token-audit
Skill2 starsChanged 28 days agoMITView on GitHub
Measures where Claude Code tokens go, from the local session transcripts: context per API call, the costliest sessions and what they ran, the tools whose results fill the context, and files read again and again. Then it names the few changes that would save the most, such as batching shell steps into one script ("code mode"). Use when the user says "token audit", "where do my tokens go", "why is my usage so high", "reduce token usage", "is code mode worth it for me", or "/token-audit". Not for API billing or pricing questions.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- kratocz/skillstheir own version, first seen Nov 15, 2026
- swarm-routing/skillstheir own version, first seen Nov 15, 2026
- vtmocanu/skillstheir own version, first seen Nov 7, 2026
- lohi-ai/babysittheir own version, first seen Nov 1, 2026
- robritacca-dotcom/rift-dstheir own version, first seen Nov 1, 2026
- UXLana/design-skills-packtheir own version, first seen Oct 25, 2026
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- murphytrueman/design-system-ops★ 197same name
- robritacca-dotcom/rift-ds★ 9same name
- UXLana/design-skills-pack★ 8same name
- ngreenwall/claude-skills★ 2same name
- vtmocanu/skills★ 2same name
- douinc/agent-skills★ 1same name
- Gaurav890/everything-agentic-engineering★ 1same name
- kratocz/skills★ 1same name
- swarm-routing/skills★ 1same name
- Vix0007/vixero-skills★ 1same name
7 more not listed
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 repository13 other files it gives its agents.
- blind-pr-reviewSkill
- bug-huntSkill
- bug-reviewSkill
- context-firstSkill
- course-builderSkill
- mock-interviewSkill
- product-manager-reviewerSkill
- progress-logSkill
- repo-bootstrapSkill
- skill-verifierSkill
- staff-engineer-reviewerSkill
- test-firstSkill
- trip-itinerarySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Diagnose: Read the report in this order:
- Very specific: line 52
Never claim a saving you did not measure.
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Audit
Find out, from real numbers, what uses the user's tokens and what would cut it. Every tool call re-sends the whole conversation, so the count of calls in long sessions usually costs more than any one large result. Good output names the two or three biggest causes with numbers, and a fix for each.
Inputs
$ARGUMENTS / the request:
- Empty → audit every transcript.
- A date (
since 2026-11-01) → pass--since YYYY-MM-DD. To judge a change, run once with--since <date of change>and once without, and compare context per call and calls per session.
Workflow
- Measure. Run
python3 scripts/token_audit.py --top 10(add--since). It reads~/.claude/projects/*/*.jsonl, counts each API response once and prints a short report. Use--format jsonwhen you need exact fields. Do not read the transcripts yourself: they are large, and the script exists so their contents stay out of the context. - Diagnose. Read the report in this order:
- Context per call. Over about 100k means long sessions; every call re-reads that much.
- Costliest sessions. Many
Bashcalls in one session means shell steps were run one at a time. - Tool results. A script or MCP server near the top returns more than the model needs.
- Files read 3+ times. Large files re-read in full.
- Recommend. Give at most four fixes, biggest saving first, each tied to a number in the report:
- Many small shell calls → batch them into one script that prints only a summary (code mode with the harness's own tools), and say so in the user's CLAUDE.md.
- High context per call →
/clearor/compactbetween unrelated tasks. - A chatty script or MCP tool → make it filter and print a summary; for an MCP server with many tools, keep its tools deferred or wrap it in a script.
- Repeated reads → search first and read line ranges; split a file that is read often.
- Searches across many files → a read-only subagent, so only its conclusion enters the context.
- Apply on request. Change config, CLAUDE.md or scripts only when the user asks.
Output
A reply of under 250 words: the totals line, a table of the top causes (cause, number, fix), and one line on what to re-run later (--since <today>) to see whether the fixes worked.
Rules
- Report estimates as estimates. Tool-result tokens are characters / 4, and an image is counted apart because its base64 size is not what it costs.
- Cache reads are billed at a fraction of normal input, so say how heavily cached the usage is before calling a number expensive.
- The report holds the user's prompts and file paths. Keep it local; never paste it into a public issue, PR or post.
- Never claim a saving you did not measure. After a change, re-run with
--sinceand report the before and after numbers.
Files
scripts/token_audit.py: run at step 1.--projects DIR,--since YYYY-MM-DD,--top N,--format text|json. Reads only; writes nothing.scripts/test_token_audit.py: run after changing the script.
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.

