Skills

Codex CLI Sub-Agent

Runs Codex CLI as a non-interactive coding sub-agent for delegated tasks and reviews.

Install

npx skills add kortix-ai/suna --skill codex-cli -g -a claude-code -y
Repository
kortix-ai/suna20.3k
Category
AI and agents
Updated
3d ago
License
See repository
Context cost
Lightabout 1,427 tokens
Runs scripts
No, instructions only

What it does

Drive OpenAI's Codex CLI (`codex exec`) as a non-interactive coding sub-agent from inside Claude Code. Load WHENEVER you want to delegate a coding/analysis/refactor task to Codex, get a second opinion / adversarial review from another model, fan out parallel agents across files or worktrees, or run a long mechanical job while you stay the planner. Covers the exact `codex exec` flags, sandbox tiers, output capture, JSON/schema modes, session resume, parallel fan-out, and the mandatory "delegate → capture → independently verify, never trust the self-report" supervision loop.

<skill name="codex-cli"> <overview> Codex CLI is OpenAI's terminal coding agent (Rust). Its **non-interactive** mode, `codex exec`, makes it a perfect disposable sub-agent: you write the metaprompt, Codex explores/edits/runs commands on its own, and returns a final message you capture and verify. You stay the long-context planner; Codex is the implementer.

The golden rule: Codex's self-report is a claim, not the truth. Always capture its output, then independently verify the artifacts yourself (read the files, re-run the tests) before treating the task as done.

Verified available on this machine: codex-cli 0.137.0, logged in via ChatGPT (no API key needed). Confirm with codex login status. </overview>

<the-core-command> The one shape you'll use most:
codex exec \
  --cd <workdir> \
  --sandbox <read-only|workspace-write|danger-full-access> \
  -o /tmp/codex_<rand>.txt \
  "your metaprompt here"  2>>/tmp/codex_<rand>.log
  • Prompt as the final arg, OR pipe via stdin: echo "$PROMPT" | codex exec - (good for long/generated prompts). If both are given, stdin is appended.
  • -o, --output-last-message <file>, writes ONLY Codex's final message to a file. This is your clean capture; read it back, don't scrape the TUI stream.
  • 2>>/tmp/...log, Codex streams progress/reasoning to stderr; the final message goes to stdout. Redirect stderr to a log so it doesn't bloat your context. Generate the suffix with openssl rand -hex 4.
  • --cd <dir>, Codex's working root. Scope it to the relevant subdir (e.g. apps/api), not the whole monorepo, so it stays focused.
  • --skip-git-repo-check, only needed when running outside a git repo. </the-core-command>
<sandbox-tiers> Pick the **least** privilege that lets the task succeed:
Read the whole SKILL.md on GitHub

More in AI and agents