RoninForge / BudgetClaw

~1.5k tokens | View as Markdown |

BudgetClaw

v1.1.3

Local spend monitor for Claude Code. Tracks cost per project and git branch, warns before you hit a cap, and kills the process when you blow past it.

Zero keys. Zero prompts. Zero latency added. Reads the JSONL session logs Claude Code already writes locally, and prices every event point-in-time so historical spend stays accurate across Anthropic price changes.

What it does

Per-project, per-branch caps

Set daily, weekly, or monthly limits scoped to a project, a specific git branch, or all projects at once. The tool attributes every Claude Code token to the branch that was checked out when the tool call happened.

Hard kill on breach

Two actions: warn pings your phone via ntfy. kill sends SIGTERM to the Claude Code process and writes a lockfile that catches silent relaunches.

Phone alerts via ntfy

Install the ntfy mobile app, subscribe to a topic, run budgetclaw alerts setup. No signups, no vendor lock-in, BYO server if you want.

Zero network calls

Reads ~/.claude/projects/*.jsonl via filesystem watch. No API keys. No prompts sent anywhere. No telemetry. The only outbound traffic is your own phone push.

Single static binary

One Go binary, roughly 5 MB. No Node, no Python, no background daemon installer, no launchd entries. Uninstall = rm.

Claude Code plugin

Ships with an optional Claude Code plugin that adds a /spend slash command and a session-start hook. Install separately if you want in-editor status.

Point-in-time pricing

Prices come from the open ai-price-index dataset (CC BY 4.0), embedded in the binary at build time so pricing stays fully offline. The dataset carries every rate change with its effective date, so each event is priced at the rate that was live when it ran. A later Anthropic price change does not rewrite your past spend. New models and rate changes land in the dataset within 24 hours, and rate values are verified by hand because a wrong rate would compromise the kill action.

Optional Goei sync

Run budgetclaw sync to push locally-computed spend rollups to a Goei dashboard at goei.roninforge.org. Only aggregate dollar and token totals leave the machine, never prompts or keys. Opt-in and off by default.

How it works

  1. 1 Watch. A filesystem watcher tails new lines appended to ~/.claude/projects/*.jsonl.
  2. 2 Parse. Each tool-call log carries usage.input_tokens, cache_creation_input_tokens, cache_read_input_tokens, cwd, gitBranch, model, timestamp.
  3. 3 Attribute. Tag the log entry with its project (the cwd basename) and the gitBranch Claude Code already records on the line. No filesystem walk.
  4. 4 Price. Map token counts to cost using the open ai-price-index dataset, embedded at build time. Each event is priced at the rate in effect on its own date, so a later price change never rewrites past spend. Rollups land in a local SQLite file.
  5. 5 Enforce. On cap breach, the configured action fires: notify, or SIGTERM plus lockfile so a silent restart is caught.
$ budgetclaw status

PROJECT     BRANCH        TODAY    WEEK
myapp       main          $4.85    $28.30
myapp       feature/auth  $1.20    $3.20
side-proj   main          $0.00    $0.50
TOTAL                     $6.05    $32.00

$ budgetclaw limit list

#  PROJECT  PERIOD  CAP      ACTION
1  *        daily   $10.00   warn
2  myapp    daily   $5.00    kill

What it will not do

No API keys

BudgetClaw never asks for an Anthropic key and cannot log in to your account. It only reads files you already own.

No prompts captured

Only token counts, cost, project name, and branch name are written to local SQLite. Prompt and response text are ignored.

No proxy, no middle

Not an API proxy. Not a process injector. Claude Code's traffic is completely untouched. Source is MIT, auditable, 100% Go.

Commands

CommandPurpose
budgetclaw initCreate ~/.budgetclaw/config.toml with sensible defaults.
budgetclaw watchStart the foreground watcher. Run it in a terminal tab or inside a launchd / systemd user service.
budgetclaw statusShow today and this week's spend grouped by project and branch.
budgetclaw limit setAdd a cap: scope, period, amount, action (warn or kill).
budgetclaw limit listList every configured cap and its current consumption.
budgetclaw alerts setupConfigure ntfy topic and test a push end-to-end.
budgetclaw backfillScan historical JSONL logs once to seed the database.
budgetclaw syncPush aggregate spend rollups to a Goei dashboard. Opt-in, dollar and token totals only.

Frequently asked questions

How does BudgetClaw track Claude Code spending? +

BudgetClaw reads the JSONL session log files that Claude Code already writes to ~/.claude/projects/ on your machine. It parses token counts and prices each event point-in-time, at the Anthropic rate that was in effect when the event ran, using the open ai-price-index dataset embedded at build time. Cost per project and git branch stays accurate even after a price change. It never touches API traffic, never sees your prompts, and never requires API keys.

What happens when I hit a budget limit? +

You configure limits with actions: "warn" sends a phone notification via ntfy, "kill" sends SIGTERM to the Claude Code process and writes a lockfile that prevents silent relaunches. You can set different limits per project, per branch, and per time period (daily, weekly, monthly).

Does BudgetClaw work with Claude Max plan or only API usage? +

BudgetClaw works with any Claude Code setup that writes local JSONL session logs. For API-billed usage, exact dollar costs are calculated from token counts. For Pro and Max subscriptions where billing is flat-rate, token consumption is still tracked as a usage metric so you can see which projects are burning the most of your plan.

Is BudgetClaw a proxy? Does it intercept API calls? +

No. BudgetClaw is a local telemetry reader, not a proxy. It never sits between your code editor and the Anthropic API. It reads log files that already exist on your filesystem. Zero keys, zero prompts, zero latency added.

Where does BudgetClaw store its data? +

Locally in ~/.budgetclaw/ as a single SQLite file. Config is at ~/.budgetclaw/config.toml. No network calls except optional phone alerts to your chosen ntfy server.

How do I install BudgetClaw? +

Run curl -fsSL roninforge.org/get | sh. This downloads a single Go binary (about 5 MB) with no runtime dependencies. Supports macOS (arm64, amd64) and Linux (amd64, arm64). Or use Homebrew: brew install roninforge/tap/budgetclaw. Prefer a manual download? Grab a binary from the latest release.

How do I uninstall BudgetClaw? +

Delete the binary (usually /usr/local/bin/budgetclaw or ~/.local/bin/budgetclaw) and remove ~/.budgetclaw/. That's it. No background daemons to stop, no launchd entries, no cron jobs.

How does BudgetClaw stay up to date when Anthropic ships a new model or changes prices? +

Pricing is sourced from the open ai-price-index dataset (CC BY 4.0), embedded in the binary at build time. The dataset carries every rate change with its effective date, so BudgetClaw prices each event at the rate that was live when it ran rather than today's rate. New models and rate changes land in the dataset within 24 hours, verified by hand against the Anthropic pricing page. Detection is automated; the rate value stays a human step because a wrong rate could fire a kill too early or too late. After a price correction lands, run budgetclaw backfill --rebuild to recompute historical rollups.

BudgetClaw is one of several tools from RoninForge. More on the way: Hanko (Claude Code plugin validator), Shodo (AGENTS.md scorer).