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
Run the check:
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.
Inspect the markdown summary — budget, spent, remaining, utilization percentage, alert level (🟢 OK · 🟡 INFO · 🟠 WARNING · 🔴 CRITICAL · 🛑 HARD_STOP), and the recommended action.
Set / inspect the budget:
node plugins/ruflo-cost-tracker/scripts/budget.mjs set 50.00
node plugins/ruflo-cost-tracker/scripts/budget.mjs get
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)
{
"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
Source: ruvnet/ruflo → plugins/ruflo-cost-tracker/skills/cost-budget-check/SKILL.md
1---2name: cost-budget-check3description: Read accumulated cost-tracking spend + budget config, compute utilization, emit 50/75/90/100% alert ladder4---567# Cost Budget Check89Reads `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).1011Until P2 (this skill) landed, the README documented the alert ladder but no code checked it. Now this skill is the gate.1213## When to use1415- After every cost-track run, to surface the alert level.16- Before spawning a swarm — if utilization ≥ 90%, escalate to `/cost-optimize` first.17- Cron-friendly via `/loop 30m` for continuous monitoring.1819## Steps20211. **Run the check**:2223 ```bash24 node plugins/ruflo-cost-tracker/scripts/budget.mjs check25 ```2627 Filter by period: `BUDGET_PERIOD=today` (default `all`). Use `BUDGET_QUIET=1` for machine-readable JSON.28292. **Inspect the markdown summary** — budget, spent, remaining, utilization percentage, alert level (🟢 OK · 🟡 INFO · 🟠 WARNING · 🔴 CRITICAL · 🛑 HARD_STOP), and the recommended action.30313. **Set / inspect the budget**:3233 ```bash34 node plugins/ruflo-cost-tracker/scripts/budget.mjs set 50.0035 node plugins/ruflo-cost-tracker/scripts/budget.mjs get36 ```37384. **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.3940## Storage shape (`cost-tracking:budget-config`)4142```json43{44 "budget_usd": 50.00,45 "setAt": "2026-05-05T...",46 "thresholds": { "info": 0.50, "warning": 0.75, "critical": 0.90, "hard_stop": 1.00 }47}48```4950## Alert ladder (from REFERENCE.md, now enforced)5152| Threshold | Level | Action |53|---|---|---|54| 50% | INFO 🟡 | log notification, no UX disruption |55| 75% | WARNING 🟠 | display warning, suggest `/cost-optimize` |56| 90% | CRITICAL 🔴 | urgent alert, recommend model downgrades |57| 100% | HARD_STOP 🛑 | halt non-essential spawns; exit code 1 |5859## Cross-references6061- `cost-track` (producer) — populates `cost-tracking:session-*`62- `cost-report` — same data source, narrative format63- `cost-optimize` — recommended action when WARNING/CRITICAL64- REFERENCE.md "Budget alert thresholds" — the documented ladder this enforces6566---6768**Source:** [`ruvnet/ruflo`](https://github.com/ruvnet/ruflo) → `plugins/ruflo-cost-tracker/skills/cost-budget-check/SKILL.md`