Back to Blog

Sub-Agents in Claude Code: Keeping Claude Focused

Sub-agents keep a Claude Code session's context window clear by pushing scoped work onto cheaper model tiers, then run up to twenty of them in parallel.

Sean Robb
5 min read
#ai

The scarce resource in a Claude Code session isn’t money. It’s the main thread’s focus, and everything already loaded into its context window is spending it.

I’ve already run into what happens when that window fills with the wrong things. A bloated CLAUDE.md quietly wrecked a session I was running before I’d typed a single instruction, because Claude Code loads it whole, every time, whether the current task needs it or not. Sub-agents create the same problem after the session is already running. My main thread runs on Fable, Anthropic’s most capable model, because that’s the seat that plans and decides and accepts or rejects. Read a sub-agent’s raw output back into that thread in full and every token of it competes for Fable’s attention with every token already sitting there, the same as a stale instruction would. Delegation exists to keep that from happening: hand the work to a session with its own window, and only the conclusion comes back.

The System

A sub-agent is a second Claude Code session, spawned from the one you’re driving, that takes a scoped task, does its own reading and writing inside its own context window, and reports back. It can run on a cheaper model than your main session runs on. That’s the whole mechanism, and it’s the part that matters here. Sub-agents put a cheaper model in the seat when the seat doesn’t need your most expensive one.

My setup treats that choice as a ladder, not a toggle. Four tiers, and the multiplier between them matches Anthropic’s own published per-token API pricing exactly, the same ratio on input and output alike. It’s relative cost, not what I pay on a Claude Code subscription, and it’s the ladder my own delegation plugin routes against:

TierModelCostWho lives there
ArchitectFable 510xMain thread. Plans, decides, accepts or rejects. Never greps.
OrchestrateOpus 55xlead owns a work item, research owns a question, reviewer audits finished work. None of them edit.
DoSonnet 53xworker writes code, writer writes prose, explorer searches.
MechanicalHaiku 4.51xmechanic runs narrow greps and mechanical edits.

Seven named roles sit across the three delegated tiers, each pinned to the model that matches what the role needs to be good at. worker doesn’t need Fable’s judgment to implement a change I’ve already scoped. mechanic doesn’t need Sonnet’s reasoning to find every call site of a function.

One placement is worth noticing. reviewer sits at Opus, one tier down from the architect, not at the bottom with the other doers. That’s the instinct to use the more advanced model for validation, and it’s already built into the roster. The agent checking finished work gets the second most expensive model in the stack, because catching a mistake takes closer to architect-level judgment than making the first pass does.

What Delegation Buys

Anthropic’s own research on multi-agent systems found agents run roughly 4x the tokens of a single chat turn, and multi-agent setups run closer to 15x. Sub-agents do not shrink the bill by default. Spawning four workers to parallelize a task can cost more in aggregate than doing the same work in one session, serially.

What the ladder controls is which tier pays for which kind of work, not whether the total goes up or down. At Fable, a grep I run myself is the most expensive line in the session. At Sonnet, it’s a rounding error. Skipping the orchestrator doesn’t dodge that cost, because the work just moves into the architect’s context at the architect’s rate, filling the exact space delegation was meant to protect.

None of lead, research, or reviewer exist to save money either. lead buys an owner and context isolation for a job that touches several files. For a question that needs more than one angle, research buys the same isolation. reviewer buys independence, a second set of eyes that doesn’t share the blind spots of whoever wrote the thing. It’s runway: my own context stays free of the transcripts those roles generate, so there’s still room left for the decisions I actually need to make.

Twenty sub-agents can run at once in a session by default, and what to do with that much concurrency is its own argument. The one this post makes is narrower: protecting the window pays off the moment I delegate a single task, before parallelism ever enters the picture.

Try It Yourself

The honest complication is that none of this pays off by reflex. Whether the total bill actually drops depends on how wide you fan out, and spawning an agent to avoid a two-file edit buys nothing while still costing a cold context. When the work is small, or the next step shares most of its context with what I’m already doing, or the round trip costs more than the work itself, it stays in the main thread.

Here’s a prompt that sorts a task list onto the ladder for you, tier by tier, and says what each item would have cost to do yourself instead.

I want you to sort my current task list onto a model-tier ladder instead of me delegating by reflex. Here's what I'm working on: [PASTE YOUR TASK LIST] For each item, tell me:
I want you to sort my current task list onto a model-tier ladder instead of me delegating by reflex. Here's what I'm working on: [PASTE YOUR TASK LIST] For each item, tell me: 1. Which tier it belongs at: architect (stays in this session, needs my judgment to plan or decide), orchestrate (needs an owner or independence: a job touching several files, a question needing more than one angle, or a review of finished work), do (a scoped, well-specified task: writing code, writing prose, or searching), or mechanical (a known pattern: a narrow grep or a mechanical edit). 2. What it would cost to do that item here, in this session, on [YOUR MAIN-THREAD MODEL] instead. Not in dollars. In context filled and judgment spent on legwork instead of decisions. 3. Whether the item is small enough, or shares enough context with what I'm already doing, that delegating it would cost more than just doing it. Flag anything on the list that's really a grep or a mechanical edit I'm about to run myself instead of handing to a cheaper tier. Don't recommend spawning anything that would take less than [X MINUTES] to just do by hand. A task sharing my current context isn't a delegation candidate just because a tier exists for it.

Delegation keeps my main thread focused on the decisions that actually need Fable, instead of filled with the legwork that doesn’t.