cost-health
它能做什么
这项技能同时运行四项 AI 成本检查,并给出一个综合的通过或失败结果。适合希望在自动化流程中设置单一成本关卡的团队。
适用场景
- ✓当你希望在持续集成步骤中运行一项成本检查时。
- ✓当你希望得到一个涵盖预算、趋势、异常和预测的综合健康结果时。
- ✓当 AI 成本看起来不健康时,你希望构建失败时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-health/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请给我的 AI 支出做一次总体的成本健康检查。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能同时启动预算、消耗速度、异常值和预测四项检查。它返回其中最高的错误代码,并为每项检查打印一段简短摘要。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
The four CI-gate skills (budget / burn / anomaly / projection) each answer
a different question. This skill composes them — runs all four IN PARALLEL,
returns max(exit_codes), prints a one-line summary per check.
| Subcheck | Question | Default threshold |
|---|---|---|
budget |
"Have we crossed the configured budget?" | HARD_STOP at 100% |
burn |
"Is daily burn accelerating?" | +100% vs prior-week mean |
anomaly |
"Is any specific session a >3.5σ outlier?" | ≥1 outlier |
projection |
"When will we hit 100% of budget?" | <14 days |
Algorithm
Implementation: scripts/health.mjs.
- Spawn all four subcheck scripts in parallel (
Promise.alloverchild_process.spawn). - Each subcheck emits
--format json; parse and capture exit code. - Projection has no built-in exit code — synthesize one from
daysUntilReached[100%] < --alert-days-to-exhaust. - Final exit code =
max(subcheck exits). Any single failure fails the gate. - Print one-line summary per check + overall HEALTHY/UNHEALTHY badge.
CI integration
- name: Cost health gate
run: cost health --alert-acceleration 100 --alert-outliers 1
A single step covers four alert ladders. Before this skill you'd wire four separate gates that each duplicated the npx + memory-list overhead; now it's one shell-out (and the four subcheck npx calls run in parallel internally).
Customizing thresholds
# Quarterly review — stricter thresholds
cost health --alert-acceleration 50 --alert-outliers 1 --alert-days-to-exhaust 30
# Production drift gate — only fire on egregious changes
cost health --alert-acceleration 200 --alert-outliers 3 --alert-days-to-exhaust 7
# Skip the slow burn check during a smoke run
cost health --skip burn
Smoke transcript (5 healthy sessions, then add 1 outlier)
# Healthy
Overall: ✓ HEALTHY (max exit code 0)
| Check | Status | Detail |
| budget | ✓ | unknown — no budget configured |
| burn | ✓ | delta within ±100% |
| anomaly | ✓ | 0 outliers — under threshold ≥1 |
| projection | ✓ | no budget configured — skipping |
# After adding $5 outlier (vs $0.10 baseline)
Overall: ⚠ UNHEALTHY (max exit code 1)
| burn | ⚠ | ALERT 5163.2% acceleration: latest bucket $5.00 is 5163.2% above prior mean $0.095 |
| anomaly | ⚠ | ALERT 1 outlier (|z|>3.5) |
Skipping subchecks
cost health --skip burn,projection # only budget + anomaly
Useful when:
- A subcheck doesn't apply (no budget set → skip projection)
- A subcheck is too slow for fast-feedback contexts (smoke runs)
- A subcheck is being independently CI-gated already
Exit code semantics
| Exit | Meaning |
|---|---|
| 0 | All subchecks OK |
| 1 | At least one subcheck fired an alert (budget HARD_STOP, burn drift, anomaly outlier, projection imminent-exhaust) |
| 2 | A subcheck had a config/usage error (e.g. invalid CLI args propagated to a subscript) |
| 127 | A subcheck failed to launch (script missing, etc.) |
max() means the worst signal wins — exit 2 (config error) always dominates
exit 1 (alert), so you spot misconfigured pipelines before they masquerade
as healthy.
常见问题
预测检查测试什么?
它检查预算是否会在不到 14 天内被全部用完,这是默认值。
它运行哪些检查?
预算、消耗速度、异常会话和预测,每项都有各自的默认阈值。
我能更改阈值吗?
可以。选项可以设置加速上限、异常会话数量和耗尽天数的提醒。
详情
作者的原始描述
Composite CI gate — runs cost-budget-check + cost-burn + cost-anomaly + cost-projection in parallel and surfaces a single combined health status with max exit code. The operationally-useful entry point — one shell-out covers all four alert ladders.
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1602
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。