Usage
codex exec --json as a subprocess and parses JSONL output line-by-line.
codaph exec uses the CodexExecAdapter from src/lib/adapter-codex-exec.ts for event capture.Arguments
The prompt to send to Codex.
Options
Working directory for the Codex session. Defaults to current directory.
Codex model to use. Defaults to Codex’s default model.
Resume an existing Codex thread instead of starting a new one.
Enable Mubit cloud sync (default: auto-enabled if MUBIT_API_KEY is set).
Disable Mubit cloud sync even if API key is configured.
Examples
Basic usage
Specify working directory
Use specific model
Resume existing thread
Local-only capture (no Mubit)
How It Works
Event Sources
Events captured viacodaph exec have source type:
codex_sdk(captured viacodaph run)codex_history(imported viacodaph push)
Differences from codaph run
| Feature | codaph exec | codaph run |
|---|---|---|
| Adapter | CodexExecAdapter | CodexSdkAdapter |
| Method | JSON output parsing | SDK streaming |
| Events | Parse JSONL output | Live event stream |
| Source | codex_exec | codex_sdk |
| Use case | Batch, scripted | Interactive, live |
| Output | Codex stdout/stderr | SDK events |
codaph exec is better for scripted workflows where you want to parse Codex’s JSON output directly.JSON Output Format
Codex exec outputs JSONL (JSON Lines):CapturedEventEnvelope format.
Troubleshooting
Command not found: codex
Command not found: codex
Cause: Codex SDK not installed or not in PATHSolution:
Invalid JSON output from Codex
Invalid JSON output from Codex
Cause: Codex not outputting JSON or mixing JSON with textSolution:
Ensure If not outputting JSON, update Codex SDK.
--json flag is working:Events missing from mirror
Events missing from mirror
Cause: Parse errors or incomplete JSONL outputSolution:
Subprocess hangs or times out
Subprocess hangs or times out
Cause: Codex subprocess waiting for input or crashedSolution:
When to Use
- Use codaph exec when...
- Use codaph run when...
- Running Codex in automated scripts
- Need to parse Codex JSON output
- Batch processing multiple prompts
- CI/CD pipelines
- Want deterministic JSON parsing
See Also
codaph run
Alternative capture using SDK streaming
Direct Capture Guide
Detailed guide on direct capture methods
Codex Exec Adapter
Exec adapter implementation details
Architecture
How adapters fit into the data flow