Your Claude bill is bigger than it should be. Find out where in 60 seconds.
You're paying more for Claude than you should and you don't know which
sessions, which models, or which habits are costing you the most. Anthropic
publishes the fix — caching, model routing, context discipline, tool design —
scattered across docs, engineering posts, and the changelog. Tokenmin reads
every doc, scans your actual ~/.claude/ usage, and ranks the
next dollar you can save.
30+ patterns from Anthropic docs one command, no auth prompt caching cuts repeated input up to 90% 5x model price spread Haiku vs Opus open-source scanner HMAC-anonymized
Install
curl --proto '=https' --tlsv1.2 -fsSL https://tokenmin.ai/install.sh | bash
macOS or Linux. Windows support is on the roadmap.
No gh, no brew, no auth setup. The installer
detects every Claude variant on your machine, drops a single
tokenmin command on PATH, and offers to add it to your shell
rc with consent. Under 60 seconds. Skip if you already use a paid Claude observability dashboard.
The audit deepens with your usage; give it a week or two of normal Claude work to hit full signal.
The first 60 seconds
After install, one command. Renders inline, in your terminal.
tokenmin
Real output from a real ~/.claude. On API-billed accounts, findings
are ranked by recoverable monthly spend; on flat-fee Pro/Max plans the same
findings rank by severity instead (since $ recovery isn't meaningful when
you're already on a fixed bill). The per-finding bar shows relative impact;
the ★★★★/★★★/★★/★
pill is the severity tier. The Levers scorecard surfaces which of
the five optimization pillars has the most headroom — directional, not absolute.
Live dashboard
Run tokenmin watch while you work. Refreshes every 2 seconds in
place. Shows the active session's spend, cache hit ratio (color-coded
against Anthropic's 90% target), model + tool mix, turn counts, and a
token-rate sparkline. Optional --alert $5 beeps when the active
session crosses your threshold. Pure stdlib, zero deps. Ctrl-C exits.
Works with every Claude install
| Source | How | Status |
|---|---|---|
| Claude Code | reads ~/.claude/ directly |
✓ default |
| claude.ai (web) | Settings → Export data → tokenmin --source export --from FILE |
✓ |
| Claude Desktop | same flow as web — export then --source export |
✓ |
| Claude Desktop (live local store) | reads Electron LevelDB directly | 🚧 in progress |
Callable by browser agents (WebMCP)
tokenmin.ai is one of the first public sites with a real
W3C WebMCP
descriptor. An agent running in Chrome 146+ Canary (with
chrome://flags/#enable-webmcp-testing enabled) sees three
read-only tools registered via navigator.modelContext.registerTool:
| Tool | Returns |
|---|---|
get_install_command | the one-line curl installer |
get_version | current Tokenmin release version |
get_curated_sources | the Tier 1 / Tier 2 source list the detector-research watcher monitors weekly |
Source: webmcp.js.
Feature-detected — the descriptor is a no-op in browsers without
navigator.modelContext, so it can't break anything on
production Chrome, Safari, or Firefox. This is what
agentic-discoverability looks like before consumer browsers
agree on a standard: ship the descriptor anyway, agents pick it up
when they're ready.
Trust — read the scanner before you trust it
The scanner is the code that decides what (if anything) leaves your machine. Apache-2.0, hosted publicly at github.com/watsonrm/tokenmin-scanner. About 5 minutes of reading, end to end.
What gets collected
- Counts — sessions, turns, tool calls, token usage, USD cost estimate
- File paths from Read/Write/Edit — whole-string hashed, no filename suffix leaks
- MCP server names, custom agent / skill / command names — hashed
- Model names — Anthropic's product names (public info)
- Timestamps — session start/end
What never gets collected
- ✗ Raw text from your prompts or assistant responses
- ✗ Tool results / outputs
- ✗ Anything outside
~/.claude/(or, for chat-export mode, your export blob) - ✗ Secrets — Anthropic / OpenAI / Stripe / JWT / npm / Google / AWS / GitHub / Slack tokens, PEM private keys, emails, IPs all get scrubbed before anything is written or sent
Why the hashes can't be reversed
Identifiers are HMAC-SHA256 with a 32-byte salt generated on first run
(stored at ~/.tokenmin/.salt, chmod 0600). An adversary who
guesses common path names like ~/.ssh/known_hosts
cannot precompute its hash without your salt. Cross-snapshot
correlation works within your install; cross-user correlation is broken.
Want stricter? Set TOKENMIN_STRICT_ANONYMIZE=1 for an additional
per-run salt — breaks within-user cross-run correlation too, at the cost of
the engine losing "same file re-read across days" findings.
Audit trail you control
Every snapshot built and every submission is logged at
~/.tokenmin/audit.log (chmod 0600) — UTC timestamp, event,
SHA-256 digest of the payload. Never user content. You can
reconstruct exactly what bytes you sent and when.
Transport defaults
- Default
tokenminmode is local — no network calls --submit-urlrefuseshttp://for non-localhost (HTTPS-only)--api-key-env VARkeeps bearer tokens out ofpsand shell history--no-anonymizerequires a second confirmation flag and refuses to submit
Continuous verification
Every commit to the scanner runs a CI suite of 13 property and CLI tests
plus a synthetic-input leak gate that builds a fake ~/.claude/
with planted client names and fails the build if any survive the scrubber.
Anonymous telemetry — opt-in, under your control
Tokenmin can send a small, fixed-shape anonymous usage signal so the rule base gets sharper for every user. Off by default; asked on first interactive run with an explicit y/N prompt and the full field list.
What's sent, per invocation (the complete list, not a sample):
- tokenmin version + platform + python version
- Which subcommand you ran (
run/watch/show/ etc.) - Which detectors fired — id list only, never the values
- Bucketed distribution shapes (cache hit, parallelism, cost, context pressure) — so we can discover NEW optimization patterns empirically
- Your setup "signature" (CLAUDE.md present, hook count, MCP count) — all bucketed
- Error class + source line on exceptions — never the message or path
- A stable
install_idderived from your salt — can't be reversed to identify you
Never sent: the snapshot, file paths, project names, raw errors, IP, email.
Three controls, any of which wins:
tokenmin telemetry off— persistent, written to settings.jsonTOKENMIN_NO_TELEMETRY=1— env var override, beats settingstokenmin telemetry dry-run— print the exact payload that would be sent, no network call
Full data dictionary + endpoint posture + cryptographic basis for the
install_id:
SECURITY.md → Telemetry.
Full threat model + disclosure path: SECURITY.md.
All commands
tokenmin scan + render inline (the magic moment)
tokenmin watch live dashboard while you work
tokenmin show <id> drill into one finding
tokenmin help 30-second walkthrough
tokenmin help-export claude.ai / Desktop export walkthrough
tokenmin demo sample report with no real data
tokenmin doctor self-diagnose your install
tokenmin selftest run the bundled tests
tokenmin telemetry status view telemetry state + endpoint
tokenmin telemetry dry-run print the exact payload that would be sent
tokenmin telemetry on|off toggle telemetry persistently
tokenmin --version what you're running
tokenmin uninstall clean removal
tokenmin --out FILE write full markdown report
tokenmin --snapshot FILE inspect anonymized payload
tokenmin --submit-url URL send to hosted engine (HTTPS only)
tokenmin --selfcheck dump anonymizer rules
Audit-first install
If you don't trust the network all the way to GitHub, verify the installer before executing:
curl --proto '=https' --tlsv1.2 -fsSL -o install.sh https://tokenmin.ai/install.sh
curl --proto '=https' --tlsv1.2 -fsSL -o install.sh.sha256 https://tokenmin.ai/install.sh.sha256
shasum -a 256 -c install.sh.sha256
less install.sh
bash install.sh
Guides
- Claude Token Optimization: What Actually Moves the Number — the underlying patterns: prompt caching, model routing, context discipline, tool call design, output length, batch API. Every claim cited to primary Anthropic documentation.
Repos
- watsonrm/tokenmin-scanner — public, Apache-2.0 — scanner, engine, and server skeleton in one repo
- SECURITY.md — threat model + defenses + disclosure
- ROADMAP.md — what's next (hosted endpoint on Vercel)