Claude Code permission rules: the ladder every call walks

By Christophe Paka · Facts checked on 23 October 2026

"My agent pushed to git after i told it not to." That reader had written never push in a note. Another allowed one command, and Claude Code still blocked it. A third finds the prompts exhausting.

Each one guessed at how the checks work, and lost work or time. Claude Code permission rules follow one fixed order, and the first match decides. The figure below draws that order as a ladder, with a real command walking down it.

A tool call, e.g. Bash(git push origin main), walks down four steps: 1 deny rules, a match means blocked; 2 ask rules, a match prompts you; 3 allow rules, a match runs with no prompt; 4 the mode default decides.
Figure 6.1: Every tool call walks the same ladder. Deny is checked first, then ask, then allow; only when nothing matches does the mode decide.
Use this diagram on your site

Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.

How to read this figure

  1. Start at the tool call. A tool call is one action Claude asks to take, such as running a shell command or reading a file. The top box shows one: Bash(git push origin main), a command that sends your commits to the shared repository.

  2. Meet the deny rules first. Step 1 asks: does any deny rule match? A match goes right to the red box: Blocked. A permission rule is a line in a settings file, a JSON file (plain text with braces and quotes) of Claude Code options, such as .claude/settings.json. The rule matches tool calls by a pattern.

  3. Then the ask rules. With no match, the call drops to step 2, ask rules. A match goes to the grey box: Prompt you. Claude Code stops and waits for your yes.

  4. Then the allow rules. With no match again, step 3 checks allow rules. A match goes to the green box: Runs, no prompt. This is where your test command belongs, so routine work stops asking.

  5. Last, the mode decides. Only when no rule matched does step 4, the mode default, decide. The box lists auto, manual, acceptEdits and plan. A mode sets how much Claude may do without asking. Manual asks before each new action and suits learning. acceptEdits edits files without asking. Plan makes no edits. In auto mode, a second AI model, the classifier, blocks what looks risky. It can miss.

  6. Read the note on the left. First match wins. The order is fixed: deny, ask, allow. A narrow allow can never beat a broad deny above it. The line at the bottom adds: rules are enforced by Claude Code, not by the model.

Key takeaways

  • Put pushes and secret files in deny rules, not in CLAUDE.md, because a note is only a reminder.
  • Allow your test command, so routine work stops asking.
  • When an allow seems ignored, look for a broader deny above it and narrow that deny.

Worked example: five calls on a small expenses app

The book gives one small app a settings file with these rules: allow Bash(npm test) and Bash(npm run test *), deny Read(./.env) and Bash(git push *). A .env file holds the project's secret keys.

  1. npm run test totals in Manual mode: the allow rule matches first. It runs with no prompt.
  2. git push origin main in any mode: the deny rule matches first. Blocked, even in bypassPermissions, the mode that skips almost every check.
  3. Read .env and summarize it: the deny rule matches. Claude cannot open the file.
  4. rm receipts.csv in auto mode: no rule matches, so the mode decides. The classifier blocks it, because the file existed before the session.
  5. rm receipts.csv in bypassPermissions: no rule matches, and the call runs with no prompt.

Result: The rules held in every mode. The last call shows why bypass belongs in a sealed container: only git or a backup brings that file back.

Questions readers ask

My agent pushed to git after I told it not to. Why?

A sentence in CLAUDE.md is a reminder Claude may not follow. A deny rule such as Bash(git push *) blocks the push in every mode. But a rule matches the command's text. git -C . push origin main is the same push with a folder option in front, and it gets through. To close that gap, a PreToolUse hook can reject any command that contains push.

How do I stop Claude from asking for permission?

Add allow rules for the routine commands you trust, such as Bash(npm test). Keep deny rules for secrets and pushes. You need not open the file. In Manual mode, ask Claude: create .claude/settings.json that allows Bash(npm test) and denies Bash(git push *). Then run /permissions to see the rules. See also where settings files live.

Why does my allow rule still get blocked?

A broader deny sits higher on the ladder. Allow Bash(aws s3 ls) never runs if a deny Bash(aws *) matches first. An allow rule cannot carve a hole in a deny rule. Narrow the deny instead.

Sources: Configure permissions (Claude Code docs); Choose a permission mode (Claude Code docs).

This figure is from Claude Code Made Crystal Clear, chapter 6.

The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.

Get the book

All diagrams