Setting Up YOLO Mode for Headless Agents
YOLO mode lets Claude Code agents run without any confirmation prompts. Here's how to configure it safely.
What YOLO Mode Does
By default, Claude Code asks for confirmation before running potentially dangerous commands (deleting files, running shell scripts, making network requests). YOLO mode disables these confirmations — the agent runs autonomously without stopping to ask permission.
This is essential for overnight and long-running unattended agents. An agent that stops every 10 minutes waiting for your "yes" is not an unattended agent.
Enabling YOLO Mode in amux
Register your session with the --yolo flag:
amux register myagent --dir ~/myproject --yolo
This sets the --dangerously-skip-permissions flag in the underlying Claude Code invocation. You can verify it's active by checking the session config:
amux info myagent
Scoping YOLO Mode Safely
YOLO mode is powerful but requires deliberate scoping. Best practices:
- Use git branches: Always run YOLO agents on a feature branch, never directly on main. Git is your undo button.
- Restrict the working directory: The
--dirflag limits the agent's filesystem access to one directory. Don't give agents access to your entire home directory. - Don't run YOLO agents with production credentials: Keep
.envfiles with production database URLs out of agent-accessible directories. Use.gitignoreand separate config directories. - Review before merging: YOLO mode means the agent acts without confirmation — it does not mean you merge without review. Always review agent-generated PRs.
Claude Code's Permission Model
Even in YOLO mode, Claude Code has a layered permission model:
- Network requests: allowed by default
- File reads: always allowed in the working directory
- File writes/deletes: allowed in YOLO mode
- Shell commands: allowed in YOLO mode
- System-level operations (outside working dir): generally restricted
YOLO Mode for Different Task Types
| Task type | YOLO mode | Reason |
|---|---|---|
| Code generation | Yes | Low risk, easy to review |
| Test running | Yes | Tests are contained |
| Database migrations | Dev DB only | Never run against production |
| npm/pip installs | Yes | Review package.json afterward |
| Deployment commands | Staging only | Manual review for production |
Get started with amux
Run dozens of Claude Code agents in parallel. Python 3 + tmux. Open source.
git clone https://github.com/mixpeek/amux && cd amux && ./install.sh
amux register myproject --dir ~/Dev/myproject --yolo
amux start myproject
amux serve # → https://localhost:8822View on GitHub