Skip to content

Built by the agent

These are real builds. Each request was given to an agent — Claude Opus 5.5 or Claude Sonnet 5.5 — driving Mica’s authoring tools from a model API loop, starting from an empty draft. Every build ended with a document import accepts. They are shown here for what they teach: how the agent works through the tools, what Mica refuses and why, and what to check before you hand the result to a host developer.

For each build you get the request, the steps, the result and the host contract the agent proposed.

  • A round is one response from the model. A response can hold several tool calls, which run in order.
  • A refused call leaves the draft exactly as it was, and the answer lists every reason. The next round is the agent’s repair.
  • finish runs import’s check. A draft import refuses is not applied, and the agent keeps going.

The documents are shown as the agent built them, apart from small clean-ups noted where they apply. Refusals are quoted as the agent read them. Two messages have since gained a hint naming the valid form: an empty inputs map now adds leave inputs out for a capability that takes none: "fetch": {}, and an optional identity adds the declaration to write.

A micro-app that teaches users how to use the gym; at the end they pass a little quiz on the do’s and don’ts.

Opus wrote all seven pages in one response and finished in the next, with no refusals. The quiz stays in the document: each answer is a Choice bound to /quiz, and each Next button is visible only while its answer is right.

  1. Round 1 · 9 calls

    1. set_state seeds /quiz = {q1: "", q2: "", q3: ""}
    2. write_page page-welcome “Welcome”, 6 elements
    3. write_page page-basics “Getting started”, 19 elements
    4. write_page page-etiquette “Do's and don'ts”, 17 elements
    5. write_page page-q1 “Quiz question 1”, 8 elements
    6. write_page page-q2 “Quiz question 2”, 8 elements
    7. write_page page-q3 “Quiz question 3”, 8 elements
    8. write_page page-done “Quiz passed”, 6 elements
    9. update_props renames the app “Gym basics”
  2. Round 2 · 1 call

    1. finish applies the document

The result is the gym induction example, live. It has since moved onto controls Mica added after the build: each option’s hint is its note where the agent wrote a Text per hint conditioned on the answer, and the step and question counters are Steps where the agent typed them. It declares no host object, so its host contract is empty: No host objects: the document keeps everything in its own state. Its answers sit in the JSON, which is fine for practice; a quiz whose result counts is graded by the host (see the playbook).

Then, in the same conversation, the follow-up:

Add a fourth question about re-racking weights.

A follow-up starts from the current document, not an empty draft. The agent did not rewrite it: it made nine small edits in one response and removed nothing.

  1. Round 1 · 9 calls

    1. write_page page-q4 “Quiz question 4”, 8 elements, at index 6 (before the Passed page)
    2. update_props q3-next: label “Next question”
    3. set_events q3-next press → goToPage page-q4
    4. update_props section-7: eyebrow “QUESTION 1 OF 4”
    5. update_props section-8: eyebrow “QUESTION 2 OF 4”
    6. update_props section-9: eyebrow “QUESTION 3 OF 4”
    7. set_state seeds /quiz = {q1: "", q2: "", q3: "", q4: ""}
    8. set_events done-again press → setState /quiz (four empty answers) → goToPage page-welcome
    9. finish applies the document

Question 3 now leads to the new question 4, every question counts to four, and Start again clears all four answers. The live document below has moved onto option notes and Steps like the first build, so its question counters count the quiz pages themselves: the three eyebrow edits are no longer needed. Answer through to the end:

