·6 min read

Claude Code subagents burned 3.9M tokens

We added up the completion reports of 14 Claude Code subagents: about 3.9M tokens, and four causes that made each run bigger than it needed to be.

claude-codeaiworkflow

Contents

Our Claude Code usage limit kept running out in the middle of a long job. We were running subagents on a big port, one milestone per agent, and the limit reset at 5:50, then 10:50, then 16:00 while work was still going. So we stopped the job and asked the main session a plain question: where are the tokens going?

The answer came as a table. This post shows it, the four causes the session named, and the change list that followed. If you are searching for why Claude Code subagents use so many tokens, the short version is that nothing was broken. We had picked the most expensive settings for every job and then kept the main conversation huge.

The numbers

The main session tallied the completion report of each subagent it had started. These are the agents' own reports, not billing data, so treat them as good estimates and not as an invoice.

Agent job Tokens
Import, milestone 3 ~252k
Render harness ~248k
Row-table storage ~217k
Node budget ~257k
Render fixes ~252k
Stage source and wiring ~442k
Speed fix ~265k
Import, milestone 4 ~309k
Camera waits ~311k
Import, milestone 5 ~247k
Import, milestone 6 ~367k
Colour fades ~447k
Gate fix ~239k
Timelines (Sonnet) ~63k
Total ~3.9M

That is 14 agents. Thirteen of them cost between 217k and 447k each. The one that cost 63k was the only one we had run on Sonnet. A fifteenth agent was still running and would add a few hundred thousand more.

So the first fact is that a single agent is not small. Each of these jobs was one milestone or one fix, and each one cost about as much as a long conversation by itself.

Why one agent costs 250k to 450k

The session gave four reasons, and they match how the tool works.

Long runs. Each agent ran for 20 to 60 minutes. In that time it read a lot of code, ran an emulator, re-ran the test suite many times and looked at screenshots. Every step sends the whole growing context again, so a longer run does not cost a little more, it costs a lot more.

Opus at high effort for everything. We had picked Opus with high effort as the default for every agent, including fairly mechanical ones. The fifth import, for example, repeated a job that already had a worked example from the earlier milestones. Higher effort means more reasoning on every step, and that job did not need it.

Checking the work in the main conversation. When an agent finished, the main session re-ran its tests to see for itself. That is a good habit, but each long report and each test log then stayed in the main conversation. On the turn where we asked the question, the model read about 377k tokens of context from cache. Every later turn pays to carry that again, so each new step in the main session was already expensive before it did anything.

A scheduled check. We had a recurring check, twice an hour, that told the session to resume stopped agents once a usage limit reset. One check is cheap. But checks piled up during the rate-limit pauses, and each one added more to the same conversation. In that session the schedule was created 133 times and deleted 76 times, so it was also something we kept reworking.

The usage limits we hit came from this volume. Two Opus agents ran in parallel for much of the time, which doubled the rate at which we spent the allowance.

What we changed

The session proposed a short list, and we took it.

  • Pick the model by the job. Sonnet at medium effort for mechanical, well-scoped work such as repeating an import that already has a worked example. Opus at high effort only for design work or for a new kind of problem. The Sonnet agent in the table, at 63k against a 250k typical cost, is the best evidence we have that this is worth doing, though one sample is not a benchmark.
  • One agent at a time. Two in parallel meant two long contexts growing together and a limit that arrived twice as fast.
  • Short reports. Each agent writes its full detail to a RESULT.md file in the repo and returns a few lines. The main session reads the file only when it needs a detail.
  • One test command per report. Instead of several commands, each with its own output, one combined command that prints a pass or fail summary.
  • Pause the schedule when you are there. The check is only useful when nobody is watching. While you are at the keyboard it adds cost for nothing.
  • A fresh session for each phase. The state lived in a STATE.md file and in memory notes, so a new session could pick up the work without the old conversation. Nothing was lost by starting over.

How to check your own run

You do not need a dashboard to do this. Ask the session to list each subagent it started and the tokens in its completion report, then add them up. Two things to look at in the result:

  1. Are the big numbers all the same kind of job? If the mechanical jobs cost as much as the design jobs, your defaults are too high.
  2. How large is the main conversation? If it is already hundreds of thousands of tokens, the cheapest saving is a new session, not a smaller agent.

One caution about our own numbers. They are self-reported by the agents, so they can be off, and they do not split input from output or cached from fresh tokens. They are good enough to see that 3.9M is not a surprise once you multiply 14 by 280k. They are not good enough to say what a different setup would have cost, and we have not measured that.

What we would do from the start

Set the agent's model and effort in the instruction that starts it, and write down why. Give every agent a file to write its result to and ask for a five-line reply. Run one at a time until a job type has proved safe to run in parallel. And treat the scheduled check as something you switch off, not something you leave on.

None of this needed a new tool. It needed us to notice that a default we picked once was being paid for 14 times.

More posts

New writing when there is something worth saying. By email or by RSS, whichever you prefer.