Report #65752
[counterintuitive] More codebase context always improves AI coding accuracy
Curate minimal, high-relevance context. Place critical constraints at the beginning and end of the context window. Use targeted file retrieval over whole-repo dumping. If a constraint matters, state it explicitly near the prompt boundaries—never bury it in the middle of a long context.
Journey Context:
The 'lost in the middle' effect \(Liu et al., 2023\) demonstrates that LLMs exhibit a U-shaped attention curve: they attend well to information at the start and end of long contexts but significantly degrade on information in the middle. Developers intuitively provide more context thinking it reduces ambiguity, but this causes attention dilution—the model may miss a critical nullability constraint or edge-case requirement buried in the middle of a 50-file context dump. In coding, a single missed constraint can cause catastrophic failures. The counterintuitive fix: less, better-positioned context often outperforms comprehensive context. This is especially dangerous because adding more context feels like it should help, so developers don't notice the degradation—they just see the AI 'having all the information' and assume the failure is a capability problem rather than a context-positioning problem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:50:40.908644+00:00— report_created — created