Permission Flow
Before a tool runs, Claude Code decides one of three things: allow it, ask you, or deny it. Several parts take a turn: rules, hooks, the permission mode, safety checks, and sometimes a classifier model. This page shows the order and where you can step in.
At a Glance
| Question | Answer |
|---|---|
| Can you use it? | It runs for every tool call. You see it as a prompt, or as a silent allow or deny. |
| Can you change it? | ✅ Yes. Change rules, the mode, hooks, or the sandbox. See the related pages. |
| Can you turn it on or off? | You cannot turn the flow off. bypass skips most checks, but not all. |
| Where does it live? | Inside the program. The inputs come from settings files, flags, and hooks. |
| Status | Documented Undocumented |
Example
You set deny: ["Bash(git push:*)"] and allow: ["Bash(bun test)"], and you run in default mode.
- Claude asks to run
git push origin main. Thedenyrule matches, so the call is denied. No prompt shows. - Claude asks to run
bun test. No deny or ask rule matches. Theallowrule matches, so it runs. - Claude asks to run
rm -rf build. No rule matches. The mode isdefault, so you get a prompt.
The Order of Checks
Official pages: Configure Permissions and Choose a Permission Mode. The docs do not give the full order. The steps below follow the program, so treat the exact order as unstable.
Step by Step
- Explicit
denyandaskrules apply first, before workspace trust. Source: the official Settings Reference. PreToolUsehooks can allow, deny, or ask. A hookallowdoes not override adenyoraskrule. Source: the program (types-2.1.304.d.tsand the texthook allows approve the command).- Allow sources let the call run:
allowrules, the rules ofacceptEdits, and read-only command lists. Program texts:Read-only command is allowedandAuto-allowed with sandbox (autoAllowBashIfSandboxed enabled). - The mode decides the rest.
defaultprompts.dontAskdenies.autoasks the classifier.bypassPermissionsallows. The other modes follow the rules on Permission Modes. - A prompt runs
PermissionRequesthooks first. Then the dialog shows.Notificationhooks fire for unanswered requests in SDK hosts.CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS=1stops that. - An auto mode denial fires
PermissionDenied. The hook can ask for a retry.
A safety check covers rm -r on a mounted drive, the folder that holds mounted drives (/Volumes, /media, WSL /mnt/c), or a top-level file or folder of a drive. Since 2.1.304 the program says it "requires explicit approval and cannot be auto-allowed by permission rules". CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT turns this prompt off (Tools and Bash).
Built-in safety checks, called circuit breakers, can also force a prompt. Some are immune to bypassPermissions. See Permission Modes. The diagram leaves them out because the program does not show where they run.
The working folders matter too.
A path outside the working folders gets the reason workingDir (Path is outside allowed working directories).
permissions.blockReadsOutsideWorkingDirectories: true refuses reads outside the working folders in every mode.
What You Can Change at Each Step
| Step | What you change |
|---|---|
| Rules | permissions., ask, deny; see Permission Rules. |
| Hooks | Pre, Permission, and Permission hooks; see the Hooks pages. |
| Safety checks | Mostly fixed. block, --, and isolate switch some on. |
| Mode | permissions. and --; see Permission Modes. |
| Sandbox | sandbox. keys; see Sandbox. |
| Classifier | The auto setting; see Auto Mode. |
Where It Sits in a Turn
The check runs in the tool stage of every turn. See The Agent Loop for the stages around it and Architecture for the pieces.