skip to content

4 min read

Swapping the model didn’t lower my Claude Code bill. This did.

A month of measuring every token: why cost scales with the number of agents and the size of their context, and the five rules that became configuration.

  • claude code
  • agents
  • cost

I was sure the answer was obvious: swap the subagents’ model for a cheaper one and done. I swapped it. I measured. The hourly bill came out… the same.

This post is about what I found when I stopped guessing and went to look at where every cent was coming from. Everything here ended up in a repository, claude-config, that makes any of my machines match the main one.

The experiment that “failed”

The idea was simple. A main session on Opus orchestrates; the grunt work goes to subagents. If the subagent costs less, the bill drops. Right?

The Sonnet agent really did cost 57% less per round than the same agent on Opus. But in that same period, 2.7 times more agents ran per hour. A cheap agent becomes the agent for everything. Result: spend per hour, tied.

Cost scales with the number of agents and the context each one carries, not with the model.

That sentence became the first line of my rules.

Where the money really goes

I went through a whole month of usage, split by token type. The result changed everything:

Token type Share of spend
Cache reads 66%
Output (the text the model writes) 9%
The rest (cache writes, input) 25%

Two thirds of the bill is rereading context. Every new message in a conversation resends everything that came before. If the conversation is 400k tokens long, every “ok, now tweak that button” pays for 400k of reads.

And then came the number that hurt: 74% of the orchestrator’s cost happened after 400k of context. The long session, the one that “already knows everything”, was exactly the most expensive one.

That’s why the trendy tips, like answering tersely or compressing command output, barely move the needle. Output is 9% of spend. Test and build output is under 2% of the context.

The five rules

1. At most two agents at a time

Independent tasks wait in line. A small task doesn’t get its own agent: it joins its neighbor or I just do it myself. Delegating a one-line edit costs more than making it.

2. Lean input context

The task points to paths (file:function), it doesn’t paste the file, the diff or the log. The agent reads what it needs. Every new agent pays for its initial context as a cache write, which costs about 12 times the price of a read.

3. Reuse the agent that already knows

A fix or a second round goes to the same agent, by message, as long as it’s under 150k. It already has the context cached. A new agent would start from zero, paying for everything again.

4. A 200k ceiling for everyone

The main session closes at 200k. The agent hands back at 200k. Past the ceiling? Finish the item, write the state to a task file and /clear. The next session reads the file and carries on.

And a detail I didn’t expect: resuming a session that has been idle for over an hour rewrites about 445k of context in one go, because the cache has already expired. Now a hook blocks cold resumes above 150k (you can force it, but then it’s a conscious choice).

5. Short returns

The agent hands back at most about 30 lines: files touched, the exit code of each proof, the error line if it failed. The full log stays in a file. Everything the agent returns goes into my context and is paid for on every following message.


Rule, skill or configuration?

My favorite part. Each thing lives where it costs the least:

  • Configuration (settings.json): whatever can’t depend on the model remembering, like the default model for subagents.
  • CLAUDE.md: read in every session, so it only carries the rule and when to apply it. Short on purpose.
  • Skill: the full playbook for how to delegate is only loaded at delegation time. A session that doesn’t delegate doesn’t pay for it.
  • Hook: the context guard warns at the ceilings, blocks cold resumes and logs every agent, so I can measure later instead of guessing.

So what about the model?

It’s still an A/B test, with a written criterion: the smaller model stays on the agents if the rework is below one in every six tasks. If it gets worse, the bigger one comes back. Every task that’s returned or redone gets logged, and that count is what decides.

But the lesson stuck: before swapping the model, look at the context. That’s where the bill lives.

PS: the little bar up top, the one that fills as you read, is exactly this. This whole post “costs” 200k. Made it to the end? Time for a /clear.