When your Claude Code session goes sideways and you need to understand what actually happened, this pulls the full event chain from Agent Monitor's API and lays it out chronologically. You get the agent hierarchy tree, every tool call with timing, token usage spikes, and gaps in the timeline that suggest something stalled. It highlights errors in context, traces the critical path through events, and spots anomalies like duplicate states or unexpected event ordering. The diagnosis section attempts root cause analysis, which is hit or miss, but having the raw timeline with PreToolUse, PostToolUse, and SubagentStop events in one view beats manually correlating logs. Best used right after a session errors out or when you're debugging why something took forever.

GitHub stars
455
last updated
Jun 11, 2026

Install

$ npx -y skills add hoangsonww/claude-code-agent-monitor --skill session-debug --agent claude-code

Installs into .claude/skills of the current project.

Files

Session Debug

Debug and inspect a Claude Code session from Agent Monitor data.

Input

The user provides: $ARGUMENTS

This may be:

  • A session ID to debug
  • "latest" or "last" for the most recent session
  • "errors" to find and debug the most recent errored session

Procedure

  1. Identify the target session:

    • If session ID given: GET /api/sessions/{id} from http://localhost:4820
    • If "latest": GET /api/sessions?limit=1 (default sort: most recently updated first)
    • If "errors": GET /api/sessions?limit=10&status=error
  2. Collect full session data:

    • Session metadata: status, model, cwd, timestamps, duration
    • Events: GET /api/events?session_id={session_id} — full event timeline
    • Agents: GET /api/agents?session_id={session_id} — all agents in session
    • Cost: GET /api/pricing/cost/{session_id}
  3. Analyze the session:

    Session Lifecycle

    • Start time → first event → last event → end time
    • Status transitions (active → working → completed/error)
    • Total duration and active-vs-idle time

Sponsors

Details

Repository
github.com/hoangsonww/claude-code-agent-monitor
Categories
DevOps & CI/CD, AI & Agent Building, Debugging
License
MIT
First seen
Jun 11, 2026

More from hoangsonww/claude-code-agent-monitor

All 24
1hoangsonww avatarsession-reporthoangsonww/claude-code-agent-monitor>0skills.sh installs
2hoangsonww avatarship-featurehoangsonww/claude-code-agent-monitorImplement a feature safely end-to-end in this repository. Use when adding or changing functionality across backend, frontend, or MCP with required verification 0skills.sh installs
3hoangsonww avatarusage-trendshoangsonww/claude-code-agent-monitor>0skills.sh installs
4hoangsonww avatarweekly-reporthoangsonww/claude-code-agent-monitor>0skills.sh installs
5hoangsonww avatarworkflow-optimizerhoangsonww/claude-code-agent-monitor>0skills.sh installs
6microsoft avatarazure-cloud-migratemicrosoft/azure-skillsAssess and migrate cross-cloud workloads to Azure with reports and code conversion. Supports Lambda→Functions, Beanstalk/Heroku/App Engine→App Service, Fargate/606.9Kskills.sh installs