3 ms·
I got curious where my tokens were actually going, so I wrote a quick audit tool that reads the Claude Code session logs. Turns out the biggest sink isn't your
by edimuj 6mo ago
I got curious where my tokens were actually going, so I wrote a quick audit tool that reads the Claude Code session logs.
Turns out the biggest sink isn't your prompts. It's the agent's own tool calls. In my case, grep alone ate 3.5M tokens across ~350 sessions. 1800+ calls, most of them dumping raw output that the agent barely used. Full file reads for one function signature. Complete test output when only failures matter.
So I built wrappers: function signatures without bodies (~90% smaller), test output with just failures, that kind of thing. 2.3M tokens saved so far.
You can audit your own sessions without installing anything:
npx tokenlean audit --all --savings
https://github.com/edimuj/tokenlean https://github.com/edimuj/tokenlean
- cscharenberg 6mo agoNeat! Installed this for Claude Code and am adding Codex support to offer back, assuming it works out. Great tool idea and looking forward to seeing it in operation over the next few days. The 'audit' command is a great feature idea more tools should integrate.
- wellthisisgreat 6mo agocan I use it with rtk and headroom?