# Codex --yolo Mode: What It Turns Off, Safely

> Codex --yolo is --dangerously-bypass-approvals-and-sandbox: how to turn it on, what it disables, why OpenAI says to use it only in a sandbox, and where.

- URL: https://flockvm.com/learn/codex-yolo-mode
- Last updated: 2026-11-10

Codex's YOLO mode is one flag:

```bash
codex --yolo
```

`--yolo` is the alias of `--dangerously-bypass-approvals-and-sandbox`. It turns off both of Codex's controls at once: it never asks before running a command, and it runs commands outside Codex's own OS sandbox, with full disk and network access. OpenAI's docs mark it "not recommended" and say to use it "only inside an externally hardened environment". The safe way to get the speed is to make that environment a machine you can throw away. Below: the flag, what replaced `--full-auto`, the config, what OpenAI says, and how to run it in a VM.

## Quick answer

| You want | Run |
|---|---|
| No prompts, no sandbox (YOLO) | `codex --yolo`, same as `codex --dangerously-bypass-approvals-and-sandbox` |
| The same, non-interactive | `codex exec --yolo "<task>"` |
| No prompts, sandbox kept | `codex --sandbox workspace-write --ask-for-approval never` |
| Fewer prompts, reviewed by a model | `codex --approve-for-me` |
| YOLO as a saved profile | `approval_policy = "never"` and `sandbox_mode = "danger-full-access"` in `~/.codex/yolo.config.toml`, then `codex --profile yolo` |

Checked on 5 November 2026 against OpenAI's [developer commands](https://learn.chatgpt.com/docs/developer-commands?surface=cli), [approvals and security](https://learn.chatgpt.com/docs/agent-approvals-security) and [configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference) pages, and Codex CLI 0.166.0 from npm. `--yolo` doesn't appear in `codex --help` in that version, but both `codex --yolo` and `codex exec --yolo` accept it, and OpenAI's command reference lists it.

## What --yolo turns off

Codex keeps two controls apart, and the flag removes both:

- **The approval policy** (`--ask-for-approval`, `-a`): when Codex stops to ask you. The flag takes `on-request` (the model asks when it needs to) or `never`; Codex 0.166.0 rejects `untrusted` and `on-failure` there. In `config.toml`, `approval_policy = "untrusted"` is no longer supported and `on-failure` is deprecated.
- **The sandbox** (`--sandbox`, `-s`): what commands can touch. `read-only`, `workspace-write` or `danger-full-access`.

By default, OpenAI says, "the agent runs with network access turned off". In a git repository, Codex recommends its **Auto** preset, `workspace-write` with `on-request` approvals: it edits and runs commands in the workspace, and asks before it edits outside it or uses the network. In `workspace-write`, `.git`, `.codex`, `.agents` and `.aws` inside the workspace stay read-only.

