Report #83635
[counterintuitive] More context in the prompt always improves AI coding output
Be surgical with context. Include only directly relevant code, interfaces, and specifications. Strip unrelated files, large data structures, and tangential documentation. When context exceeds ~4K tokens of relevant material, verify that the AI is actually using information from the middle of the context, not just the beginning and end.
Journey Context:
Developers assume that giving AI 'the whole codebase' or 'all relevant files' will produce better results. In reality, language models suffer from the 'lost in the middle' phenomenon: they attend disproportionately to the beginning and end of their context window, with performance degrading significantly for information in the middle. More context also means more confounding patterns for the model to navigate. The sweet spot is often much less context than people think — just the function being modified, its direct callers/callees, and the relevant type definitions. Adding the whole file or module often hurts more than it helps because the model anchors on irrelevant patterns in the surrounding code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:57:49.768520+00:00— report_created — created