AgentSmyth LabBack to AgentSmyth
Skip to article
Back to Lab NotesGenerative UI rules · v1

What the model may decide

The rules behind our generative UI: what a model may choose, what the system of record writes, and what nothing generated may do.

November 23, 20269 min readChris Flannery
On this page

A rule, as a rule, is only useful if a reader can see what it permits, what it forbids and what enforces it. Where the model stops explains why we draw the lines where we do. This companion sets out the lines themselves: who decides each part of a screen, how figures reach it, and what contains anything a model writes.

Two commitments run through all of it. The model never types a figure a user will rely on, and nothing a model writes can act on its own.

1. Who decides what

Every part of a generated screen has one owner, and the owner gets less freedom the more a mistake would cost.

DecisionWho makes itWhat bounds it
Which cards appear in an answerthe modelthe closed card catalog
Where each card sits in the prosethe modelan embed tag; cards it doesn't place fall to a grid below the answer
The figures inside a card, table or chartthe system of recordtool output, computed by code
Which cards a page can showthe clientthe client sends the list with every run
The layout of a whole deskthe model drafts it, a person accepts itthe frontend validates the draft before anything is saved
How a model-written HTML report looksthe modelan opaque-origin sandbox with no network
What a button doesthe serverthe model can name an action; the server assigns what it does

2. Figures

The model never types a figure a user will rely on. It chooses where figures go, and code puts them there.

Where a figure appearsHow it gets there
A carda deterministic projection of tool output
A table in an answerembedded by reference to the source document, <table id="…" index="0"/>, never retyped
A custom carda saved script computes it on every load, with no model in the loop
A chartthe chart must cite source documents fetched in the same run, or it is refused
A report's source listbuilt by code from the real document records, never written by the model

The exception is a "record" card, such as a trade ticket or a thesis, whose fields the model fills, like a form. Those fields are typed, carry source ids and are drawn by typed components. Prose claims carry citations (section 5).

3. Closed vocabularies

Wherever the model names something the UI will act on, it chooses from a closed list with one source of truth.

VocabularyExamplesHeld together by
Inline embed tags in an answer<cite>, <chart/>, <table/>, <artifact/>one parser pattern on each side
Card kindsstock performance, options positioning, a volatility surfacea backend registry, checked in the client build (section 8)
Custom-card blockstable, stats, feed, tabs, pickeran exported list that the save gate, the client parser and the model's instructions are all tested against
Control parametersticker, date_range, watchlist, option_legsone enum, mirrored by type

An unknown name is never guessed at. It is dropped, demoted to text or shown as an unrenderable card (section 11).

4. The client owns the catalog

On dashboard pages, the client tells the backend which cards it may produce, on every run.

The list comes from the deployment, the organization's data entitlements, feature flags and the user's chosen persona. The backend keeps it in state and never puts it in prompt text, so it limits what the model may emit without relying on the model to respect it. The frontend validates again before anything is drawn or saved.

Permission to the data itself is checked on the server, in three places:

CheckWhere it runs
Who the user isthe server verifies the signed token when the connection opens and builds the user's identity from it; no field in a request can change it
A user's own data, such as a portfoliothe tool takes the user from that identity, and the query matches only rows that user owns
Restricted datasets and toolsthe tool checks the organization's access before it reads, and refuses if the check fails or errors

A deployment can also install a gate that checks every tool against the organization's entitlement records, fetched on the server when the token is validated.

5. Citations

Claims in an answer cite the documents the run retrieved, and nothing else counts as a citation.

StepRule
Writingthe model cites with a claim tag; the platform converts each one to a canonical citation, in answers and in report files alike
Showinga document has two audiences. Its title and content are shown verbatim in the audit panel and fed to the model, so nothing internal may be written into them. Guidance meant only for the model goes in a separate field the panel never shows
Reconcilinga citation to a document the run didn't retrieve is shown as plain text
Auditinga citation opens a chain from the claim back through derived documents to the raw source

6. Containment of what the model writes

Model-written content is contained by where it renders. We don't rely on inspecting what it says.

ContentWhere it rendersWhat it cannot do
Markdown answersa renderer with no raw-HTML supportrun HTML; fetch an image (images render as their alt text); open a link without a confirmation that shows the full URL
Custom-card markupparsed as XML into the closed block list, drawn by our own componentsrun script; make a request before the user clicks
HTML reportsan iframe with sandbox="allow-scripts" and never allow-same-origin, served from a route whose CSP has no connect-srcread cookies or storage, touch the page around it, or reach the network
Code the model runsa sandbox with no networksend data anywhere

