CostClaw Get started

Local audit for Claude Code

See where your Claude Code spend leaks.

CostClaw reads the Claude Code logs already on your disk, estimates token value from current list prices, and scores your setup across six rule-based pillars. It analyzes prompts locally and never uploads them.

npx costclaw audit
See what it finds

No account, no upload. It parses the logs on your disk and prints a report.

costclaw audit read-only · nothing uploaded

~/.claude/projects 1 session · 1 project · CLAUDE.md found

Cache-miss exposure (estimate) $90.01 cache-miss exposure
API-equivalent estimate
$100.01
Cache hit
0%
Logged session hours
1

Model spend opus 0.01% / haiku 99.99%

Rule-based setup score 74 / 100 Solid
  • CLAUDE.md quality 72
  • Context hygiene 50
  • Prompting patterns 75
  • Session management 100
  • Tool and MCP config 88
  • Cost discipline 67

Top opportunity by estimated exposure

$90.01 Reduce cache-miss exposure Synthetic scenario: accepted requests compared with cache reads where applicable.
  • $0.00 Flesh out your CLAUDE.md
  • $0.00 Turn repeated prompts into skills
Synthetic example. Values are illustrative, not from any account or invoice.

The leak

Logs show scenarios. Your invoice is the billing record.

CostClaw reads session logs on your disk, including subagent and workflow sub-logs, and compares logged token use with scenarios worth investigating. It does not reconcile an invoice or guarantee savings. Four signals it shows:

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 lower-priced. CostClaw estimates that counterfactual gap from logged fields.

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 might have been suitable for a cheaper model, CostClaw flags it for review. It does not determine task quality or guarantee a cheaper model would succeed.

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 sessions that may benefit from compaction.

How it works

Three passes over logs you already have.

  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. 2

    Derive a summary

    It analyzes raw logs locally to derive dated list-price estimates by reported model, cache hit rate per turn, tool use, and session timing. Prompts, paths, and code are dropped from the output.

  3. 3

    Score and rank

    It applies rules to six setup pillars and ranks counterfactual opportunities. The report prints to your terminal; estimates are not invoice totals or guaranteed savings.

Your machine
  • Raw session logs
  • Your prompts
  • File paths and names
  • Your code

Stays here. Always.

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.
How CostClaw estimates value and where the estimate stops

Method. For each accepted logged request, CostClaw applies the dated API list price for its reported model and sums input, output, cache-write, and cache-read token fields. A synthetic 1,000,000-token one-hour Sonnet cache write is valued at $6.00. Repeated cumulative updates are deduplicated so the latest observed total is counted once.

Scope. The report can use logged cache TTL splits when present. If a valid top-level cache-write count conflicts with a nested split, it preserves that count, estimates it at the conservative one-hour rate, and warns. Legacy writes with no split use the five-minute rate with a warning. It cannot establish model provenance, provider discounts, every billing modifier, subscription inclusion, or an Anthropic invoice total.

Interpretation. Cache-miss exposure compares logged usage with a cache-read counterfactual. In a synthetic mixed-model case, the list-price estimate is $0.10001 and the exposure is $0.090009. That is a scenario to investigate, not recoverable money or a quota guarantee. Setup scores are rule-based signals, not provider grades.

What you get

One command. Four answers.

A dated list-price estimate, with its limits

Estimated API-equivalent value over the window you audit, your cache hit rate, and a cache-miss counterfactual. It is based on logged fields and current list prices, not an invoice or a promise of savings.

List-price estimate
$100.01
Cache hit
0%
Cache-miss scenario
$90.01

A six-pillar setup score from evidence

CLAUDE.md quality, context hygiene, prompting, session management, tooling, and cost discipline. Scores are rule-based signals from the logs, settings, and CLAUDE.md available to the audit. A pillar with no evidence reads n/a; it is not a provider quality grade.

  • Context hygiene50
  • Cost discipline67
  • Session management100

Opportunities ranked by estimated exposure

The list leads with the largest modeled scenario and its evidence, then suggests a change to review. Dollar figures are counterfactual estimates, not money promised back.

  • $90.01 Investigate cache-miss exposure
  • $0.00 Use a cheaper model for small sessions
  • warn Workflow and subagent runs add up

The week your spend actually follows

Burn Clock buckets every dollar by local day and time of day, so you can see the rhythm the bill hides. The peak day is compared against an average day, never against your quietest hour, so the multiplier stays a number you can check against the bars. Under seven active days it reads n/a instead of guessing a pattern.

  • Exa $100.01

Synthetic example only: one day with $100.01 in estimated API-equivalent value. Real reports omit a pattern when there is insufficient activity.

Privacy as the moat

Checkable, not just promised.

The audit saves a derived AuditRecord with totals and generated sentences. Raw prompt text and path markers are covered by privacy tests that run in the 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. The build fails if any tested private marker survives.

Simplified privacy test tested markers
// 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);

Pricing

Free today. Hosted next.

The CLI is real and usable right now, at no cost. The hosted plan is in progress, and it will only ever see the derived record, never your logs.

CLI

$0runs on your machine

  • Local dated list-price estimate and cache-miss scenario
  • Six-pillar rule-based setup score from logs and CLAUDE.md
  • Opportunities ranked by modeled exposure, with evidence
  • Burn Clock: your spend rhythm by day and time of day
  • HTML report, score card, and README badge
  • Runs offline, nothing uploaded
npx costclaw audit
Buy CostClaw - $39

One-time license that unlocks costclaw optimize. It scans your project and writes five artifacts: a filled-in CLAUDE.md, a ranked fix playbook, suggested settings, a work order your own Claude Code can apply, and a dashboard that opens in your browser with the token receipt, the fixes, and your CLAUDE.md before and after. Verified offline. Your key is emailed to you in about a minute.

Hosted

In progress

  • Everything in the CLI
  • Hosted dashboard, history over time
  • Shareable PDF report for billing clients
  • Receives only the derived record

Want it when it ships? Leave your email.

Not ready yet. The CLI does the core job today.

Run it on your own logs.

The audit reads what is already on your disk and prints the report. If it finds nothing, you have lost a minute. If it finds signals, you have a local estimate to investigate.

npx costclaw audit

Reads local logs. Sends nothing. No account.