cost-budget-check

Computes API spend utilization against configured budgets and emits tiered alert levels.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill cost-budget-check
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cost-budget-check
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-cost-tracker/skills/cost-budget-check
Command: npx skills add https://github.com/ruvnet/claude-flow --skill cost-budget-check

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Teams running AI agent swarms accumulate API costs across sessions without any automated gate enforcing budget limits, risking unexpected overspend. This Skill reads accumulated cost-tracking records, compares total spend against a configured budget, and enforces a four-tier alert ladder so overspending is caught before it happens.

Core Features & Use Cases

  • Utilization Computation: Sums total_cost_usd across all session-* cost records and calculates percentage utilization against the configured budget.
  • Four-Tier Alert Ladder: Emits INFO at 50%, WARNING at 75%, CRITICAL at 90%, and HARD_STOP at 100% with recommended actions per level.
  • Fail-Closed Guard: Exits with code 1 at 100% utilization, enabling budget.mjs check && spawn guards that block non-essential agent spawns.
  • Use Case: Before spawning a new agent swarm, run the budget check; if utilization is at or above 90%, escalate to cost optimization instead of launching more spend.

Quick Start

Ask the AI to check current API spend against the configured budget and report the utilization percentage and alert level.

Frequently Asked Questions about cost-budget-check

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check API spend against a budget limit?

Run the budget check script, which sums total_cost_usd across all session cost records and compares the total to the configured budget. It outputs spend, remaining balance, utilization percentage, and the current alert level.

How do I set a spending budget for AI agent sessions?

Use the budget script's set command with a dollar amount, such as setting 50.00 USD. The configuration is stored with default thresholds of 50% info, 75% warning, 90% critical, and 100% hard stop.

Can I filter budget utilization by time period?

Yes, set the BUDGET_PERIOD environment variable to today, week, month, or all. The default is all, and you can combine it with BUDGET_QUIET=1 for machine-readable JSON output.

What happens when API spend reaches 100% of budget?

The check enters HARD_STOP state and exits with code 1. Wrapping agent spawn commands in a budget check guard causes them to fail closed, halting non-essential spawns until the budget is raised.

How do I monitor API costs continuously on a schedule?

The skill is cron-friendly and can run on a recurring loop, such as every 30 minutes, to continuously surface the current alert level. Pair it with cost tracking runs so each new session record is evaluated.