Policies and Decisions
A Policy is one guardrail; a Decision is what it answers for one hook call.
What do the entries in my configuration turn on, and what do they answer?
Each entry turns on one Policy, a guardrail such as "no writes to Claude Code's settings" or "lint must pass before the agent stops". For each hook call it applies to, a Policy answers with a Decision: allow, deny, ask, add context, or keep the agent from stopping.
The parts of a Policy
| Part | What it means |
|---|---|
id | The entry's name, unique in the configuration. Messages, logs, overrides and stop-check markers use it. |
events | The hook events it runs for: PreToolUse, Stop and so on. A built-in Policy brings its own. |
tools | Optional: the tools it runs for, by exact name (Bash, Write) or a prefix ending in * (mcp__tracker__*). Read on PreToolUse and PostToolUse only. |
agentTypes | Optional: the subagent types it runs for (verifier, Explore); a Policy without them runs for every agent. |
| fail mode | What happens when it fails or runs out of time: closed refuses the call, open lets it through. An entry sets it with failMode. |
| timeout | How long it may take. An entry sets it with timeoutMillis. |
A Policy comes from one of three places:
- A built-in Policy, named by an entry's
use. The Built-in Policies section describes each one. - A Policy written in code, in TypeScript beside the entries. See Writing a custom Policy.
- An external Policy, an executable in any language that answers over the kit's protocol. See External Policies and adapters.
Two built-in Policies run in every configuration without an entry: self-protection and hook-bypass. Every other one runs only when an entry names it.
Decisions
A Policy answers each call with one of these:
| Decision | What the agent sees |
|---|---|
| Allow | Nothing; the call goes ahead. |
| Deny | The call is refused, with the reason and the fix that clears it. |
| Ask | Claude Code asks the person whether the call may go ahead, with the reason the Policy gives. |
| Context | Text added to what the agent reads. |
| Block-stop | The agent may not stop yet, with the reason and the fix that clears it. |
A deny or block-stop cannot be made without its fix. The agent reads the reason, then Fix: and what to do, so it can correct course instead of trying the same thing again.
Ask is for calls a Policy cannot judge. The path Policies, for instance, ask when a command writes to a path built from a variable they cannot resolve: the person sees what was unclear and decides. Several questions about one call become one prompt.
Choose a fail mode and a timeout
A Policy that fails or runs out of time follows its fail mode. Every built-in Policy has a default that follows this rule, listed in the Policies reference. Change it with failMode on the entry:
| Fail mode | Choose it for |
|---|---|
closed | a Policy whose whole point is to refuse: if it cannot decide, the call should not go through |
open | a helper, or a check that depends on a network call or a slow command, where blocking costs more |
Raising a timeout
The hook's own time limit in .claude/settings.json is derived from the longest Policy timeout. Raise an entry's timeoutMillis, then run harness-kit settings sync again.
Policies that act after the answer
Some Policies decide nothing and act once the call is answered. format-on-edit formats the file an edit changed, and keep-awake holds the machine awake while a turn runs. They see the merged answer and cannot change it. A failure of theirs never blocks the agent.
harness-kit explain does not run them, so it never shows their effect.
Related
- How a hook call is decided: how Decisions are merged into one answer.
- The configuration: writing entries.
Toolchain and rules
toolchain checks the tools and versions a session runs on; rules copies your team's rules into the session where Claude Code reads them.
How a hook call is decided
What happens between Claude Code calling a hook and the agent reading its answer, and why a hook never lets a call through by accident.