All Agent Engineering

Claude Code prompt hooks: decisions vary by event

The effect of ok=false varies by event; inspect the event contract first.

AINavWritten / Updated
On this page

At a glance

This page explains one configuration contract from official documentation and records the local synthetic checks. It changes no actual settings, runs no hook, creates no subagent and calls no external service. Documented capabilities are separate from execution results.

Runtime and applicability

Article type
Spec file
Verified
Applies to
  • Claude Code Applies to the documented Claude Code configuration; version and event support appear in the body.

File locations

PathScopeHow it is read
settings: hooks array; type=promptThe event or subagent configuration described in this page.Read by Claude Code during relevant configuration loading and event execution; not enabled in this run.

When to use

  • Use when inspecting this configuration, loading location and result contract.

When not to use

  • Stop integration and consult specific documentation when the event, version or permission boundary is unclear.

Choose the event before the prompt

A prompt hook makes a model judgment rather than executing a command script. Set type=prompt and prompt; $ARGUMENTS inserts event JSON, while absent placeholders cause the input JSON to be appended. Model output contains ok and requires reason when ok=false. Check prompt support for the event and account for its model call.

Denial effects depend on the event

On PreToolUse, ok=false denies the tool call and ends the turn by default; continueOnBlock=true can return the reason to Claude as a tool error. On PermissionRequest, ok=false has no effect; use the documented command-hook permission decision fields instead. A model false value does not universally establish denied permission, and one configuration cannot cover every event contract.

Impossible applies to specific stop events

impossible is optional and can accompany ok=false when the model judges that a condition cannot be satisfied. Stop and SubagentStop then permit ending, whereas agent hooks and other events ignore the field. Only the synthetic {ok:false,reason:missing-input} shape was inspected locally. No model judgment or hook was requested; stop enabling the hook when the event contract is unclear.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Anthropic · Hooks reference

Found an error? Tell us →