cost-health
できること
このスキルは、AIのコストに関する4つのチェックを一緒に実行し、合否の結果を1つにまとめます。自動化パイプラインで、コストの単一の確認ゲートがほしいチーム向けです。
使う場面
- ✓継続的インテグレーションの工程で、コストチェックを1つ実行したいとき。
- ✓予算、傾向、外れ値、予測をまとめた1つの健全性の結果がほしいとき。
- ✓AIのコストが異常に見えたら、ビルドを失敗させたいとき。
スキルのリンク
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-health/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“AIの支出について、全体のコスト健全性チェックを1つにまとめて教えてください。”
毎週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日未満で使い切られるかどうかを確かめます。14日は既定値です。
どのチェックを実行しますか?
予算、消費速度、外れ値のセッション、予測の4つで、それぞれ既定のしきい値があります。
しきい値を変えられますか?
はい。オプションで、加速度の上限、外れ値の数、残り日数のアラートを設定できます。
詳細
作者による元の説明
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作業量の変化に合わせて、エージェントのグループを分割し、再配分する手助けをします。作業に合った配置を選びます。
agent-agent
81k大きな目標を順番に並んだ行動計画にし、状況が変わったときに計画を立て直す方法をエージェントに教えます。
agent-agentic-payments
81kAIの買い物のために、支出の上限、期間、販売店のルール、署名付きの承認を含む支出の委任を管理する手助けをします。
agent-analyze-code-quality
81kコードの品質を確認し、コードの臭い、技術的負債、リファクタリングの案を見つける手助けをします。ファイルは変更しません。