Principle
Treat context as a budget, not a transcript
A bigger context window is not permission to turn the whole project into one prompt.
When it fits
- A long AI task keeps accumulating chat history, tool output and reference material.
When to avoid it
- Do not optimize tokens by deleting safety constraints, unresolved assumptions or evidence the next decision actually requires.
Why it matters
Decide which information must be present now, which can be retrieved later and which should live only in durable project state. Keep the active context focused on current goals, constraints, recent decisions and the evidence needed for the next move. Store bulky logs, old tool output and reference material outside the working window with discoverable pointers.
An example
For a SAP incident, keep the current failure, tested hypotheses and next diagnostic step in context; leave old log dumps in files the agent can reopen.
Check your result
You can explain why every large context item is present now rather than merely available somewhere.
Keep this limit in mind
- Do not optimize tokens by deleting safety constraints, unresolved assumptions or evidence the next decision actually requires.
Connected ideas
Useful withCompact context by preserving decisions and unresolved work—not every tool result
Evidence and sources
Anthropic recommends treating context as a finite resource and aiming for the smallest set of high-signal tokens that supports the desired behavior.
More context can still be necessary for some tasks; the goal is relevance, not arbitrary brevity.
Effective context engineering for AI agents · Finite context and anatomy of effective context