execute — OpenAI Codex CLI¶
Run a prepared Codex kit through central policy, worker verification, and Astra acceptance.
- Source: codex/skills/execute/SKILL.md
- Also available on: Claude Code, GitHub Copilot CLI
In practice¶
What it does¶
Executes a prepared kit task by task through central policy, enforces dependencies, independently reviews each completed phase with Sol, and reserves Astra for coordination, evidence-gated recovery, and final acceptance.
When to reach for it¶
- Use it after architect creates a kit with runnable verification commands.
- Use it to resume work while preserving attempts, actual-use evidence, review reports, and acceptance state.
- Not for freehand model dispatch or bypassing an unmet task dependency.
Worked example¶
python3 bin/codex_execute.py status --kit tasks/kits/<slug>
python3 bin/codex_execute.py run --kit tasks/kits/<slug> --task <id>
python3 bin/codex_execute.py review --kit tasks/kits/<slug> --phase 1
python3 bin/codex_execute.py accept --kit tasks/kits/<slug> --phase 1
Worker completion and final acceptance are distinct states. A phase remains acceptance-pending until a fresh independent review succeeds and Astra records an explicit decision.
Failure modes & fallbacks¶
Missing verification fails before dispatch. Failed dispatch never becomes success merely because a check passes. A stale review is invalidated by changes to the phase, plan, task attempts, Git head, or workspace. Runtime model mismatch is a policy violation and cannot unlock recovery.
Cost & safety¶
Preview and status are read-only. Review and acceptance use read-only sandboxes; implementation uses the normal workspace sandbox. Records keep planned pins, dispatched roles, and runtime-attested actual use separate. Unknown remains honest when the runtime supplies no trustworthy attestation.
Related¶
- architect creates the kit contract.
- escalate describes the bounded worker and recovery ladder.
- doctor diagnoses installation and policy state.
The skill card — what the model reads¶
This is the SKILL.md body the model reads, transformed for this page: the source's own leading title, if it had one, is removed; every remaining heading is demoted one level to nest under this section; and relative links are rewritten to site or GitHub URLs. ${CLAUDE_PLUGIN_ROOT} and {{POLYTROPOS_ROOT}} are install-time path variables, left intact exactly as the model sees them. The unmodified original is codex/skills/execute/SKILL.md.
Resolve POLYTROPOS_ROOT from this skill's location. In a managed copy use POLYTROPOS_ROOT="{{POLYTROPOS_ROOT}}"; reject the literal placeholder. Confirm pricing data, bin/codex_policy.py, and bin/codex_execute.py exist. Otherwise stop and use python3 bin/harness_select.py doctor --harness codex.
Read the kit's PLAN.md, TASKS.md, and guardrails. The only task states are pending | in-progress | done | blocked. Use the central driver; do not replace it with a freehand dispatch loop or select workers from prose.
Start with read-only previews:
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" status --kit tasks/kits/<slug> --json
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" run --kit tasks/kits/<slug> --task <id> --dry-run
A real run spends subscription usage or API funds, so obtain authority before it. When interactive delegation is available, kit-implementer, kit-verifier, and phase-reviewer provide separate roles; plugin installation does not install them. The headless driver remains the functional fallback. Dispatch implementation, independent review, and final acceptance through the driver:
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" run --kit tasks/kits/<slug> --task <id>
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" review --kit tasks/kits/<slug> --phase <N>
python3 "$POLYTROPOS_ROOT/bin/codex_execute.py" accept --kit tasks/kits/<slug> --phase <N>
The driver uses workers for ordinary work and reserves Astra for final acceptance or a bounded correction; that is the reserved routing policy and the default. A kit that declares routing: policy=adaptive in PLAN.md, or a run passed --policy adaptive, may dispatch a hard task straight to an eligible capable model without a failed cheaper attempt; the run's - routing: note line and --dry-run say which policy was in force. It creates no warm pool. Recovery needs recorded lower-tier attempts and a real nonzero verification result, unresolved integration conflict, or failed lower-tier correction. Rerun verification independently before acceptance. Treat planned, dispatched, and observed model-role records as different facts, leaving unavailable observations unknown.
Optional context travel¶
When an explicit repository/kit/assignment and authorized startup config are supplied, use the native context-travel skill and read {{POLYTROPOS_ROOT}}/docs/CONTEXT-TRAVEL-SURFACES.md on demand for a bounded task brief. Treat missing, stale, partial, or refused context as advisory; retain this workflow's authoritative sources, policy, pricing, permission, and mandatory verification rules. If no authorized context transport is available, continue this workflow and report context unavailable.