CLAUDE CODE

Claude Code permissions, the complete guide

How Claude Code permissions work, which tools ask first, allow, ask and deny rules, rule syntax, settings files, permission modes and managed policy.

Short answer

Claude Code asks before it runs shell commands, edits files or fetches web pages, unless a rule or a permission mode says otherwise. You control this with allow, ask and deny rules in settings.json (deny always wins), with permission modes such as Manual, acceptEdits, plan and auto, and with the /permissions command.

Claude Code permissions decide what the agent can do on your machine without asking you first. Reads inside your project run freely, while shell commands, file edits and web requests trigger a permission prompt unless a rule or a permission mode approves them. This guide covers the whole system: which tools ask, how allow, ask and deny rules work, the rule syntax, where settings files live, how modes change the defaults, and what organizations can enforce.

If you only want to stop approving the same command again and again, jump to how to allow specific commands in Claude Code. If you want the modes in detail, read Claude Code permission modes explained.

Which Claude Code tools ask for permission?

In Claude Code's Manual mode (the default mode), read-only tools run without asking, and anything that changes your machine or reaches the network asks first. The official docs describe it as a tiered system:

Tool typeExampleAsks for approval?"Yes, and don't ask again" lasts
Read-onlyFile reads, GrepNo, inside the working directory and additional directoriesNot applicable
Bash commandsShell executionYes, except a built-in set of read-only commandsPermanently, per repository and command
File modificationEdit and WriteYesUntil the session ends
Web fetchWebFetchYes, except preapproved documentation domainsPermanently, per repository and domain
Web searchWebSearchYesPermanently, per repository

The built-in read-only commands include ls, cat, echo, pwd, head, tail, grep, find, wc, which, diff, stat, du, cd and read-only forms of git. That set is not configurable. If you want one of them to prompt, add an ask or deny rule for it.

What happens when you answer a permission prompt?

A Claude Code permission prompt shows the tool, the exact command or file, and a few options: approve once, approve and stop asking for that pattern, or refuse. Some prompts also offer to switch to auto mode.

When you choose "Yes, and don't ask again" for a Bash command or a WebFetch domain, Claude Code writes an allow rule to .claude/settings.local.json at the root of your git repository. The rule then applies to future sessions anywhere in that repository, including subdirectories and worktrees. File edit approvals are different: they are not saved to a file and last only until the session ends.

When you approve a compound command such as git status && npm test this way, Claude Code saves a separate rule for each subcommand that needed approval, not one rule for the whole string. Up to 5 rules can be saved from a single compound command.

How do allow, ask and deny rules work?

Claude Code permission rules come in three lists: allow runs a tool without asking, ask always prompts, and deny blocks it. Rules are evaluated in a fixed order, deny first, then ask, then allow, and the first match decides.

Specificity does not change that order. A broad deny rule like Bash(aws *) blocks aws s3 ls even if you also have an allow rule for exactly Bash(aws s3 ls). An allow rule cannot carve an exception out of a deny rule, and a matching ask rule still prompts when a narrower allow rule also matches.

{
  "permissions": {
    "allow": [
      "Bash(npm run *)",
      "Bash(git commit *)"
    ],
    "ask": [
      "Bash(git push *)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./secrets/**)"
    ]
  }
}

Two details matter in practice. A deny rule with a bare tool name, such as "Bash", removes the tool from Claude's context entirely, while a scoped rule like Bash(rm *) keeps the tool and blocks matching calls. And permission rules are enforced by Claude Code itself, not by the model: instructions in a prompt or in CLAUDE.md shape what Claude tries, but they do not change what is allowed.

What is the Claude Code permission rule syntax?

Every Claude Code permission rule has the form Tool or Tool(specifier). A bare tool name matches every use of that tool, and the specifier narrows it.

Bash rules and wildcards

Bash rules match the command text, and * stands for any text, spaces included. A rule with no * matches one exact command.

RuleMatchesDoes not match
Bash(npm run build)npm run buildnpm run build --watch
Bash(npm run *)npm run build, npm run test --watch, npm runnpm install
Bash(ls *)ls -la, lslsof
Bash(ls*)ls -la, lsof

