Built-in Code Review (`/review`)
POST /review on the daemon HTTP gateway runs a structured diff analysis using the currently configured LLM and returns a typed ReviewResult.
How it works
Section titled “How it works”1. getGitDiffForReview(projectPath, target) → executes git diff synchronously (30s timeout, 2 MB buffer)
2. If diff is empty → return { findings: [], overall_correctness: "patch is correct" }
3. Build system prompt (buildReviewSystemPrompt) → instructs the model to act as a code reviewer → outputs ONLY a JSON object matching the review schema
4. gateway.complete({ profileId, model?, messages, responseFormat: json_schema }) → uses structured output (json_schema) for reliable schema adherence
5. Parse and return ReviewResultDiff target options
Section titled “Diff target options”target value | What is diffed |
|---|---|
uncommitted (default) | git diff --cached + git diff (staged + unstaged) |
staged | git diff --cached only |
<file path> | git diff HEAD -- <file> for a single file |
Review output schema (ReviewResult)
Section titled “Review output schema (ReviewResult)”type ReviewFinding = { title: string; // ≤80 chars, imperative, prefixed [P0]–[P3] body: string; // Markdown, one paragraph max confidence_score: number; // 0.0–1.0 priority?: 0 | 1 | 2 | 3 | null; code_location: { absolute_file_path: string; line_range: { start: number; end: number }; };};
type ReviewResult = { findings: ReviewFinding[]; overall_correctness: 'patch is correct' | 'patch is incorrect'; overall_explanation: string; // 1-3 sentences overall_confidence_score: number;};Priority levels
Section titled “Priority levels”| Priority | Label | Meaning |
|---|---|---|
| P0 | Drop everything | Blocking bug or security issue — do not merge |
| P1 | Urgent | Significant correctness or performance problem |
| P2 | Normal | Should be addressed before release |
| P3 | Nice-to-have | Style, naming, minor improvement |
Reviewer configuration
Section titled “Reviewer configuration”The review uses a separate provider/model setting from the agent, allowing a different (e.g. stronger) model for code review:
/review settings # interactive picker in TUIStored in runtime-preferences.json as reviewProvider and reviewModel. Falls back to the active provider profile if not set.
Review guidelines baked into the system prompt
Section titled “Review guidelines baked into the system prompt”- Flag only issues introduced in the diff, not pre-existing ones
- Finding body: one paragraph max, concise
- No findings for nitpicks below P3 that don’t affect correctness or maintainability
- If no real issues: return empty
findingsarray overall_correctness: "patch is incorrect"only when there are blocking bugs