# canonical multimodal ui

- Status: `experiment`
- Track: [post-<a> hypermedia & composable islands](https://aifoc.us/labs/hypermedia-and-islands/)
- Layer: 2. Post-<a> Hypermedia & Composable UI
- Updated: 1 December 2026
- Live demo: https://canonical-multimodal-ui.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/canonical-multimodal-ui

## Inspired by

- [web components are packaging for ai-generated ui](https://aifoc.us/elements/)
- [webmcp is the new web intents ... maybe](https://aifoc.us/webmcp-is-the-new-web-intents/)

## Hypothesis

- **Claim:** Generating semantic HTML forms (`FormData`, ARIA, `commandfor` invokers) and WebMCP JSON tool descriptors from one declarative `ACTION_DEFINITIONS` object eliminates drift between human UI and machine tool execution.
- **Confirms it:** Dispatching an identical action through the HTML form UI or the headless WebMCP console executes the same shared reducer and produces byte-identical FNV-1a state hashes.
- **Falsifies or bounds it:** Rich multi-field validation, conditional sub-fields, or visual grouping constraints force UI-only overrides that break single-schema generation.

> **Why this exists:** Whenever teams build a visual HTML form for humans and a separate JSON tool definition for an automated assistant, the two surfaces drift out of sync—enums, required fields, or validation rules change in one place and silently break in the other. Generating both the human DOM controls and the machine-callable schema from one shared reducer guarantees identical validation and state transitions.


## What this lab tests

[Canonical Multimodal UI](https://canonical-multimodal-ui.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/canonical-multimodal-ui)) generates both semantic ARIA/`FormData` HTML controls (with Invoker `commandfor` actions) and [WebMCP](https://webmachinelearning.github.io/webmcp/) JSON tool schemas from one declarative schema backed by an FNV-1a hashed reducer to eliminate UI/API drift.


## Open questions to iterate on

- How cleanly can conditional rules (`if country != US show customs`) from `reactive-goal-ui` compile into `ACTION_DEFINITIONS` schemas?
- Can native `<form>` validation + `ElementInternals` serve as the authoritative runtime schema read by `navigator.modelContext`?

## Iteration log

- **2026-12-01:** Built split Human DOM vs. Headless WebMCP workbench with FNV-1a state-hash parity and published full verbatim `ACTION_DEFINITIONS` source at top of page.
- **2026-12-01:** Reordered the dual-modality workbench above setup docs for 700px embeds, added CSP-safe DOM syntax highlighting across code and HTTP wire panes, added keyboard tab navigation, and routed static assets through the Worker with `Cache-Control: no-cache` and 15 passing tests.

## Primitives tested

- `ARIA Accessibility Tree`
- `JSON Schema`
- `Invoker Commands`
- `FormData`
- `WebMCP`

## Connected labs in other tracks

- [backward-chaining goal-driven reactive ui](https://aifoc.us/labs/reactive-prompts/reactive-goal-ui/) — Generates dynamic missing-input forms from constraint schemas.
- [web + ai spec polyfill testbed](https://aifoc.us/labs/hypermedia-and-islands/spec-polyfill-browser/) — Runs 15 conformance assertions across polyfilled WebMCP APIs.

---
Canonical: https://aifoc.us/labs/hypermedia-and-islands/canonical-multimodal-ui/
