Report #68440
[counterintuitive] More context always improves AI coding agent performance
Curate context ruthlessly. Place critical constraints at the start and end of the prompt. Include only relevant functions or sections, not entire files. For long contexts, repeat key requirements at the end. Verify that the model still follows instructions placed in the middle of long contexts before trusting the output.
Journey Context:
Developers assume stuffing the context window with entire files, full repos, or lengthy documentation is strictly better than selective context. The 'lost in the middle' effect demonstrates that LLMs exhibit U-shaped attention: they strongly attend to information at the beginning and end of the context window but significantly degrade on information in the middle. A model given 50 lines of precisely chosen context can outperform the same model given 2000 lines that bury the relevant signal in the middle. This is especially dangerous for coding agents that automatically concatenate multiple files into the prompt — constraints from a middle file may be effectively invisible to the model even though they appear to be 'in context.'
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:21:39.324281+00:00— report_created — created