What does codex exec --json output?
It streams Codex execution events to standard output as JSONL: one JSON object per line. This is useful for CI, logging, and event-driven automation.
Instrument 14 / Codex automation
codex exec --json command with an explicit Git check.Generate one inspectable command for JSONL automation, ephemeral runs, constrained sandboxes, structured output, and the trusted-directory check.
Compose a bounded run
The safe default keeps the Git repository check, uses a read-only sandbox, streams JSONL events, and avoids persisting session files.
Three separate boundaries
Git check.
Confirms the command targets a repository unless deliberately skipped.
Sandbox.
Controls filesystem and command authority; it is independent of the Git check.
Output contract.
JSONL events, a final-message file, and a response schema solve different automation needs.
Current CLI contract
--json prints execution events as newline-delimited JSON. Parse one object per line instead of expecting a single JSON document.
--ephemeral runs without persisting session files. It does not change model or sandbox behavior.
--skip-git-repo-check allows execution outside a Git repository. Use it only when the working directory is already explicit and controlled.
--output-schema points to a JSON Schema for the final response. --output-last-message writes the last agent message to a file.
Codex exec guide
The best fix is usually to run inside the intended repository. The skip flag is for deliberate non-Git automation, not a blanket trust setting.
Inspect the current OpenAI Codex exec source → Need project-doc settings? Build config.toml → Read the full Codex CLI technical guide →It streams Codex execution events to standard output as JSONL: one JSON object per line. This is useful for CI, logging, and event-driven automation.
Run Codex from the intended Git repository whenever possible. For a deliberate workflow outside Git, add --skip-git-repo-check and make the target directory unambiguous.
No. The flag only bypasses the Git-repository requirement. The sandbox and approval controls remain separate.
--output-schema constrains the final response shape. --output-last-message saves the final agent message. --json separately streams the full event sequence.
Automation without folklore
ResearchAudio turns changing AI tooling into practical, inspectable decisions for engineers and builders.