Overview
Every built-in Policy by area, what it guards against, and whether it is on without an entry.
Find the built-in Policy that stops what you do not want the agent to do, then follow its area's guide to a working configuration. An entry's use names a Policy and its options configure it; presets fill the options in for common tools.
Two Policies are always on
self-protection and hook-bypass run without an entry. Every other Policy runs once your configuration names it.Find the Policy for your problem
| I want to stop the agent from … | Area | Policies |
|---|---|---|
| switching its own guardrails off | Protection | self-protection, hook-bypass (both on by default) |
running dangerous command lines: production kubectl, the wrong package manager, a write-capable subagent | Commands | command-policy |
| committing or pushing to shared branches, losing a stash, merging or approving a pull request | Git and forge | branch-name, push-target, stash-safety, commit-subject, merge-method, readonly-agents, branch-switch, forge-guard |
| writing files that must not be edited, or writing outside where files belong | Paths and new files | protected-paths, generated-paths, allowed-paths, new-file |
| leaving edited files unformatted | Formatting | format-on-edit |
| ending a turn with failing lint, unsaved work or an incomplete hand-off | Stop checks and hand-off | stop-command, work-saved, pull-request, references, status-sync, tracker-fields |
| running a check twice at once, or waiting on one forever | Gates | none: the gates key and harness-kit gate |
| starting in a checkout that loads another checkout's packages, a stale worktree or a full disk | Session start | codegraph, workspace-links, worktree-health |
| letting the machine sleep while it works | Keep awake | keep-awake |
| working on the wrong tool versions, or without your team's rules | Toolchain and rules | toolchain, rules |
Outside these areas, external runs an external Policy over the protocol.
API reference
How each guide reads
Each Policy on a guide has the same parts, in the same order:
- what it guards against, with its main options;
- what the agent reads when it fires, quoted from a real run;
- how to turn it off.
A guide opens with a working configuration for the whole area.
What a Policy answers
| Answer | What happens |
|---|---|
| deny | the call is blocked; the agent reads the reason and a Fix: line |
| ask | Claude Code's permission prompt: the person decides |
| allow | the call runs |
| context | text is added to what the agent reads |
How a hook call is decided shows how the answers of several Policies merge.
Defaults that hold in every area
- Policies that refuse fail closed, helpers fail open. A Policy whose job is to refuse refuses when it cannot decide; one that checks, formats or reminds lets the call through and logs why. An entry's
failModechanges it. - Every refusal names its fix. Many options include a
hintormessagethat replaces the fix with your team's own words. - To turn a Policy off, remove its entry, or, for one option, set it as the guide says. A central configuration can keep a repository from doing either, and an override lets a person loosen one Policy for a session.
Related
- Policies and Decisions: what a Policy is.
- Recipes: real tasks that combine these Policies.
A complete setup: this repository's own
The configuration harness-kit's own repository runs on, part by part, from session-start checks to a read-only verifier subagent and a docs reminder at the stop.
Protection
self-protection and hook-bypass keep the agent from switching its own guardrails off. Both run in every configuration.