Skip to main content
command CX Codex

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

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

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

2Manually: put the files in place

.claude/commands/overspend.md

Call it with /overspend. For all projects use ~/.claude/commands/

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

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set155

The whole set →
report-analyst report-analyst builds executive, cost, reliability and workflow reports from a local CCAM API, keeping units, scope and data freshness intact. Handy when a stakeholder summary has to hold up to scrutiny. CX Codex ★ 1,198repo stars 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 top-spenders 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. 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

Project sponsors

Companies that keep this analytics open