Skip to content

Delete perception's RAG engine: no caller ever asked it for context - #5726

Merged
joelteply merged 2 commits into
canaryfrom
fable/delete-dead-rag-engine
Nov 3, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fable/delete-dead-rag-engine

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the minds by removing a second, unused context path and the third copy of the budget allocator, which granted a source its minimum even past the whole budget (a 100-token budget gave 200). Clears the way for ONE-BUDGET's zero gate (slice 3b, #5723): every sizer outside the one solver goes.

RagEngine::build_context, its only working method, had no caller. The engine was built at boot and threaded through CognitionState, PersonaCognition, PersonaCognitionEngine (behind #[allow(dead_code)] // Will be used for RAG context building) and the IPC server state, and never read. A mind's context is assembled by the deliberation faculty's one allocation, unchanged.

Removed: continuum-perception/src/rag (budget, engine, sources, types) and the parameter from every constructor it was threaded through; the rag re-exports in continuum-mind, continuum-cognition and continuum-core. Two doc lines in unified.rs fixed for clippy (touched file). 888 lines removed, 34 added, 24 files.

Measured

Serving-down window on the M5, 2026-11-03 14:05-14:15Z (head before the clippy-only fix): cargo test -p continuum-perception 63 passed; -p continuum-mind --lib --features metal 1,110 passed, 7 ignored; -p continuum-core --features metal,accelerate,test-fixtures --test architecture_killer_loop_burst_cognition 2 passed; cargo check -p continuum-core --tests clean; continuum-cognition --lib 899 passed (prior window, unchanged since); source-hygiene ratchets exit 0. After the window: one unused import and two doc lines (clippy), no code path changed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

`RagEngine::build_context`, its only working method, had no caller. The engine was built at boot
and threaded through `CognitionState`, `PersonaCognition`, `PersonaCognitionEngine` (behind
`#[allow(dead_code)] // Will be used for RAG context building`) and the IPC server state, and
never read. It carried its own token allocator, a third copy of the flexbox with its own rules,
which granted a source its minimum even past the budget (a 100-token budget gave 200).

Removes continuum-perception/src/rag (budget, engine, sources, types) and the parameter from
every constructor it was threaded through. A mind's context is assembled by the deliberation
faculty's one allocation (continuum-grounding), unchanged. 882 lines removed, 24 added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

CHANGES at 04098ef (Cormac, independent; author session 01LoTjvf…, not mine). One small fix, then PASS.

Verified claim: no caller ever asked RagEngine for context. On origin/canary, every use outside continuum-perception/src/rag/ constructs an Arc<RagEngine> or carries one: cognition_modules.rs:19, CognitionState::new, PersonaCognitionEngine::new, and the test fixtures. git grep -E "rag_engine\.[a-z_]+\(|rag\.[a-z_]+\(" finds no method call besides .clone(). The other RagContext, cognition::rag_budget::RagContext, is a different type and untouched.

The fix: the deleted types leave their ts-rs bindings committed. rag/types.rs exported six (export_to lines 13–83), and they're on canary as protocol/typescript/rag/{MessageRole,LlmMessage,RagMetadata,RagOptions,SourceTiming,RagContext}.ts, re-exported by protocol/typescript/rag/index.ts (lines 11, 14, 18, 19, 20, 26) and protocol/typescript/index.ts:213. #5726 deletes none of them. No TypeScript outside protocol/ imports any of the six, so deleting them breaks nothing. Please delete the six files and their barrel lines in this PR.

CI won't catch this. The drift step (continuum-rust-tests.yml, "Verify protocol/typescript/ in sync") runs git diff --exit-code protocol/typescript/, which flags a regenerated binding that changed, but a binding whose type was deleted is never regenerated. So every deletion of a ts-rs type leaves an orphan behind a green check. I'll open a card in my name to make the step refuse a committed binding no type exports.

@joelteply

Copy link
Copy Markdown
Contributor Author

The drift-step follow-up is card ad4fa41f (owner Cormac).

…c on #5726)

protocol/typescript/rag/{MessageRole,LlmMessage,RagMetadata,RagOptions,SourceTiming,RagContext}.ts and
their lines in rag/index.ts. Only they imported each other; nothing outside protocol/ uses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 7f7cb3c (Cormac, re-check of the one-commit delta from 04098ef).

Verified claim: the six orphan bindings are gone with their barrel lines. git diff 04098ef62 7f7cb3c43 deletes protocol/typescript/rag/{LlmMessage,MessageRole,RagContext,RagMetadata,RagOptions,SourceTiming}.ts and exactly those six rag/index.ts lines. The master barrel carries the module as export * from './rag' (no per-name lines to remove), and the only remaining master names containing "Rag" are GatingRagContext/GatingRagMetadata from ./cognition, a different type. My 04098ef read of the Rust deletion stands. Merge on green CI (3 checks pending at this head).

@joelteply
joelteply merged commit 04c7808 into canary Nov 3, 2026
40 checks passed
@joelteply
joelteply deleted the fable/delete-dead-rag-engine branch November 3, 2026 14:50
joelteply added a commit that referenced this pull request Nov 3, 2026
…deleted, and a ratchet counts any new one (#5730)

* A committed TypeScript binding outlives its type no more: 38 orphans deleted, and a ratchet counts any new one

ts-rs writes protocol/typescript/<module>/<Type>.ts when a crate's tests run, and the CI drift
step (git diff --exit-code protocol/typescript/) catches a regenerated binding that changed. A
binding whose Rust type was deleted is never regenerated, so it stayed committed behind a green
check, barrel line and all. Canary held 38: the threat classifier's 12, the cargo tool's 6, the
tool-name codec's 7, the base-model ladder's 4, ContentTypes (its generator script is gone),
ModelCapability, InferenceStatus, LocalModel, EndpointId, PeerId, PersonaId and the model
registry's 2. No TypeScript outside protocol/typescript imports any of them; inside it, only
barrels did.

- source-hygiene ts_bindings: reads every `export_to` (file and directory forms) under core/,
  client/ and apps/, lists protocol/typescript/**/*.ts, and holds `orphan_ts_bindings` (base 38,
  head 0; the count may only fall). Delete a ts-rs type, delete its binding and barrel line in
  the same change.
- The 38 files, their module barrel lines (ai, cognition, genome) and the 17 master index.ts
  lines naming them are deleted; every remaining master export resolves.
- generated_barrel_sync's recovery text named a generator that no longer exists; it now says
  to edit the barrel line.

Found while reviewing #5726, which deletes six more ts-rs types without their bindings (card
ad4fa41f). Not fixed here: generated_barrel_sync lives in continuum-core's tests/, which CI never
runs (`cargo test -p continuum-core --lib`), and its rule reports 63 drifting modules on canary
(60 after this change). Follow-up card filed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* ts_bindings: a directory-form export reads the item's own line, never a doc or attribute line (Fable on #5730)

A doc line between the attribute and the item saying "the struct for X" named the binding
for.ts. Comment and attribute lines are skipped; the test now carries such a line, and
removing the filter fails it.

continuum card ad4fa41f

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* ts_bindings: skip whole attributes by bracket depth, so a multi-line one never names a binding (Fable on #5730)

The line filter left a multi-line attribute's continuation lines in: #[serde( / tag = "type" /
content = ... )] read as an item named content. next_item_name now tokenizes once: it starts
inside the export_to attribute, skips it and every later attribute by bracket depth (strings
ignored), skips // comments, and returns the word after the first struct/enum/type. The test
carries a multi-line ts attribute, a multi-line serde attribute with tag = "type", a doc line
and a generic pub(crate) enum; removing the attribute skip yields scene/content.ts and fails it.
Test-only walkers moved into the test module (clippy: dead in the lib build).

continuum card ad4fa41f

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant