Skip to content

majiayu000/spellbook / skills/codex-agent

codex-agent

Verified

Use when you want a second-opinion review via Codex CLI, cross-verification after another agent implements changes, debugging help, or alternative implementation proposals. Requires Codex CLI to be installed and authenticated.

FileKindSize
README.mdmarkdown4.9 KB
SKILL.mdskill md7.5 KB
advanced.mdmarkdown3.8 KB
examples.mdmarkdown4.3 KB
sandbox-modes.mdmarkdown2.0 KB
scripts/check-codex.shexecutablescript1.0 KB
scripts/codex-wrapper.shexecutablescript3.5 KB

scripts/codex-wrapper.sh

View on GitHub
#!/bin/bash
# codex-wrapper.sh - Wrapper script for calling Codex with common defaults
# Place in: ~/.claude/skills/codex-agent/scripts/

set -e

# Defaults
SANDBOX="${CODEX_SANDBOX:-read-only}"
OUTPUT_FORMAT=""
OUTPUT_FILE=""
SESSION=""
WORKDIR="${PWD}"
CONFIG_OVERRIDES=()

usage() {
    cat << EOF
Usage: codex-wrapper.sh [options] "<task>"

Options:
  -d, --dir <path>       Working directory (default: current)
  -s, --sandbox <mode>   Sandbox mode: read-only, workspace-write, danger-full-access
  -j, --json             Output as JSON
  -c, --config <key=val> Pass a Codex config override (repeatable)
  -o, --output <file>    Save output to file
  -S, --session <id>     Use session ID for follow-up
  -h, --help             Show this help

Examples:
  codex-wrapper.sh -d /path/to/project "Analyze the code"
  codex-wrapper.sh -j -s workspace-write "Fix the bug in main.ts"
  codex-wrapper.sh -s workspace-write -c 'sandbox_workspace_write.network_access=true' "Install dependencies"
  codex-wrapper.sh -S abc123 "Continue from where we left off"
EOF
    exit 0
}

# Parse arguments
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
    case $1 in
        -d|--dir)
            [[ $# -ge 2 ]] || { echo "Error: --dir requires a path" >&2; exit 2; }
            WORKDIR="$2"
            shift 2
            ;;
        -s|--sandbox)
            [[ $# -ge 2 ]] || { echo "Error: --sandbox requires a mode" >&2; exit 2; }
            SANDBOX="$2"
            shift 2
            ;;
        -j|--json)
            OUTPUT_FORMAT="--json"
            shift
            ;;
        -c|--config)
            [[ $# -ge 2 ]] || { echo "Error: --config requires key=value" >&2; exit 2; }
            CONFIG_OVERRIDES+=(-c "$2")
            shift 2
            ;;
        -o|--output)
            [[ $# -ge 2 ]] || { echo "Error: --output requires a file" >&2; exit 2; }
            OUTPUT_FILE="$2"
            shift 2
            ;;
        -S|--session)
            [[ $# -ge 2 ]] || { echo "Error: --session requires an id" >&2; exit 2; }
            SESSION="$2"
            shift 2
            ;;
        -h|--help)
            usage
            ;;
        -*)
            echo "Error: unsupported option: $1" >&2
            exit 2
            ;;
        *)
            POSITIONAL_ARGS+=("$1")
            shift
            ;;
    esac
done

set -- "${POSITIONAL_ARGS[@]}"

if [[ $# -eq 0 ]]; then
    echo "Error: Task description required"
    usage
fi

TASK="$*"

# Validate high-impact options before building the command.
case "$SANDBOX" in
    read-only|workspace-write|danger-full-access) ;;
    *)
        echo "Error: unsupported sandbox mode: $SANDBOX" >&2
        exit 2
        ;;
esac

if [[ "$SANDBOX" == "danger-full-access" && "${CODEX_ALLOW_DANGER_FULL_ACCESS:-}" != "1" ]]; then
    echo "Error: danger-full-access requires CODEX_ALLOW_DANGER_FULL_ACCESS=1" >&2
    exit 2
fi

if [[ -n "$SESSION" && ${#CONFIG_OVERRIDES[@]} -gt 0 ]]; then
    echo "Error: --config is only supported for new codex exec tasks, not session resume" >&2
    exit 2
fi

if [[ -n "$SESSION" ]]; then
    # Build command as an argv array. Do not use eval with user-controlled text.
    CMD=(codex exec -C "$WORKDIR" resume)
else
    # Build command as an argv array. Do not use eval with user-controlled text.
    CMD=(codex exec -C "$WORKDIR" -s "$SANDBOX")
    CMD+=("${CONFIG_OVERRIDES[@]}")
fi

if [[ -n "$OUTPUT_FORMAT" ]]; then
    CMD+=("$OUTPUT_FORMAT")
fi

if [[ -n "$OUTPUT_FILE" ]]; then
    CMD+=(-o "$OUTPUT_FILE")
fi

if [[ -n "$SESSION" ]]; then
    CMD+=("$SESSION")
fi

CMD+=("$TASK")

# Execute
"${CMD[@]}"
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall