
Keep your main coding session small and send the verbose work to short-lived subagents. When we split Claude Code work between one Opus 5.5 orchestrator and four specialist agents on Haiku 5.5, Sonnet 5.5 and Opus 5.5, the API-equivalent cost of a delivered code change fell from $3.59 to $2.14, about 40%.
We expected Sonnet 5.5's lower price per token to carry that saving. The numbers point at the main session instead: it made 54 requests per session instead of 75, at 107,000 tokens of context per request instead of 119,000, while each session shipped more code.
A coding agent works in turns. Each turn sends the whole conversation so far, plus the system prompt, to the model. The conversation grows with every file read, test run, error message and fix, so by the fortieth turn of a feature a single request can carry over 100,000 tokens of history, most of it irrelevant to the question being asked.
Prompt caching lowers the price of that history without removing it. A cached prefix is billed at a fraction of the input price, 5% on Opus 5.5 and Sonnet 5.5 according to Anthropic's pricing page, yet every cached token is still paid for on every turn, and any change to the start of the prompt, such as an edited system prompt or a compacted history, writes the cache again. Output quality also drops late in a long session, as the context fills with stale detail. The bill and the drop in quality come from the same history.
The expensive part of an implementation task is the loop in the middle: edit, run the tests, read the failure, edit again. That loop produces thousands of tokens nobody needs once the tests pass, and in a single session every one of them is re-sent on every later turn. Context engineering is the wider discipline of deciding what a model sees; this setup applies it to your own coding sessions.
We measured both setups on a Claude Pro subscription over several weeks in October 2026, using the API-equivalent cost Claude Code reports for each session. The main session ran Opus 5.5 at medium effort both times. The only difference was whether implementation, scoping and shipping went to subagents on Sonnet 5.5 and Haiku 5.5.
| Measure | Opus alone | With subagents |
|---|---|---|
| Cost per delivered change | $3.59 | $2.14 |
| Sessions measured | 24 | 10 |
| Lines added per session | 248 | 392 |
| Usage window per change | About 10% of five hours | About 6% of five hours |
| Context per main request | 119,000 tokens | 107,000 tokens |
| Requests per session | 75 | 54 |
On the five-hour usage window, that moves a subscriber from about 10 delivered changes per window to about 16. The scoping agent joined late in the measurement, so most delegated sessions used the implementation agent alone, and the sample is small: ten delegated sessions on one personal subscription with a light system prompt. A heavier instruction set in your main session should make the main-context saving larger, but test that on your own work before you quote it.
One session acts as the orchestrator. It holds the plan, talks to you, and reviews routine results. Four specialist subagents, the workers, do the context-heavy work. Each one starts with an empty context, reads one short project brief, does its job and returns a report in a fixed shape. The orchestrator sees the report and nothing else.
| Role | Model | Job | Returns |
|---|---|---|---|
| Orchestrator | Opus 5.5 | The session itself. Plans, routes work, reviews routine diffs, talks to the human. | Decisions |
| Scoper | Haiku 5.5 | Turns a task into facts before planning: files with line numbers, acceptance criteria, risks. Plan mode, 12 turns. | Goal, acceptance criteria, relevant code, scope, validation, risks, possible split |
| Researcher | Haiku 5.5 | Facts from outside the repository: library behaviour, API contracts, version differences, error messages. | Question, answer, sources, confidence, open points |
| Implementer | Sonnet 5.5 | Builds exactly the plan it is given, runs the validation commands, fixes until green or two rounds fail. | Changes, validation, notes |
| Reviewer | Opus 5.5 | Risky changes only: security, concurrency, data migrations, state machines, payment logic, public APIs. | Verdict, findings, not checked |
According to the Claude Code subagent documentation, each subagent starts with a fresh context window that holds none of your conversation, and returns only its summary. The implementer's edits, test output and fixes stay in its context and disappear when it reports. The orchestrator's history grows by one report of typically 20 to 40 lines instead of by the whole loop.
Every worker returns the same fixed sections every time, so the orchestrator never parses a narrative or pastes worker output into its own context. The fixed shape also makes the small models more reliable, because the headings tell them what counts as done.
Fact finding and documentation lookup need a model that cites paths and URLs and admits when it does not know, which is Haiku 5.5 work at $0.10 per million input tokens on prompts up to 100,000 tokens. Implementation needs a model that can hold a plan and a test loop, so it runs on Sonnet 5.5. Judgment on risky changes gets Opus 5.5, and only there. Matching the model to the role saves less than context isolation does, and it costs nothing once the roles exist. Our benchmark of Haiku, Sonnet and Opus as Claude Code subagents graded which delegated jobs each model can carry.
Claude Code lets a subagent start subagents of its own, up to three layers deep by default. Here every worker's tool list leaves out the Agent tool, so every handoff passes through the orchestrator. Nested delegation hides cost, because a worker starting a worker is invisible to you, and it lets two agents bounce a task between them. With a hub you see every dispatch and every report in one place.
When a review finds a problem, the fix goes back to the same implementer by name. A resumed subagent keeps its full history, including the files, the failing test and its own decisions, so the fix costs a fraction of a fresh run. In Claude Code the orchestrator resumes it with its agent ID or name.
Delegation does not happen on its own. A model with a capable context does the work itself unless it has standing rules, so the rules live in the project's instruction file, where the orchestrator reads them at the start of every session. These are the ones that held up.
Claude Code reads subagent definitions from Markdown files in a .claude/agents/ folder, in the project or in your home directory. The frontmatter sets the model, the tools and the limits, and the body is the agent's system prompt. The scoper looks like this.
.claude/agents/, each with a model, a tool list no wider than the job, and the exact report headings in its prompt.omitClaudeMd: true only on the read-only scoper and researcher.The CLAUDE.md step is the one place where saving tokens trades against correctness, and correctness wins. Default model and effort live in a settings file: the committed .claude/settings.json changes cost and behaviour for everyone who opens the repository, the uncommitted .claude/settings.local.json for one engineer. A setup script should write to the local file, show what it would write first, and touch the shared file only once the team agrees. The Ovidius Academy lists Anthropic's own Claude Code and subagent courses if your team is new to the format.
Five sessions instead of one plus four agents. Each live session carries the full system prompt, instruction files, skill listings and tool catalogue on every turn, so five of them multiply the baseline the design exists to shrink. Subagents start empty and sessions do not.
Trusting the scoper's paths. Small models invent plausible file names. The orchestrator spot-checks two before it plans, and the scoper's prompt makes it confirm every path exists.
Reviewing everything with the strongest model. The saving depends on the orchestrator reviewing routine diffs itself. A reviewer that runs on every change doubles the Opus 5.5 spend.
Workers that decide architecture. The implementer is told to stop and report when the plan would need an architectural decision. A worker that redesigns in a context nobody watches produces expensive surprises.
Briefs that grow. Every spawn reads the shared brief, so every line added to it is paid for by every worker, every time. Keep facts in it and move explanations elsewhere.
Workers that nest. One worker whose tool list includes the Agent tool is enough to bring nesting back. The same discipline applies to agents that act on live systems, where guardrails that stop an agent before it acts do the work of the tool allowlist.
The Claude Code status line hands your script a JSON payload with cost.total_cost_usd, the estimated session cost at list price, and, for Pro and Max subscribers, rate_limits.five_hour.used_percentage and rate_limits.seven_day.used_percentage. Append those to a log file whenever they change and you have a per-session record of window usage and API-equivalent cost.
Then compare two groups of sessions on the same kind of work, one with delegation and one without. That is enough to see whether the pattern pays off in your codebase. The estimate can differ from your actual bill, so compare the two groups with each other, not with an invoice. To put a monthly figure on agent runs across a team, the AI agent cost estimator takes runs per day and tokens per run.
Keep the main session small. Send scoping, documentation lookups and the edit and test loop to subagents that start with an empty context and return a short fixed-shape report. In our measurement that cut the API-equivalent cost per delivered change from $3.59 to $2.14.
They do when they absorb verbose work the main session would otherwise carry on every later turn. Each subagent runs in its own context window and returns only a summary. They cost more than they save when you hand off small edits, so make changes under about twenty lines in files already open directly.
We ran the orchestrator on Opus 5.5 at medium effort, because it plans, routes and reviews routine diffs. The workers ran on Haiku 5.5 for scoping and research, Sonnet 5.5 for implementation, and Opus 5.5 only to review risky changes.
By default a subagent can start subagents of its own, up to three layers below the main conversation. Leave the Agent tool out of a subagent's tool list and it cannot, which keeps every handoff visible in the orchestrator.
Configure a status line. Its JSON payload includes cost.total_cost_usd and, on Pro and Max plans, the five-hour and seven-day usage percentages. Log those per session and compare sessions with and without delegation.
If you want this set up across your team's repositories, or agents built to the same discipline inside your own systems, Ovidius does that through AI agent development services and keeps them running under AI managed services. Book a discovery call to scope yours.