← sources

I measured where my Claude Code tokens actually go and it wasn't what I expected

source: reddit (reddit:ClaudeCode)published 2026-10-23 02:26ingested 2026-10-24 02:40

retained text

I was trying to cut down my token usage and the obvious thing to me was that the agent repeats itself a lot. It reads the same file again, runs the same grep again, checks the same thing it already checked. So I figured a cache that reuses tool results until the underlying file changes would save a good chunk.

Before building anything I wrote a script to go through my local session logs and see how much it would actually save. 14 sessions, about 5,200 tool calls.

Turns out almost nothing. About a quarter of the steps were repeats but only 3 out of 410 were actually safe to reuse. Most of the repeats were the agent re-reading a file it had just edited, which makes sense when you think about it, it edits then reads back to check. I also looked at only returning the changed part of the file after an edit instead of the whole thing. That works but it came out to around 3% at best because most files are small anyway.

The thing that actually surprised me was the scale difference. Everything the agent read from files and commands was about 1M tokens total. The agent re-reading the conversation on every step was about 1.8 billion. It's cached so it's cheap per token, but that's still where basically all the volume is. And since the conversation keeps growing, a session that's twice as long costs roughly 4x.

So for me the fix was boring. One task per session with a short handoff note, compact early instead of waiting, push exploration into subagents, and keep test and log output short.

I put the full investigation in a comment if anyone wants to run it on their own sessions. Would be interesting to see if other people's numbers look different, especially if you do more read-heavy work than active coding.

document fetched 2026-10-24 00:41 · canonical https://reddit.com/r/ClaudeCode/comments/1xd1x8w/i_measured_where_my_claude_code_tokens_actually