Claude Code Auto Approve Guide (2026): Auto-Accept Edits, Auto Mode, and Guardrails¶
Target Audience
- Intermediate Claude Code users who want a safe auto-approval workflow
Key Points¶
- Limit auto accept to low-risk chores
- Guard
--dangerously-skip-permissionswith shared rules - Lock allow/deny lists
Verified Environment (Apr 2026)
This guide has been validated against the following stack.
| Component | Version / Notes |
|---|---|
| Claude Code | v2.1.80+ (Compaction, VS Code integration, Checkpoint, Auto mode) |
| Claude Opus 4.6 | 1M context (standard, no beta header required), 128K output, Agent Teams, Adaptive Thinking |
| Claude Sonnet 4.6 | Default coding model (successor to Sonnet 4.5) |
| Hooks | Multiple event types (PreToolUse / PostToolUse / SubagentStop / PermissionDenied / defer decisions) |
| auto mode | 2026-03-24 Research Preview (Team / Enterprise / API; Pro/Max not supported) → Details1 |
Quick Answer: Which Claude Code Auto-Approve Path Should You Pick?¶
Need fewer prompts for daily work
Start with Step 1. Use
acceptEditsplus Hooks and allow lists before touching full bypass.Need broader unattended runs
Prefer Claude Code Auto mode when Team / Enterprise access is available. It gives you classifier-based auto-approval without opening the whole sandbox.
Need the Codex CLI equivalent
Compare team defaults with the Codex CLI No-Approval Guide before standardizing automation policy across tools.
Why It Matters Now¶
With Claude Code v2.0 expanding auto-approval capabilities and adoption growing, the risk of unintended command execution from misconfigured permissions has increased. A clear operational framework that balances speed with safety is essential.
Pair with the 90-second playbook
- The bite-sized checklist lives in Claude Code Auto-Approval Quick Tips.
- Use the quick post for pre-flight reminders, then follow this long-form guide for the full rollout.
Step Overview¶
When Claude Code attempts to execute a command, it must pass through 3 gates in sequence. Use the simulator below to see how each command behaves.
Step 1: Limit Auto Accept to Low-Risk Tasks¶
Auto-approval scope is determined by your mode. Use Shift+Tab to switch modes and select the right one for your task's risk level.
Step 2: Standardize CLI Flag Usage¶
⚠️ Official warning: 'dangerously' is intentional
Anthropic intentionally uses the word 'dangerously' in this flag name as a safety signal—treat it as high risk and make sure you understand the implications before using it.
Keep it OFF by default and only enable in these scenarios:
- Isolated CI/CD environments
- Verified remediation tasks (lint fixes, test reruns)
- Pipelines with established audit logging
Define scope, rollback, and logging, then let batch jobs or CI call the flag:
claude --dangerously-skip-permissions "Run eslint --fix and rerun tests"
Behavior change since v2.1.78: protected paths
Since v2.1.78, .git/ and .claude/ directories are designated as protected paths. Even with --dangerously-skip-permissions (bypassPermissions mode) enabled, write operations to these paths will still trigger an approval prompt.
- v2.1.81 added
.claude/skills/to the protected list - VS Code extension may ignore settings.json permission configuration (CLI-only confirmed)
- This constraint is likely to expand in the future
Impact: Automation pipelines that include skill file generation or .claude/ configuration changes can no longer run fully unattended with this flag alone.
Combine Hooks with settings.json allow/deny lists for defense in depth. See the Advanced Best Practices (2026 Edition) for details.
New Hook Capabilities (March 2026)
PermissionDeniedhook: Fires after Auto mode's Classifier rejects an operation. Return{retry: true}to instruct the model to retrydeferdecision (PreToolUse): Pause a tool call in headless sessions (-pmode) and re-evaluate the hook on resume via-p --resume
These features are designed for Auto mode integration, but also improve permission control granularity when using Hooks standalone.
New for Team/Enterprise: Auto mode (March 24, 2026)
Anthropic released Auto mode as a safer alternative to --dangerously-skip-permissions. A Sonnet 4.6-based Classifier evaluates risk per tool call, auto-approving safe operations and blocking dangerous ones (mass file deletion, data exfiltration, malicious code execution, etc.).
Supported plans (as of April 2026):
- Team: Available (research preview)
- Enterprise: Available
- API: Available
- Pro / Max (individual plans): Not supported
Activation:
claude --enable-auto-mode
Once enabled, auto is added to the Shift+Tab mode cycle.
Impact for individual plan users: Auto mode is currently unavailable on Pro/Max plans. The acceptEdits mode + Hooks + allow/deny list combination described in this guide remains the most practical auto-approval workflow for individual users.
Details: Auto mode for Claude Code (official blog) / Anthropic Engineering deep dive
Restricting Bypass at the Organization Level¶
In enterprise environments, Organization managed policies can restrict the use of --dangerously-skip-permissions. When administrators set the policy, it is automatically enforced across all member CLIs.
Limit the flag to chore-like remediation; deployments, credential access, and destructive work stay review-driven.
Step 3: Freeze Guardrails with Allow/Deny Lists¶
Define policy in settings.json so auto approval respects hard stops. Use the matcher below to see which rule each command hits.
Known Issue: deny rules may not work as expected
As reported in GitHub Issues #6631 and #6699, deny rules (especially for Read/Write operations) may not function correctly. Although these issues were closed, regressions have been reported in #12918 (v2.0.56) and #27040 (Feb 2026), meaning the problem remains unresolved as of February 2026. Do not rely on deny rules alone for security-critical restrictions.
Recommended mitigation: Combine deny rules with PreToolUse Hooks for reliable blocking. Hooks can exit with a non-zero code to reject tool calls, providing a defense-in-depth approach.
March 2026 update: The v2.1.80+ release fixed a bug where PreToolUse hooks returning allow could bypass deny rules (including enterprise managed settings). However, deny reliability is being improved incrementally, and the defense-in-depth approach remains recommended.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"command": "python3 validate_command.py \"$TOOL_INPUT\"",
"timeout": 5000
}
]
}
}
Restart Claude Code, test a denied command, and sync run logs to shared storage.
Compaction: Stabilizing Long-Running Auto-Approval Sessions¶
Claude Code's Compaction feature automatically compresses conversation when context approaches its limit, keeping your session alive.
Common Pitfalls and Fixes¶
| Symptom | Cause | Fix |
|---|---|---|
| Risky commands run | No deny rules | Add high-risk patterns to settings.json |
| Production deploy sneaks in | Mode banner ignored | Shift+Tab back to default mode and add a reviewer |
| Audit trail missing | Logs stay local | Sync run logs to shared storage |
| Context lost in long sessions | Compaction not used | Update to Claude Code v2.0+ and use Checkpoint as safety net |
--dangerously-skip-permissions still prompts for .git/ operations | Protected paths since v2.1.78 | Migrate to Auto mode (Team/Enterprise), or use Hooks to allow specific operations |
Advanced Optimization
- Wrap the command with alias `cca`, validate arguments, restrict callers. - Document the policy in `CLAUDE.md` and capture `git diff --stat` in CI for instant diffs.alias cca="claude --dangerously-skip-permissions"
Next Reads¶
- Claude Code Auto Mode Complete Guide — Classifier logic, subagent behavior, and setup instructions
- Auto mode for Claude Code (official blog) — Team/Enterprise: Classifier-based auto-approval mode
- Advanced Best Practices (2026 Edition) — Hooks, Subagents, context management and 11 practical techniques
- Claude Code Hooks Complete Guide — Build safety nets with PostToolUse hooks for auto-approval
- CLAUDE.md Introduction Guide — Document auto-approval policies in CLAUDE.md
- Claude Code Troubleshooting Guide — Diagnose issues when auto-approval misbehaves
- Claude Code Permission Modes (official docs) — All modes (default/acceptEdits/plan/auto/bypassPermissions)
- Claude Code on Windows: Fix "not recognized as cmdlet" — Native Windows install + PATH troubleshooting
- Claude Code Remote Access Guide — SSH and remote development setup
- Serena MCP Setup Guide — Add full codebase understanding to Claude Code
- Codex CLI Auto Approve — Cross-tool comparison: Codex CLI equivalent (
-a never) - Claude Code MCP Guide
Anthropic, "Auto mode for Claude Code", 2026-03-24. https://claude.com/blog/auto-mode ↩