Skip to content
SCOHOSTINGS
Sign inSign upSubscribe

How to Enable Auto Mode in Codex CLI: Complete Guide

Marian9 min readAi
Codex CLI Auto Mode enabled with workspace-write permissions.

Codex CLI can inspect code, edit files, execute terminal commands, and test your project directly from the command line. However, depending on its permissions, Codex may stop frequently and ask you to approve individual actions.

If you are working in a trusted project and want Codex to handle routine development tasks with fewer interruptions, you can enable Auto mode.

In this tutorial, you will learn how to:

  • Enable Auto mode permanently through config.toml
  • Start a single Codex session in Auto mode
  • Switch to Auto mode during an active session
  • Verify the currently active permissions
  • Enable network access when required
  • Troubleshoot common configuration problems

Important: Auto mode is not the same as unrestricted system access. The recommended configuration keeps Codex inside a workspace sandbox and asks for permission when it needs to perform an action outside that boundary.

What Is Auto Mode in Codex CLI?

Auto mode allows Codex to perform ordinary development work inside the current project without requesting approval for every command.

With the recommended Auto configuration, Codex can generally:

  • Read files in the current workspace
  • Create and modify project files
  • Run build, test, lint, and formatting commands
  • Run dependency installation commands when the necessary workspace, cache, package-manager, and network access is available or approved.
  • Execute routine terminal commands inside the project
  • Continue through multiple development steps automatically

The recommended Auto preset combines two Codex security controls:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

These settings have different responsibilities:

SettingPurpose
sandbox_mode = "workspace-write"Allows Codex to read and modify files inside the active workspace
approval_policy = "on-request"Allows Codex to request approval when an action must cross the sandbox boundary

Codex can therefore work automatically inside your project while still asking before attempting actions such as writing outside the workspace.

According to the official OpenAI documentation, the Auto preset is represented by workspace-write sandboxing combined with the on-request approval policy.

Method 1: Enable Codex Auto Mode Permanently in config.toml

The best method for users who want Auto mode enabled by default is to configure it in the Codex config.toml file.

Step 1: Locate the Codex configuration file

The user-level configuration file is located at:

~/.codex/config.toml

On Linux and macOS, ~ represents your home directory.

You can open the file with Nano:

nano ~/.codex/config.toml

If the .codex directory does not exist, create it first:

mkdir -p ~/.codex
nano ~/.codex/config.toml

You can also use another editor, such as Vim or Visual Studio Code:

vim ~/.codex/config.toml

Or:

code ~/.codex/config.toml

Step 2: Add the Auto mode configuration

Add these two settings near the top of the file:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

A minimal config.toml configured for Auto mode should look like this:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

If the file already contains settings such as a model selection, you can combine them:

model = "gpt-5.6"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

Root-level settings should be placed before table sections such as [sandbox_workspace_write], [windows], or [mcp_servers.example]. Otherwise, TOML may interpret them as belonging to the preceding section.

Step 3: Save the file

When using Nano:

  1. Press Ctrl + O
  2. Press Enter
  3. Press Ctrl + X

Step 4: Start a new Codex session

Open your project directory and launch Codex:

cd /path/to/your/project
codex

The settings will be loaded automatically when the new session starts.

You can verify them from inside Codex with:

/status

The status output should indicate that Codex is using the workspace-write sandbox and the corresponding Auto approval policy.

The official Codex configuration documentation confirms that personal defaults are loaded from ~/.codex/config.toml.

Method 2: Start One Codex Session in Auto Mode

You may not want Auto mode enabled permanently. For example, you might use it only when working in a trusted local repository.

Start a single interactive session with:

codex --sandbox workspace-write --ask-for-approval on-request

This overrides your default configuration for that invocation.

The two command-line options mean:

--sandbox workspace-write

Codex can write inside the active workspace.

--ask-for-approval on-request

Codex asks for permission when it determines that an action must cross the current security boundary.

You can also launch Codex in a specific project directory:

codex \
  --cd /path/to/project \
  --sandbox workspace-write \
  --ask-for-approval on-request

Command-line options have higher priority than settings from config.toml, so this method is also useful for temporarily overriding a stricter default configuration.

Method 3: Enable Auto Mode During an Active Session