Put the * after the subcommand: Bash(git log *) allows only git log, while Bash(git *) allows every git command. The older :* suffix is equivalent to a trailing *, so Bash(ls:*) matches the same commands as Bash(ls *).

Claude Code understands shell operators. A rule like Bash(safe-cmd *) does not approve safe-cmd && other-cmd; every subcommand must be allowed on its own. The recognized separators are &&, ||, ;, |, |&, & and newlines. Claude Code also strips a fixed set of wrappers before matching (timeout, time, nice, nohup, stdbuf, plus command, builtin and zsh's noglob), so Bash(npm test *) also matches timeout 30 npm test.

Bash rules are not a security boundary around a program. A deny rule for Bash(rm *) stops rm -rf build/ but not /bin/rm -rf build/ or bash -c 'rm -rf build/'. For enforcement that does not depend on the command text, the docs point to sandboxing and PreToolUse hooks.

Read and Edit rules

Read and Edit rules use gitignore-style path patterns, and the leading characters decide where the pattern is anchored:

PatternMeaningExample
//pathAbsolute path from the filesystem rootRead(//Users/alice/secrets/**)
~/pathPath from your home directoryRead(~/Documents/*.pdf)
/pathRelative to the settings sourceEdit(/src/**/*.ts)
path or ./pathRelative to the current directoryRead(*.env)

A single leading slash is not an absolute path. In project settings it anchors at the project, and in user settings (~/.claude/settings.json) it anchors at ~/.claude. Use // for a real absolute path. Edit rules apply to every built-in tool that edits files, and a Read deny rule also blocks Edit and Write on the same path.

WebFetch, MCP and subagent rules

  • WebFetch(domain:example.com) matches fetches to that host. Add WebFetch(domain:*.example.com) to cover subdomains.
  • mcp__puppeteer__* matches every tool from the puppeteer MCP server, and mcp__puppeteer__puppeteer_navigate matches one tool. See what an MCP server is if this is new.
  • Agent(Explore) matches the Explore subagent. Put it in deny to disable that subagent.

Where do Claude Code permission settings live?

Claude Code reads permission rules from four settings files plus command line flags, and it merges the allow, ask and deny lists from all of them instead of picking one.

ScopeFileWho it affects
User~/.claude/settings.jsonYou, in every project on this machine
Shared project.claude/settings.jsonEveryone who works in the repository, once committed
Project local.claude/settings.local.jsonYou, in this project only, kept out of git
Managedmanaged-settings.json, MDM or server-managed settingsEveryone your organization deploys it to

For keys that hold a single value, precedence from highest to lowest is managed settings, command line (--settings), project local, shared project, then user. For permission rules, the deny-first evaluation applies across all levels: if any level denies a tool, no other level can allow it. A user-level deny blocks a project-level allow, and the reverse is also true.

One safety detail: permissions.allow rules and additionalDirectories in a project's committed .claude/settings.json only take effect after you accept the workspace trust dialog for that folder. Deny and ask rules apply right away because they only restrict. The Claude Code settings.json reference covers each file in detail.

What are the Claude Code permission modes?

A permission mode changes Claude Code's defaults for the whole session, on top of your rules. The six modes in the official docs are:

ModeWhat runs without asking
default (labeled Manual)File reads in the working directories and actions that need no approval
acceptEditsReads, file edits and common filesystem commands such as mkdir, touch, mv and cp in scope
planReads and exploration; Claude proposes changes but does not edit your source files
autoMost actions, with a background classifier reviewing them first
dontAskOnly pre-approved tools; anything that would prompt is denied
bypassPermissionsEverything except a short list of actions no mode auto-approves

In the CLI you cycle modes with Shift+Tab, start in one with claude --permission-mode plan, or set a default with permissions.defaultMode in a settings file. Deny rules apply in every mode, including bypassPermissions. The permission modes guide explains when to use each, and the dangerously skip permissions guide covers the riskiest one.

How do I use the /permissions command?

In Claude Code, /permissions opens a dialog that lists every permission rule and the settings file each rule comes from. You can add or remove rules there instead of editing JSON by hand.

You can open the dialog while Claude is working, and changes apply from Claude's next tool call. When auto mode is available to your session, the dialog also shows the auto mode classifier rules in a separate tab. The security docs recommend auditing your permission settings with /permissions regularly, which is a good habit after a few weeks of clicking "don't ask again".

To check which settings files actually loaded, run /status and read the Setting sources line. To list settings entries Claude Code rejected, such as a malformed rule, run claude doctor.

Can hooks make permission decisions?

Yes. Claude Code hooks are shell commands (or other handlers) that run on events, and a PreToolUse hook runs before the permission prompt. It can return allow, deny, ask or defer for a tool call. A PermissionRequest hook runs when Claude Code is about to show you a permission prompt and can allow or deny it.

Hooks do not bypass your rules: deny and ask rules are evaluated whatever a PreToolUse hook returns. A hook that exits with code 2 blocks the tool call even when an allow rule matches. The Claude Code hooks guide and the PermissionRequest hook guide go further.

What can organizations enforce with managed settings?

Managed settings sit above every user and project file, so developers cannot override them. Administrators deliver them as a managed-settings.json file, through MDM, or as server-managed settings from the claude.ai admin console.

The file paths are /Library/Application Support/ClaudeCode/managed-settings.json on macOS, /etc/claude-code/managed-settings.json on Linux and WSL, and C:\Program Files\ClaudeCode\ on Windows. Useful permission keys include:

{
  "permissions": {
    "disableBypassPermissionsMode": "disable",
    "deny": ["Bash(curl *)", "Read(./.env)"]
  },
  "allowManagedPermissionRulesOnly": true
}

permissions.disableBypassPermissionsMode set to "disable" prevents bypass mode, permissions.disableAutoMode set to "disable" removes auto mode, and allowManagedPermissionRulesOnly makes managed settings the only source of permission rules.

Answering permission prompts from the menu bar

Permission prompts are only useful if you see them. When Claude Code waits on a prompt in a terminal tab you are not looking at, the session just stops, and you find out minutes later.

Allowbar is a macOS menu bar app that connects to Claude Code (and Codex) through their own hooks. When the agent asks to run a command or edit a file, a panel slides down from the top of the screen with the project, the tool and the exact command, and you answer with Allow, Block or Terminal. Allowbar never approves anything on its own: there is no auto approval and no rules that approve for you. If you do not answer before the countdown ring runs out, or if Allowbar is closed, the question goes back to the terminal as usual, and commands your own allow rules already cover never show up.

It is Mac only (macOS 14 or later) and supports Claude Code and Codex. Allowbar is in private beta. Join the waitlist; the launch price is $9.99 instead of $29.90.

Sources:

Frequently asked questions

Where does Claude Code save "Yes, and don't ask again"?

Claude Code saves it as an allow rule in .claude/settings.local.json at the root of the git repository, so it applies to future sessions anywhere in that repository. File edit approvals are not saved; they last until the session ends.

Does a deny rule override an allow rule in Claude Code?

Yes. Claude Code evaluates deny rules first, then ask, then allow, and the first match wins. A deny rule in any settings file blocks the call even if a more specific allow rule exists elsewhere.

Can I put permission instructions in CLAUDE.md instead?

No. Instructions in CLAUDE.md influence what Claude tries to do, but permission rules are enforced by Claude Code, not by the model. Use /permissions, settings files, a permission mode or a hook to change what is allowed.

Why are my project allow rules ignored?

Allow rules in a committed .claude/settings.json only apply after you accept the workspace trust dialog for that folder. Also check that no ask or deny rule at another level matches the same command, and run /status to confirm the file loaded.

Which commands does Claude Code run without asking?

In Manual mode, a built-in set of read-only commands such as ls, cat, grep, pwd and read-only git commands run without a prompt, along with file reads inside your working directories. Everything else needs an allow rule, a permission mode that covers it, or your approval.

ALLOWBAR FOR MAC

Answer your agents from the menu bar.

Permission requests from Claude Code and Codex slide down from the top of your screen. Allow, Block or send back to the terminal. Allowbar never approves anything on its own.

Launch price $9.99 instead of $29.90, one-time purchase, lifetime license.