跳到正文
Skillpedia
其他81k · #1594

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-budget-check/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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-optimize first.
  • Cron-friendly via /loop 30m for continuous monitoring.

Steps

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

  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:

    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)

{
  "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
常见问题

如何设置预算?

你用一个以美元为单位的金额运行预算设置命令。这项技能也可以显示当前预算。

各个提醒级别是什么意思?

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能