The HTML frame loads a static shell route and receives the report as a single string message, so the HTML never round-trips through a backend. We use a route rather than srcdoc because an srcdoc frame would inherit the application's nonce-based content policy, and a report's own scripts could never run. Writing the HTML into the page would give model markup our origin and our session. A route lets the frame carry its own policy: inline scripts, one charting CDN and Google Fonts, no connect-src, and form-action 'none'.

7. Actions

Generated UI may propose an action. It may never define one.

  • A custom card's action gets its id from the server when the card is saved. The client dispatches it by id, behind a confirmation. There are no client-side expressions, so model markup has no path to unsafe-eval.

  • A change to a portfolio, watchlist, account or desk arrives as a proposal card. The client commits it with its own request when the user accepts. The backend has no write path for these.

  • Sharing, revising a shared card, saving it into a shared pulse, creating a team-wide pulse and any connector action that changes something on another service run only when the person's own message asks for it.

  • Return and post-login URLs pass one same-origin check. The media proxy needs a session, fetches only public addresses, checks every redirect hop and never forwards credentials.

8. The wire contract

Backend and client agree on every payload, and the build fails when they don't.

RuleHow it holds
One registry of card kindsthe backend lists every kind it can emit
No silent schema driftexported schemas are checked in CI; a shape change without a re-export fails the build
The client can draw everything the backend sendsevery chat card kind the backend registers must be drawable by the client, or the client build fails
New payloads don't break old clientsgenerative payloads ride as additive keys on the state frame; a client that doesn't know a key renders nothing for it
Runtime checks never break the screenboth sides validate a copy after the write and report anything off-contract, once per run per kind
Every run endsevery stream ends in a "done" frame or an error, enforced on both sides

Generative payloads ride as additive keys because a new top-level message type would be dropped by every client until a coordinated frontend release. Cards, output files, plan and decision frames and narration all travel as keys inside the state frame. A client that doesn't know a key yet renders nothing for it, so the backend can ship a new kind of payload without breaking anyone, and the client build check above makes sure the frontend catches up before the payload matters.

9. Charts

A chart is an ECharts configuration that the backend treats as opaque, behind arithmetic gates only.

RuleWhy
The option is passed through, never re-typedre-typing it would limit charts to the types the backend happens to model
The only gates are arithmetic: the option is non-empty, has a series or a dataset, and its source ids ground in this run's documentsdensity or style checks would reimplement ECharts, and every false positive refuses a chart that would have rendered
The payload carries its own format discriminator; one without it is legacy and passes through byte for byteevery saved run holds legacy charts, and they must render forever
A chart the model draws in its own sandbox is never shownit is context for the model; only a validated chart payload reaches the screen

10. Streaming

Nothing half-finished is shown as if it were finished.

What streamsRule
Report filesstream from the tool-call arguments as the model types them, before the tool runs, and are reconciled with the written file afterward. The client reads the argument deltas and never parses a partial buffer as JSON
HTML reportspaint only once the file is confirmed, so a half-written layout never shows
Embed tags in an answera trailing partial chart, citation, table or card tag is cut on every render; unresolved citations bind when the final state frame arrives
Custom cardsthe data paints first; the narrative shows a skeleton until it arrives
Briefs, charts and documentsthree states: undefined is a skeleton, a value is content, and null is an em-dash. A settled-empty field never spins.

11. Fallbacks

Every layer has a defined behavior for what it doesn't recognize, and every fallback is reported.

SituationBehavior
A card kind the client can't drawan "unrenderable" panel, never a blank space
A card with no dataa degraded empty state
A citation that doesn't resolvedemoted to plain text
An embed tag the renderer doesn't knowunwrapped, so its text shows and nothing executes

12. How the rules are checked

Each rule is tested where it lives.

LayerCheck
What the model decidesdecision evals on the agent backend: which cards it selects, where it anchors them, whether injected instructions take effect. No LLM judges content, and "not measured" never counts as a pass
How cards rendera Playwright harness renders every card kind at a 400px floor and checks seven properties of each
How the client honors the contractunit tests in CI on every pull request; a known failure is marked expected to fail, so the marker turns red the moment it's fixed
How it all fits togetherfinished conversations are replayed through the real page, with no model and no backend, to check that every card draws and no raw tag leaks

Sources

  • The card render harness, its 400px floor and its seven checks: the test suite in the AgentSmyth web client.
  • The save gates, the wire contract and the decision evals: the AgentSmyth Python backend service.