Launch OpenAI Codex CLI as a subagent (ChatGPT subscription auth, no API key). Use when delegating a self-contained coding task to Codex from another agent — parallel implementation work, a second opinion, or an independent verification pass.
75
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No known issues
Codex CLI is OpenAI's terminal coding agent. codex exec runs it non-interactively:
it works autonomously in a sandbox, streams progress to stderr, and prints only the
final message to stdout. Auth reuses the user's ChatGPT subscription — never an API key.
Do NOT delegate tasks that need conversation context you can't fully write into the prompt.
codex --version # missing? npm i -g @openai/codex (or: brew install --cask codex)
codex login status # exit 0 + "Logged in using ChatGPT" = readyNot logged in → stop and tell the user to run codex login (one-time browser OAuth).
Never read, print, or copy credentials (~/.codex/auth.json).
OUT=$(mktemp /tmp/codex-out.XXXXXX)
codex exec \
--cd /path/to/repo \
--model gpt-5.6-sol \
--config model_reasoning_effort=high \
--sandbox workspace-write \
--output-last-message "$OUT" \
"Full task prompt: goal, constraints, files to touch, definition of done." \
</dev/nullgpt-5.6-sol). Default reasoning effort to high.
Pass both flags explicitly on every new Codex run.</dev/null is MANDATORY when stdin is not a real terminal (background shells,
scripts): codex treats open stdin as extra context and waits forever for EOF.codex exec [flags] - < /tmp/task.md.--json for JSONL event stream.cat "$OUT" # final message = the deliverable
git -C /path/to/repo status --short # see what Codex actually changedFollow-up in the same session (run from the same cwd — resume filters by cwd):
codex exec resume --last "follow-up instruction" </dev/nullParallelize only genuinely independent tasks, and assign file ownership upfront so results merge cleanly. One git worktree per Codex run — never two in the same tree:
git worktree add /tmp/wt-taskA -b codex/task-a
codex exec --cd /tmp/wt-taskA --model gpt-5.6-sol \
--config model_reasoning_effort=high --sandbox workspace-write \
-o /tmp/outA.md "task A" </dev/null</dev/null.codex login status non-zero → the user must run codex login. Don't work around it.--skip-git-repo-check, or init a repo first.-c sandbox_workspace_write.network_access=true.--dangerously-bypass-approvals-and-sandbox.For auto-routing and /codex invocation inside Cursor, add ~/.cursor/agents/codex.md —
a custom subagent whose description is "delegates coding tasks to Codex CLI" and whose
body points at this skill.
66860fb
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.