| name | description |
|---|---|
codex |
Use Codex CLI for autonomous code analysis, refactoring, design, and implementation. Use when user asks to run codex, mentions pair programming with Codex, or requests iterative code analysis and development with session continuity. |
Codex is an advanced AI programming assistant that excels at autonomous code analysis, design, and implementation through iterative consultation with self-constructed quality standards.
- Session Continuity: Maintains conversation context across commands
- Autonomous Planning: Discovers context and creates execution plans independently
- Rubric-Based Excellence: Creates and iterates against self-constructed quality standards
- Pattern Recognition: Analyzes and matches existing code patterns
Use the default profile for safe, read-only analysis:
codex exec --profile readonly_quiet -C /full/path/to/project "your comprehensive prompt here" 2>/dev/null
Profile: Always use --profile readonly_quiet for analysis and planning (safe mode)
Working Directory: Always use -C flag with the fully qualified path to the project directory (use the actual project root path you know)
Suppress Thinking Tokens: Always append 2>/dev/null to suppress stderr unless user explicitly requests to see thinking tokens or debugging is needed
Maintain context for iterative work:
codex exec "follow-up prompt" resume --last 2>/dev/null
No flags needed: The resumed session inherits all settings from the original session
Session Benefits: Preserves context, builds on previous analysis, maintains rubric consistency
Codex performs best when asked to create and iterate against quality rubrics:
codex exec --profile readonly_quiet -C /full/path/to/project "Analyze [component]. Create excellence rubric covering architecture, performance, maintainability, security. Execute comprehensive analysis against rubric with scored evaluations (0-10) and actionable findings." 2>/dev/null
Rubric Dimensions:
- Functionality: Does it meet all requirements?
- Code Quality: Is it clean, maintainable, follows patterns?
- Integration: Does it fit seamlessly with existing code?
- Testing: Is coverage comprehensive?
- Performance: Is it efficient and scalable?
- Security: Are there vulnerabilities?
codex exec --profile readonly_quiet -C /full/path/to/project "Create an excellence rubric for [task]. Execute iteratively against this rubric, self-assessing and refining your approach." 2>/dev/null
codex exec --profile readonly_quiet -C /full/path/to/project "Analyze [component]. Files: [paths]. Create analysis rubric covering architecture, performance, maintainability, security. Execute comprehensive analysis with actionable findings." 2>/dev/null
codex exec --profile readonly_quiet -C /full/path/to/project "Plan implementation for [feature]. Discovery: Analyze similar implementations. Standards: Follow observed patterns. Rubric: Create comprehensive standards. Provide detailed reasoning and execution plan." 2>/dev/null
codex exec "Review implementation of [feature]. Create review rubric: correctness, performance, security, maintainability, style. Score against each criterion (0-10). Provide improvement suggestions with priority ranking." resume --last 2>/dev/null
- Initial Consultation: Execute comprehensive initial prompt
- Think Critically: Analyze Codex response, don't be passive
- Follow-up: Formulate next prompt based on results
- Continue Session: Use
resume --lastto maintain context - Iterate: Continue until excellence (8+/10 scores) achieved
CRITICAL: Backticks are strictly forbidden in Codex prompts
- Never use backticks (`) - the tool will crash
- Use single quotes (' ') instead for emphasis or code references
- Avoid Markdown code formatting in prompts
- Keep prompts simple and clear
Good: "Analyze the 'UserService' class and review the 'authenticate' method"
Bad: "Analyze the UserService class and review the authenticate method"
- Provide objectives, not implementation details
- Let Codex discover and plan autonomously
- Focus on what and why, not how
- Trust Codex's analytical capabilities
- Share project context and constraints
- Let Codex determine the best approach
- Enable self-directed problem solving
- Start with analysis and planning
- Build incrementally
- Review and score frequently
- Refine until excellence
| Use Case | Command Pattern |
|---|---|
| New analysis | codex exec --profile readonly_quiet -C /full/path/to/project "prompt" 2>/dev/null |
| Continue session | codex exec "follow-up prompt" resume --last 2>/dev/null |
| Show thinking | codex exec "prompt" resume --last (omit 2>/dev/null) |
- Report failures when commands exit non-zero
- Summarize warnings and partial results
- Ask user for direction before retrying
- Show stderr only when debugging or explicitly requested
- Codex CLI commands are bash commands - execute them using terminal
- Session continuity is key - use
resume --lastfor follow-ups - Think critically about Codex suggestions - you're pair programming
- Let Codex create rubrics and self-assess
- No backticks in prompts - use single quotes instead