Building the
writer pipeline.
The writer turns a saved dataset into OpenUI Lang statements. It reasons about which component answers each fact group and follows rules from the prompt, the sports pack and the briefing. The compiler then checks every statement, derives what each part shows, asks for one repair and fills what is still missing.
From prompt to screen.
Shape finds candidates. Meaning picks one.
placements matches records against component contracts, so the briefing lists every candidate whose shape fits. The writer reads the request first, then keeps the candidate whose useWhen answers it. These are the contrast cases from the relevance probe: each one supplies a fitting record the request did not ask for.
The record fits this component's contract.
The record fits this component's contract.
The selected components answer the original request. Every requested available fact is visible. Unrelated context is omitted. Every referenced sub-statement is defined and reachable. To change a decision, edit the useWhen in components.ts and name the neighbour it is not.
The first failed check stops it.
admit runs six checks in order. Pick a statement to see where it stops and the message the compiler records. Messages are quoted from the code. The rule explorers below show the name, data and vocabulary checks.
stats = MetricBars({ columns: [] })templateMetricBars takes a data reference for record (d.<path> or an @Each item)
stats = MetricBars(d.answers.q1.comparison)WhyThe failure from the full Demin rerun. Dataset shaping timed out and the writer built records itself. A component's record is always a data reference.
The shape of a program.
These rules are in the system prompt for any domain. Most of them are also gate checks, so a statement that breaks one never reaches the screen.
Each part is one statement with a lowerCamel label. A large part splits into label_name sub-statements. The writer never writes root, d, Screen, queries, mutations, state or actions, and a part never references another part.
root = Screen([table, scorers])
table = Card([scorers_list])What the compiler saysroot is written by the server. scorers_list is not a sub-statement of table; parts cannot contain other parts.
table = Card([table_rows])
table_rows = Stack("v", 12, [...])ResultBoth statements are admitted. The compiler renames the part to pickN and writes root itself.
How a sports screen reads.
These rules come from the sports pack and the briefing. All but TeamPoints are prompt only, so a statement that ignores one is still admitted.
Every item of a match's statBars renders with StatBar, including shots, corners, saves, fouls and cards. No Progress and no row of figures instead.
stats = Stack("v", 12, [@Each(d.answers.q1.match.statBars, "s",
Progress(s.home, "bar", null, s.label)
)])What the screen showsAdmitted. One side shows as a bar and the comparison is lost.
stats = Stack("v", 12, [@Each(d.answers.q1.match.statBars, "s", StatBar(s))])ResultBoth teams' figures at the edges, with a split bar between them.
What the writer is asked to fix.
A part shows a question when it reads that answer's content. Reads of status, question, title, source, asOf and team do not count. An unavailable answer counts only when a part reads its note.
demin = Text(d.answers.q1.title, "headline")Gaps foundThe part is admitted, but title names an answer and does not show it. q1 is still a gap.
Repair. Write only the statements that finish these parts or show these questions; do not repeat admitted statements.
Questions not yet shown (read their answer data):
q1: Show only Egor Demin's individual key statistics from his latest game.The new statements are admitted like any other. No default part is added.
q1 was not shown by the writer; the server added its default part. Unfinished parts are dropped with part-incomplete.
Test the same records under different requests.
npm run check:writer-relevanceWhat it checksEvery component compiles from its catalog sample after player-image enrichment, with no issues and no fallback. No contract repeats a field. Each probe's expected component has a fitting record.
The probes use prepared datasets. They do not test the planner, the feed adapters or dataset shaping. The full Demin rerun failed in shaping, a stage the probes skip.
Put the rule where its scope is.
A prompt rule asks. A gate rule enforces. Write a rule as an instruction, with the exact call when there is one. The icon-led row rule includes the full statement to copy.
System prompt
Add it to writerMessages. Keep anything that varies per request out of it, so the cache entry stays shared.
System prompt ↗Pack templates
Add it to SPORTS_SCREEN.templates, next to the component it is about. A rule about which component fits goes in that component's useWhen.
Sports rules ↗Briefing
A rule that depends on one answer's data, such as its note or source, goes in briefing.
Briefing ↗Gate
Add a check to validate for any domain, or to the pack's refuses for one. The writer reads its message in repair, so name the fix, as the TeamPoints message does.
refuses ↗Validation proves the screen is well formed. It cannot prove it is the right screen.
Every gate check has a test a statement can fail: a name, a path, a type, a count. Relevance has no such test inside one compile, because a wrong component with a valid record is still a valid statement. That is why the reasoning lives in the prompt and is measured by contrast probes, where the same records meet different requests.
compose ↗Fixed system prompt ↗TeamPoints refusal ↗