Index of every page on this site: llms.txt
All skills
Run it yourself

Use when you want to delegate work to the OpenAI Codex CLI (GPT-5.x) as an autonomous subagent — offloading a coding/research/review task, getting a second-opinion model, or fanning out parallel work to Codex instead of (or alongside) Claude subagents.

Use this Skill: https://skilld.dev/gh/ferriskleier/skills/use-codex

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈66 tokens for metadata: the name and description. ≈1.2k when used: this file.

Description uses 3.3% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈264 characters, or 3.3%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

use-codex

Overview

codex is the OpenAI Codex CLI (an agentic coding tool like Claude Code, but GPT-backed). You can shell out to it with Bash to hand a whole task to Codex and let it work autonomously, then read back its result. Use this to offload work, get a different model's take, or run a flock of Codex agents in parallel.

Core principle: codex exec is the non-interactive entrypoint. Give it a self-contained prompt, run it unattended, capture the final message from a file. One codex exec call = one autonomous agent.

Before launching: ask model + effort

If the user did NOT specify, ask them which model and which reasoning effort before running. Do not silently pick.

  • Effort values: minimal | low | medium | high. High = slowest/smartest.
  • Model: e.g. gpt-5.6-sol. If unsure of available names, the config defaults live in ~/.codex/config.toml (grep -i model ~/.codex/config.toml); offer that default. Always pass --model explicitly — the model misreports its own name, so never rely on self-report and never assume the config default is what the user wants.

The autonomous invocation (copy this)

codex exec \
  --model gpt-5.6-sol \
  -c model_reasoning_effort=high \
  --sandbox workspace-write \
  --cd /path/to/worktree \
  --skip-git-repo-check \
  -o /tmp/codex-result.txt \
  "Self-contained task prompt. State the goal, constraints, and what 'done' looks like." \
  < /dev/null
# then read the result:
cat /tmp/codex-result.txt
  • < /dev/null — prevents Codex blocking on stdin ("Reading additional input from stdin").
  • -o FILE (--output-last-message) — writes ONLY the agent's final message; read this instead of scraping the transcript.
  • --sandbox workspace-write — lets Codex edit files under its workdir + /tmp. Use read-only for research/review-only tasks.
  • approval: never is automatic under codex exec; it won't stop to ask. Long tasks may run minutes — set a generous Bash timeout (180000+).

Quick reference

Need Flag
Pick model --model <name> / -m
Reasoning effort -c model_reasoning_effort=high
Working dir (worktree) --cd <dir> / -C
Read-only (no edits) --sandbox read-only
Capture final message -o <file>
Structured output --output-schema <schema.json> (final msg is JSON matching it)
Stream progress events --json (JSONL to stdout)
Extra writable dir --add-dir <dir>
Run outside git repo --skip-git-repo-check
Code review of a diff codex exec review --base <branch> (or --uncommitted / --commit <sha>)

Structured output (for verifier / decision agents)

When you need a machine-readable verdict (e.g. pass/fail), pass a JSON Schema; the final message is validated JSON:

echo '{"type":"object","properties":{"pass":{"type":"boolean"},"reason":{"type":"string"}},"required":["pass","reason"],"additionalProperties":false}' > /tmp/verdict.json
codex exec --model gpt-5.6-sol -c model_reasoning_effort=high --sandbox read-only \
  --output-schema /tmp/verdict.json -o /tmp/verdict.txt \
  "Does the current diff satisfy: <criteria>? Return pass + reason." < /dev/null

Fanning out (flock over Codex)

To run tickets/tasks in parallel through Codex, give each its own git worktree and point --cd at it — no branch collisions. Each codex exec is one background Bash call. This is the same shape as the flock-agents skill, but the per-ticket implementation agent is a codex exec call instead of a Claude subagent. Prefer running each as a background Bash job; poll their result files. Keep concurrency modest (Codex hits its own rate limits).

Common mistakes

  • Blocking on stdin — always append < /dev/null (or pipe the real stdin you intend).
  • Scraping the transcript for the answer — use -o FILE; it isolates the final message.
  • Trusting the model's self-reported name — it said "GPT-5" when run as gpt-5.6-sol. Set --model explicitly and trust that.
  • Wrong sandbox — read-only can't write files (research/review); workspace-write is needed to implement. Don't use danger-full-access / --dangerously-bypass-* unless the environment is externally sandboxed.
  • Too-short Bash timeout — high-effort runs take minutes; raise the timeout and/or run in background.
  • Vague prompt — Codex won't ask follow-ups under exec. The prompt must be fully self-contained: goal, constraints, definition of done.
  • Skipping the model/effort question — if the user didn't specify, ask first.

Verify it's usable

codex login status (should say logged in). If which codex fails, Codex isn't installed — stop and tell the user.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    The skill provides instructions for delegating coding and research tasks to the OpenAI Codex CLI as an autonomous subagent. It encourages security best practices such as sandboxing and explicit user confirmation for model selection.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 0fd50f1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 4 months ago
optimized for
Claude Code

README badge

README badge for ferriskleier/skills/use-codex