Skip to main content
command CX Codex

top-spenders — Claude Code command: what it does, how to install

top-spenders sorts Claude Code sessions by cost and lists the most expensive ones. Use it to inspect session spending and compare the top entries with the total.

MIT ★ 1,198 updated 2026-10-23

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-analytics@claude-code-agent-monitor-plugins
Open on GitHub

What top-spenders does

The command gets sessions from the Agent Monitor dashboard, then sorts them by the inline cost value in descending order. For each of the requested entries, it prints the USD cost, model, working-directory name or ID, and start time. If you omit N, it uses 10.

It also adds up the listed sessions and reports their share of the cost across all returned sessions. Currency values use four decimal places. The Agent Monitor dashboard must be reachable at localhost:4820; if it is down, start it with npm start from the repository root.

For Claude Code, install the command through the plugin marketplace. The repository also provides install paths for Codex, GitHub Copilot, and Gemini CLI.

What it helps with

  • rank Claude Code sessions by cost
  • compare spending across models and working directories
  • calculate the top sessions' share of total cost
  • inspect session start times alongside costs

Example prompts for the agent

  • List the five most expensive Claude Code sessions: /ccam-analytics:top-spenders 5.
  • Show the default number of highest-cost sessions: /ccam-analytics:top-spenders.
  • Calculate the share for the three costliest sessions: /ccam-analytics:top-spenders 3.

How to install top-spenders

1Plugin marketplace

/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-analytics@claude-code-agent-monitor-plugins

2Manually: put the files in place

.claude/commands/top-spenders.md

Call it with /top-spenders. For all projects use ~/.claude/commands/

Questions about top-spenders

How do I install top-spenders in Claude Code?

Run /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then run /plugin install ccam-analytics@claude-code-agent-monitor-plugins.

What does top-spenders do?

It orders Agent Monitor sessions by cost and lists the most expensive entries. It then reports their combined cost and its share of the total cost for all returned sessions.

What does top-spenders need to run?

The Agent Monitor dashboard must be available at localhost:4820. If it cannot be reached, start the dashboard with npm start from the repository root.

Source text

top-spenders.md · MIT
---
description: List the top N most expensive Claude Code sessions by inline cost.
argument-hint: "[N]"
---

List the most expensive Claude Code sessions from the Agent Monitor dashboard.

`N` = **$ARGUMENTS** (default `10` if empty).

Fetch the session list (each session carries an inline `cost` field from bulk pricing):

```
curl -s "http://localhost:4820/api/sessions?limit=200"
```

Then:

1. Sort sessions by `cost` descending.
2. Print the top `N` as a numbered list, one line each:
   `<rank>. $<cost to 4dp> — <model> — <cwd basename or id> — <started_at>`
3. After the list, print the **summed cost of the top N** and what percent that is of the summed cost of all returned sessions.

Currency as USD to 4 decimal places. Skip sessions with no/zero cost only if it would otherwise pad the list past meaningful entries — otherwise include them. Keep it terse, no extra commentary.

If the dashboard is unreachable, tell the user to start it with `npm start` from the repo root.

© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor

Similar slash commands

All slash commands for Finance and business →

From the same set155

The whole set →
ping ping is a Claude Code command that checks the local Agent Monitor dashboard API and reports its reachability. CX Codex +1 ★ 1,198repo stars repo-onboarding repo-onboarding maps a repository before coding, helping locate the right module, ownership, and checks for a planned change. CX Codex +1 ★ 1,198repo stars debug-live-issue debug-live-issue walks an agent through incident-style debugging: pin down the symptom, isolate the subsystem, reproduce, prove the cause, then apply a minimal fix. CX Codex +1 ★ 1,198repo stars overspend overspend spots the most expensive Claude Code sessions via a local dashboard and displays them in a ranking table. Useful when spending spikes unexpectedly. CX Codex +1 ★ 1,198repo stars runs Pulls recent Workflow-tool fleet runs from the local Agent Monitor and prints a status summary plus a compact table of the latest ones. CX Codex +1 ★ 1,198repo stars recent recent fetches the latest Claude Code sessions from Agent Monitor with costs and run statuses. Useful when you need a quick summary of agent activity and spending. CX Codex +1 ★ 1,198repo stars ship-feature ship-feature — a workflow for taking medium or large feature changes from module inspection through implementation, verification, and documentation updates. Covers backend, frontend, and MCP work. CX Codex +1 ★ 1,198repo stars budget Puts your Claude spend next to a monthly budget you name, then tells you whether you are under it, on pace or already over. CX Codex +1 ★ 1,198repo stars

Project sponsors

Companies that keep this analytics open