How an Idle Agent Burned 50M Tokens a Day – and How to Fix It

An OpenClaw user on Reddit reported their LLM API usage spiking from 11M to 51M tokens per day over six days, totaling 196M tokens — most of it wasted by an idle agent. The cause: a forgotten agent called "main" was being poked by OpenClaw's heartbeat every 30 minutes, loading a 225k-token session history just to reply "HEARTBEAT_OK".
The Leak: cacheRead Dominance
Two numbers stood out from the transcript analysis:
- 95% of tokens were cacheRead — the model re-reading old conversation history instead of doing new work.
- 56% of all tokens came from a single agent named "main" that wasn't even in use anymore.
The heartbeat ran 48 times daily, each time loading a months-old session. Even an empty HEARTBEAT.md — intended to disable the heartbeat — failed to stop it in that build.
The Fix: Two Steps
- Clear the bloated session. Wipe the session file for the idle agent. The next heartbeat starts from a blank slate. Only remove junk sessions, keep real DM/chat sessions.
- Prevent refilling. A one-time clear won't stick because the heartbeat keeps adding to the session. Use config changes:
- Set
heartbeat every: "0m"to turn off heartbeat entirely if the agent does nothing, or - Set
isolatedSession: trueandlightContext: trueso each heartbeat runs on a fresh, tiny context (~2-5k tokens) instead of the full history (~100k+).
- Set
Bonus: other agents were reusing one ever-growing session because a session ID was not actually starting fresh in that build. Reset session between jobs to keep each run clean.
Takeaways
- Idle agents are not free — a heartbeat on a fat session can cost more than real work.
- If most tokens are
cacheRead, you're paying to re-read history, not for new work. - Verify that "off" is actually off — empty
HEARTBEAT.mddidn't stop the heartbeat in the reported build. - Read the per-turn transcripts; token usage is recorded there per input/output/cacheRead.
The user cut their token usage by more than half with these config changes.
📖 Read the full source: r/openclaw
👀 See Also
Build a $10 Token Monitor for LM Studio Using an ESP32 Display
A developer repurposed a $10 ESP32 weather station display as a live token monitor for LM Studio, coding the firmware in 15 minutes with Codex.

End-to-End LLM Stack Trace: From Keystroke to Streamed Token
A software engineer has created a comprehensive document tracing every layer of the stack when sending a prompt to an LLM, covering client-side token counting, network protocols, API gateways, safety classifiers, tokenization, KV cache, sampling pipeline, and streaming mechanics.

Structured AI Workflow with Phase-Based Commands to Reduce Rework
A developer shares a programmable workflow using specific commands like /pwf-brainstorm and /pwf-work-plan to address common AI coding issues: lost context, broken standards, and mixed planning/execution. The approach includes mandatory documentation updates and a multi-root project structure.

Scaling Agentic Coding to 150+ PRs/Week: Lessons from $85K in Tokens at Lovable
Alexander Lebedev shares how he scaled from 20–30 PRs/week with one human to 150+ PRs/week with a swarm of AI agents, spending $85K in tokens since January. Key learnings: risk classification, AI review replacing human code review, and the challenge of preserving knowledge diffusion.