Free guide
How Claude Code Decides What Runs: Deny, Ask, Allow
Claude can ask to run anything. Claude Code decides what actually runs. Here's the order it checks, the one rule that trips people up, and the new setting for when nobody is there to click yes.

The short version
- Permission rules are enforced by Claude Code, not by the model. What you write in a prompt or CLAUDE.md doesn't change what's allowed.
- Rules are checked deny, then ask, then allow. The first match wins, and a more specific rule doesn't jump the line.
- New in v2.1.319: permissions.denyInsteadOfPrompting turns a prompt nobody will answer into a deny, so the turn carries on instead of waiting.
How it actually works
Think of a coin sorter
Every command Claude wants to run rolls past three slots in the same order every time. The deny slot comes first. If a deny rule matches, the call is blocked and never reaches the others.
Then ask, then allow
If nothing in deny matches, ask is next. A match there stops and shows you a permission prompt. If ask doesn't match either, allow is last, and a match there runs without asking. Anything that matches no rule falls back to your permission mode.
The first match wins, not the most specific
Specificity doesn't change the order. Anthropic's own example: a deny rule for Bash(aws *) blocks aws s3 ls even if you also have an allow rule for Bash(aws s3 ls). An allow rule can't carve an exception out of a deny rule. The same goes for ask versus allow: a matching ask rule prompts even when a narrower allow rule also matches.
When nobody is there to click yes
A prompt waits for a person. In a long unattended run, a subagent or an agent team, that can stall the work. The new permissions.denyInsteadOfPrompting setting denies the call at once instead, tells Claude it was denied, and lets the turn carry on. Your allow rules, permission mode, auto mode's classifier and PermissionRequest hooks still decide first. It only ever denies, and it never allows anything.
How to set it up
1.See the rules you already have
Inside Claude Code, open the permissions dialog to see your allow, ask and deny rules and where each one comes from.
/permissions2.Write a deny and an ask rule
Add rules under permissions in ~/.claude/settings.json (or your project's .claude/settings.json to share them with your team). This example lets Claude run your tests without asking, makes it ask before any git push, and blocks reading .env files. Settings files are strict JSON, so no comments or trailing commas.
{ "permissions": { "allow": ["Bash(npm run test *)"], "ask": ["Bash(git push *)"], "deny": ["Read(./.env)", "Read(./.env.*)"] } }3.Check the file loaded
Run /status inside Claude Code. The Setting sources line shows which settings files were read, and a broken file shows up as a Settings Error.
/status4.Turn prompts into denies for unattended runs
Update to v2.1.319 or later, then set denyInsteadOfPrompting in your user settings (~/.claude/settings.json). It's ignored in project and local settings files. Give Claude allow rules for what it should be able to do on its own, because everything else that would prompt is now denied.
claude update claude --version # 2.1.319 or later { "permissions": { "denyInsteadOfPrompting": true } }
The fine print
- denyInsteadOfPrompting is read from user settings, --settings and managed settings. Project and local settings files ignore it.
- It only denies. It never approves a call your rules or mode wouldn't approve.
- Deny rules block in every permission mode, including bypassPermissions.
- A Bash rule matches the command text Claude writes. It isn't a security boundary around a program that can be called another way, so pair it with the sandbox for anything that really matters.
- Older and related: dontAsk mode also auto-denies every call that would prompt, for a whole session. It's set with --permission-mode dontAsk.
- As of November 7, 2026 the new setting is in the v2.1.319 changelog but not yet on the docs pages, so the docs may add details.
FAQ
In what order does Claude Code check permission rules?
Deny first, then ask, then allow. The first rule that matches decides what happens, and a more specific rule doesn't change that order.
Can an allow rule override a deny rule in Claude Code?
No. If a deny rule matches, the call is blocked even when a narrower allow rule also matches. Anthropic's docs use Bash(aws *) in deny blocking an allow rule for Bash(aws s3 ls).
What does denyInsteadOfPrompting do?
It's a Claude Code setting added in v2.1.319. Any tool call that would wait on a permission prompt is denied right away, Claude is told, and the turn carries on. It works in terminal sessions, subagents and agent teams.
Where do I put Claude Code permission rules?
Under permissions in a settings file: ~/.claude/settings.json for you, .claude/settings.json in a project to share with your team. You can also manage them with /permissions inside Claude Code.
Does telling Claude not to do something in CLAUDE.md block it?
No. Instructions shape what Claude tries to do, but permission rules are enforced by Claude Code itself. Use a deny rule to actually block something.
Sources
- Claude Code docs: Configure permissions
- Claude Code docs: Permission modes
- Claude Code docs: Settings
- Claude Code changelog (v2.1.319)
Facts checked 2026-11-07 against the Claude Code permissions, permission modes and settings docs, the v2.1.319 changelog, and the setting's description in the official v2.1.319 package.
Want help building with tools like this?
Join the Shipping Skool community free. Paid members get live bootcamp calls every week and weekly-updated courses.
Join Shipping SkoolMore free guides
How ChatGPT Wallet Pays Without Seeing Your Card (and How to Set It Up)
OpenAI's new ChatGPT Wallet lets your dot pay for things on your behalf, and neither the agent nor the store ever sees your real card number. Here's how the stand-in card works and how to set it up.
Claude Code Custom Themes: Animated Backdrops and Your Own Colors
The Claude Code desktop app can now wear a theme: your own colors and an animated scene behind the chat. Here is how a theme works, two ways to get one today, and why you should treat a theme like code.
Astryx: Give Your AI Agent Meta's Design System So Every Screen Matches
Meta's open-source design system ships 150+ React components, seven themes and a CLI your coding agent reads from. What it is, how it works, how to set it up today, and the fine print.