The problem
Just saying "hi" to Claude Code costs ~31,000 tokens.
I was paying $500+/month in API costs and had no idea where the tokens were going. So I built tokenwise — a free CLI that shows exactly where your AI coding agent wastes tokens.
What it does
tokenwise audit — Scan your instruction files
It scans your CLAUDE.md, AGENTS.md, and rules files, then shows:
- How many tokens each file costs per message
- Boilerplate the AI already knows ("Always write clean code")
- ALL-CAPS emphasis that doesn't help (NEVER, ALWAYS, MUST)
- Duplicate sections
- Unscoped rules that load when they shouldn't
tokenwise scan — Analyze your sessions
It reads your latest session logs and shows:
- Token breakdown by component (system prompt, history, tool output)
- Cache hit rate
- Top 3 "token hogs" with actionable tips
- Monthly cost projection
The key insight
Most people try to compress context (which makes the AI dumber).
tokenwise measures first, then applies safe fixes. You can't optimize what you can't measure.
Quick start
npx @davizin713/tokenwise audit
npx @davizin713/tokenwise scan
Zero API calls. Zero LLM inference. 100% local. Free forever.
Works with 11 agents
Claude Code, OpenCode, Cursor, Aider, Cline, Codex CLI, Goose, Continue.dev, Windsurf, Augment, and Kilocode.
Links
GitHub: github.com/davi713albano-coder/tokenwise
npm: npmjs.com/package/@davizin713/tokenwise
Built with
TypeScript / Node.js
js-tiktoken for token counting
sql.js for reading OpenCode sessions
MIT licensed
If you use Claude Code or any AI coding agent, try it and let me know what you think! ⭐
Top comments (0)