Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): stop classifying skill bundles as hidden files (PRD-7802) (#3212)

tim-inkeepc5731e4bf13a
diff --git a/packages/app/src/components/file-tree-utils.test.ts b/packages/app/src/components/file-tree-utils.test.ts
index 593a6b7c0..1927fc2d4 100644
--- a/packages/app/src/components/file-tree-utils.test.ts
+++ b/packages/app/src/components/file-tree-utils.test.ts
@@ -145,6 +145,22 @@ describe('filterVisibleEntries', () => {
expect(filterVisibleEntries(entries, { showHiddenFiles: true })).toEqual(entries);
});
+ test('skill bundle files stay out of the tree even with showHiddenFiles on', () => {
+ // Skills are addressed through the Skills panel. They leave the tree on
+ // their own axis now that the hidden-files axis no longer claims them, so
+ // flipping Hidden files must not drag a bundle into the render set.
+ const entries = [
+ { kind: 'document' as const, docName: 'README' },
+ { kind: 'document' as const, docName: '.agents/skills/consolidate-notes/SKILL' },
+ { kind: 'document' as const, docName: '.claude/skills/consolidate-notes/references/x' },
+ { kind: 'asset' as const, path: '.codex/skills/consolidate-notes/scripts/run.sh' },
+ ];
+ for (const showHiddenFiles of [false, true])
+ expect(filterVisibleEntries(entries, { showHiddenFiles })).toEqual([
+ { kind: 'document', docName: 'README' },
+ ]);
+ });
+
test('returns empty array when every entry is hidden', () => {
expect(
filterVisibleEntries([
@@ -406,6 +422,27 @@ describe('attributeTreeHiddenAxes', () => {
).toEqual(none);
});
+ test('an open project skill attributes nothing in every axis cell', () => {
+ // The regression: a skill opened from the Skills panel showed
+ // "Not in sidebar → Hidden files" above its properties. Flipping that
+ // toggle only silenced the chip and revealed every dotfile in the repo —
+ // it could never give the skill a tree row, because skills do not have
+ // one. Applies to every bundle file, `scripts/**` included.
+ for (const entry of [
+ { kind: 'document' as const, docName: '.agents/skills/consolidate-notes/SKILL' },
+ { kind: 'document' as const, docName: '.claude/skills/ai-sdk/references/gateway' },
+ { kind: 'asset' as const, path: '.codex/skills/ai-sdk/scripts/run.sh' },
+ ]) {
+ for (const showHiddenFiles of [false, true]) {
+ for (const showOnlyMarkdownFiles of [false, true]) {
+ expect(
+ attributeTreeHiddenAxes(entry, { showHiddenFiles, showOnlyMarkdownFiles }),
+ ).toEqual(none);
+ }
+ }
+ }
+ });
+
test('non-markdown file attributes only-markdown when the toggle is on', () => {
expect(
attributeTreeHiddenAxes({ kind: 'asset', path: 'data.csv' }, { showOnlyMarkdownFiles: true }),
diff --git a/packages/app/src/components/file-tree-utils.ts b/packages/app/src/components/file-tree-utils.ts
index afa28a79b..e21925fe2 100644
--- a/packages/app/src/components/file-tree-utils.ts
+++ b/packages/app/src/components/file-tree-utils.ts
@@ -5,6 +5,7 @@ import {
type InlineAssetMediaKind,
isHiddenDocName,
isManagedArtifactDocName,
+ isProjectSkillBundlePath,
} from '@inkeep/open-knowledge-core';
export interface DocumentEntry {
@@ -316,6 +317,11 @@ export function filterVisibleEntries<T extends { kind?: unknown; docName?: strin
const ancestorPath = segments.slice(0, okIndex).join('/');
return showHiddenFiles || ancestorPath === '' || !isHiddenDocName(ancestorPath);
}
+ // Skill bundles are addressed through the Skills panel and have no tree
+ // row. They are dropped here rather than by the hidden-files axis, which
+ // deliberately no longer classifies them: living in a dot-dir is how a
+ // harness finds a skill, not a statement that it is incidental content.
+ if (isProjectSkillBundlePath(ref)) return false;
return !failsHiddenFilesAxis(ref, showHiddenFiles);
});
}
@@ -339,7 +345,12 @@ export function attributeTreeHiddenAxes(
): { hiddenFiles: boolean; onlyMarkdownFiles: boolean } {
const { showHiddenFiles = false, showOnlyMarkdownFiles = false } = visibility;
const ref = entry.docName ?? entry.path ?? '';
- if (ref === '' || isManagedArtifactDocName(ref) || hasOkPathSegment(ref)) {
+ if (
+ ref === '' ||
+ isManagedArtifactDocName(ref) ||
+ isProjectSkillBundlePath(ref) ||
+ hasOkPathSegment(ref)
+ ) {
return { hiddenFiles: false, onlyMarkdownFiles: false };
}
return {
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index fee3dc91a..e25463ef3 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -1329,6 +1329,7 @@ export type {
export {
HIDDEN_CONFIG_BASENAMES,
isHiddenDocName,
+ isProjectSkillBundlePath,
isValidDocName,
validateDocName,
} from './util/doc-name.ts';
diff --git a/packages/core/src/util/doc-name.test.ts b/packages/core/src/util/doc-name.test.ts
index 6b707b73a..6d6c72bb4 100644
--- a/packages/core/src/util/doc-name.test.ts
+++ b/packages/core/src/util/doc-name.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, test } from 'vitest';
import {
HIDDEN_CONFIG_BASENAMES,
isHiddenDocName,
+ isProjectSkillBundlePath,
isValidDocName,
validateDocName,
} from './doc-name.ts';
@@ -28,9 +29,23 @@ describe('isHiddenDocName', () => {
// `opencode.json` ancestor segment counts as hidden.
'opencode.jsonx',
'opencode.json/notes',
+ // Skill bundle CONTENT is not hidden: the dot-dir is how a harness finds
+ // the skill, so classifying it hidden cost skills their search rank,
+ // embeddings, egress, and `[[` autocomplete entry.
+ '.agents/skills/consolidate-notes/SKILL',
+ '.claude/skills/consolidate-notes/references/deep-dive',
+ '.codex/skills/consolidate-notes/scripts/run',
+ '.ok/skills/stored-skill/SKILL',
])
test(`visible: ${JSON.stringify(name)}`, () => expect(isHiddenDocName(name)).toBe(false));
+ test('the skill carve-out admits bundle files without admitting the dot-dir itself', () => {
+ // The bundle DIR row stays hidden (no tree row of its own); only files
+ // INSIDE a bundle are carved out.
+ expect(isHiddenDocName('.cursor/skills/x')).toBe(true);
+ expect(isHiddenDocName('.cursor/skills/x/SKILL')).toBe(false);
+ });
+
test('HIDDEN_CONFIG_BASENAMES contains the seeded opencode.json agent config', () => {
expect(HIDDEN_CONFIG_BASENAMES.has('opencode.json')).toBe(true);
});
@@ -73,3 +88,28 @@ describe('validateDocName', () => {
});
}
});
+
+describe('isProjectSkillBundlePath', () => {
+ for (const name of [
+ '.agents/skills/consolidate-notes/SKILL',
+ '.claude/skills/a/references/b/c',
+ '.codex/skills/a/scripts/run.sh',
+ '.ok/skills/a/SKILL',
+ ])
+ test(`bundle file: ${JSON.stringify(name)}`, () =>
+ expect(isProjectSkillBundlePath(name)).toBe(true));
+
+ for (const name of [
+ // The bundle dir and its ancestors are not bundle FILES.
+ '.agents/skills',
+ '.agents/skills/consolidate-notes',
+ // `skills/` must sit directly under a single dot-segment root.
+ 'skills/a/SKILL',
+ 'notes/.agents/skills/a/SKILL',
+ // A global skill keeps the synthetic managed-artifact namespace.
+ '__skill__/global/a',
+ 'Characters/Spike Spiegel',
+ ])
+ test(`not a bundle file: ${JSON.stringify(name)}`, () =>
+ expect(isProjectSkillBundlePath(name)).toBe(false));
+});
diff --git a/packages/core/src/util/doc-name.ts b/packages/core/src/util/doc-name.ts
index 6faaefb72..c98887bb3 100644
--- a/packages/core/src/util/doc-name.ts
+++ b/packages/core/src/util/doc-name.ts
@@ -74,6 +74,26 @@ export function isValidDocName(name: string): boolean {
*/
export const HIDDEN_CONFIG_BASENAMES: ReadonlySet<string> = new Set(['opencode.json']);
+// Any file inside a project skill bundle, under either skill root shape: the
+// `.ok/skills` store or an in-place editor dir (`.claude/skills`,
+// `.agents/skills`, `.codex/skills`, …). Shape-matched on `.<root>/skills/<name>/`
+// so there is no editor list to keep in lock-step. Broader on purpose than
+// `parseProjectSkillBundleDoc`, which admits only the graph-node docs (`SKILL`
+// + `references/**`): the hidden-file question is about the whole bundle,
+// `scripts/**` included.
+const PROJECT_SKILL_BUNDLE_PATH_RE = /^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;
+
+/**
+ * Whether a path addresses a file inside a project skill bundle. Skills are
+ * forced into dot-directories because that is where each harness discovers
+ * them (`.claude/skills`, `.cursor/skills`, …) — the dot is a consequence of
+ * the discovery contract, not a signal that the content is incidental. Callers
+ * that mean "content the user did not author" must exclude these.
+ */
+export function isProjectSkillBundlePath(name: string): boolean {
+ return PROJECT_SKILL_BUNDLE_PATH_RE.test(name);
+}
+
/**
* Whether a docName addresses a hidden file — any `/`-segment starts with `.`
* (`.claude/`, `.cursor/`, `.obsidian/`, a top-level `.foo`), or its basename
@@ -87,8 +107,15 @@ export const HIDDEN_CONFIG_BASENAMES: ReadonlySet<string> = new Set(['opencode.j
* mirroring the file tree's `showHiddenFiles` default-off. Deliberately NOT
* applied to listings / backlinks: the read guard stays lenient, so hidden
* docs remain editable and addressable directly.
+ *
+ * Skill bundles are carved out ({@link isProjectSkillBundlePath}): they sit in
+ * dot-dirs only because harness discovery puts them there, and classifying
+ * them as incidental cost them their search rank, their embeddings, their
+ * egress, and their `[[` autocomplete entry. The file tree hides them on its
+ * own axis — they have a dedicated Skills panel — not through this predicate.
*/
export function isHiddenDocName(name: string): boolean {
+ if (isProjectSkillBundlePath(name)) return false;
if (name.split('/').some((segment) => segment.startsWith('.'))) return true;
return HIDDEN_CONFIG_BASENAMES.has(name.slice(name.lastIndexOf('/') + 1));
}