# Common — codex transport - `cwd: ` is MANDATORY (agent won't launch without it). - Task in `=== TASK FOR CODEX ===` / `=== END TASK ===` (wrapper forwards only this block). - `codex options:` line passed verbatim to `scripts/codex-run.sh` after mode; saved to `$JOB/codex-flags` (NUL-delimited) and re-applied on `resume` so permissions survive retries. - Overrides: `-m ` (e.g. ``), `-c model_reasoning_effort=""` (per-model, run `scripts/codex-models.sh` to list), `-s read-only|workspace-write|danger-full-access`, `--dangerously-bypass-approvals-and-sandbox` (global, hoisted before `exec`), `--add-dir `, `-c key=value`. Never `--ephemeral`. - Codex has shell+apply_patch always, browser_use stable. MCP via `codex mcp list` if needed. - Wait-loop: agent polls `$JOB/status` with short 60s foreground calls, streams `tail -5 $JOB/events.jsonl` via `SendMessage` (to: main) without ending turn; final answer + `thread_id` only in last message. - Resume: on `stalled`/`error` or orchestrator SendMessage, write new `$JOB/prompt.md` and `codex-run.sh $JOB resume $(cat $JOB/thread_id)` with saved flags.