Complete document — examples/documents/gym-induction-four-questions.json
examples/documents/gym-induction-four-questions.json
{
"envelopeVersion": 1,
"ui": {
"root": "app",
"elements": {
"app": {
"type": "PageStack",
"props": {
"name": "Gym basics"
},
"children": [
"page-welcome",
"page-basics",
"page-etiquette",
"page-q1",
"page-q2",
"page-q3",
"page-q4",
"page-done"
]
},
"stack-1": {
"type": "Stack",
"props": {
"direction": "vertical",
"gap": "lg",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "xl",
"surface": null
},
"children": [
"text-1",
"heading-1",
"text-2",
"stack-2"
]
},
"text-1": {
"type": "Text",
"props": {
"content": "NEW MEMBER GUIDE",
"size": "sm",
"tone": "inverse",
"align": "left",
"italic": false
},
"children": []
},
"heading-1": {
"type": "Heading",
"props": {
"content": "Your first week at the gym",
"level": "1",
"align": "left",
"accent": true
},
"children": []
},
"text-2": {
"type": "Text",
"props": {
"content": "A five-minute tour of how the floor works, what to do and what to avoid. Finish with a short quiz to show you're ready.",
"size": "lg",
"tone": "inverse",
"align": "left",
"italic": false
},
"children": []
},
"stack-2": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"welcome-start"
]
},
"welcome-start": {
"type": "Button",
"props": {
"label": "Start the tour",
"variant": "solid",
"size": "lg",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-basics"
}
}
]
}
},
"page-welcome": {
"type": "Page",
"props": {
"title": "Welcome",
"background": "ink"
},
"children": [
"stack-1"
]
},
"stack-3": {
"type": "Stack",
"props": {
"direction": "vertical",
"gap": "lg",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "lg",
"surface": null
},
"children": [
"lesson-steps-1",
"heading-2",
"grid-1",
"stack-4"
]
},
"lesson-steps-1": {
"type": "Steps",
"props": {
"format": "STEP {n} OF {total}",
"pages": [
"page-basics",
"page-etiquette",
"page-q1"
]
},
"children": []
},
"heading-2": {
"type": "Heading",
"props": {
"content": "Getting started",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"grid-1": {
"type": "Grid",
"props": {
"columns": 2,
"gap": "md",
"padding": "none",
"minCellWidth": 180
},
"children": [
"section-1",
"section-2",
"section-3",
"section-4"
]
},
"section-1": {
"type": "Section",
"props": {
"eyebrow": "BEFORE YOU TRAIN",
"title": "Come prepared",
"tone": "outlined",
"padding": "lg"
},
"children": [
"text-4",
"text-5"
]
},
"text-4": {
"type": "Text",
"props": {
"content": "Bring a towel, a water bottle and clean indoor shoes.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-5": {
"type": "Text",
"props": {
"content": "Warm up for 5–10 minutes: light cardio and a few mobility moves.",
"size": "sm",
"tone": "muted",
"align": "left",
"italic": false
},
"children": []
},
"section-2": {
"type": "Section",
"props": {
"eyebrow": "MACHINES",
"title": "Set it up for you",
"tone": "outlined",
"padding": "lg"
},
"children": [
"text-6",
"text-7"
]
},
"text-6": {
"type": "Text",
"props": {
"content": "Adjust the seat and pads so the joint lines up with the pivot point.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-7": {
"type": "Text",
"props": {
"content": "Start with a light weight and move slowly and in control.",
"size": "sm",
"tone": "muted",
"align": "left",
"italic": false
},
"children": []
},
"section-3": {
"type": "Section",
"props": {
"eyebrow": "FREE WEIGHTS",
"title": "Safety first",
"tone": "outlined",
"padding": "lg"
},
"children": [
"text-8",
"text-9"
]
},
"text-8": {
"type": "Text",
"props": {
"content": "Use collars on barbells and ask for a spotter on heavy bench presses.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-9": {
"type": "Text",
"props": {
"content": "Keep a clear space around you when lifting.",
"size": "sm",
"tone": "muted",
"align": "left",
"italic": false
},
"children": []
},
"section-4": {
"type": "Section",
"props": {
"eyebrow": "CARDIO",
"title": "Find your pace",
"tone": "outlined",
"padding": "lg"
},
"children": [
"text-10",
"text-11"
]
},
"text-10": {
"type": "Text",
"props": {
"content": "Clip on the safety key and start at a gentle speed.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-11": {
"type": "Text",
"props": {
"content": "Most machines have a time limit at busy hours — check the sign.",
"size": "sm",
"tone": "muted",
"align": "left",
"italic": false
},
"children": []
},
"stack-4": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"basics-back",
"basics-next"
]
},
"basics-back": {
"type": "Button",
"props": {
"label": "Back",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-welcome"
}
}
]
}
},
"basics-next": {
"type": "Button",
"props": {
"label": "Next: do's and don'ts",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-etiquette"
}
}
]
}
},
"page-basics": {
"type": "Page",
"props": {
"title": "Getting started",
"background": "paper"
},
"children": [
"stack-3"
]
},
"stack-5": {
"type": "Stack",
"props": {
"direction": "vertical",
"gap": "lg",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "lg",
"surface": null
},
"children": [
"lesson-steps-2",
"heading-3",
"grid-2",
"stack-6"
]
},
"lesson-steps-2": {
"type": "Steps",
"props": {
"format": "STEP {n} OF {total}",
"pages": [
"page-basics",
"page-etiquette",
"page-q1"
]
},
"children": []
},
"heading-3": {
"type": "Heading",
"props": {
"content": "Do's and don'ts",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"grid-2": {
"type": "Grid",
"props": {
"columns": 2,
"gap": "md",
"padding": "none",
"minCellWidth": 180
},
"children": [
"section-5",
"section-6"
]
},
"section-5": {
"type": "Section",
"props": {
"eyebrow": "PLEASE",
"title": "Do",
"tone": "raised",
"padding": "lg"
},
"children": [
"text-13",
"text-14",
"text-15",
"text-16"
]
},
"text-13": {
"type": "Text",
"props": {
"content": "✓ Wipe down benches and machines after use.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-14": {
"type": "Text",
"props": {
"content": "✓ Put weights and plates back on the rack.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-15": {
"type": "Text",
"props": {
"content": "✓ Let others work in between your sets.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-16": {
"type": "Text",
"props": {
"content": "✓ Ask staff when you're unsure how something works.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"section-6": {
"type": "Section",
"props": {
"eyebrow": "PLEASE DON'T",
"title": "Don't",
"tone": "outlined",
"padding": "lg"
},
"children": [
"text-17",
"text-18",
"text-19",
"text-20"
]
},
"text-17": {
"type": "Text",
"props": {
"content": "✗ Drop dumbbells or slam the weight stack.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-18": {
"type": "Text",
"props": {
"content": "✗ Hog a machine while scrolling your phone.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-19": {
"type": "Text",
"props": {
"content": "✗ Walk in front of someone lifting at a mirror.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"text-20": {
"type": "Text",
"props": {
"content": "✗ Film other members without asking.",
"size": "md",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"stack-6": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"etiquette-back",
"etiquette-next"
]
},
"etiquette-back": {
"type": "Button",
"props": {
"label": "Back",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-basics"
}
}
]
}
},
"etiquette-next": {
"type": "Button",
"props": {
"label": "Take the quiz",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q1"
}
}
]
}
},
"page-etiquette": {
"type": "Page",
"props": {
"title": "Do's and don'ts",
"background": "paper"
},
"children": [
"stack-5"
]
},
"heading-4": {
"type": "Heading",
"props": {
"content": "Quick quiz",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"section-7": {
"type": "Section",
"props": {
"eyebrow": null,
"title": "You just finished on the bench",
"tone": "outlined",
"padding": "lg"
},
"children": [
"q1-steps",
"q1",
"stack-7"
]
},
"q1-steps": {
"type": "Steps",
"props": {
"format": "QUESTION {n} OF {total}",
"pages": [
"page-q1",
"page-q2",
"page-q3",
"page-q4"
]
},
"children": []
},
"q1": {
"type": "Choice",
"props": {
"label": "What do you do next?",
"display": "radio",
"options": [
{
"value": "leave",
"label": "Leave it — the cleaners will handle it",
"note": "Not quite: wipe it right away so the next person gets a clean bench."
},
{
"value": "wipe",
"label": "Wipe it down with a towel or spray",
"note": "Correct!"
},
{
"value": "later",
"label": "Wipe it at the end of my workout",
"note": "Not quite: wipe it right away so the next person gets a clean bench."
}
],
"required": false,
"helpText": null,
"value": {
"$bindState": "/quiz/q1"
}
},
"children": []
},
"stack-7": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"q1-back",
"q1-next"
]
},
"q1-back": {
"type": "Button",
"props": {
"label": "Review the guide",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-etiquette"
}
}
]
}
},
"q1-next": {
"type": "Button",
"props": {
"label": "Next question",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q2"
}
}
]
},
"visible": {
"$state": "/quiz/q1",
"eq": "wipe"
}
},
"page-q1": {
"type": "Page",
"props": {
"title": "Quiz question 1",
"background": "mist"
},
"children": [
"heading-4",
"section-7"
]
},
"heading-5": {
"type": "Heading",
"props": {
"content": "Quick quiz",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"section-8": {
"type": "Section",
"props": {
"eyebrow": null,
"title": "Done with your dumbbells",
"tone": "outlined",
"padding": "lg"
},
"children": [
"q2-steps",
"q2",
"stack-8"
]
},
"q2-steps": {
"type": "Steps",
"props": {
"format": "QUESTION {n} OF {total}",
"pages": [
"page-q1",
"page-q2",
"page-q3",
"page-q4"
]
},
"children": []
},
"q2": {
"type": "Choice",
"props": {
"label": "Where do they go?",
"display": "radio",
"options": [
{
"value": "floor",
"label": "On the floor next to the bench",
"note": "Not quite: weights left out are a trip hazard and hard for others to find."
},
{
"value": "rack",
"label": "Back on the rack, in their spot",
"note": "Correct!"
},
{
"value": "drop",
"label": "Drop them — that's what the floor is for",
"note": "Not quite: weights left out are a trip hazard and hard for others to find."
}
],
"required": false,
"helpText": null,
"value": {
"$bindState": "/quiz/q2"
}
},
"children": []
},
"stack-8": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"q2-back",
"q2-next"
]
},
"q2-back": {
"type": "Button",
"props": {
"label": "Back",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q1"
}
}
]
}
},
"q2-next": {
"type": "Button",
"props": {
"label": "Next question",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q3"
}
}
]
},
"visible": {
"$state": "/quiz/q2",
"eq": "rack"
}
},
"page-q2": {
"type": "Page",
"props": {
"title": "Quiz question 2",
"background": "mist"
},
"children": [
"heading-5",
"section-8"
]
},
"heading-6": {
"type": "Heading",
"props": {
"content": "Quick quiz",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"section-9": {
"type": "Section",
"props": {
"eyebrow": null,
"title": "Someone is waiting for your machine",
"tone": "outlined",
"padding": "lg"
},
"children": [
"q3-steps",
"q3",
"stack-9"
]
},
"q3-steps": {
"type": "Steps",
"props": {
"format": "QUESTION {n} OF {total}",
"pages": [
"page-q1",
"page-q2",
"page-q3",
"page-q4"
]
},
"children": []
},
"q3": {
"type": "Choice",
"props": {
"label": "You still have three sets to go. What do you do?",
"display": "radio",
"options": [
{
"value": "ignore",
"label": "Keep going and check my phone between sets",
"note": "Not quite: sharing during your rest keeps everyone moving."
},
{
"value": "share",
"label": "Offer to let them work in between my sets",
"note": "Correct!"
},
{
"value": "leave",
"label": "Leave my towel on it and go to the water fountain",
"note": "Not quite: sharing during your rest keeps everyone moving."
}
],
"required": false,
"helpText": null,
"value": {
"$bindState": "/quiz/q3"
}
},
"children": []
},
"stack-9": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"q3-back",
"q3-next"
]
},
"q3-back": {
"type": "Button",
"props": {
"label": "Back",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q2"
}
}
]
}
},
"q3-next": {
"type": "Button",
"props": {
"label": "Next question",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q4"
}
}
]
},
"visible": {
"$state": "/quiz/q3",
"eq": "share"
}
},
"page-q3": {
"type": "Page",
"props": {
"title": "Quiz question 3",
"background": "mist"
},
"children": [
"heading-6",
"section-9"
]
},
"stack-10": {
"type": "Stack",
"props": {
"direction": "vertical",
"gap": "lg",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "lg",
"surface": "citrus"
},
"children": [
"heading-7",
"text-21"
]
},
"heading-7": {
"type": "Heading",
"props": {
"content": "You passed — welcome to the floor!",
"level": "1",
"align": "left",
"accent": true
},
"children": []
},
"text-21": {
"type": "Text",
"props": {
"content": "You know the do's and don'ts. Warm up, wipe down, rack your weights and share the equipment.",
"size": "lg",
"tone": "default",
"align": "left",
"italic": false
},
"children": []
},
"stack-11": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "start",
"wrap": false,
"padding": "md",
"surface": null
},
"children": [
"done-review",
"done-again"
]
},
"done-review": {
"type": "Button",
"props": {
"label": "Review the guide",
"variant": "outline",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-basics"
}
}
]
}
},
"done-again": {
"type": "Button",
"props": {
"label": "Start again",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "setState",
"params": {
"statePath": "/quiz",
"value": {
"q1": "",
"q2": "",
"q3": "",
"q4": ""
}
}
},
{
"action": "goToPage",
"params": {
"page": "page-welcome"
}
}
]
}
},
"page-done": {
"type": "Page",
"props": {
"title": "Quiz passed",
"background": "paper"
},
"children": [
"stack-10",
"stack-11"
]
},
"heading-8": {
"type": "Heading",
"props": {
"content": "Quick quiz",
"level": "1",
"align": "left",
"accent": false
},
"children": []
},
"section-10": {
"type": "Section",
"props": {
"eyebrow": null,
"title": "You finished squatting with a loaded barbell",
"tone": "outlined",
"padding": "lg"
},
"children": [
"q4-steps",
"q4",
"stack-12"
]
},
"q4-steps": {
"type": "Steps",
"props": {
"format": "QUESTION {n} OF {total}",
"pages": [
"page-q1",
"page-q2",
"page-q3",
"page-q4"
]
},
"children": []
},
"q4": {
"type": "Choice",
"props": {
"label": "What do you do with the bar and plates?",
"display": "radio",
"options": [
{
"value": "leave",
"label": "Leave the plates on — the next person might want them",
"note": "Not quite: unload the bar and re-rack every plate on the matching peg so the next person can start fresh."
},
{
"value": "strip",
"label": "Strip the plates and put each one back on its peg by weight",
"note": "Correct!"
},
{
"value": "pile",
"label": "Stack the plates in a pile next to the rack",
"note": "Not quite: unload the bar and re-rack every plate on the matching peg so the next person can start fresh."
}
],
"required": false,
"helpText": null,
"value": {
"$bindState": "/quiz/q4"
}
},
"children": []
},
"stack-12": {
"type": "Stack",
"props": {
"direction": "horizontal",
"gap": "md",
"align": "stretch",
"justify": "between",
"wrap": false,
"padding": "none",
"surface": null
},
"children": [
"q4-back",
"q4-next"
]
},
"q4-back": {
"type": "Button",
"props": {
"label": "Back",
"variant": "ghost",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-q3"
}
}
]
}
},
"q4-next": {
"type": "Button",
"props": {
"label": "Finish the quiz",
"variant": "solid",
"size": "md",
"disabled": false,
"fullWidth": false
},
"children": [],
"on": {
"press": [
{
"action": "goToPage",
"params": {
"page": "page-done"
}
}
]
},
"visible": {
"$state": "/quiz/q4",
"eq": "strip"
}
},
"page-q4": {
"type": "Page",
"props": {
"title": "Quiz question 4",
"background": "mist"
},
"children": [
"heading-8",
"section-10"
]
}
},
"state": {
"quiz": {
"q1": "",
"q2": "",
"q3": "",
"q4": ""
}
}
},
"meta": {
"pack": {
"id": "mica.core",
"version": "1.0.0"
}
}
}

