Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill hook-failure-audit -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/hook-failure-audit/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/hook-failure-audit/

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

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set60

executive-report Turns CCAM sessions, analytics, cost and alerts into one stakeholder report. Handy before a release or a leadership update. CX Codex +1 ★ 1,121repo stars cost-report Generates scoped CCAM token and spend reports by model, provider, source, and session. Useful for tracking agent costs and spotting unpriced usage. CX Codex +1 ★ 1,121repo stars slo-check Turns Agent Monitor events into an SLO scorecard for session completion, tool calls, and API errors. Use it to compare results with targets and track remaining error budget. CX Codex +1 ★ 1,121repo stars regression-alert Compares agent reliability this period against the last one and flags where it got worse. Handy when you need to know if things degraded. CX Codex +1 ★ 1,121repo stars error-scan Scans recent Claude Code sessions for API errors and unfinished tool calls, then ranks failures by tool and model. Useful when you need to see what is breaking. CX Codex +1 ★ 1,121repo stars api-error-report Turns Agent Monitor data into a report on APIError events: how many, in which sessions and models, and what likely caused them. CX Codex +1 ★ 1,121repo stars workflow-optimizer Analyzes agent DAGs, tool call transitions, and token expenses via the Agent Monitor API. Identifies retry loops, error flows, and model delegation waste. CX Codex +1 ★ 1,121repo stars weekly-report Turns Agent Monitor data into a weekly view of sessions, costs, tokens, tool use, and completion. Use it to review a chosen week or date range. CX Codex +1 ★ 1,121repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor