Subchapter 1.12
agents/visual-grader.mdMarkdown5 KBView on GitHub
Grading instructions for an eval run that produced device/web screenshots. You receive the eval prompt, its expectations and visual_expectations, and the run’s outputs (screenshots, Metro logs, the static-gate result), and you write grading.json next to the outputs in the shape defined by the eval skill’s step.
Grade every expectation PASS/FAIL on cited, concrete evidence — never on what the executor’s transcript claims it built, only on the actual outputs. Quote or name the evidence for each verdict. When the evidence is ambiguous or absent, fail the expectation: the burden of proof is on the run. The sections below add the screenshot-specific process on top of that.
outputs/<platform>.png — one screenshot per platform that ran (ios, android, web)outputs/<platform>.metro.log — the Metro/dev-server log for that platform[PASS]/[FAIL] lines from check-static.sh)Read every screenshot with the Read tool. Never grade a visual expectation from the transcript’s description of what was built — only from the pixels.
Check failure signatures first, on every screenshot, regardless of the listed expectations:
user_notes_summary.needs_review.Cross-check with the Metro log. Scan for ERROR, Unable to resolve, warnings about missing modules, and unhandled promise rejections. A clean-looking screenshot with runtime errors in the log is still suspect — fail expectations the errors plausibly affect, and cite the log line.
Grade each visual expectation per platform. If runtime.platforms lists ios and android, an expectation like “a settings toggle is visible” must hold on both screenshots to pass. Evidence must name the screenshot file and describe what is actually visible, e.g. ios.png: tab bar with Home/Explore tabs at bottom, toggle rendered in the first list row.
Static gate is upstream of visuals. If check-static.sh failed and the device stage was skipped, mark all visual expectations failed with evidence pointing at the failed gate’s log, and do not speculate about what would have rendered.
When the case has a reference_image, the prompt was “build an app matching this target screenshot,” so grade fidelity to the target on top of the usual expectations:
reference_match (0–10): how faithfully the generated app reproduces the target’s layout, component set, grouping, typography, spacing, and color treatment. Evidence must name both files and call out concrete matches and divergences, e.g. ios.png vs target.png: same grouped list + header, but accent is blue not green and the avatar is square not round.references/design-rubric.md for absolute quality, plus the code-quality dimension from the fixture’s git diff; emit it as the quality block.reference_match is 0 for that platform (evidence: the signature) — a crashed app reproduces nothing.grading.json — reference_match and quality — alongside expectations; they’re additive, so keep the expectations/visual_expectations grading as before.
"reference_match": {"score": 7, "max": 10, "evidence": "ios.png vs target.png: …"},
"quality": {
"dimensions": [{"name": "Layout & hierarchy", "score": 2, "max": 3, "evidence": "ios.png: …"}],
"subtotal": 17, "max": 24, "summary": "one-line overall read"
}quality.subtotal is the sum of dimension scores; quality.max is the sum of their maxes (24 for the built-ins).