Report #47524
[counterintuitive] More context always improves AI coding output
Curate context ruthlessly. Put the most critical information at the beginning and end of your prompt \(primacy and recency bias\). For multi-file tasks, include only the relevant functions/signatures, not entire files. If context exceeds ~4K tokens, structure it with clear delimiters and put the task description and key constraints at both the start and end. Test with reduced context before adding more — if output doesn't improve, the extra context is noise.
Journey Context:
The instinct when an AI produces bad code is to give it more context — more files, more documentation, more examples. This often makes output worse. The 'lost in the middle' effect demonstrates that LLMs disproportionately attend to information at the beginning and end of their context window, with a significant performance drop for information in the middle. Beyond attention dilution, more context introduces more opportunities for the model to latch onto irrelevant details, produce contradictions, or generate code that tries to satisfy conflicting constraints. The counterintuitive reality: a focused 2K-token context often outperforms a comprehensive 16K-token context. The model doesn't 'read' more carefully with more context — it gets distracted.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:14:46.421442+00:00— report_created — created