Context engineering for Claude: budget the window like memory
Context engineering is choosing what Claude sees, in what order, and what is cached. It is the discipline behind quality and spend.
Context engineering is the work of assembling what Claude sees on each turn: instructions, tools, retrieval, history, and the user. Prompt wording is a subset. Most production failures we inherit are context failures: too much, in the wrong order, uncached, uncited.
Treat the window like a memory budget, not a junk drawer.
A working budget
- Policy and tools first, stable, cached. See prompt caching.
- Then the resolved entity and a few chunks. See retrieval.
- Then the current user turn.
- History last, summarised or truncated, never infinite.
If a token cannot change the decision, it should not be in the prompt.
Order is a product decision
Putting untrusted retrieval above the policy is how injection wins. Putting a 40-page dump above the user question is how the model answers a different question. Read prompt injection defense if writes are on the table.
Test context like code
Ablate chunks. If removing a section does not change eval scores, delete it. If adding a section drops scores, it is noise. Context is not "more documents." Context is the minimum that makes the next action correct.
This is one of the six disciplines on our expertise page because it shows up in every live system, not because it is a trend word.
Related notes
Production systems
Claude Agent SDK Session Recovery: Resume, Fork, Compact, and Checkpoint Safely
Learn when to continue, resume, fork, compact, and checkpoint Claude Agent SDK sessions so long-running agents can recover safely.
Production systems
Why most Claude pilots never reach production
Most Claude pilots stall on integration, evaluation and cost, not prompting. Here is what actually blocks a production launch, and how to unblock it.
Production systems
MCP versus ad-hoc Claude tools: pick the contract, not the acronym
MCP is a protocol. The production question is whether Claude has a narrow, permissioned contract with your systems of record.