Permission modes
A permission mode sets the baseline behavior for all tool calls. Individual allow/deny rules can override this baseline for specific tools or commands.| Mode | Description |
|---|---|
default | Prompt for approval on potentially dangerous operations. Safe read-only tools run without prompting. |
acceptEdits | Auto-approve all file edit operations (Write, Edit, MultiEdit). Bash commands still prompt. |
bypassPermissions | Skip all permission checks. All tools run without prompting. Requires allowDangerouslySkipPermissions: true in settings. |
plan | Read-only planning mode. No tool execution; Claude can only read files and explain what it would do. |
dontAsk | Do not prompt the user. Deny any tool call that is not pre-approved by an explicit allow rule. |
Setting the permission mode
- CLI flag
- Settings file
- /permissions command
- SDK control request
Pass
--permission-mode to set the mode for a single invocation:Permission rules
Rules let you pre-approve or block specific tools and commands without changing the global permission mode. Rules are additive across settings scopes — allow rules from all files merge together.Configuration format
Rules that auto-approve matching tool calls without prompting.
Rules that unconditionally block matching tool calls.
Deny rules always take precedence over allow rules. If both an allow rule and a deny rule match a tool call, the call is blocked.
Rule syntax
A rule is a string that matches a tool name, optionally with a parenthesized content pattern. Tool name only — matches every call to that tool:Bash, the pattern is matched against the full command string. For file tools (Write, Edit, Read, Glob), the pattern is matched against the file path argument.
MCP server — matches all tools from a specific MCP server:
Pattern matching for Bash
Bash rule patterns use shell-style glob matching on the full command string.
Pattern matching for file tools
File path patterns are matched against the absolute path of the file being read, written, or edited.Permission rule sources and priority
Rules are collected from multiple sources and evaluated in a defined order. When the same tool call matches rules from different sources, deny takes precedence over allow, and the most restrictive result wins.| Source | Where configured | Editable |
|---|---|---|
policySettings | Managed policy layer | No |
flagSettings | CLI flags and SDK control requests | Per-session |
userSettings | ~/.claude/settings.json | Yes |
projectSettings | .claude/settings.json | Yes |
localSettings | .claude/settings.local.json | Yes |
cliArg | --allowedTools / --disallowedTools flags | Per-invocation |
session | /permissions command, SDK updates | Per-session |
--allowedTools and --disallowedTools CLI flags
Pass comma-separated rule strings directly on the command line:
cliArg source and apply for the duration of the invocation.
Permission decisions
The permission engine evaluates each tool call through a pipeline and returns one of three outcomes.| Decision | Meaning |
|---|---|
allow | Tool runs immediately. |
ask | User is prompted for confirmation. |
deny | Tool call is blocked; Claude receives an error result. |
Decision pipeline
Claude Code evaluates tool calls in this order:- Deny rules — if any deny rule matches, the call is blocked immediately.
- Ask rules — if any ask rule matches, the permission dialog is shown.
- Tool’s own permission check — the tool’s
checkPermissionsmethod runs (e.g., Bash checks individual subcommands). - Safety checks — paths inside
.git/,.claude/,.vscode/, and shell config files always prompt, even inbypassPermissionsmode. - Mode check —
bypassPermissionsand plan mode apply here. - Allow rules — if an allow rule matches, the call is approved.
- Default behavior — if no rule matched, prompt the user.
Safety checks (step 4) are bypass-immune. Even with
bypassPermissions mode, Claude Code will prompt before modifying files in .git/ or shell configuration files like ~/.bashrc.Working directories
By default, Claude Code restricts file operations to the current working directory and its subdirectories. You can grant access to additional directories.Via CLI flag
Via settings
Via SDK control request
Permission updates via the SDK
SDK hosts (IDEs, desktop apps) can respond tocan_use_tool control requests and include permission updates to persist rule changes alongside their decisions.
PermissionUpdate object
type
'addRules' | 'replaceRules' | 'removeRules' | 'setMode' | 'addDirectories' | 'removeDirectories'
required
The update operation.
Rules to add, replace, or remove. Each rule has
toolName and an optional ruleContent (the parenthesized pattern).Which rule list to modify.
Where to persist the update.
session applies only to the current session; userSettings, projectSettings, and localSettings write to the corresponding settings files on disk.Permission decision response
When responding to acan_use_tool request, include updatedPermissions to persist rule changes:
The permission decision.
Modified tool input to use instead of the original. Only valid when
behavior is "allow".Permission rule updates to apply and persist alongside this decision.
How the user responded, for telemetry.
user_temporary for allow-once; user_permanent for always-allow; user_reject for deny.Hooks and permissions
PreToolUse and PermissionRequest hooks can inject permission decisions programmatically. See Hooks reference for details on permissionDecision output and hookSpecificOutput.decision.
The hook-based permission flow is especially useful for headless agents that cannot show interactive prompts. When shouldAvoidPermissionPrompts is true (background agent mode), Claude Code runs PermissionRequest hooks before falling back to auto-deny.
Safety recommendations
CI/CD pipelines
CI/CD pipelines
Use
bypassPermissions only in isolated, short-lived environments where you control all inputs. Set explicit deny rules for destructive operations as a defense-in-depth measure:IDE and interactive use
IDE and interactive use
Use
default mode with allow rules for common safe operations. This minimizes interruptions while keeping you in control of destructive actions:Code review and read-only analysis
Code review and read-only analysis
Use
plan mode when you want Claude to reason about code without making any changes. Claude can read files and explain what it would do, but cannot write, edit, or run commands:Automated agents with human approval
Automated agents with human approval
Use Any tool call not matching an allow rule is sent to your
dontAsk mode combined with an SDK PermissionRequest hook to replace the interactive dialog with your own approval UI. The hook receives every tool call that would have prompted and can allow, deny, or forward it to a human reviewer:PermissionRequest hook handler instead of being auto-denied.