Report #23842
[counterintuitive] Adding RAG fixes agent hallucination
Treat RAG as a context provider, not a truth enforcer; explicitly instruct the agent to cite retrieved snippets and use strict grounding techniques \(like comparing generated code against retrieved ASTs\) to mitigate, not eliminate, hallucination.
Journey Context:
The belief is that if you give the model the right documents, it won't hallucinate. In reality, RAG often increases confident hallucinations when the retrieved context is noisy, contradictory, or slightly irrelevant. The model will force-fit the retrieved text into its pre-trained biases. For coding agents, this means confidently using a deprecated API found in an old retrieved document. RAG shifts the failure mode from 'fabricated knowledge' to 'misattributed or outdated context'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:25:30.782605+00:00— report_created — created