r/ClaudeCode • u/pgratz1 • 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?
•
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
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.
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/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/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.
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.