Screenery

Docs / Reference

Screenery for coding agents

Updated

When coding agents open your pull requests, a pixel diff is not enough. Screenery can hold a pull request to what it said it would change, limit what an agent may approve, catch breaks the pixels miss, and hand your orchestrator events and signed evidence.

What works today

Some of this runs on Screenery's servers and works for every project now, whichever CLI your CI runs. The rest is in the screenery CLI and needs CLI 0.5.0. The CLI on npm is 0.4.0, and screenery/push@v1 runs 0.4.0 until the Action moves to the new release. The hosted MCP server (https://app.screenery.dev/mcp) always has the newest tools; the local one (npx screenery mcp) gets them with the CLI.

FeatureWorks nowRequires CLI 0.5.0
Expected-change contractScreenery-Expect: line, API, screenery_expectpush --expect, report --expect
Agent approval policy, change limitAccess screen, the check, screenery_report spread--fail-on spread
JudgmentsAPI, screenery_judge, console—
Text, accessibility, runtime, blank-page checks—all of it (local gate)
Check against a channel—diff --baseline-channel, local screenery_check
Repair packethosted screenery_report with repairreport --repair
Bisect, find, flake report, scorecard, inboxAPI and hosted MCP tools, /inboxthe same tools on the local server; push --agent
Webhooksreview.submitted, review.state_changed, flake.detected—
Flows and verification runsconsole filmstrip, PR comment Flows block, hosted screenery_verify_then_publishstartFlow, pushing flows, flow GIFs, verify-publish runs
Cross-repo breaksGET /v1/orgs/{org}/upstream, hosted screenery_upstream_reportpush --upstream, report --upstream
Coverage, changelog, attestationshosted screenery_coverage, screenery_changelog, screenery_attest, the APIscreenery coverage, changelog, attest
Design baselinethe @design channel rulesdesign-publish, compare

Declare what a pull request should change

A pull request can say which screenshots it means to change: its expected-change contract, a list of asset globs, or none. Put a line in the pull request's description (needs the GitHub App):

