pixelpact is a tool for measuring the UI results built by coding agents. The core problem it solves is: after writing CSS, coding agents cannot see the actual rendered result and can only guess, which leads to repeated manual inspection. pixelpact extracts a "contract" from a reference page—recording the actually rendered dimensions, colors, spacing, fonts, hover and focus states, animation keyframes, design tokens, etc.—then measures the implementation page and returns the deviation of each property, enabling the agent to work in a closed loop.
Main capabilities include:
- Extract contract: extract rendered properties from a reference page (or Figma frame) and generate a readable, diffable JSON file.
- Check implementation: compare the implementation page with the contract and output a list of deviations, with support for pixel tolerance and color-aware distance.
- Pixel diff: compute the pixel difference between the implementation and the reference.
- Side-by-side comparison: display two pages section by section side by side, outlining the differing regions.
- MCP server: provides the extract_contract, check_implementation, diff_pixels, and read_contract_summary tools for agents to call.
- GitHub Action: automatically measures the difference between the preview deployment and the contract in the repository in a PR, and updates the comment.
Usage:
- Installation: requires Node 22.12 or later, with Playwright as a peer dependency.
- Extract contract: pixelpact extract <reference page URL> --out contract.json
- Check implementation: pixelpact check <implementation page URL> --contract contract.json
- Pixel diff: pixelpact diff <implementation page URL> --contract contract.json
- Side-by-side comparison: pixelpact side <reference page URL> <implementation page URL>
- Supports --json to output a structured report, and shared flags such as --viewport, --selector, and --wait.
- After integrating pixelpact-mcp through an MCP client, the agent can call check_implementation after each edit to obtain the deviation table.
Applicable scenarios:
- Coding agents building UI self-verification.
- Adjusting pages to match the design reference during development.
- Automatically checking deviations between the UI implementation and the contract in CI.
- Extracting contracts from Figma designs and checking the implementation.
Limitations:
- Only supports Chromium (via Playwright), not cross-browser engines.
- The contract format may add fields before 1.0.
- A passing check only means all values in the contract match within tolerance; it does not detect extra elements in the implementation (requires running diff separately).
- Dynamic content must be excluded using --mask.
- Figma extraction requires the REST API; gradient or image fills cannot be represented as a single CSS value and will be ignored with a warning.
- Version 0.3, no stability commitment yet.