
Session Analyzer
Mine Claude Code debug logs to see when subagents, hooks, and tools ran so you can debug flaky agent workflows.
Overview
Session Analyzer is an agent skill most often used in Operate (also Build agent-tooling, Ship testing) that documents grep patterns to extract SubAgent, hook, and tool events from Claude Code debug logs.
Install
npx skills add https://github.com/ai-native-camp/camp-2 --skill session-analyzerWhat is this skill?
- Documented grep patterns for SubagentStart, SubagentStop, and agent session registration lines
- PreToolUse hook tracing via executePreToolHooks and matcher deduplication counts
- Timestamped debug log format (~/.claude/debug/{sessionId}.txt) as the single source of truth
- Patterns to correlate agent_id with agent_transcript_path across nested sessions
- Frontmatter hook registration lines tied to named agents (e.g. gap-analyzer)
Adoption & trust: 1.1k installs on skills.sh; 17 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You finished an agent session but cannot tell which subagent ran, which hooks fired, or why a tool was blocked.
Who is it for?
Indie builders debugging Claude Code hooks, nested subagents, or mysterious PreToolUse blocks using local debug transcripts.
Skip if: Teams that need hosted APM, zero local log access, or analysis of non–Claude Code agents without ~/.claude/debug files.
When should I use this skill?
You need structured grep patterns to extract SubAgent, hook, and tool timing from Claude Code ~/.claude/debug logs.
What do I get? / Deliverables
You get a repeatable search playbook so you can line up timestamps, hook matchers, and subagent IDs in a debug log and fix configuration or prompts with evidence.
- Annotated timeline of subagents and hooks from a debug log
- Evidence lines for tool and matcher behavior
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Session log forensics fits Operate because it diagnoses what already happened in production-like agent runs, even though you often run it right after a Build or Ship failure. Errors is the canonical shelf for parsing ~/.claude/debug transcripts to trace SubagentStart/Stop, PreToolUse hooks, and tool-call failures.
Where it fits
Parse last night’s sessionId.txt to see which Explore subagent started before a write failure.
Verify frontmatter hooks from gap-analyzer registered for the expected child session.
Confirm PreToolUse matched exactly one hook for Write before accepting a CI repro log.
Spot repeated SubagentStop gaps that explain intermittent task timeouts.
How it compares
Local log pattern cheat sheet, not a hosted session replay or MCP observability server.
Common Questions / FAQ
Who is session-analyzer for?
Solo and indie builders who run Claude Code with hooks or subagents and need to audit what the runtime actually executed.
When should I use session-analyzer?
After a failed or surprising agent run in Operate/errors, when tuning Build/agent-tooling hooks, or when validating Ship/testing behavior from a fresh debug log.
Is session-analyzer safe to install?
It is documentation-style patterns for reading logs you already have on disk; review the Security Audits panel on this page before installing any skill from the catalog.
SKILL.md
READMESKILL.md - Session Analyzer
# Analysis Patterns for Session Analyzer Detailed grep/search patterns for extracting information from Claude Code debug logs. --- ## Debug Log Structure Debug logs are located at `~/.claude/debug/{sessionId}.txt` and contain timestamped entries: ``` 2026-01-13T09:39:26.905Z [DEBUG] {message} ``` --- ## SubAgent Patterns ### SubAgent Start ```bash # Pattern grep "SubagentStart with query:" debug.txt # Example output 2026-01-13T09:39:26.905Z [DEBUG] Getting matching hook commands for SubagentStart with query: Explore ``` ### SubAgent Stop ```bash # Pattern grep "SubagentStop with query:" debug.txt # With agent ID (session tracking) grep "agent_id.*agent_transcript_path" debug.txt ``` ### SubAgent Session Registration ```bash # Pattern - shows when hooks are registered for subagent grep "Registered.*frontmatter hook.*from agent" debug.txt # Example 2026-01-13T09:43:08.203Z [DEBUG] Registered 1 frontmatter hook(s) from agent 'gap-analyzer' for session a373157 ``` --- ## Hook Patterns ### PreToolUse Hook Trigger ```bash # Pattern grep "executePreToolHooks called for tool:" debug.txt # Example 2026-01-13T09:39:40.000Z [DEBUG] executePreToolHooks called for tool: Write ``` ### Hook Matcher Check ```bash # Pattern grep "Getting matching hook commands for PreToolUse with query:" debug.txt # With match count grep "Matched.*unique hooks for query" debug.txt # Example 2026-01-13T09:39:40.000Z [DEBUG] Matched 1 unique hooks for query "Write" (1 before deduplication) ``` ### Hook Permission Decision ```bash # Pattern grep "permissionDecision" debug.txt # Example (allow) "permissionDecision": "allow" # Example (deny) "permissionDecision": "deny" ``` ### Prompt-Based Hook Processing ```bash # Pattern - hook is being processed grep "Hooks: Processing prompt hook with prompt:" debug.txt # Pattern - model response grep "Hooks: Model response:" debug.txt # Pattern - condition result grep "Prompt hook condition was" debug.txt # Example (met) 2026-01-13T09:48:09.076Z [DEBUG] Hooks: Prompt hook condition was met # Example (not met) 2026-01-13T09:45:59.297Z [DEBUG] Hooks: Prompt hook condition was not met: REJECT - ... ``` ### Stop Hook Events ```bash # Pattern grep "Getting matching hook commands for Stop" debug.txt ``` ### SubagentStop Hook Events ```bash # Pattern - converted from Stop to SubagentStop grep "Converting Stop hook to SubagentStop" debug.txt # Example 2026-01-13T09:43:08.202Z [DEBUG] Converting Stop hook to SubagentStop for agent 'gap-analyzer' ``` --- ## Tool Usage Patterns ### Tool Execution ```bash # Pattern grep "executePreToolHooks called for tool:" debug.txt ``` ### File Write Operations ```bash # Pattern - file creation/modification grep "FileHistory: Tracked file modification for" debug.txt # Pattern - atomic write grep "File.*written atomically" debug.txt # Example 2026-01-13T09:39:40.036Z [DEBUG] File /path/to/file.md written atomically ``` ### Bash Command Execution ```bash # Pattern - PreToolHooks for Bash grep "executePreToolHooks called for tool: Bash" debug.txt ``` --- ## Skill/Session Patterns ### Skill Loading ```bash # Pattern - skill hooks registered grep "Added session hook for event" debug.txt grep "Registered.*hooks from skill" debug.txt # Example 2026-01-13T09:39:14.449Z [DEBUG] Added session hook for event PreToolUse in session 3cc71c9f-... 2026-01-13T09:39:14.449Z [DEBUG] Registered 2 hooks from skill 'specify' ``` ### Session Hook Cleanup ```bash # Pattern grep "Cleared all session hooks for session" debug.txt ``` --- ## AskUserQuestion Patterns ```bash # Pattern - PreToolHooks grep "executePreToolHooks called for tool: AskUserQuestion" debug.txt # Pattern - PostToolHooks grep "PostToolUse with query: AskUserQuestion" debug.txt ``` --- ## Error Patterns ### Hook Errors ```bash # Pattern grep -i "error\|failed\|exception" debug.txt | grep -i hook ``` ### Tool Errors ```bash # Pattern grep "Tool.*error\|Tool.*failed" debug.txt ``` --- ## Reviewer-Specific Pa