You do not need to close and restart Codex when you want to change its permissions.

During an active Codex CLI session, enter:

/permissions

Codex will display the available permission presets.

Select:

Auto

The permission change applies to future actions in the current session.

This is useful when you initially open a repository in Read Only mode, inspect the project, and then decide that you trust Codex to make changes.

The process is:

  1. Type /permissions
  2. Press Enter
  3. Select Auto
  4. Confirm the selection if prompted
  5. Use /status to verify the active permissions

According to the Codex CLI command reference, /permissions can relax or restrict permissions during an active session, including switching between Auto and Read Only.

The change normally applies only to the active session. To use Auto mode automatically in future sessions, add the settings to ~/.codex/config.toml.

Optional: Enable Network Access in Auto Mode

The workspace-write sandbox does not automatically provide unrestricted network access. Network access is disabled by default for locally executed commands.

If Codex must download dependencies, access an API, or contact a remote package repository, add the following section:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true

Only enable network access when it is necessary and when you trust the repository.

A malicious project could contain instructions or scripts designed to transmit source code, environment variables, or other sensitive information to an external server.

If you need network access only occasionally, keep it disabled by default. Under the on-request policy, Codex may request approval when a command needs network access, subject to the active sandbox and any organization-enforced restrictions.

When network_access = true is enabled without a network proxy policy, commands may receive direct outbound network access. Advanced users can configure Codex’s network proxy and domain rules to restrict allowed destinations.

Using a Separate Auto Mode Profile

Codex also supports configuration profiles. This is useful when you want to keep a conservative default while having an Auto profile available for trusted projects.

Create:

~/.codex/full_auto.config.toml

Add:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

Then start Codex using the profile:

codex --profile full_auto

This approach gives you two convenient workflows:

codex

Uses your normal default configuration.

codex --profile full_auto

Uses your Auto configuration.

Profiles are especially useful on development machines that contain both trusted personal projects and unfamiliar third-party repositories.

Since Codex CLI 0.134.0, profiles must use separate ~/.codex/profile-name.config.toml files. Legacy [profiles.name] sections inside the main config.toml are no longer selected by --profile.

Should You Use approval_policy = "never"?

You may encounter configurations such as:

approval_policy = "never"
sandbox_mode = "workspace-write"

With approval_policy = "never", Codex never pauses for interactive approval. It remains constrained by the configured sandbox, and operations outside that boundary cannot be approved interactively.

For normal interactive Auto mode, use:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

The Old codex exec --full-auto Option

Older versions of Codex CLI provided this compatibility option for non-interactive execution:

codex exec --full-auto "your task"

The option was deprecated and has been removed from current Codex CLI releases. Do not use:

codex --full-auto

For an interactive Auto session, use:

codex --sandbox workspace-write --ask-for-approval on-request

For a non-interactive task that needs to edit the workspace, use:

codex exec --sandbox workspace-write "your task"

Avoid --yolo and Full Access on Your Main Operating System

Codex also provides an unrestricted option:

codex --dangerously-bypass-approvals-and-sandbox

It may also be available as:

codex --yolo

This disables both approval prompts and sandbox protections. It is not the recommended Auto mode.

Only consider this option inside a dedicated and externally isolated environment, such as:

  • A disposable virtual machine
  • A restricted CI runner
  • A hardened development container
  • An environment containing no sensitive credentials or personal files

For ordinary development on your workstation or server, use workspace-write instead.

How Codex Chooses Between Multiple Configuration Files

Codex can load settings from several locations. A setting in a higher-priority location can override the one in your user configuration.

The relevant precedence is:

  1. Command-line flags and --config overrides
  2. Project .codex/config.toml files
  3. The selected profile file
  4. User configuration at ~/.codex/config.toml
  5. System configuration
  6. Built-in defaults

For example, this command overrides the sandbox value in your configuration file:

codex --sandbox read-only

Project-specific configuration is loaded only for projects that Codex considers trusted.

Administrators can also enforce security requirements that prevent users from selecting settings such as approval_policy = "never" or sandbox_mode = "danger-full-access".

For most local development work, this is the recommended configuration:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

If commands inside the sandbox also require network access:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true

Use network access only when your workflow requires it.

Troubleshooting Codex CLI Auto Mode

Codex still asks for approval

