Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By Arunjay4213v0.1.0MITIn 2 marketplaces
Stops a session before it runs past a budget. Three figures are guarded, each with a limit you set: the session cost in dollars, the 5-hour plan window and the 7-day plan window. It says nothing until a figure nears its limit, then pins a status line and warns once; past the limit it refuses tool calls and asks before sending another prompt. /guard shows the state and changes the limits.
Trending plugins
7-day copy clicks
Code that runs inside Claude Code on every session, as you, unsandboxed.
Claude Code asks for these when you enable the plugin. Sensitive values are stored in your system keychain.
Modemode
block refuses tool calls once a limit is passed. warn only says so.
One of block, warn
stringdefault block
Enabledenabled
Turn the whole guard off without uninstalling it.
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it sees, changes or blocks tool calls; changes your /config settings; reads or rewrites your prompts.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
2 marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
booleandefault true
Session cost limit (USD)costLimitUsd
Dollars this session may spend before the guard acts. 0 turns the cost guard off.
numbermin 0default 0
Warn at (% of a limit)warnAtPercent
How far along a limit a figure has to be before the guard warns about it.
number1–100default 80
5-hour window limit (%)fiveHourLimitPercent
Percent of the 5-hour plan window the guard allows. 0 turns this guard off.
number0–100default 90
7-day window limit (%)sevenDayLimitPercent
Percent of the 7-day plan window the guard allows. 0 turns this guard off.
number0–100default 95
A spending guard for Claude Code, built as a mod (function hooks).
It watches three figures against limits you set and stops work when one is passed:
While everything is under the warning mark it shows nothing at all.
At 80% of a limit it shows a toast once and pins a line under the prompt:
budget-guard: cost $4.10/$5.00 82% · 5h 71/90% · 7d 15/95%
The line stays while any figure is at the warning level or over, and goes away as soon as everything is back under it. The toast only repeats when the level changes.
Past a limit in block mode, which is the default, two things happen.
First, the next tool call is refused (a subagent's too, since subagents also spend) and the turn is stopped. Stopping the turn matters because a model that is refused one tool tries another, and every attempt is a billed API call:
● Bash(echo c)
⎿ Error: budget-guard: session cost $0.67 passed the $0.66 limit, so the turn was stopped.
/guard override allows the next turn; /guard cost 2 raises the limit.
Second, sending a new prompt asks you first:
☐ Budget
Session cost is $0.59, past its $0.36 limit. Send this prompt anyway?
❯ 1. Send anyway
2. Do not send
"Send anyway" sets an override for that one turn. "Do not send" drops the prompt and says why:
● Prompt dropped by a hook: budget-guard: session cost $0.59 passed the $0.36 limit.
The prompt was not sent. /guard override sends the next one; /guard cost 1 raises the limit.
Past a limit in warn mode, nothing is refused.
The guard shows one toast per turn and keeps the status line pinned.
claude plugin marketplace add Arunjay4213/claude-mods
claude plugin install budget-guard@claude-mods
Mods are early access, so the module only loads when function hooks are switched on.
Add this to ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
Or set it for one run: CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude.

/guard/guard with no arguments prints the current state:
budget-guard: on, in block mode. It warns at 80% of a limit.
session cost $0.31, no limit not guarded
5-hour window 14% of 90% ok
7-day window 15% of 95% ok
Change it:
/guard cost 5 dollar limit for this session (0 turns it off)
/guard 5h 90 percent of the 5-hour plan window
/guard 7d 95 percent of the 7-day plan window
/guard warn only say so, never refuse
/guard block refuse tool calls once a limit is passed
/guard override allow the next turn even if a figure is over
/guard off turn the guard off (/guard on turns it back)
/guard override lasts exactly one turn.
A subagent's turn finishing inside your turn does not use it up.
The six settings are the plugin's own userConfig fields, so /config shows them too.
| Field | Default | What it is |
|---|---|---|
costLimitUsd | 0 | Dollars this session may spend. 0 turns the cost guard off. |
fiveHourLimitPercent | 90 | Percent of the 5-hour plan window allowed. |
sevenDayLimitPercent | 95 | Percent of the 7-day plan window allowed. |
warnAtPercent | 80 | How far along a limit counts as a warning. |
mode | block | block refuses work past a limit, warn only says so. |
enabled | true | Turn the whole guard off without uninstalling it. |
Changing one with /guard writes it through $.config.set into ~/.claude/settings.json under pluginConfigs["budget-guard"].options, so it survives a restart.
Claude Code reloads the module whenever its options change, and that reload is the short "options changed - reloaded" notice you see after /guard cost 5.
If a host refuses to let a plugin write its own userConfig row, the guard keeps the same six fields in $.store instead, and /guard says "Kept in the plugin store" where it would otherwise say "Kept in the plugin settings".
The $.config.set path works on the Claude Code build this was written against (2.1.272), so the fallback should be rare.
Everything is read with $.session.usage() called with no argument.
That form is free, because it only reports the figures the last API response already carried.
cost.usd is the same dollar figure /cost and the status line show.rateLimits[] carries five_hour and seven_day with a percentUsed, rounded here with Math.round.It reads at session.start, after every turn, and inside tool.call just before deciding, since cost keeps moving during a turn.
The guard times the tool.call read once per session and writes the result to the debug log:
7-day copy clicks
npx claudepluginhub arunjay4213/claude-mods --plugin budget-guardPlugins from other owners that cover similar ground
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.