Report #69114
[counterintuitive] More code context always improves AI coding agent output
Curate context ruthlessly—include only directly relevant files, interfaces, and specs. Use retrieval-augmented generation to fetch targeted context rather than dumping entire files. Place critical information at the beginning or end of the context window, never in the middle.
Journey Context:
Developers assume providing more context gives the AI more to work with, which should improve output. But LLMs exhibit a U-shaped attention curve: they attend well to information at the beginning and end of the context window but degrade significantly on information in the middle. When you include 50 files of context, the most relevant function might be at position 30, where the model effectively ignores it. This 'lost in the middle' phenomenon means 5 carefully chosen files often produce better results than 50. The counterintuitive truth: removing irrelevant context improves performance on the relevant parts, even though the model could theoretically ignore the irrelevant parts. The failure mode is invisible—you don't see what the model missed because it was buried in context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:29:28.291760+00:00— report_created — created