`--yolo` drops all of that. When the flag was added in June 2025 ([PR #1384](https://github.com/openai/codex/pull/1384)), it set the `never` approval policy and the full-access sandbox together, so that commands run "without _any_ sandbox" and you are never prompted. OpenAI's security page sums it up as "No sandbox; no approvals". Two side effects: with `--yolo`, web search defaults to live results instead of OpenAI's cache, and since Codex 0.90.0, `codex exec --yolo` skips the check that you are inside a git repository instead of failing.

The CLI's own help text for the long flag (0.166.0): "EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed".

## --full-auto vs --yolo

They were never the same thing, and only one is left.

- **`--full-auto`** was the low-friction mode *with* the sandbox. OpenAI deprecated it in Codex 0.128.0 (30 April 2026): in the interactive CLI it "just resolves to the default permissions", so it was removed there ([PR #20133](https://github.com/openai/codex/pull/20133)). Codex 0.147.0 (7 August 2026) removed it from `codex exec` too, with the advice "use `--sandbox workspace-write` instead". In Codex 0.166.0, both `codex --full-auto` and `codex exec --full-auto` fail with `unexpected argument '--full-auto'`.
- **`--yolo`** is still there, and removes the sandbox as well as the prompts.

If an old script or tutorial uses `--full-auto`, replace it with `--sandbox workspace-write`, plus `--ask-for-approval never` if nobody will be there to answer. Don't replace it with `--yolo`: that gives the agent more than the old flag did.

Codex 0.147.0 also added a middle option, `--approve-for-me` (alias `--not-so-yolo`). OpenAI describes it as "automatic approval review with `on-request` approvals and the `workspace-write` sandbox": the sandbox stays, and approval requests go to an automatic reviewer instead of you. It can't be combined with `--sandbox` or `--yolo`. Automatic review uses extra model calls, so it can add to your Codex usage.

## Set it in config.toml

There is no `yolo` key. The two settings the flag combines live in `~/.codex/config.toml`:

```toml
# ~/.codex/config.toml: the default for every session (not recommended)
approval_policy = "never"
sandbox_mode    = "danger-full-access"
```

A safer pattern is a profile you choose on purpose. Profile files sit next to `config.toml` as `$CODEX_HOME/<name>.config.toml`, and `--profile <name>` (`-p`) layers one on top of your config:

```toml
# ~/.codex/yolo.config.toml
approval_policy = "never"
sandbox_mode    = "danger-full-access"
```

```bash
codex --profile yolo
```

For no prompts with the sandbox kept, and network on, use this instead:

```toml
# ~/.codex/unattended.config.toml
approval_policy = "never"
sandbox_mode    = "workspace-write"

[sandbox_workspace_write]
network_access = true
```

A project's own `.codex/config.toml` only loads once you trust that project. OpenAI documents `--sandbox danger-full-access` and the bypass flag side by side as the way to run "with network access without approval prompts", and adds: "Use caution before doing so."

## What OpenAI says about it

In OpenAI's own words, across its docs and the CLI:

- The security page's table: "No sandbox; no approvals _(not recommended)_".
- The command reference: "Only use inside an externally hardened environment", and for `codex exec`, "only use inside an isolated runner".
- On prompt injection: it "can cause the agent to fetch and follow untrusted instructions". Treat web results as untrusted.
- On containers: when Codex's Linux sandbox can't start inside Docker, OpenAI says to make the container the isolation boundary and run Codex with `--sandbox danger-full-access` or the bypass flag inside it. But even then, "a malicious project can exfiltrate anything available inside the devcontainer, including Codex credentials", so use it only with trusted repositories.

So the question is not whether to use `--yolo`, but where. The box has to keep the agent away from your files, and you have to assume anything inside the box can leave.

## What can go wrong

Without approvals and without a sandbox, Codex can do anything your user can do on that machine:

1. **Destruction**: a wrong `rm`, a `git reset --hard`, a migration run against the wrong database.
2. **Secret leaks**: environment variables, `.env` files, `~/.ssh`, cloud credentials and the Codex login in `~/.codex` are all readable, and the network is open.
3. **Prompt injection**: an issue, a README or a live web result can carry instructions, and nothing stops a command it suggests.
4. **Persistence**: a write to `.git/hooks` or `~/.bashrc` runs code after the session ends. `workspace-write` keeps `.git` read-only; `--yolo` doesn't.

## Run it in a disposable VM

A VM on another machine is the "externally hardened environment" in its simplest form: the agent can wreck the VM, not your laptop, and you delete it afterwards. On flockvm, each task gets its own Firecracker microVM in France, with Codex preinstalled on the Agent image.

1. **Create a VM** from your laptop:

   ```bash
   flockvm vm create codex-1 --size default --wait
   ```

2. **SSH in.** You log in as `user`, which has passwordless `sudo`:

   ```bash
   flockvm vm ssh codex-1
   ```

3. **Sign Codex in, inside the VM.** The VM has no browser, so use device code login, `codex login --device-auth` (beta; turn on device code login in your ChatGPT security settings first), and finish it in your laptop's browser. Or use an API key: `printenv OPENAI_API_KEY | codex login --with-api-key`, with a project key that has a spend limit. API key usage is billed at OpenAI's API rates.

4. **Clone with a deploy key** scoped to one repository, then run the task in tmux so it survives a dropped connection:

   ```bash
   tmux new -s codex
   codex --yolo
   ```

   Or non-interactive: `codex exec --yolo "fix the failing tests and commit"`.

5. **Pause or delete the VM** when the work is done, and revoke the key if anything looked wrong:

   ```bash
   flockvm vm pause codex-1       # keep it, memory included
   flockvm vm delete codex-1 --yes
   ```

The full setup, from the deploy key to choosing the approval mode, is in the [Codex docs](/docs/agents/codex). To run several tasks at once, one VM each, see [Codex parallel tasks](/learn/codex-parallel-tasks). For a company rollout, with keys you can revoke, a locked `requirements.toml` and Codex in GitHub Actions, see [Codex CLI for enterprise teams](/playbooks/codex-cli-enterprise).

What the VM does and doesn't stop. Your laptop's files, keys and other projects aren't there, and each VM has its own kernel and can't reach the others. Outbound IPv4 is open, except private ranges, cloud metadata, other VMs, the host and SMTP port 25, and flockvm v1 has no per-VM egress allowlist and no secrets proxy. So the Codex login or API key in the VM can still leave with a followed injection: use one you can revoke.

## Claude Code's equivalent

Claude Code's flag is `--dangerously-skip-permissions`, the `bypassPermissions` mode. It removes the prompts but leaves Claude Code's built-in `/sandbox` on if you enabled it, refuses to run as root, and still honors deny rules. Every way to turn it on, and what still applies, is in [Claude Code's --dangerously-skip-permissions](/learn/dangerously-skip-permissions-safely).

## When flockvm is the wrong pick

- **You just want fewer prompts on your laptop.** Keep the sandbox: `--sandbox workspace-write --ask-for-approval never`, or `--approve-for-me`. That is often enough for code you trust, and costs nothing extra.
- **You want OpenAI to host it.** OpenAI's security page describes Codex Cloud as running "in isolated OpenAI-managed containers", with nothing for you to set up.
- **Your team already standardizes on dev containers.** OpenAI documents that pattern, with its caveat about credentials, and it keeps everything on your machine.

flockvm fits when you want `--yolo` speed on code you don't fully trust, without your laptop involved, or many tasks at once, each in its own VM, billed per second. [Start your 7-day free trial](/signup): card required, nothing charged for 7 days.

## FAQ

### What is Codex YOLO mode?

Running Codex with `--yolo`, the alias of `--dangerously-bypass-approvals-and-sandbox`: no approval prompts and no sandbox. OpenAI marks it "not recommended" outside an externally hardened environment.

### Is --yolo the same as --full-auto?

No. `--full-auto` kept the sandbox and was removed (deprecated in 0.128.0, gone from `codex exec` in 0.147.0). `--yolo` removes the sandbox too. The replacement for `--full-auto` is `--sandbox workspace-write`.

### How do I set YOLO mode in config.toml?

There is no single key: set `approval_policy = "never"` and `sandbox_mode = "danger-full-access"`. Put them in a profile file such as `~/.codex/yolo.config.toml` and start with `codex --profile yolo`, so it is never your default by accident.

### Does --yolo work with codex exec?

Yes: `codex exec --yolo "<task>"`. OpenAI's reference says to use it "only inside an isolated runner".

### Does Codex have network access in YOLO mode?

Yes. Without the sandbox, commands reach the network like any other program on the machine, and web search uses live results. By default, without `--yolo`, network access is off.

### Is there a middle ground between prompts and --yolo?

Two. `--sandbox workspace-write --ask-for-approval never` keeps the sandbox and skips the prompts. `--approve-for-me` keeps the sandbox and lets an automatic reviewer answer approval requests.

## Sources

- [OpenAI Codex docs: Developer commands (--yolo, --ask-for-approval, --sandbox, --approve-for-me, codex login)](https://learn.chatgpt.com/docs/developer-commands?surface=cli) (accessed 2026-11-05)
- [OpenAI Codex docs: Agent approvals and security](https://learn.chatgpt.com/docs/agent-approvals-security) (accessed 2026-11-05)
- [OpenAI Codex docs: Configuration reference (approval_policy, sandbox_mode, profiles)](https://learn.chatgpt.com/docs/config-file/config-reference) (accessed 2026-11-05)
- [OpenAI Codex docs: Authentication (device code, API key)](https://learn.chatgpt.com/docs/auth) (accessed 2026-11-05)
- [openai/codex PR #1384: add --dangerously-bypass-approvals-and-sandbox (merged 2025-06-25)](https://github.com/openai/codex/pull/1384) (accessed 2026-11-05)
- [openai/codex PR #20133: deprecate --full-auto (merged 2026-04-29)](https://github.com/openai/codex/pull/20133) (accessed 2026-11-05)
- [openai/codex release rust-v0.128.0 (2026-04-30: --full-auto deprecated)](https://github.com/openai/codex/releases/tag/rust-v0.128.0) (accessed 2026-11-05)
- [openai/codex release rust-v0.147.0 (2026-08-07: codex exec --full-auto removed, --approve-for-me added)](https://github.com/openai/codex/releases/tag/rust-v0.147.0) (accessed 2026-11-05)
- [npm: @openai/codex 0.166.0 (codex --help, codex exec --help, run on 2026-11-05)](https://www.npmjs.com/package/@openai/codex) (accessed 2026-11-05)
