Paper to GPUI
Turn a selected Paper design into maintainable GPUI code, then prove the native
result against the design at the same viewport. Treat Paper as the visual
contract and the current Rust checkout as the implementation contract.
Non-negotiable rules
- Inspect before editing. Verify the Paper file, selected node, GPUI version,
existing components, theme, assets, and dirty worktree first.
- Use Paper MCP evidence, not a screenshot alone. Capture hierarchy, computed
styles, text, fonts, assets, and a 2x screenshot of the exact target.
- Treat Paper JSX as a structural hint, never as GPUI code or unquestioned
truth. Computed styles and the screenshot settle ambiguity.
- Preserve the app shell, state model, component conventions, and platform
behavior. Replace only the visual surface in scope.
- Prefer GPUI layout over coordinate transcription. Use flex/grid for normal
structure and absolute positioning only where the design genuinely overlaps.
- Do not rasterize text, controls, panels, or whole screens to fake fidelity.
Export only real visual assets such as icons, illustrations, textures, and
photos.
- Validate the native runtime.
cargo check is necessary but does not prove
fonts, window chrome, scale factor, focus, hover, clipping, or pixel fidelity.
- Work in small regions. Large artboards must be translated and compared
section by section before the whole screen is judged.
Workflow
1. Establish both contexts
Run the read-only project inspector:
scripts/inspect_gpui_project.sh /path/to/gpui-project
Then inspect the checkout directly:
- Confirm the repository root, branch, dirty state, and requested surface.
- Read the relevant
Cargo.toml, lockfile entry, app entrypoint, root view,
theme/tokens, reusable components, asset source, and nearby tests.
- Identify whether the project uses published
gpui, a Git revision, a
workspace checkout, a fork, or a wrapper component library.
- Follow the pinned checkout's APIs when they differ from examples. GPUI is
pre-1.0 and changes frequently.
Use the Paper MCP server:
- Call
get_basic_info to verify the currently open file and artboards.
- Call
get_selection to resolve the target.
- If the selection is empty or includes unrelated nodes, ask the user to select
one artboard or frame. Do not guess from names when multiple targets fit.
- Default to read-only Paper tools. Do not change the design unless the user
explicitly asks for design edits.
Read paper-mcp.md before extracting a non-trivial
design or troubleshooting Paper connectivity.
2. Capture a design evidence pack
Acquire evidence in this order:
get_screenshot at 2x for the selected root.
get_node_info and get_tree_summary for dimensions and hierarchy.
get_jsx for a compact structural interpretation.
get_computed_styles in batches for the root, layout containers, text,
controls, separators, and visually distinct descendants.
get_font_family_info for every non-system family and used weight/style.
get_fill_image or export for real image/vector assets.
get_children plus targeted subtree calls when a large design exceeds tool
limits or loses detail.
Record a compact evidence table before coding:
| Paper node |
Role |
Bounds |
Layout |
Spacing |
Type |
Paint/effects |
Asset |
Behavior |
Include exact values where they affect fidelity. Do not fill unknowns with
plausible defaults. Re-query the node or label the uncertainty.
3. Build a translation plan
Map the design into these layers:
- Window and chrome — viewport, titlebar, background, safe inset, minimum
size, and platform-specific frame.
- Structural regions — sidebar, toolbar, content columns, inspector, footer,
modal, or overlay.
- Reusable primitives — button, icon button, field, row, badge, separator,
list item, empty state, and section heading.
- Tokens — color, spacing, typography, radius, border, shadow, and
breakpoint constants.
- State and behavior — selection, hover, pressed, focus, disabled, loading,
scrolling, shortcuts, and resize behavior.
Reuse existing tokens and components when their rendered result matches. Extend
them narrowly when they do not. Do not create a parallel design system for one
screen.
Read gpui-translation.md before implementing.
It contains the detailed Paper/CSS-to-GPUI mapping and the boundaries where GPUI
needs a custom element, canvas, or deliberate approximation.
4. Implement from geometry inward
Use this order because it minimizes rework:
- Match window/content bounds and large background regions.
- Match flex direction, fixed/flexible dimensions, gaps, padding, alignment,
wrapping, overflow, and clipping.
- Match typography: actual family, available weight, size, line height,
wrapping width, alignment, truncation, and baseline.
- Match fills, borders, radii, opacity, shadows, gradients, and separators.
- Add exported assets at their intended logical size.
- Add interaction states and focus behavior.
- Extract reusable GPUI components only after the repeated visual pattern is
confirmed.
Keep exact Paper pixels as px(...) during the first fidelity pass. Consolidate
repeated values into project tokens after the screen matches. Avoid premature
rounding to GPUI convenience scales such as .gap_3() when Paper specifies an
off-scale value.
5. Validate behavior and visual fidelity
Run the nearest repository checks first:
cargo fmt --check
cargo check -p <owning-crate>
cargo test -p <owning-crate>
cargo clippy -p <owning-crate> --all-targets -- -D warnings
Adapt commands to the repository. Do not claim checks that were unavailable or
unreasonably broad.
Then launch the real app and compare:
- Reproduce the Paper artboard's logical viewport inside the GPUI content area.
- Confirm OS scale factor, theme, font availability, and window chrome.
- Put the app in the same state and use the same content as Paper.
- Capture the GPUI window or content region without resizing the result.
- Compare side by side, overlay at partial opacity, and use a difference image
when tooling is available.
- Fix mismatches in this order: bounds, layout, typography, paint, assets,
interaction polish.
- Repeat until further changes are below the agreed tolerance.
Read fidelity-validation.md for capture
normalization, diff techniques, tolerances, and mismatch diagnosis.
6. Prove completion
Do not call the work complete until:
- The exact Paper file and target node are identified.
- The relevant GPUI crate builds and targeted tests pass.
- The native app has been launched at least once.
- A final Paper screenshot and GPUI screenshot exist at matching logical bounds.
- Major structure, typography, colors, radii, and assets have been visually
compared.
- Hover, active, focus, scrolling, resizing, and keyboard behavior relevant to
the screen have been exercised.
- Remaining deltas and platform limitations are stated plainly.
Reference routing
- Read paper-mcp.md for connection setup, safe tool
sequencing, node extraction, tokens, fonts, assets, and Paper failure modes.
- Read gpui-translation.md for current GPUI
architecture, styling APIs, property mapping, components, assets, state, and
version shields.
- Read fidelity-validation.md for the
screenshot loop, visual tolerances, diff workflow, responsive checks, and
native acceptance.
- Read worked-example.md when starting a new
translation or when Paper's JSX/CSS structure does not map cleanly to GPUI.
Failure shields
- If Paper tools are absent, stop and explain how to connect Paper Desktop MCP.
Do not reconstruct a design from memory.
- If Paper reports the wrong file, have the user open the intended file and call
get_basic_info again.
- If no single target is selected, ask for a selection or an exact node ID.
- If a Paper subtree is huge, split by structural region and keep one screenshot
of the full target for global alignment.
- If an exact font is unavailable to GPUI, do not silently substitute it. Report
the missing family/weight, add or register the font if authorized, then
recapture.
- If a Paper effect has no direct GPUI equivalent, preserve hierarchy and
interaction, implement the nearest maintainable native effect, and document
the delta. Consider
canvas or a custom Element only after ordinary GPUI
styling is proven insufficient.
- If screenshots differ despite equal CSS-like values, inspect content bounds,
device scale, text metrics, default line height, border inclusion, and OS
window chrome before nudging arbitrary pixels.
Final response
Report:
- Paper file, artboard/frame, and viewport used.
- GPUI files and reusable components changed.
- Assets and fonts added or reused.
- Build, test, launch, and screenshot checks performed.
- Remaining visual or behavioral deltas.
- Any assumptions that still require user confirmation.
1---2name: paper-to-gpui3description: Primary skill for faithfully translating Paper.design artboards, selected frames, components, tokens, computed styles, and exported assets into native Rust/GPUI views. Use when Paper fidelity is the central task: inspecting a Paper file through the Paper Desktop MCP server, implementing or updating an existing GPUI view to match it closely, mapping web-style layout and typography to GPUI, or running screenshot-driven comparison. For general GPUI scaffolding, architecture, platform integration, or production hardening where Paper is only one input, use build-gpui-apps instead.4---56# Paper to GPUI78Turn a selected Paper design into maintainable GPUI code, then prove the native9result against the design at the same viewport. Treat Paper as the visual10contract and the current Rust checkout as the implementation contract.1112## Non-negotiable rules13141. Inspect before editing. Verify the Paper file, selected node, GPUI version,15 existing components, theme, assets, and dirty worktree first.162. Use Paper MCP evidence, not a screenshot alone. Capture hierarchy, computed17 styles, text, fonts, assets, and a 2x screenshot of the exact target.183. Treat Paper JSX as a structural hint, never as GPUI code or unquestioned19 truth. Computed styles and the screenshot settle ambiguity.204. Preserve the app shell, state model, component conventions, and platform21 behavior. Replace only the visual surface in scope.225. Prefer GPUI layout over coordinate transcription. Use flex/grid for normal23 structure and absolute positioning only where the design genuinely overlaps.246. Do not rasterize text, controls, panels, or whole screens to fake fidelity.25 Export only real visual assets such as icons, illustrations, textures, and26 photos.277. Validate the native runtime. `cargo check` is necessary but does not prove28 fonts, window chrome, scale factor, focus, hover, clipping, or pixel fidelity.298. Work in small regions. Large artboards must be translated and compared30 section by section before the whole screen is judged.3132## Workflow3334### 1. Establish both contexts3536Run the read-only project inspector:3738```sh39scripts/inspect_gpui_project.sh /path/to/gpui-project40```4142Then inspect the checkout directly:4344- Confirm the repository root, branch, dirty state, and requested surface.45- Read the relevant `Cargo.toml`, lockfile entry, app entrypoint, root view,46 theme/tokens, reusable components, asset source, and nearby tests.47- Identify whether the project uses published `gpui`, a Git revision, a48 workspace checkout, a fork, or a wrapper component library.49- Follow the pinned checkout's APIs when they differ from examples. GPUI is50 pre-1.0 and changes frequently.5152Use the Paper MCP server:53541. Call `get_basic_info` to verify the currently open file and artboards.552. Call `get_selection` to resolve the target.563. If the selection is empty or includes unrelated nodes, ask the user to select57 one artboard or frame. Do not guess from names when multiple targets fit.584. Default to read-only Paper tools. Do not change the design unless the user59 explicitly asks for design edits.6061Read [paper-mcp.md](references/paper-mcp.md) before extracting a non-trivial62design or troubleshooting Paper connectivity.6364### 2. Capture a design evidence pack6566Acquire evidence in this order:67681. `get_screenshot` at 2x for the selected root.692. `get_node_info` and `get_tree_summary` for dimensions and hierarchy.703. `get_jsx` for a compact structural interpretation.714. `get_computed_styles` in batches for the root, layout containers, text,72 controls, separators, and visually distinct descendants.735. `get_font_family_info` for every non-system family and used weight/style.746. `get_fill_image` or `export` for real image/vector assets.757. `get_children` plus targeted subtree calls when a large design exceeds tool76 limits or loses detail.7778Record a compact evidence table before coding:7980| Paper node | Role | Bounds | Layout | Spacing | Type | Paint/effects | Asset | Behavior |81|---|---|---|---|---|---|---|---|---|8283Include exact values where they affect fidelity. Do not fill unknowns with84plausible defaults. Re-query the node or label the uncertainty.8586### 3. Build a translation plan8788Map the design into these layers:89901. **Window and chrome** — viewport, titlebar, background, safe inset, minimum91 size, and platform-specific frame.922. **Structural regions** — sidebar, toolbar, content columns, inspector, footer,93 modal, or overlay.943. **Reusable primitives** — button, icon button, field, row, badge, separator,95 list item, empty state, and section heading.964. **Tokens** — color, spacing, typography, radius, border, shadow, and97 breakpoint constants.985. **State and behavior** — selection, hover, pressed, focus, disabled, loading,99 scrolling, shortcuts, and resize behavior.100101Reuse existing tokens and components when their rendered result matches. Extend102them narrowly when they do not. Do not create a parallel design system for one103screen.104105Read [gpui-translation.md](references/gpui-translation.md) before implementing.106It contains the detailed Paper/CSS-to-GPUI mapping and the boundaries where GPUI107needs a custom element, canvas, or deliberate approximation.108109### 4. Implement from geometry inward110111Use this order because it minimizes rework:1121131. Match window/content bounds and large background regions.1142. Match flex direction, fixed/flexible dimensions, gaps, padding, alignment,115 wrapping, overflow, and clipping.1163. Match typography: actual family, available weight, size, line height,117 wrapping width, alignment, truncation, and baseline.1184. Match fills, borders, radii, opacity, shadows, gradients, and separators.1195. Add exported assets at their intended logical size.1206. Add interaction states and focus behavior.1217. Extract reusable GPUI components only after the repeated visual pattern is122 confirmed.123124Keep exact Paper pixels as `px(...)` during the first fidelity pass. Consolidate125repeated values into project tokens after the screen matches. Avoid premature126rounding to GPUI convenience scales such as `.gap_3()` when Paper specifies an127off-scale value.128129### 5. Validate behavior and visual fidelity130131Run the nearest repository checks first:132133```sh134cargo fmt --check135cargo check -p <owning-crate>136cargo test -p <owning-crate>137cargo clippy -p <owning-crate> --all-targets -- -D warnings138```139140Adapt commands to the repository. Do not claim checks that were unavailable or141unreasonably broad.142143Then launch the real app and compare:1441451. Reproduce the Paper artboard's logical viewport inside the GPUI content area.1462. Confirm OS scale factor, theme, font availability, and window chrome.1473. Put the app in the same state and use the same content as Paper.1484. Capture the GPUI window or content region without resizing the result.1495. Compare side by side, overlay at partial opacity, and use a difference image150 when tooling is available.1516. Fix mismatches in this order: bounds, layout, typography, paint, assets,152 interaction polish.1537. Repeat until further changes are below the agreed tolerance.154155Read [fidelity-validation.md](references/fidelity-validation.md) for capture156normalization, diff techniques, tolerances, and mismatch diagnosis.157158### 6. Prove completion159160Do not call the work complete until:161162- The exact Paper file and target node are identified.163- The relevant GPUI crate builds and targeted tests pass.164- The native app has been launched at least once.165- A final Paper screenshot and GPUI screenshot exist at matching logical bounds.166- Major structure, typography, colors, radii, and assets have been visually167 compared.168- Hover, active, focus, scrolling, resizing, and keyboard behavior relevant to169 the screen have been exercised.170- Remaining deltas and platform limitations are stated plainly.171172## Reference routing173174- Read [paper-mcp.md](references/paper-mcp.md) for connection setup, safe tool175 sequencing, node extraction, tokens, fonts, assets, and Paper failure modes.176- Read [gpui-translation.md](references/gpui-translation.md) for current GPUI177 architecture, styling APIs, property mapping, components, assets, state, and178 version shields.179- Read [fidelity-validation.md](references/fidelity-validation.md) for the180 screenshot loop, visual tolerances, diff workflow, responsive checks, and181 native acceptance.182- Read [worked-example.md](references/worked-example.md) when starting a new183 translation or when Paper's JSX/CSS structure does not map cleanly to GPUI.184185## Failure shields186187- If Paper tools are absent, stop and explain how to connect Paper Desktop MCP.188 Do not reconstruct a design from memory.189- If Paper reports the wrong file, have the user open the intended file and call190 `get_basic_info` again.191- If no single target is selected, ask for a selection or an exact node ID.192- If a Paper subtree is huge, split by structural region and keep one screenshot193 of the full target for global alignment.194- If an exact font is unavailable to GPUI, do not silently substitute it. Report195 the missing family/weight, add or register the font if authorized, then196 recapture.197- If a Paper effect has no direct GPUI equivalent, preserve hierarchy and198 interaction, implement the nearest maintainable native effect, and document199 the delta. Consider `canvas` or a custom `Element` only after ordinary GPUI200 styling is proven insufficient.201- If screenshots differ despite equal CSS-like values, inspect content bounds,202 device scale, text metrics, default line height, border inclusion, and OS203 window chrome before nudging arbitrary pixels.204205## Final response206207Report:208209- Paper file, artboard/frame, and viewport used.210- GPUI files and reusable components changed.211- Assets and fonts added or reused.212- Build, test, launch, and screenshot checks performed.213- Remaining visual or behavioral deltas.214- Any assumptions that still require user confirmation.