tokenscope finds token waste in AI coding agent sessions
tokenscope is an open-source tool that shows where an spent its tokens during a work session. It reads local and finds cases where the same files or content were sent again and again, or where very large took over the . Each finding includes a suggested fix and an estimated saving.
It can run without a full install through `npx tokenscope-ai`, or it can be installed globally. Claude Code logs under `~/.claude/projects/` are supported in version 0.1, while universal proxy mode, OpenAI raw JSONL logs, Gemini CLI, aider, and adapter support are listed as future or -stage work. Results can appear in the terminal or as a single HTML treemap report that opens in a browser and can be shared with a team.
s use a local tokenizer and are estimates, with about a 5% margin, so the goal is to spot waste patterns rather than match a bill exactly.
Key points
- It analyzes locally, with no account, API key, or remote upload required.
- It flags repeated content and oversized tool results that consume too many tokens.
- It gives concrete fixes and estimated savings for each problem it finds.
- It can create an HTML treemap report for sharing with a team or attaching to a PR.
- Its s are approximate, so it is better for comparing waste than for exact billing.