Get the free coreGet core

Gemini CLI YOLO mode: the approval modes and how to sandbox it

Updated 6 min readSection 01 / Agent permissions
SHORT ANSWER

Gemini CLI YOLO mode is an approval mode in which every tool is auto-approved. The old --yolo and -y flags are deprecated, and the CLI reference says to use --approval-mode=yolo instead. Turn on the sandbox before you use it. On macOS the sandbox uses Seatbelt, and its default profile confines writes to the project folder but still allows broad reads and network access.

01The old flag and the new one

The --yolo flag is marked "Deprecated" in the CLI reference, with the instruction to use --approval-mode=yolo. The new flag takes a mode name, so Gemini CLI YOLO mode is now one value among four. Run it like this:

gemini --approval-mode=yolo

02The four approval modes

The --approval-mode flag controls how tool calls are approved. Its choices are default, auto_edit, yolo and plan. The policy engine docs spell the second one autoEdit, so you may see either spelling.

ModeWhat the agent can do without asking
defaultThe standard interactive mode where most write tools require confirmation
auto_editOptimized for automated code editing; some write tools may be auto-approved
planA strict, read-only mode for research and design
yoloAll tools are auto-approved (use with extreme caution)

With no flag, the mode is default. In default mode, write tools such as write_file and run_shell_command default to ask_user, which means they ask you first. That is the prompt you skip in yolo.

03What yolo mode turns off

The policy engine is the part of Gemini CLI that decides whether a tool call is allowed, asked about or denied. In yolo mode, a high-priority rule allows all tools. Shell commands are tools too, so nothing asks you before one runs.

An approval you grant while in yolo mode applies only to yolo. Switching back to default does not carry those approvals along.

The policy engine can also deny a shell command by its prefix, for example rm -rf. That is a useful guard against honest mistakes. Because yolo adds a rule that allows all tools, rely on the sandbox below for anything you cannot afford to lose.

04What it looks like when it goes wrong

In July 2025, Ars Technica described a Gemini CLI session where the destruction happened through a series of move commands targeting a directory that never existed. The tool then said, "I have failed you completely and catastrophically". The user's own analysis named the cause: the absence of a read-after-write verification step. In plain words, the agent never checked that the folder it was moving files into really existed. Yolo mode takes away the prompt where you might have noticed.

Outside attackers know about the flag too. A supply-chain attack, where malicious code arrives inside a package you installed, has prompted installed AI command line tools with --yolo to steal files. The story is told once, on the dangerously-skip-permissions page.

05Put a sandbox around it on a Mac

A sandbox is a fence around what commands can touch. Sandboxing isolates potentially dangerous operations, such as shell commands or file modifications, from your host system. It is the right partner for yolo mode.

You can turn it on three ways, in this order of precedence: the -s or --sandbox flag, the GEMINI_SANDBOX environment variable, or settings.json. The flag looks like this:

gemini --sandbox --approval-mode=yolo

Pick the sandbox type to match your Mac:

The two options compare like this:

SandboxWhat it limitsWhat it leaves open
Seatbelt, default profileWrites, confined to the project directoryBroad file reads and network access
Seatbelt, strict-proxiedReads and writes; network goes through a proxyWhatever the proxy lets through
Docker or PodmanRuns in a container with the default imageYour project files, mounted at the same path

Gemini's own description of the sandbox flag is short: run in a sandboxed environment for safer execution. The aim is to limit file system access to the project directory and to put a security barrier between AI operations and your environment. Read that as a lower risk, not as zero. An agent in yolo mode inside the default Seatbelt profile can still read files outside the project and reach the network.

06Which approval mode fits which job

Match the mode to the risk instead of jumping straight to yolo:

07Folders you have not read yet

Trusted Folders is a Gemini CLI feature that decides whether a project may load its own settings. It is disabled by default, and you must first enable it in your settings. In an untrusted folder, the CLI will not load the .gemini/settings.json file from the project. Yolo mode plus a repository you did not write is the riskiest pair, so switch Trusted Folders on before you open one.

08A safer routine for Gemini CLI YOLO mode

  1. Try auto_edit first.
  2. Use plan when you only want the agent to read and propose.
  3. Commit before a yolo session, so Git can bring files back.
  4. Start yolo only with the sandbox on, and prefer a container if you cannot spare your keys.
  5. Keep secrets out of the project folder and the environment.

The same ideas apply to other agents. Claude Code has bypass mode and a YOLO page of its own. Cursor's no-prompt mode is covered in Cursor YOLO mode, and Codex has its own flag in Codex full auto. For the sandbox idea across tools, see AI agent sandbox, and for the wider picture, AI agent permissions.

09Should you use Gemini CLI YOLO mode?

Only inside a container or a throwaway VM. On your main Mac, stay on default or auto_edit, add the sandbox and keep Git history. Yolo saves clicks, and the price is that nothing reviews what the agent does next.

With yolo on, it helps to know what actually ran on the Mac. Artificial Immunity's free, open-source core watches every program start and the places where code starts on its own, and reports what it finds without blocking anything.

FAQ

What is YOLO mode in Gemini CLI?

It is an approval mode where all tools are auto-approved, and the docs say to use it with extreme caution. You start it with --approval-mode=yolo.

Is the --yolo flag still supported?

It is deprecated. The CLI reference says to use --approval-mode=yolo instead.

Can Claude Code run in YOLO mode?

Yes, under another name: the bypassPermissions mode, which --dangerously-skip-permissions is equivalent to. The docs say to use it only in isolated environments such as containers, VMs or dev containers without internet access. Actions that no mode auto-approves still apply.

How do I configure the Gemini CLI?

Install it with npm install -g @google/gemini-cli. Pick the approval mode with --approval-mode, whose choices are default, auto_edit, yolo and plan. Enable the sandbox with the -s or --sandbox flag, the GEMINI_SANDBOX environment variable or settings.json.

Does a policy rule still protect me in yolo mode?

In yolo mode, a high-priority rule allows all tools. The policy engine can deny a shell command by its start, such as rm -rf, but treat the sandbox as the guard that holds, not a deny rule.

Is Gemini CLI still free for individuals?

The README says free individual access and Google AI Pro and Ultra plans moved to Antigravity CLI on June 18, 2026. Check which tool you are running.

Sources

  1. Gemini CLI docs: CLI reference
  2. Gemini CLI docs: policy engine
  3. Gemini CLI docs: sandbox
  4. Gemini CLI docs: trusted folders
  5. Gemini CLI README
  6. Ars Technica: AI coding assistants chase phantoms
  7. Claude Code docs: permission modes
  8. Artificial Immunity
Running Gemini CLI with approvals off? Artificial Immunity watches the Mac where your agents work.Get the free core