Privacy-first token analyzer for AI agent setups
Know exactly what your agents are eating.
Tolkin measures the standing context of your AI setup: MCP servers, instruction files, skills, cache health. Deterministic numbers, zero network egress, receipts for every claim.
brew install agnelnieves/tolkin/tolkin$ tolkin project --json | jq .totals
{
"files_scanned": 593,
"context_files": 22,
"context_tokens": 44174,
"savings_min": 774,
"savings_max": 2201
}
593 files measured. nothing left this machine.Features
Everything is measured.
Eight commands, one posture: deterministic output, honest labels, and nothing invented. The same Rust core runs in the CLI, the web analyzer, and the GitHub Action.
Honesty tiers
Numbers that admit what they are.
Every figure Tolkin prints belongs to exactly one tier, and the tier is always printed next to it. No blending, no rounding up the confidence.
identified
"advisory estimate"
What audit, mcp, and project flag as reclaimable right now. An estimate, and labeled as one.
realized
"measured structure, estimated frequency"
The measured delta between ledger snapshots of the same project. Structural evidence of what you actually removed.
measured
"ground truth"
Actual spend from your own ingested session logs. Reconciled token-for-token before it is reported.
Model output is a fourth class, "model advisory (local)", and it never joins the tiers.
Local intelligence
A local model, when you want one. Never required.
tolkin optimize runs deterministically on its own. If a local OpenAI-compatible server is already running (mlx-lm, Ollama, LM Studio, llama-server) and you consent, it adds plain-language narration and skill lint on top. Nothing leaves the machine.
The model proposes, Rust verifies. Every model claim has to pass verification gates before it reaches your terminal; anything that fails is dropped and counted, not printed.
- every digit in model output must exist in the deterministic input
- every quoted span must exist verbatim in the source file
- loopback only: 127.0.0.1 is enforced in code
- output is labeled "model advisory (local)", never a tier
When no model is installed, optimize does not dead-end. It detects the machine's RAM and chip, recommends the blessed model for that tier with the download size and a per-machine time estimate, and asks one question before showing the setup guide.
$ tolkin optimize
context files 22
context tokens 44,174
identified savings 774 to 2,201 tokens (advisory estimate)
No local model detected (checked 127.0.0.1 ports 8080, 11434, 1234).
The deterministic report above is complete without one.
Suggested model for this machine: mlx-community/Qwen3.5-4B-4bit (3.0 GB download)
Would you like to see how to install and set it up? [y/N]brew install uv
uv tool install mlx-lm
mlx_lm.server --model mlx-community/Qwen3.5-4B-4bit --max-tokens 1200
tolkin optimizeBlessed models by machine
- 8GB
- Qwen3.5-0.8B
- 16GB
- Qwen3.5-4B
- 32GB
- Qwen3.5-9B
- 48GB+
- Qwen3.5-35B-A3B MoE
measured near 250 tok/s prefill on an M1 Max; estimates printed before any run
MCP exactness
Unknown MCP servers become measured, not guessed.
The catalog covers 22 known servers. For the internal one only your team runs, --probe speaks the real MCP handshake (initialize, then tools/list) to a server your own config already names, tokenizes the returned manifest, and caches it.
Probe once, commit .tolkin/mcp-manifests, and the whole team reports exact numbers. The cached manifest is date-stamped, secret-redacted, and flagged when it goes stale.
$ tolkin mcp mcp.json --probe internal-docs --yes
probing internal-docs over the standard MCP handshake
manifest captured, redacted, cached at .tolkin/mcp-manifests/internal-docs.json
basis: measured (probed manifest, captured 2026-06-11) (exact; supersedes the catalog estimate)Claimed vs measured
We measure vendor claims too.
Compression claims are often measured under different conditions than yours, and the conditions are rarely published. Tolkin runs the tools on a declared corpus, publishes the conditions, and reports what came out.
| Tool | Claimed | Measured |
|---|---|---|
| cavemem | about 75% for prose | 11.72% |
| repomix --compress | about 70% | 45.47% |
declared fixtures, vendored licenses, reproducible runs
Privacy
Zero egress is the default, not a setting.
Three classes of network traffic exist, each user-controlled and documented down to the implementing source file. Everything else: no network calls, ever.
byok verify
Opt-in token verification: one endpoint, your key, your flag. Never runs on its own.
update check
One GET to the npm registry, either explicit (tolkin update) or consented at onboarding.
mcp probe
Speaks only to servers your own config already names. Per-server confirmation, refused in CI.
Kill switches
TOLKIN_NO_SIDECARTOLKIN_NO_UPDATE_CHECKTOLKIN_NO_LEDGERCI
The full posture, with every claim cross-referenced to the source file that implements it, lives in PRIVACY.md.
Distribution
Wherever your agents live.
brew install agnelnieves/tolkin/tolkinnpm install -g @tolkin/clibunx tolkin- GitHub Action
- Delta gates and sticky PR comments: every pull request that touches agent context gets a before and after table.
- Agent skills
- Four skills (audit, slim, optimize, cache) for Claude Code, Cursor, Windsurf, Codex, and any client that reads SKILL.md.
- Claude Code plugin
- One marketplace install namespaces all four skills under /tolkin.
- tolkin update
- Knows your install channel: Homebrew users see brew upgrade, npm users see npm update.