- Home
- Skills
- Agents & Orchestration
- Claude Code Session Audit
Works with the AI Agents you already use
Claude Code Session Audit
by Tony Huynh
Find out where a Claude Code session spent its tokens: cost per subagent, model and tool, cache hits, failing retries and context growth, with ranked fixes. Read-only, nothing to install.
$4
Claude Code Session Audit
Example session with this skill installed
Audit my last Claude Code session: where did the tokens go, and what should I change?
- Read your context and instructions
- Compiled the claude code session
Here is the audit of your last session (sample session shown; your report has the same sections with your numbers).
Summary: 32,282 tokens, about $0.19 at API list prices. Two things stand out: a Bash command failed 4 times with the same input, and the cache hit ratio is only 35 %.
Top 3 fixes
- Stop the Bash retry loop: the same command failed 4 times. Fix the input or check the precondition before retrying.
- Move the Explore scouting subagent off Opus: read-only scouting runs fine on Sonnet or Haiku.
- Keep the prompt start stable and avoid long pauses so cached input is reused (35 % hit ratio, target 60 %+).
Session audit: sess-main
Costs are API-equivalent estimates (list prices of 2026-11-03), not a bill. Source: local transcripts.
- Wall time 10m00s (active 2m10s), 2 turns, 9 API responses
- Tokens: 32,282 = input 269, output 1,213, cache read 10,800, cache write 20,000
- Cache hit ratio: 34.8%
- Estimated cost: $0.19
- Subagents: 2; skipped lines: 2; versions: 9.9.9
Recommendations
- [medium] Bash failed 4 times with identical input. Stop retrying: change the input, check the precondition, or ask the user.
- [medium] Scouting-type subagent Explore (aaa) ran on claude-opus-5-5. Run read-only scouting on a smaller model (sonnet or haiku).
- [medium] Subagent Explore (aaa) used 32% of session tokens (threshold 30%). Narrow what it reads, or do small jobs in the main thread.
- [medium] Cache hit ratio is 35% (threshold 60%). Keep the prompt start stable and avoid pauses over 5 minutes so cached input is reused.
Models
| Model | Responses | Input | Output | Cache read | Cache write | Est. cost |
|---|---|---|---|---|---|---|
| claude-opus-5-5 | 7 | 218 | 1,153 | 10,300 | 20,000 | $0.19 |
| claude-sonnet-5-5 | 1 | 1 | 10 | 500 | 0 | $0.0002 |
| claude-haiku-5-5 | 1 | 50 | 50 | 0 | 0 | $0.0000* |
* = assumed price row.
Subagents
| Type | Model | Tokens | Cost | Tool calls | Errors | Result (chars) | Description |
|---|---|---|---|---|---|---|---|
| Explore | claude-opus-5-5 | 10,200 | $0.02 | 2 | 1 | 4 | scan modules |
| web-fetch | claude-haiku-5-5 | 100 | $0.0000 | 0 | 0 | 2 | look up docs |
Tools
| Tool | Calls | Errors | Context added (chars) |
|---|---|---|---|
| Bash | 4 | 4 | 38 |
| Agent | 2 | 0 | 160 |
| Read | 1 | 0 | 0 |
| Grep | 1 | 1 | 0 |
Repeated identical failure: Bash x4
Context
- Peak main-thread prompt: 20,010 tokens (2% of an assumed 1,000,000-token window for claude-opus-5-5)
- Growth, max prompt per tenth of the session: 0, 20,010, 0, 1,005, 101, 0, 101, 0, 101, 501
- Compactions: 1 (size before each: 90,000)
Connects securely to your tools. The creator never sees your data.
About this skill
Find out where a Claude Code session spent its tokens.
Your agent runs a small read-only script over the transcripts Claude Code already keeps on your machine and returns one report: tokens and API-equivalent cost per subagent, model and tool, cache hit rate, repeated failing tool calls, context growth and compactions, plus ranked fixes, each tied to the number behind it.
- Nothing to install: Python 3 standard library only, no network, writes no files.
- Private by default: the report holds counts, names and ids, never your prompts or tool output.
- Any scope: the last session of a project, a specific session, or every session since a date.
Good questions to ask your agent
- "Where did my tokens go in the last session?"
- "Which subagent burned the most?"
- "Why was this session so expensive, and what should I change?"
- "Is my cache working? Did the context get too big?"
Notes
- Cost is an estimate at public API list prices. On a subscription plan it shows where usage went, not what you were billed.
- Numbers come from local transcripts only. Background calls Claude Code does not write to transcripts (session titles, prompt suggestions) are not counted.
Claude Code only. Cost is an estimate at public API list prices, not a bill. Background calls missing from transcripts (session titles, prompt suggestions) are not counted. The context window size is assumed from the model family. Needs Python 3.9+.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
- Software
Python 3.9+Claude Code
Permissions
File Scopes
Read-only. The script reads Claude Code transcripts under ~/.claude/projects (or $CLAUDE_CONFIG_DIR/projects; that is the only environment variable it reads). It makes no network calls and writes no files; the agent writes the script to a temp file to run it, as with every Agensi script.
What's inside
Frequently Asked Questions
New in Agents & Orchestration
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.