3-step event registration with review and submit; dietary needs required only for the workshop track.

Both models built three steps, a review and a create whose dietary input is required only for the workshop. The difference is what the review page shows when the host refuses.

  1. Round 1 · 7 calls

    1. declare_object registration = events.Registration (one) · create(name, email, track, dietary)
    2. set_state seeds /reg = {name, email, track, dietary}
    3. write_page page-details “Your details”, 8 elements
    4. write_page page-track “Track”, 11 elements
    5. write_page page-review “Review”, 24 elements
    6. write_page page-done “Registered”, 7 elements
    7. check lists the draft's issues and host contract
  2. Round 2 · 2 calls

    1. update_props renames the app “Event registration”
    2. finish applies the document
  1. Round 1 · 7 calls

    1. declare_object registration = events.Registration (one) · fields {id?, confirmationCode?} · create(fullName, email, track, dietaryNeeds)
      Refused: the draft is unchanged
      • Object “registration” identity “id” must be required and non-null; the host returns it on every record. (/objects/registration)
    2. set_state seeds /form = {name, email, track, dietary}
    3. write_page page-details “Your details”, 8 elements
    4. write_page page-track “Track”, 10 elements
    5. write_page page-review “Review”, 16 elements
    6. write_page page-done “Done”, 4 elements
    7. finish sent in the same response as the refused declaration
      Not applied: the draft does not import yet
      • Element “button-6” (on.press[0]): create names undeclared object “registration”. (/ui/elements/button-6/on/press/0)
  2. Round 2 · 2 calls

    1. declare_object registration with a required id · create(fullName, email, track, dietaryNeeds)
    2. finish applies the document

