cost-budget-check
它能做什么
这项技能读取你记录的 AI 支出,并与你设定的预算进行比较。适合希望在超出限额之前收到明确警告的人。
适用场景
- ✓当你想知道 AI 预算还剩多少时。
- ✓当你即将开始一大批 AI 任务,想先做安全检查时。
- ✓当你希望定期按计划运行检查时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-budget-check/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我到目前为止已经用掉了多少 AI 预算?”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能将已记录的会话费用相加,用总额除以你设定的预算,并显示提醒级别。达到 100% 时它会返回错误代码,方便脚本安全停止。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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-optimizefirst. - Cron-friendly via
/loop 30mfor continuous monitoring.
Steps
Run the check:
node plugins/ruflo-cost-tracker/scripts/budget.mjs checkFilter by period:
BUDGET_PERIOD=today(defaultall). UseBUDGET_QUIET=1for 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 getHARD_STOP path —
budget.mjs checkexits with code1when utilization ≥ 100%. Wrap critical agent spawns in abudget.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) — populatescost-tracking:session-*cost-report— same data source, narrative formatcost-optimize— recommended action when WARNING/CRITICAL- REFERENCE.md "Budget alert thresholds" — the documented ladder this enforces
常见问题
如何设置预算?
你用一个以美元为单位的金额运行预算设置命令。这项技能也可以显示当前预算。
各个提醒级别是什么意思?
50% 为提示级,75% 为警告级,90% 为严重级,100% 为强制停止级,每级都附有建议的操作。
我能只检查今天的支出吗?
可以。将时间范围设为今天,即可把检查限制在今天的记录中。
详情
作者的原始描述
Read accumulated cost-tracking spend + budget config, compute utilization, emit 50/75/90/100% alert ladder
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1594
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。