usage-report
Skill1 starsChanged 4 months agoMITView on GitHub
Show the token/model report for this session on demand. No autoplay, no forced report after every reply, this is a manual command only.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- agentic-community/mcp-gateway-registrytheir own version, first seen Nov 6, 2026
- CheehooLabs/SpureeSkillstheir own version, first seen Nov 1, 2026
- fws94/product9-token-savertheir own version, first seen Oct 11, 2026
- artisansplatform/claude-code-usagetheir own version, first seen Oct 4, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- agentic-community/mcp-gateway-registry★ 1ksame name
- CheehooLabs/SpureeSkills★ 18same name
- artisansplatform/claude-code-usage★ 2same name
- fws94/product9-token-saver★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- model-routingSkill
- refresh-rulesSkill
- routing-statusSkill
The file
Files
Build the report right now. For each piece of work, name the model that handled it directly (no personas) and how many tokens it spent.
For the main session, sum output tokens by model straight from the transcript file. Claude Code writes one API response as several transcript lines, one per content block, and every line repeats the same full usage, so dedupe by message id before summing; a raw per-line sum comes out 2-3x too high:
PROJDIR=~/.claude/projects/$(pwd | sed 's/[^A-Za-z0-9]/-/g')
SESSION_ID="${CLAUDE_CODE_SESSION_ID:-$(basename "$(ls -t "$PROJDIR"/*.jsonl 2>/dev/null | head -1)" .jsonl)}"
jq -n '
[inputs | select(.type=="assistant") | .message // empty]
| unique_by(.id)
| reduce .[] as $m ({}; .[$m.model // "unknown"] += ($m.usage.output_tokens // 0))
' "$PROJDIR/${SESSION_ID}.jsonl"Two notes on the lookup. The project directory name is pwd with every character outside A-Za-z0-9 replaced by a dash, not just the slashes, so a dot, underscore, or space in the path becomes a dash too. And CLAUDE_CODE_SESSION_ID is documented in Claude Code's environment-variables reference: set automatically to the current session id in Bash tool subprocesses (among others), updated on /clear, which is exactly the context this snippet runs in. The ls -t fallback covers older CLIs where it may be absent; the fallback picks the transcript written to most recently, which can belong to a different open session of the same project.
For delegated agents, use the real numbers from subagent_tokens in their completion notification, resolving the model from an explicit parameter or from the tier (cheap→Haiku 4.5, dev→Sonnet 5, hard→Opus 5, super→Fable 5), as described in skills/routing-status/SKILL.md. Match the tier on the name after the last colon: a plugin install registers these agents under scoped names like bullpen:dev, a copy-into-config install under the bare names, so accept both. Those model names are what the tier aliases resolve to on the Anthropic API on a current CLI (v2.1.219 or later for opus→Opus 5); other providers and older CLIs resolve the same aliases to different models, see the provider table in FAQ.md. If a number isn't available for some piece, say so plainly, don't invent one.
Agents started by a Workflow have no Agent/Task tool call and no completion notification of their own, so their tokens are genuinely not in the transcript. What does exist is one start-nested row per agent in ~/.claude/hooks/state/route-gate.log, with the model each one ran on. When this session ran a workflow, count those rows and report them as "N workflow agents on <model>, tokens not individually tracked" instead of implying the session spent nothing on them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

