Reduce and delegate: two ways to keep an agent's context focused
A context window is not infinite RAM. First cut what never belongs in it, then spread the rest across sub-agents and context bundles so long tasks keep their focus.
Written by
-
Benedikt Stemmildt Founder & Co-CEO
Published: 14 October 2025 Updated: 3 min read
Most engineers treat AI context windows like infinite RAM. They are not.
Your agent fails not because the model is bad, but because you are flooding 200K tokens with noise and wondering why it hallucinates.
Building agentic systems with production teams, I have learned that a focused agent is a performant agent. Context engineering is not about cramming more information in. It is structured management of what goes in and what stays out.
That management has two strategies. Reduce what goes in. Then delegate what is left.
Reduce: load MCP servers per task
Most teams load every MCP server by default. I have seen more than 24,000 tokens, 12% of the context, wasted on tools the agent never uses.
The fix:
- Delete your default MCP.json file.
- Load MCP servers explicitly, per task.
- Measure the token cost before adding anything permanent.
This one change saves more than 20,000 tokens at once.
Reduce: shrink the memory file and prime per task
Teams build massive memory files that grow forever: 23,000 tokens of “always loaded” context, most of it irrelevant to the current task.
The fix:
- Shrink claude.md to the universal essentials only.
- Build
/primecommands for different task types. - Load context based on what you are actually doing.
For example:
/prime-bug -> bug investigation context
/prime-feature -> feature development context
/prime-refactor -> refactoring-specific context
Dynamic context beats static memory every time.
Keep irrelevant context out
The mental model shifts from “How do I get more context in?” to “How do I keep irrelevant context out?”
The teams that get this right measure token usage per agent operation, where others throw everything into the context. They design the context architecture before writing prompts, where others keep adding to claude.md each time an agent fails.
When reduction is not enough: delegate
Say you optimized your context window, removed unnecessary tokens and cleaned up your claude.md. Your agent still hits 180K tokens and loses focus halfway through complex tasks.
At that point the problem is no longer reduction. It is delegation. Smart agents do not do everything. They delegate.
Delegate: sub-agents do the bulky work
Instead of loading 40,000 tokens of web-scraped docs into your primary agent, delegate that work to a sub-agent:
- The sub-agent scrapes the documentation and consumes 30K tokens.
- It returns only a 500-token summary to the primary agent.
- The primary agent’s context stays clean and focused.
You are not saving tokens. You are spending them in the right place.
Delegate: context bundles carry long tasks forward
Your agent hits 180K tokens on a long-running task, and starting over means losing all progress. The fix:
- Log key operations: prompts, reads, writes, decisions.
- Create checkpoint files, not full transcripts.
- New agents reload what matters from a few thousand tokens of checkpoints instead of the full transcript.
This is how you chain long-running operations without degradation.
Manage context as a scarce resource
This is not vibe coding. It is engineering practice applied to AI systems.
The teams shipping production agentic systems are not the ones with the biggest context windows. They are the ones managing context like a scarce resource. They use sub-agents to isolate specialized tasks instead of overloading the primary agent until it becomes unreliable. They chain operations through context bundles instead of starting from scratch when the context fills up. And they design the agent architecture before writing prompts, instead of adding more context and hoping it works.
Your agent’s intelligence ceiling is your context management ceiling. The question to ask is no longer how to get more context in, but how to distribute it across agents.
Are you using sub-agents in your agentic pipelines yet?
Further reading
Written by
-
Benedikt Stemmildt · Founder & Co-CEO
More on Context engineering
- Onboard your AI assistant like a junior developer Teams spend weeks onboarding a junior developer and minutes onboarding their AI assistant. Both need the same thing: context, standards, and patience.
- Who owns the file every agent reads first Since Claude Code 2.1.277 reads AGENTS.md where no CLAUDE.md exists, one instruction file can serve every coding agent on a team. The file was never the hard part: the instructions are a team decision and need one owner, so merge the files into one AGENTS.md and name who owns it.
- Million-token windows did not remove the dumb zone Agent quality degrades without warning above roughly 40 percent context fill, the zone Dex Horthy named. Windows grew to a million tokens and the failure mode came along, so starting bare metal is still the habit that keeps a session out of it.
Scaling needs named owners
Coding agents scale across teams when named people own the platform, the team practice, the guardrails, and the measurement. Rollout & scale is where that ownership is built and handed to internal owners, in your stack.
Training on this topic: Agentic Engineering for Developers and QAWant to check one team first? The self-check: twelve yes or no questions, three minutes, instant result, no account. Take the self-check