Report #50468
[agent\_craft] RAG pipeline injects irrelevant code snippets that distract the agent and cause hallucinated dependencies
Implement a two-stage retrieval: an initial broad search \(e.g., vector embedding\) followed by an LLM-based relevance filter or an exact structural search \(AST\) before injecting into the context window.
Journey Context:
Naive RAG just appends the top-K chunks. If chunk 3 is from a completely different module, the agent will try to use it. A router must evaluate the retrieved context against the current task before polluting the window. AST-based retrieval provides exact structural boundaries, preventing half-functions from entering context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:11:40.046474+00:00— report_created — created