hook-failure-audit — Claude Code skill: what it does, how to install
Audits hook delivery health using Agent Monitor metrics, tracking unreturned tool calls, unclosed subagents, and stalled ingestion pipelines.
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a claude-codeWhat hook-failure-audit does
This skill inspects event delivery records inside the Agent Monitor dashboard. Instead of diagnosing why a model failed, it focuses strictly on pipeline transport issues like dropped signals. The checks query local endpoints such as GET /api/analytics and GET /api/stats.
The audit calculates the difference between PreToolUse and PostToolUse events to reveal tools that started without reporting back. It also verifies that completed runs produced matching Stop or SubagentStop terminators, flagging specific session identifiers with gaps. If the dashboard is not running on http://localhost:4820, the curl requests fail immediately.
What it helps with
- Detect tool executions missing matching PostToolUse hooks
- Identify abandoned sessions and subagents missing Stop or SubagentStop terminators
- Pinpoint the exact session identifiers experiencing dropped delivery events
- Check whether event ingestion has stalled during active work
Example prompts for the agent
- Run a full pipeline delivery check with
hook-failure-audit all. - Verify tool call starts against completions using
hook-failure-audit balance. - Find unclosed sessions and subagents by calling
hook-failure-audit terminators.
How to install hook-failure-audit
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a claude-code2Manually: put the files in place
~/.claude/skills/hook-failure-audit/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/hook-failure-audit/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a codex2Manually: put the files in place
.agents/skills/hook-failure-audit/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a cursor2Manually: put the files in place
.cursor/skills/hook-failure-audit/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hoangsonww/Claude-Code-Agent-Monitor hook-failure-audit2Manually: put the files in place
.github/skills/hook-failure-audit/SKILL.md1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a gemini-cli2Platform CLI
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-quality/skills/hook-failure-auditManually: put the files in place
.devin/skills/hook-failure-audit/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about hook-failure-audit
How to install hook-failure-audit in Claude Code?
Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a claude-code. The definition will be placed in ~/.claude/skills/hook-failure-audit/SKILL.md.
What does hook-failure-audit do?
It audits event delivery between agent hooks and the Agent Monitor dashboard. The skill checks tool start and finish parity, counts missing session terminators, and reports ingestion lag.
What prerequisite is needed to run hook-failure-audit?
The Agent Monitor dashboard must be running locally. If curl cannot reach http://localhost:4820, start the dashboard by running npm start in the repository root.
Source text
SKILL.md · MIT
--- name: hook-failure-audit description: > Audit hook delivery health from Agent Monitor data — balance PreToolUse vs PostToolUse (a gap means tools that started but never reported back), detect missing Stop/SubagentStop terminators (sessions/subagents that never closed), and check for stale ingestion (no recent events). Use when hooks look unreliable or events seem to be dropping. --- # Hook Failure Audit Assess whether the hook pipeline is delivering events reliably, using the event counts and stream the dashboard already has. This is about *delivery* health (missing/dropped events), not about why a model errored. ## Input The user provides: **$ARGUMENTS** This may be: - empty or "all" — run every check (default) - "balance" — PreToolUse/PostToolUse balance only - "terminators" — missing Stop/SubagentStop only - "freshness" — stale-ingestion check only ## Data Sources | Endpoint | Returns | |----------|---------| | `GET /api/analytics` | `event_types` (counts per type: PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd), `daily_events` (365d), `total_subagents`, `sessions_by_status` — fleet-wide delivery balance | | `GET /api/stats` | `total_sessions`, `total_agents`, `total_events`, `events_today` — expected terminator counts and recency | | `GET /api/events?session_id=X` | Per-session stream — confirm which sessions are missing a `PostToolUse`, `Stop`, or `SubagentStop` | ## Report Sections ### 1. PreToolUse / PostToolUse Balance From `GET /api/analytics` `event_types`: `gap = PreToolUse − PostToolUse`. A positive gap means tools whose completion hook never arrived. Report the gap as a count and as a percentage of `PreToolUse`. A healthy pipeline keeps this near 0%. ### 2. Missing Terminators Compare `Stop` count against completed sessions (`sessions_by_status`) and `SubagentStop` against `total_subagents`/`total_agents` (from `/api/stats`). A shortfall means sessions or subagents that ran but never emitted a closing hook — likely dropped delivery or a crashed handler. Report expected vs observed for each. ### 3. Stale Ingestion Check `events_today` from `/api/stats` and the tail of `daily_events` from analytics. If recent days are empty while sessions exist, ingestion has stalled. Report the most recent day with events and how long ago that was. ### 4. Localize For the sessions with the largest gaps or missing terminators, pull `GET /api/events?session_id=X` and confirm which specific hook types are absent. List the offending session IDs. ## Output - A check-by-check report with a PASS / WARN / FAIL marker each (✅ / ⚠️ / ❌) and the expected-vs-observed numbers. - Rates as percentages to 2 decimals. - Cite exact `event_type` counts and `session_id` values — never fabricate. - End with an overall verdict (e.g., "4/4 checks passed" or "hook delivery DEGRADED") and the single highest-impact remediation (e.g., reinstall hooks via the dashboard Settings, or restart the server with `npm start`). - Read-only: only report what the API returns. If `curl` cannot reach `http://localhost:4820`, tell the user to start the dashboard with `npm start` from the repo root.
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor