If you’re a dev chaining Claude Code sessions like it’s free coffee, this hits home: your wallet’s bleeding, and Anthropic’s not telling you why. kerf-cli changes that — a local CLI that slurps up those hidden JSONL logs and spits out the truth.
Look, I’ve seen this movie before. Back in AWS’s early days, bills arrived like tax bombs because no one tracked instance hours properly. Devs hacked spreadsheets; now one’s doing it for Claude Code.
Here’s the kick.
The creator logged in, typed /cost, and Claude chirped back:
With your Claude Max subscription, no need to monitor cost.
Two days later? 91% of weekly limit torched in a morning. No breakdowns. No project splits. Just pain.
Why Build kerf-cli When Anthropic Has Dashboards?
They don’t. Not for solo Max users. You’ve got org-level web consoles for teams — useless here. ccusage? Solid totals, but no ‘which project ate Opus tokens?’ Or cache hit rates over 30 days.
Kerf-cli fills the void. TypeScript CLI on commander, ink, better-sqlite3. Sync once: ingests every ~/.claude/projects JSONL into local SQLite. Incremental after that. Then query away.
$ kerf summary –period week –by-project
Total: $178. Cache hit: 98%. Projects: $117 (66%). Subagents: $42. Kerf itself: $14 — meta, right?
But the SQL hatch? Gold.
$ kerf query “SELECT date(timestamp) as day, ROUND(SUM(cost_usd), 2) as cost FROM messages WHERE timestamp > date(‘now’, ‘-7 days’) GROUP BY day”
Daily burns laid bare. Copy-paste examples included. Schema dump too. Read-only SELECTs only — no accidents.
Can kerf-cli Actually Stop the Bleeding?
Hell yes. Efficiency analyzer: Scans sessions, flags Opus overkill. Creator switched 90% to Sonnet — file edits, refactors, deps. 4x cheaper, zero quality drop.
“This was the moment kerf paid for itself.”
Budget enforcement? Set $50 weekly: kerf budget set 50 –period weekly. Hooks into Claude Code PreToolUse — checks before every call. Over? Blocks it. Exit code 2. Warnings are for amateurs.
Web UI at localhost:3847. Sub-100ms SQLite queries. Budget cards, efficiency tips, cache stats. Sortable tables, cost charts by model. Local-only — your data stays put.
Claude Code Billing’s Dirty Secrets
Staring at JSONLs reveals ugliness. Cache reads: 60-80% of costs. Billed at 10% input rate — cheap until you’re reading 50K tokens per turn. Tweak CLAUDE.md, cut invalidations: biggest lever.
Opus defaults everywhere. But 90% sessions? Simple stuff. Sonnet suffices.
Anthropic’s making bank on this fog. Max subs lull you: ‘No need to monitor.’ Meanwhile, unchecked Opus + cache balloons bills. Who’s winning? Them. You? Not so much.
My hot take — unique to this beat: This echoes Stripe’s early API days. Devs built custom dashboards because their console hid fees in ‘misc.’ Stripe iterated; Anthropic? Crickets. Expect copycat features in six months, post-kerf popularity.
And enforcement hooks? Game-changer. Imagine git pre-commit blocking deploys over budget — that’s the future for AI tools.
Kerf’s open source, naturally. GitHub awaits your fork. But don’t sleep: As Claude Code scales, costs explode. Tools like this aren’t nice-to-haves; they’re survival gear.
Setup’s a breeze: npm install, kerf sync, done. Hooks via init –enforce-budgets.
Skeptical? Run it on your logs. That $178 week becomes history.
Who’s Footing the Bill in AI Dev?
Real people — indie devs, bootstrappers — get hosed first. Enterprises have accountants; you don’t. Kerf levels it, asking the money question: Switch models? Yes. Cache better? Absolutely.
Predictions: Anthropic notices, adds half-baked /analytics. Too late — locals win on privacy, speed.
Or they acquire the creator. Stranger things happened in the Valley.
Bottom line: If Claude Code’s your hammer, kerf-cli’s the ruler measuring swings. Grab it before next bill shocks you.
🧬 Related Insights
- Read more: Microsoft’s Agent Governance Toolkit: Taming Wild AI Agents or Just More Redmond Wrapping Paper?
- Read more: Galaxy S26 Ultra: 214 Grams of Peak Perfection—And Why It Annoys Me
Frequently Asked Questions
What is kerf-cli and how does it track Claude Code costs?
Local CLI ingests JSONL session logs into SQLite for queries, summaries, budgets. Enforces caps via hooks.
Does kerf-cli save money on Anthropic bills?
Yes — flags Opus-to-Sonnet switches (4x savings), cache optimizations (60% cost chunk). Creator cut monthly bill meaningfully.
Is kerf-cli open source and free?
Totally. npm install, GitHub repo. No cloud, no subs.