codex
Skill22 starsChanged 9 days agoMITView on GitHub
Deep-dive reference for delegating implementation work to the OpenAI Codex CLI. Covers exec mode, full-auto approval, git-repo requirement, output parsing, and batch workflows (worktree-parallel issue fixes, batch PR reviews).
- Reads credentials
135 other projects use a version of this.
Adopted by
Most recently taken up by
- holylight1979/AtomicMemory-ClaudeCodetheir own version, first seen Nov 8, 2026
- mxrsv/agents-skillstheir own version, first seen Nov 8, 2026
- hemal08ce094/DesignSkillsSwiftUItheir own version, first seen Nov 8, 2026
- choughton/feature-design-prompt-templatestheir own version, first seen Nov 8, 2026
- hurleywgly/skillstheir own version, first seen Nov 8, 2026
- puck-muling/peer-agenttheir own version, first seen Nov 8, 2026
Used with
Projects with it also use ios-sync, compare-screenshots and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Saqlain-811Skillios-sync
Regenerate the iOS debug bridge against the latest upstream gstack templates. (gstack)
Also in 6 projects that use this
transitive-bullshitSkillcompare-screenshots
Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.
Also in 5 projects that use this
dzhngSkillimplement-spec-with-codex
Run [implement-spec](../implement-spec/SKILL.md) with Codex doing the implementation passes while you orchestrate, integrate, and review. Use when the user asks to implement a spec with Codex, or to run implement-spec with Codex as the implementer.
Also in 4 projects that use this
Saqlain-811Skillios-clean
Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)
Also in 5 projects that use this
john-data-chenSkilltouchdesigner-mcp
Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.
Also in 7 projects that use this
math-incSkillminecraft-modpack-server
Set up a modded Minecraft server from a CurseForge/Modrinth server pack zip. Covers NeoForge/Forge install, Java version, JVM tuning, firewall, LAN config, backups, and launch scripts.
Also in 5 projects that use this
- +1 more from Saqlain-811
Other versions135 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 135
- NousResearch/hermes-agent★ 262ksame name
- garrytan/gstack★ 141ksame name
- dzhng/jevgrep★ 3.2ksame name
- ispc/ispc★ 3ksame name
- bergside/awesome-design-skills★ 2.9ksame name
- dataplat/dbatools★ 2.9ksame name
- Lilac-Labs/gini-agent★ 1.9ksame name
- Open-Curiosity/gini-agent★ 1.9ksame name
- dzhng/skills★ 1.5ksame name
- clice-io/clice★ 1.4ksame name
125 more not listed
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 repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dependency-analyzerSkill
- docsSkill
- handoffSkill
- openai-reviewerSkill
- plugin-homeSkill
- schema-validatorSkill
- security-auditSkill
- session-auditSkill
- test-validatorSkill
- claude-codeSkill
- opencodeSkill
- chartsSkill
- export-csvSkill
- export-excelSkill
- make-chartSkill
- make-html-reportSkill
- make-pdfSkill
- a2a-communicateSkill
- a2a-handle-inboundSkill
- codebase-inspectionSkill
- ethos-skill-authoringSkill
- native-mcpSkill
- github-authSkill
- github-code-reviewSkill
- github-issuesSkill
- github-pr-workflowSkill
- github-repo-managementSkill
- birth-ritualSkill
- get-to-know-youSkill
- xurlSkill
- arxivSkill
- grounded-citationsSkill
- research-paper-writingSkill
- reddit-researchSkill
- code-reviewSkill
- coding-agentSkill
- planSkill
- requesting-code-reviewSkill
- spikeSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- tddSkill
- writing-plansSkill
- no-ai-slopSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 111 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 58
If this fails, Codex will error out immediately.
- Distinctive: line 94
Use cheaper models for simpler tasks to control cost.
- Distinctive: line 193
Never use on a production branch: Always work in a feature branch or worktree.
- Distinctive: line 234
If any check fails, refuse the delegation and print the specific remediation step.
- Distinctive: line 258
Simple, well-scoped tasks: use a cheaper model to save cost.
- Distinctive: line 259
Complex logic or reasoning: use the strongest available model.
- Distinctive: line 260
User preference: if the user specifies a model, pass it through.
- Distinctive: line 261
No override: if no preference, let Codex use its default.
“Common” is measured: kept by at least 6 in 10 of the 111 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 — Deep-Dive Delegation Reference
Comprehensive reference for spawning and managing the OpenAI Codex CLI (codex) as a delegated coding agent under ethos process control.
When to use
- Fast iteration on smaller, well-scoped changes — Codex is optimized for speed over deliberation.
- Second opinion — when the user wants a different model family's perspective on a problem.
- Quick prototypes where turnaround matters more than deep codebase reasoning.
- Batch operations — Codex's
execmode is well-suited for parallelized workflows (multiple worktrees, multiple PRs).
Do not use for deep multi-file reasoning where the model needs to read and understand large portions of the codebase before acting. Claude Code is better suited for that. Also avoid for tasks requiring nuanced architectural decisions.
Hard rules
These are non-negotiable constraints of the Codex CLI:
PTY-mandatory
Codex expects a real terminal (PTY). Always spawn via process_start, which provides one. Running Codex via a bare exec() or piped subprocess will produce garbled output or hang.
Git repo requirement
Codex refuses to work outside a git repository. Before delegating, verify the target directory is inside a git repo:
git -C /path/to/project rev-parse --is-inside-work-treeIf this fails, Codex will error out immediately. Either initialize a git repo or choose a different delegation target.
exec mode for one-shots
codex exec "<task description>"exec runs the task and exits. This is the only invocation pattern for delegation from process_start. Do not use interactive mode — it cannot be driven programmatically.
--full-auto for unattended operation
codex exec "<task description>" --full-auto--full-auto auto-approves all operations (file writes, shell commands, etc.) without prompting. This is required for unattended delegations but must be used with care.
Invocation patterns
Minimal delegation
process_start({
command: 'codex exec "Add input validation to the createUser endpoint in src/api/users.ts" --full-auto',
name: 'delegated-codex-add-validation',
cwd: '/path/to/project'
})With model selection
codex exec "<task>" --full-auto --model o4-miniUse cheaper models for simpler tasks to control cost.
With working directory
cd /path/to/project && codex exec "<task>" --full-autoCodex does not have a --cwd flag — set the working directory via cd before invocation, or set cwd in the process_start call (which handles this).
Output parsing
Codex outputs plain text to stdout by default. There is no structured JSON mode.
Parsing strategy
1. Capture stdout from process_logs after the process exits.
2. The exit code is the primary success indicator:
- 0 = task completed successfully
- Non-zero = failure (stderr contains the error)
3. Parse stdout for the result summary — Codex typically outputs a description
of what it changed at the end.
4. For file-level change tracking, run `git diff --name-only` after completion
to see what Codex modified.Exit code interpretation
| Exit code | Meaning |
| 0 | Task completed |
| 1 | Task failed (general error) |
Non-zero + rate in stderr | Rate limited — wait and retry |
Non-zero + auth in stderr | Authentication failure — check OPENAI_API_KEY |
Cost discipline
Codex does not report cost in its output. Monitor token usage indirectly:
- Model selection — use
--modelto pick cheaper models for simpler tasks.o4-miniis significantly cheaper than the default for well-scoped changes. - Task scoping — smaller, more specific tasks use fewer tokens. "Fix the null check in processOrder" is cheaper than "review and fix all error handling".
- Process duration — longer runtime correlates with higher cost. Set a time-box in the orchestrator and kill the process if it exceeds it.
- Post-hoc tracking — check the OpenAI usage dashboard after batch operations to calibrate your cost estimates.
Batch workflows
Codex's fast exec mode makes it well-suited for parallelized batch operations.
Worktree-parallel issue fix
For a list of independent issues, create a git worktree per issue and run Codex in each:
For each issue in the batch:
1. Create a feature branch: git checkout -b fix/<issue-slug>
2. Create a worktree: git worktree add /tmp/worktree-<issue-slug> fix/<issue-slug>
3. Spawn:
process_start({
command: 'codex exec "Fix issue: <issue-title>. Details: <issue-body>" --full-auto',
name: 'delegated-codex-<issue-slug>',
cwd: '/tmp/worktree-<issue-slug>'
})
4. After completion, verify with: git -C /tmp/worktree-<issue-slug> diff
5. If the diff looks correct, commit and create a PR.
6. Clean up: git worktree remove /tmp/worktree-<issue-slug>This parallelizes naturally — each worktree is independent. Run up to 3-5 concurrent delegations depending on API rate limits.
Batch PR review
For a list of open PRs, run a review pass on each:
For each PR:
1. Fetch the diff: gh pr diff <pr-number>
2. Spawn:
process_start({
command: 'codex exec "Review this PR diff for bugs, security issues, and style violations:\n<diff>" --full-auto',
name: 'delegated-codex-review-pr-<pr-number>',
cwd: '/path/to/repo'
})
3. Capture the review output from process_logs.
4. Post the review as a PR comment.Note: this uses Codex as a coding worker, not as a code reviewer. The openai-reviewer skill in ethos uses Codex specifically for the review framing — keep the two roles separate. Use this batch pattern when you want a model to do work on each PR (e.g., apply fixes), not just comment.
Safety
--full-auto risk assessment
--full-auto is powerful but dangerous. It auto-approves:
- File writes and deletions
- Shell command execution
- Package installations
Mitigation rules:
- Never use on a production branch. Always work in a feature branch or worktree.
- Scope the task tightly. "Fix the null check in src/api/users.ts line 42" is safer than "fix all bugs".
- Review the diff after completion.
git diffbefore committing anything Codex produced. - Set a time-box. Kill the process if it runs longer than expected — runaway loops are expensive.
- Use worktrees for isolation. A worktree can be discarded entirely if the result is bad.
Pre-delegation safety checklist
- The target directory is a git repo (Codex requirement).
- The current branch is a feature branch, not main/master.
- There are no uncommitted changes that could be overwritten.
--full-autois intentional and the user has authorized unattended operation.- A time-box is set in the orchestrator.
Authentication
API key method
Set OPENAI_API_KEY in the environment before spawning:
export OPENAI_API_KEY=sk-...
codex exec "<task>" --full-autoLogin method
codex loginOpens a browser flow. After completion, Codex stores the session token locally.
Verification
which codex # installed?
codex --version # which version?
[ -n "$OPENAI_API_KEY" ] || codex auth status # authenticated?If any check fails, refuse the delegation and print the specific remediation step.
Error recovery
| Failure | Cause | Recovery |
| "not a git repository" | Codex ran outside a git repo | Ensure cwd points inside a git working tree |
| Rate limit error | API rate limit exceeded | Wait 60 seconds, retry. For batch workflows, reduce parallelism |
| Auth error | OPENAI_API_KEY invalid or expired | Re-set the key or re-run codex login |
| Process hangs | Waiting for interactive input | Ensure --full-auto is set; kill and retry |
| Garbled output | No PTY | Ensure invocation is via process_start (provides PTY) |
Recovery pattern: capture exit code + stderr, match against known patterns, retry up to 2 times for transient errors, surface to the user for permanent failures.
Model selection
Override the default model with --model:
codex exec "<task>" --model o4-mini # cheaper, faster
codex exec "<task>" --model o3 # stronger reasoningGuidelines:
- Simple, well-scoped tasks: use a cheaper model to save cost.
- Complex logic or reasoning: use the strongest available model.
- User preference: if the user specifies a model, pass it through.
- No override: if no preference, let Codex use its default.
Adapted from NousResearch/hermes-agent (MIT)
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.

