Context engineering
Choosing what goes into the model's working memory is now a bigger lever than how you phrase the request.
Bigger windows, same problem
Context windows have grown to a million tokens on frontier models. That has not made context management unnecessary. Independent testing across eighteen models found that performance degrades unevenly as input grows, and well before the stated limit is reached. Degradation gets worse when the relevant passage is not phrased like the question, and worse again when plausible-but-irrelevant material is present.
The practical reading is simple. Treat the context window as a working surface you curate, not a bucket you fill.
Ordering matters, measurably
Put long documents at the top of the prompt and your actual question at the end. Anthropic reports this can improve response quality substantially on complex, multi-document inputs, and Google gives the same ordering advice for Gemini. Asking the model to extract the relevant quotes before answering also helps, because it forces attention onto the passages that matter.
Include
- The source material the task depends on
- Terms with a meaning specific to you
- Examples of the quality you expect
- Decisions that are settled and should not be reopened
Cut or summarise
- Long history with no bearing on the task
- Duplicates and near-duplicates
- Material “just in case”
- Whole documents where one section would do
Long sessions need maintenance
In an extended conversation or an agent run, context accumulates: old tool output, abandoned attempts, superseded instructions. The failure mode is not always a wrong answer. Recent work on long-horizon search found that excess context can make models give up or answer prematurely rather than degrade gracefully.
So compact deliberately. Summarise what has been established, drop what is resolved, and start a fresh session when the thread has drifted. Several current models can now report how much of their context budget remains, which makes this easier to manage.
Sources
- Chroma: context rot — independent testing across 18 models, July 2025
- Anthropic: effective context engineering — the write, select, compress, isolate framing
- A survey of context engineering — academic overview of the field