RoninForge / BudgetClaw

~1.5k tokens | View as Markdown |

BudgetClaw

v0.1.5

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.

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.

Daily pricing audit

A scheduled GitHub Action runs daily and bundles two checks: it diffs Anthropic's /v1/models against the embedded table to catch new model IDs, and it cross-checks every embedded rate against the community-maintained LiteLLM pricing data to catch price changes on existing models. Both signals land in one combined issue because new-model launches typically coincide with price cuts on older models in the same tier. Pricing additions are verified by hand because a wrong rate would compromise the kill action.

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, model, timestamp.
  3. 3 Attribute. Read .git/HEAD at the cwd to tag the log entry with its git branch.
  4. 4 Price. Map token counts to cost using Anthropic's published per-model pricing. 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.

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 maps them to Anthropic's published pricing to calculate cost per project and git branch. 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? +

One scheduled GitHub Action runs daily and bundles two checks. It diffs Anthropic's /v1/models against the embedded table to catch new model IDs, and it cross-checks every embedded rate against the community-maintained LiteLLM pricing data to catch price changes on existing models. Both signals land in one combined issue because new-model launches typically coincide with price cuts on older models in the same tier. Pricing additions are verified by hand against the Anthropic pricing page. Detection is automated; the rate value stays a human step because a wrong auto-merged price 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).