# Codex Subagent

Launch OpenAI Codex CLI as a subagent (ChatGPT subscription auth, no API key).

- Repository: https://github.com/davidondrej/skills (4238 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add davidondrej/skills --skill codex-subagent -g -a claude-code -y`
Codex: `npx skills add davidondrej/skills --skill codex-subagent -g -a codex -y`
Cursor: `npx skills add davidondrej/skills --skill codex-subagent -g -a cursor -y`
Gemini CLI: `npx skills add davidondrej/skills --skill codex-subagent -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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

```bash
codex --version       # missing? npm i -g @openai/codex  (or: brew install --cask codex)
codex login status    # exit 0 + "Logged in using ChatGPT" = ready
```

Not 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

```bash
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/null
```

The rest: https://github.com/davidondrej/skills/blob/HEAD/skills/agent-orchestration/codex-subagent/SKILL.md
