codex-delegate
Delegate a coding task to the OpenAI Codex CLI as a background implementer, then review its diff and land it yourself. Use this whenever the user wants to hand implementation work to Codex — phrasings like "have Codex do X", "delegate this to Codex", "run it through Codex", or "use Codex to implement/fix/refactor" — or wants to run a queue of coding tasks through Codex while staying the reviewer. Prefer it over a one-shot Codex forwarder (such as the codex-rescue agent) specifically when the user will review the resulting diff and commit it themselves, or wants the full brief → dispatch → review → commit loop across a single task or a queue. Also reach for it proactively for a separate implementation pass on a bounded, well-specified task (an implementation sweep, a migration, a mechanical refactor, parallel work). Covers writing the Codex brief, dispatching it via the bundled relay.mjs helper, waiting for completion, reviewing the result, and committing. DO NOT USE for tasks small enough to do inline, or when the user wants the code written directly without delegating.
NPX Install
npx skill4agent add amelnagdy/delegate-skills codex-delegateTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Codex Delegate
When NOT to use this
- The task is small enough to just do inline — delegation overhead is not worth it.
- The CLI is not installed or not authenticated (run
codex).codex login - You want to write the code yourself, or you only need a review (use Codex's own command).
review
Prerequisites (check once)
- succeeds. If not, install (
codex --version) andnpm i -g @openai/codex.codex login - Confirm which is on PATH. Multiple installs are common (e.g. a current npm/nvm copy and a stale Homebrew one).
codexshows the active one andcommand -v codexits version — an old binary predates flags this skill relies on (codex --version,codex exec --json,-o). The relay also records the version it ran intoexec resume, so a stale binary is visible after the fact.result.json - You are in (or will point at) the target git repository.
--cd
The loop
1. Write the brief
2. Dispatch
codex execresult.json<skill-dir>SKILL.mdfind ~ -name relay.mjs -path '*codex-delegate*'node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
# read-only (review/diagnosis, no edits): add --read-only
# continue the previous Codex session: add --resume-last (send only the delta brief)
# see all options: node .../relay.mjs --helpworkspace-writeresult.json3. Wait for completion
- Claude Code: run the Bash call with ; you are notified on completion.
run_in_background: true - Plain shell / other agents: run it in the foreground for short tasks, or background it and poll
the result file — in bash/zsh (including Git Bash/WSL), or your shell's equivalent (
… &in PowerShell,Start-Jobin cmd). The run is done whenstart /bexists with aresult.json. (A pre-run usage error — bad args or an empty brief — instead exits with code 2 and a stderr message and writes no result file, so check the exit code too. A missingstatusbinary exits 127 but does write acodexwith statusresult.json.)codex_unavailable
result.json4. Review — do not trust the self-report
result.json- Re-run the project's gates yourself (the test/lint/build commands from step 1). Never take "gates passed" on faith.
- Read the diff against the brief: did Codex do what was asked, nothing more (scope creep) and
nothing less? in the result is your starting point.
touchedFiles - Run the relevant guard skills on the diff if you have them installed (clean-code-guard,
test-guard, etc. from ) — this skill produces the work; those skills judge it.
guard-skills - For schema/migration changes, round-trip them; for removals, grep for dangling references.
5. Land it
.git- Commit the verified work yourself, with a clear message.
- If it needs changes, send a delta brief with (don't restate the whole task) and review again.
--resume-last
Non-negotiables
- Re-run the gates yourself. The self-report is a claim, not evidence.
- The orchestrator commits, never Codex. Don't assume Codex committed; it didn't.
- One task = one brief = one commit. Split unrelated work into separate runs.
- Trust the working tree and process state over any progress tracker.
Authorization model
Trust and safety
scripts/relay.mjscodexgitcodexReferences
- references/writing-the-brief.md — how to write a brief Codex can execute blind: structure, XML blocks, the report contract, embedding the real gate commands.
- references/dispatch-and-poll.md — flags, the
relay.mjscontract, backgrounding per orchestrator, and recovery when a run misbehaves.result.json - references/review-and-land.md — the review checklist, the commit
boundary, and the rework cycle via .
--resume-last - references/multi-task-queues.md — running a sequential queue: carrying constraints forward, progress tracking, and the end-of-run coherence check.
What this skill does NOT do
- It does not commit for you — that is deliberate (step 5).
- It does not review the code's quality itself — pair it with guard skills.
- It does not run your tests — you re-run the project's own gates in step 4.
- It is not the inverse direction (Codex reviewing your work). For that, use the openai-codex plugin's review command or stop-review gate.