Skip to Content
harness-kit

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

PartWhat it means
idThe entry's name, unique in the configuration. Messages, logs, overrides and stop-check markers use it.
eventsThe hook events it runs for: PreToolUse, Stop and so on. A built-in Policy brings its own.
toolsOptional: the tools it runs for, by exact name (Bash, Write) or a prefix ending in * (mcp__tracker__*). Read on PreToolUse and PostToolUse only.
agentTypesOptional: the subagent types it runs for (verifier, Explore); a Policy without them runs for every agent.
fail modeWhat happens when it fails or runs out of time: closed refuses the call, open lets it through. An entry sets it with failMode.
timeoutHow long it may take. An entry sets it with timeoutMillis.

A Policy comes from one of three places:

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:

DecisionWhat the agent sees
AllowNothing; the call goes ahead.
DenyThe call is refused, with the reason and the fix that clears it.
AskClaude Code asks the person whether the call may go ahead, with the reason the Policy gives.
ContextText added to what the agent reads.
Block-stopThe 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 modeChoose it for
closeda Policy whose whole point is to refuse: if it cannot decide, the call should not go through
opena 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.

On this page