After building code review chapters, you should generate a prologue. The prologue is a high-level overview designed to help reviewers orient themselves quickly (ideally in about 5 seconds) before they dive into specific chapters. It should be written in plain English, as if explaining the change to a coworker, avoiding technical jargon or implementation details in the high-level summaries.
Prologue Structure
The prologue object contains the following fields:
motivation (string or null): A single sentence describing what was annoying, broken, or missing from a human perspective. Avoid technical implementation details (e.g., use "Loading was slow" instead of "Added a caching layer").outcome (string or null): A single sentence describing what is better now for the user.rootCause (string or null): The technical reason the problem occurred. Unlike motivation, this should use technical terms (functions, files, mechanisms) and is intended for the engineer. Only include this if the change fixes a bug or regression and the cause is evident.diagram (string or null): A Mermaid diagram source string (without fenced code block markers) representing the big picture. Use this only for changes spanning multiple components (e.g., new endpoints, state machine transitions). Most changes should not have a diagram.keyChanges (array of 2–5 objects): An array of objects describing what is different. Each object must have:summary: 6–10 words describing the outcome (e.g., "Audit runs are now tracked in a database").description: A capitalized sentence (10–15 words) providing context.
focusAreas (array of 1–5 objects): Areas where reviewers should pay special attention. Each object must have:type: One of security, breaking-change, high-complexity, data-integrity, new-pattern, architecture, performance, or testing-gap.severity: One of critical, high, medium (for problems) or info (for points of interest).title: A 3–5 word noun phrase.description: A declarative instruction for the reviewer using verbs like "confirm", "verify", or "check".locations: An array of file paths where this applies.
complexity (object): Describes the difficulty of the change.level: One of low, medium, high, or very-high.reasoning: A brief explanation of why this level was chosen.
{
"chapters": [
{
"id": "chapter-1",
"order": 1,
"title": "...",
"summary": "...",
"hunkRefs": [ ... ],
"keyChanges": [ ... ],
"riskLevel": "medium",
"riskReasons": [ "..." ]
}
],
"prologue": {
"motivation": "...",
"rootCause": null,
"outcome": "...",
"diagram": null,
"keyChanges": [ ... ],
"focusAreas": [ ... ],
"complexity": { "level": "medium", "reasoning": "..." }
}
}