Intermediate10 min
HTTP Hooks and the Prompt/Agent Hook Types
Three of the four hook types go beyond shell scripts: HTTP hooks POST event data to endpoints, prompt hooks evaluate nuanced conditions using an LLM, and agent hooks spawn full subagents for complex verification. Each fills a different gap.
Quick Reference
- →HTTP hook: POST event JSON to a URL — for external integration, webhooks, audit APIs
- →allowedEnvVars: only listed vars are interpolated into HTTP headers — security by default
- →Prompt hook: single-turn LLM eval (Haiku by default) — for nuanced judgment calls
- →Agent hook: spawns a subagent with tools (Read, Grep, Glob) — for multi-step verification
- →Prompt hook timeout: 30s. Agent hook timeout: 60s (experimental)
- →Command hooks for deterministic rules; HTTP for external; prompt for AI judgment; agent for complex checks
- →HTTP hooks use the same JSON output format as command hooks for decisions
- →Agent hooks are experimental — may change between Claude Code versions
Beyond Shell Scripts
Most hook documentation shows shell scripts. But Claude Code supports three more hook types that handle use cases shell scripts can't: HTTP endpoints for external integration, LLM prompts for nuanced judgment, and subagents for complex multi-step verification.
Understanding when to use each type is as important as knowing how to configure them. The wrong type creates unnecessary complexity or latency. The right type makes the hook trivial to write.