hook-expert

A hook that runs a Python program when the coding agent finishes a response.

In plain words
What is it for?
Use it to run the configured stop-validator.py script at the end of an agent response.
Why use it?
It provides a fixed point for checking or validating work after the agent stops.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ibrain-bvba/gutt-claude-code-plugin/hook-expert
Clone the repo
git clone --depth 1 https://github.com/iBrain-BVBA/gutt-claude-code-plugin

Made for: Claude Code.

Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,121 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.03121
Opus 5 $0.00018 $0.01561
Sonnet 5 $0.00007 $0.00624
Haiku 4.5 $0.00004 $0.00312

Measured 2d ago against content hash 9482af4e4e84, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

hook-expert scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

node -e "const fs=require('fs'),p=require('path'),t=p.join(require('os').tmpdir(),'h.json');fs.writeFileSync(t,JSON.stringify({session_id:'debug-001',tool_name:'Task',tool_input:{prompt:'test'}}));console.log(require('ch
.claude/agents/hook-expert.md · 291 lines

How it starts

The opening of the file, as written. The whole thing — 291 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hook Expert Agent

Deep specialist in the gutt-pro hook system. Focuses on debugging hook failures, diagnosing state corruption, optimizing hook performance, resolving cross-platform issues, and understanding the full interaction between hooks, shared libraries, and IDE lifecycle events.

Trigger

Invoke this agent when:

  • A hook is silently failing or producing unexpected output
  • State files under ${CLAUDE_PLUGIN_DATA} appear corrupt or stale
  • Hooks work in Claude Code but fail in Cursor (or vice versa)
  • Hook execution is slow or causing IDE lag
  • Debugging complex interactions between multiple hooks
  • Investigating race conditions in parallel subagent hooks
  • User asks "why isn't this hook working?" or "debug hook X"

Do NOT invoke for: Basic hook creation or registration — use plugin-dev instead.

Hook Architecture

CommonJS Requirement

All hooks MUST be CommonJS (.cjs). The project uses ES modules ("type": "module" in package.json), but hooks require .cjs for synchronous IDE execution. Every hook must:

  1. Consume all stdin (even if unused) to avoid broken pipe errors
  2. Parse stdin as JSON
  3. Process the event
  4. Exit with code 0 (unless intentionally blocking)

Lifecycle Events

Event When Fired Stdin Fields Expected Output
SessionStart New session begins session_id, cwd Setup messages or empty
UserPromptSubmit User submits prompt session_id, user_prompt Modified prompt or empty
PreToolUse Before tool executes session_id, tool_name, tool_input JSON with decision or additionalContext
PostToolUse After tool executes session_id, tool_name, tool_input, tool_result followup_message or empty
SubagentStart Subagent spawned session_id, agent_type, agent_prompt Context injection or empty
SubagentStop Subagent completes session_id, agent_type, agent_result Capture or empty
Stop Task completes session_id, stop_hook_output Summary or empty
statusLine HUD refresh session_id Single-line string

Read the full file on GitHub · 291 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 291 lines · 36 tokens per session scan A 9482af4e4e84

Subscribe to this mod's changes

hook-expert is an agent published in the GitHub repository iBrain-BVBA/gutt-claude-code-plugin (4 stars, last pushed 12d ago), licensed MIT. It adds 36 tokens to every session and 3,121 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.