cost-budget-check — Claude Code skill: what it does, how to install
Adds up what the project has spent, compares it with the budget limit and names the alert level. Worth running before you spawn another round of agents.
npx skills add ruvnet/ruflo --skill cost-budget-check -a claude-codeWhat cost-budget-check does
The skill reads the limit from cost-tracking:budget-config, sums total_cost_usd across the session-* records that cost-track writes, then returns a level: 50% INFO, 75% WARNING, 90% CRITICAL, 100% HARD_STOP. Until it shipped, the ladder was documented in the README and nothing checked it. This skill is the check.
One call does the work: node plugins/ruflo-cost-tracker/scripts/budget.mjs check. BUDGET_PERIOD=today narrows the window (default all), BUDGET_QUIET=1 swaps the markdown summary for JSON. Setting and reading the limit use the same script: budget.mjs set 50.00 and budget.mjs get. The skill is allowed Bash plus three MCP memory tools.
At 100% the script exits with code 1, so budget.mjs check && spawn … fails closed. That is the point: the guard runs before the spawn. Past 90% utilization, go to /cost-optimize before spending on more agents. /loop 30m keeps the check on a schedule.
What it helps with
- see what a week of agent runs has cost
- spot a budget that is running out mid-task
- set a dollar limit and read what is left
- block agent spawns once the budget is gone
- keep a budget check running on a timer
Example prompts for the agent
- run cost-budget-check for this week
- how much budget is left? check before spawning agents
- set the limit to 50.00 and show the current alert level
How to install cost-budget-check
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-budget-check -a claude-code2Manually: put the files in place
~/.claude/skills/cost-budget-check/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cost-budget-check/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-budget-check -a codex2Manually: put the files in place
.agents/skills/cost-budget-check/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-budget-check -a cursor2Manually: put the files in place
.cursor/skills/cost-budget-check/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo cost-budget-check2Manually: put the files in place
.github/skills/cost-budget-check/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-budget-check -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-cost-tracker/skills/cost-budget-checkManually: put the files in place
.devin/skills/cost-budget-check/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-budget-check -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set104
The whole set →Similar
Questions about cost-budget-check
How do I install cost-budget-check in Claude Code?
Run npx skills add ruvnet/ruflo --skill cost-budget-check -a claude-code; the skill lands at ~/.claude/skills/cost-budget-check/SKILL.md.
What does cost-budget-check do?
It reads accumulated spend from cost-track and the limit from cost-tracking:budget-config, computes utilization, then reports the alert level with a recommended action.
What happens at 100% of the budget?
You get HARD_STOP: budget.mjs check exits with code 1, so non-essential spawns should stop. Chained with &&, the spawn never runs.
Source text
SKILL.md · MIT
---
name: cost-budget-check
description: Read accumulated cost-tracking spend + budget config, compute utilization, emit 50/75/90/100% alert ladder
argument-hint: "[--period today|week|month|all]"
allowed-tools: Bash mcp__plugin_ruflo-core_ruflo__memory_retrieve mcp__plugin_ruflo-core_ruflo__memory_list mcp__plugin_ruflo-core_ruflo__memory_store
---
# Cost Budget Check
Reads `cost-tracking:budget-config` for the project's budget limit, sums `total_cost_usd` across `session-*` records produced by `cost-track`, computes utilization, and emits the **measured** 4-tier alert ladder (50% INFO / 75% WARNING / 90% CRITICAL / 100% HARD_STOP).
Until P2 (this skill) landed, the README documented the alert ladder but no code checked it. Now this skill is the gate.
## When to use
- After every cost-track run, to surface the alert level.
- Before spawning a swarm — if utilization ≥ 90%, escalate to `/cost-optimize` first.
- Cron-friendly via `/loop 30m` for continuous monitoring.
## Steps
1. **Run the check**:
```bash
node plugins/ruflo-cost-tracker/scripts/budget.mjs check
```
Filter by period: `BUDGET_PERIOD=today` (default `all`). Use `BUDGET_QUIET=1` for machine-readable JSON.
2. **Inspect the markdown summary** — budget, spent, remaining, utilization percentage, alert level (🟢 OK · 🟡 INFO · 🟠 WARNING · 🔴 CRITICAL · 🛑 HARD_STOP), and the recommended action.
3. **Set / inspect the budget**:
```bash
node plugins/ruflo-cost-tracker/scripts/budget.mjs set 50.00
node plugins/ruflo-cost-tracker/scripts/budget.mjs get
```
4. **HARD_STOP path** — `budget.mjs check` exits with code `1` when utilization ≥ 100%. Wrap critical agent spawns in a `budget.mjs check && spawn …` guard to fail closed.
## Storage shape (`cost-tracking:budget-config`)
```json
{
"budget_usd": 50.00,
"setAt": "2026-05-05T...",
"thresholds": { "info": 0.50, "warning": 0.75, "critical": 0.90, "hard_stop": 1.00 }
}
```
## Alert ladder (from REFERENCE.md, now enforced)
| Threshold | Level | Action |
|---|---|---|
| 50% | INFO 🟡 | log notification, no UX disruption |
| 75% | WARNING 🟠 | display warning, suggest `/cost-optimize` |
| 90% | CRITICAL 🔴 | urgent alert, recommend model downgrades |
| 100% | HARD_STOP 🛑 | halt non-essential spawns; exit code 1 |
## Cross-references
- `cost-track` (producer) — populates `cost-tracking:session-*`
- `cost-report` — same data source, narrative format
- `cost-optimize` — recommended action when WARNING/CRITICAL
- REFERENCE.md "Budget alert thresholds" — the documented ladder this enforces
© ruvnet · MIT · ruvnet/ruflo