This preview runs a small stand-in host. Its create already has a registration for sam@example.com, and the workshop is full, so it puts workshop places on the waitlist. The document has since moved onto controls Mica added after the build: one track-step Next with an any-of ($or) condition where the agent wrote two, a submit Button that is busy instead of a hidden Button beside a Sending… line, and each step’s control showing its field error in error, a Steps counter where the agent typed “Step n of 3” on each page, and one Value per review answer (the track’s through $label, the host’s field error in its error) where the agent paired a label Text with a value Text and an error Text.

  • Fill in your details with the email sam@example.com and submit. The host refuses, and its message for the email shows under the Email line of the review, next to the host’s own message for the whole form.
  • Go back, change the email and submit again. The done page shows the confirmation code the host issued.
  • Choose the workshop track. Dietary needs appears and is required — the Input’s required is a $cond on the track, and the dietary input has requiredWhen on the same path — and the done page says you are on the waitlist.

One gap the agent left: type dietary needs, then switch back to the conference track, and the value is still sent.

Host contract
registration = events.Registration (one record)
create(name: string (minLength 1, maxLength 120), email: string (email), track: conference|workshop, dietary?: string | null (maxLength 500, required when /reg/track eq workshop)) -> {id, confirmationCode: string, status: confirmed|waitlisted}

