Answer: Use `codex exec` (or the short form `codex e`) for scripted or CI-style runs that should finish without human interaction. Add `--json` to receive newline-delimited JSON events, and use the optional `resume` subcommand to continue non-interactive tasks. Status: Confirmed Entry: tool/codex/commands-and-shortcuts/exec-non-interactive Revision: 2 Digest: sha256:88ad405260e9be4b (changes whenever the content changes) Timeline: Created: 2026-11-13T03:48:42Z Last changed: 2026-11-19T13:26:56Z (all flag: — → --all) Last verified: 2026-11-20T13:36:25Z Next check: 2026-11-21T13:36:25Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of command | codex exec | [1] | 2026-11-20 short form | codex e | [1] | 2026-11-20 json flag | --json | [1] | 2026-11-20 resume subcommand | resume | [1] | 2026-11-20 last flag | --last | [1] | 2026-11-20 all flag | --all | [1] | 2026-11-20 Sources: [1] OpenAI. "Command line options". https://learn.chatgpt.com/docs/developer-commands.md?surface=cli Role: primary. Accessed: 2026-11-20T13:36:25Z Quote: "Use `codex exec` (or the short form `codex e`) for scripted or CI-style runs that should finish without human interaction." (Supports: command, short form) Quote: "Add `--json` to receive newline-delimited JSON events (one per state change)." (Supports: json flag) Quote: "The optional `resume` subcommand lets you continue non-interactive tasks." (Supports: resume subcommand) Quote: "Use `--last` to pick the most recent session from the current working directory, or add `--all` to search across all sessions:" (Supports: last flag, all flag) Snapshot SHA-256: c03e3a1408d1c55fbbe838c81e4e98d0eca65bde195e39a41c8d1fd8d340b5e3 (captured 2026-11-18T13:30:25Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T13:30:27Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:36:25Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:36:25Z Last attempt: 2026-11-20T13:36:25Z Notes and limitations: Extracted automatically from a single official source (section "`codex exec`"). Related: https://latestn.com/tool/codex/commands-and-shortcuts/import-from-another-agent-cli How do I import from another agent using Codex CLI? https://latestn.com/tool/codex/commands-and-shortcuts/import-from-cli How do I import scanner findings into Daybreak from the CLI? https://latestn.com/tool/codex/commands-and-shortcuts/open-prompt-editor How do I open an external editor for long prompts in the Codex CLI? https://latestn.com/tool/codex/commands-and-shortcuts/configure-deep-scan How do I configure a deep scan with the Codex Security CLI? https://latestn.com/tool/codex/commands-and-shortcuts/create-custom-prompt How do I create a custom prompt in Codex? https://latestn.com/tool/codex/commands-and-shortcuts/custom-prompt-metadata-arguments How do I add metadata and arguments to a Codex custom prompt? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-19T13:26:56Z | changed | all flag: — → --all | [1] 2026-11-19T13:26:56Z | changed | last flag: — → --last | [1] 2026-11-19T13:26:56Z | changed | json flag: — → --json | [1] 2026-11-19T13:26:56Z | changed | all sessions flag: --all → — | [1] 2026-11-19T13:26:56Z | changed | last session flag: --last → — | [1] 2026-11-19T13:26:56Z | changed | JSON output flag: --json → — | [1] 2026-11-13T03:48:42Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/codex/commands-and-shortcuts/exec-non-interactive/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/codex/commands-and-shortcuts/exec-non-interactive POST: https://latestn.com/dispute/tool/codex/commands-and-shortcuts/exec-non-interactive with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/codex/commands-and-shortcuts/exec-non-interactive?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I run Codex non-interactively with codex exec? Revision 2, last verified 2026-11-20T13:36:25Z. https://latestn.com/tool/codex/commands-and-shortcuts/exec-non-interactive (accessed 2026-11-21T09:59:58Z). @misc{LatestN_tool_codex_commands_and_shortcuts_exec_non_interactive_r2, title = {How do I run Codex non-interactively with codex exec?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/codex/commands-and-shortcuts/exec-non-interactive}}, note = {Revision 2; digest sha256:88ad405260e9be4b; last verified 2026-11-20T13:36:25Z; accessed 2026-11-21T09:59:58Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/codex/commands-and-shortcuts/exec-non-interactive