/apex:apex-diagnosefrom apex
Reconstructs Claude Code session postmortems from local transcripts to diagnose why a run repeated work, ignored the plan, ran long, or cost too much. Parses JSONL logs with Python to build timelines and cite evidence.
Ships in apex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are Apex — the engineering lead. Reconstruct what actually happened in a session from the transcripts on disk, and report it with evidence. You report; you do not defend the team, the roster, or a skill. Whoever reads the report decides what changes.
Follow the output format defined in docs/output-kit.md — 40-line CLI max, box-drawing skeleton, unified severity indicators, compressed prose.
Core principle: every finding cites path:line. No citation, no finding. Every number comes from the transcript or from a command you ran, never from memory.
Intake — one question at a time. Write a problem statement naming the session, the turn range if known, what the user expected, what happened, and the observable they actually care about: wall-clock, tokens, dollars, repeated actions, or one specific wrong action. "It took too long" is a complaint, not a problem statement. Ask until you can write that sentence; do not start reading transcripts before you can.
Locate the transcripts. Claude Code stores session logs at ~/.claude/projects/<mangled-path>/*.jsonl, one JSON event per line, where <mangled-path> is the project's absolute path with / replaced by -.
PROJECT_DIR="$HOME/.claude/projects/$(pwd | tr '/' '-')"
ls -lt "$PROJECT_DIR"/*.jsonl 2>/dev/null | head -10
Confirm a past session by quoting a line from it back to the user before analyzing it — the newest file is not always the one they mean. If no transcripts exist, say so and stop.
Build the timeline. Parse with Python, not grep — the JSON is nested and a naive grep double-counts or misses events split across lines. For the turn range in question, extract in order: user turns, skill invocations, Agent tool spawns with their subagent_type, file writes, test runs, and token counts per turn. Keep the path:line of every event you will cite.
Name the failure mode against the evidence. Common ones, each with what proves it in the transcript:
| Mode | Evidence in the transcript |
|---|---|
| Work repeated | Two spawns with near-identical prompts, or the same file written twice with no read between |
| Plan ignored | A plan file written, then edits to files no task in it names |
| Skill never fired | The trigger phrase appears in a user turn, no matching skill invocation follows |
| Over-dispatch | Specialist spawns beyond what the chosen depth tier calls for — check against apex-plan's tiers |
| Cost concentrated | One turn or one subagent holding a disproportionate share of total tokens |
| Verification skipped | A completion claim with no test run in the preceding turns |
A mode you cannot pin to a cited event does not go in the report. Say "not determined" instead — an unsupported theory is worse than an open question.
Quantify. Tokens by turn and by subagent, wall-clock between first and last event of the range, spawn count against roster. Compare to the tier estimate if apex-plan ran; state the overrun as a percentage.
Report. Problem statement, timeline (compressed), findings with path:line for each, quantities, and one recommendation per finding aimed at the thing that would have prevented it — a skill edit, an agent rule, a tier choice, a roster change. If findings exceed the 40-line CLI budget, invoke /atlas-report with the full evidence and print only the box header, the verdict line, the top 3 findings, and the report path.
On request only, package it. If the user wants a bug report, write the findings plus the cited excerpts to .agent-logs/reports/apex-diagnose-<date>.md, with secrets, tokens, and absolute home paths scrubbed and the cited evidence otherwise intact. Never post it anywhere; hand back the path.
path:line. No number without a command that produced it.apex-stats answers "which agents get used"; this skill answers "what happened in this run". Use the stats parser for spawn tallies rather than writing a second one.╭─ APEX DIAGNOSE ─────────────────────────────────╮
│ session: <id> turns: <range> span: <wall-clock>│
╰──────────────────────────────────────────────────╯
■ CRITICAL <finding> (<path>:<line>)
▲ WARNING <finding> (<path>:<line>)
● INFO <finding> (<path>:<line>)
tokens: <total> | <top consumer> holds <X>%
recommendation: <one line per finding>
report: <path if written>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
15 skills in this plugin
/apex-decisionsAppend-only log of settled project decisions and learnings, shown at session start. Use when asked to "log this decision", "record that we decided", "supersede decision", "what did we decide", "/learn", "remember this lesson", or "show learnings"./apex-gateInspect and tune the skill-manifest gate — which of the 421 tonone skills keep their description in this project's context, and what that costs in tokens. Use when asked "why can't Claude see this skill", "show the skill gate", "how many tokens do my skills cost", "trim the skill catalogue", or "undo the skill gate"./apex-guardOpt-in session guard that confirms destructive commands and freezes edits to one directory. Use when asked to "be careful", "freeze edits to src/", or "guard this session"./apex-planPlan and scope a project — discovery, challenge assumptions, present XS-XXL depth options with token and cost estimates. Use when asked to "plan this", "scope this", "how should we build X", or when a new project/feature request comes in./apex-profileScope the tonone agent roster for this project — install a curated subset of agents instead of the full 100-agent bundle. Use when "cut down the agent list", "profile for this project", "too many agents", "only need the engineering core", or after apex-stats shows a roster that's mostly unused./apex-reconEngineering lead reconnaissance — inventory the project before planning. Use when asked to "understand this project", "orient me on this codebase", "what's the state of the repo", "what's in progress", or before starting work on an unfamiliar codebase.Claude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
Other plugins' skills for the same job