Find where your Claude Code usage wastes money
Tokendoctor is a free add-on for Claude Code. It replays your last 30 days of sessions, estimates what different settings would have cost, and suggests up to five changes. You choose which to apply, each shown first as a diff, and you can undo them. It's MIT licensed.
Tokendoctor is a plugin for Claude Code that uses your own past sessions to estimate what changes would save before you make them.
It replays your last 30 days of sessions at several context sizes and estimates what each would have cost. This step only reads your data. It then proposes up to five changes and applies only the ones you pick, showing each as a diff first. You can undo any change.
Two optional modes are included. One drops old tool output instead of summarizing when a chat gets long. The other sends a short keepalive message before the prompt cache expires, so a chat you resume after a break doesn't need to be cached again.
The README claims savings of up to 38 percent. It says this comes from one user's before-and-after comparison, not a controlled experiment, so treat it as a guess. The project is MIT licensed.
New to this? The key idea
Claude Code keeps a running conversation in memory, and the longer it gets, the more text, or tokens, you pay to send again each turn. A prompt cache stores recently sent text at a lower price, but only for a short time. Tokendoctor looks at your own past sessions to show where that text, and the money, is going, like a utility bill broken down by appliance.
Use it at work
Use it for: finding out where your Claude Code usage wastes money before changing any settings. Developers who use Claude Code heavily and team leads who watch its cost should care.
Try it: install, from the README:
claude plugin marketplace add localixai/tokendoctor
claude plugin install tokendoctor@tokendoctor
Restart Claude Code, then run /tokendoctor:sessions.
Commands: /tokendoctor:sessions [days] (read-only savings estimate), /tokendoctor:audit (read-only check of settings, memory and CLAUDE.md), /tokendoctor:dashboard [days] (local dashboard), /tokendoctor:optimize [focus] (propose and apply chosen changes), /tokendoctor undo [n] (revert).
Before you roll it out: free under the MIT licence. The README says nothing leaves your machine, except that it fetches two public Claude Code docs pages once a day and that keepalive pings go to the model through Claude Code like any other message. Replay results are an upper bound. The 38% saving comes from one person's comparison and is not a controlled experiment, and in the author's benchmark settings advice alone cost more in 3 of 4 runs. Keepalive applies only to conversations of 200K tokens or more and saved about 1.6% of the author's monthly spend. It is maintained by a small team, with no version or stability claim on the page.
Summaries are written by AI from the linked source. Always check the original.