Permission modes
Claude Code operates in one of five permission modes. The active mode determines whether Claude Code prompts before executing potentially dangerous operations.default
default
The standard interactive mode. Claude Code prompts for approval before running operations that could be destructive or irreversible — shell commands, file writes, web requests, and similar actions.Read-only operations (file reads, directory listings, searches) are allowed without prompting.
plan
plan
Plan mode shows a structured plan of what Claude Code intends to do before executing any tools. No tools run until you approve the plan.The model can also enter plan mode autonomously via
EnterPlanModeTool.acceptEdits
acceptEdits
Auto-approves file edit operations (create, write, edit) within the working directory, while still prompting for shell commands and other potentially dangerous actions.Useful when you want Claude Code to work through file changes without repeated prompts but still want oversight of command execution.
dontAsk
dontAsk
Skips interactive prompts for most tool operations. Similar to
bypassPermissions but retains certain safety checks. Suitable for non-interactive automation scenarios.bypassPermissions
bypassPermissions
Skips all permission prompts. Every tool call is approved automatically without any user confirmation.
Setting the permission mode
Pass flags when starting Claude Code to control permissions:-p) mode, you can also pass --permission-mode to control how tools are approved during headless execution:
Permission dialogs
When Claude Code needs approval indefault mode, it displays a permission dialog in the terminal showing:
- The tool name and a description of what it will do
- The exact input (command, file path, etc.)
- The reason approval is required (mode, rule match, safety check, or hook decision)
| Response | Effect |
|---|---|
y / Enter | Allow this one invocation |
n | Deny this invocation |
always allow | Add an always-allow rule for this tool or command prefix |
always deny | Add an always-deny rule for this tool or command prefix |
Always allow and always deny rules
You can configure persistent per-tool rules so Claude Code never prompts for certain operations. Rules are stored in your project settings (.claude/settings.json) or user settings (~/.claude/settings.json).
Rule syntax: ToolName(prefix:value) for content-specific rules, or just ToolName to cover all invocations of a tool.
- Always-deny rules (deny → block immediately)
- Always-ask rules (ask → show dialog even in permissive modes)
- Tool-specific
checkPermissions(tool’s own safety logic) - Always-allow rules (allow → skip dialog)
- Mode-level decision (default, plan, acceptEdits, bypassPermissions)
Hook-based permissions
The hooks system lets you plug external scripts into the permission pipeline. APermissionRequest hook runs before Claude Code shows the permission dialog (or auto-approves). The hook can return allow, deny, or pass through to the normal flow.
Hooks are configured in .claude/hooks.json:
Auto-mode classifier
Whenauto mode is active (internal builds with the TRANSCRIPT_CLASSIFIER feature flag), Claude Code uses a transcript-based safety classifier instead of prompting the user.
The classifier:
- Reads the full conversation transcript
- Formats the pending tool call as an action description
- Calls a secondary Claude model to decide whether the action is safe
- Returns
allowordenywith a reason
acceptEdits mode).
If the classifier is unavailable or the transcript exceeds its context window, Claude Code falls back to normal prompting so you retain control.
Consecutive classifier denials trigger a fallback to interactive prompting after a configurable threshold, surfacing the classifier’s reason so you can review.
Sandbox
BashTool supports OS-level sandboxing via utils/sandbox/. When sandboxing is enabled, shell commands run inside a restricted execution environment that limits filesystem and network access.
The sandbox adapter (sandbox-adapter.ts) selects the appropriate backend for the current OS. Sandboxed commands that would otherwise require approval can be auto-allowed when the autoAllowBashIfSandboxed option is on.
Sandboxing does not apply to commands that explicitly opt out via dangerouslyDisableSandbox.
Workspace trust
On the first run in a new directory, Claude Code shows a workspace trust dialog asking whether you trust the project. This prevents Claude Code from reading project-specific configuration (.claude/settings.json, CLAUDE.md) in untrusted directories.
The trust decision is persisted and can be revoked via /config.
Safety checks
Certain paths are protected regardless of the active permission mode or bypass flags. Claude Code will always prompt before modifying:.git/— git repository internals.claude/— Claude Code configuration.vscode/,.idea/— IDE configuration- Shell configuration files (
.bashrc,.zshrc,.profile, etc.)
decisionReason.type === 'safetyCheck' and cannot be suppressed by bypassPermissions mode, always-allow rules, or PreToolUse hooks.