| name | description |
|---|---|
consult-codex |
Consult OpenAI Codex CLI for a second opinion or alternative perspective. Triggers on "consult codex", "ask codex", "check with codex", "codex opinion", "what does codex think". |
Get a second opinion from OpenAI's Codex CLI on the current topic, question, or task. Use the output to inform your next action based on the user's request.
- User explicitly says "consult codex", "ask codex", or similar
- User wants a second opinion on debugging, architecture, or implementation
- User instructs you to consider Codex's perspective before planning or acting
-
Formulate the prompt — Distill the current conversation context into a clear, actionable prompt for Codex. Include:
- The specific question, bug, or task at hand
- Relevant file paths or code snippets (keep it concise)
- What kind of answer is needed (explanation, fix, alternatives, review)
- If the user provided an explicit message for Codex, use that instead
-
Run Codex — Execute via Bash using the non-interactive
execmode:codex exec --sandbox read-only "YOUR PROMPT HERE"
--sandbox read-onlyrestricts Codex to read-only file access (no modifications)- Codex runs in the current working directory and can see project files
- stdout contains the final answer; stderr has progress (ignore stderr)
- For longer prompts, use a heredoc:
codex exec --sandbox read-only "$(cat <<'EOF' Your multi-line prompt here. Include context, file paths, and what you need. EOF )"
-
Interpret the output — Based on the user's request:
- Debugging: Compare Codex's diagnosis with your own, highlight agreements and new insights
- Planning: Incorporate Codex's suggestions into your plan, noting where approaches differ
- Code review: Present Codex's feedback alongside your own assessment
- General question: Summarize Codex's answer and add your own perspective if relevant
-
Act on the result — Follow the user's intent:
- If user asked to "consult then implement" → use the combined insights to write code
- If user asked for a second opinion → present both perspectives and let the user decide
- If user asked to debug with Codex → synthesize findings into a resolution
- Be specific about scope: "Look at
src/features/tags/queries.tsand explain why the cache isn't invalidating after mutation" - Include constraints: "This project uses TanStack Query v5 and Zustand — suggest solutions using these libraries"
- Ask for concrete output: "Suggest a fix" rather than "What do you think about this code"
- Keep prompts under ~500 words for best results
- Always use
codex exec --sandbox read-onlyfor read-only consultation (no file modifications) - Summarize Codex's response concisely for the user
- Clearly distinguish between Codex's suggestions and your own
- Mention when you and Codex agree — convergent opinions build confidence
- Let Codex modify files — always use
--sandbox read-only - Blindly follow Codex output — verify against project conventions in
CLAUDE.md - Run Codex for trivial questions you can answer directly
- Pass sensitive data (API keys, credentials) in the prompt