Problem
Workspace-scoped queries send all DocCards to the Orchestrator's LLM analysis phase in a single prompt. At 1000+ documents this exceeds token budgets, is expensive, and LLM selection quality degrades.
Proposal
Add a Router layer between Engine.query() and the Orchestrator that pre-filters documents using compile-stage artifacts (DocCard, ReasoningIndex, DocumentGraph) before LLM analysis.
- BM25 on DocCard text for lexical matching
- Keyword overlap using QueryPlan concepts vs ReasoningIndex topics
- Graph boost from cross-document relationships
- Optional LLM-assisted re-ranking of top candidates
- Only activates when workspace exceeds configurable threshold (default: 20 docs)
Full RFC
See docs/rfc/router
Acceptance Criteria
Open Questions
- Score normalization strategy across different corpus sizes
- Cold start handling for new documents (no graph edges)
- Thread safety model for mutable BM25 index (
RwLock vs rebuild-on-query)
Problem
Workspace-scoped queries send all DocCards to the Orchestrator's LLM analysis phase in a single prompt. At 1000+ documents this exceeds token budgets, is expensive, and LLM selection quality degrades.
Proposal
Add a Router layer between
Engine.query()and the Orchestrator that pre-filters documents using compile-stage artifacts (DocCard, ReasoningIndex, DocumentGraph) before LLM analysis.Full RFC
See docs/rfc/router
Acceptance Criteria
rust/src/router/module withDocumentRouter,RouteResult,RouterConfigEngine.query()with activation thresholdOpen Questions
RwLockvs rebuild-on-query)