Works with the AI Agents you already use

    Claude Code Session Audit

    by Tony Huynh

    1

    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

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Claude Code Session Audit

    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

    1. Stop the Bash retry loop: the same command failed 4 times. Fix the input or check the precondition before retrying.
    2. Move the Explore scouting subagent off Opus: read-only scouting runs fine on Sonnet or Haiku.
    3. 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

    1. [medium] Bash failed 4 times with identical input. Stop retrying: change the input, check the precondition, or ask the user.
    2. [medium] Scouting-type subagent Explore (aaa) ran on claude-opus-5-5. Run read-only scouting on a smaller model (sonnet or haiku).
    3. [medium] Subagent Explore (aaa) used 32% of session tokens (threshold 30%). Narrow what it reads, or do small jobs in the main thread.
    4. [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

    ModelResponsesInputOutputCache readCache writeEst. cost
    claude-opus-5-572181,15310,30020,000$0.19
    claude-sonnet-5-511105000$0.0002
    claude-haiku-5-51505000$0.0000*

    * = assumed price row.

    Subagents

    TypeModelTokensCostTool callsErrorsResult (chars)Description
    Exploreclaude-opus-5-510,200$0.02214scan modules
    web-fetchclaude-haiku-5-5100$0.0000002look up docs

    Tools

    ToolCallsErrorsContext added (chars)
    Bash4438
    Agent20160
    Read100
    Grep110

    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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Terminal / Shell
    Read Files
    Environment Variables

    File Scopes

    ~/.claude/projects/**

    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.

    Listed11 days ago

    What's inside

    Frequently Asked Questions

    Seven ranked checks, each with its threshold: a cache hit ratio below 60 %, one subagent using more than 30 % of the session's tokens, the same tool call failing 3 or more times, the main prompt above 80 % of the context window, a mean main-thread prompt of 150k tokens or more over 30+ responses (the context re-read cost), a scouting subagent running on an expensive model, and 5 or more compactions. It also breaks tokens and cost down per subagent, model and tool, and shows how much text each tool added to the main context.

    It reads Claude Code's own transcript files, so it is built for Claude Code. Any agent that can run a Python script can run the audit, but the data it reads comes from Claude Code.

    No. The script runs on your machine, reads the transcripts, makes no network calls and writes no files. The report holds counts, names and ids, not your prompts or tool output.

    The SKILL.md instructions for your agent, one read-only Python script (standard library only) and a reference that explains every metric and recommendation rule. Reports come out as Markdown or JSON.

    The script carries a price table with its as-of date, printed on every report. Skill updates refresh it, and you can pass your own prices as a JSON file with --prices.

    Background calls that Claude Code does not write to transcripts (session titles, prompt suggestions) are not counted, so totals can sit a few percent below Anthropic's own usage figures. For every request the transcript does record, the token counts are exact.

    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.