By Sagar Shankaran, Founder of CallSphere
What to put in a Claude coding agent's context and what to leave out: working-set curation, fixed vs fluid budgeting, and retrieval over pre-loading.
Key takeaways
Two teams give Claude the same coding task on the same model and get wildly different results. The usual reason isn't the prompt's wording — it's what's in the context window and what isn't. Context design is the most underrated lever in agent engineering. A million-token window doesn't save you; it just gives you more rope. The skill is deciding, every turn, what the model needs to see and what would only distract it.
This post is a practical guide to that decision. We'll cover what belongs in context, what to deliberately leave out, how to budget a window, and how retrieval fits in. The throughline: context is a curated working set, not a dumping ground.
Some things earn a permanent seat. The system instructions and the agent's identity stay throughout. So does the definition of done — the agent must keep its success condition in view or it drifts. The running plan belongs here too: a compact statement of strategy that anchors long runs. And the immediately relevant code — the specific files and symbols the current sub-goal touches — must be present, or the model will hallucinate APIs that don't exist.
The mistake teams make is stopping at "relevant code" and interpreting it generously. Relevant means the function being changed and its direct collaborators and tests — not the entire module, and definitely not the whole repository. Generosity here is exactly what poisons the window.
Just as important is the negative space. Leave out files the agent isn't working on right now, even if they might matter later — you can retrieve them when the time comes. Leave out raw, verbose tool output once it's been acted on; keep a one-line summary instead. Leave out earlier reasoning that has been superseded by the current plan. Every token of noise competes with signal for the model's attention.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
The diagram below shows the decision an effective context engine makes for each candidate piece of information before a turn. Run everything through this filter and the window stays lean.
flowchart TD
A["Candidate info"] --> B{"Needed for current sub-goal?"}
B -->|No| C["Exclude or evict"]
B -->|Yes| D{"Already acted on?"}
D -->|Yes| E["Replace with summary"]
D -->|No| F{"Verbose?"}
F -->|Yes| G["Compress, keep signal"]
F -->|No| H["Include in full"]
E --> I["Assemble window"]
G --> I
H --> IThink of the context window as two regions. The fixed region holds things that persist across turns: system instructions, the definition of done, the plan, and durable project conventions. The fluid region holds the current working set: the files under edit, the most recent tool results, and the last few turns of action. Fluid content rotates in and out as the agent moves through sub-goals.
Allocating explicitly helps. You might reserve a slice of the budget for fixed instructions and let the rest flex for fluid content, evicting oldest-first when you approach your soft limit. The exact split matters less than the discipline of having one — drifting into "keep everything" is the failure mode.
A useful mental model is a soft limit well below the model's hard ceiling. If your window can technically hold a million tokens, target a working budget far smaller and treat crossing it as a signal to compress, not as headroom to fill. Agents that run near a soft limit they actively defend stay fast and coherent; agents that fill the window just because they can degrade slowly and pay for every wasted token on every subsequent turn. The cost is cumulative — a bloated turn doesn't just cost once, it taxes the rest of the run.
The instinct to dump the whole codebase into context comes from a fear of missing something. Retrieval dissolves that fear. Instead of pre-loading, give the agent a search tool and let it pull in code exactly when a sub-goal needs it. This keeps the baseline window small and means the model only pays attention to code it actively chose to read.
# Agent retrieves on demand instead of pre-loading
hits = search_code("def parse_date")
# -> returns 2 matches with file paths
content = read_file(hits[0].path)
# only now does parser.py enter contextThis on-demand pattern scales to large repositories that could never fit in a single window, and it naturally keeps context relevant: the agent reads what it needs, when it needs it, and you summarize or evict afterward.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Retrieval quality, though, depends on giving the agent good search primitives. A grep-style exact-match search and a symbol-aware search cover most coding needs; a semantic search over docs or commit history helps for fuzzier "where is this handled?" questions. The point is that retrieval is only as good as what the agent can ask for. Invest in the search tools and the agent's context stays both small and correct — it pulls precisely the function it needs instead of loading a whole file to find one line, then carrying the rest as dead weight.
Consider an agent fixing a date-parsing bug. The naive approach loads the whole utils package, the full test suite, and every prior log. The disciplined approach loads the failing test, the one function it exercises, and the running plan — then retrieves neighbors only if the fix turns out to need them. Same model, same task; the second agent is faster, cheaper, and far less likely to wander.
| Context choice | Naive | Disciplined |
|---|---|---|
| Code loaded | Whole package upfront | One function, retrieve as needed |
| Test output | Full logs retained | Failing assertions only |
| Prior turns | Everything kept | Plan plus recent actions |
| Result | Drifts, costly | Focused, cheaper, accurate |
Context design is curation under a budget: keep the goal, the plan, and the code in active use; summarize what's been acted on; retrieve the rest on demand; and treat every excluded token as a feature, not a loss.
Because attention is finite even when capacity is large. Irrelevant content competes with relevant content for the model's focus, slows the run, and raises cost. A lean, curated window consistently outperforms a stuffed one on the same model.
Anchor on the current sub-goal. Include the goal, the plan, and the specific code and tests that sub-goal touches; exclude everything else and retrieve it only if the work expands to need it.
Whenever the codebase is larger than the working set, which is almost always. Retrieval keeps the baseline window small and lets the agent pull in code precisely when a sub-goal demands it, instead of paying upfront for code it may never read.
CallSphere applies this same context discipline to voice and chat — giving each agent exactly the customer history and tools the moment needs, nothing more, so responses stay sharp and fast. See it live at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Anthropic's Claude Fable 5 and Mythos 5 explained: pricing, availability, frontier benchmarks, the dual-model safeguard architecture, and what they mean for AI agents.
Where Claude Code, MCP, and multi-agent systems are taking GTM engineering next, and how to prepare your team now for standing and multi-agent workflows.
Where Claude Cowork and the Claude agent ecosystem are heading next — standing agents, MCP, skills as a moat — and the concrete moves to prepare your team now.
The metrics, leading signals, and anti-metrics that prove Claude Cowork is working — acceptance rate, time-to-outcome, and why usage counts mislead.
Shipping an agentic GTM workflow is easy; proving it works is hard. The metrics, signals, and eval loops that show a Claude Code rebuild is paying off.
A realistic end-to-end Claude Cowork use case: a quarterly vendor-spend review from vague ask to shipped deliverable, with every agentic step shown.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI