Context engineering is deciding what goes into the model's context window at each step and what stays out: instructions, rules files, tool results, history, retrieved documents and summaries. With an agent that works over many steps, it matters more than the exact wording of the prompt, because the model only knows what reaches it.
📚Everything available→✂️You choose what goes in→📏It fits the window→🤖The model decides
Put it to the test
A question from the app. Pick an answer.
The plan is approved, but the chat drags along three failed attempts. How do you go on?
It gets what helps and none of the noise. The approved plan is already the summary worth carrying over.
It does, but the failed attempts are still in its context and can pull it back to an idea you already dropped.
It is the same noise in another window. Passing everything is not passing what matters.
Writing a good prompt is taking care of your request. In a short chat, the request is almost everything the model sees. In a coding agent on step 30, your request is a small part of the context window: there are also its instructions, the project rules, the description of each tool, what the previous 29 steps returned and the conversation.
The agent picks its next step by looking at all of that together. If a fact is missing there, or there is too much noise, the best prompt will not save it. That is why people talk about context engineering: the job is shaping what the model sees at every step, not just the sentence you start with.
What goes in, and how
The fixed part, loaded every time: a file like CLAUDE.md, kept short, with what the code does not say. What gets pulled in when needed: a file the agent opens, the chunks a RAG search finds, or a skill that loads its instructions only for that task.
And what gets trimmed: a 5,000 line log goes in better as the 20 lines with the error; a long conversation, as a summary; a search that reads half the repo, in a subagent that returns only what it found.
More is not better
A full window costs more tokens on every step, and with very long texts many models pay less attention to what sits in the middle. Old information can contradict new information: if the window holds both the previous version of a file and the current one, the model may pick the wrong one.
Order matters for cost too. With prompt caching, what goes first and does not change (instructions, rules) is billed cheaper on every step. If that part keeps changing, the cache does not help.
Common mistakes
"With a huge window, I just pass it everything." It fits, but you pay for it and it gets diluted. "It is just another name for writing prompts." The prompt is one piece; the context is everything the model sees. "It is for big companies." If you choose which document to paste into a chat, and which part of it, you are already doing it.