codex-system
Codex System — Planning, Design & Complex Implementation
Codex CLI handles planning, design, and complex code implementation.
Detailed rules:
.claude/rules/codex-delegation.md
Two Roles of Codex
1. Planning & Design
- Architecture design, module composition
- Implementation plan creation (step breakdown, dependency ordering)
- Trade-off evaluation, technology selection
- Code review (quality and correctness analysis)
2. Complex Implementation
- Complex algorithms, optimization
- Debugging with unknown root causes
- Advanced refactoring
- Multi-step implementation tasks
When to Consult (MUST)
| Situation | Trigger Examples |
|---|---|
| Planning | "Create a plan" "Architecture" |
| Design decisions | "How to design?" |
| Complex implementation | "How to implement?" "How to build?" |
| Debugging | "Why doesn't this work?" "Error" "Debug" |
| Trade-off analysis | "Which is better?" "Compare" |
| Refactoring | "Refactor" "Simplify" |
| Code review | "Review" "Check" |
When NOT to Consult
- Simple file edits, typo fixes
- Tasks that simply follow explicit user instructions
- git commit, test execution, lint
- Codebase analysis → general-purpose subagent (Opus 1M context)
- External information retrieval → general-purpose subagent (Opus, WebSearch/WebFetch)
- Multimodal processing → Gemini CLI (PDF/video/audio/images)
How to Consult
Subagent Pattern (Recommended)
Task tool parameters:
- subagent_type: "general-purpose"
- run_in_background: true (optional)
- prompt: |
Consult Codex about: {topic}
codex exec --model gpt-5.4 --sandbox read-only --full-auto "
{question for Codex}
" 2>/dev/null
Return CONCISE summary (key recommendation + rationale).
Direct Call (responses up to ~50 lines)
codex exec --model gpt-5.4 --sandbox read-only --full-auto "Brief question" 2>/dev/null
Having Codex Implement Code
codex exec --model gpt-5.4 --sandbox workspace-write --full-auto "
Implement: {task description}
Requirements: {requirements}
Files: {file paths}
" 2>/dev/null
Sandbox Modes
| Mode | Use Case |
|---|---|
read-only |
Design, review, debug analysis |
workspace-write |
Implementation, fixes, refactoring |
Task Templates
Implementation Planning
codex exec --model gpt-5.4 --sandbox read-only --full-auto "
Create an implementation plan for: {feature}
Context: {relevant architecture/code}
Provide:
1. Step-by-step plan with dependencies
2. Files to create/modify
3. Key design decisions
4. Risks and mitigations
" 2>/dev/null
Design Review
codex exec --model gpt-5.4 --sandbox read-only --full-auto "
Review this design approach for: {feature}
Context: {relevant code or architecture}
Evaluate:
1. Is this approach sound?
2. Alternative approaches?
3. Potential issues?
4. Recommendations?
" 2>/dev/null
Debug Analysis
codex exec --model gpt-5.4 --sandbox read-only --full-auto "
Debug this issue:
Error: {error message}
Code: {relevant code}
Context: {what was happening}
Analyze root cause and suggest fixes.
" 2>/dev/null
Language Protocol
- Ask Codex in English
- Receive response in English
- Execute based on advice
- Report to user in the user's language
Why Codex?
- Deep reasoning: Complex analysis and problem-solving
- Planning expertise: Architecture and implementation strategies
- Code mastery: Complex algorithms, optimization, debugging
- Consistency: Same project context via
context-loaderskill
More from del-taiseiozaki/claude-code-orchestra
update-design
Explicitly update DESIGN.md with decisions from the current conversation. Use when you want to force a design document update.
15context-loader
ALWAYS activate this skill at the start of every task. Load project context from .claude/ directory including coding rules, design decisions, and documentation before executing any task.
15simplify
Simplify and refactor code while preserving functionality and library constraints.
13init
Analyze project structure and update AGENTS.md with detected tech stack, commands, and configurations.
12plan
Create a detailed implementation plan for a feature or task. Use when user wants to plan before coding.
12update-lib-docs
Update library documentation in .claude/docs/libraries/ with latest information from web search.
12