Report #10197
[agent\_craft] Agent retrieves irrelevant documentation chunks that pollute the context window
Implement a two-stage retrieval router: first, a lightweight classifier determines which tool or knowledge base to query; second, the actual vector search happens. Never dump unfiltered RAG results directly into the context.
Journey Context:
A common mistake is to treat RAG as a single step: embed the query, search, and dump top-K results into the prompt. If the agent is working on a Python backend but the retriever pulls React frontend docs because of a shared keyword, the context gets polluted. A router ensures the retrieval is scoped correctly before it ever touches the context window.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:07:20.584630+00:00— report_created — created