The Sonnet build’s review page on the designer’s canvas, which shows every conditional element at once: the answers, a “Sending…” line and one fixed error sentence, with no place for a per-field message.

The canvas shows every conditional element at once. The only error is a fixed sentence, shown while the create’s phase is error: We couldn’t submit your registration. Check your details and try again. If the host refuses the email, the person has to guess which answer is wrong. What the two review pages read from the host:

Paths each build reads (- Opus only, + Sonnet only)
/meta/objects/registration/operations/create/phase
/meta/objects/registration/operations/create/error/message
/meta/objects/registration/operations/create/error/fieldErrors/name
/meta/objects/registration/operations/create/error/fieldErrors/email
/meta/objects/registration/operations/create/error/fieldErrors/dietary
/objects/registration/data/confirmationCode
/objects/registration/data/status

And the two contracts — Sonnet’s also makes the confirmation code optional and drops the confirmed or waitlisted status:

Host contract (- Opus, + Sonnet)
registration = events.Registration (one record)
create(name: string (minLength 1, maxLength 120), email: string (email), track: conference|workshop, dietary?: string | null (maxLength 500, required when /reg/track eq workshop)) -> {id, confirmationCode: string, status: confirmed|waitlisted}
create(fullName: string (minLength 2), email: string (email), track: talks|workshop|networking, dietaryNeeds?: string (maxLength 300, required when /form/track eq workshop)) -> {id, confirmationCode?: string}

