03 / Generative UI

A page a model writes, checked line by line.

A product's model writes surface operations one line at a time. The surface checks each line as it arrives, applies it or refuses it with a reason, and gives back a patch for the product's page. Every applied line leaves a valid surface.

From a model's line to a person's press.

The product owns the model call and the page. Culm owns the check, the patch and the mount.

Agent

such as Claude Opus, called by the product

Product

its server and its page

Culm surface

createSurface

Person

using the product

01

Agent

Writes one operation per line

As JSON, or in the shorter outline spelling. The product gives it the surface's grammar from describeSurface.

{"op":"add","node":{"kind":"text","props":{…}}}

02

Product

Passes the text on as it comes

A chunk may end anywhere, even inside a line.

stream.write(chunk)

03

Culm surface

Applies each line alone

Against the surface's profile: its kinds, blocks, elements and depth. 500 lines a stream.

{"line":1,"ok":true}

04

Culm surface

Refuses a bad line, and goes on

The line changes nothing. The next line is read as usual.

{"line":2,"ok":false,"problems":[{"code":"INVALID_OPERATION","path":"line"}]}

05

Product

Draws each patch

An applied line gives a patch. Queued patches drain in one frame.

view.patch(step.patches[0]) → true

06

Person

Sees a valid page after every line

A refused operation never reaches the screen.

mountSurface

07

Person

Presses, types, submits

The mount reports each event to the product.

SurfaceEvent

08

Product

Decides what comes next

The product's own code answers the event: a new patch, or a new turn for its model.

surface.apply([…]) → patch

Culm calls no model. The product, or the person's agent host, calls it. "An agent such as Claude Opus" names a role in these diagrams: the flows are exercised by tests with scripted callers, and nothing here was measured with Claude Opus.

Fewer code tokens for the same page.

A model wrote the same six briefs in three formats. Culm's outline spelling took the fewest code tokens. Read the conditions with the figures.

Code tokens per page

Culm

72.4

A2UI

241.6

json-render

614.2

Mean of 90 runs per format · lower is better

Cost per page

Culm

$0.00046

A2UI

$0.00168

json-render

$0.00350

Mean of 90 runs per format

Pages with a defect, of 90

Culm

0

A2UI

14

json-render

0

All 14 A2UI defects are on one brief · json-render equal to Culm

Renderer size, Brotli

Culm

4,315 B

A2UI

233,049 B

json-render

242,238 B

What the product ships to draw

Render comparison · 270 runs · gpt-6.1-terra

Six briefs, 15 runs each per format. Pages with a defect: Culm 0 of 90, A2UI 14 of 90, all 14 on one brief because its basic catalogue has no responsive grid, and json-render 0 of 90, equal to Culm. By the protocol's own rule the verdict is "advantage not shown": no arm had a defect in the pilot, so the defect half could not be measured. The project owner counts the result as favourable, a ruling made after the results were known. One model; the outline format was revised after an earlier comparison.

One op per line. Or an outline.

JSON lines by default. The outline spelling reads an indented outline, one line per node, and turns it into the same nine operations, through the same checks.

outline spelling

# Contact us
We answer within two days.
form.f !contact="Send a message"
 field key=email name=email input=email required Email
 button Send
column.card | color=brand
 ## Team
 button link={"url":"/pricing"} See plans
=n2 Write to us

A line

One operation as a JSON object, applied alone as a batch of one. A chunk may end anywhere.

A refusal

The code, the path and the node id. The line changes nothing; the stream goes on.

Ceilings

500 lines a stream, 1,000,000 characters a line, and the profile's elements and depth.

Same in, same out

The same lines into surfaces with the same id give the same patches.

Or draw it inside an MCP Apps host.

@culmjs/surface/mcp-apps serves a surface as a view under MCP Apps (SEP-1865, 2026-01-26). The view draws patches and reports what the person does, and nothing else.

Does

Draws the patch in each tool result. Every press, submit and link leaves as one app-only tool call, culm_surface_event. The product's server checks every value.

Does not

No live streaming from the host's model, no partial input, no theme or display mode, no recovery from a missed patch: the product sends full state with every result.

Forms

A submit reaches the product only if the host grants allow-forms to the view frame and the sandbox proxy frame.

Tested

Against the AppBridge of the MCP Apps SDK in Chromium. The automated test names no real host.

The rest of Culm