Report #38258
[agent\_craft] Agent retrieves too many code snippets via RAG and gets confused by irrelevant snippets, leading to hallucinated integrations
Use a two-step retrieval: a fast, high-recall search \(e.g., BM25 or embedding\) followed by a lightweight LLM call or strict keyword filter to rerank and prune snippets before injecting them into the main agent context. Keep the context-to-task ratio high.
Journey Context:
The instinct is 'more context is better.' But irrelevant context is noise that degrades the agent's reasoning. A router that strictly filters down to only what is strictly necessary for the current sub-task prevents the agent from trying to use an irrelevant class just because it was in the context. Precision matters more than recall for in-window context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:41:45.914824+00:00— report_created — created