Context engineering
Choosing what goes into the model's context window, in what order, and what to leave out, because the model sees nothing else.
Read first: Tokens & tokenization, How a model predicts the next token.
D1 · StoryFor young children and total beginners
The AI can only use what is in front of it right now. That space is called its context, and it has a size limit.
Context engineering is deciding what to put in that space: the instructions, the right notes and the question, in a sensible order.
Like: Packing a small school bag for the day.
D2 · PictureFor curious beginners
Every model call is built from parts: a system prompt with rules and role, tool descriptions, retrieved documents, memory, the conversation so far and the latest message.
All of it must fit in the context window, which is measured in tokens. Long contexts cost more, run slower, and models can miss details buried in the middle.
So the application budgets space, trims or summarises old turns, and keeps stable parts (system prompt, tool list) at the start so a cached prefix can be reused.
Like: Packing a small school bag for the day.
Where it breaks: A bag holds things you can dig out later. A model has no bag outside the window: anything left out simply does not exist for that call, and stuffing in more can make it notice less.
D5 · FrontierFor experts
Bigger context windows do not remove the problem: models use information unevenly across a long context, and quality can drop well before the limit.
Open questions: how to compact long agent sessions without losing what matters, how to measure whether context was actually used, and how to keep untrusted text from carrying instructions.