ccdwyer/budget-governor

Claude Code mod,強制執行工作階段與每日支出上限:提示列上方顯示即時儀表,在 80% 時提醒收尾,達到上限後拒絕新的提示訊息。
ccdwyer/budget-governor

Budget Governor 強制執行支出上限,不只是把支出顯示出來。它會在提示列上方繪製填滿條,顯示工作階段與每日支出、過去一小時的 $/hr 消耗速率,以及每輪成本的迷你折線圖。超過上限的 80% 後,每則提示訊息都會帶有通知,請模型簡潔地完成工作;達到 100% 時會拒絕新的提示訊息(包括排程、轉送與背景工作任務的提示),但像 /budget 這類真正的斜線指令仍可使用。跨過上限的工作階段會得到一次被拒絕的工具呼叫,要求停止並摘要;若它繼續呼叫工具,該工作階段就會結束。每日支出會透過共用儲存空間跨工作階段彙總,並按照每個上限持久保存;檢查或讀取上限失敗時,mod 會採預設拒絕。指令:/budget、/budget session 5、/budget day 20、/budget raise 5、/budget off。透過 ccdwyer/claude-mods 市集安裝。完全在本機執行,不連線也不收集遙測資料。MIT 授權。
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add ccdwyer/budget-governor claude plugin install budget-governor

A Claude Code mod that enforces spending caps instead of just showing them.
$3.20 / $10 today · $1.10 / $5 session, the burn rate in $/hr over the last hour of turns, and a sparkline of what each recent turn cost./budget stays available. That includes skills and /compact, which do cost money. Text that only starts with a / is gated like any other prompt./clear starts a new session with its own count, but its spend still adds to today's total. Resuming a session that began on an earlier day doesn't count its earlier spend against today. That earlier spend does still count toward its session cap. Session totals are kept for a year, so resuming an old conversation doesn't earn it a fresh session allowance.| Command | Effect |
|---|---|
| /budget | Show session and daily spend against the caps |
| /budget session 5 | Cap this session (and later ones) at $5 |
| /budget day 20 | Cap all sessions combined at $20 per local day |
| /budget raise 5 | Raise whichever cap is blocking by $5 |
| /budget off | Remove all caps |
Caps are saved and carry over to later sessions. Costs are what Claude Code's /cost reports. They're booked as they're observed (at every prompt and turn end, and once a minute), so a turn that runs past midnight counts toward the new day. If the host stops reporting cost, the gauge says so, and caps keep being enforced against the last recorded spend.
/plugin marketplace add ccdwyer/claude-mods
/plugin install budget-governor@ccdwyer-mods
/reload-plugins
claude plugin validate .
claude plugin test .
Events this mod hooks, as claude plugin validate reads the module:
session.startsession.endcommand.run{command=budget}turn.startturn.completeprompt.submittool.callui.render{component=AbovePrompt}Engine calls it makes: $.clock.after, $.clock.every (via setUp), $.clock.now, $.clock.sleep, $.command.list (via isCommand), $.command.register (via setUp), $.session.id (via refresh, settled), $.session.usage (via refresh, settled), $.state.get, $.state.set, $.store.delete, $.store.get, $.store.keys, $.store.set (via refresh, setCap), $.turn.abort, $.ui.resolve, $.ui.toast.
A tool.call hook sits in the middle of every tool call: it can see the call, refuse it, or add context to its result. This mod uses that only for the behaviour described above.
It runs entirely on your machine. It sends nothing over the network. It reads the session's cost from Claude Code and keeps a daily ledger in Claude Code's local plugin store.
The mod collects no analytics or telemetry, and its author receives no data from it.
Full policy: PRIVACY.md.
MIT