cost

A cost-reporting command that measures token usage from code-review session records. Tokens are the units used to process and generate text.

In plain words
What is it for?
Use it to compare total and typical review costs, main-agent versus subagent spending, token types, depth levels, and reviewer roles.
Why use it?
It shows where a review spends its model-processing budget, which can reveal expensive reviewer roles, review depths, or cache traffic.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/closedloop-ai/claude-plugins/cost
Clone the repo
git clone --depth 1 https://github.com/closedloop-ai/claude-plugins
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,080 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.01080
Opus 5 $0.00026 $0.00540
Sonnet 5 $0.00010 $0.00216
Haiku 4.5 $0.00005 $0.00108

Measured 2d ago against content hash a4051e246ca8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cost scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/code-review/commands/cost.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code-Review Cost Report

review_result.json's telemetry block carries no token data — the Python review pipeline never sees usage. The real numbers live only in the Claude Code session transcripts (~/.claude/projects/<encoded-cwd>/<session>.jsonl plus the per-session subagents/agent-*.jsonl fleet). This command runs a bundled analyzer over those transcripts and attributes spend.

What it reports

  • Total / mean / median / p90 cost across the matched sessions.
  • Main orchestrator vs subagent fleet split (the walker is typically ~65% of spend).
  • Cost by token kind — cache read, 1h/5m cache write, output, input. Cache traffic dominates a long walker loop.
  • Cost by depth tierdeep / standard / shallow, each with mean/median cost, main% split, mean turns, and mean agent count. Depth is resolved from the command variant and --depth args (a bare /code-review:start is standard; :deep/:shallow bind their tier), so this is the like-for-like axis. Pooling depths together makes the headline mean meaningless when the mix of tiers shifts.
  • Cost by reviewer role — bug_hunter, domain_critic, premise, impact_analyzer, auditor, verifier, etc., with $/run so you can see ROI per agent type.
  • Top sessions by cost, with turn count and agent count.

Costs are ESTIMATES: raw transcript token counts × public Anthropic list prices, no 1M-context premium or committed-use discount applied. The value is a consistent yardstick for measuring relative cost and the delta from a change.

Run it

The tool is a self-contained Node bundle (Node 18+, no install):

# Scan every code-review session under ~/.claude/projects and print the report
node ${CLAUDE_PLUGIN_ROOT}/scripts/dist/cost-report.mjs --scan

# One specific session
node ${CLAUDE_PLUGIN_ROOT}/scripts/dist/cost-report.mjs --session ~/.claude/projects/<proj>/<session>.jsonl

# Every code-review session in one project directory
node ${CLAUDE_PLUGIN_ROOT}/scripts/dist/cost-report.mjs --project ~/.claude/projects/<proj>

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 60 lines · 51 tokens per session scan A a4051e246ca8

Subscribe to this mod's changes

cost is a command published in the GitHub repository closedloop-ai/claude-plugins (103 stars, last pushed 4d ago), licensed Apache-2.0. It adds 51 tokens to every session and 1,080 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.