codex exec
The subcommand that runs Codex non-interactively (alias: e) — the entry point for scripting and CI.
Specs
Verified:
- Kind
- CLI subcommand (non-interactive)
- Syntax
- codex exec [options] [PROMPT]; alias codex e
- First seen
- —unverified
- Subcommands
- exec resume / fork / review
- Alias
- e (codex e)
The official help for `codex exec` reads "Run Codex non-interactively"; alias `e`. It is the automation entry point (scripts, CI, pipelines) and hosts exec resume / fork / review beneath it. Since 0.163.0, exec can select Daybreak with an OpenAI API key when the server offers access; since 0.169.0 it takes `--trust` — untrusted directories keep project config and MCP disabled even with `--sandbox workspace-write` (#60041). First-seen version is unverified (our coverage starts at 0.154.0 and the command predates it).
Timeline
- 0.163.0: exec can select Daybreak with an OpenAI API key when the server offers access
- 0.169.0: exec/review take --trust — untrusted dirs keep project config and MCP disabled even with --sandbox workspace-write (#60041)
Key features
- Non-interactive — runs to completion and exits
- Alias `e`; hosts exec resume/fork/review beneath it
- --trust (since 0.169.0) gates directory trust, project config, and MCP loading
Use cases
Automated review/edits in CI, pipeline batch jobs, cron tasks — anywhere no human sits at the terminal.
Install
`codex exec "review the latest changes"` runs one shot; `codex e` is the shorter alias for scripts.
Caveats
Non-interactive means no human approval step — think through the --sandbox/--trust combination before letting it loose in CI.
Added
Updated
Verified