Skip to content

Commit d0c9740

Browse files
committed
ai(claude[commands]) Add agent CLI fallback and rename Codex to GPT
why: The agent CLI (Cursor) can access Gemini and GPT models via --model flag, providing a fallback when native gemini/codex binaries are missing. Renaming "Codex" to "GPT" decouples the reviewer identity from the specific CLI tool used to reach the model family. what: - Add Bash(agent:*) to allowed-tools in review.md - Add agent detection to Phase 2 reviewer discovery - Add fallback resolution table: native CLI → agent --model → unavailable - Add agent -p -f fallback commands for Gemini and GPT reviewers - Rename "Codex" reviewer slot to "GPT" throughout review.md and solve.md
1 parent 15d8e4a commit d0c9740

2 files changed

Lines changed: 60 additions & 26 deletions

File tree

.claude/commands/multi-model/review.md

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
description: Multi-model code review — runs Claude, Gemini, and Codex reviews in parallel, then synthesizes findings
3-
allowed-tools: Bash(git diff:*), Bash(git log:*), Bash(git branch:*), Bash(git status:*), Bash(git remote:*), Bash(gemini:*), Bash(codex:*), Bash(which:*), Read, Grep, Glob, Task
2+
description: Multi-model code review — runs Claude, Gemini, and GPT reviews in parallel, then synthesizes findings
3+
allowed-tools: Bash(git diff:*), Bash(git log:*), Bash(git branch:*), Bash(git status:*), Bash(git remote:*), Bash(gemini:*), Bash(codex:*), Bash(agent:*), Bash(which:*), Read, Grep, Glob, Task
44
---
55

66
# Multi-Model Code Review
77

8-
Run code review using up to three AI models (Claude, Gemini, Codex) in parallel, then synthesize their findings into a unified report with consensus-weighted confidence.
8+
Run code review using up to three AI models (Claude, Gemini, GPT) in parallel, then synthesize their findings into a unified report with consensus-weighted confidence.
99

1010
---
1111

@@ -35,21 +35,32 @@ Run code review using up to three AI models (Claude, Gemini, Codex) in parallel,
3535

3636
## Phase 2: Detect Available Reviewers
3737

38-
**Goal**: Check which AI CLI tools are installed locally.
38+
**Goal**: Check which AI CLI tools are installed locally and resolve each reviewer slot.
3939

4040
Run these checks in parallel:
4141

4242
```bash
4343
which gemini 2>/dev/null && echo "gemini:available" || echo "gemini:missing"
4444
which codex 2>/dev/null && echo "codex:available" || echo "codex:missing"
45+
which agent 2>/dev/null && echo "agent:available" || echo "agent:missing"
4546
```
4647

47-
Claude (this agent) is always available. Build a list of available reviewers:
48-
- **Claude** — always available
49-
- **Gemini** — available if `gemini` binary is found
50-
- **Codex** — available if `codex` binary is found
48+
### Reviewer resolution (priority order)
5149

52-
Report which reviewers will participate. If only Claude is available, proceed with Claude-only review and note the missing tools.
50+
Each reviewer slot is resolved independently using a **native CLI first, `agent` fallback** strategy:
51+
52+
| Slot | Priority 1 (native) | Priority 2 (agent fallback) | Agent model |
53+
|------|---------------------|-----------------------------|-------------|
54+
| **Claude** | Always available (this agent) |||
55+
| **Gemini** | `gemini` binary | `agent --model gemini-3-pro` | `gemini-3-pro` |
56+
| **GPT** | `codex` binary | `agent --model gpt-5.2` | `gpt-5.2` |
57+
58+
**Resolution logic** for each external slot:
59+
1. If the native CLI is found → use it (direct API, fewer layers)
60+
2. Else if `agent` is found → use `agent` with the corresponding `--model` flag
61+
3. Else → slot is unavailable, note in report
62+
63+
Report which reviewers will participate and which backend is used (native or agent fallback). If only Claude is available, proceed with Claude-only review and note the missing tools.
5364

5465
---
5566

@@ -84,41 +95,64 @@ Launch a Task agent with `subagent_type: "general-purpose"` to perform Claude's
8495
8596
### Gemini Review (if available)
8697

87-
Run Gemini CLI in non-interactive mode. Execute via Bash:
98+
Use the resolved backend from Phase 2. The review prompt is the same regardless of backend.
99+
100+
**Review prompt** (used by both backends):
101+
> You are a code reviewer. Analyze the changes since the trunk in this branch, consider AGENTS.md.
102+
>
103+
> Run git diff origin/<trunk>...HEAD to see the changes. Read AGENTS.md or CLAUDE.md for project conventions.
104+
>
105+
> For each issue, report: severity (Critical/Important/Suggestion), file and line, description, and recommendation. Focus on bugs, logic errors, security issues, and convention violations.
106+
107+
**Native (`gemini` CLI)**:
88108

89109
```bash
90-
gemini -p "You are a code reviewer. Analyze the changes since the trunk in this branch, consider AGENTS.md.
110+
timeout 300 gemini -p "<review prompt>"
111+
```
91112

