backend/src/config/prompts.ts
The review agent (CODE_REVIEW_SYSTEM_PROMPT) acts as a senior-engineer code reviewer. It optimizes for high-signal findings over volume — a clean PR with zero comments is a valid, successful result.
What the Agent Generates
The agent always returns a single JSON object (no Markdown fences; any fences that a less intelligent model adds are trimmed by a static function) with this shape:Field expectations
Quality guarantees baked into the prompt
- No style/naming/formatting nitpicks, no speculative issues
- Findings must be introduced or materially exposed by this PR
- Root causes are deduplicated (one comment per underlying problem)
- Every finding includes a realistic failure path and an actionable fix
How to Interact With This Data
-
Persistence — the raw JSON is stored on the
reviewrecord:review.rawReviewJSON→ full parsed JSON abovereview.reviewSummary→ text summary (rendered as markdown in the client’s AI Review tab)review.status/review.completedAt/review.reviewedCommitSha→ lifecycle metadata
-
Client rendering —
- Summary tab:
summary.overviewvia the markdown component inPullRequestReviewView - Findings: map each
comments[]item to anAIFinding(severity badge, explanation fromcomment, patch fromsuggestedFix) - Score widget: use
confidence.overallinstead of hardcoding
- Summary tab:
-
Consumers should:
- Treat
risk === 'high'as blocking-worthy - Never assume
commentsis non-empty - Use
failureScenario+commentfor detail views; keep list rows short viatitle - Surface
agenticFixPromptas a one-click “fix with agent” action when present
- Treat
-
Review modes —
REVIEW_MODES(Quick/Focused/Deep Dive) only change depth (context scope, verification passes, max findings cap 5/10/20). The JSON output contract is identical across all modes.