promptgarten 🌱

Command reference Β· Codex CLI

codex exec

Runs Codex non-interactively, e.g. for scripts or CI.

codex exec (short form: e) runs a task non-interactively without opening the TUI. You can also pass '-' as the prompt to read input from stdin. With --json, events are output as JSONL; with -o/--output-last-message, only the last message is saved; and with --output-schema, an output schema is enforced.

🎬 AS A SHORT VIDEO

Runs Codex non-interactively, e.g. for scripts or CI.

πŸ”„ THE SAME TASK (β€œSTART HEADLESS/NON-INTERACTIVE”) ON OTHER PLATFORMS

Compare all 28 tasks β†’

βœ… WHEN TO USE IT?

Integrate Codex into a script or pipeline

codex exec "summarize the changes from the last commits" --json

Pipe input from another source via stdin

cat task.txt | codex exec -

β›” WHEN NOT TO?

You want to steer interactively, e.g. answer follow-up questions live

codex exec runs through without interactive follow-up questions.

Better: Start the normal TUI with codex (without exec)

SOURCES

MORE COMMANDS Β· Codex CLI

codex reviewcodex resumecodex apply/init/compact/reasoning/fast/personality/memories/ide/feedback/approve

All commands Β· Codex CLI β†’

Share:𝕏inπŸ’¬