Skip to content
← All guides

YOLO mode for AI agents: Claude Code, Codex, Cursor, Gemini CLI

What YOLO mode is in Claude Code, Codex, Cursor, Gemini CLI and OpenCode: the exact flag for each, what it turns off, what still stops it, and safer setups.

7 min read

“YOLO mode” is the nickname for running an AI agent with its approval prompts turned off, so it runs every command and edit without asking you first. Some vendors now use the word themselves. Gemini CLI has a --yolo flag and an approval mode called yolo. Codex lists --yolo as an alias for --dangerously-bypass-approvals-and-sandbox. The Cursor CLI has --yolo as an alias for --force. Claude Code’s docs don’t use the word, and neither do OpenCode’s. The trade is the same everywhere: no interruptions, and nothing between the model’s decision and your files and keys.

The flag in each agent

AgentThe flag or settingWhat it turns offWhat still stops it
Claude Code--dangerously-skip-permissions, same as --permission-mode bypassPermissionsPermission prompts and safety checks, including for writes to protected pathsDeny rules, explicit ask rules, AskUserQuestion, recognized rm of critical paths such as rm -rf ~, unless you turn that prompt off
Codex--dangerously-bypass-approvals-and-sandbox, alias --yoloApprovals and the sandbox, both at onceNothing in Codex itself. OpenAI says to use it only in an externally hardened environment
Cursor (editor)Run Mode set to Run Everything, in Settings > Agents > Approvals & ExecutionApproval prompts, the sandbox and the classifierBrowser Protection, File-Deletion Protection and External-File Protection, if you turn them on, can still require approval
Cursor (CLI)--force, alias --yoloPrompts for commandsCommands you explicitly denied
Gemini CLI--yolo, or --approval-mode=yoloApproval for every tool callThe sandbox, which the docs say is on by default in YOLO mode
OpenCodeOpenCode has no YOLO flag; its default policy already allows nearly everythingPrompts, except .env readsAny deny or ask rule placed after it; a broad allow rule added later also overrides the .env ask

For every Codex and Claude Code control side by side, see Codex vs Claude Code: security controls compared.

Claude Code YOLO mode

claude --dangerously-skip-permissions starts Claude Code in bypassPermissions mode. The installed help for Claude Code 2.1.322 describes it as “Bypass all permission checks” and recommends it only for sandboxes with no internet access. What else still prompts, and how to lock the mode out, is in Claude Code --dangerously-skip-permissions.

The safer middle is auto mode. A separate classifier model reviews each action before it runs and blocks the ones it judges risky, such as curl | bash, force pushes and production deploys. After 3 blocks in a row or 20 in total, Claude Code starts prompting again. The docs say auto mode reduces prompts but does not guarantee safety. See Claude Code auto mode and Claude Code permissions.

Codex YOLO mode (--yolo)

codex --yolo is the short form of --dangerously-bypass-approvals-and-sandbox. The installed help for Codex CLI 0.166.0 calls it extremely dangerous and intended solely for environments that are externally sandboxed. OpenAI’s security page adds that with --yolo or another full-access setting, web search defaults to live results instead of the cached index, so planted instructions reach it more easily.

Codex has a deliberate middle option. --approve-for-me, alias --not-so-yolo, keeps the workspace-write sandbox and sends approval requests to automatic review instead of to you. For low-friction local work, the CLI reference suggests --sandbox workspace-write --ask-for-approval on-request. See Codex --dangerously-bypass-approvals-and-sandbox and Codex sandbox.

Cursor

In the Cursor editor, Auto-review runs allowlisted calls, sandboxes other shell commands where it can and sends the rest to a classifier. Allowlist runs only what you listed. Run Everything runs everything. Cursor also warns that Auto-review “is not a security boundary.” In the Cursor CLI, --force (alias --yolo) allows commands unless you explicitly denied them, and --sandbox enabled or disabled sets the sandbox.

Gemini CLI

