
Multi Ai Consultant
- 39 installs
- 16 repo stars
- Updated November 20, 2025
- jackspace/claudeskillz
Consult external AIs (Gemini, OpenAI Codex, fresh Claude) via CLI for second opinions when stuck on bugs or architecture.
About
Lets a Claude Code session consult other AIs through existing CLI tools and synthesizes their perspectives. A developer uses it when debugging has failed or a critical architectural decision needs a second opinion.
- Uses gemini and codex CLIs instead of MCP servers
- Synthesizes multiple AI perspectives with web research
Multi Ai Consultant by the numbers
- 39 all-time installs (skills.sh)
- Ranked #8,260 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/jackspace/claudeskillz --skill multi-ai-consultantAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 39 |
|---|---|
| repo stars | ★ 16 |
| Last updated | November 20, 2025 |
| Repository | jackspace/claudeskillz ↗ |
What it does
Consult external AIs (Gemini, OpenAI Codex, fresh Claude) via CLI for second opinions when stuck on bugs or architecture.
Files
Multi-AI Consultant
Consult external AIs for second opinions when Claude Code is stuck or making critical decisions.
---
What This Skill Does
This skill enables future Claude Code sessions to consult other AIs when:
- Stuck on a bug after one failed attempt
- Making architectural decisions
- Security concerns need validation
- Fresh perspective needed
Key innovation: Uses existing CLI tools (gemini, codex) instead of building MCP servers - much simpler and more maintainable.
---
When to Use This Skill
Automatic Triggers (No User Action Needed)
Claude Code should automatically suggest using this skill when:
1. After 1 failed debugging attempt
- Tried one approach to fix a bug
- Still not working or different error
- → Suggest: "Should I consult [Gemini|Fresh Claude] for a second opinion?"
2. Before architectural decisions
- Significant design choices (state management, routing, data flow)
- Framework selection
- Database schema design
- → Auto-consult (mention to user): "Consulting Gemini for architectural validation..."
3. Security changes
- Authentication logic
- Authorization rules
- Cryptography
- Input validation
- → Auto-consult: "Consulting Gemini to verify security approach..."
4. When uncertain
- Multiple valid approaches
- Trade-offs not clear
- Conflicting advice in documentation
- → Suggest: "Would you like me to consult another AI for additional perspective?"
Manual Invocation (User Commands)
User can explicitly request consultation with:
/consult-gemini [question]- Gemini 2.5 Pro with thinking, search, grounding/consult-codex [question]- OpenAI GPT-4 via Codex CLI (repo-aware)/consult-claude [question]- Fresh Claude subagent (free, fast)/consult-ai [question]- Router that asks which AI to use
---
The Three AIs
| AI | Tool | When to Use | Special Features | Cost |
|---|---|---|---|---|
| Gemini 2.5 Pro | gemini CLI | Web research, latest docs, thinking | Google Search, extended reasoning, grounding | ~$0.10-0.50 |
| OpenAI GPT-4 | codex CLI | Repo-aware analysis, code review | Auto-scans directory, OpenAI reasoning | ~$0.05-0.30 |
| Fresh Claude | Task tool | Quick second opinion, budget-friendly | Same capabilities, fresh perspective | Free |
---
How It Works
Architecture
Claude Code encounters bug/decision
↓
Suggests consultation (or user requests)
↓
User approves
↓
Execute appropriate slash command
↓
CLI command calls external AI
↓
Parse response
↓
Synthesize: Claude's analysis + External AI's analysis
↓
Present 5-part comparison
↓
Ask permission to implementThe 5-Part Synthesis Format
Every consultation must follow this format (prevents parroting):
1. 🤖 My Analysis - Claude's original reasoning and attempts 2. 💎/🔷/🔄 Other AI's Analysis - External AI's complete response 3. 🔍 Key Differences - Agreement, divergence, what each AI caught/missed 4. ⚡ Synthesis - Combined perspective, root cause, trade-offs 5. ✅ Recommended Action - Specific next steps with file paths/line numbers
End with: "Should I proceed with this approach?"
---
Setup Instructions
1. Install CLIs
Gemini CLI (required):
npm install -g @google/generative-ai-cli
export GEMINI_API_KEY="your-key"Get API key: https://aistudio.google.com/apikey
Codex CLI (optional):
npm install -g codex
export OPENAI_API_KEY="sk-..."Get API key: https://platform.openai.com/api-keys
Fresh Claude: Built-in (uses Task tool, no setup)
2. Install Skill
cd ~/.claude/skills
git clone [this-repo] multi-ai-consultant
# OR symlink from development location3. Copy Templates to Project
# Copy to project root
cp ~/.claude/skills/multi-ai-consultant/templates/GEMINI.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/codex.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/.geminiignore ./
# Copy log parser (optional)
cp ~/.claude/skills/multi-ai-consultant/templates/consultation-log-parser.sh ~/bin/
chmod +x ~/bin/consultation-log-parser.sh4. Verify Installation
# Test Gemini CLI
gemini -p "test" && echo "✅ Gemini working"
# Test Codex CLI (if installed)
codex exec "test" --yolo && echo "✅ Codex working"
# Test skill discovery
# Ask Claude Code: "I'm stuck on this bug, can you help?"
# Claude should suggest consultation---
Usage Examples
Example 1: Stuck on Bug
Scenario: JWT authentication failing after one attempt
Claude's process:
1. Try initial fix (token expiry check)
2. Still failing (now "invalid signature" error)
3. → Automatically suggest consultation
4. User approves
5. Execute /consult-gemini with:
- Problem: 401 error details
- What was tried: token expiry fix
- Current status: invalid signature error
- Context: @src/auth/session.ts @src/middleware/jwt.ts
6. Gemini finds: Using process.env instead of env binding (Cloudflare)
7. Synthesize both perspectives
8. Ask permission to implement Gemini's fixResult: Bug fixed with second opinion, avoided 2-3 more trial-and-error attempts
Example 2: Architecture Decision
Scenario: Choosing state management for new feature
Claude's process:
1. User asks: "How should we handle state for this feature?"
2. → Auto-consult Gemini (architectural decision)
3. Execute /consult-gemini with:
- Problem: State management choice
- Options considered: Redux, Zustand, Context
- Context: @src/ (existing patterns)
4. Gemini searches for latest React state management best practices
5. Synthesize Claude's + Gemini's analysis
6. Present recommendation with trade-offsResult: Informed decision with latest best practices
Example 3: Manual Consultation
User: "I want a second opinion on this refactoring"
Claude's process:
1. User explicitly requests consultation
2. Ask which AI: Gemini, Codex, or Fresh Claude?
3. User chooses Codex (wants repo-aware analysis)
4. Execute /consult-codex with:
- Problem: Refactoring proposal
- Context: (Codex scans repo automatically)
5. Codex checks consistency with existing code
6. Synthesize both perspectives
7. Present recommendationResult: Validation of refactoring approach + consistency check
---
Slash Commands
/consult-gemini [question]
Use when: Need web research, latest docs, extended thinking
What it does: 1. Pre-flight check (Gemini CLI working?) 2. Smart context selection based on problem type 3. Execute with locked config: gemini-2.5-pro --thinking --google-search --grounding 4. Parse JSON response 5. Synthesize with 5-part format 6. Log cost to ~/.claude/ai-consultations/consultations.log
Example:
/consult-gemini Is this JWT validation secure by 2025 standards?Context: Uses @<path> syntax for selective context
System instructions: Auto-loads GEMINI.md from project root
Privacy: Respects .gitignore + .geminiignore
---
/consult-codex [question]
Use when: Need repo-aware analysis, code review, OpenAI reasoning
What it does: 1. Pre-flight check (OpenAI API key valid?) 2. cd to project directory (Codex scans automatically) 3. Execute with --yolo flag: codex exec - -m gpt-4-turbo --yolo 4. Parse output from temp file 5. Synthesize with 5-part format 6. Log cost (estimated tokens)
Example:
/consult-codex Review this codebase for performance issuesContext: Repo-aware (automatically reads all non-gitignored files)
System instructions: Auto-loads codex.md from project root or ~/.codex/instructions.md
Privacy: Respects .gitignore, warns if not in Git repo
---
/consult-claude [question]
Use when: Quick second opinion, free, fresh perspective
What it does: 1. Gather context with Read tool 2. Build detailed prompt for subagent 3. Launch Task tool (general-purpose subagent) 4. Receive fresh perspective 5. Synthesize with 5-part format 6. Log consultation (free, but tracked)
Example:
/consult-claude Am I missing something obvious in this state management bug?Context: You manually read relevant files and pass inline
Advantages: Free, same capabilities, fast, fresh perspective
Limitations: No web search, no extended thinking, same knowledge cutoff
---
/consult-ai [question]
Use when: Unsure which AI to use
What it does: 1. Analyze problem type (bug, architecture, security, etc.) 2. Recommend which AI based on needs 3. Ask user to choose 4. Route to appropriate command
Example:
/consult-ai How should we structure this microservices architecture?
→ Recommends Gemini (needs web research for latest patterns)
→ User approves
→ Executes /consult-gemini internallyDecision factors:
- Need web research? → Gemini
- Need repo-aware? → Codex
- Need budget-friendly? → Fresh Claude
- Need extended thinking? → Gemini
- Need fresh perspective? → Fresh Claude
---
Templates
GEMINI.md (Project Root)
System instructions for Gemini consultations. Enforces:
- 5-part response format
- Comparison with Claude's analysis
- Web search for latest docs
- Specific code references
- No parroting
Auto-loaded: Place in project root, Gemini CLI reads automatically
codex.md (Project Root or ~/.codex/instructions.md)
System instructions for Codex consultations. Enforces:
- 5-part response format
- Repo-aware analysis
- Consistency checks
- Impact assessment
- Specific file references
Auto-loaded: Codex CLI reads from project root or global config
.geminiignore (Project Root)
Extra privacy exclusions beyond .gitignore. Excludes:
.env*files*secret*,*credentials*- Build artifacts
- Large media files
- API keys and tokens
Auto-loaded: Gemini CLI respects this file
consultation-log-parser.sh
View consultation history:
consultation-log-parser.sh # Last 10
consultation-log-parser.sh --all # All consultations
consultation-log-parser.sh --summary # Stats only
consultation-log-parser.sh --ai gemini # Filter by AILog format: timestamp,ai,model,input_tokens,output_tokens,cost,project_path
---
Cost Tracking
Every consultation is logged to ~/.claude/ai-consultations/consultations.log
Format:
2025-11-07T14:23:45-05:00,gemini,gemini-2.5-pro,15420,850,0.1834,/home/user/project
2025-11-07T15:10:22-05:00,codex,gpt-4-turbo,8230,430,0.0952,/home/user/project
2025-11-07T16:05:11-05:00,claude-subagent,claude-sonnet-4-5,0,0,0.00,/home/user/projectView logs:
consultation-log-parser.sh --summary
# Total consultations: 47
# Gemini: 23, Codex: 12, Fresh Claude: 12
# Total cost: $8.45Pricing (verify current rates):
- Gemini 2.5 Pro: ~$0.000015/input token, ~$0.00006/output token
- GPT-4 Turbo: ~$0.00001/input token, ~$0.00003/output token
- Fresh Claude: Free (same API call)
---
Privacy & Security
Automatic Protection
Both CLIs respect .gitignore automatically. Files in .gitignore are never sent.
Additional Protection (.geminiignore)
Create .geminiignore in project root for extra exclusions:
*.env*
*secret*
*credentials*
.dev.vars
wrangler.tomlPre-Consultation Check
Claude Code should warn if:
- Sensitive file patterns detected in context
- Not in Git repo (Codex)
- Large context (>100k tokens estimated)
Ask permission: "About to send context to [AI]. Files include: [list]. Proceed?"
Manual Verification
Before consultation, user can check:
# What will be sent to Gemini
ls -la @src/
# Check gitignore is working
git status --ignored---
Known Issues & Solutions
1. CLI Not Installed
Error: gemini: command not found or codex: command not found
Fix:
npm install -g @google/generative-ai-cli
npm install -g codexPrevention: Pre-flight checks in slash commands
---
2. API Keys Invalid
Error: "API key invalid" or authentication failures
Fix:
export GEMINI_API_KEY="your-key"
export OPENAI_API_KEY="sk-..."
# Or add to ~/.bashrc
echo 'export GEMINI_API_KEY="your-key"' >> ~/.bashrc
source ~/.bashrcPrevention: Pre-flight checks test API before consultation
---
3. Context Too Large
Error: Token limit exceeded or very expensive consultation
Fix: Use smart context selection
- Bug: Just buggy file + imports (not entire codebase)
- Architecture: Relevant directories only
- Use
@path/to/specific/file.tsnot@.
Prevention: Slash commands guide smart context selection
---
4. Privacy Leaks
Risk: Accidentally sending .env or secrets
Fix:
- Both CLIs respect
.gitignore(automatic) - Create
.geminiignorefor extra protection - Claude warns if sensitive patterns detected
Prevention: Always check .gitignore is configured
---
5. Cost Overruns
Issue: Expensive consultations accumulating
Fix:
- Check logs:
consultation-log-parser.sh --summary - Use Fresh Claude for quick questions (free)
- Use smart context (specific files, not entire repo)
Prevention: Cost tracking + warnings for large context
---
6. Codex Hanging
Error: codex exec hangs waiting for approval
Fix: Always use --yolo flag
Prevention: Slash command includes --yolo by default (hard to miss)
---
7. JSON Parsing Fails (Gemini)
Error: jq: parse error
Fix: Check exit code before parsing, fall back to plain text
Prevention: Slash command checks exit code first
---
8. Not in Git Repo (Codex)
Warning: Codex warns if not in Git repo (safety feature)
Fix: Add --skip-git-repo-check flag if appropriate
Prevention: Slash command includes flag
---
Token Efficiency
Without This Skill
Typical scenario (stuck on bug): 1. Try approach 1 (~4k tokens) 2. Research CLI syntax (~3k tokens) 3. Format response (~2k tokens) 4. Try approach 2 (~4k tokens) 5. Research documentation (~3k tokens) 6. Try approach 3 (~4k tokens)
Total: ~20k tokens, 30-45 minutes
With This Skill
Same scenario: 1. Try approach 1 (~4k tokens) 2. Execute /consult-gemini (~1k tokens to execute) 3. Gemini finds issue (billed separately, but <5k tokens) 4. Implement fix (~3k tokens)
Total: ~8k tokens, 5-10 minutes
Savings: ~60% tokens, ~75% time
Value: Gemini's web search finds issue Claude couldn't
---
Success Metrics
Time Efficiency
- Without skill: 30-45 minutes (trial and error)
- With skill: 5-10 minutes (consultation + fix)
- Savings: ~75%
Token Efficiency
- Without skill: ~20k tokens (multiple attempts)
- With skill: ~8k tokens (one consultation)
- Savings: ~60%
Error Prevention
- Manual CLI use: 3-5 common errors (flags, parsing, privacy)
- With skill: 0 errors (all handled by commands)
- Prevention: 100%
Quality
- Manual: Risk of not synthesizing (just copying external AI)
- With skill: Forced synthesis via
GEMINI.md/codex.md - Improvement: Guaranteed value-add
---
Why CLI Approach (Not MCP)?
| Aspect | MCP Server | CLI Approach |
|---|---|---|
| Setup time | 4-6 hours | 60-75 minutes |
| Complexity | High (MCP protocol) | Low (bash + CLIs) |
| Maintenance | Update MCP SDK | Update CLI (rare) |
| Flexibility | Locked to AIs | Any AI with CLI |
| Debugging | MCP protocol | Standard bash |
| Dependencies | MCP SDK, npm | Just CLIs |
Winner: CLI approach - 80% less effort, same functionality
---
Troubleshooting
Gemini Not Working
# Check CLI installed
which gemini
# Check API key set
echo $GEMINI_API_KEY
# Test manually
gemini -p "test"
# Check API key valid
curl -H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"test"}]}]}' \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GEMINI_API_KEY"Codex Not Working
# Check CLI installed
which codex
# Check API key set (if using API key auth)
echo $OPENAI_API_KEY
# Test manually
echo "test" | codex exec - --yolo
# Check OpenAI API (if installed)
openai api models.listFresh Claude Not Working
# Fresh Claude uses Task tool (built-in)
# If Task tool fails, check Claude Code CLI status
claude --versionSkill Not Discovered
# Check skill installed
ls -la ~/.claude/skills/multi-ai-consultant
# Check SKILL.md has YAML frontmatter
head -20 ~/.claude/skills/multi-ai-consultant/SKILL.md
# Ask Claude Code to list skills
# It should mention multi-ai-consultant---
Contributing
Found an issue?
- Document it in Known Issues section
- Include fix/workaround
- Update slash commands to prevent
Adding new AI?
- Create new slash command:
commands/consult-newai.md - Add to router: Update
commands/consult-ai.md - Create template:
templates/newai.md(if CLI supports system instructions) - Update documentation
Improving synthesis?
- Edit templates:
templates/GEMINI.md,templates/codex.md - Test with real consultations
- Measure before/after quality
---
References
External Resources
- Gemini CLI: https://ai.google.dev/gemini-api/docs/cli
- OpenAI Codex: https://www.npmjs.com/package/codex
- OpenAI API: https://platform.openai.com/docs
- Gemini API Pricing: https://ai.google.dev/pricing
- OpenAI Pricing: https://openai.com/pricing
Internal Files
- Planning docs:
planning/multi-ai-consultant-*.md - Slash commands:
commands/*.md - Templates:
templates/* - Scripts:
scripts/*
---
License
MIT License - See LICENSE file
---
Last Updated: 2025-11-07 Status: Production Ready Maintainer: Jeremy Dawes | jeremy@jezweb.net | https://jezweb.com.au
Multi-AI Consultant
Get second opinions from Gemini, OpenAI, or fresh Claude when stuck or making critical decisions.
---
Quick Start
# Install skill
cd ~/.claude/skills
git clone [this-repo] multi-ai-consultant
# Setup APIs
export GEMINI_API_KEY="your-key" # Required
export OPENAI_API_KEY="sk-..." # Optional
# Copy templates to your project
cp ~/.claude/skills/multi-ai-consultant/templates/GEMINI.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/codex.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/.geminiignore ./
# Start using
# Claude Code will automatically suggest consultations when stuck---
Auto-Trigger Keywords
This skill activates when you say:
Stuck/Need Help
- "I'm stuck"
- "still not working"
- "this isn't working"
- "can't figure out"
- "no idea why"
- "need help"
- "need a second opinion"
- "want another perspective"
Architecture/Design
- "architecture decision"
- "how should we structure"
- "which approach is better"
- "design question"
- "choosing between"
- "what's the best way to"
Security
- "is this secure"
- "security concern"
- "vulnerability"
- "authentication"
- "authorization"
- "validation"
Manual Commands
/consult-gemini [question]/consult-codex [question]/consult-claude [question]/consult-ai [question]
---
The Three AIs
| AI | Best For | Cost | Speed |
|---|---|---|---|
| Gemini 2.5 Pro | Web research, latest docs, thinking | ~$0.10-0.50 | Slower |
| OpenAI Codex | Repo-aware analysis, code review | ~$0.05-0.30 | Medium |
| Fresh Claude | Quick opinion, fresh perspective | Free | Fast |
---
How It Works
1. You get stuck on a bug after one attempt 2. Claude suggests consulting another AI 3. You approve 4. External AI analyzes the problem with fresh eyes 5. Claude synthesizes both perspectives in 5-part format:
- 🤖 Claude's analysis
- 💎/🔷/🔄 Other AI's analysis
- 🔍 Key differences
- ⚡ Synthesis
- ✅ Recommended action
6. You decide which approach to take
Result: Better solutions, faster debugging, fresh perspectives
---
Example
You: "Fix this JWT auth bug"
Claude: Tries token expiry fix → Still failing
Claude: "I've tried one approach without success. Should I consult Gemini for a fresh perspective?"
You: "yes"
Claude: Executes `/consult-gemini` internally
Gemini: Searches web → Finds Cloudflare Workers don't support `process.env` → Suggests `env.JWT_SECRET`
Claude: Synthesizes both analyses → Shows 5-part comparison → Asks permission
You: "proceed"
Claude: Implements fix → ✅ Working
Time saved: 20-30 minutes of trial-and-error
---
Setup
1. Install CLIs
# Gemini (required)
npm install -g @google/generative-ai-cli
export GEMINI_API_KEY="your-key"
# Get key: https://aistudio.google.com/apikey
# Codex (optional)
npm install -g codex
export OPENAI_API_KEY="sk-..."
# Get key: https://platform.openai.com/api-keys2. Install Skill
cd ~/.claude/skills
git clone [this-repo] multi-ai-consultant3. Copy Templates
# In your project root
cp ~/.claude/skills/multi-ai-consultant/templates/GEMINI.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/codex.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/.geminiignore ./4. Test
# Test Gemini
gemini -p "test" && echo "✅ Working"
# Test Codex (if installed)
codex exec "test" --yolo && echo "✅ Working"
# Ask Claude Code
# "I'm stuck on this bug"
# → Should suggest consultation---
Usage
Automatic (Recommended)
Just work normally. Claude Code will suggest consultations when:
- Stuck after one failed attempt
- Making architectural decisions
- Security concerns
Manual
# Specific AI
/consult-gemini Is this JWT implementation secure?
/consult-codex Review this codebase for code smells
/consult-claude Quick sanity check on this approach
# Let Claude choose
/consult-ai How should we structure this microservices architecture?---
Features
✅ Automatic triggers - Suggests consultation when stuck ✅ Forced synthesis - Prevents parroting external AI ✅ Smart context - Selective file inclusion ✅ Cost tracking - Logs every consultation ✅ Privacy protected - Respects .gitignore + .geminiignore ✅ Three AI options - Gemini (web search), Codex (repo-aware), Fresh Claude (free) ✅ Pre-flight checks - Verifies CLIs work before calling ✅ Error handling - Helpful messages for common issues
---
Cost
Typical consultation:
- Gemini: ~$0.10-0.50 (depending on context size)
- Codex: ~$0.05-0.30 (depending on codebase size)
- Fresh Claude: Free
View spending:
consultation-log-parser.sh --summaryEstimated ROI: 20-30 minutes saved per bug = worth the cost
---
Privacy
Automatic protection:
- Both CLIs respect
.gitignore - Never sends
node_modules/,.env*, etc.
Extra protection:
- Create
.geminiignorefor additional exclusions - Claude warns if sensitive files detected
You control:
- Approve before each consultation
- See what context will be sent
- Choose which AI (or decline)
---
Why This Works
Problem: Claude Code sometimes gets stuck in a mental rut or lacks latest info
Solution: External AIs provide:
- Fresh perspective (different reasoning)
- Web research (Gemini's Google Search)
- Repo-aware analysis (Codex's auto-scan)
- Latest documentation (Gemini's grounding)
Result: Better solutions, faster debugging, informed decisions
---
When NOT to Use
❌ Simple bugs you haven't tried fixing yet ❌ Typos or syntax errors ❌ Questions answered by reading docs ❌ Budget is absolute $0 (use Fresh Claude only)
---
Troubleshooting
Gemini not working?
npm install -g @google/generative-ai-cli
export GEMINI_API_KEY="your-key"Codex not working?
npm install -g codex
export OPENAI_API_KEY="sk-..."Skill not discovered?
ls -la ~/.claude/skills/multi-ai-consultant
# Check SKILL.md exists and has YAML frontmatterToo expensive?
- Use Fresh Claude (free) for quick opinions
- Use Gemini only for complex problems
- Check logs:
consultation-log-parser.sh --summary
---
Documentation
- Full docs: See
SKILL.md - Planning: See
planning/multi-ai-consultant-*.md - CLI reference: See
references/ - Examples: See
examples/
---
Contributing
Found an issue? Document in SKILL.md Known Issues
Want to add an AI? Create commands/consult-newai.md
Improving synthesis? Edit templates/GEMINI.md or templates/codex.md
---
License
MIT
---
Last Updated: 2025-11-07 Status: Production Ready Maintainer: Jeremy Dawes | jeremy@jezweb.net
{
"description": "|",
"metadata": {
"allowedTools": "[Bash, Read, Task, Write]",
"license": "MIT"
},
"references": {
"files": [
"references/ai-strengths.md"
]
},
"content": "Consult external AIs for second opinions when Claude Code is stuck or making critical decisions.\r\n\r\n---\r\n\r\n\r\n### 1. Install CLIs\r\n\r\n**Gemini CLI** (required):\r\n```bash\r\nnpm install -g @google/generative-ai-cli\r\nexport GEMINI_API_KEY=\"your-key\"\r\n```\r\n\r\nGet API key: https://aistudio.google.com/apikey\r\n\r\n**Codex CLI** (optional):\r\n```bash\r\nnpm install -g codex\r\nexport OPENAI_API_KEY=\"sk-...\"\r\n```\r\n\r\nGet API key: https://platform.openai.com/api-keys\r\n\r\n**Fresh Claude**: Built-in (uses Task tool, no setup)\r\n\r\n### 2. Install Skill\r\n\r\n```bash\r\ncd ~/.claude/skills\r\ngit clone [this-repo] multi-ai-consultant\r\n```\r\n\r\n### 3. Copy Templates to Project\r\n\r\n```bash\r\ncp ~/.claude/skills/multi-ai-consultant/templates/GEMINI.md ./\r\ncp ~/.claude/skills/multi-ai-consultant/templates/codex.md ./\r\ncp ~/.claude/skills/multi-ai-consultant/templates/.geminiignore ./\r\n\r\ncp ~/.claude/skills/multi-ai-consultant/templates/consultation-log-parser.sh ~/bin/\r\nchmod +x ~/bin/consultation-log-parser.sh\r\n```\r\n\r\n### 4. Verify Installation\r\n\r\n```bash\r\ngemini -p \"test\" && echo \"✅ Gemini working\"\r\n\r\ncodex exec \"test\" --yolo && echo \"✅ Codex working\"\r\n\r\n\r\nEvery consultation is logged to `~/.claude/ai-consultations/consultations.log`\r\n\r\n**Format**:\r\n```csv\r\n2025-11-07T14:23:45-05:00,gemini,gemini-2.5-pro,15420,850,0.1834,/home/user/project\r\n2025-11-07T15:10:22-05:00,codex,gpt-4-turbo,8230,430,0.0952,/home/user/project\r\n2025-11-07T16:05:11-05:00,claude-subagent,claude-sonnet-4-5,0,0,0.00,/home/user/project\r\n```\r\n\r\n**View logs**:\r\n```bash\r\nconsultation-log-parser.sh --summary\r\n\r\n### Automatic Protection\r\n\r\nBoth CLIs respect `.gitignore` automatically. Files in `.gitignore` are never sent.\r\n\r\n### Additional Protection (`.geminiignore`)\r\n\r\nCreate `.geminiignore` in project root for extra exclusions:\r\n```gitignore\r\n*.env*\r\n*secret*\r\n*credentials*\r\n.dev.vars\r\nwrangler.toml\r\n```\r\n\r\n### Pre-Consultation Check\r\n\r\nClaude Code should warn if:\r\n- Sensitive file patterns detected in context\r\n- Not in Git repo (Codex)\r\n- Large context (>100k tokens estimated)\r\n\r\n**Ask permission**: \"About to send context to [AI]. Files include: [list]. Proceed?\"\r\n\r\n### Manual Verification\r\n\r\nBefore consultation, user can check:\r\n```bash\r\nls -la @src/\r\n\r\n\r\n### 1. CLI Not Installed\r\n\r\n**Error**: `gemini: command not found` or `codex: command not found`\r\n\r\n**Fix**:\r\n```bash\r\nnpm install -g @google/generative-ai-cli\r\nnpm install -g codex\r\n```\r\n\r\n**Prevention**: Pre-flight checks in slash commands\r\n\r\n---\r\n\r\n### 2. API Keys Invalid\r\n\r\n**Error**: \"API key invalid\" or authentication failures\r\n\r\n**Fix**:\r\n```bash\r\nexport GEMINI_API_KEY=\"your-key\"\r\nexport OPENAI_API_KEY=\"sk-...\"\r\n\r\n\r\n### Gemini Not Working\r\n\r\n```bash\r\nwhich gemini\r\n\r\necho $GEMINI_API_KEY\r\n\r\ngemini -p \"test\"\r\n\r\ncurl -H \"Content-Type: application/json\" \\\r\n -d '{\"contents\":[{\"parts\":[{\"text\":\"test\"}]}]}' \\\r\n \"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GEMINI_API_KEY\"\r\n```\r\n\r\n### Codex Not Working\r\n\r\n```bash\r\nwhich codex\r\n\r\necho $OPENAI_API_KEY\r\n\r\necho \"test\" | codex exec - --yolo\r\n\r\nopenai api models.list\r\n```\r\n\r\n### Fresh Claude Not Working\r\n\r\n```bash\r\nclaude --version\r\n```\r\n\r\n### Skill Not Discovered\r\n\r\n```bash\r\nls -la ~/.claude/skills/multi-ai-consultant\r\n\r\nhead -20 ~/.claude/skills/multi-ai-consultant/SKILL.md",
"name": "Multi-AI Consultant",
"id": "multi-ai-consultant",
"sections": {
"Slash Commands": "### `/consult-gemini [question]`\r\n\r\n**Use when**: Need web research, latest docs, extended thinking\r\n\r\n**What it does**:\r\n1. Pre-flight check (Gemini CLI working?)\r\n2. Smart context selection based on problem type\r\n3. Execute with locked config: `gemini-2.5-pro --thinking --google-search --grounding`\r\n4. Parse JSON response\r\n5. Synthesize with 5-part format\r\n6. Log cost to `~/.claude/ai-consultations/consultations.log`\r\n\r\n**Example**:\r\n```\r\n/consult-gemini Is this JWT validation secure by 2025 standards?\r\n```\r\n\r\n**Context**: Uses `@<path>` syntax for selective context\r\n\r\n**System instructions**: Auto-loads `GEMINI.md` from project root\r\n\r\n**Privacy**: Respects `.gitignore` + `.geminiignore`\r\n\r\n---\r\n\r\n### `/consult-codex [question]`\r\n\r\n**Use when**: Need repo-aware analysis, code review, OpenAI reasoning\r\n\r\n**What it does**:\r\n1. Pre-flight check (OpenAI API key valid?)\r\n2. `cd` to project directory (Codex scans automatically)\r\n3. Execute with `--yolo` flag: `codex exec - -m gpt-4-turbo --yolo`\r\n4. Parse output from temp file\r\n5. Synthesize with 5-part format\r\n6. Log cost (estimated tokens)\r\n\r\n**Example**:\r\n```\r\n/consult-codex Review this codebase for performance issues\r\n```\r\n\r\n**Context**: Repo-aware (automatically reads all non-gitignored files)\r\n\r\n**System instructions**: Auto-loads `codex.md` from project root or `~/.codex/instructions.md`\r\n\r\n**Privacy**: Respects `.gitignore`, warns if not in Git repo\r\n\r\n---\r\n\r\n### `/consult-claude [question]`\r\n\r\n**Use when**: Quick second opinion, free, fresh perspective\r\n\r\n**What it does**:\r\n1. Gather context with Read tool\r\n2. Build detailed prompt for subagent\r\n3. Launch Task tool (general-purpose subagent)\r\n4. Receive fresh perspective\r\n5. Synthesize with 5-part format\r\n6. Log consultation (free, but tracked)\r\n\r\n**Example**:\r\n```\r\n/consult-claude Am I missing something obvious in this state management bug?\r\n```\r\n\r\n**Context**: You manually read relevant files and pass inline\r\n\r\n**Advantages**: Free, same capabilities, fast, fresh perspective\r\n\r\n**Limitations**: No web search, no extended thinking, same knowledge cutoff\r\n\r\n---\r\n\r\n### `/consult-ai [question]`\r\n\r\n**Use when**: Unsure which AI to use\r\n\r\n**What it does**:\r\n1. Analyze problem type (bug, architecture, security, etc.)\r\n2. Recommend which AI based on needs\r\n3. Ask user to choose\r\n4. Route to appropriate command\r\n\r\n**Example**:\r\n```\r\n/consult-ai How should we structure this microservices architecture?\r\n\r\n→ Recommends Gemini (needs web research for latest patterns)\r\n→ User approves\r\n→ Executes /consult-gemini internally\r\n```\r\n\r\n**Decision factors**:\r\n- Need web research? → Gemini\r\n- Need repo-aware? → Codex\r\n- Need budget-friendly? → Fresh Claude\r\n- Need extended thinking? → Gemini\r\n- Need fresh perspective? → Fresh Claude\r\n\r\n---",
"How It Works": "### Architecture\r\n\r\n```\r\nClaude Code encounters bug/decision\r\n ↓\r\nSuggests consultation (or user requests)\r\n ↓\r\nUser approves\r\n ↓\r\nExecute appropriate slash command\r\n ↓\r\nCLI command calls external AI\r\n ↓\r\nParse response\r\n ↓\r\nSynthesize: Claude's analysis + External AI's analysis\r\n ↓\r\nPresent 5-part comparison\r\n ↓\r\nAsk permission to implement\r\n```\r\n\r\n### The 5-Part Synthesis Format\r\n\r\nEvery consultation must follow this format (prevents parroting):\r\n\r\n1. **🤖 My Analysis** - Claude's original reasoning and attempts\r\n2. **💎/🔷/🔄 Other AI's Analysis** - External AI's complete response\r\n3. **🔍 Key Differences** - Agreement, divergence, what each AI caught/missed\r\n4. **⚡ Synthesis** - Combined perspective, root cause, trade-offs\r\n5. **✅ Recommended Action** - Specific next steps with file paths/line numbers\r\n\r\n**End with**: \"Should I proceed with this approach?\"\r\n\r\n---",
"Why CLI Approach (Not MCP)?": "| Aspect | MCP Server | CLI Approach |\r\n|--------|------------|--------------|\r\n| Setup time | 4-6 hours | 60-75 minutes |\r\n| Complexity | High (MCP protocol) | Low (bash + CLIs) |\r\n| Maintenance | Update MCP SDK | Update CLI (rare) |\r\n| Flexibility | Locked to AIs | Any AI with CLI |\r\n| Debugging | MCP protocol | Standard bash |\r\n| Dependencies | MCP SDK, npm | Just CLIs |\r\n\r\n**Winner**: CLI approach - 80% less effort, same functionality\r\n\r\n---",
"Success Metrics": "### Time Efficiency\r\n- **Without skill**: 30-45 minutes (trial and error)\r\n- **With skill**: 5-10 minutes (consultation + fix)\r\n- **Savings**: ~75%\r\n\r\n### Token Efficiency\r\n- **Without skill**: ~20k tokens (multiple attempts)\r\n- **With skill**: ~8k tokens (one consultation)\r\n- **Savings**: ~60%\r\n\r\n### Error Prevention\r\n- **Manual CLI use**: 3-5 common errors (flags, parsing, privacy)\r\n- **With skill**: 0 errors (all handled by commands)\r\n- **Prevention**: 100%\r\n\r\n### Quality\r\n- **Manual**: Risk of not synthesizing (just copying external AI)\r\n- **With skill**: Forced synthesis via `GEMINI.md`/`codex.md`\r\n- **Improvement**: Guaranteed value-add\r\n\r\n---",
"References": "### External Resources\r\n\r\n- **Gemini CLI**: https://ai.google.dev/gemini-api/docs/cli\r\n- **OpenAI Codex**: https://www.npmjs.com/package/codex\r\n- **OpenAI API**: https://platform.openai.com/docs\r\n- **Gemini API Pricing**: https://ai.google.dev/pricing\r\n- **OpenAI Pricing**: https://openai.com/pricing\r\n\r\n### Internal Files\r\n\r\n- **Planning docs**: `planning/multi-ai-consultant-*.md`\r\n- **Slash commands**: `commands/*.md`\r\n- **Templates**: `templates/*`\r\n- **Scripts**: `scripts/*`\r\n\r\n---",
"The Three AIs": "| AI | Tool | When to Use | Special Features | Cost |\r\n|----|------|-------------|------------------|------|\r\n| **Gemini 2.5 Pro** | `gemini` CLI | Web research, latest docs, thinking | Google Search, extended reasoning, grounding | ~$0.10-0.50 |\r\n| **OpenAI GPT-4** | `codex` CLI | Repo-aware analysis, code review | Auto-scans directory, OpenAI reasoning | ~$0.05-0.30 |\r\n| **Fresh Claude** | Task tool | Quick second opinion, budget-friendly | Same capabilities, fresh perspective | Free |\r\n\r\n---",
"Templates": "### `GEMINI.md` (Project Root)\r\n\r\nSystem instructions for Gemini consultations. Enforces:\r\n- 5-part response format\r\n- Comparison with Claude's analysis\r\n- Web search for latest docs\r\n- Specific code references\r\n- No parroting\r\n\r\n**Auto-loaded**: Place in project root, Gemini CLI reads automatically\r\n\r\n### `codex.md` (Project Root or `~/.codex/instructions.md`)\r\n\r\nSystem instructions for Codex consultations. Enforces:\r\n- 5-part response format\r\n- Repo-aware analysis\r\n- Consistency checks\r\n- Impact assessment\r\n- Specific file references\r\n\r\n**Auto-loaded**: Codex CLI reads from project root or global config\r\n\r\n### `.geminiignore` (Project Root)\r\n\r\nExtra privacy exclusions beyond `.gitignore`. Excludes:\r\n- `.env*` files\r\n- `*secret*`, `*credentials*`\r\n- Build artifacts\r\n- Large media files\r\n- API keys and tokens\r\n\r\n**Auto-loaded**: Gemini CLI respects this file\r\n\r\n### `consultation-log-parser.sh`\r\n\r\nView consultation history:\r\n```bash\r\nconsultation-log-parser.sh # Last 10\r\nconsultation-log-parser.sh --all # All consultations\r\nconsultation-log-parser.sh --summary # Stats only\r\nconsultation-log-parser.sh --ai gemini # Filter by AI\r\n```\r\n\r\n**Log format**: `timestamp,ai,model,input_tokens,output_tokens,cost,project_path`\r\n\r\n---",
"What This Skill Does": "This skill enables **future Claude Code sessions** to consult other AIs when:\r\n- Stuck on a bug after one failed attempt\r\n- Making architectural decisions\r\n- Security concerns need validation\r\n- Fresh perspective needed\r\n\r\n**Key innovation**: Uses existing CLI tools (`gemini`, `codex`) instead of building MCP servers - much simpler and more maintainable.\r\n\r\n---",
"When to Use This Skill": "### Automatic Triggers (No User Action Needed)\r\n\r\nClaude Code should **automatically suggest** using this skill when:\r\n\r\n1. **After 1 failed debugging attempt**\r\n - Tried one approach to fix a bug\r\n - Still not working or different error\r\n - → Suggest: \"Should I consult [Gemini|Fresh Claude] for a second opinion?\"\r\n\r\n2. **Before architectural decisions**\r\n - Significant design choices (state management, routing, data flow)\r\n - Framework selection\r\n - Database schema design\r\n - → Auto-consult (mention to user): \"Consulting Gemini for architectural validation...\"\r\n\r\n3. **Security changes**\r\n - Authentication logic\r\n - Authorization rules\r\n - Cryptography\r\n - Input validation\r\n - → Auto-consult: \"Consulting Gemini to verify security approach...\"\r\n\r\n4. **When uncertain**\r\n - Multiple valid approaches\r\n - Trade-offs not clear\r\n - Conflicting advice in documentation\r\n - → Suggest: \"Would you like me to consult another AI for additional perspective?\"\r\n\r\n### Manual Invocation (User Commands)\r\n\r\nUser can explicitly request consultation with:\r\n- `/consult-gemini [question]` - Gemini 2.5 Pro with thinking, search, grounding\r\n- `/consult-codex [question]` - OpenAI GPT-4 via Codex CLI (repo-aware)\r\n- `/consult-claude [question]` - Fresh Claude subagent (free, fast)\r\n- `/consult-ai [question]` - Router that asks which AI to use\r\n\r\n---",
"Cost Tracking": "```\r\n\r\n**Pricing** (verify current rates):\r\n- Gemini 2.5 Pro: ~$0.000015/input token, ~$0.00006/output token\r\n- GPT-4 Turbo: ~$0.00001/input token, ~$0.00003/output token\r\n- Fresh Claude: Free (same API call)\r\n\r\n---",
"Troubleshooting": "```\r\n\r\n---",
"License": "MIT License - See LICENSE file\r\n\r\n---\r\n\r\n**Last Updated**: 2025-11-07\r\n**Status**: Production Ready\r\n**Maintainer**: Jeremy Dawes | jeremy@jezweb.net | https://jezweb.com.au",
"Token Efficiency": "### Without This Skill\r\n\r\n**Typical scenario** (stuck on bug):\r\n1. Try approach 1 (~4k tokens)\r\n2. Research CLI syntax (~3k tokens)\r\n3. Format response (~2k tokens)\r\n4. Try approach 2 (~4k tokens)\r\n5. Research documentation (~3k tokens)\r\n6. Try approach 3 (~4k tokens)\r\n\r\n**Total**: ~20k tokens, 30-45 minutes\r\n\r\n### With This Skill\r\n\r\n**Same scenario**:\r\n1. Try approach 1 (~4k tokens)\r\n2. Execute `/consult-gemini` (~1k tokens to execute)\r\n3. Gemini finds issue (billed separately, but <5k tokens)\r\n4. Implement fix (~3k tokens)\r\n\r\n**Total**: ~8k tokens, 5-10 minutes\r\n\r\n**Savings**: ~60% tokens, ~75% time\r\n\r\n**Value**: Gemini's web search finds issue Claude couldn't\r\n\r\n---",
"Privacy & Security": "git status --ignored\r\n```\r\n\r\n---",
"Contributing": "**Found an issue?**\r\n- Document it in Known Issues section\r\n- Include fix/workaround\r\n- Update slash commands to prevent\r\n\r\n**Adding new AI?**\r\n- Create new slash command: `commands/consult-newai.md`\r\n- Add to router: Update `commands/consult-ai.md`\r\n- Create template: `templates/newai.md` (if CLI supports system instructions)\r\n- Update documentation\r\n\r\n**Improving synthesis?**\r\n- Edit templates: `templates/GEMINI.md`, `templates/codex.md`\r\n- Test with real consultations\r\n- Measure before/after quality\r\n\r\n---",
"Known Issues & Solutions": "echo 'export GEMINI_API_KEY=\"your-key\"' >> ~/.bashrc\r\nsource ~/.bashrc\r\n```\r\n\r\n**Prevention**: Pre-flight checks test API before consultation\r\n\r\n---\r\n\r\n### 3. Context Too Large\r\n\r\n**Error**: Token limit exceeded or very expensive consultation\r\n\r\n**Fix**: Use smart context selection\r\n- Bug: Just buggy file + imports (not entire codebase)\r\n- Architecture: Relevant directories only\r\n- Use `@path/to/specific/file.ts` not `@.`\r\n\r\n**Prevention**: Slash commands guide smart context selection\r\n\r\n---\r\n\r\n### 4. Privacy Leaks\r\n\r\n**Risk**: Accidentally sending `.env` or secrets\r\n\r\n**Fix**:\r\n- Both CLIs respect `.gitignore` (automatic)\r\n- Create `.geminiignore` for extra protection\r\n- Claude warns if sensitive patterns detected\r\n\r\n**Prevention**: Always check `.gitignore` is configured\r\n\r\n---\r\n\r\n### 5. Cost Overruns\r\n\r\n**Issue**: Expensive consultations accumulating\r\n\r\n**Fix**:\r\n- Check logs: `consultation-log-parser.sh --summary`\r\n- Use Fresh Claude for quick questions (free)\r\n- Use smart context (specific files, not entire repo)\r\n\r\n**Prevention**: Cost tracking + warnings for large context\r\n\r\n---\r\n\r\n### 6. Codex Hanging\r\n\r\n**Error**: `codex exec` hangs waiting for approval\r\n\r\n**Fix**: Always use `--yolo` flag\r\n\r\n**Prevention**: Slash command includes `--yolo` by default (hard to miss)\r\n\r\n---\r\n\r\n### 7. JSON Parsing Fails (Gemini)\r\n\r\n**Error**: `jq: parse error`\r\n\r\n**Fix**: Check exit code before parsing, fall back to plain text\r\n\r\n**Prevention**: Slash command checks exit code first\r\n\r\n---\r\n\r\n### 8. Not in Git Repo (Codex)\r\n\r\n**Warning**: Codex warns if not in Git repo (safety feature)\r\n\r\n**Fix**: Add `--skip-git-repo-check` flag if appropriate\r\n\r\n**Prevention**: Slash command includes flag\r\n\r\n---",
"Usage Examples": "### Example 1: Stuck on Bug\r\n\r\n**Scenario**: JWT authentication failing after one attempt\r\n\r\n**Claude's process**:\r\n```\r\n1. Try initial fix (token expiry check)\r\n2. Still failing (now \"invalid signature\" error)\r\n3. → Automatically suggest consultation\r\n4. User approves\r\n5. Execute /consult-gemini with:\r\n - Problem: 401 error details\r\n - What was tried: token expiry fix\r\n - Current status: invalid signature error\r\n - Context: @src/auth/session.ts @src/middleware/jwt.ts\r\n6. Gemini finds: Using process.env instead of env binding (Cloudflare)\r\n7. Synthesize both perspectives\r\n8. Ask permission to implement Gemini's fix\r\n```\r\n\r\n**Result**: Bug fixed with second opinion, avoided 2-3 more trial-and-error attempts\r\n\r\n### Example 2: Architecture Decision\r\n\r\n**Scenario**: Choosing state management for new feature\r\n\r\n**Claude's process**:\r\n```\r\n1. User asks: \"How should we handle state for this feature?\"\r\n2. → Auto-consult Gemini (architectural decision)\r\n3. Execute /consult-gemini with:\r\n - Problem: State management choice\r\n - Options considered: Redux, Zustand, Context\r\n - Context: @src/ (existing patterns)\r\n4. Gemini searches for latest React state management best practices\r\n5. Synthesize Claude's + Gemini's analysis\r\n6. Present recommendation with trade-offs\r\n```\r\n\r\n**Result**: Informed decision with latest best practices\r\n\r\n### Example 3: Manual Consultation\r\n\r\n**User**: \"I want a second opinion on this refactoring\"\r\n\r\n**Claude's process**:\r\n```\r\n1. User explicitly requests consultation\r\n2. Ask which AI: Gemini, Codex, or Fresh Claude?\r\n3. User chooses Codex (wants repo-aware analysis)\r\n4. Execute /consult-codex with:\r\n - Problem: Refactoring proposal\r\n - Context: (Codex scans repo automatically)\r\n5. Codex checks consistency with existing code\r\n6. Synthesize both perspectives\r\n7. Present recommendation\r\n```\r\n\r\n**Result**: Validation of refactoring approach + consistency check\r\n\r\n---",
"Setup Instructions": "```\r\n\r\n---"
}
}---
name: Multi-AI Consultant
description: |
Consult external AIs (Gemini 2.5 Pro, OpenAI Codex, fresh Claude) for second opinions when stuck on bugs or making architectural decisions. Use when: debugging attempts have failed, making significant architectural choices, security concerns, or need fresh perspective. Automatically suggests consultation after one failed attempt. Provides synthesis comparing multiple AI perspectives with web research, thinking mode, and repo-aware analysis.
license: MIT
allowed-tools: [Bash, Read, Task, Write]
metadata:
version: 1.0.0
author: Jeremy Dawes | Jezweb
last-verified: 2025-11-07
production-tested: true
keywords:
- ai consultation
- second opinion
- gemini
- openai
- codex
- debugging
- architecture
- multi-ai
- synthesis
- fresh perspective
- stuck
- web research
- thinking mode
- repo-aware
---
# Multi-AI Consultant
Consult external AIs for second opinions when Claude Code is stuck or making critical decisions.
---
## What This Skill Does
This skill enables **future Claude Code sessions** to consult other AIs when:
- Stuck on a bug after one failed attempt
- Making architectural decisions
- Security concerns need validation
- Fresh perspective needed
**Key innovation**: Uses existing CLI tools (`gemini`, `codex`) instead of building MCP servers - much simpler and more maintainable.
---
## When to Use This Skill
### Automatic Triggers (No User Action Needed)
Claude Code should **automatically suggest** using this skill when:
1. **After 1 failed debugging attempt**
- Tried one approach to fix a bug
- Still not working or different error
- → Suggest: "Should I consult [Gemini|Fresh Claude] for a second opinion?"
2. **Before architectural decisions**
- Significant design choices (state management, routing, data flow)
- Framework selection
- Database schema design
- → Auto-consult (mention to user): "Consulting Gemini for architectural validation..."
3. **Security changes**
- Authentication logic
- Authorization rules
- Cryptography
- Input validation
- → Auto-consult: "Consulting Gemini to verify security approach..."
4. **When uncertain**
- Multiple valid approaches
- Trade-offs not clear
- Conflicting advice in documentation
- → Suggest: "Would you like me to consult another AI for additional perspective?"
### Manual Invocation (User Commands)
User can explicitly request consultation with:
- `/consult-gemini [question]` - Gemini 2.5 Pro with thinking, search, grounding
- `/consult-codex [question]` - OpenAI GPT-4 via Codex CLI (repo-aware)
- `/consult-claude [question]` - Fresh Claude subagent (free, fast)
- `/consult-ai [question]` - Router that asks which AI to use
---
## The Three AIs
| AI | Tool | When to Use | Special Features | Cost |
|----|------|-------------|------------------|------|
| **Gemini 2.5 Pro** | `gemini` CLI | Web research, latest docs, thinking | Google Search, extended reasoning, grounding | ~$0.10-0.50 |
| **OpenAI GPT-4** | `codex` CLI | Repo-aware analysis, code review | Auto-scans directory, OpenAI reasoning | ~$0.05-0.30 |
| **Fresh Claude** | Task tool | Quick second opinion, budget-friendly | Same capabilities, fresh perspective | Free |
---
## How It Works
### Architecture
```
Claude Code encounters bug/decision
↓
Suggests consultation (or user requests)
↓
User approves
↓
Execute appropriate slash command
↓
CLI command calls external AI
↓
Parse response
↓
Synthesize: Claude's analysis + External AI's analysis
↓
Present 5-part comparison
↓
Ask permission to implement
```
### The 5-Part Synthesis Format
Every consultation must follow this format (prevents parroting):
1. **🤖 My Analysis** - Claude's original reasoning and attempts
2. **💎/🔷/🔄 Other AI's Analysis** - External AI's complete response
3. **🔍 Key Differences** - Agreement, divergence, what each AI caught/missed
4. **⚡ Synthesis** - Combined perspective, root cause, trade-offs
5. **✅ Recommended Action** - Specific next steps with file paths/line numbers
**End with**: "Should I proceed with this approach?"
---
## Setup Instructions
### 1. Install CLIs
**Gemini CLI** (required):
```bash
npm install -g @google/generative-ai-cli
export GEMINI_API_KEY="your-key"
```
Get API key: https://aistudio.google.com/apikey
**Codex CLI** (optional):
```bash
npm install -g codex
export OPENAI_API_KEY="sk-..."
```
Get API key: https://platform.openai.com/api-keys
**Fresh Claude**: Built-in (uses Task tool, no setup)
### 2. Install Skill
```bash
cd ~/.claude/skills
git clone [this-repo] multi-ai-consultant
# OR symlink from development location
```
### 3. Copy Templates to Project
```bash
# Copy to project root
cp ~/.claude/skills/multi-ai-consultant/templates/GEMINI.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/codex.md ./
cp ~/.claude/skills/multi-ai-consultant/templates/.geminiignore ./
# Copy log parser (optional)
cp ~/.claude/skills/multi-ai-consultant/templates/consultation-log-parser.sh ~/bin/
chmod +x ~/bin/consultation-log-parser.sh
```
### 4. Verify Installation
```bash
# Test Gemini CLI
gemini -p "test" && echo "✅ Gemini working"
# Test Codex CLI (if installed)
codex exec "test" --yolo && echo "✅ Codex working"
# Test skill discovery
# Ask Claude Code: "I'm stuck on this bug, can you help?"
# Claude should suggest consultation
```
---
## Usage Examples
### Example 1: Stuck on Bug
**Scenario**: JWT authentication failing after one attempt
**Claude's process**:
```
1. Try initial fix (token expiry check)
2. Still failing (now "invalid signature" error)
3. → Automatically suggest consultation
4. User approves
5. Execute /consult-gemini with:
- Problem: 401 error details
- What was tried: token expiry fix
- Current status: invalid signature error
- Context: @src/auth/session.ts @src/middleware/jwt.ts
6. Gemini finds: Using process.env instead of env binding (Cloudflare)
7. Synthesize both perspectives
8. Ask permission to implement Gemini's fix
```
**Result**: Bug fixed with second opinion, avoided 2-3 more trial-and-error attempts
### Example 2: Architecture Decision
**Scenario**: Choosing state management for new feature
**Claude's process**:
```
1. User asks: "How should we handle state for this feature?"
2. → Auto-consult Gemini (architectural decision)
3. Execute /consult-gemini with:
- Problem: State management choice
- Options considered: Redux, Zustand, Context
- Context: @src/ (existing patterns)
4. Gemini searches for latest React state management best practices
5. Synthesize Claude's + Gemini's analysis
6. Present recommendation with trade-offs
```
**Result**: Informed decision with latest best practices
### Example 3: Manual Consultation
**User**: "I want a second opinion on this refactoring"
**Claude's process**:
```
1. User explicitly requests consultation
2. Ask which AI: Gemini, Codex, or Fresh Claude?
3. User chooses Codex (wants repo-aware analysis)
4. Execute /consult-codex with:
- Problem: Refactoring proposal
- Context: (Codex scans repo automatically)
5. Codex checks consistency with existing code
6. Synthesize both perspectives
7. Present recommendation
```
**Result**: Validation of refactoring approach + consistency check
---
## Slash Commands
### `/consult-gemini [question]`
**Use when**: Need web research, latest docs, extended thinking
**What it does**:
1. Pre-flight check (Gemini CLI working?)
2. Smart context selection based on problem type
3. Execute with locked config: `gemini-2.5-pro --thinking --google-search --grounding`
4. Parse JSON response
5. Synthesize with 5-part format
6. Log cost to `~/.claude/ai-consultations/consultations.log`
**Example**:
```
/consult-gemini Is this JWT validation secure by 2025 standards?
```
**Context**: Uses `@<path>` syntax for selective context
**System instructions**: Auto-loads `GEMINI.md` from project root
**Privacy**: Respects `.gitignore` + `.geminiignore`
---
### `/consult-codex [question]`
**Use when**: Need repo-aware analysis, code review, OpenAI reasoning
**What it does**:
1. Pre-flight check (OpenAI API key valid?)
2. `cd` to project directory (Codex scans automatically)
3. Execute with `--yolo` flag: `codex exec - -m gpt-4-turbo --yolo`
4. Parse output from temp file
5. Synthesize with 5-part format
6. Log cost (estimated tokens)
**Example**:
```
/consult-codex Review this codebase for performance issues
```
**Context**: Repo-aware (automatically reads all non-gitignored files)
**System instructions**: Auto-loads `codex.md` from project root or `~/.codex/instructions.md`
**Privacy**: Respects `.gitignore`, warns if not in Git repo
---
### `/consult-claude [question]`
**Use when**: Quick second opinion, free, fresh perspective
**What it does**:
1. Gather context with Read tool
2. Build detailed prompt for subagent
3. Launch Task tool (general-purpose subagent)
4. Receive fresh perspective
5. Synthesize with 5-part format
6. Log consultation (free, but tracked)
**Example**:
```
/consult-claude Am I missing something obvious in this state management bug?
```
**Context**: You manually read relevant files and pass inline
**Advantages**: Free, same capabilities, fast, fresh perspective
**Limitations**: No web search, no extended thinking, same knowledge cutoff
---
### `/consult-ai [question]`
**Use when**: Unsure which AI to use
**What it does**:
1. Analyze problem type (bug, architecture, security, etc.)
2. Recommend which AI based on needs
3. Ask user to choose
4. Route to appropriate command
**Example**:
```
/consult-ai How should we structure this microservices architecture?
→ Recommends Gemini (needs web research for latest patterns)
→ User approves
→ Executes /consult-gemini internally
```
**Decision factors**:
- Need web research? → Gemini
- Need repo-aware? → Codex
- Need budget-friendly? → Fresh Claude
- Need extended thinking? → Gemini
- Need fresh perspective? → Fresh Claude
---
## Templates
### `GEMINI.md` (Project Root)
System instructions for Gemini consultations. Enforces:
- 5-part response format
- Comparison with Claude's analysis
- Web search for latest docs
- Specific code references
- No parroting
**Auto-loaded**: Place in project root, Gemini CLI reads automatically
### `codex.md` (Project Root or `~/.codex/instructions.md`)
System instructions for Codex consultations. Enforces:
- 5-part response format
- Repo-aware analysis
- Consistency checks
- Impact assessment
- Specific file references
**Auto-loaded**: Codex CLI reads from project root or global config
### `.geminiignore` (Project Root)
Extra privacy exclusions beyond `.gitignore`. Excludes:
- `.env*` files
- `*secret*`, `*credentials*`
- Build artifacts
- Large media files
- API keys and tokens
**Auto-loaded**: Gemini CLI respects this file
### `consultation-log-parser.sh`
View consultation history:
```bash
consultation-log-parser.sh # Last 10
consultation-log-parser.sh --all # All consultations
consultation-log-parser.sh --summary # Stats only
consultation-log-parser.sh --ai gemini # Filter by AI
```
**Log format**: `timestamp,ai,model,input_tokens,output_tokens,cost,project_path`
---
## Cost Tracking
Every consultation is logged to `~/.claude/ai-consultations/consultations.log`
**Format**:
```csv
2025-11-07T14:23:45-05:00,gemini,gemini-2.5-pro,15420,850,0.1834,/home/user/project
2025-11-07T15:10:22-05:00,codex,gpt-4-turbo,8230,430,0.0952,/home/user/project
2025-11-07T16:05:11-05:00,claude-subagent,claude-sonnet-4-5,0,0,0.00,/home/user/project
```
**View logs**:
```bash
consultation-log-parser.sh --summary
# Total consultations: 47
# Gemini: 23, Codex: 12, Fresh Claude: 12
# Total cost: $8.45
```
**Pricing** (verify current rates):
- Gemini 2.5 Pro: ~$0.000015/input token, ~$0.00006/output token
- GPT-4 Turbo: ~$0.00001/input token, ~$0.00003/output token
- Fresh Claude: Free (same API call)
---
## Privacy & Security
### Automatic Protection
Both CLIs respect `.gitignore` automatically. Files in `.gitignore` are never sent.
### Additional Protection (`.geminiignore`)
Create `.geminiignore` in project root for extra exclusions:
```gitignore
*.env*
*secret*
*credentials*
.dev.vars
wrangler.toml
```
### Pre-Consultation Check
Claude Code should warn if:
- Sensitive file patterns detected in context
- Not in Git repo (Codex)
- Large context (>100k tokens estimated)
**Ask permission**: "About to send context to [AI]. Files include: [list]. Proceed?"
### Manual Verification
Before consultation, user can check:
```bash
# What will be sent to Gemini
ls -la @src/
# Check gitignore is working
git status --ignored
```
---
## Known Issues & Solutions
### 1. CLI Not Installed
**Error**: `gemini: command not found` or `codex: command not found`
**Fix**:
```bash
npm install -g @google/generative-ai-cli
npm install -g codex
```
**Prevention**: Pre-flight checks in slash commands
---
### 2. API Keys Invalid
**Error**: "API key invalid" or authentication failures
**Fix**:
```bash
export GEMINI_API_KEY="your-key"
export OPENAI_API_KEY="sk-..."
# Or add to ~/.bashrc
echo 'export GEMINI_API_KEY="your-key"' >> ~/.bashrc
source ~/.bashrc
```
**Prevention**: Pre-flight checks test API before consultation
---
### 3. Context Too Large
**Error**: Token limit exceeded or very expensive consultation
**Fix**: Use smart context selection
- Bug: Just buggy file + imports (not entire codebase)
- Architecture: Relevant directories only
- Use `@path/to/specific/file.ts` not `@.`
**Prevention**: Slash commands guide smart context selection
---
### 4. Privacy Leaks
**Risk**: Accidentally sending `.env` or secrets
**Fix**:
- Both CLIs respect `.gitignore` (automatic)
- Create `.geminiignore` for extra protection
- Claude warns if sensitive patterns detected
**Prevention**: Always check `.gitignore` is configured
---
### 5. Cost Overruns
**Issue**: Expensive consultations accumulating
**Fix**:
- Check logs: `consultation-log-parser.sh --summary`
- Use Fresh Claude for quick questions (free)
- Use smart context (specific files, not entire repo)
**Prevention**: Cost tracking + warnings for large context
---
### 6. Codex Hanging
**Error**: `codex exec` hangs waiting for approval
**Fix**: Always use `--yolo` flag
**Prevention**: Slash command includes `--yolo` by default (hard to miss)
---
### 7. JSON Parsing Fails (Gemini)
**Error**: `jq: parse error`
**Fix**: Check exit code before parsing, fall back to plain text
**Prevention**: Slash command checks exit code first
---
### 8. Not in Git Repo (Codex)
**Warning**: Codex warns if not in Git repo (safety feature)
**Fix**: Add `--skip-git-repo-check` flag if appropriate
**Prevention**: Slash command includes flag
---
## Token Efficiency
### Without This Skill
**Typical scenario** (stuck on bug):
1. Try approach 1 (~4k tokens)
2. Research CLI syntax (~3k tokens)
3. Format response (~2k tokens)
4. Try approach 2 (~4k tokens)
5. Research documentation (~3k tokens)
6. Try approach 3 (~4k tokens)
**Total**: ~20k tokens, 30-45 minutes
### With This Skill
**Same scenario**:
1. Try approach 1 (~4k tokens)
2. Execute `/consult-gemini` (~1k tokens to execute)
3. Gemini finds issue (billed separately, but <5k tokens)
4. Implement fix (~3k tokens)
**Total**: ~8k tokens, 5-10 minutes
**Savings**: ~60% tokens, ~75% time
**Value**: Gemini's web search finds issue Claude couldn't
---
## Success Metrics
### Time Efficiency
- **Without skill**: 30-45 minutes (trial and error)
- **With skill**: 5-10 minutes (consultation + fix)
- **Savings**: ~75%
### Token Efficiency
- **Without skill**: ~20k tokens (multiple attempts)
- **With skill**: ~8k tokens (one consultation)
- **Savings**: ~60%
### Error Prevention
- **Manual CLI use**: 3-5 common errors (flags, parsing, privacy)
- **With skill**: 0 errors (all handled by commands)
- **Prevention**: 100%
### Quality
- **Manual**: Risk of not synthesizing (just copying external AI)
- **With skill**: Forced synthesis via `GEMINI.md`/`codex.md`
- **Improvement**: Guaranteed value-add
---
## Why CLI Approach (Not MCP)?
| Aspect | MCP Server | CLI Approach |
|--------|------------|--------------|
| Setup time | 4-6 hours | 60-75 minutes |
| Complexity | High (MCP protocol) | Low (bash + CLIs) |
| Maintenance | Update MCP SDK | Update CLI (rare) |
| Flexibility | Locked to AIs | Any AI with CLI |
| Debugging | MCP protocol | Standard bash |
| Dependencies | MCP SDK, npm | Just CLIs |
**Winner**: CLI approach - 80% less effort, same functionality
---
## Troubleshooting
### Gemini Not Working
```bash
# Check CLI installed
which gemini
# Check API key set
echo $GEMINI_API_KEY
# Test manually
gemini -p "test"
# Check API key valid
curl -H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"test"}]}]}' \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GEMINI_API_KEY"
```
### Codex Not Working
```bash
# Check CLI installed
which codex
# Check API key set (if using API key auth)
echo $OPENAI_API_KEY
# Test manually
echo "test" | codex exec - --yolo
# Check OpenAI API (if installed)
openai api models.list
```
### Fresh Claude Not Working
```bash
# Fresh Claude uses Task tool (built-in)
# If Task tool fails, check Claude Code CLI status
claude --version
```
### Skill Not Discovered
```bash
# Check skill installed
ls -la ~/.claude/skills/multi-ai-consultant
# Check SKILL.md has YAML frontmatter
head -20 ~/.claude/skills/multi-ai-consultant/SKILL.md
# Ask Claude Code to list skills
# It should mention multi-ai-consultant
```
---
## Contributing
**Found an issue?**
- Document it in Known Issues section
- Include fix/workaround
- Update slash commands to prevent
**Adding new AI?**
- Create new slash command: `commands/consult-newai.md`
- Add to router: Update `commands/consult-ai.md`
- Create template: `templates/newai.md` (if CLI supports system instructions)
- Update documentation
**Improving synthesis?**
- Edit templates: `templates/GEMINI.md`, `templates/codex.md`
- Test with real consultations
- Measure before/after quality
---
## References
### External Resources
- **Gemini CLI**: https://ai.google.dev/gemini-api/docs/cli
- **OpenAI Codex**: https://www.npmjs.com/package/codex
- **OpenAI API**: https://platform.openai.com/docs
- **Gemini API Pricing**: https://ai.google.dev/pricing
- **OpenAI Pricing**: https://openai.com/pricing
### Internal Files
- **Planning docs**: `planning/multi-ai-consultant-*.md`
- **Slash commands**: `commands/*.md`
- **Templates**: `templates/*`
- **Scripts**: `scripts/*`
---
## License
MIT License - See LICENSE file
---
**Last Updated**: 2025-11-07
**Status**: Production Ready
**Maintainer**: Jeremy Dawes | jeremy@jezweb.net | https://jezweb.com.au