agent-cap · free and open source · by okgate

Put a dollar ceiling on your coding agents

One command sets a ceiling in dollars, per day, per week or per run, across Claude Code, Codex and Gemini CLI on your machine. When it is reached, the next tool call in each of them stops, with a message naming the ceiling and the one command that raises it. A runaway guard stops a burst before the day's ceiling is gone. It runs locally, sends nothing, and needs no account.

$ npx --allow-git=root github:agentwares/agent-cap set 40/day

Also set 250/week or set 5/run. Then status for what is left, off to remove the ceiling and its hooks, and demo to see the whole loop on synthetic history first.

What is stopped, and what is not

The ceiling is enforced through each harness's pre-tool-use hook, okgate's hook mode, written at user level so it covers every project. Where there is no hook of ours, agent-cap only warns: a loud line in status and a desktop notification.

HarnessSpend countedAt the ceiling
Claude Codeyes, by seatledger's Claude Code reader (~/.claude/projects)halted by a PreToolUse hook
Codexyes, by seatledger's Codex reader (~/.codex/sessions)halted by a PreToolUse hook; trust it once in Codex's /hooks
Gemini CLIno: seatledger has no Gemini CLI reader or Gemini prices yethalted by a BeforeTool hook; per Gemini CLI's hook docs, not yet run on a live Gemini CLI
Cursorno: Cursor keeps its usage on its serversadvisory only: no Cursor hook written; Cursor may also run Claude Code's hook, untested

Gemini CLI is stopped when the machine's total reaches the ceiling, but its own spend is not in that total yet. Cursor is never counted as stopped, even though Cursor can run Claude Code's hooks: that has not been tested.

The runaway guard and the kill switch

If 25% of the daily ceiling is spent inside 10 minutes (both adjustable), the hooked agents stop and stay stopped until you run resume: the pattern of an agent re-sending its whole context in a loop. okgate's kill switch (OKGATE_KILL=1 or AGENTGUARD_KILL=1, or a .okgate/KILL file) stops every hooked call too. Each stop is written to okgate's hash-chained audit log, and an agent that tries to change its own ceiling is refused.

What status prints

On synthetic history (generated transcripts, not anyone's usage), from demo:

agent-cap — $70.00/day ceiling (Wed 7 Oct, local day, resets Thu 00:00)

  spent       $31.25 of $70.00  (45%)
  remaining   $38.75
  pace        $0.00/hour over the last hour
  ceiling at  not before it resets, at this pace
  runaway     last 10 min $0.00, busiest 10 min $4.73; halts above $17.50 (25% of the daily ceiling)

  harness      spent         at the ceiling
  Claude Code  $29.82        halted (PreToolUse hook, ~/.claude/settings.json)
  Codex        $1.43         halted (PreToolUse hook, ~/.codex/hooks.json; trust it once in Codex's /hooks)
  Gemini CLI   not measured  halted (BeforeTool hook, ~/.gemini/settings.json; per Gemini CLI's hook docs, not yet run on a live Gemini CLI)
  Cursor       not measured  advisory, not stopped (no Cursor hook written; Cursor may also run Claude Code's hook, untested)

  USD at API list prices from seatledger's table (Anthropic read 2026-10-07, OpenAI read 2026-10-07); subscription seats are priced as if on the API.

Where the dollar figures come from

Spend is read from Claude Code and Codex transcripts on your machine with seatledger's readers, and priced per model at the API's list prices from seatledger's table. It is an API-equivalent figure: a subscription seat is priced as if its tokens had gone through the API, so on a Pro or Max plan it measures how hard the agents work, not your bill. Requests on a model with no list price are counted and left out of the total.

What each harness offers on its own

As their pages read on 9 October 2026. None stops the others.

What it reads and sends

For a team

See every teammate's Claude Code and Codex spend in one ledger, with history: seatledger Team.

One budget for the whole team, with an alert before anyone's agents reach it, is not built yet. I want team budget alerts

Source, MIT: github.com/agentwares/agent-cap