Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ruvnet/ruflo --skill cost-summary -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/cost-summary/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cost-summary/

From the same set104

The whole set →
ruflo ruvnet This skill adds multi-agent orchestration, memory, routing, and MCP tools to a project. Use it for swarm tasks and multi-step workflows. Claude Code CX Codex Cursor +1 4,000installs Swarm Orchestration ruvnet Skill for managing agent swarms with parallel execution, dynamic topology, and automatic load balancing. Use when a single agent is not enough and you need to orchestrate specialists of different types. Claude Code CX Codex Cursor +1 2,100installs github-project-management ruvnet Turns issue triage and board upkeep into gh and ruv-swarm calls: labels, subtasks, duplicate lookup. Useful when the tracker holds more tickets than order. Claude Code CX Codex Cursor +1 1,400installs github-workflow-automation ruvnet Automates GitHub Actions with AI agent coordination. Generates optimised pipelines, manages pull requests, analyzes failed runs, and deploys updates with risk assessment. Claude Code CX Codex Cursor +1 1,300installs github-code-review ruvnet Runs a swarm of specialized AI agents to inspect GitHub pull requests for security, performance, and architecture issues. Claude Code CX Codex Cursor +1 1,300installs stream-chain ruvnet Chains sequential agent steps together using streaming JSON flow and provides ready-to-run pipelines. Claude Code CX Codex Cursor +1 1,200installs flow-nexus-swarm ruvnet Deploy cloud-based AI agent swarms and define event-driven workflows with message queues. Use it to coordinate tasks, inspect runs, and scale a swarm. Claude Code CX Codex Cursor +1 1,200installs performance-analysis ruvnet Detects bottlenecks in Claude Flow swarms, profiles agent operations, and generates reports with actionable optimization recommendations. Claude Code CX Codex Cursor +1 1,200installs

Similar

cli-anything-inkscape HKUDS Stateful command-line interface skill for editing vector graphics in Inkscape, tracking project state in JSON, and manipulating SVG documents. Claude Code CX Codex Cursor +1 599installs godot-nodes-scenes gamedev-skills Teaches the agent to build a Godot 4.7 project from nodes and scenes: reusable .tscn files, runtime instancing, autoload singletons, and node lookups that survive renames. Claude Code CX Codex Cursor +1 6,200installs ce-explain EveryInc A skill that explains how a piece of code or a stretch of work ended up in its current shape, with the evidence it used. For the reasoning, not the recommendation. Claude Code CX Codex Cursor +1 952installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs writing-plans Jesse Vincent This skill turns requirements for a multi-step task into an implementation plan before code changes begin. It helps when another engineer needs exact files, interfaces, and checks. Claude Code CX Codex 282,859installs stitch-loop official google-labs-code Guides agents through iterative website creation with Stitch MCP. The agent reads the baton file, generates UI, integrates the page, and prepares tasks for the next run. Claude Code CX Codex Cursor +1 56,300installs improve shadcn Surveys any codebase in read-only mode and writes self-contained implementation plans for other models to execute. Helps audit bugs, tech debt, and security without touching code. Claude Code CX Codex Cursor +1 37,500installs

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

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor