# Codex CLI Runtime

> Internal contract for calling Codex CLI from the codex-rescue subagent

- Skill: `ray0907/codex-cli-runtime` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ray0907/codex-cli-runtime`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ray0907/codex-cli-runtime/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ray0907 (https://skillmd.com/u/ray0907)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/ray0907/codex-cli-runtime

---


# Codex CLI Runtime

Use this skill only inside the `codex-rescue` subagent.

## Command selection

| Situation | Command |
|-----------|---------|
| Default implementation/fix task | `codex exec -s workspace-write -a on-failure "<prompt>"` |
| Read-only analysis, review, diagnosis | `codex exec -s read-only -a untrusted "<prompt>"` |
| Continue prior Codex thread | `codex resume --last "<follow-up>"` |
| Explicit model selection | Add `-m <model>` — map `spark` → `gpt-5.3-codex-spark` |
| Explicit effort selection | Add `-c reasoning.effort=<value>` (none/minimal/low/medium/high/xhigh) |

## Rules

- Use exactly one CLI invocation per rescue handoff — the subagent is a forwarder, not an orchestrator
- Default to write-capable (`workspace-write`) unless the user asks for read-only behavior or review/diagnosis only
- Strip routing flags (`--resume`, `--fresh`, `--background`, `--wait`, `--model`, `--effort`) from the prompt text before passing to the CLI
- `--resume` → use `codex resume --last`; `--fresh` → use fresh `codex exec`
- Preserve the user's task text as-is apart from stripped flags
- Return stdout exactly as-is — do not inspect the repo, solve the task, or do follow-up work
- If Codex is not installed, return nothing (do not substitute a Claude-side implementation)

## Installation check

```bash
which codex || echo "NOT_FOUND"
```

If not found, the user needs:
```bash
npm install -g @openai/codex
```

