/pr-review-local:agent-spendfrom pr-review-local
Analyzes token usage and cost from local Claude Code session transcripts, grouped by repo, branch, and PR. Also tracks which skills are used or never fire.
Ships in pr-review-local. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Token usage per PR, from the session transcripts Claude Code already keeps on this machine.
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/spend_by_pr.py" --repo . --gh
| Option | Effect |
|---|---|
--repo PATH | only sessions run inside this path (default: every repo) |
--since 2026-11-01 | only usage from that date |
--gh | map branches to PRs with gh pr list (read-only) |
--rates rates.json | add a USD column: {"<model id>": {"input": X, "output": X, "cache_write": X, "cache_read": X}}, USD per million tokens |
--json | rows as JSON |
--skills | count skill use instead of tokens: per skill, Skill tool calls (auto), typed /commands (typed), sessions and last date |
When asked which skills get used, which never fire, or whether a skill change helped, run with --skills (add --since to compare before and after a change). Show the table, then one line each:
auto (Claude picked the skill) versus typed (the user named it);typed column (/model, /clear...) are not skills; leave them out of the summary.Show the table, highest first, then one line each:
(no branch), which no PR owns;rates.json from memory; ask for the rates or a link to the price page and confirm them. Without rates, report tokens only.main and moved to a branch later counts under main.Lessons from earlier runs live in two files: ~/.claude/skill-lessons/agent-spend.md (any repo) and .claude/skill-lessons/agent-spend.md at the repo root (this repo only).
- <YYYY-MM-DD>: <do or avoid X> because <Y>. (seen: 1). When a line already says the same thing, raise its seen count and date instead of adding one. Facts about this repo go in the repo file, everything else in the user file. Keep each file under 30 lines by merging or dropping stale lessons.seen: 3: if the ashish-claude-skills source repo is open, propose the edit to plugins/pr-review/skills/agent-spend/SKILL.md as a diff and wait for a yes, then delete the lesson once it lands; otherwise say Lesson ready to promote: <line> in the report.Learned: <the line written | nothing>.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub ashishyd/ashish-claude-skills --plugin pr-review-local