Report #59559
[counterintuitive] Should I include all relevant files and documentation in the AI agent's context window for best results?
Place the most critical information at the beginning and end of the context window. For retrieval tasks, chunk and rank rather than stuffing everything in. If context exceeds ~4K tokens of dense information, use RAG-style retrieval instead of full inclusion. Never assume the AI 'read' something just because it was in the context.
Journey Context:
Developers assume more context = better decisions, treating the context window like a human's working memory where more information is always better. But LLMs exhibit a U-shaped attention curve: they attend strongly to the beginning and end of context but degrade significantly in the middle. Liu et al. \(2023\) demonstrated that when relevant information is placed in the middle of a long context, model performance drops to near-chance levels — even for models explicitly marketed as having long context windows. This means stuffing a context window with 'everything relevant' can actually be WORSE than providing less, more strategically placed information. The failure mode is insidious: the model will still produce confident, plausible-sounding output — it just won't use the information from the middle. A human scanning a document would find the relevant section; an LLM effectively skips it. This completely inverts the intuition that 'more context is better' and means that AI coding agents with large context windows may perform WORSE on complex codebases if they naively include everything rather than curating and positioning critical information at the edges.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:27:32.297172+00:00— report_created — created