DEV Community

Cover image for My Claude Code subagents ignored me all week. Here are the receipts.
Developer at Fortitude Omnis Group
Developer at Fortitude Omnis Group

Posted on AI-assisted

My Claude Code subagents ignored me all week. Here are the receipts.

So, a week of reading my own Claude Code logs, and of people on Bluesky asking better questions than I'd asked myself. Some of it went well. Some of it is embarrassing. Scratch that, MOST of it is embarrassing! I'll do it in that order, because I'm not daft.

Agents of different types don't share anything

Start with the thing that kicked the week off. When the main session starts a subagent, that subagent's first call has to put its whole opening prompt (system prompt, tool list, the lot) into the prompt cache. Writing to the cache costs MORE than plain input, 1.25 times the input price. Reading from it costs almost nothing, a twentieth of the input price on Opus 5.5.

So the cheap way to start five agents is for one to write the cache and the other four to read it. And they can, as long as they start with the same prefix. Which they don't, if they're different types. The cache is matched in order, tools then system prompt then messages, and a change anywhere breaks it from that point on.

In my logs, every custom agent started after a general-purpose one read 0 tokens from the cache and wrote about 59K. One that started warm wrote about 30K. That's roughly 14 cents an agent on Opus at API prices, every time the lead fans out with a mix of types. Not a fortune. But the lead does it all day, and that can mount up!

So I made them wait

The fix is boring. When several agents of the same type start together, let the first go and hold the rest until it starts answering. Then they read what it wrote.

That's in OmnisSwarm 0.7.0 (my Claude Code plugin, free on GitHub) since 15 Nov. Four runs on my own swarms, 15 to 18 Nov:

  • every held agent read 19K to 33K tokens from the cache on its first call, 7 out of 7
  • the agent that went first read 0, every time
  • for general-purpose agents, the first call's cache write dropped from 60K to 27K

And the cost? Time. The held ones go when the first starts answering, which was about 2 seconds in the first run. If the first one hangs, they go anyway after 4 minutes.

Caveats, because there are always caveats. Four runs is four runs. I haven't tried it with more than 3 agents of one type at once. The savings are worked out from token counts times list prices, not read off a bill. And on a subscription (I'm on one) there's no bill to shrink, the tokens come out of your limits instead, and I haven't measured what holding does to those.

Should subagents get the 1-hour cache?

Here's the other half of it. From 1 to 10 Nov my main session wrote 21.7M tokens to the 1-hour cache. Subagents wrote 62.4M, and ALL of it went to the 5-minute cache. That was $288 of cache writes for subagents against $174 for the main session. So a subagent that sits waiting on a slow build comes back cold and writes the lot again.

Obvious answer: give subagents the 1-hour cache. Except someone in the Claude Code issue tracker (sindrehenriksen, #110403) did the sums on four weeks of their own traffic and it came out about break-even. A 1-hour write costs 2x input, not 1.25x. It only pays when roughly 40% of writes follow a pause of 5 to 60 minutes. Less than that and you're paying extra for nothing. Measure before you flip it.

Who decides which model a subagent runs on?

I posted a tip on Wednesday: send your subagents to Sonnet with CLAUDE_CODE_SUBAGENT_MODEL. Someone on Bluesky (codewright) came straight back with: so the research runs on Sonnet and only the summary gets Fable, and that's the point of Fable gone?

Yes. They were right. And it turns out there's a fixed order, straight from the sub-agents docs:

  1. whatever model Claude passes when it starts the subagent
  2. the model field in that agent's own file
  3. CLAUDE_CODE_SUBAGENT_MODEL
  4. the main session's model

So you can have both. The env var catches the grunt work, and your research agents keep model: fable in their files. And if you want Claude to stop choosing altogether, there's CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 (Claude Code v2.1.257 or later), which pins every subagent to the env var's model. /tasks shows which model a running subagent is actually on.

Confession one: my own rule

Then someone asked me what I do. Do I pin my review and research agents in their files?

Nope. Nothing's pinned. My CLAUDE.md tells the main session to pass a cheaper model for builds, tests and commits. A rule! Written down and everything.

So I counted. 13 to 20 Nov, 1,799 subagent requests. 256 on Sonnet. 1,537 on Opus. Six on Haiku. Which means my lovely written rule worked 14% of the time. The main session reads it, nods, and does what it likes. Rule number 1 above beats a paragraph in CLAUDE.md every time, because Claude IS rule number 1.

So I'm pinning them. Lesson learned, the expensive way (well, the "API-equivalent" way).

And yes, I see the irony. Counting this from raw session logs meant writing a script. Watching it is the whole job of OmnisVigil, the thing I actually sell. It reads the receipts OmnisRouter writes and shows what your agents spend by project, repo, model and commit, puts a cap on the budget, and has a kill switch for when an agent loop goes feral at 2am. It's free for one person (sign up here and it hands you OmnisRouter), and paid for teams. Which brings me neatly to the second confession.

Confession two: 79 downloads, 0 clicks

OmnisRouter is my free self-hosted router (it sends each coding-agent request to the cheapest model that can handle it). OmnisVigil is the paid dashboard that sits on top. Since 15 Nov the signup page logs where each click came from.

Last week OmnisRouter got 79 downloads. Clicks from the router to the signup: zero.

Why? The router does mention the signup. In one line. In a log file. And most people install the Windows tray version, which runs the router with no console window at all. So the only place I put the link was a file nobody ever opens. And the tray's own "get a key" button opens the dashboard with no tag on it, so even if someone did click through I'd never have known where they came from.

Top marks, me.

Both get fixed this week.

Awwww look at my sleeping babies.

I just keep imagining the wicked witch of the east releasing her flying monkeys.

And a correction

Before the OmnisRouter 1.3.0 release I re-checked the benchmark its routing is built on. One Opus 5.5 answer on LiveCodeBench was stored as a fail and passes every test in under a second. Now it's a pass, which moves Opus 5.5 from 92% to 94% on that set. While I was in there I found that re-grading on Python 3.14 passes 9 answers that 3.12 fails (3.14 evaluates annotations lazily, so a missing from typing import List no longer breaks anything). So the runs now record their Python version. No routing choice changed. It's all in the OmnisBench README.

The numbers

  • What the agents would have cost at API prices, 13 to 20 Nov: $501 (Opus 5.5 $475 of it). What I paid: the flat subscription.
  • OmnisRouter downloads: +79 (371 all-time). Signups to OmnisVigil from outside: still 0, now 47 days.
  • Bluesky: 27 followers, up 3. Substack: 8 followers, 4 subscribers, flat.
  • Replies posted: 27, mostly on Bluesky and in the Claude Code issue tracker.

Next week: pin the subagents and count again, put the signup link where a human can see it, and find out if anyone clicks. I'll tell you either way.

(Everything I've built, the free stuff and the paid stuff, is on fortitude-omnis.group.)

Top comments (1)

Collapse
 
skillselion profile image
Skillselion •

One addition to your model order list, from the same sub-agents docs page: CLAUDE_CODE_SUBAGENT_MODEL by itself does not change the model for the built-in Explore and Plan subagents. That takes the FORCE variable set together with it. So "the env var catches the grunt work" has a gap if a large part of the fan-out is Explore. On the 14%: if the 1,799 are API requests, one Opus subagent that runs 40 turns is counted 40 times. Do you have the split per spawn, that is, how many Agent calls carried a model parameter at all? That would show if the main session ignores the rule or if a few long Opus agents dominate the count.