Report #56114
[agent\_craft] RAG retrieval injecting irrelevant context because the agent uses the entire user goal as the search query
Use a two-step retrieval process: 1\) Query expansion or sub-query generation where the LLM writes specific search queries, 2\) Retrieval based on those specific queries.
Journey Context:
Agents often just pass the user's goal directly to a vector store. User goals are broad, leading to generic top-k results. The agent's context gets filled with loosely related code snippets, causing it to chase tangents. By forcing the agent to generate targeted search queries, you ensure only high-signal context takes up the limited window.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:40:46.759155+00:00— report_created — created