# Error Scan

Scan recent Claude Code activity for errors and failure signals across all sessions...

- Repository: https://github.com/hoangsonww/Claude-Code-Agent-Monitor (1136 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill error-scan -g -a claude-code -y`
Codex: `npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill error-scan -g -a codex -y`
Cursor: `npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill error-scan -g -a cursor -y`
Gemini CLI: `npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill error-scan -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor`

## Description

Scan recent Claude Code activity for errors and failure signals across all sessions using Agent Monitor data, APIError events and PreToolUse→PostToolUse gaps (tools that started but never completed), then group failures by tool and model and rank them by frequency. Use when checking for errors or asking "what's failing right now".

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Error Scan

Sweep recent events across sessions for error and failure signals, then rank them
by how often they occur and which tool or model produced them.

## Input

The user provides: **$ARGUMENTS**

This may be:
- empty or "all", scan every failure signal (default)
- "api", APIError events only
- "tools", tool-failure gaps only
- a number N, limit the scan to the most recent N sessions
- a session ID, scan a single session

## Data Sources

| Endpoint | Returns |
|----------|---------|
| `GET /api/analytics` | `event_types` (counts per type incl. PreToolUse, PostToolUse, APIError), `tool_usage` (top 20), `daily_events` (365d), fleet-wide failure baseline |
| `GET /api/events?session_id=X` | Per-session event stream: `event_type`, `tool_name`, `summary`, `data`, `timestamp`, locate `APIError` and unmatched `PreToolUse` |
| `GET /api/sessions?limit=N` | Sessions with `id`, `status`, `model`, `started_at`, pick the recent window and attribute failures to a model |

## Report Sections

### 1. Scope
Resolve `$ARGUMENTS` to a session set: pull `GET /api/sessions?limit=N` (default 50, ordered by `started_at`). Report how many sessions and what time span are covered.

### 2. Fleet Failure Counts
From `GET /api/analytics` `event_types`, report total `APIError` count and the PreToolUse→PostToolUse gap: `gap = PreToolUse − PostToolUse` (unmatched tool starts = likely failures). State both as raw counts and as a share of `total_events`.

### 3. Group by Tool
For each session in scope, pull `GET /api/events?session_id=X`. Match each `PreToolUse` to its following `PostToolUse` by `tool_name`; unmatched starts are failures. Aggregate failures and `APIError` events per `tool_name`. Rank tools by failure frequency (descending).

### 4. Group by Model
Join failures to the owning session's `model` (from `GET /api/sessions`). Rank models by APIError count and tool-failure count.

The rest: https://github.com/hoangsonww/Claude-Code-Agent-Monitor/blob/HEAD/plugins/ccam-quality/skills/error-scan/SKILL.md
