Marquetry: generative UI for Ember, as a Joinery and Formwright sibling
Marquetry lets a model build a user interface from Joinery components and Formwright forms.
Summary
Marquetry lets a model build a user interface from Joinery components and Formwright forms. The model streams a JSON spec. A catalog limits what the spec can contain. An Ember renderer shows the spec while it streams.
Marquetry follows the Joinery methodology: v2 addons in a pnpm monorepo, strict TypeScript and
Glint, .gts everywhere, a harness class for every component, a Kolay guide whose examples are
all tested, a hand-written marketing site with a live demo, Changesets, and tag-triggered OIDC
releases.
Change a decision only with the maintainer's agreement, and record the change at the top of this file.
Glossary
Not recorded in the original plan.
Problem and context
Not recorded in the original plan.
Goals and non-goals
Not recorded in the original plan.
Customers
Not recorded in the original plan.
Internal stakeholders
Not recorded in the original plan.
Users and scenarios
Not recorded in the original plan.
Landscape and constraints
Not recorded in the original plan.
Proposed design
Target layout
ember-marquetry/
packages/
core/ @ember-marquetry/core no Ember: catalog, spec, stream compiler, expressions, validation, repair, prompt, JSON Schema
ember/ @ember-marquetry/ember <Render>, registry, state store, actions, error boundaries, GenerationMachine
joinery/ @ember-marquetry/joinery the ready catalog and registry of Joinery components, layout parts and page templates
formwright/ @ember-marquetry/formwright Form and Field spec elements on Formwright, the three validation sources
chat/ @ember-marquetry/chat thread, streamed markdown, tool-call components, approvals
mcp-apps/ @ember-marquetry/mcp-apps sandboxed iframe host for MCP Apps
ai-sdk/ @ember-marquetry/ai-sdk Vercel AI SDK UI message stream adapter
ag-ui/ @ember-marquetry/ag-ui AG-UI event stream adapter
a2ui/ @ember-marquetry/a2ui A2UI v0.9.1 to Marquetry spec
sse/ @ember-marquetry/sse plain fetch, JSONL and SSE client
inspector/ @ember-marquetry/inspector dev panel: spec, patches, state, errors
eslint-plugin/ @ember-marquetry/eslint-plugin rules for catalog and registry definitions
skills/ @ember-marquetry/skills agent skills for the API
test-support/ @ember-marquetry/test-support harnesses, and a scripted stream for tests
cli/ ember-marquetry `npx ember-marquetry add`, and its registry
test-app/ Vite Ember app: integration tests; built into docs/site/demo/ (the playground)
docs-app/ the Kolay guide → docs/site/guide/
examples/ ember-vite-basic, ember-classic, server-node, server-rails (each runs in CI)
recordings/ recorded model streams for the demo, the hero and the tests
docs/site/ hand-written marketing page, styled with Joinery's compiled CSS
scripts/ publish.mjs, publish-plan.mjs, record.mjs, site and registry checks
Each add-on exports its own harnesses from a /test-support subpath, as Joinery's add-ons do.
Architecture
The spec (core)
- A spec has
root,elements(a flat map from id to{ type, props, children }) andstate. - The model sends one JSON object on each line. Each object is an RFC 6902 patch operation.
- The stream compiler accepts a partial line and applies each complete operation in order.
- A prop value is a literal or an expression. Expressions read state, bind a control to state
in two directions, select by a condition, fill a text template, and repeat an element for
each item of a list. A
visiblecondition hides an element. - Expressions are data. The renderer never evaluates code from the model.
The catalog (core)
defineCatalog({ components, actions }). Each component has a Standard Schema for its props, a description, and the slots it accepts.catalog.prompt()writes the system prompt.catalog.jsonSchema()writes a schema for tool definitions and structured output.catalog.validate(spec)returns errors by element id.catalog.repair(spec)applies decision 13.- Catalogs merge, so an app adds its own components to the Joinery catalog.
The renderer (ember)
<Render @spec @catalog @registry @state @onStateChange @onAction @onError />.- The registry maps each catalog name to a Glimmer component. No template compiles at runtime.
- Each element renders in an error boundary. An element that is not complete shows a skeleton.
GenerationMachine(Switchyard) has the states idle, streaming, done, error and aborted. An abort stops the fetch.- An action runs only if the catalog lists it.
confirm: trueopens a JoineryAlertDialogfirst. The handler's result goes to@onAction, and the chat package sends it to the agent.
Layout (joinery), decision 10
- Parts:
Stack,Grid,Split(onResizable),Tabs,Accordion,Card,Sidebar,Sheet,Dialog,ScrollArea, with gap, columns and breakpoint props. - Templates:
DashboardPage,DetailPage,WizardPageand others. Each has named slots that the model fills. - Free grid: a
GridAreaspart. The validator accepts only area names, track sizes from a fixed grammar, and children that name a declared area.
Forms (formwright), decision 11
- A
Formelement renders Formwright's<Form>. AFieldelement renders<f.Field>. - Validators run in this order: the named app validator, the JSON Schema, then the field rules.
- Submit is a catalog action. The model never receives a value unless the action sends it.
Chat (chat)
- A thread on Joinery's
Message,Bubble,MessageScroller,Trace,AttachmentandQuestionnaire. - A message part is text (streamed markdown), a spec (
<Render>), a tool call, or an MCP App. toolComponentsmaps a tool name to a component that gets the arguments, the status and the result. A tool can wait for approval from the user.
Safety
- The renderer shows only catalog components and never inserts HTML from the model.
- URLs in props pass an allow-list of schemes and hosts.
- MCP Apps content runs in a sandboxed iframe with a strict CSP and a typed message channel.
- The demo keeps a pasted key in memory only, and sends it only to the provider.
joegaudet.com and siblings
joegaudet.github.io: add a<article class="project marquetry">after switchyard inindex.html, its accent insite.css, and the name in thedescriptionandog:descriptionmeta tags.- PRs to ember-formwright, ember-joinery, switchyard, real-enums and harnessed that add Marquetry to their sibling lists and footers.
User interface and prior art
Guide, demo and site
- Guide (
docs-app/): getting started, the spec, the catalog, expressions, layout, forms, actions, chat, each adapter, the two server examples, safety, tests, and a generated API reference. Each catalog component has a page with its schema and a live example. - Demo (
test-app/): a playground with three panes: the prompt, the spec with its patches, and the render. A list of recorded prompts needs no key. The inspector is on. - Site (
docs/site/): the sibling layout and type, with its own accent and logo. The hero plays a recorded stream (decision 20). Sections: why Marquetry, the three patterns, catalog, layout, forms, chat, adapters, safety, tests, install, siblings.
Requirements
Definition of done for every package
- A harness for each component, in
test-supportor the add-on's/test-support. - Tests written first, with the harness, and an axe audit at the end of each render test.
- A guide page with a live, tested example for each public API.
- An entry in the copy CLI's registry where the code can be copied.
- A changeset.
Tests never call a model. They use the scripted stream or a file from recordings/.
Data model and API changes
Not recorded in the original plan.
Security and permissions
Not recorded in the original plan.
Observability and success metrics
Not recorded in the original plan.
Rollout and migration
Precondition for release
Marquetry 1.0 releases only after Joinery 1.0 is on npm and every git link is an npm range
(decision 3). On 2026-11-30, npm view @ember-joinery/ember returned an error.
@ember-formwright/ember was 2.0.1 and @switchyard-ts/ember was 0.5.0.
Met on 2026-12-01: Joinery 1.0.1 is on npm, and every Joinery dependency is an npm range.
The last phase: GitHub, npm and release
Nothing in this phase runs before phases 0 to 12 pass the gate locally. Each step in this
phase needs Joe: an account, a credential, money, or a step that other people can see. The work
that needs no one is already done: ci.yml, pages.yml, release.yml,
bootstrap-publish.yml, .changeset/config.json, scripts/publish.mjs and its tests, and a
prepared ~/dev/setup-ember-marquetry.sh (outside the repository, as for Joinery).
- Recordings. Record the real streams from Claude with
examples/server-node/src/record-cli.ts(it needs a key and costs money), and replace the scripted streams that the demo plays. - A second origin for MCP Apps. GitHub Pages serves one origin, and the sandbox proxy must be on another origin, for example a subdomain served from a separate repository. This needs a DNS record. Until then, the demo shows MCP Apps only locally.
- Joinery on npm. Done on 2026-12-01 (see "Changes to decisions").
- Commits. Make the commits on
build/marquetry-1.0, after Joe agrees. Nothing is committed before this step. - The npm org. Create the npm org
ember-marquetryby hand. npm has no CLI for this step, and the setup script checks for the org before it changes anything. - The repository. Run
~/dev/setup-ember-marquetry.sh. It createsjoegaudet/ember-marquetry, copies the settings and thenpm-bootstrapenvironment from ember-formwright, and prints the last manual step: give the Claude GitHub App access. - Push. Push
mainwith the first commit only, then pushbuild/marquetry-1.0and open the stacked PR. - Pages. Set the Pages source of the repository to "GitHub Actions".
- Release. After Joe merges the PR, release with one command:
cd ~/dev/ember-marquetry && bash ~/.claude/skills/oss-release/release.sh. - Sites. Open the joegaudet.com PR (branch
add-marquetryin~/dev/joegaudet.github.io) and the sibling PRs.
Work items
Phases (each phase is a group of units in the stacked PR)
- Local bootstrap.
git init, the branchbuild/marquetry-1.0, the workspace, and the tooling for plain TypeScript packages. No GitHub repository and no npm org yet. core. Spec types, stream compiler, expressions, catalog, validation, repair, prompt, JSON Schema.- Ember tooling. Glint, lint, the two Ember versions,
test-app, the example apps, and the git links to Joinery. ember. Renderer, registry, state, actions, error boundaries,GenerationMachine, harnesses, the scripted stream.joinerycatalog. Layout parts, then display, inputs, overlays, charts, data table, code block, then templates and free grid.formwright. Form and Field elements, the three validation sources, submit actions.sse, then recordings. The plain client,scripts/record.mjs, and scripted streams inrecordings/. A scripted stream is written by hand and says so in its file. The real recordings from Claude wait for the last phase, because they need credentials and cost money.chat. Thread, streamed markdown, tool-call components, approvals.- Adapters.
ai-sdk,ag-ui,a2ui. mcp-apps. The iframe host and its message channel.- Server examples.
examples/server-nodeandexamples/server-rails. - Tooling. Inspector, ESLint plugin, skills, copy CLI.
- Guide, demo, site. All built and tested locally.
- GitHub, npm and release. See "The last phase" below.
Future work and research
Not recorded in the original plan.
Alternatives considered
Changes to decisions
- 2026-11-30, decision 3 (Joe): Marquetry does not wait for Joinery 1.0. It uses git links
to
joegaudet/ember-joineryuntil Joinery is on npm, then changes to npm ranges. - 2026-12-01, how the git link works: pnpm cannot install a Joinery package from a git
URL, because the package must build at install time and needs its sibling packages built
first.
scripts/joinery-link.mjsclones Joinery at the commit injoinery-link.json, builds it, and writes the packed packages to.joinery/packages/.overridesinpnpm-workspace.yamlpoint at those directories. Packages declare npm ranges (^1.0.1), so the change to npm is: delete the overrides, the script andjoinery-link.json. - 2026-12-01, decisions 7 and 8 (Joe): the demo's own-key mode supports more than one
provider. A visitor selects Anthropic, OpenAI, or an OpenAI-compatible endpoint (a base URL,
for example OpenRouter or a local server), pastes a key, and selects a model. The key stays in
memory, and goes only to that provider. Recordings and guide examples still use Claude first.
The live page of
examples/ember-vite-basicgets the same theme switch as the demo: light, dark, or the system setting. - 2026-12-01, Joinery on npm: all seven
@ember-joinery/*packages are on npm at 1.0.1. Thefile:overrides,scripts/joinery-link.mjs,joinery-link.json,.joinery/and the CI link steps are deleted. The full gate passes against the npm packages. - 2026-12-01, sign in with OpenRouter (Joe): a demo visitor who has no key signs in with
OpenRouter (OAuth PKCE, no server). The visitor's own OpenRouter account pays, so the
maintainer never pays. The key lasts one day with a $1 limit, and stays in memory only.
sessionStorageholds only the verifier and the state until the callback. The model list comes from the public models endpoint of OpenRouter when the page runs. - 2026-11-30, phases (Joe): the work starts in a local git repository. The GitHub repository, the npm org and the release setup are the last phase.
Decisions (from intake, 2026-11-30)
| # | Area | Decision |
|---|---|---|
| 1 | Name | Marquetry. Repo joegaudet/ember-marquetry, npm @ember-marquetry/*, CLI package ember-marquetry |
| 2 | Spec format | Our own spec is native: a flat element map, a root and a state object, streamed as JSONL RFC 6902 patches. A2UI comes in through an adapter |
| 3 | Joinery | Git links to joegaudet/ember-joinery during the build. npm ranges before the release, which waits for Joinery 1.0 |
| 4 | Scope of 1.0 | All four patterns: declarative specs, tool-call components, a chat thread, and an MCP Apps host |
| 5 | Adapters | Vercel AI SDK, AG-UI, A2UI (v0.9.1), and a plain fetch and SSE client |
| 6 | Server side | core runs on Node (prompt, JSON Schema, validation, stream helpers). examples/ has a Node endpoint and a Rails endpoint |
| 7 | Demo model | The demo replays recorded streams by default. A visitor can paste a key to call a real model from the browser. The key stays in the browser |
| 8 | Provider | Guide examples and recorded streams use Claude first. Notes show the changes for other providers |
| 9 | Catalog | Every Joinery component that fits a spec, plus charts, the data table and the code block |
| 10 | Layout | Three levels: layout parts (Stack, Grid, Split), named page templates (dashboard, detail, wizard), and free CSS grid areas |
| 11 | Form rules | Three sources: a JSON Schema in the spec (wrapped as a Standard Schema), rule props on each field, and app validators that the spec names |
| 12 | State | Controlled or uncontrolled, as in Joinery: a tracked store in the renderer by default, or @state and @onStateChange |
| 13 | Bad specs | Repair first (remove unknown props, coerce simple types). An element that stays invalid shows a fallback and reports to @onError |
| 14 | Actions | Only catalog actions run. An action can require a confirm dialog. The result can go back to the agent |
| 15 | Markdown | Our own streamed renderer: markdown to Joinery components while the text streams, with CodeBlock for code. No HTML from the model |
| 16 | Tooling | A spec inspector, an agent skills package, a copy CLI (npx ember-marquetry add), and ESLint rules |
| 17 | Ember | 7.3 and 6.12 LTS, in Vite/Embroider and classic ember-cli apps, each with an example app in CI |
| 18 | Process | One long branch, build/marquetry-1.0, in a local repository. It becomes one stacked PR when the GitHub repository exists. Joe reviews and merges it |
| 19 | Positioning | MIT, with an original API. The README and NOTICE credit json-render and A2UI for the ideas and the formats |
| 20 | Site hero | A recorded stream plays in the hero: a prompt, then a dashboard that builds itself from Joinery parts |
Defaults chosen without a question; please check them: the core Ember package is
@ember-marquetry/ember; the test prefix is mq; Node ≥ 22.12 (scripts run on 24), pnpm 10,
TypeScript 6; QUnit with ember-a11y-testing for Ember packages and Vitest for core; GitHub
Pages at joegaudet.com/ember-marquetry/, with /guide/ and /demo/ under it; the generation
state machine uses Switchyard; the logo is a marquetry fan or star in the sibling style.
Risks
Risks and open items
- A2UI versions. Google's blog calls 1.0 stable, and a2ui.org calls it a release candidate. The adapter targets v0.9.1 and has a version switch.
- Prompt size (measured 2026-12-01). The full Joinery catalog has 69 components, and its
prompt is 51,327 characters (about 13,000 tokens). A pick of ten components for a dashboard is
10,275 characters. The largest entry is
GridAreas. The server marks the prompt for caching. - Model quality. A large catalog makes a long prompt. The catalog needs a way to send a subset for each request, and the recordings need a check for each catalog version.
- Free grid areas. This layout level breaks most easily. The validator and the repair step need the most tests here.
- Browser keys. The demo's own-key mode calls the provider from the browser. The guide must tell users not to do this in production.
- Git links. A git link to a monorepo package needs a build step at install time, and
~/.npmrcsetsignore-scripts=true. Phase 2 must prove the link in a Vite app and in CI. - Name. Nobody checked if
ember-marquetryand the@ember-marquetryorg are free on npm. The setup script checks this before it changes anything. - Joinery bugs found by Marquetry (report them upstream).
MessageScroller: two items with@scrollAnchorin a container with no height stop the page when the tree is removed. The chat does not use@scrollAnchoruntil a fix.Alertwith thedestructivevariant: the description has a contrast of 4.49:1, under 4.5:1. The chat shows its errors with the default variant until a fix.- Joinery's compiled colours fail AA in more places:
--muted-foregroundon--mutedis 4.34:1, theKbdtext, and theAvatarfallback. The guide makes its own tokens darker. Threetest-apptests (kbd,alert,avatar) exclude these nodes from axe, which the rules do not permit. Fix the colours in Joinery, move the pin, then delete the exclusions.
- Formwright version. The Joinery bridge needs Formwright
^1.3.0, so Marquetry uses 1.3, not 2.0. Move to 2.x when the bridge does. - Markdown headings. A model can skip heading levels, and axe then reports
heading-order. The chat shows the levels that the model writes.
Open questions
The original plan lists its open items under Risks.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file MARQUETRY_PLAN.md at commit 9447b56. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: MARQUETRY_PLAN.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-01 | Joe Gaudet | Commit 8f2790b: chore: add the workspace, the tooling, CI and the plan |
| 2026-12-01 | Joe Gaudet | Commit cd47c86: Marquetry 1.0: generative UI for Ember (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from MARQUETRY_PLAN.md to this page. The text is the text of the Markdown file. |
| 2026-12-04 | Joe Gaudet (agent) | Status Shipped: @ember-marquetry/core 1.0.0 and @ember-marquetry/ember 1.0.0 are on npm. The Markdown file says that the precondition for release was met on 2026-12-01. |
The prd skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.