Skip to content

refactor(cortex): remove the notes index - #6775

Merged
hurttlocker merged 1 commit into
mainfrom
del/notes-index
Nov 25, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
del/notes-index

Conversation

@hurttlocker

Copy link
Copy Markdown
Collaborator

Owner decision 2026-11-24 (item 15): cut the notes index. Agents search files on demand, so o8 no longer reads markdown note folders into Brain facts.

Removed

  • The knowledge-rescan loop (60 s timer) and the fs.watch on note folders that started with the repo doc watcher.
  • Note reading, chunk distillation (the distill model call), and reconciliation on settings saves (src/lib/cortex/knowledge/{index,read-notes,reconcile,sources-route,answer-validity}.ts).
  • /api/cortex/sources (route and registry entry), the cortex_knowledge_sources MCP tool, and o8 brain sources.
  • The answer-validity guard, which only fired for note-derived facts. The facts retriever now skips source_kind = 'knowledge' facts, so old note facts no longer reach answers.

Kept

  • The knowledgeSources setting and its write guard (assertNotKnowledgeSource, knowledgeSourceWriteRefusal, root validation, operator-only edits). Twelve writers still use it to keep agents out of protected folders.
  • Cortex facts, directives and proposals; the repo doc watcher.
  • The knowledge_chunks table and existing rows, untouched on disk.

There was no native Knowledge sources settings page or Brain dock piece for it. The native settings window and Brain dock never showed sources, so nothing changed there. The phone app does not call any removed route.

Tests

  • Deleted tests/knowledge-sources-real-path.test.ts (covered only the removed indexer) and the reconciliation cases in o8d-settings-window-owner and o8d-knowledge-owner.
  • knowledge-source-direct-writers: the source-admission case now goes through the settings writer and asserts the same refusal.
  • Local: typecheck:fast, lint, the nine enumerating suites, and verify:ci integration (changed files) pass. Two failures, mcp-deferred-tools (tool-count floor) and o8d-cortex-ask-answer-native (401 vs 403), fail the same way on main. Neither file is changed.

🤖 Generated with Claude Code

Owner decision 2026-11-24: agents search files on demand, so o8 no longer
indexes markdown note folders into Brain facts.

Removed:
- the knowledge-rescan loop (60 s) and the fs.watch on note folders started
  with the repo doc watcher
- note reading, chunk distillation, and reconciliation on settings saves
- the /api/cortex/sources route, its MCP tool (cortex_knowledge_sources) and
  the `o8 brain sources` CLI command
- the answer-validity guard that only fired for note-derived facts; the facts
  retriever now skips facts whose source is a note folder

Kept: the knowledgeSources setting and its write guard (assertNotKnowledgeSource,
operator-only edits, root validation), which still keep agents from writing into
protected folders. Cortex facts, directives and proposals are unchanged. The
knowledge_chunks table and existing facts stay on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hurttlocker hurttlocker added the tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional label Nov 25, 2026
@github-actions github-actions Bot added the size/L Pull request with L diff size label Nov 25, 2026
@github-actions

Copy link
Copy Markdown

📝 o8.run docs may need updating

This PR changes source that the public docs describe. Review whether these pages are still accurate (and bump their stamp in o8-site if so):

  • The Brain the-brain — tracks src/lib/cortex/qa/ask.ts, src/lib/cortex/qa/citations.ts, src/lib/cortex/qa/compose-class-b.test.ts, src/lib/cortex/qa/compose-class-b.ts, src/lib/cortex/qa/compose-connected.ts, src/lib/cortex/qa/retrievers/facts.ts, src/lib/cortex/indexer/doc-watcher.ts
  • The CLI cli — tracks cli/src/index.ts, cli/src/commands/brain-sources.ts

Flagged by docs-drift against https://o8.run/api/docs/manifest. Docs only — nothing is auto-edited.

@github-actions

Copy link
Copy Markdown

🔍 PR Review Bot

Metric Value
Files changed 32
Additions +21
Deletions -807
New files 0

Note: This PR touches 32 files. Consider splitting into smaller PRs.


Automated review — CI workflow

@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit e48512f Nov 25, 2026
36 of 37 checks passed
@hurttlocker
hurttlocker deleted the del/notes-index branch November 25, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Pull request with L diff size tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant