Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

Developer monitors a Claude Code terminal interface with SQLite-powered cost dashboard displaying spending…
Open SourceScore: 95

Kerf-CLI: The SQLite-Powered Cost Dashboard Every Claude Code User Needs

Install Kerf-CLI to track Claude Code spending, enforce budgets, and identify wasted Opus spend with a local SQLite database and polished dashboard.

·Apr 8, 2026·5 min read··452 views·AI-Generated·Report error
Share:
Source: github.comvia hn_claude_code, devto_claudecode, gn_claude_code, gn_mcp_protocol, medium_claudeWidely Reported
TL;DR

Kerf-CLI gives you SQLite-backed cost analytics for Claude Code, showing exactly where your money goes and how to save 37%+ by optimizing model usage.

What Kerf-CLI Does — SQLite-Powered Claude Code Cost Intelligence

Kerf-CLI (named after the "kerf" or material removed by a cutting tool) is a 100% local, SQLite-backed analytics tool that reads your Claude Code session data and surfaces exactly where your money is going. It tracks wasted Opus spend, calculates cache hit rates, enforces budgets via Claude Code hooks, and provides a polished local web dashboard—all without sending any data to the cloud.

The core insight: every Claude Code user is flying blind about costs. You might know your monthly bill, but not which sessions or which model choices are driving it. Kerf solves this by ingesting your Claude Code session JSONL files into a local SQLite database you can query directly.

Setup — 5 Commands to Full Visibility

Installation is straightforward:

npm install -g kerf-cli
# or use without installing:
npx kerf-cli@latest <command>

Then run the essential workflow:

kerf init          # One-time setup (creates DB, installs hooks)
kerf sync          # Import Claude Code sessions into SQLite
kerf dashboard     # Open the polished web UI at http://localhost:3847

The kerf init command offers several modes:

  • kerf init (default): Install warning-mode hooks (safe)
  • kerf init --enforce-budgets: Install PreToolUse hook that BLOCKS usage when over budget
  • kerf init --global: Install hooks in ~/.claude/ (applies to all projects)
  • kerf init --no-hooks: Just create database, skip hooks

The Dashboard — What You'll Actually See

Open kerf dashboard and you get:

kerf dashboard

Hero Metrics: Cost, sessions, tokens, cache hit rate with trend arrows vs prior period
Budget Card: Progress bar, remaining amount, reset timer
Efficiency Card: Potential monthly savings if Opus traffic were routed to Sonnet
Cache Card: Hit rate donut chart, money saved from cache
Cost Chart: Stacked area chart broken down by Opus/Sonnet/Haiku usage
Session Table: Click any row to expand full details
Period Picker: Today/week/month/all time
Live Indicator: Auto-refreshes every 5 seconds

All queries run directly against SQLite, so the dashboard loads in <100ms even with thousands of sessions.

Key Commands for Daily Claude Code Work

Beyond the dashboard, these commands give you quick insights:

# What did I spend today?
kerf summary

# Last 7 days
kerf summary --period week

# Am I wasting money on Opus?
kerf efficiency

# Machine-readable sync stats
kerf sync --json

# Diagnose your setup
kerf doctor

The kerf doctor command is particularly useful—it checks 10 things and tells you how to fix each one, like whether you have budgets configured or if your database schema is up to date.

Why This Matters for Claude Code Users

Most developers using Claude Code have no visibility into:

  1. Cache efficiency: What percentage of requests are hitting cache vs. costing real money?
  2. Model optimization: How much could you save by routing appropriate tasks to Sonnet instead of Opus?
  3. Budget enforcement: How to automatically block usage when you hit a spending limit?
  4. Session-level analysis: Which specific coding sessions are driving your costs?

Kerf answers all these questions with a local-first approach that respects your privacy. No API keys, no telemetry, no cloud dependencies.

The SQLite Advantage

Because Kerf uses SQLite as its backend, you can query your own data directly:

-- Find your most expensive sessions
SELECT session_id, total_cost_usd, model
FROM sessions
ORDER BY total_cost_usd DESC
LIMIT 10;

-- Calculate daily spending trends
SELECT date(created_at) as day, SUM(total_cost_usd) as daily_cost
FROM sessions
GROUP BY day
ORDER BY day DESC;

This open data approach means you're never locked into Kerf's visualization—you can build your own reports, connect to BI tools, or analyze patterns that matter specifically to your workflow.

When to Use Kerf-CLI

Immediately if:

  • Your Claude Code monthly spend exceeds $50
  • You work on multiple projects and want per-project cost tracking
  • You suspect you're overusing Opus for tasks Sonnet could handle
  • You need to justify Claude Code usage to your team or company

Consider waiting if:

  • You're just experimenting with Claude Code (costs under $10/month)
  • You exclusively use the free tier
  • You already have comprehensive cost monitoring through Anthropic's dashboard

Limitations to Know

Kerf reads Claude Code's session files, so it can only analyze what Claude Code logs. If you use Claude through other interfaces (web, API directly), those costs won't appear here. The tool also requires Node.js and assumes you're comfortable with CLI tools.

The Bottom Line

Kerf-CLI fills a critical gap in the Claude Code ecosystem: cost transparency. For developers serious about using Claude Code professionally, understanding and optimizing spend isn't optional—it's essential. Kerf gives you that visibility with a polished, local-first tool that respects your data privacy while providing actionable insights.

Install it today, run kerf sync, and within minutes you'll know exactly where your Claude Code budget is going—and how to optimize it.

Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

**Immediate Action**: Run `npx kerf-cli@latest init` in your terminal today. Even if you don't use the dashboard regularly, having the hooks installed will give you budget warnings before you overspend. **Workflow Change**: Add `kerf sync` to your daily startup routine. It takes seconds and ensures your cost data is current. Consider aliasing it: `alias ksync='kerf sync'`. **Budget Enforcement**: If you're on a tight budget, use `kerf init --enforce-budgets`. The PreToolUse hook will block Claude Code usage when you exceed your limit, preventing surprise bills. **Model Optimization**: After a week of data, run `kerf efficiency` to see your "Opus → Sonnet savings" percentage. If it's high (30%+), you're overusing Opus. Adjust your `CLAUDE.md` to default to Sonnet for routine tasks, reserving Opus for complex reasoning. **Team Usage**: If you're managing a team, have everyone install Kerf with `kerf init --global`. The SQLite database makes it easy to aggregate cost data across multiple users while keeping everything local.
Compare side-by-side
Claude Code vs Kerf-CLI
Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Open Source

View all