Type object
Schema URL https://catalog.lintel.tools/schemas/claude-code/hooks/latest.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Map of hook event names to arrays of matcher groups. Each matcher group optionally filters by a regex pattern and contains an array of hook handlers that execute when the event fires.

Properties

SessionStart MatcherGroup[]
UserPromptSubmit MatcherGroup[]
PreToolUse MatcherGroup[]
PermissionRequest MatcherGroup[]
PostToolUse MatcherGroup[]
PostToolUseFailure MatcherGroup[]
Notification MatcherGroup[]
SubagentStart MatcherGroup[]
SubagentStop MatcherGroup[]
TeammateIdle MatcherGroup[]
TaskCompleted MatcherGroup[]
ConfigChange MatcherGroup[]
WorktreeCreate MatcherGroup[]
WorktreeRemove MatcherGroup[]
PreCompact MatcherGroup[]
SessionEnd MatcherGroup[]

Definitions

MatcherGroupArray MatcherGroup[]
MatcherGroup object

A matcher group pairs an optional regex filter with an array of hook handlers. If matcher is omitted, the hooks fire on every occurrence of the event. See matcher patterns.

hooks HookHandler[] required
matcher string

Regex pattern to filter when this group's hooks fire. Use | for OR (e.g. Edit|Write), .* for wildcards (e.g. mcp__.*). MCP tools follow the pattern mcp__<server>__<tool>. Omit to match all occurrences.

Examples: "Bash", "Edit|Write", "mcp__.*"
HookHandler CommandHook | HttpHook | PromptHook | AgentHook
CommandHook object

Runs a shell command or script. The command receives hook context as JSON on stdin, including session_id, transcript_path, cwd, permission_mode, hook_event_name, and event-specific fields. Exit 0: success — stdout is parsed as JSON for decision control. Exit 2: blocking error — stderr is fed back to Claude. Other exit codes: non-blocking error, logged in verbose mode.

type const: "command" required
Constant: "command"
command string required

Shell command or script path to execute. Runs in the project's working directory. Use $CLAUDE_PROJECT_DIR for the project root (always quote it: "$CLAUDE_PROJECT_DIR"/path) and ${CLAUDE_PLUGIN_ROOT} for plugin-relative paths.

Examples: ""$CLAUDE_PROJECT_DIR"/.claude/hooks/validate.sh", "${CLAUDE_PLUGIN_ROOT}/scripts/lint-check.sh"
timeout number

Max execution time in seconds.

Default: 600
Examples: 10, 30, 120
statusMessage string

Custom spinner message displayed while the hook runs.

Examples: "Validating...", "Running lint check..."
async boolean

Run in background without blocking. Only supported for PostToolUse and PostToolUseFailure events. Async hooks cannot block or return decisions. See async hooks.

Default: false
once boolean

Run once per session then remove. Primarily useful in skill-scoped hooks.

Default: false
HttpHook object

Sends the event's JSON input as an HTTP POST request to a URL. The endpoint communicates results back through the response body using the same JSON output format as command hooks. Non-2xx responses, connection failures, and timeouts produce non-blocking errors. To block a tool call or deny a permission, return a 2xx response with a JSON body containing the appropriate decision fields. HTTP hooks must be configured by editing settings JSON directly — the /hooks interactive menu only supports command hooks.

type const: "http" required
Constant: "http"
url string required

URL to send the POST request to. Must match an entry in allowedHttpHookUrls if that setting is configured.

Examples: "http://localhost:8080/hooks/pre-tool-use", "https://hooks.example.com/validate"
format=uri
headers Record<string, string>

Additional HTTP headers as key-value pairs. Values support environment variable interpolation using $VAR_NAME or ${VAR_NAME} syntax. Only variables listed in allowedEnvVars are resolved; references to unlisted variables are replaced with empty strings.

Examples: {"Authorization":"Bearer $MY_TOKEN","X-Custom-Header":"value"}
allowedEnvVars string[]

List of environment variable names that may be interpolated into header values. References to unlisted variables are replaced with empty strings. Required for any env var interpolation to work.

Examples: ["MY_TOKEN","HOOK_SECRET"]
timeout number

Max execution time in seconds.

Default: 30
Examples: 10, 30, 60
statusMessage string

Custom spinner message displayed while the hook runs.

Examples: "Validating with remote service..."
once boolean

Run once per session then remove. Primarily useful in skill-scoped hooks.

Default: false
PromptHook object

Evaluates a single-turn LLM prompt-based hook to make a pass/fail decision. A small, fast model receives the prompt and must respond with {ok: true} to allow the action, or {ok: false, reason: "explanation"} to block it. Cannot use tools — decides based solely on the prompt content.

type const: "prompt" required
Constant: "prompt"
prompt string required

The evaluation prompt sent to the LLM. Use $ARGUMENTS to interpolate the hook's full input context as JSON (includes session_id, cwd, tool_name, tool_input, and other event-specific fields). If $ARGUMENTS is not present, input JSON is appended to the prompt.

Examples: "Is this Bash command safe to run? Review for destructive operations: $ARGUMENTS", "Does this file edit follow our coding standards? $ARGUMENTS"
model string

Model for evaluation. Defaults to a fast model for low latency.

Examples: "haiku"
timeout number

Max execution time in seconds.

Default: 30
statusMessage string

Custom spinner message displayed while the hook runs.

Examples: "Evaluating safety..."
once boolean

Run once per session then remove. Primarily useful in skill-scoped hooks.

Default: false
AgentHook object

Runs a multi-turn LLM agent-based hook that can use tools (Read, Grep, Glob, Bash, etc.) to gather additional context before making a decision. Unlike prompt hooks, agent hooks can explore the codebase and run commands to verify conditions. Must respond with {ok: true} or {ok: false, reason: "explanation"}.

type const: "agent" required
Constant: "agent"
prompt string required

The verification prompt sent to the agent. Use $ARGUMENTS to interpolate the hook's full input context as JSON. The agent can then use tools to investigate further before deciding. If $ARGUMENTS is not present, input JSON is appended to the prompt.

Examples: "Verify this operation is safe and won't cause data loss: $ARGUMENTS"
model string

Model for the agent. Defaults to a fast model.

Examples: "sonnet"
timeout number

Max execution time in seconds.

Default: 60
statusMessage string

Custom spinner message displayed while the hook runs.

Examples: "Verifying operation..."
once boolean

Run once per session then remove. Primarily useful in skill-scoped hooks.

Default: false