Get the FREE Ultimate OpenClaw Setup Guide →

codex

Scanned
npx machina-cli add skill addsalt1t/evoca/codex --openclaw
Files (1)
SKILL.md
3.9 KB

Codex CLI Skill

Models

ModelIDUse When
Defaultgpt-5.3-codexAccuracy & depth: complex refactoring, architecture, multi-file changes, debugging
Sub (Spark)gpt-5.3-codex-sparkSpeed & iteration: quick fixes, simple reviews, formatting, single-file edits, rapid prototyping

Running a Task

  1. Read defaults: Read defaults.json (in skill base directory) using Read tool.

    • Defaults exist → proceed. Print: [Codex] model: <MODEL> | reasoning: <LEVEL> | sandbox: <MODE> | background: <BOOL>
    • Missing/invalid → ask user via AskUserQuestion.
  2. Select model (in priority order):

    • Explicit model name in user message → use exactly as given.
    • Spark keyword ("spark", "fast", "quick") → use sub_model.
    • Auto-select: model for complex tasks, sub_model for simple tasks.
    • No signal → use model.
  3. Assemble command:

    codex exec [PROMPT] -m <MODEL> -c model_reasoning_effort="<LEVEL>" -s <SANDBOX> -o /tmp/codex_output.md 2>/tmp/codex_stderr.log
    
    • Sandbox: analysis → -s read-only. editing → -s workspace-write. danger-full-access requires user confirmation.
    • CRITICAL: -c requires full key=value syntax. Never -c xhigh.
    • -i <FILE> and -o <FILE> must come after [PROMPT].
  4. Execute:

    • Background (default): run_in_background: trueTaskOutput block: false (startup check) → TaskOutput block: true.
    • Foreground: timeout: 300000.
    • On error: Read /tmp/codex_stderr.log for diagnosis.
  5. Read results: Read /tmp/codex_output.md (final message only). If more detail is needed → read /tmp/codex_stderr.log.

  6. Summarize outcome. Inform user they can continue with "codex resume".

Changing Defaults

When user says "codex config", "change codex settings", or "change codex defaults":

  1. Show current defaults.json.
  2. Ask via AskUserQuestion which settings to change.
  3. Write updated values to defaults.json in skill base directory.

Error Handling

  • Non-zero exit: stop and report, ask before retrying.
  • Before -s danger-full-access: confirm with user via AskUserQuestion.

/codex-review Command

Uses native codex exec review. Only triggered when user explicitly types /codex-review. Does not support -o or -s.

Usage

/codex-review                     → current branch vs base
/codex-review <SHA>               → specific commit
/codex-review --base main         → against main branch
/codex-review --uncommitted       → all local changes

Flow

  1. Read defaults. Print: [Codex Review] model: <MODEL> | reasoning: <LEVEL>
  2. Select model: sub_model (spark) by default. model only if user requests deep review.
  3. Assemble: codex exec review [OPTIONS] -m <MODEL> -c model_reasoning_effort="<LEVEL>" 2>/tmp/codex_stderr.log
    • --commit <SHA> cannot be combined with [PROMPT].
  4. Execute: Same as main skill.
  5. Read results via Bash: tail -n 50 /tmp/codex_stderr.log. If cut off, increase to -n 100 or more.
  6. Summarize findings. Inform user they can continue with "codex resume".

References

Source

git clone https://github.com/addsalt1t/evoca/blob/main/plugins/codex/skills/codex/SKILL.mdView on GitHub

Overview

Codex is a skill that runs the Codex CLI to analyze, refactor, or automate edits on code. It supports session management, MCP server configuration, and settings changes via codex config and the dedicated /codex-review flow. It uses defaults.json to tailor model choice and sandbox modes before executing Codex tasks.

How This Skill Works

The skill starts by reading defaults.json to determine the model and sandbox settings. It then selects a model (explicitly named, Spark for fast tasks, or auto) and assembles the codex exec command with -m, -c, and -s options. Finally it executes in foreground or background, writes results to /tmp/codex_output.md and diagnostics to /tmp/codex_stderr.log, and presents a summary to the user, who can resume with codex resume.

When to Use It

  • When you want to run Codex CLI to analyze code with codex exec review or other Codex operations.
  • When you need automated edits or refactoring on a codebase using Codex CLI.
  • When configuring Codex defaults or changing codex settings via codex config.
  • When performing a codex-review on a specific commit, base branch, or uncommitted changes.
  • When you need to resume a previously started Codex task using codex resume.

Quick Start

  1. Step 1: Read defaults.json in the skill base directory with the Read tool.
  2. Step 2: Choose a model (explicit, Spark for speed, or auto) and assemble the codex exec command.
  3. Step 3: Run the task (foreground or background) and inspect /tmp/codex_output.md; review /tmp/codex_stderr.log if needed.

Best Practices

  • Always read defaults.json first to choose the right model and sandbox.
  • Let explicit model names or Spark keywords drive model selection for speed vs. depth.
  • Use read-only sandbox (-s read-only) for analysis; workspace-write for edits.
  • Ensure -c uses key=value syntax and avoid dangerous forms like -c xhigh.
  • Check /tmp/codex_output.md for results and /tmp/codex_stderr.log for errors; resume with codex resume if needed.

Example Use Cases

  • Run a quick Codex review on a single file to surface issues without changing code.
  • Execute a full multi-file refactor to improve architecture and readability.
  • Configure Codex defaults to set a preferred model and sandbox for ongoing work.
  • Use /codex-review to compare the current feature branch against main.
  • Pause a long Codex task and resume later with codex resume.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers