session-audit · git:20261102.0255a79 · 2026-11-02 · sha256 2adf6552cad1aa6a

session-audit git:20261102.0255a79A

Immutable. This exact content never changes and is served at /api/v1/blob/2adf6552cad1aa6a.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_n6zmckv4cd55myyf/2adf6552cad1aa6aa2e2e110f207f14941a66e8cca043c5746960253ef3d7afc.json

Then /plugin install session-audit@markdownregistry-n6zmckv4cd55myyf in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: session-audit
description: Analyze the current Claude Code session transcript for execution failures, classify errors, and suggest CLAUDE.md rules or settings.json hooks. Use on "audit this session", "what failed", "analyze errors", "what went wrong".
allowed-tools: Bash
---

# Session Audit

Analyze the current Claude Code session for execution failures and present a structured report.

## Phase 1 — Parse transcript

Run the parse script:

```bash
python3 "$(dirname "$0")/scripts/parse-transcript"
```

The script outputs JSON:
```json
{
  "session": "<path>",
  "total_tool_calls": 42,
  "failures": [
    {
      "category": "git-state",
      "count": 1,
      "examples": ["fatal: 'messaging-queue-background' is already used by worktree at ..."],
      "suggestion": {
        "type": "claude_md",
        "rule": "Before any `git worktree add` or `git checkout -b`, first run `git worktree list` and `git branch --list <name>` to verify the target does not already exist."
      }
    }
  ]
}
```

## Phase 2 — Present the report

For each failure in the output, format it as:

```
## <CATEGORY> (<count> occurrence(s))

**What failed:**
> <example snippet — first 200 chars>

**Suggested fix:**
<type: CLAUDE.md rule | settings.json hook>
<the rule or hook config>
```

Categories and their fix types:
- `git-state` → CLAUDE.md rule about verifying git state before operations
- `typecheck` → CLAUDE.md rule to always run `pnpm typecheck` before declaring done
- `lint` → settings.json Stop hook: `cd <project> && pnpm lint 2>&1 | grep "error" | grep -v WARN || true`
- `build` → CLAUDE.md rule to run `pnpm build` in affected package before reporting complete
- `test` → CLAUDE.md rule to run `pnpm test` before declaring done
- `dependency` → CLAUDE.md rule to run `pnpm install && pnpm typecheck` after package changes
- `permission` → CLAUDE.md rule: never bypass hooks with --no-verify; investigate root cause
- `runtime` → CLAUDE.md rule to check `~/.ethos/logs/errors.jsonl` for context
- `exit-code` → no rule (informational only)

Show the full report and stop. Do not ask to apply anything.