lockstep
5 min readNaman Jain

Claude Code permissions: modes, allow and deny rules

How Claude Code permissions work: the six permission modes, allow, ask, and deny rules, rule syntax with wildcards, the order rules apply in, and safe setups.

Claude Code asks before it runs npm test for the fortieth time, and someone on the team "fixes" it with --dangerously-skip-permissions. Both are the wrong answer. Claude Code has a precise permission system, and a few minutes with it removes the prompts you don't need without giving up the ones you do.

This guide covers modes, rules, and setups, from Anthropic's permissions and permission modes documentation, checked on 16 November 2026.

Two layers: modes and rules

A mode sets the baseline for what runs without asking. Rules refine it for specific tools and commands. Both are enforced by Claude Code, not by the model: instructions in CLAUDE.md shape what Claude tries to do, but don't change what it's allowed to do.

The six permission modes

ModeRuns without askingBest for
default (shown as Manual)Reads onlySensitive work, unfamiliar code
acceptEditsReads, file edits, and common filesystem commands like mkdir and mvIterating on code you're reviewing
planReads; edits wait for an approved planExploring before changing anything
autoEverything, with background safety checksLong tasks, fewer prompts
dontAskReads in your working directories and pre-approved tools; everything else is deniedLocked-down CI and scripts
bypassPermissionsEverythingIsolated containers and VMs only

Press Shift+Tab during a session to cycle modes; the status bar shows the active one. Start in a mode with a flag, claude --permission-mode plan, or set permissions.defaultMode in settings.

Some actions are never auto-approved in any mode, including tools matched by an explicit ask rule and recognized removals of critical paths with rm.

Permission rules

There are three kinds:

  • Allow: run without asking.
  • Ask: always prompt.
  • Deny: never run.

Rules are evaluated in a fixed order: deny, then ask, then allow. The first match decides, and specificity doesn't change the order. A broad deny like Bash(aws *) blocks aws s3 ls even if you also allow it. Deny rules block in every mode, including bypassPermissions.

Rule syntax

A rule is Tool or Tool(specifier):

RuleMatches
BashEvery Bash command; as a deny rule, removes the tool entirely
Bash(npm run build)Exactly npm run build
Bash(npm run *)Any npm script
Read(./.env)Reading .env in the current directory
WebFetch(domain:example.com)Fetches to example.com
Agent(isolation:worktree)Subagent calls that request a worktree

Put the wildcard after the subcommand. Everything before the first * is matched as written, so Bash(git log *) allows only git log, while Bash(git *) allows every git command, including push. A rule also matches commands as written: Bash(git push *) won't catch the same push written as git -C . push, so don't treat command rules as a security boundary on their own.

A sensible starting configuration

In .claude/settings.json, shared with the team:

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

Personal additions go in .claude/settings.local.json. When you choose "Yes, and don't ask again" at a prompt for a Bash command, Claude Code saves that rule there for you, at the repository root, so it applies to future sessions and worktrees. For which file wins, see Claude Code settings.json.

Managing rules

Run /permissions to see every rule and the file it comes from, and to add or remove rules. Changes apply from Claude's next tool call, even mid-turn.

Common setups

From Anthropic's permission modes guide:

You want toStart with
Review every actionclaude --permission-mode default
Explore before changing anythingclaude --permission-mode plan
Work hands-offclaude --permission-mode auto
Run in CI with an exact allowlistclaude -p "run the test suite" --permission-mode dontAsk --allowedTools "Bash(npm test)" "Read"
Run fully unattended--dangerously-skip-permissions, only inside a container or VM, as a non-root user

For fewer prompts without a classifier, the documentation pairs Manual mode with the Bash sandbox in auto-allow mode, available on macOS, Linux, and WSL2. See Claude Code sandbox.

For organizations

Managed settings can make permission rules non-negotiable: permissions.deny for actions no one should take, allowManagedPermissionRulesOnly so only the organization's rules apply, and disableBypassPermissionsMode to turn off bypass mode. See Claude Code managed settings.

What permissions can't express

Permissions answer "may Claude run this?" They can't answer "should this code exist?" A deny rule can stop a push. It can't stop an agent from building an export that includes a field the product team decided last week to exclude.

Where Lockstep fits

Lockstep handles that second question. It captures decisions from PRDs, Slack, and pull requests, makes each binding when its owner approves it, and briefs Claude Code on the ones that apply at the start of each session. An opt-in check can flag code changes that may conflict with a decision; it's advisory, and it sits alongside your permission rules, not in place of them.

Session briefings work with Claude Code today. See how it works.

Sources checked 16 November 2026

For hooks that block actions with custom logic, see Claude Code hooks: 6 examples. For unattended runs, see Claude Code best practices. For approving tools in scripts, see Claude Code headless mode. For when to use each mode, see Claude Code plan mode vs auto mode vs accept edits. For organization-wide controls, see Claude Code for enterprise.

Frequently asked questions

What are Claude Code's permission modes?
Six: default (shown as Manual), which only runs reads without asking; acceptEdits, which also allows file edits and common filesystem commands; plan, for exploring before editing; auto, which runs everything with background safety checks; dontAsk, which denies anything not pre-approved; and bypassPermissions, which skips checks and is meant only for isolated containers and VMs.
How do I switch permission modes in Claude Code?
Press Shift+Tab during a session to cycle modes, or start with a flag such as claude --permission-mode plan. Set the starting mode for every session with permissions.defaultMode in settings.
In what order do Claude Code permission rules apply?
Deny, then ask, then allow. The first match in that order decides, and specificity doesn't change it, so an allow rule can't carve an exception out of a broader deny rule. Deny rules block in every mode, including bypassPermissions.
How do I allow a command without being asked?
Add an allow rule such as Bash(npm run *) to permissions.allow in settings, choose "Yes, and don't ask again" at a prompt, or add it in /permissions. Put the wildcard after the subcommand: Bash(git log *) allows only git log, while Bash(git *) allows every git command.
How do I let Claude Code run without asking for permission?
Auto mode runs everything with a background classifier checking actions. bypassPermissions, or --dangerously-skip-permissions, skips all checks and Anthropic says to use it only in an isolated container or VM. For CI, dontAsk with an exact allowlist is safer.

Keep reading