Skip to main content
Hooks let you run shell commands automatically when specific agent events occur — for example, enforcing coding standards before a tool writes a file, or logging every completed turn. The system follows the same conventions as Claude Code hooks.

Configuration

Hooks are configured in JSON files at two levels: Both files are merged additively. Identical handlers (same event, matcher, and command) are deduplicated.

Config format

The top-level hooks wrapper is optional — you can place event keys at the root. Each event key maps to an array of rule objects. A rule has:
  • matcher — which tool or trigger to match (see Matchers)
  • hooks — an array of handler objects, each with:
    • type — always "command"
    • command — the shell command to run
    • timeout — per-handler timeout in seconds (default 60)

Matchers

Matchers follow Claude Code semantics:

Events

Execution protocol

Each matching handler runs through the shell with cwd set to the project path. A JSON payload is passed on stdin containing:
  • session_id — the current session ID
  • cwd — the project path
  • hook_event_name — the event name
Plus per-event fields such as tool_name, tool_input, tool_response, prompt, trigger, agent_type, and goal. The following environment variables are set:

Exit codes

Timeouts are also treated as non-blocking failures.

Decision output

On exit code 0, stdout may contain a JSON object:
  • Block a tool call (PreToolUse): {"decision": "block", "reason": "..."}
  • Deny with reason (PreToolUse): {"hookSpecificOutput": {"permissionDecision": "deny", "permissionDecisionReason": "..."}}
  • Append feedback (PostToolUse): {"additionalContext": "..."}
All matching handlers run in parallel. If any handler blocks, the tool call or prompt is denied and all block reasons are joined.

Scope

Hooks apply across all agent contexts:
  • Main agent tool calls
  • Sub-agent tool calls (with agent_type in the payload)
  • GUI tool calls
  • ACP tool calls
UserPromptSubmit only gates user-typed prompts — goal continuations and internal session messages are not intercepted. Hook engine failures never propagate into the agent loop. Plugins can also contribute hooks. They are approved explicitly at install time and merge alongside your global and project hooks.

Examples

Require a linter check before file writes

Log every completed turn

Data storage