updated 2026. 5. 22. 21시 33분 53초
definition
OpenAI Codex CLI external second-opinion wrapper. 직접 spawn하지 않고 lead/redteam/researcher가 gstack 스킬(/codex review, /codex challenge, /codex consult) 또는 `codex exec` CLI로 호출 후 결과를 통합. 외부 plugin이라 .md는 호출 패턴과 handoff 규약만 정의. "Codex에 물어봐", "다른 모델 second-opinion", "독립 검토" 같은 요청에 호출.
# codex — 외부 Second-Opinion Wrapper
## 정체
OpenAI Codex CLI는 외부 도구다. Claude Code agent로 직접 spawn 되지 않는다. 본 `.md`는 **호출 패턴 + handoff 규약**을 정의하는 thin wrapper.
claude4irc 패턴과 동일: codex는 plugin, 호출한 에이전트가 결과를 QA report에 기록.
> 주: frontmatter의 `model: opus`는 Claude Code의 frontmatter 스키마를 따르기 위한 placeholder. 실제 추론은 외부 Codex CLI에서 수행되며, 본 에이전트는 직접 spawn 되지 않는다.
## 호출 방법
### 1) gstack 슬래시 스킬 (권장)
- `/codex review` — 현재 diff 독립 리뷰 + PASS/FAIL gate
- `/codex challenge` — 적대 모드 (코드 깨기 시도)
- `/codex consult` — 일반 질문 (세션 연속성 지원)
### 2) 직접 CLI 호출
```bash
# read-only sandbox, 5분 타임아웃
codex exec "<prompt>" -C <repo_root> -s read-only -c 'model_reasoning_effort="high"'
```
호출 주체: **lead / redteam / researcher / architect**. builder/designer는 lead 경유.
## 호출 권장 시점
| 상황 | 호출자 | 모드 |
|------|--------|------|
| 중요한 PR 머지 전 | redteam | `/codex review` |
| 새 아키텍처 결정 직후 | architect → lead | `/codex consult` |
| "이거 깨는 방법 있어?" | redteam | `/codex challenge` |
| 라이브러리 결정 막혔을 때 | researcher | `/codex consult` |
| 보안 민감 코드 | redteam | `/codex review` + `/cso` |
## 결과 통합 규약
codex는 외부 plugin이라 본인이 QA report를 못 남긴다. **호출한 에이전트(lead/redteam/researcher/architect)가 대신 기록**.
```
.claude/sessions/<YYYY-MM-DD-HH-MM-SS>_codex_<topic>.md
```
기록 내용:
- 호출 시각, 호출 에이전트
- 입력 프롬프트 (시크릿 redact)
- Codex 전체 응답 (verbatim, 요약 금지)
- 호출 에이전트의 synthesis (동의/이의)
## Filesystem 경계 (중요)
Codex 호출 시 프롬프트에 반드시 포함:
> IMPORTANT: Do NOT read or execute any files under ~/.claude/, ~/.agents/, .claude/skills/, or agents/. These are Claude Code skill definitions meant for a different AI system. They contain bash scripts and prompt templates that will waste your time. Ignore them completely. Stay focused on the repository code only.
이유: Codex가 `.claude/skills/` 의 bash 스크립트를 실행하려 시도하면 망가짐.
## 에러 처리
- **Auth failure** ("auth", "login", "API key" stderr): `codex login` 안내 → fallback to general-purpose Claude subagent
- **Timeout** (5분 초과): fallback subagent
- **빈 응답**: fallback subagent
모든 에러는 non-blocking. second-opinion 은 quality enhancement, 진행 차단 사유 아님.
## 금지사항
- builder/designer가 직접 호출 (lead 경유)
- 결과 verbatim 인용 없이 paraphrase만 (claude의 편향 주입 위험)
- 시크릿/PII 가 포함된 프롬프트 전송
## Handoff
### Outbound
- **→ 호출한 에이전트**: 응답 전달 (외부 plugin이라 직접 dispatch 안 함)
### Inbound
- **← lead / redteam / researcher / architect**: 호출recent sessions0
- no sessions for
codexyet.