Auto Mode in Claude Code runs tools without asking for permission. No "Allow this command?" prompts. No confirmation dialogs. This is powerful for autonomous work — and dangerous without guardrails.
| Behavior | Normal Mode | Auto Mode |
|---|---|---|
rm -rf / | Asks for permission | Runs immediately |
git push --force | Asks for permission | Runs immediately |
git add .env | Asks for permission | Runs immediately |
| Edit any file | Shows diff first | Edits immediately |
Auto Mode + No Hooks = No Safety Net
CLAUDE.md rules are suggestions. In Auto Mode, Claude doesn't pause to reconsider rules before acting. If it decides rm -rf is the right approach, it executes immediately. The only thing that can stop it is a hook.
Hooks run at the process level, outside the model's control. They execute before (PreToolUse) or after (PostToolUse) every tool call — regardless of whether Claude is in normal mode or Auto Mode.
This means a hook that exits with code 2 blocks the operation even in Auto Mode. The model cannot bypass hooks.
Example: Block rm -rf in Auto Mode
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "bash -c 'CMD=$(cat | jq -r \".tool_input.command // empty\"); echo \"$CMD\" | grep -qE \"rm\\s+-rf\\s+(/|~)\" && exit 2; exit 0'"
}]
}]
}
}
Add this to ~/.claude/settings.json. Claude will never be able to run rm -rf / or rm -rf ~/, even in Auto Mode.
If you're running Auto Mode, these 8 hooks are the minimum safety net:
rm -rf, git reset --hard, chmod 777git add .env, credential filesnpx cc-safe-setup
Works in Auto Mode. Blocks dangerous operations before they execute. 9,200+ tests 655 examples
Browse 655 example hooks covering security, code quality, deployment, and monitoring:
npx cc-safe-setup --examples
npx cc-health-check
Free 20-point diagnostic. If you're using Auto Mode and your score is below 80, you have gaps.
cc-safe-setup is open source, zero dependencies, and installs nothing globally. View source on GitHub.
New: Hook if field — reduce overhead (v2.1.85)
Learn more: Production Guide · All Tools