Free Claude Code plugin and CLIMITBeta 0.1.0Sends nothing to us
Measure one Claude Code setup change before you keep it.
See where your tokens go, get ranked fixes to try, then measure whether one change lowers token use (or, on per-token billing, cost) and whether your own tasks still pass – with a 95% interval, in your own repository.
claude plugin install crafthall-optimize --marketplace crafthall/pluginsThen run /crafthall-optimize:usage in Claude Code. Or without the plugin: download the command line tool and run node crafthall-optimize.mjs usage. Needs Claude Code 2.1.292+, git and Node.js 20+.
Already in a session?
/plugin install crafthall-optimize --marketplace crafthall/plugins/reload-plugins1,009,320 tokens in the last 7 days: 2 sessions, 24 requests (counted from your session records; the shares behind the checks and the fixes are estimated, not measured) Tokens by component: input (uncached) 120 <0.1% cache write, 5m TTL 246,400 24.4% cache write, 1h TTL 123,200 12.2% cache read 630,000 62.4% output 9,600 1.0% total 1,009,320 100.0%
Plan: 8 runs (4 per arm per task × 1 task × 2 arms), interleaved, every run cold … expected cost: at most USD 4.00, every run at its --max-budget-usd cap (API billing – Claude Code's client-side estimate; your bill may differ) … Plan only: nothing was run and nothing was spent.
Real output on a seeded demo repository, shortened. Token counts are from its records.
- usage, fixes, compare
- 3 steps
- on every measured ratio
- 95% interval
- sent to us by Optimize
- 0 bytes
- free, open source
- MIT
The problem
A shorter CLAUDE.md feels cheaper. Is it?
A setup change looks like a saving. But token use varies from run to run, so one run before and one after tells you little – and a cheaper run that fails the task is no saving.
| Guess | Measure |
|---|---|
| One run before, one after | Paired runs of your own tasks, interleaved |
| A percentage | A ratio with its 95% interval |
| “Felt faster” | Pass counts from your own success command |
| Cost unknown up front | The plan and its expected cost before anything runs |
How it works
Three steps, from where your tokens go to a measured change
See where your tokens go
Totals by token kind, model, day, main conversation vs subagents, and your top sessions. Then the share of those tokens behind each of six setup checks, with the file and line that triggered it.
Counted from your recordsShares estimated, not measured
crafthall-optimize usagecrafthall-optimize usage · where the tokens goWhere the tokens go (non-native checks D1–D6, estimated, not measured; the checks overlap, so the shares do not add up): … D5 duplicate and contradictory text: about 437 tokens (<0.1%) about 21 redundant tokens in always-loaded files carried by each of 16 main requests evidence: same line in 2 places: CLAUDE.md:3, .claude/rules/tests.md:1 … Token counts are sums of the usage fields in your records; the shares and fixes are estimates to test with compare. Nothing was stored.
Get ranked fixes
Shown by usage and by import-usage, which also takes the rows you copy from Claude Code’s /usage screen: what to change, the evidence, the patch to write and a ready compare --plan-only command.
Estimated, not measured
crafthall-optimize import-usagecrafthall-optimize usage · how to improveHow to improve (ranked as in import-usage; every item is an estimate until compare measures it): 1. [D6, not native] Add a PreToolUse hook on Bash that keeps the last 100 lines of test and build output about 11.7% of token cost – estimated, not measurable; the check behind it covers about 25.7% of your tokens evidence: 12 Bash results over 20000 characters, no PreToolUse filter on Bash patch: add a PreToolUse hook with matcher "Bash" to .claude/settings.json (the costs page has a ready example) try: crafthall-optimize compare --change optimize-D6-bash-output-filter.patch --plan-onlyMeasure one change
Your fixtures before and after the change, interleaved, each run in a fresh git worktree. The result is a ratio with its 95% interval, pass counts for each side and what the measurement itself used. You see the plan first; nothing runs until you confirm.
Measured on N runs of your fixtures
crafthall-optimize compare --change change.patchcrafthall-optimize compare --plan-onlyPlan: 8 runs (4 per arm per task × 1 task × 2 arms), interleaved, every run cold … expected cost: at most USD 4.00, every run at its --max-budget-usd cap (API billing – Claude Code's client-side estimate; your bill may differ) payback horizon: unknown (no --monthly-volume) run cap: 60 metric: token use – raw count of input, cache write (5m + 1h), cache read and output tokens, summed over every model of the run; cache reads count at full weight (how your plan's limit weighs token kinds is not published; a model switch can change cost without changing token use) … Comparisons run on your own Claude account and use your tokens or plan capacity; the expected cost is shown before anything runs. Plan only: nothing was run and nothing was spent.
Crafthall Optimize does not change your setup. You decide what to change.
How to read a result
A range, not a headline number
- Measured or estimated: a result from compare says “measured on N runs of your fixtures”. Everything else – the shares in usage, the fixes – is “estimated, not measured”. A bare percentage is never a result.
- Every cost figure carries one of four labels:API billingAPI-equivalent estimateSubscription capacityUsage creditsCost figures are Claude Code’s client-side estimate; your bill may differ.
- On a Pro, Max or Ultra plan a saving is plan capacity, not money; it does not lower your subscription price.
- Task success: pass counts for each side and, at most, “no drop larger than X pp detected on your success commands (N runs)”. Your success command is the only signal of task success.
- The cost of measuring comes first: you see the expected cost before anything runs, and a comparison whose payback horizon is over 3 months, or cannot be computed, does not start without --force.
- Scope: results hold for your tasks, model and Claude Code version; re-measure after updates.
Case study
Measured on our own agents
As compare printed it – API-equivalent cost at list prices, not money paid or plan capacity saved
Measured saving of 51%: cost ratio 0.488 (95% CI 0.456–0.522), measured on 24 runs of your fixtures.
- Cost ratio (API-equivalent)
- 0.49
- Runs per side (N)
- 12
- 95% interval
- 0.46–0.52
- Passed, before / after
- 11/12 / 12/12
- Cost of measuring (API-equivalent estimate)
- USD 7.70
Data
What Crafthall Optimize reads, stores and sends
Reads
Your repository’s Claude Code config – not your user-level config in
~/.claude/. Session records as usage fields only: token counts, model ids, timestamps, ids, tool result sizes – never message text, tool output or file content. The/usagerows you paste, and the prompt file and success command you givefixture add.Stores
Only
.crafthall/optimize/in your repository, ignored by git and readable by your user only: fixtures with a salted hash of the prompt, comparison records and your billing mode. Never prompt text, file content, secrets, credentials, absolute paths, names or e-mails. Delete the folder to remove everything.Sends
Crafthall Optimize itself sends nothing to Crafthall or to any third party – no telemetry, no account, no network call of its own.
The paired runs of compare are ordinary Claude Code runs on your own account. Like any Claude Code session, they send your prompts and the repository content Claude Code reads to Anthropic, or to your cloud provider if you use Claude Code through one, under your own terms with them.
When you use the plugin, the output of its commands becomes part of your Claude Code conversation, so it is sent to Anthropic like the rest of that conversation.
Install
Five minutes, nothing spent
You need Claude Code (2.1.292 or newer for the one-command install), git and Node.js 20 or newer.
claude plugin install crafthall-optimize --marketplace crafthall/pluginsOlder Claude Code? Use two commands
claude plugin marketplace add crafthall/pluginsclaude plugin install crafthall-optimize@crafthallor as a standalone file
node crafthall-optimize.mjs --helpOne file, no dependencies, Node.js 20+. From GitHub Releases, where each release lists its SHA-256.
Already in a session?
/plugin install crafthall-optimize --marketplace crafthall/plugins/reload-pluginsQuick start
Tell it how you pay (stored once, in this repository only)
crafthall-optimize config set billing subscriptionSee where your tokens went
crafthall-optimize usageFreeze one task you run often as a fixture
crafthall-optimize fixture add fix-login --prompt tasks/fix-login.md --check "npm test"Write the change you want to test as a patch
git diff > trim-claude-md.patchSee the plan without running anything
crafthall-optimize compare --change trim-claude-md.patch --plan-only
These steps read local files and spend no tokens. A real comparison uses your tokens or plan capacity; you see the expected cost first.
Limits
What Crafthall Optimize does not do
- Crafthall Optimize does not change your setup; you decide what to change
- Beta: small effects need many runs and often come back as “not enough evidence”
- Token counts come from Claude Code’s records and are not a bill
- Estimates and measurements, not advice or a guarantee of any saving
- Results hold for your tasks, model and Claude Code version
- For testing a plugin or a skill, claude plugin eval and the skill-creator benchmark fit better
FAQ
Questions
Does Optimize send my code anywhere?
Not to us. Crafthall Optimize itself sends nothing to Crafthall or to any third party: no telemetry, no account and no network call of its own. The paired runs of compare are ordinary Claude Code runs on your own account. Like any Claude Code session, they send your prompts and the repository content Claude Code reads to Anthropic, or to your cloud provider if you use Claude Code through one, under your own terms with them. When you use the plugin, the output of its commands becomes part of your Claude Code conversation, so it is sent to Anthropic like the rest of that conversation.
Does it work on a Pro or Max plan?
Yes. usage, import-usage and fixture spend nothing on any plan. compare uses your API key by default; with --auth subscription it runs on your own Claude login and prints: "Runs count against your plan’s limits; Anthropic’s plan limits assume ordinary, individual use." On a Pro, Max or Ultra plan a saving is plan capacity, not money; it does not lower your subscription price.
How many runs does a comparison need?
By default 4 runs per task and side, at most 60 runs per comparison. A short comparison detects only large changes; smaller ones come back as "not enough evidence". The plan shows the smallest change it can detect before anything runs.
What does a comparison cost me?
The runs use your tokens or plan capacity, each run capped by its fixture’s budget (default 0.50 USD per run). Before anything runs you see the plan and the expected cost, and nothing starts until you confirm. A comparison whose payback horizon is over 3 months, or cannot be computed, does not start unless you add --force. Cost figures are Claude Code’s client-side estimate; your bill may differ.
How is this different from Claude Code’s /usage screen?
Crafthall Optimize can read the rows you copy from /usage (import-usage). What it adds: the share of your tokens behind six setup checks, with the file and line (estimated, not measured), ranked fixes to try, and compare, which measures one change with paired runs of your own tasks and a 95% interval.
Does it change my files?
No. Crafthall Optimize does not change your setup; you decide what to change. It stores only in .crafthall/optimize/ inside your repository, and comparison runs happen in temporary git worktrees – your own working copy is never touched.
How do I remove it?
Run claude plugin uninstall crafthall-optimize@crafthall. Delete the .crafthall/optimize/ folder in your repository to remove everything Crafthall Optimize stored.
How do I get support?
Open an issue on GitHub: github.com/crafthall/optimize/issues. There is no support e-mail. Include the command you ran, the first line of its output and crafthall-optimize --version. The tracker is public: do not post prompt text, code, secrets or unredacted records.
Measure your next change.
One command, then /crafthall-optimize:usage in Claude Code. Free, MIT licence, sends nothing to us.
claude plugin install crafthall-optimize --marketplace crafthall/plugins