92-
Run git diff origin/<trunk>...HEAD to see the changes. Read AGENTS.md or CLAUDE.md for project conventions.
113+
**Fallback (`agent` CLI)**:
93114

94-
For each issue, report: severity (Critical/Important/Suggestion), file and line, description, and recommendation. Focus on bugs, logic errors, security issues, and convention violations."
115+
```bash
116+
timeout 300 agent -p -f --model gemini-3-pro "<review prompt>"
95117
```
96118

97119
**Important**: Use the actual trunk branch name detected in Phase 1 in the prompt. Capture the full stdout output.
98120

99-
### Codex Review (if available)
121+
### GPT Review (if available)
122+
123+
Use the resolved backend from Phase 2. The review prompt is the same regardless of backend.
100124

101-
Run Codex CLI with full sandbox access. Execute via Bash:
125+
**Review prompt** (used by both backends):
126+
> You are a code reviewer. Analyze the changes since the trunk in this branch, consider AGENTS.md.
127+
>
128+
> Run git diff origin/<trunk>...HEAD to see the changes. Read AGENTS.md or CLAUDE.md for project conventions.
129+
>
130+
> For each issue, report: severity (Critical/Important/Suggestion), file and line, description, and recommendation. Focus on bugs, logic errors, security issues, and convention violations.
131+
132+
**Native (`codex` CLI)**:
102133

103134
```bash
104-
codex \
135+
timeout 300 codex \
105136
--sandbox danger-full-access \
106137
--ask-for-approval never \
107138
-c model_reasoning_effort=medium \
108-
exec "You are a code reviewer - Analyze the changes since the trunk in this branch, consider AGENTS.md.
139+
exec "<review prompt>"
140+
```
109141

110-
Run git diff origin/<trunk>...HEAD to see the changes. Read AGENTS.md or CLAUDE.md for project conventions.
142+
**Fallback (`agent` CLI)**:
111143

112-
For each issue, report: severity (Critical/Important/Suggestion), file and line, description, and recommendation. Focus on bugs, logic errors, security issues, and convention violations."
144+
```bash
145+
timeout 300 agent -p -f --model gpt-5.2 "<review prompt>"
113146
```
114147

115148
**Important**: Use the actual trunk branch name detected in Phase 1 in the prompt. Capture the full stdout output.
116149

117150
### Execution Strategy
118151

119-
- Launch the Claude Task agent and the Gemini/Codex Bash commands in parallel where possible.
152+
- Launch the Claude Task agent and the Gemini/GPT Bash commands in parallel where possible.
153+
- Use whichever backend was resolved in Phase 2 for each slot.
120154
- If a reviewer fails (timeout, crash, API error), note the failure and continue with the remaining reviewers.
121-
- Set a 5-minute timeout for Gemini and Codex commands (`timeout 300`).
155+
- Set a 5-minute timeout for external CLI commands (`timeout 300`).
122156

123157
---
124158

@@ -152,15 +186,15 @@ Present the synthesized report in this format:
152186
```markdown
153187
# Multi-Model Code Review Report
154188

155-
**Reviewers**: Claude, Gemini, Codex (or whichever participated)
189+
**Reviewers**: Claude, Gemini, GPT (or whichever participated)
156190
**Branch**: <branch-name>
157191
**Compared against**: origin/<trunk>
158192
**Files changed**: <count>
159193

160194
## Consensus Issues (flagged by multiple reviewers)
161195

162196
### Critical
163-
- [Claude + Gemini + Codex] **file.py:42** — Description of issue
197+
- [Claude + Gemini + GPT] **file.py:42** — Description of issue
164198
- Recommendation: ...
165199

166200
### Important
@@ -178,7 +212,7 @@ Present the synthesized report in this format:
178212
- Recommendation: ...
179213

180214
### Suggestions
181-
- [Codex] **file.py:55** — Description
215+
- [GPT] **file.py:55** — Description
182216
- Recommendation: ...
183217

184218
## Reviewer Disagreements
@@ -190,7 +224,7 @@ List any cases where reviewers explicitly contradicted each other, noting both p
190224
- **Total issues**: X
191225
- **Consensus issues**: Y (flagged by 2+ reviewers)
192226
- **Critical**: Z
193-
- **Reviewers participated**: Claude, Gemini, Codex
227+
- **Reviewers participated**: Claude, Gemini, GPT
194228
- **Reviewers unavailable/failed**: (if any)
195229
```
196230

.claude/commands/multi-model/solve.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Process multi-model code review findings from the conversation context. Validate
2020
2. **Extract each finding** into a numbered list with:
2121
- **Consensus level**: how many reviewers flagged it (3, 2, or 1)
2222
- **Severity**: Critical / Important / Suggestion (after consensus promotion)
23-
- **Reviewers**: which models flagged it (Claude, Gemini, Codex)
23+
- **Reviewers**: which models flagged it (Claude, Gemini, GPT)
2424
- **File and line**: location in the codebase
2525
- **Description**: what the issue is
2626
- **Recommendation**: suggested fix

0 commit comments

Comments
 (0)