cost-summary
它能做什么
这项技能把所有已记录的 AI 成本数据汇总为一份摘要,供人或其他工具阅读。适合想快速概览,或想为仪表盘提供数据的人。
适用场景
- ✓当你想快速查看 AI 总支出和预算状态时。
- ✓当其他工具或脚本需要稳定的成本摘要来读取时。
- ✓当你想把最贵的会话和节点合计数据放在一处时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-summary/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请给我一页纸的摘要,列出我所有 AI 支出和预算状态。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能把成本追踪记录和节点记录中的数据合并为一个输出。默认输出固定格式的 JSON,如果你需要,也可以输出 Markdown 表格。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Cost Summary
A stable single-call interface that other plugins / scripts / dashboards can shell out to and parse. ADR-0002 considered exposing cost_report / cost_summary as proper MCP tools but deferred that — adding MCP tools requires modifying @claude-flow/cli source, out of scope for plugin-local work. This script is the equivalent: same data, exposed via a stdout JSON contract.
When to use
- Another plugin needs a snapshot of cost state — it shells out to
summary.mjs --format jsonand parses. - A dashboard / Slackbot fetches a one-line cost rollup.
- Quick "where am I right now?" view that pulls from every cost-tracker source (cost-tracking + federation-spend).
Output contract (JSON, stable)
{
"exportedAt": "<ISO>",
"total_cost_usd": 1546.36,
"sessionCount": 1,
"conversationCount": 1,
"byTier": { "haiku": 0, "sonnet": 0, "opus": 1546.36, "unknown": 0 },
"byModel": {
"claude-opus-4-7": {
"tier": "opus",
"cost_usd": 1546.36,
"messages": 1597,
"input_tokens": 3090,
"output_tokens": 3295940,
"cache_creation_input_tokens": 10659599,
"cache_read_input_tokens": 732833690
}
},
"topSession": {
"sessionId": "1dba3b8c-...",
"total_cost_usd": 1546.36,
"messageCount": 1597
},
"budget": {
"budget_usd": 2500.00,
"setAt": "<ISO>",
"spent_usd": 1546.36,
"utilization": 0.6185,
"level": "INFO"
},
"federation": {
"eventCount": 0,
"peerCount": 0,
"totalUsd24h": 0
}
}
Steps
# Markdown (default)
node plugins/ruflo-cost-tracker/scripts/summary.mjs
# JSON for programmatic consumption
node plugins/ruflo-cost-tracker/scripts/summary.mjs --format json
Optional env: SUMMARY_NAMESPACE=cost-tracking, SUMMARY_FED_NAMESPACE=federation-spend, SUMMARY_FORMAT=json.
Cross-references
cost-report— narrative report (per-agent / per-model lens; uses same data)cost-export— pushes to Prometheus / webhook (this skill is pull-style; export is push-style)- ADR-0002 §"Decision" — explicitly defers proper MCP-tool registration to a future ADR
常见问题
输出格式稳定吗?
稳定。来源将 JSON 格式描述为稳定的约定,因此其他工具可以依赖相同的字段。
它包含哪些数据?
总支出、按等级和按模型的支出、最贵的会话、预算状态和节点合计。
我能在脚本中使用它吗?
可以。脚本可以运行它,并直接读取 JSON 输出。
详情
作者的原始描述
Single-shot programmatic dump of all cost data — total spend, per-tier, top session, budget status, federation aggregate. JSON or markdown.
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1610
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。