What to check: a form that sends a host write shows the write’s fieldErrors next to each input it sends, and the error’s message, not a fixed sentence. Opus’s builds of this request always did; most of Sonnet’s did not. The check now hints at every create input a control binds whose field error nothing shows, and the playbook’s wizard pages recipe shows a multi-step form with each error in its control’s error and on the review page.

Check the host contract for inputs nobody asked for

Section titled “Check the host contract for inputs nobody asked for”

My host can give the signed-in employee (name, team) and their expense claims (merchant, amount, status). Let people see their claims and withdraw a pending one with a reason.

Both models hit the same refusal first: a fetch declared with an empty inputs map. They repaired it differently.

  1. Round 1 · 7 calls

    1. declare_object employee = hr.Employee (one) · fields {id, name, team} · fetch with inputs {}
      Refused: the draft is unchanged
      • Object “employee” capability “fetch” inputs must declare at least one field. (/objects/employee)
    2. declare_object claims = expenses.Claim (many) · fields {id, merchant, amountLabel, status} · fetch with inputs {} · update(withdrawalReason)
      Refused: the draft is unchanged
      • Object “claims” capability “fetch” inputs must declare at least one field. (/objects/claims)
    3. set_state seeds /withdraw = {id, merchant, amountLabel, reason}
    4. set_startup fetch employee, fetch claims
    5. write_page page-claims “My claims”, 20 elements
    6. write_page page-withdraw “Withdraw claim”, 13 elements
    7. check lists the draft's issues and host contract
  2. Round 2 · 3 calls

    “Fetch capabilities with no inputs: I'll declare them as `{}`.”

    1. declare_object employee · fetch()
    2. declare_object claims · fetch() · update(withdrawalReason)
    3. finish applies the document
  1. Round 1 · 6 calls

    1. declare_object employee = hr.Employee (one) · fields {id?, name?, team?} · fetch with inputs {}
      Refused: the draft is unchanged
      • Object “employee” identity “id” must be required and non-null; the host returns it on every record. (/objects/employee)
    2. declare_object claims = finance.ExpenseClaim (many) · fields {id?, merchant?, amountLabel?, status?} · fetch with inputs {} · update(withdrawReason)
      Refused: the draft is unchanged
      • Object “claims” identity “id” must be required and non-null; the host returns it on every record. (/objects/claims)
    3. set_state seeds /withdraw = {id, merchant, reason}
    4. set_startup fetch employee, fetch claims
    5. write_page page-claims “My expense claims”, 23 elements
      Refused: the draft is unchanged
      • Invalid Avatar props on “avatar-1”: props.name uses unsupported expression “$state”; name takes a literal value only. (/ui/elements/avatar-1/props/name)
    6. finish sent in the same response
      Not applied: the draft does not import yet
      • The PageStack must contain at least one page. (/ui/elements/app/children)
  2. Round 2 · 4 calls

    “Fixes: mark identity required, drop the Avatar.”

    1. declare_object employee with a required id · fetch with inputs {}
      Refused: the draft is unchanged
      • Object “employee” capability “fetch” inputs must declare at least one field. (/objects/employee)
    2. declare_object claims with a required id · fetch with inputs {}
      Refused: the draft is unchanged
      • Object “claims” capability “fetch” inputs must declare at least one field. (/objects/claims)
    3. write_page page-claims “My expense claims”, 22 elements, no Avatar
    4. finish sent in the same response
      Not applied: the draft does not import yet
      • Document (lifecycle.startup[0]): fetch names undeclared object “employee”. (/lifecycle/startup/0)
      • Document (lifecycle.startup[1]): fetch names undeclared object “claims”. (/lifecycle/startup/1)
      • Element “button-1” (on.press[0]): fetch names undeclared object “claims”. (/ui/elements/button-1/on/press/0)
      • Element “button-3” (on.press[0]): update names undeclared object “claims”. (/ui/elements/button-3/on/press/0)
  3. Round 3 · 3 calls

    1. declare_object employee · fetch(locale)
    2. declare_object claims · fetch(status) · update(withdrawReason)
    3. finish applies the document

