Permission Modes
The active permission mode is stored inToolPermissionContext.mode and determines how permission prompts are resolved.
default
The standard interactive mode. Claude prompts you before running potentially impactful operations — bash commands, file writes, web requests. Read-only operations (file reads, searches) are generally auto-approved.
plan
Claude can analyze, plan, and reason — but cannot execute any tool that requires permission. Use this when you want to review a plan before committing to it.
bypassPermissions
All permission prompts are auto-approved without user interaction. Enabled by the
--dangerously-skip-permissions CLI flag. See the warning below before using this.auto
Automated mode for headless / non-interactive sessions. A classifier and hook system attempt to auto-resolve permissions; prompts that cannot be auto-resolved are rejected rather than displayed.
ToolPermissionContext also carries per-session rule lists that refine behavior regardless of mode:
| Rule list | Effect |
|---|---|
alwaysAllowRules | Patterns that are always approved without prompting |
alwaysDenyRules | Patterns that are always rejected |
alwaysAskRules | Patterns that always prompt, even in auto mode |
The Permission Check Flow
Every tool invocation follows this sequence beforecall() runs:
checkPermissions() on the tool
The tool’s own
checkPermissions() method runs first. It returns a PermissionResult that may be allow, ask, or deny based on tool-specific logic.Rule matching
The result is checked against
alwaysAllowRules, alwaysDenyRules, and alwaysAskRules in ToolPermissionContext. Matching rules short-circuit the remaining checks.Hook execution (runHooks)
Any registered
PermissionRequest hooks run next. A hook can allow, deny, or pass through to the next step. Hooks are defined in .claude/settings.json or via the hooks API.Classifier (BASH_CLASSIFIER feature gate)
When enabled, the
BashTool classifier runs for bash commands, consulting a prompt-rule model to auto-approve safe commands.What Triggers a Permission Prompt
Bash commands (BashTool)
Bash commands (BashTool)
All shell commands require a permission prompt in default mode. The prompt shows the exact command Claude intends to run. You can approve, deny, or modify the command before it executes.
File writes (FileWriteTool, FileEditTool)
File writes (FileWriteTool, FileEditTool)
Creating or modifying files always asks for confirmation. The prompt shows the file path and, for edits, a diff of the proposed change.
Web requests (WebFetchTool, WebSearchTool)
Web requests (WebFetchTool, WebSearchTool)
Fetching URLs or performing web searches triggers a prompt so you can verify the destination before data leaves your machine.
Sub-agent spawning (AgentTool)
Sub-agent spawning (AgentTool)
Spawning a sub-agent prompts for approval in default mode. Sub-agents run with their own permission context and may prompt you independently.
Destructive operations
Destructive operations
Tools that declare
isDestructive() returning true are always highlighted in the UI, regardless of mode.Approving and Denying
When a permission prompt appears in the REPL:- Approve — Claude executes the tool with the shown input.
- Approve always — adds the pattern to
alwaysAllowRules, persisted to~/.claude/settings.jsonso the same class of action is auto-approved in future sessions. - Deny — the tool receives a
REJECT_MESSAGEresult and Claude is informed the action was not permitted. Claude will typically offer an alternative approach. - Deny with feedback — you can type a reason alongside the denial. The reason is included in the rejection message so Claude can adjust its approach.
SUBAGENT_REJECT_MESSAGE and the rejection is propagated up to the parent.
Plan Mode
Plan mode lets Claude think and plan without executing anything. You can enter it manually or Claude can enter it autonomously viaEnterPlanModeTool.
- Claude can call read-only tools (file reads, searches).
- Any tool that would normally require a permission prompt is blocked.
- Claude presents its proposed steps as a plan for you to review.
ExitPlanModeTool(or your/plantoggle) restores the previous permission mode.
ToolPermissionContext.prePlanMode and restored exactly on exit.
Bypass Permissions
isBypassPermissionsModeAvailable field on ToolPermissionContext controls whether this mode can be activated. Organization policy can lock this to false.
Organization Policy Limits
ThepolicyLimits service (src/services/policyLimits/) enforces org-level restrictions. Policies are delivered via remoteManagedSettings and can:
- Force a specific permission mode.
- Disable
bypassPermissionsmode entirely (isBypassPermissionsModeAvailable: false). - Populate
alwaysDenyRuleswith patterns your organization has blocked. - Strip dangerous rules that would otherwise be inherited from user settings (
strippedDangerousRules).
Tips for Safe Use
When
shouldAvoidPermissionPrompts is true (set automatically for background agents that have no UI), any tool requiring a prompt is auto-denied rather than hanging indefinitely.