본문으로 건너뛰기
cccskills
무료GitHub에 공개

codex-exec

Execute OpenAI Codex CLI prompts and return results

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구OpenAI
설치 방법 보기

포함된 파일(2)

  • SKILL.md8.8 KB
  • scripts/codex-wrapper.cjs11.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Codex Exec Skill

Execute OpenAI Codex CLI prompts in non-interactive mode and return structured results. Enables Claude + Codex hybrid workflows.

Options

<prompt>          Required. The prompt to send to Codex CLI
--json            Return structured JSON Lines output
--output <path>   Save final message to file
--model <name>    Model override (default: Codex CLI default model)
--timeout <ms>    Execution timeout (default: 120000, max: 600000)
--full-auto       Enable auto-approval mode (codex -a full-auto)
--working-dir     Working directory for Codex execution
--effort <level>  Set reasoning effort level (minimal, low, medium, high, xhigh)
                  Maps to Codex CLI's model_reasoning_effort config
                  Default: uses Codex CLI's configured default
                  Recommended: xhigh for research/analysis tasks

Workflow

1. Pre-checks
   - Verify `codex` binary is installed (which codex || npx codex --version)
   - Verify authentication (OPENAI_API_KEY or logged in)
2. Build command
   - Base: codex exec --ephemeral "<prompt>"
   - Apply options: --json, --model, --full-auto, -C <dir>
   - Set --working-dir if specified
3. Execute
   - Run via Bash tool with timeout (default 2min, max 10min)
   - Or use helper script: node .claude/skills/codex-exec/scripts/codex-wrapper.cjs
4. Parse output
   - Text mode: return raw stdout
   - JSON mode: parse JSON Lines, extract final assistant message
5. Report results
   - Format output with execution metadata

Safety Defaults

  • --ephemeral: No session persistence (conversations not saved)
  • Default mode: Normal approval (Codex prompts for confirmation)
  • Override with --full-auto only when explicitly requested

Output Format

Success (Text Mode)

[Codex Exec] Completed

Model: (default)
Duration: 23.4s
Working Dir: /path/to/project

--- Output ---
{codex response text}

Success (JSON Mode)

[Codex Exec] Completed (JSON)

Model: (default)
Duration: 23.4s
Events: 12

--- Final Message ---
{extracted final assistant message}

Failure

[Codex Exec] Failed

Error: {error_message}
Exit Code: {code}
Suggested Fix: {suggestion}

Helper Script

For complex executions, use the wrapper script:

node .claude/skills/codex-exec/scripts/codex-wrapper.cjs --prompt "your prompt" [options]

The wrapper provides:

  • Environment validation (binary + auth checks)
  • Safe command construction
  • JSON Lines parsing with event extraction
  • Structured JSON output
  • Timeout handling with graceful termination

Examples

# Simple text prompt
codex-exec "explain what this project does"

# JSON output with model override
codex-exec "list all TODO items" --json

# Save output to file
codex-exec "generate a README" --output ./README.md

# Full auto mode with custom timeout
codex-exec "fix the failing tests" --full-auto --timeout 300000

# Specify working directory
codex-exec "analyze the codebase" --working-dir /path/to/project

Integration

Works with the orchestrator pattern:

  • Main conversation delegates Codex execution via this skill
  • Results are returned to the main conversation for further processing
  • Can be chained with other skills (e.g., dev-review after Codex generates code)

Availability Check

codex-exec requires the Codex CLI binary to be installed and authenticated. The skill is only usable when:

  1. codex binary is found in PATH (which codex succeeds)
  2. Authentication is valid (OPENAI_API_KEY set or codex logged in)

If either check fails, this skill cannot be used. Fall back to Claude agents for the task.

Note: This skill is invoked via /codex-exec command, delegated by the orchestrator, or suggested by routing skills when codex is available. The intent-detection system can trigger it for research (xhigh) and code generation (hybrid) workflows.

Agent Teams Integration

When used within Agent Teams (requires explicit invocation):

  1. As delegated task: orchestrator explicitly delegates codex-exec for code generation
  2. Hybrid workflow: Claude team member analyzes → orchestrator invokes codex-exec → Claude reviews
  3. Iteration: Team messaging enables review-fix cycles between Claude and Codex outputs
Orchestrator delegates generation task
  → /codex-exec invoked explicitly
  → Output returned to orchestrator
  → Reviewer validates quality
  → Iterate if needed

Research Workflow

When the orchestrator or intent-detection detects a research/information gathering request (routing_rule in agent-triggers.yaml):

  1. Check Codex availability: Verify codex binary and OPENAI_API_KEY
  2. If available: Execute with xhigh reasoning effort for thorough research
  3. If unavailable: Fall back to Claude's WebFetch/WebSearch