Some approval prompts are expected even in Auto mode.

Codex may ask before:

  • Writing outside the active workspace
  • Accessing protected locations
  • Running a command that requires elevated privileges
  • Using network access when it is disabled
  • Performing an action restricted by an organizational policy
  • Calling an external tool that advertises side effects

Run:

/status

Confirm that the active sandbox is workspace-write.

If the action targets another directory, start Codex with additional directory access instead of granting access to your entire system:

codex --add-dir /path/to/second/directory

Changes to config.toml are not applied

Close Codex and start a new session:

codex

Persistent configuration changes may not automatically replace the permissions of an already-running session.

Also check whether command-line options, a project configuration, or a selected profile are overriding your user configuration.

Codex starts in Read Only mode

Inside the session, run:

/permissions

Select Auto, and then verify the result:

/status

If every new session starts in Read Only mode, confirm that ~/.codex/config.toml contains:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

Codex reports a TOML parsing error

Check for:

  • Missing quotation marks
  • Duplicate keys
  • Incorrect section names
  • Root settings placed under an unrelated table
  • Curly “smart quotes” copied from a formatted webpage

Use ordinary straight quotation marks:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

Do not use:

approval_policy = “on-request”

Codex cannot download packages or access the internet

Add network access to the workspace sandbox:

[sandbox_workspace_write]
network_access = true

Restart Codex after saving the file.

Remember that the table should appear after the root-level settings:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]
network_access = true

A project configuration is ignored

Project-specific .codex/config.toml files are loaded only for trusted projects.

Either trust the project when Codex asks, or place your personal default configuration in:

~/.codex/config.toml

Do not trust repositories from unknown sources before reviewing their files and instructions.

The --full-auto command shows a warning

The flag is deprecated. Replace it with:

codex --sandbox workspace-write --ask-for-approval on-request

Conclusion

The safest practical way to enable Codex CLI Auto mode is:

approval_policy = "on-request"
sandbox_mode = "workspace-write"

Place these settings in ~/.codex/config.toml to make Auto mode the default.

For a single session, use:

codex --sandbox workspace-write --ask-for-approval on-request

To switch during an active session, run:

/permissions

Then select Auto.

This configuration gives Codex enough autonomy to edit code, run tests, and complete multi-step development tasks while preserving an important sandbox boundary around your project.

Frequently asked questions

What is Auto mode in Codex CLI?

Auto mode allows Codex to read, edit, and run commands inside the active workspace without requesting approval for every routine action. The recommended configuration uses the workspace-write sandbox with the on-request approval policy.

How do I permanently enable Auto mode?

Add the following lines to ~/.codex/config.toml: approval_policy = "on-request" sandbox_mode = "workspace-write" Restart Codex after saving the file.

How do I enable Auto mode during a Codex session?

Enter: /permissions Then select Auto. Use /status afterward to verify the active configuration.

Does changing permissions during a session save them permanently?

No. The change affects the current session. Add the desired settings to ~/.codex/config.toml if you want them applied automatically to future sessions.

Does Auto mode give Codex full access to my computer?

No. The recommended Auto mode keeps Codex inside the workspace-write sandbox. Codex can work within the project but may request approval before accessing files or resources outside the permitted workspace.

Is approval_policy = "never" the same as Auto mode?

No. The never policy prevents interactive approval prompts. An action outside the sandbox may be denied rather than automatically authorized. Interactive Auto mode normally uses approval_policy = "on-request".

Is --full-auto still supported?

The old codex exec --full-auto compatibility flag was deprecated and has been removed from current Codex CLI releases. Use codex exec --sandbox workspace-write for non-interactive tasks.

How can I check the current Codex permissions?

Run the following slash command inside Codex: /status It displays information about the active session, including its current configuration and permissions.

Can Auto mode access the internet?

Not by default for commands executed inside the local workspace-write sandbox. You can enable it with: [sandbox_workspace_write] network_access = true Only enable network access for repositories you trust.

Is Codex Auto mode safe?

The recommended Auto mode is considerably safer than disabling sandboxing because file writes remain limited to the workspace. However, you should still review generated changes, use Git, avoid exposing secrets, and create checkpoints before large tasks.

Comments (0)

Sign in to join the discussion

Sign in