What does Anthropic say about context engineering for AI agents?

Short answer

Anthropic's engineering post "Effective context engineering for AI agents" (September 29, 2025) treats context as a finite resource with an attention budget. Its core advice: find the smallest set of high-signal tokens that makes the desired outcome likely. In practice that means system prompts at the right altitude, few and clear tools, a handful of canonical examples, just-in-time retrieval, and for long tasks compaction, structured notes and sub-agents.

The core idea: context is an attention budget

Anthropic frames context engineering as the step after prompt engineering. Where prompt engineering asks how to word the instruction, context engineering asks “what configuration of context is most likely to generate our model’s desired behavior?” It covers everything the model sees: the system prompt, tools, examples, message history, retrieved data and tool results. And unlike a prompt you write once, the context is curated again every time the model is called.

The reason it matters is what Anthropic calls the attention budget. Every token you add uses some of it. Transformers let every token attend to every other token, and models see fewer very long sequences in training, so recall and long-range reasoning get less precise as the window fills. The post describes this as context rot: a gradual decline, not a cliff. The guiding principle that follows is one sentence: “find the smallest set of high-signal tokens that maximize the likelihood of your desired outcome.”

The advice, component by component

Part of the context What Anthropic recommends
System prompt The “right altitude”: specific enough to guide, not hardcoded if-else logic. Clear sections with XML tags or Markdown headers. Start minimal, add instructions for observed failures
Tools Self-contained, robust to errors, clear purpose, little overlap. If a human cannot pick the right tool, the agent cannot either
Examples A small set of diverse, canonical examples instead of a long list of edge-case rules
Retrieved data Keep light references (file paths, stored queries, links) and load the data just in time with tools
Message history For long tasks: compaction, structured notes, sub-agents

On retrieval, the post describes a shift from pre-loading everything through embedding search to just-in-time loading. Claude Code is the example: it analyzes large data by writing targeted queries and using commands like head and tail instead of pasting whole datasets. Metadata such as folder names and timestamps helps the agent judge what is relevant. The trade-off is speed: exploring at runtime is slower and wastes context on dead ends without good tools. So Anthropic recommends a hybrid. Load some context up front for speed (Claude Code loads CLAUDE.md files at the start) and let the agent explore the rest. The general rule: “do the simplest thing that works.”

Three techniques for long tasks

  1. Compaction. When the window is nearly full, summarize it and continue in a fresh window with the summary. In Claude Code the summary keeps architectural decisions, unresolved bugs and implementation details, plus the five most recently accessed files. Tune it for recall first, then precision. Clearing old tool results is the lightest form. See What is context compaction?
  2. Structured note-taking. The agent writes notes to storage outside the window, such as a to-do list or a NOTES.md file, and reads them back later. Anthropic’s example is Claude playing Pokémon, keeping tallies, maps and strategy notes across thousands of steps. The post also mentions the memory tool on the Claude Developer Platform, released in public beta at the time, which gives agents file-based storage across sessions.
  3. Sub-agent architectures. A lead agent coordinates, and specialized sub-agents work in their own clean windows. A sub-agent may use tens of thousands of tokens but hands back a summary of often 1,000 to 2,000 tokens.

Which to choose depends on the work: compaction for long back-and-forth conversations, note-taking for iterative work with clear milestones, sub-agents for research that can run in parallel.

Anthropic took the note-taking idea further in a later post (November 26, 2025) on harnesses for long-running agents. An initializer agent sets up the environment in the first session, and a coding agent makes incremental progress in every session after that. Because each new session starts without memory of the last, files carry the handover: claude-progress.txt logs what happened, feature_list.json lists the features with a passes field, and the git history lets an agent undo a bad change.

The common misunderstanding

Many people read “context engineering” as “give the model more context.” Anthropic’s advice runs the other way. More tokens cost attention, so the job is to remove, not to add: fewer tools, fewer rules, fewer stale tool results, and references instead of full documents. The post also expects smarter models to need less prescriptive engineering, but it holds that treating context as scarce will stay central. A 1M-token window changes how much fits, not how much the model uses well; see What is context rot?

What this means for a team

The post is written for one agent at a time, but its two most practical ideas, an always-loaded file like CLAUDE.md and notes the agent writes outside the window, are exactly where team knowledge tends to end up. When each person keeps their own CLAUDE.md, NOTES.md and memory, the same rule exists in ten versions, and the high-signal set Anthropic asks for becomes a pile of near-duplicates. Curating it once for everyone is the team version of the same advice. More in How do you set up context engineering for a team?

Where Bombos fits

Bombos applies the just-in-time idea across a team: it is a plugin that gives every AI tool your team uses, from Claude Code and ChatGPT to Cursor and your own agents, one shared memory, and retrieves only what fits the question at hand. Notes and corrections become rules that live outside any single window or person, and you can see what each answer rested on. One person can try it first for their own agents.

Related questions

Who wrote Anthropic's context engineering post?

It was written by Anthropic's Applied AI team: Prithvi Rajasekaran, Ethan Dixon, Carly Ryan and Jeremy Hadfield, with contributions from Rafi Ayub, Hannah Moran, Cal Rueb and Connor Jennings. It appeared on the Anthropic engineering blog on September 29, 2025.

Does Anthropic say bigger context windows solve the problem?

No. The post argues that larger windows do not remove context pollution and relevance problems, because recall degrades gradually as the window fills. That is why it recommends compaction, note-taking and sub-agents for long tasks.

What is "the right altitude" for a system prompt?

It is the middle ground between brittle, hardcoded if-else rules and vague guidance that assumes the model shares your context. Anthropic advises starting with a minimal prompt on the best model and adding instructions only for failures you actually observe.

How does Claude Code apply this advice?

Claude Code loads CLAUDE.md files at the start and finds other files on demand with glob and grep, a hybrid of up-front and just-in-time retrieval. When the window fills up it compacts the conversation into a summary that keeps decisions, open bugs and recently used files.

Sources

  1. Effective context engineering for AI agents (Anthropic, September 29, 2025)
  2. Effective harnesses for long-running agents (Anthropic, November 26, 2025)
The first half hour · free

What does your AI forget?

  1. 01You tell us which AI you use and where it keeps starting over.
  2. 02We show what a shared memory changes there, on your own examples.
  3. 03You keep the plan, with or without Bombos.
Piet Baudoin
Piet BaudoinYou talk to Piet, from the Bombos teamDutch team from Utrecht and Nijmegen · data in Europe
We reply the same working day.