Research Command Pattern

/codex-exec "Research and analyze: {topic}. Provide structured findings with sources." --effort xhigh --full-auto --json

Effort Level Guide

LevelUse CaseSpeedDepth
minimalQuick lookupsFastestSurface
lowSimple queriesFastBasic
mediumGeneral tasksBalancedStandard
highComplex analysisSlowerDeep
xhighResearch & investigationSlowestMaximum

Code Generation Workflow

When routing skills detect a code generation task and codex is available:

  1. Check availability: Verify codex CLI via /tmp/.claude-env-status-*
  2. If available + new file creation: Suggest hybrid workflow
  3. Hybrid pattern:
    • codex-exec generates initial code (fast, broad generation)
    • Claude expert reviews for quality, patterns, best practices
    • Iterate if needed

Suitable Tasks

  • New file scaffolding
  • Boilerplate generation
  • Test stub creation
  • Documentation generation

Unsuitable Tasks

  • Modifying existing code (Claude expert better at understanding context)
  • Architecture decisions (requires reasoning, not generation)
  • Bug fixes (requires deep code understanding)

Code Generation Command Pattern

/codex-exec "Generate {description} following {framework} best practices" --effort high --full-auto

Browser Verify Workflow (Codex + claude-in-chrome 협업 루프)

Codex가 생성/수정한 프론트엔드 결과를 시각적으로 검증하는 루프 패턴. 신규 스킬 불요 — 기존 도구 조합.

Pattern

codex-exec "build/fix frontend"
    → bun dev / npm run dev (로컬 서버 기동)
    → claude-in-chrome:navigate(localhost:port)
    → claude-in-chrome:gif_creator(action capture)
    → claude-in-chrome:read_console_messages (오류 감지)
    → claude-in-chrome:read_network_requests (실패 호출 감지)
    → 오류 있으면: codex-exec "fix: {error context}" → 루프 재진입
    → 오류 없으면: 종료 + 결과 보고

When to Use

상황권장
단순 코드 생성codex-exec 단독
프론트엔드 시각 검증 필요이 루프
API/백엔드 검증deep-verify skill
복잡한 디자인 시스템design-shotgun 병행

Loop Termination Rules

  • 최대 반복 3회 (degeneration 방지, R013/agora 패턴 차용)
  • console error 0개 + network failure 0개 → 종료
  • 동일 오류 반복 시 즉시 종료 + 사용자 보고

Tool Composition

단계도구
Build/Fixcodex-exec
ServerBash(bun dev) (background)
Visualmcp__claude-in-chrome__navigate + gif_creator
Diagnoseread_console_messages + read_network_requests

자세한 구현 패턴: guides/browser-automation/01-browser-automation-patterns.md 참조.

Tool: Use the Write tool for any artifact files this loop produces — never Bash mkdir on .claude/outputs/.

Tool: Writing artifacts under .claude/outputs/

CC sensitive-path check inspects tool target paths and triggers permission prompts on .claude/ regardless of bypassPermissions and allow rules (refs: #960, #961, #978, #981, #1016).

To write codex execution results under .claude/outputs/codex/:

  1. Write the artifact body to /tmp/codex-{HHmmss}.{ext} first (Write tool target = /tmp, no sensitive-path trigger)
  2. Use a /tmp/*.sh Bash script to move/copy the file under .claude/outputs/codex/sessions/... (Bash target = /tmp, script-internal cp to .claude/ is not audited)
  3. Read-only Bash on .claude/outputs/ (e.g., cat, head, wc) is allowed for verification

Reference: feedback_sensitive_path_tmp_bypass.md, R006 sensitive-path handling.

Attribution

Pattern source: Codex Browser Use (https://x.com/jameszmsun/status/2047522852854026378), scout #1009.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Pre-action boundary checking — validates agent tool calls against declared capabilities and task contracts

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

Auto-detect project context and optimize harness — deactivate unused agents/skills, suggest missing experts, generate project profile

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

Adversarial code review using attacker mindset — trust boundary, attack surface, business logic, and defense evaluation

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

Apache Airflow best practices for DAG authoring, testing, and production deployment

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

Alembic migration patterns for naming conventions, safety checks, expand-contract, env.py configuration, and CI integration

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

Pre-routing ambiguity analysis — scores request clarity and asks clarifying questions when needed (inspired by ouroboros)

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

baekenough/second-brain152026년 10월 8일 업데이트

baekenough의 스킬 모두 보기

이 스킬의 문제 신고