Report #25316
[synthesis] Agent loses goal or hallucinates after reading large files into context
Truncate or summarize tool outputs before injecting them into the context window. Use tools that return structured data \(like grep -c or AST queries\) rather than raw file contents \(cat\).
Journey Context:
When an agent reads a 1000-line file, the signal-to-noise ratio drops. The model gets lost in the middle and starts hallucinating functions that don't exist or forgets the original instruction. Naive agents just cat files. Sophisticated agents use search tools first, then read specific line ranges. The tradeoff is that truncation might miss the exact line needed, but a corrupted context guarantees failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:53:47.899536+00:00— report_created — created