The Opus build is the expense claims example, live, with one fix: it also refetched the whole list after a withdrawal, which is wasted work because Mica merges the updated row into the list in place, so the example drops that fetch. It has since also moved onto controls Mica added after the build: the withdraw Button is busy instead of hidden beside a Withdrawing… line, and the reason Input shows its field error in error instead of a Text under it, and each amount is a raw number the document shows with $format instead of the host’s amountLabel text. Apart from that amount, its contract asks the host for exactly what the request named:

Host contract
employee = hr.Employee (one record)
fetch() -> {id, name: string, team: string}
claims = expenses.Claim (a list of records)
fetch() -> [{id, merchant: string, amount: number, status: pending|approved|rejected|withdrawn}]
update(id, withdrawalReason: string (minLength 3, maxLength 500)) -> {id, merchant: string, amount: number, status: pending|approved|rejected|withdrawn}
At startup: fetch employee, fetch claims

The Sonnet build still works — a list, its loading, error and empty states, and an inline withdraw panel with the reason’s field error — but its status shows the raw value, and its contract asks for more than the request did:

The Sonnet build in the designer’s preview: three claims with their raw status values and a Withdraw button on the pending ones, and an inline panel asking for a reason under the list.

Host contract (- Opus, + Sonnet)
employee = hr.Employee (one record)
fetch() -> {id, name: string, team: string}
fetch(locale?: string) -> {id, name?: string, team?: string}
claims = expenses.Claim (a list of records)
claims = finance.ExpenseClaim (a list of records)
fetch() -> [{id, merchant: string, amountLabel: string, status: pending|approved|rejected|withdrawn}]
update(id, withdrawalReason: string (minLength 3, maxLength 500)) -> {id, merchant: string, amountLabel: string, status: pending|approved|rejected|withdrawn}
fetch(status?: pending|approved|rejected|withdrawn) -> [{id, merchant?: string, amountLabel?: string, status?: pending|approved|rejected|withdrawn}]
update(id, withdrawReason: string (minLength 3, maxLength 300)) -> {id, merchant?: string, amountLabel?: string, status?: pending|approved|rejected|withdrawn}
At startup: fetch employee, fetch claims

Nobody asked for a locale or a status filter, but a host implementing this contract now has to accept both, and every record field became optional. Sonnet invented inputs like these in many of its builds of this request; Opus never did.

What to check: read every capability’s inputs in the contract against the request. An input nobody asked for is work for the host developer and a place for the two sides to disagree. Fields the document only reads should be required when the host always returns them.

  • The refuse-and-repair loop works. A refused call changes nothing and names every reason, so the next round is a targeted fix — but the fix is the agent’s choice, and a repair can satisfy Mica while adding something nobody wanted. Read the result, not only the fact that it imports.
  • Send finish on its own. A finish in the same response as a call that is refused fails too, because the draft is still missing what that call would have added.
  • Follow-ups are small. Asked for one more question, the agent edited nine things and rewrote nothing.
  • Preview hides permission-gated controls. The expense build shows Withdraw only while the host allows update. The designer’s preview seeds every host operation as not allowed, so the button never appears there (see preview and debug); in the live example, which runs a stand-in host, it does.
  • One prompt, more than one design. The packing checklist in Build with an agent came back as two lists in one build and as a tick in each row in another.