Ivan Kaliuzhnyi

Note I · Case study

How to Build UI Efficiently

Six redesigned pages, built by parallel AI agents — one page per chat, per git worktree, all folding into a single pull request. How the pipeline holds together, and everything that broke along the way.

A redesign touched six pages, and building them one after another wasn't going to fit the timeline. The fix was to run them in parallel instead — one agent per page, each in its own branch, all folding into a single integration PR.

The human stays in the loop, but not by writing the code. The setup runs once: a shared playbook of rules, the gates that matter, the final call on whether a page is actually done. Everything between those — planning a page, writing it, checking it — runs through agents. What made this work wasn't the code generation itself; it was the scaffolding around it, and a verification loop that catches an agent when it's confidently wrong.

This is that scaffolding — and, more usefully, everything that broke on the way to it working.

The pipeline

human orchestrates · agents execute the slices

01

Design handoff

A mockup file — the source of truth.

02

Plan agent

FE/BE split, phases, definition of done.

03

Page agents write

One chat, one worktree, one writer.

× 6 in parallel
04

Verify in a browser

Live probe, computed styles. A miss returns to 03.

loops until parity ↺
05

Prepare PR

Scoped polish, doctor pass, draft PR.

06

Fold + CI

One commit per page, one integration PR.

A person plans and approves the gates; agents run the slices. Steps three and four loop — verification hands a slice back to its writer until it matches the mockup.

One page = one chat = one worktree

Every page runs off the same shared playbook — one set of instructions that all of them follow. The opening moves are written into it and carried out by the agent itself: rename the chat to the page name, create an isolated git worktree so nothing lands in the shared checkout, read the existing conventions, and study the design handoff and the current code before writing a line.

A planning pass then turns that into the page's own plan: what's frontend, what's backend, what to defer, and what counts as done. Implementation starts only after that. Several of these chats run at once — that's the whole point, and also where most of the pain lives.

Six pages, six chats

overview/
exposure/
workspace/
ledger/
signals/
preferences/
Each chat carries the name of the page it owns, so a glance down the list shows what's actually in flight.

Design is the source of truth, not the code

Every page starts from a design handoff, and that handoff — not any existing screen — is the source of truth for how the page should look. It comes out as a zip: the mockup files plus a short brief describing how the screens connect. That brief is what lets the planning agent see the flow rather than a single screen in isolation — where this page sits, what links into it, what comes next.

From there the agent reads the handoff top to bottom, maps each part of the mockup to components and to the API fields that feed them, and lists the backend gaps before touching anything.

Close enough isn't parity. Agents reach for a shared component's defaults — a button here, a badge there — when the mockup specifies exact values. The fix was to make the agent pull the exact hex, padding and radius out of the handoff before accepting any default, since those defaults were often a few pixels or one shade off.

What's inside a handoff

handoff.zip what the agent reads
README.md agent brief · screen flow
mockup/ screen + tokens
Page.dc.html source of truth
runtime.js prototype behavior
assets/ designer shots
tokens/ values + lint rules
A brief plus one mockup file — never a dump of production assets. README.md carries how the screens connect; Page.dc.html is what the agent measures against.

Zone by zone

mockup vs. first pass 4 gaps open
Summary strip6 / 6
Exposure by name2 / 4

missing: sector mix · desk breakdown

Exposure by venue1 / 2

missing: trend view

Exposure by strategy3 / 3
View toggle1 / 2

missing: follows the selected metric

What the mockup called for, checked against the first pass — a worklist a review works from, not a surprise it uncovers at the end.

No fake data

Real APIs are wired by default; mocks are only allowed if the plan explicitly says so — a rule that exists because of one specific failure.

An agent once reported that a page's overview was showing real numbers — cost, tokens, sessions. It wasn't. Those came from a local fixture that only appears when no data warehouse is configured. The numbers looked entirely reasonable, which is exactly why nobody questioned them.

Visual plausibility isn't authenticity. Before anyone calls data real, trace it: component → hook → handler → source. When something genuinely isn't wired up yet, ship an explicit "not wired" state — never invent numbers to fill the gap.

The corollary: when a section is blocked on backend work, the rule is to cut it rather than fill it with a "coming soon" placeholder or fabricated content.

Saying so, instead of guessing

Watchlist

Signals

not wired yet

A widget with nothing behind it yet says exactly that, instead of quietly borrowing a neighbor's numbers to look finished.

Visual verification, not "the code looks fine"

This is the part that earned the most corrections, and the part worth stealing outright.

The single most repeated mistake wasn't a CSS bug. It was an agent claiming a fix was done — from edits on disk — while the running app still served the old code: a stale hot reload, or a subagent reporting "looks clean" without ever opening the page.