For unpaid tier and Google One users, Gemini CLI was replaced by Antigravity CLI on June 18, 2026, per a notice on Gemini CLI’s own docs. gemini --yolo approves every tool call automatically. --approval-mode also takes default, auto_edit (approves edits, prompts for the rest) and plan (read-only, experimental and not yet fully functional). The two flags can’t be combined. YOLO can only be turned on from the command line, not as a default in settings.json. To lock it out, set security.disableYoloMode to true, or admin.secureModeEnabled, which also removes the “Always allow” options.

OpenCode

OpenCode has no YOLO flag, and its default is already close to one. Every agent starts with a base policy that allows every action, except that it asks before reading .env files. The docs warn that the shell runs with your user’s full filesystem, process and network authority. The last matching rule wins, so add ask and deny rules after any broad allow.

{
  "permissions": [
    { "action": "shell", "resource": "git push *", "effect": "deny" },
    { "action": "external_directory", "resource": "*", "effect": "ask" }
  ]
}

Is YOLO mode safe?

Not on your everyday Mac. YOLO mode doesn’t make the agent err more, but it removes the moment you would have caught the error. With your real account, that covers:

  • Deletion. An rm -rf on the wrong path, or a git reset --hard or git clean -fd that throws away uncommitted work. See An AI agent deleted files on my Mac.
  • History. A git push --force to main that overwrites other people’s commits.
  • Secrets. Reading .env files, SSH keys and cloud credentials, then pasting them into a command, a log or a request to a website.
  • Publishing. Running a deploy, a package publish or a database migration that reaches real users.
  • Prompt injection. Text in a web page, issue or file that tells the agent to do something you didn’t ask for. With no prompt in the way, the agent can act on it at once.

An unattended agent can run hundreds of commands before you look.

How to run it more safely

  • Make the machine the sandbox. Claude Code and Codex both recommend full bypass only in an isolated environment. Use a container or VM without real credentials.
  • Know what the native sandbox still covers. Claude Code’s sandbox still applies in bypass mode, but there a sandboxed command can reach hosts outside your allowlist without a prompt, and a command retried outside the sandbox runs without one too. Set sandbox.allowUnsandboxedCommands to false to stop those retries. Codex’s workspace-write sandbox is the default, but --yolo turns it off, so use --approve-for-me or --ask-for-approval never instead. See Claude Code sandbox and Codex sandbox.
  • Use the middle modes. Claude Code’s auto mode, Codex’s --approve-for-me, Cursor’s Auto-review and Gemini’s auto_edit cut most prompts and keep some checks.
  • Write deny rules. Deny rules still apply in Claude Code bypass mode, in Cursor CLI --force and in OpenCode. They match command text, so test other spellings of the same command. See Stop an AI agent from running rm -rf or git push --force.
  • Protect the branch on the host. Disallow force pushes to main on GitHub or GitLab.
  • Commit first, review afterwards. Start from a clean working tree, then read what the agent ran. See Check what your AI agents did.

Checked against the vendor documentation on November 27, 2026. Claude Code permission modes · Claude Code sandboxing · Codex CLI reference · Codex approvals and security · Cursor run modes · Cursor CLI parameters · Gemini CLI configuration · OpenCode permissions

Where Excellent fits

Excellent’s free scan reads supported logs on the Mac and reports findings for review, such as a force push, a deleted never-delete folder or a key in a log. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. For a local report without installing an app, run the free scan. See a sample report.

Excellent Pro adds a live check before supported actions in Claude Code, Codex, Gemini CLI, Cursor (not yet tested in a live Cursor session) and the other agents on the Agents page. OpenCode isn’t protected yet: Excellent recognizes it but doesn’t run its check there. Pro blocks deleting protected folders and typing API keys into commands, and it asks before overwriting history on main and before reading keys and .env files. In Claude Code the ask shows as a prompt. In Codex, Cursor and Gemini CLI an ask refuses the action and tells the agent to ask you. Commands sent into an already running Codex shell fall outside that check. Pro can also configure the native Mac sandbox for Claude Code and Codex from your file and folder rules, with a plan to review first. Pro is sold in most countries. Turn on protection · Sandbox setup · Pricing

Related guides

View all