Skip to content

Commit 5e93701

Browse files
recuu-pfegclaude
andcommitted
fix: Reviewer prompt — strict 3-turn workflow, reduce max-turns to 5
Reviewer was hitting turn limits by exploring the codebase. New prompt forces a strict workflow: - Turn 1: git diff --stat + npm test - Turn 2-3: quick analysis - Turn 3: output COMPLETION_JSON immediately Reduced max-turns from 10 to 5. If verdict not output by then, fallback NEEDS_CHANGES is used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent be7c81b commit 5e93701

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

src/agent-templates.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,25 +227,30 @@ COMPLETION_JSON:{"review_comment":"<your strategic analysis and recommendations>
227227
post_actions: [],
228228
prompt: {
229229
mode_header: "## REVIEW MODE — Analyze code changes, run tests, report verdict. Do NOT modify any files.",
230-
completion: `You are reviewing code changes for a task. Your job:
230+
completion: `You are reviewing code changes for a task. You have LIMITED TURNS — be fast and direct.
231231
232-
1. Run: git diff {{diffRef}} to see the changes
233-
2. Read relevant source files for context
234-
3. Run: npm test (check if tests pass)
235-
4. Evaluate against the criteria below
232+
## Step 1 (Turn 1): Run these two commands immediately
233+
- git diff {{diffRef}} --stat
234+
- npm test 2>&1 | tail -20
235+
236+
## Step 2 (Turn 2-3): Quick analysis
237+
- If tests failed → verdict is NEEDS_CHANGES, skip to Step 3
238+
- If diff is empty or metadata-only → verdict is NEEDS_CHANGES, skip to Step 3
239+
- Glance at changed files — do they match the task description?
240+
241+
## Step 3: Output verdict IMMEDIATELY
242+
Output COMPLETION_JSON right now. Do NOT do more analysis. Do NOT read additional files.
236243
237244
## Review Criteria
238245
{{reviewCriteria}}
239246
240-
## Project Review Rules
241247
{{customReviewRules}}
242248
243-
IMPORTANT:
244-
- Do NOT modify any files. Do NOT commit. Do NOT push. Only analyze and report.
245-
- Be efficient: run git diff and npm test first, then output your verdict. Do not explore the entire codebase.
246-
- You MUST output COMPLETION_JSON before running out of turns.
249+
CRITICAL RULES:
250+
- Do NOT modify any files. Do NOT commit. Do NOT push.
251+
- Do NOT explore the codebase beyond the diff. Do NOT read unrelated files.
252+
- Output COMPLETION_JSON within your FIRST 3 TURNS. Every turn without COMPLETION_JSON is wasted.
247253
248-
When done, output your verdict on a new line in this exact format:
249254
COMPLETION_JSON:{"verdict":"APPROVE or NEEDS_CHANGES","requirement_match":"met/partial/not — explain","files_changed":"file: summary","code_quality":"issues or clean","test_coverage":"tested or not","risks":"risks or none"}`,
250255
rules: [
251256
"You MUST NOT create, edit, write, or delete any files.",
@@ -625,7 +630,7 @@ export async function executeActions(
625630
const env = { ...process.env };
626631
delete env.CLAUDECODE;
627632
const child = reviewSpawn2("claude", [
628-
"--print", "--model", "claude-sonnet-4-20250514", "--max-turns", "10", fullPrompt,
633+
"--print", "--model", "claude-sonnet-4-20250514", "--max-turns", "5", fullPrompt,
629634
], {
630635
env, cwd: reviewRepoDir, stdio: ["ignore", "pipe", "pipe"], timeout: REVIEWER_TIMEOUT,
631636
});

0 commit comments

Comments
 (0)