From claude-spend
Use when the user wants a token + cost breakdown of their LOCAL Claude Code activity (via ccusage parsing ~/.claude/projects/**/*.jsonl) — invoked as /claude-usage [daily|session|current|monthly|project|live|--live|--g|--graph|--report], or natural language like "show my Claude usage", "how many tokens have I used", "per-project Claude cost", "ccusage report". Distinct from /claude-spend (Anthropic Admin API billed cost).
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-spend:claude-usage [daily|session|current|monthly|project|live|--live|--g|--graph|--report][daily|session|current|monthly|project|live|--live|--g|--graph|--report]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
The user invoked `/claude-usage` (or asked a natural-language question about Claude Code token usage). Argument: `$ARGUMENTS`
The user invoked /claude-usage (or asked a natural-language question about Claude Code token usage). Argument: $ARGUMENTS
Run ccusage (parses ~/.claude/projects/**/*.jsonl) to produce a token + cost overview. Pick the subcommand based on the argument.
| Argument | Command to run | Purpose |
|---|---|---|
(empty) or daily | npx ccusage@latest | Daily token + cost rollup (default) |
session | npx ccusage@latest session | Per-session breakdown |
current | (resolve current session UUID, then) npx ccusage@latest session -i <uuid> | Just this session — see workflow below |
monthly | npx ccusage@latest monthly | Monthly rollup |
project | npx ccusage@latest session --json | python "${CLAUDE_PLUGIN_ROOT}/scripts/usage-by-project.py" | Per-project cost breakdown |
live or --live | do not run — print instructions | Live 5h-block burn rate (blocking TUI) |
--g | npx ccusage@latest session --json | python "${CLAUDE_PLUGIN_ROOT}/scripts/usage-terminal.py" | Terminal bar charts (daily cost + top projects) |
--graph | python "${CLAUDE_PLUGIN_ROOT}/scripts/usage-app.py" | Launch Streamlit dashboard (blocking) |
--report | npx ccusage@latest session --json | python "${CLAUDE_PLUGIN_ROOT}/scripts/usage-report.py" --outdir "$HOME/.claude/claude-spend-reports" | Write CSV + Markdown report for finance/admin |
The Python-backed subcommands (
project,--g,--graph,--report) need extra packages:pandas,plotext(for--g),plotly+streamlit(for--graph). If you seeModuleNotFoundError, tell the user to runpip install pandas plotext plotly streamlitand retry.If
pythonis not on PATH (common on Windows), retry withpyinstead.
daily / session / monthly/claude-usage subcommands so the user can drill in.currentShows just this Claude Code session — not all sessions.
~/.claude/projects/ is the cwd with :, \, / all replaced by -. The current session is the most-recently-modified *.jsonl in that folder:
$encoded = (Get-Location).Path -replace '[:\\/]', '-'
$uuid = (Get-ChildItem "$env:USERPROFILE\.claude\projects\$encoded\*.jsonl" |
Sort-Object LastWriteTime -Descending | Select-Object -First 1).BaseName
Write-Output $uuid
npx ccusage@latest session -i <uuid> (substitute the resolved UUID).session (all sessions in this project) or the per-session statusline ($X ⏱Ym Zs) which already shows the live cost for this window with no command needed.projectnpx ccusage@latest session --json | python "${CLAUDE_PLUGIN_ROOT}/scripts/usage-by-project.py" via Bash. The aggregator script:
~/.claude/projects/<encoded-path>/ (including subagent sessions under <parent-uuid>/subagents/)session or monthly for drilling further into the top project.Notes:
(non-claude: <agent>).~/.claude/projects/ get bucketed under (unmapped-claude-sessions).Important framing note to include once at the top of the digest:
"Cost" is the API-equivalent. If you're on a Claude Pro/Max plan, this represents the value extracted, not money out of pocket.
live or --liveccusage blocks --live is a full-screen TUI that streams indefinitely — do not call it from Bash (it will hang or get killed by the timeout, and the captured output is meaningless).
Instead:
npx ccusage@latest blocks --live
--live means "only the live view".--g--graphscripts/usage-app.py shells streamlit run which blocks the foreground. Run it with run_in_background=true via Bash.--report~/.claude/claude-spend-reports/:
claude-usage-YYYYMMDD-HHMM.csv — one row per (day × project), columns: date, project, cost_usd, tokens, cache_read_tokens, cache_read_pctclaude-usage-YYYYMMDD-HHMM.md — totals + top-10 projects + top-10 tools tables, ready for paste into a finance ticketccusage is offline — it reads the local session logs, no auth needed, no network call beyond npm install of the package itself.daily / session / monthly — don't extend it.daily and mention what you did in one line so the user can correct.--graph blocks indefinitely — always use run_in_background=true./claude-spend: /claude-spend is what Anthropic bills you (authoritative), /claude-usage is what your local logs estimate (great for per-project attribution).Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub aasadi1978/claude-spend --plugin claude-spend