codex-subagent
Skill11 starsChanged 4 months agoMITView on GitHub
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.
- Installs packages
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Do NOT delegate tasks that need conversation context you can't fully write into the prompt.
- Very specific: line 28
Not logged in → stop and tell the user to run codex login (one-time browser OAuth).
- Very specific: line 29
Never read, print, or copy credentials (~/.codex/auth.json).
- Distinctive: line 61
Follow-up in the same session (run from the same cwd — resume filters by cwd):
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codex CLI as a Subagent
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.
When to delegate
- Self-contained coding task with clear success criteria (fix, feature, refactor, review).
- Parallel work: several independent tasks at once (see Parallel runs).
- Second opinion / independent verification of your own changes.
Do NOT delegate tasks that need conversation context you can't fully write into the prompt.
Preflight
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).
Launch
OUT=$(mktemp /tmp/codex-out.XXXXXX)
codex exec \
--cd /path/to/repo \
--sandbox workspace-write \
--output-last-message "$OUT" \
"Full task prompt: goal, constraints, files to touch, definition of done." \
</dev/null</dev/nullis MANDATORY when stdin is not a real terminal (background shells, scripts): codex treats open stdin as extra context and waits forever for EOF.- Codex sees NOTHING of your conversation. Put all context in the prompt: goal, relevant paths, constraints, and how to verify it's done.
- Long prompt? Pipe it via stdin instead:
codex exec [flags] - < /tmp/task.md. - Wrap the command in a background/Bash subagent if your host agent has one (Cursor: Task tool with a shell subagent) so Codex's verbose stream stays out of the parent context. Fallback: a plain background terminal.
- Runs take minutes and have no built-in timeout — background it and monitor.
- Optional:
-m <model>to override the model,--jsonfor JSONL event stream.
Collect results
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/nullParallel runs
Parallelize 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 --sandbox workspace-write -o /tmp/outA.md "task A" </dev/nullFailure modes
- Hangs forever with no output → stdin was left open. Kill it, relaunch with
</dev/null. codex login statusnon-zero → the user must runcodex login. Don't work around it.- ChatGPT plan rate limit hit → report to the user; never retry in a loop.
- "Not a git repo" error → add
--skip-git-repo-check, or init a repo first. - Network is blocked inside the workspace-write sandbox by default. If the task
needs it (installs, API calls):
-c sandbox_workspace_write.network_access=true. - NEVER use
--dangerously-bypass-approvals-and-sandbox.
Rules
- One task per launch. Split big jobs into multiple launches.
- Review Codex's diff yourself before declaring the task done.
Cursor-native wrapper (optional)
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.
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- davidondrej/skills★ 4.2k90% same
Wrote their own version · 6
- Alexin09/cc-subagent-codex★ 17same name
- dwgx/claude-codex-subagent★ 4same name
- localSummer/skills★ 4same name
- sagy101/DotSkills★ 4same name
- beeltec/skills★ 2same name
- sadiksaifi/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- agent-self-schedulingSkill
- cmuxSkill
- fable-safe-promptSkill
- goal-loopSkill
- handoffSkill
- markdown-renderingSkill
- run-deep-sweSkill
- anti-sleepSkill
- pi-custom-modelSkill
- setup-helpSkill
- browser-harnessSkill
- deepapiSkill
- deep-researchSkill
- pi-web-searchSkill
- research-promptSkill
- youtube-transcriptSkill
- distribute-skill-to-all-agentsSkill
- effective-agent-skillsSkill
- folder-specific-claude-and-agents-mdSkill
- push-skill-to-githubSkill
- brain-to-docsSkill
- grill-meSkill
- interview-style-doc-buildingSkill
- read-all-adrsSkill
- shortSkill
- teachSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

