Token Autopsy — AI skill for Claude Code
Token autopsy for agent fleets: ingest Claude Code / Codex / Cursor transcripts, emit per-behavior cost reports (file re-reads, retry storms, tool-result bloat, cache hit-rate).
How to install Token Autopsy
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open bugyal/token-autopsy and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Token Autopsy does
Token autopsy for agent fleets: ingest Claude Code / Codex / Cursor transcripts, emit per-behavior cost reports (file re-reads, retry storms, tool-result bloat, cache hit-rate). One binary, zero LLM calls.
Alternatives in AI
- Open Multi Agent — TypeScript multi-agent orchestration engine — one runTeam() call from goal to result 5.8k ★
- Wiki Ingest — Ingest a source document into the LLM Wiki 2.3k ★
- Mancode — AI coding agent harness 358 ★
README
token-autopsy
[](https://github.com/bugyal/token-autopsy/actions/workflows/ci.yml) [](https://github.com/bugyal/token-autopsy/releases/latest) [](https://pkg.go.dev/github.com/bugyal/token-autopsy)
**token-autopsy is a per-behavior cost autopsy for agent session transcripts.**
Why
Agent fleets (Claude Code, Codex, Cursor) burn tokens in ways the invoice never explains. Total spend per day is easy to get; *which behaviors* drove that spend is not. Teams end up tuning prompts blind while the actual waste — re-reading the same file nine times, retrying a failing command in a tight loop, pasting 40 MB of logs into context — goes unmeasured.
token-autopsy ingests a week of session transcripts and attributes token cost to the behaviors that caused it, so you can fix the workflow instead of just paying for it.
What it does
It walks a directory of `.jsonl` session transcripts (Claude Code format: one JSON object per line with `timestamp`, `message`, `tool_calls`; Codex/Cursor flat records tolerated), normalizes every message and tool call into a single event stream, detects cost-driving behaviors, and prints a table sorted by estimated token cost:
| Behavior | What it detects | Attributed cost |
|---|---|---|
re-reads |
Same file_path in multiple Read/Glob calls within one session |
Every read after the first |
retry-storms |
Identical tool call (same tool + args) repeated >2× in a row | Repeats beyond the threshold |
tool-result-bloat |
Tool result chars / call content chars ≥ 3.0 (flag with --bloat-ratio) |
Result volume above the threshold |
| cache hit-rate | Sessions carrying cache_read_input_tokens / cache_creation_input_tokens metadata |
Informational line under the table |
Token counts come from tr
Related Skills
Bench Watch
Launch or attach to a Plumbline benchmark slice, poll it to completion, and emit the canonical anti-Goodhart p
Agent Yes
Run AI coding agents (Claude, Codex, Gemini …) unattended — auto-answer prompts, auto-retry on rate limits, an
Vibeharness
Hackable, interactive LLM agent harness for the terminal — streaming REPL, tool-using agent loop, persistent P
Burn O Meter
See what your AI coding agents really cost — tokens, spend, cache efficiency and rate limits. Works with Claud
Usage
macOS menu bar & Windows tray app pinning Claude Code, Codex & Antigravity quota, burn rate, and cost to your
Coding Agent Account Manager
Sub-100ms auth switching for AI coding CLIs (Claude Code, Codex, Gemini): swap subscription accounts instantly
Related Agents
Agent Performance Updater
Tier-1 Trade Evaluation. Computes per-agent (hit_rate, sharpe, pnl, n_samples) rows for the agent_performance
Deep Lit Reader
Read one arXiv paper in depth, write its wiki note, and emit a deep-lit result JSON.
Sdl Game Helper
SDL2/SDL1 game port specialist for AmigaOS. Knows the libSDL2-amigaos3 fast-path traps, blitter mode tradeoffs