overspend — Claude Code command: what it does, how to install
overspend spots the most expensive Claude Code sessions via a local dashboard and displays them in a ranking table. Useful when spending spikes unexpectedly.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-cost-guard@claude-code-agent-monitor-pluginsWhat overspend does
The command queries http://localhost:4820/api/sessions?limit=200 to inspect recent agent sessions. It sorts the returned entries by inline cost descending and outputs the top N, defaulting to 10 if run without arguments. The output table includes rank, session ID or name, model, started_at, metadata.turn_count, and cost formatted in USD with four decimal places.
Directly below the table, the command adds two summary lines. It prints the total cost of the top N sessions alongside their share of total fleet spend. It also flags any Opus run with a low turn count as a downshift candidate, referencing the model-savings skill.
All operations are read-only. The command fails if the local dashboard is offline; you must launch it beforehand with npm start from the repository root.
What it helps with
- list the most expensive Claude Code sessions
- calculate the share of top sessions in overall fleet spend
- identify short Opus sessions suitable for model downshifting
Example prompts for the agent
- /overspend
- /overspend 5
- /overspend 20
How to install overspend
1Plugin marketplace
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-cost-guard@claude-code-agent-monitor-plugins2Manually: put the files in place
.claude/commands/overspend.mdCall it with /overspend. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/overspend.mdCall it with /prompts:overspend. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/overspend.prompt.mdManually: put the files in place
.gemini/commands/overspend.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about overspend
How to install overspend in Claude Code?
Run /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor followed by /plugin install ccam-cost-guard@claude-code-agent-monitor-plugins.
What does overspend do?
It fetches session records from the local monitor dashboard API, sorts by cost, and renders a table of priciest sessions with spend share metrics.
What prerequisites does overspend require?
It requires the local dashboard running at http://localhost:4820. If it is unreachable, start it using npm start from the repository root.
Source text
overspend.md · MIT
--- description: List the most expensive sessions pushing your spend up argument-hint: "[top-N]" --- List the sessions driving Claude Code spend up — the **top $ARGUMENTS** most expensive (default top 10 if empty). 1. Fetch a wide slice of sessions: ``` curl -s "http://localhost:4820/api/sessions?limit=200" ``` 2. Sort the returned sessions by inline `cost` **descending** and take the top N. 3. Print a table — rank, session id/name, `model`, `started_at`, `metadata.turn_count`, and `cost` (USD, 4 decimals). Below it: - **Sum of the top N** and what share of fleet spend they represent (sum top-N `cost` / sum of all `cost`). - Flag any Opus session with a low `turn_count` as a downshift candidate (point to the `model-savings` skill). If the dashboard is unreachable, tell the user to start it with `npm start` from the repo root. Keep it to one table plus two summary lines. Read-only — do not modify anything.
© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor