Cost budget check

From ruvnet/ruflo · View interactive version

Cost budget check is an AI agent skill from the GitHub repository ruvnet/ruflo. Read accumulated cost-tracking spend + budget config, compute utilization, emit 50/75/90/100% alert ladder

How to use this skill

Skill file

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

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.

  1. Inspect the markdown summary โ€” budget, spent, remaining, utilization percentage, alert level (๐ŸŸข OK ยท ๐ŸŸก INFO ยท ๐ŸŸ  WARNING ยท ๐Ÿ”ด CRITICAL ยท ๐Ÿ›‘ HARD_STOP), and the recommended action.
  1. 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

```

  1. 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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.