r/ClaudeCode • • 7h ago

Tips & Workflows Huge token burn rate on agentic software dev project

I've had a big software dev project running for about 2 weeks and was burning up my ultra plan in less than a week(which sucked for that cost!). Digging in I found that my fable orchestrator was leaving opus agents running after they were finished. I was seeing my opus cache read tokens in the billions! They were not doing anything but the orchestrator would check in on them every so often an that would burn a ton of tokens rewarming the cache. Fixing that dramatically lowered my burn rate. Basically I told it to kill finished agents and always start fresh agents rather than restarting a running agent. Also I'm using sonnet more too.

I'm still pretty new at doing this kind of thing but it's this what others are seeing? Is there a better way to handle this?

2 Upvotes

26 comments sorted by

•

u/AutoModerator 7h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

7

u/ClemensLode Senior Developer 7h ago

ask Claude what burns your tokens and how to improve the situation

1

u/pgratz1 7h ago

Yeah, that's basically how I figured out what was going on.

1

u/Valeriax4sj 4h ago

Token burn: the real feature nobody ordered.

3

u/Admirable-Degree6807 4h ago

Opus is more than. Capable of running an orchestrator. Fable is good for deep thinking and even some creativity but using fable for anything but targeted one-off high level planning/architecture/design is likely a waste of tokens and all downstream resources.

1

u/pgratz1 4h ago

Probably true, but Fable didn't seem to be my problem in terms of usage, FWIW. It was the Opus cache stuff

2

u/ChemicalExcellent463 6h ago

i kill a coding run if it's written nothing for 15 minutes, not just when it's finished. where did you see the cache read count?

2

u/pgratz1 6h ago

Under /usage

1

u/ChemicalExcellent463 6h ago

thanks, what did the cache read count in /usage look like after you started killing the finished agents?

2

u/pgratz1 6h ago

I haven't gone a week yet since changing it, but I'll report back when I do.

1

u/ChemicalExcellent463 1h ago

thanks, curious what it looks like after a week.

2

u/SirRobinBlibs 2h ago

On where to see the cache reads: in Claude Code v2.1.251 or later, /usage has a "Prompt cache (main)" line with the request count, the share of input served from cache, misses and whether the cache is warm, but it covers the main conversation only, not subagents. On Pro, Max and Ultra plans the same screen also attributes recent usage to subagents, skills and MCP servers as a percentage, which is the quickest way to spot an orchestrator like this one. For per-agent numbers, the OpenTelemetry export has claude_code.token.usage with a cacheRead type and session.id on by default, so you can sum cache reads per session and see which agents never stopped. The polling cost adds up because every poll resends the whole conversation, so even at cache-read prices a finished agent that keeps getting asked "done yet?" is expensive. Waiting for a completion notification beats a polling loop.

1

u/ChemicalExcellent463 1h ago

so you're saying the /usage cache line doesn't include subagents. what do you use to sum cache reads per session from the otel export?

2

u/called9527 5h ago

the leftover agents thing is sneaky, cache reads look cheap per token until something keeps poking idle agents all day. one pattern that keeps it sane: each subagent does one job, writes its result to a file and exits, and the orchestrator just reads the file. nothing stays warm. checking /usage after the first day instead of at the end of the week also helps catch it early

1

u/pgratz1 5h ago

Yeah that is basically what I ended up at. Unfortunately I had to burn a reset to get back on track though. Now I'm spending less than 10% of my weekly per day.

1

u/Ragy-ragy 7h ago

Refrain from using fable as an orchestrator on subscription, since despite it being cheaper on api, it's four time costlier than opus while on subscription.

1

u/pgratz1 7h ago

Really? interesting. I guess I've been hesitant to use opus for orchestrator since I figured you want the smartest model checking the work. I do see Fable changing the recommendations coming from the opus agents occasionally (usually in a direction I agree with). How much loss do you end up seeing using opus instead?

2

u/Ragy-ragy 6h ago

No problem with checking the work. Just arm a separate fable reviewer. I register no loss at all. When running in a single pass, opus and fable - they both  do the job decently, or find right mistakes. But they do different mistakes and review jobs from different angles. And after all using them both in sensitive scenarios can be the right call after all. But all in all rocking opus high instead of fable medium as an orchestrator has no downsides at all

2

u/615PowerhouseService 6h ago

Token burn on agentic projects is almost never the model — it's the agent re-reading the whole codebase every session because nothing tells it what it already decided. A tight project file with the architecture, the files that matter, and the choices already made cuts that re-reading down hard; we saw the same thing running AI on daily business operations, where the standing file did more for cost than any plan change. Also finish and test in small pieces, so when a usage window resets you're never paying twice to rebuild a half-finished change.

2

u/CandidSystem6155 6h ago

The check-ins are the expensive part. The prompt cache only lives 5 minutes after its last use, so every check-in rereads the whole agent context, and if more than 5 minutes passed it also gets written to cache again at the higher write price. Either keep any polling under that window or, better, have each worker report back once when it's done and let the orchestrator sit idle until then. When we measured our own sessions, reading context was about 170x the tokens actually written, so most of the burn is sessions rereading themselves, not answering. Your orchestrator was basically paying full fare to ask "are we there yet".

2

u/Appropriate-Toe-2993 4h ago

For the 'where do I see it' part: /usage gives you totals, but the per-session breakdown is already on disk. Claude Code writes every message to JSONL files under ~/.claude/projects/<project>/, and each assistant message carries its usage: input_tokens, output_tokens, cache_creation_input_tokens and cache_read_input_tokens. Summing those per session file shows which agent run is doing the rereading, and you can see it the same day instead of finding out at the weekly reset.

Two things that showed up for us when we looked at ours: cache reads are cheap per token but dominate the totals once something polls idle agents, and cache writes (the re-warm after the 5-minute window) are priced higher than normal input, so frequent check-ins on a cold cache cost twice.

Disclosure: I built a small free CLI that prices those logs offline (npx spendbyteam report, no account), but a quick jq or Python pass over the files gets you most of the way too. Keep in mind it shows the API-equivalent price, not what your plan actually bills.

2

u/onitsoga 4h ago

yeah the idle rewarm is the expensive part, an agent sitting there getting pinged every few minutes still pays to reload its whole prompt each time. killing finished ones and spawning fresh for the next task is the right call. are you polling on a fixed timer or only when a task actually lands?

1

u/Outrageous_Band9708 3h ago

https://github.com/Druthulu/ProjectArchitect

My workflow (terminal only) may help you.

checkout the readme and the wiki and test it out.

its a very mature system. over a year of development on it. SWE by trade.

2

u/iam-stevie-bee 7h ago

Killing finished agents is the big one. The other half is the checking in: if the orchestrator polls, each check after the cache has gone cold pays to read the whole context again. Have it wait for the agent's completion notification instead of looking every few minutes, and ask each agent to hand back a short summary rather than its full output, so the orchestrator's own context stays small too.