Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix(library): index user documents and remove stale excluded rows
IgnoreMeButca166dffa8d8
diff --git a/src/main/features/kb_indexer.ts b/src/main/features/kb_indexer.tsindex 01414a79..b037aa59 100644--- a/src/main/features/kb_indexer.ts+++ b/src/main/features/kb_indexer.ts@@ -64,7 +64,7 @@ function corpusFor(uid: string): LibraryCorpus {imageSessionPrefix: 'extract-img',// Root-level `_INDEX.md` is generated for Finder browsing, and subdirectory// copies are pre-vector-store legacy — neither is KB content.- skipRelPath: (relPath) => relPath.endsWith('_INDEX.md'),+ skipRelPath: (relPath) => path.posix.basename(relPath) === '_INDEX.md',emit: (event: CorpusStatusEvent) => {const out: KbStatusEvent = {userId: uid,diff --git a/src/main/features/library_corpus.ts b/src/main/features/library_corpus.tsindex 09d7c59b..c7fec6c7 100644--- a/src/main/features/library_corpus.ts+++ b/src/main/features/library_corpus.ts@@ -307,7 +307,10 @@ function createCorpus(spec: CorpusSpec): LibraryCorpus {if (discarded()) return;const safe = safeCorpusRelPath(relPath);if (!safe) return;- if (spec.skipRelPath?.(safe)) return;+ // Skipped paths are never indexed, but a row indexed before the skip rule+ // (or under an older rule) must still be deletable, or reconcile keeps a+ // stale searchable row forever.+ if (op === 'upsert' && spec.skipRelPath?.(safe)) return;if (op === 'upsert' && !libraryKindFor(safe)) return;const existing = queue.jobs.find((job) => job.relPath === safe && job.op === op);if (existing) {diff --git a/test/main/features/kb_indexer.test.ts b/test/main/features/kb_indexer.test.tsindex 212259cf..6f3c696b 100644--- a/test/main/features/kb_indexer.test.ts+++ b/test/main/features/kb_indexer.test.ts@@ -491,19 +491,37 @@ describe('kb_indexer › reconcile', () => {writeCtx('.hidden/junk.md', 'should be skipped'); // dot-dir (same rule as .kb/)writeCtx('_INDEX.md', '# index'); // generated filewriteCtx('sub/_INDEX.md', '# sub index'); // legacy subdir index (also .md but name-filtered)+ writeCtx('docs/API_INDEX.md', '# a user document whose name merely ends in _INDEX.md');const idx = await import('../../../src/main/features/kb_indexer');const r = await idx.reconcile(TEST_UID);- expect(r.enqueuedUpsert).toBe(1);+ expect(r.enqueuedUpsert).toBe(2);await idx.drain(TEST_UID);const kb = await import('../../../src/main/features/kb_vector');expect(kb.getFileByPath(TEST_UID, 'a.md')).not.toBeNull();+ expect(kb.getFileByPath(TEST_UID, 'docs/API_INDEX.md')).not.toBeNull();expect(kb.getFileByPath(TEST_UID, '_INDEX.md')).toBeNull();expect(kb.getFileByPath(TEST_UID, 'sub/_INDEX.md')).toBeNull();expect(kb.getFileByPath(TEST_UID, '.hidden/junk.md')).toBeNull();});+ it('still deletes a previously indexed row whose path the skip rule now excludes', async () => {+ // A row indexed under an older rule must not stay searchable forever just+ // because new upserts of that path are skipped.+ const kb = await import('../../../src/main/features/kb_vector');+ const idx = await import('../../../src/main/features/kb_indexer');+ await kb.setFileStatus(TEST_UID, 'sub/_INDEX.md', 'ready', {+ kind: 'text', bytes: 1, mtime: 1, sha1: 'stale', error: '',+ });+ expect(kb.getFileByPath(TEST_UID, 'sub/_INDEX.md')).not.toBeNull();++ const r = await idx.reconcile(TEST_UID);+ expect(r.enqueuedDelete).toBe(1);+ await idx.drain(TEST_UID);+ expect(kb.getFileByPath(TEST_UID, 'sub/_INDEX.md')).toBeNull();+ });+it('re-enqueues files previously marked failed', async () => {const kb = await import('../../../src/main/features/kb_vector');const idx = await import('../../../src/main/features/kb_indexer');