See where your Claude Code spend leaks.
Local audit for Claude Code
See where your Claude Code spend leaks.
CostClaw reads the Claude Code logs already on your disk, finds the token spend you can get back, and scores your setup across six pillars. It runs on your machine and never reads your prompts.
`$npx costclaw audit ` Copy
No account, no upload. It parses the logs on your disk and prints a report.
\~/.claude/projects 1840 sessions · 41 projects · CLAUDE.md found
Recoverable spend $1,284.50 cache-miss exposure
Spend analyzed $6,240.18
Cache hit 95.1%
Active hours 538
Model spend opus 58% / sonnet 33% / haiku 9%
Overall setup score 88 / 100 Tight
- CLAUDE.md quality 78
- Context hygiene 95
- Prompting patterns 92
- Session management 84
- Tool and MCP config 100
- Cost discipline 70
- $52.40 Use a cheaper model for 61 small sessions
- $18.90 Compact four long sessions that lost the cache
- warn Workflow and subagent runs cost $214
- warn Three projects fire one tool 100+ times per session
- Raw session logs
- Your prompts
- File paths and names
- Your code
- Context hygiene_95_
- Cost discipline_70_
- Session management_84_
- $1,284.50 Recover spend lost to cache misses
- $52.40 Use a cheaper model for small sessions
- warn Workflow and subagent runs add up
Top fix by recoverable spend
$1,284.50 Recover spend lost to cache misses Keep the start of each session stable so the prompt cache is reused instead of rebuilt.
Example output. Numbers are illustrative, not from any real account.
input $3.00 / MTok ↓ cache read $0.30 / MTok
Cache-miss exposure
Claude Code caches the front of your prompt so repeat tokens cost a tenth of the price. When a session rebuilds that cache instead of reusing it, you pay full input rate on tokens that should have been nearly free. CostClaw measures the gap and prices it.
Read ×142 in one session
Reactive tool loops
A session that fires the same tool a hundred times is usually thrashing: re-reading, re-grepping, circling a problem. It does not show up as a line item, but it burns tokens and time. CostClaw counts the loops and flags the sessions that run hot.
Opus $15 / MTok ↓ Sonnet $3 / MTok
Model misrouting
A short, simple session does not need the top model. When a quick task runs on Opus that a cheaper model would have served, you pay the Opus rate for Sonnet work. CostClaw flags those sessions and prices the difference against the cheaper model.
cache 91% ↓ 34% by the last turns
Sessions that outgrow the cache
A session that runs for hours keeps adding context until the cache stops paying off. The early turns hit it; the closing turns re-pay full price for a prompt that only grew. CostClaw tracks the per-turn cache and flags the sessions that should have been compacted.
1. 1
Parse locally
It reads the JSONL session logs under your Claude directory, including the subagent and workflow sub-logs, in memory, on your machine. Nothing is sent anywhere. 2. 2Derive a summary
From the raw logs it computes totals: spend by model, cache hit rate per turn, tool use, session timing. Prompts, paths, and code are dropped here. 3. 3Score and rank
It scores six setup pillars from the evidence and your settings, then ranks fixes by the dollars they recover. The report prints to your terminal.Your machine
Stays here. Always.
AuditRecord → only derived numbers and sanitized prose
Hosted dashboard
Optional, on the Pro plan. It only ever receives the derived record above. The free CLI sends nothing at all.
What crosses the line, and what never does.
A cost report, with the recoverable part priced
Real spend over the window you audit, your cache hit rate, and the slice you could get back. The recoverable figure is the headline, so you know what fixing the leak is worth before you start.
Spend analyzed$6,240.18
Cache hit95.1%
Recoverable$1,284.50
A six-pillar setup score from evidence
CLAUDE.md quality, context hygiene, prompting, session management, tooling, and cost discipline. Each pillar is scored only from what your logs, settings, and CLAUDE.md actually show; the audit finds your global CLAUDE.md on its own. A pillar with no evidence reads n/a; nothing is invented to fill a bar.
Fixes ranked by the dollars they recover
Not a wall of warnings. The list leads with the fix that returns the most spend, carries the exact figure and the evidence behind it, and tells you the one change to make. Smaller issues sit below it, in order.
Privacy as the moat
Checkable, not just promised.
The only thing CostClaw produces is an AuditRecord: totals and generated sentences. No prompt text, no file paths, no secrets. That boundary is held by a test that runs on every build.
The test plants tripwire strings, a fake prompt and a fake client path, into sample logs, runs the full pipeline, and asserts that none of them appear in the record. If a leak ever slipped in, the build would fail before it shipped.
packages/engine/tests/audit.test.ts tripwire passing
// the privacy invariant, enforced on every run
const raw = sessionWith({
prompt: "TRIPWIRE_secret_prompt",
path: "/Users/me/clients/acme",
});const record = buildAudit(analyze(raw));
const json = JSON.stringify(record);
expect(json).not.toContain("TRIPWIRE_secret_prompt");
expect(json).not.toContain("/Users/me/clients/acme");
expect(hasEmDash(json)).toBe(false);
CLI
$0runs on your machine
`$npx costclaw audit ` Copy
One-time license that unlocks `costclaw optimize`: a filled-in CLAUDE.md, a ranked fix playbook, suggested settings, and a work order your own Claude Code can apply, all generated from your own project. Verified offline. Your key is emailed to you in about a minute.
Hosted
In progress
Want it when it ships? Leave your email.
Email address Notify me
Not ready yet. The CLI does the core job today.