So verification became its own pass, run in a real browser. Instead of screenshots-as-vision, it reads the page's accessibility tree, clicks and fills by element reference, pulls computed styles to compare against the mockup's exact values, and diffs screenshots against the design. Two rules hardened out of this: "couldn't verify visually" counts as "not done" — a clean-looking diff on disk is not evidence — and when hot reload lies, cold-restart: wipe the build cache, restart, and re-check both the app and the API gateway, since one can be alive while the other silently serves errors.

What counts as proof

proof-sheet · exposure/ 4 signals
Implemented slicereal API · no mocks
Rendered pagedev server · live bundle
The mockupsource of truth
Live browser probeprimary signal

definition of done

verified on a live bundle · exact hex / px · real API data · a11y snapshot + screenshot

✓ PARITY
↺ any check fails → back to the writer · "couldn't verify visually" = not done
Not a code review — an evidence check. A slice counts as done only once it holds up on a live bundle; short of that, it loops back to the writer.

The browser probe beats an IDE preview for a few boring reasons:

Two ways of checking the same thing

screenshots only

a guess dressed up as an image

a11y-tree probe

deterministic evidence

clicks

by coordinate — misses small targets

by element reference — deterministic

sessions

one shared browser session

one named session per worktree

pixel checks

eyeballed from an image

computed styles — real hex and px

evidence

a picture

a probe: URL, copy, computed value

The right column is deterministic. The left one is a guess dressed up as a screenshot.

Running them in parallel without collisions

Parallelism is where the interesting failures showed up. The worst was two sessions writing into the same worktree at once — one agent's commits quietly reverting another's instructions. The fix was a simple ownership rule: the shared main checkout is read-only, and one writer owns one worktree. Before any agent claims it's ready, it checks git status for changes it didn't make, and stops if it finds any.

Two smaller failures from the same root cause: port squatting — a "server not ready" error was often a stale process from another worktree still holding the port, not a slow boot — and browser-session races, where parallel agents sharing one default browser session produced screenshots of the wrong page. Neither is exotic; they're the ordinary cost of concurrency. Agents just don't anticipate them on their own, so the rules have to be explicit.

One writer, one worktree

ownership, not etiquette

shared main read-only
overview/ agent 1 1 writer
exposure/ agent 2 1 writer
workspace/ agent 3 1 writer
Shared main stays read-only. Each worktree answers to exactly one agent, and to nobody else.

Three collision cards

the ordinary cost of concurrency 3 failures → 3 rules

Two agents, one tree

Commits quietly reverted each other's edits.

One writer per worktree — stop on a foreign git status before claiming done.

"Server not ready"

Usually a stale process from another worktree holding the port.

Check who holds the port instead of assuming a slow boot.

A screenshot of the wrong page

Parallel agents shared one default browser session.

A named browser session per worktree — never share the default.

The same failure shape, three times: a symptom worth noticing, and the rule that closes it.

Fold, and keep CI green

Once a page verifies against its mockup, it gets a polish pass — cleaning up only the files it touched — and then folds into the integration PR as one commit per page. From there an automation loop keeps the PR merge-ready: resolving conflicts, triaging review comments, and fixing failing CI, without ever merging on its own.

Before anything folds in

Page implementation, verified input
✓ Qualitycode cleanliness passed
✓ Performancerender + query cost passed
↺ Reuseshared components fixes applied
Ready to fold output
Not one agent signing off on its own diff — three scoped passes first, and the fixes they turn up.

One discipline worth calling out: the PR carries product code only. Seeds, local fixtures, and the design handoff files stay out of it. Agents like to sweep helpful-looking extras into the diff; the plan and the prepare step exist partly to sweep them back out.

One commit per page

Commit history on main: one feature commit per redesigned page, with two follow-up fixes after a failed check on the Billing redesign.
Real commit history on main, newest first: one feature commit opens each page, but redesigning Billing broke CI at 4 of 6 checks — it took two follow-up commits to bring it back to green, alongside an unrelated fix landing the same day. Green on every commit was never the bar — green before merge was.

Open questions

Subagent reports

One will occasionally insist a fix landed when it didn't — cheap enough to re-check in the browser rather than take the summary on faith.

Demo recordings

A five-minute manual capture still beats what automated screen recording produces, so anything stakeholder-facing gets filmed by hand.

Protected environments

Nothing behind SSO can be reached headlessly — someone still has to hand over a session once before an agent can work there.

The final call

The browser pass narrows the gap to almost nothing, but a person still looks at the screen before a page is called done.

Where this goes next

Two defaults are staying, full stop: a page isn't done until a live browser probe says so, and a worktree — like a browser session — never gets shared between agents. Both started as notes in a playbook; both became hard gates once the cost of skipping them became clear.

The bigger shift is a preference more than a rule: a section that admits it's empty beats one that quietly guesses. That trade has paid for itself every time a backend lagged behind a design, and it's the one part of this that generalizes past this particular pipeline.

Anyone running several agents on UI at once, and chasing the same "it's already fixed" ghost, is welcome to compare notes.