Prereview Pipeline
Use this workflow when the task is to generate local rich previews from agent-generated code changes.
Trigger examples
- •"Prepare context first, then annotate, then build review HTML"
- •"Generate prereview output from my local changes"
- •"Use staged workflow for code preview"
Required flow
- •Run
prereview. - •Read
prereview/review-input.txt. - •Write notes to
prereview/review-notes.jsonl. - •Run
prereviewagain to parse notes, validate/sanitize, and rebuildprereview/review.html. - •Optional cleanup: run
prereview cleanto removeprereview/artifacts and local git exclude entry.
prereview performs end-to-end execution in one command:
- •recompute context from current diff;
- •write agent-facing
prereview/review-input.txt; - •parse
prereview/review-notes.jsonl; - •keep only valid note records in
prereview/review-notes.jsonl; - •move malformed/unmappable note lines into
prereview/rejected-notes.jsonl; - •build
prereview/review.htmlwith validation issues shown in the report.
Canonical JSON artifacts are internal (prereview/review-context.json, prereview/annotations.json) and should not be manually edited.
Input source selection
Choose one source:
- •Patch file:
--patch-file PATH - •Commit range:
--git-range A..B - •Default current working tree diff vs
HEADwhen no source flags are given
By default, untracked files are excluded.
Use --include PATH to scope review to matching paths (tracked or untracked, repeatable).
Without --include, prereview uses tracked working-tree changes and excludes binary diffs.
If context preparation fails due diff-size safeguards, narrow scope with --include before retrying.
Annotation authoring guidance
- •Notes are authored as JSONL records in
prereview/review-notes.jsonl:- •
{"type":"overview","text":"..."} - •
{"type":"file_summary","path":"...","summary":"..."} - •
{"type":"anchor_note","anchor_id":"...","what_changed":"...","why_changed":"...","title":"...","reviewer_focus":"...","risk":"...","severity":"note"}
- •
- •Use
anchor_idexactly fromprereview/review-input.txt. - •Missing or unknown
anchor_idrecords are rejected and written toprereview/rejected-notes.jsonl. - •Keep annotations focused on non-computable reviewer value (intent, rationale, risk, compatibility impact).
- •Do not restate automatically available facts such as line numbers, hunk ids, diff stats, or file counts.
- •Add top-level
overviewwith 2-4 concise lines for the header: scope, primary intent, and reviewer focus/risk. - •For every anchor note include both:
what_changed(concrete behavior/data/API change), andwhy_changed(intent, fix, reliability, maintainability, compatibility, etc.). - •Prefer hunk-level anchor explanations as the default.
- •Keep high-severity notes rare (
warning/risk) and reserve them for genuinely important reviewer attention points.
Read references/annotation-schema.md for field semantics; for day-to-day work, rely on prereview/review-input.txt + JSONL records.
Recovery rules
- •If report shows rejected lines, fix
prereview/review-notes.jsonland rerunprereview. - •If context-related warnings appear, rerun
prereviewto regenerate context/input from the latest diff. - •Do not patch output HTML directly; update notes and rerun.