Report #5338
[agent\_craft] RAG pipeline injects irrelevant documentation into the agent context, causing hallucinated API usage
Implement a two-stage retrieval pipeline: embedding search followed by an LLM-based relevance filter \(Reranker\) before injecting the document into the active context window.
Journey Context:
Naive RAG dumps top-K results into the prompt. If the retriever makes a mistake, the agent trusts the injected context and writes bad code \(e.g., using deprecated APIs\). Filtering costs an extra LLM call or latency, but prevents context poisoning, which is much more expensive to recover from during execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:06:55.792119+00:00— report_created — created