From cli-delegation
Call the OpenAI Codex CLI (`codex exec`) non-interactively to get a second opinion, run a code review, or delegate read-only or edit-capable work to an independent Codex run. Use for Codex CLI subagent-style delegation, long-running worker runs, worktree-isolated edits, machine-readable JSONL output, resume flows, and harness gotchas around stdin and sandboxing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cli-delegation:delegate-to-codexThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run `codex exec` non-interactively for a second opinion, review, or a delegated
Run codex exec non-interactively for a second opinion, review, or a delegated
edit worker. Model default: gpt-5.6-sol at -c model_reasoning_effort='"high"'
(medium/low only for small or mechanical work).
Isolate. Read-only work runs in the current checkout with -s read-only:
slug="codex-$(date +%Y%m%d-%H%M%S)"
run_dir="/tmp/codex-$slug"; mkdir -p "$run_dir"
Edit work gets its own worktree instead, so the diff is easy to inspect or discard:
slug="codex-$(date +%Y%m%d-%H%M%S)"
worktree="../$(basename "$PWD")-$slug"
git worktree add -b "agent/codex/$slug" "$worktree" HEAD
run_dir="$worktree/.agent-runs/$slug"; mkdir -p "$run_dir"
Write the brief to $run_dir/prompt.md.
Include context, exact task, constraints, verification commands, output
contract — and a hard completion criterion: GPT-5.6 Sol is exploratory
and keeps widening scope without an unambiguous definition of "done".
Launch. Always feed the prompt from the file with - < prompt.md; never
pass it as a bare argument under a harness (see Gotchas: stdin wedge).
Read-only reviewer / second opinion:
codex exec -C "$PWD" \
-m gpt-5.6-sol -c model_reasoning_effort='"high"' \
-s read-only --json -o "$run_dir/final.md" \
- < "$run_dir/prompt.md" > "$run_dir/events.jsonl"
Edit worker — same command with -C "$worktree" and
--sandbox workspace-write instead of -s read-only.
Research briefs that need current information: add -c tools.web_search=true.
Harvest. Final answer in $run_dir/final.md; session id in the
thread.started event in $run_dir/events.jsonl. For edit work also:
diff via git -C "$worktree" diff — harvest from the working tree, not
branch history, since the worker's commits may be missing (see Gotchas) —
and run a fresh read-only reviewer over the diff before merging.
codex binary or stale auth surfaces mid-run as an abort — or
a hang indistinguishable from the stdin wedge. Preflight codex --version
and auth (codex login, ChatGPT auth, or a scoped
CODEX_API_KEY/OPENAI_API_KEY) before long runs.codex exec reads piped stdin whenever you pass -, no
prompt, or a prompt argument — and under a harness stdin never closes, so it
wedges at startup (0% CPU, no output). Use - < prompt.md, or add
< /dev/null to any argument form. Never codex exec "$(cat prompt.md)" bare..git/worktrees/<name>, so git commit/git merge fail even
with workspace-write. The orchestrator runs all git commands; workers only
edit and resolve content. Commit-shaped deliverable: brief the worker "commit;
if commit fails, produce a git bundle" and fetch from the bundle.codex exec review --base <ref> recurses on 0.144.1 — re-execs itself endlessly, emits
no findings, leaves stray processes. Review with plain codex exec -s read-only and a "review the diff between and HEAD" prompt instead.codex exec resume rejects the exec flags (-C -m -c -s --json -o, exit
2), so resumed turns run on config defaults. Prefer a fresh self-contained run
that embeds the prior finding; if you must resume:
codex exec resume --last "..." < /dev/null.~/.codex/config.toml aborts the whole run. Pass
--ignore-user-config (auth still resolves via CODEX_HOME) and re-specify
-m/-c on the CLI.-s read-only is a hard filesystem boundary — commands that write caches or
build artifacts fail under it.-p selects a config profile, not an agent persona; custom subagents are TOML
files under .codex/agents/ or ~/.codex/agents/.codex apply applies the latest agent diff to the current tree — check
pwd and branch first..env.local), never secret directories. If the worker needs uncommitted
local changes, apply an explicit patch in the worktree — never checkpoint
unrelated user WIP with git add -A.-a/--ask-for-approval is rejected.--search flag on codex exec — use -c tools.web_search=true.--ephemeral runs.--dangerously-bypass-approvals-and-sandbox only inside a bounded
container/VM/CI runner — a worktree is not a security sandbox.Evidence and full mechanics behind each gotcha: reference/gotchas.md.
npx claudepluginhub t0msilver/skillsGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Synthesizes the current conversation into a structured spec (PRD) and publishes it to the project issue tracker with a ready-for-agent label, without interviewing the user.