cost-summary — Claude Code skill: what it does, how to install
Extracts a single-shot cost snapshot across models, tiers, and sessions in JSON or markdown. Useful for scripts, bots, and budget tracking.
npx skills add ruvnet/ruflo --skill cost-summary -a claude-codeWhat cost-summary does
The skill gathers spending metrics from the cost-tracking and federation-spend namespaces. It reports total USD spend, breakdowns by tier such as Haiku, Sonnet, or Opus, per-model token counts, the single most expensive session, and budget utilization. Output defaults to markdown, while passing --format json prints a structured payload to stdout.
Under the hood, it executes node plugins/ruflo-cost-tracker/scripts/summary.mjs via Bash. According to ADR-0002, proper MCP tool integration was deferred because it required modifying @claude-flow/cli source code. It requires Node.js in the environment. You can override namespaces and output formats using SUMMARY_NAMESPACE, SUMMARY_FED_NAMESPACE, and SUMMARY_FORMAT.
What it helps with
- dump model spend data to JSON for dashboards or Slack bots
- inspect budget status and percentage utilization
- find the top session by dollar spend and message count
- pull local cost metrics without configuring Prometheus or webhooks
Example prompts for the agent
- Show the current model cost summary in markdown
- Run cost-summary --format json to dump all spend metrics
How to install cost-summary
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-summary -a claude-code2Manually: put the files in place
~/.claude/skills/cost-summary/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cost-summary/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-summary -a codex2Manually: put the files in place
.agents/skills/cost-summary/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-summary -a cursor2Manually: put the files in place
.cursor/skills/cost-summary/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo cost-summary2Manually: put the files in place
.github/skills/cost-summary/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-summary -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-cost-tracker/skills/cost-summaryManually: put the files in place
.devin/skills/cost-summary/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-summary -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set104
The whole set →Similar
Questions about cost-summary
How to install cost-summary in Claude Code?
Run npx skills add ruvnet/ruflo --skill cost-summary -a claude-code in your terminal.
What does cost-summary do?
It aggregates token and dollar expenses across models, tiers, and federation sources, outputting the result in markdown or JSON.
Why is cost-summary implemented as a shell script instead of an MCP tool?
ADR-0002 notes that registering proper MCP tools requires modifying @claude-flow/cli source code. Running a local Node.js script via Bash provides the same JSON contract without modifying CLI internals.
Source text
SKILL.md · MIT
---
name: cost-summary
description: Single-shot programmatic dump of all cost data — total spend, per-tier, top session, budget status, federation aggregate. JSON or markdown.
argument-hint: "[--format json|markdown]"
allowed-tools: Bash
---
# 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 json` and 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)
```json
{
"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
```bash
# 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
© ruvnet · MIT · ruvnet/ruflo