Context & Retrieval
Context Engineering
Curating and maintaining the right set of tokens in the window during a task, not just wording one prompt.
Context engineering is deciding what goes in the model’s window on each call: nothing missing, nothing extra. Four things compete for a fixed number of tokens. The instructions, the knowledge you fetched, the conversation so far, and the tool descriptions. Every system built on a model carries all four. Choosing what to include this turn is the engineering.
Difficulty scales with turn count. A one-shot call assembles the window once, so structure is most of the work. An agent rebuilds it every turn and appends the last turn’s tool output. By turn twenty the window is mostly transcript and the turn-one instructions are near its middle. Recall is lowest there, an effect named lost in the middle. An instruction can be loaded and still not change the answer.
The working rules are subtractive. Only add what the model does not already know. Drop what no longer changes the answer: superseded instructions, spent tool output, abandoned approaches. A window that keeps them is where context rot begins and where the model starts filling gaps with invention. Every token left in is re-read on every call, so the lean window is cheaper and more accurate.