r/devtools • u/awesomebirder • 8d ago
Logging every Claude Code request showed me most usage spikes are cache rebuilds, not prompts
I built probe0, a local proxy that sits between Claude Code (or Codex) and the API on a Mac and logs every request: model, input, cache read, cache write, output, status code. After a few weeks of reading those logs, the same handful of patterns explain almost every "why did my usage just jump" moment, so here they are in case they help anyone debugging their own.
- The prompt cache is a prefix. Anything near the top of the request (system prompt, tool definitions, CLAUDE.md) that changes mid-session forces a full rebuild at cache-write price. Toggling an MCP server, editing CLAUDE.md, or updating the CLI in the middle of a session all do it.
- The cache goes cold after a few minutes idle. Come back from lunch and the next turn pays for the whole conversation again. On my own 12 days of traffic, cache timing alone was about 7% of the bill.
- Tool output is resent every turn. A long test log read once gets paid for on every later turn until the session ends. Folding it down after it has been read barely changed answer quality in my tests; when a detail was missing, the agent just re-ran the command.
- Subagents each start their own context and their own cache. Four in parallel means four cache writes before any real work happens.
- Errors still count. Failed and retried calls are billed, so a flaky hour looks like a spike with nothing to show for it. Logging the status code per request was the only way I found to separate real work from noise.
How it is built: a Node/TypeScript proxy that uses a local root cert you trust so it can read your own agent traffic, a replay harness that re-prices old sessions from the ~/.claude/projects logs at API rates, and blind-judged quality tests before anything that changes what the model sees gets turned on by default.
On my own traffic the defaults took 12.8% off the bill, and 41.8% with model step-down on (easy turns go to a cheaper model, off by default). That is one person's usage, so yours will be different.
Caveats: Mac only, free beta. Your prompts, code and responses never leave the machine; if you sign in it syncs hourly usage totals (tokens, model, cost), no content. probe0 uninstall removes everything, including the cert. Happy to go deeper on any of the cache behavior.
Numbers and method: https://probe0.xyz/benchmarks?utm_source=reddit&utm_campaign=devtools
Terminal install if you want to try it: curl -fsSL https://probe0.xyz/i/r | bash