Screenery-Expect: checkout/**, cart/summary

Or have the agent call screenery_expect, or send PUT /v1/projects/{org}/{project}/pr/{n}/contract. Requires CLI 0.5.0: screenery push --expect 'checkout/**' on the pull request's job. Then a CI step can fail on a change outside the contract (unexpected) or a glob nothing changed under (unmet). report judges the contract you pass it with --expect; without one those two are a usage error:

npx screenery report acme/shop --pr 12 --expect 'checkout/**' --fail-on unexpected,unmet

The contract is the author's claim, not an approval. The details, and which declaration wins, are in Reviewing screenshots.

Limit what agents may approve

By default an agent's approval counts like yours. On the console's Access screen, Agent approvals changes that per project: open, limited (only changes graded at or under minor or moderate, inside the contract unless you turn that off, and optionally only after another person's judgment says matches) or off. An agent is any session not signed in through a browser: an MCP server or a personal access token. A refused approval gets 403 with the list of screenshots that need a person, and the screenery check reads "2 changes need a person".

The same card sets a change limit: the most distinct changes one pull request may hold. Over it, the check title says so first and no agent may approve. To make a CI job fail on it, add spread to --fail-on (requires CLI 0.5.0) or to screenery_report's fail_on. See Limiting what agents may approve.

Judgments: does it do what the description asks?

A judge, an agent using screenery_judge or a model in your CI posting to POST /v1/projects/{org}/{project}/pr/{n}/judgments with a publish token, records matches, mismatch or unsure, overall and per screenshot. Screenery runs no model. A judgment approves nothing; it goes stale on the next push or when the description changes. The review workspace shows What judges said, and the check adds one line per judge. See Judgments.

Breaks that pixels miss

Requires CLI 0.5.0. The screenery/playwright helper's screenshot() writes a {name}.signals.json beside each PNG. The local gate, screenery diff or screenery push --diff-baseline, compares it with the baseline's copy. Nothing in that file is uploaded.

{
  "diff": {
    "aria": "fail",
    "blank": 0.995,
    "budgets": { "load_ms": 3000 }
  }
}
import { screenshot, watch } from 'screenery/playwright';

test.beforeEach(async ({ page }) => watch(page));

test('checkout', async ({ page }, testInfo) => {
  await page.goto('/checkout');
  await screenshot(page, testInfo, 'checkout/payment-form');
});

That is screenery.config.json above, and a Playwright test below it. See Visual testing for the gate itself.

Check before you push

Requires CLI 0.5.0. An agent can compare its local screenshots with what @main holds before it opens a pull request, graded the way the pull request will be, at the branch's merge base, with your project's ignored flaky changes applied:

npx screenery diff ./test-results --baseline-channel main --project acme/shop

A screenshot @main never held is new, not a failure. The default bar is moderate, --json prints the result, and nothing is published. On the local MCP server the tool is screenery_check. The hosted server cannot read your files, so it does not have it.

Fixing a change: the repair packet

Each changed screenshot in screenery_report carries where it changed (regions), which test took it (capture, with a link to the line), whether a Playwright trace exists, and whether it looks flaky. Ask for a repair block to cap the agent's attempts:

npx screenery report acme/shop --pr 12 --repair --max-attempts 3

At the cap, the report's next starts with stop: ask a person. It never changes the gate. The hosted tool takes repair: true now; the CLI flags require CLI 0.5.0. See report.

When it changed, and finding a screen

screenery_bisect lists every change to one screenshot on a channel, oldest first, with the commit range each landed in, narrowed by a good and bad commit, version or date. It says so when the same bytes keep coming back. The history route GET /v1/projects/{org}/{project}/channels/{name}/history?asset=… carries the same commits.

screenery_find looks a screen up before an agent changes it: words across the name, label, description, tags, test file and page path, or a prefix, test_file or page. It answers with image URLs, or with the channel's tags and folders when nothing matched. The manifest route takes the same filters (q, prefix, test_file, page) and never finds a screenshot you may not see.

Flows: a journey, step by step

Recording requires CLI 0.5.0. A flow is one keyframe per step plus a small flow.json, and optionally the page's video:

import { startFlow } from 'screenery/playwright';

const flow = await startFlow(page, testInfo, 'checkout');
await flow.step('cart', { label: 'Cart with two items' });
await flow.step('payment-form', { label: 'Payment form' });
await flow.end();

push stores each step as a screenshot (checkout/step/cart) and the GIF or video as checkout. Screenery compares the steps and their durations with the baseline, so a re-encoded video whose steps look the same is not a change, and a changed one names the step. A step that got slower than its budget makes the flow regressed; set budgets under flows in screenery.config.json. The console shows a filmstrip of the steps and plays the before and after videos side by side. See the Flows block for the pull-request comment.

Verification runs

Requires CLI 0.5.0. When an agent checks its own work in a browser, it can publish the run as a receipt: a flow whose steps say "outcome": "pass" or "fail" with a note, and who recorded it ("run": { "kind": "agent-self" }, agent-other or ci):

npx screenery verify-publish ./verify-out --project acme/shop --verdict pass

--verdict pass is refused when a step failed. A video on a public project is refused unless you pass --public-recording, because a recording shows whatever was on screen. --traces uploads the trace, members only. A receipt is evidence for the reviewer, never an approval. See Verify receipts.

Webhooks for your orchestrator

Add a webhook on the console's Access screen and tick the events your system reacts to:

EventSent when
review.submittedAnyone reviews: once per review. See the payload.
review.state_changedA pull request's review state moves, for example to approved. The event to merge on. See the payload.
flake.detectedA screenshot on @latest becomes flaky. Once per episode. See Flaky screenshots.

Each is signed (x-screenery-signature). A webhook is not an approval: before you merge, read the review state with GET /v1/projects/{org}/{project}/pr/{n}/review.

Scorecard per agent and model

Label each build with the agent that made it. Requires CLI 0.5.0: --agent, --agent-model and --agent-run on push, or these in the workflow, with no change to the Action step:

env:
  SCREENERY_AGENT: forge-coder
  SCREENERY_AGENT_MODEL: my-model-id
  SCREENERY_AGENT_RUN_ID: ${{ github.run_id }}

Then GET /v1/orgs/{org}/scorecard?days=30&group_by=agent (or group_by=model, or the MCP tool screenery_scorecard) gives, per group: the share of pull requests ever rejected, builds until the first green head, an agent's approvals a person later rejected, and builds whose change was only known flakiness. Each comes with its numerator and denominator; rates are withheld under 5 pull requests. Any member of the org can read it. The label is the pusher's word, and nothing gates on it.

One review inbox across projects

app.screenery.dev/inbox (the reviews link in the console's header) lists every pull request waiting on you across your projects, grouped by project, with what is left to review and the agent that pushed it. Rows you may look at but not decide are marked view only. The same list is GET /v1/reviews/pending and the MCP tool screenery_pending_reviews. It can trail the live state by a few seconds. A pull request leaves the inbox when it is approved, when it is closed, or after 30 days with no push.

Flaky screenshots: hand them to an agent

flake.detected fires once when a screenshot on @latest becomes flaky, and not again until it has been stable. Its report_url, also GET /v1/projects/{org}/{project}/flake-report?asset=… and the MCP tool screenery_flake_report, returns what an agent needs to fix the test in one read: each changed region, the versions with their commit and CI run, the test file and line, traces, and gaps for what is missing. Its job is to fix the test, not to raise a threshold.

Coverage: which pages no test looks at

Requires CLI 0.5.0. A green check can mean nothing was looked at. screenery coverage matches your routes against the page each screenshot was taken on:

npx screenery coverage acme/shop --discover next

Routes come from screenery.coverage.json, --sitemap, or --discover next for a Next.js app. The answer lists the routes each test saw, the routes nothing saw, and screenshots on pages no route matches. It says seen, not covered, and is never a gate. The MCP tool screenery_coverage takes the routes from the agent. Only screenshots taken with the CLI 0.5.0 helper record their page.

Visual changelog between two releases

Requires CLI 0.5.0.

npx screenery changelog acme/shop --from v1.2.0 --to v1.3.0 --out CHANGELOG-visual.md

Markdown: a before and after table of the screens that changed, the new screens with their descriptions, and the removed ones. Every image is pinned to its version, so the notes stay true. A ref is a channel, build:b_…, commit:<sha>, date:2026-11-01 or a git tag. --format json prints the document. The MCP tool is screenery_changelog and the route GET /v1/projects/{org}/{project}/changelog.

Signed attestations

Requires CLI 0.5.0. An orchestrator that accepts an agent's task without a person needs something it can check, not a pull-request comment anyone with write access can edit:

npx screenery attest b_01J… --task ORCH-77 --out attestation.jws
npx screenery attest verify attestation.jws --dir test-results \
  --expect-commit "$(git rev-parse origin/agent/orch-77)" --require verified,approved

Screenery signs a statement of the build: every screenshot's SHA-256, the commit and whether GitHub vouched for it, the verdict and the review state. verify checks the signature against https://app.screenery.dev/.well-known/screenery-attestation-keys, the image bytes, and the commit, and exits 2 when one fails. Take the commit from your git host, never from the agent. --task is your word, not checked. An attestation does not prove the screenshots show that commit's code. The MCP tool screenery_attest issues one. While that key list is empty, signing is not available.

Comparing with the design

Requires CLI 0.5.0. Put the designer's export on @design and measure how far the build drifted from it:

npx screenery design-publish ./figma-export --project acme/shop
npx screenery compare acme/shop --from design --to latest --fail-on major

design-publish takes PNGs named after the screenshots they design (checkout/payment-form.png pairs with checkout/payment-form). It needs a project that already has @latest, and refuses any file that would be public unless you pass --allow-public: a design is unreleased work. compare grades each same-size pair on your machine and lists screens designed but not built, built but not designed, and the drift of each pair, worst first. Its threshold defaults to 0.3 and --fail-on to never.

A design never becomes @latest.

Only a design build moves @design and @design-* on its own (a person can still promote onto them), it moves nothing else, and nothing it stored can be promoted onto @latest. So a branch named design no longer moves a @design channel from CI; its pushes keep their other channels.

Cross-repo breaks: one upstream change, every consuming app

Requires CLI 0.5.0. When a shared package (a design system, a component library) has an open pull request, your orchestrator builds that package and runs each consuming app’s screenshot job with it. Each job labels its push with the upstream change:

npx screenery@0.5.0 push test-results --project acme/web \
  --upstream acme/design-system#412 --upstream-commit <full sha>

A labelled push lands on its own channel, @up-design-system-412, and never moves @latest. It is removed automatically 30 days after its last labelled push. Then one call collects every app’s result for that upstream commit:

screenery report --upstream acme/design-system#412 --upstream-commit <sha> --org acme --expect web,admin

The report (screenery.upstream-report/1, also GET /v1/orgs/{org}/upstream and the MCP tool screenery_upstream_report) lists, per project you can read, the newest build at that commit and what changed against that project’s @latest, with how old that @latest is; stale projects that built an older upstream commit; and missing projects you expected that sent nothing. The label is a claim made by the consumer’s CI, and the report says so. The screenery/push@v1 Action has no upstream input yet: run the CLI as a plain step.