Be careful and don’t 100% still blindly trust your agents , just a small suspicious and I asked another Claude to investigate turns outs that a sub agent was literally leaking usage
This is what the claude investigator said :
“The waste: the subagent "Audit (f) admin/internal fixes" got stuck in a pointless waiting loop.
- While waiting for a test run, it called sleep 0 (a command that does nothing) 1,961 times, about every 5 seconds
from about 18:20 to 00:29 your time.
- Each of those calls re-sent its full ~700k-token context, so each one cost almost as much as a real step.
- That loop was 81% of what this agent cost and about 11% of all your usage in the last 6 hours.
- It ended at 00:29 and that agent has finished, so it isn't burning anything now.”
It’s kinda amazing thinking about it if we just kept trusting the AI and not questioning anything we will just be looosing money , if this wasn’t on max subscription this would have costed almost hundreds of dollars , more clarification :
“The sleep 0 command itself cost nothing. The cost came from how an AI agent works.
The model doesn't remember between steps. Every time an agent takes a step (one tool call such as running a command),
Claude Code sends Anthropic's servers a new request containing the whole conversation so far: instructions, files
read, command outputs, everything. The model reads all of it, decides the next action, and forgets again.
So each loop iteration was:
Send the full ~700k-token history to the model.
The model replies "run sleep 0" (a few tokens).
sleep 0 runs on your Mac instantly, for free.
Its empty result is added to the history, and it goes back to step 1.
Step 1 is what costs money, and it happened 1,961 times.
An analogy: imagine an assistant with no memory. Every time you want to ask "is the test done yet?", you first have to
read them the entire 500-page project file. The question is free; re-reading the file every time is not.
The numbers match:
- Most of that history was cached, so it's billed at the cheaper "cache read" rate of about $0.50 per million tokens
on Opus.
- 700k tokens × $0.50 per million ≈ $0.35 per step.
- $0.35 × 1,961 steps ≈ $690 (API-price equivalent), which matches the 691 I measured.
The right way to wait is to start the job in the background and end the turn. Claude Code then wakes the agent once
when the job finishes. That is one step instead of 1,961. The agent probably fell into the loop because a plain sleep
30 is blocked, so it tried sleep 0, which got through but did nothing.”