Proposal: State-Model-First Prototype Pipeline

Status: SUPERSEDED (2026-06-26) by the flow-walk re-cut (alignment/ui-interview-flow-walk-refactor-architecture.html, flow-tree schema v0.4). The route-tuple expansion to 8 steps, mandatory state-model/create-ui-experiment route positions, cross-branch --batch deferred mode, and app-level scope field are dropped. Two ideas were cherry-picked into the executed change: the state-model fast-pass fold for CRUD-trivial domains and the per-screen model_ref on ui_experiment. §2's file:line map is retained for reference only.

Status (historical): proposed — no canon edited yet.

Authored by: companion to alignment/investigate-prototype-design-tree-flow.html (§2).

Scope of this doc: spell out every convention / skill / schema / sample / test edit an

executor would apply to promote state-model and create-ui-experiment from off-route

attachments into first-class inline route steps. This is a plan, not the change.

1. Summary & rationale

Target sequence

journey-map ▶ user-flow-map ▶ state-model ▶ ux-variations ▶ ui-interview
  ▶ create-ui-experiment ▶ user-flow-map --prototype-build-plan
  ▶ prototype ⇄ uat ▶ consolidate-prototypes ▶ research-roadmap --post-prototype ▶ spec-interview

user-flow-map translates the journey map into design language (screen flow, entry points, decisions/actions/states). state-model then codifies the data architecture before the UX/UI passes — the domain/state/logic model is a property of the flow, not of any one UI presentation, so authoring it once gives ux-variations / ui-interview a real substrate to re-skin instead of re-inventing per variation.

Two promotions:

  1. state-model → mandatory inline route step (was: orthogonal, skippable per-branch
  2. sibling). It owns a hierarchical model attachment — app-whole (tree root), per-flow (today's model_ref), and per-screen (as needed). For CRUD-trivial domains it carries a fast-pass fold: a quick confirm of the obvious data shape instead of a full multi-framework modeling pass.

  3. create-ui-experiment → mandatory inline route step between ui-interview and
  4. user-flow-map --prototype-build-plan (was: per-branch experiment owner, "not a replacement top-level route position"). It is batchable/deferrable: the user may finish all ui-interview experiments first, then knock out all clickable experiments in one pass, so later interviews can adjust earlier experiment specs.

Why data-first is safe

The existing convention already enforces model-before-presentation: ux-variations "requires the branch's model_ref confirmed; do not grow UX branches first" (docs/design-tree-loop-convention.md L360, L131–132). So the dependency is real today — it is just enforced by next-step recommendation rather than drawn in the route tuple. This proposal makes the existing dependency honest rather than inventing a new one.

Data-first does not lose UX-driven discovery, because the modify / needs-revalidation loop catches model errors found during prototyping. A modify decision names targets[] (an upstream user-flow branch or a model_ref node), returns each target to pending, and marks descendants stale for re-validation (docs/design-tree-loop-convention.md §4 L297–308; design/flow-tree.schema.json decision $defs L442–452). So if a UX/UI/prototype pass exposes a modeling gap, the loop re-opens state-model — UX-first ordering is not needed to surface model problems.

2. Blast radius — exact edits with file:line anchors

Line numbers are anchors against the working tree at authoring time; an executor should

re-grep the quoted wording before editing.

2.1 docs/design-tree-loop-convention.md

"The top-level route tuple stays the 6-skill sequence (`user-flow-map → ux-variations →

ui-interview → prototype → consolidate-prototypes → spec-interview) … state-model` is a

per-branch attachment (model_ref), not a route position — keeping the route stable

while the model rides each branch."

Edit: expand the tuple to the 8-step proposed sequence with state-model after user-flow-map and create-ui-experiment after ui-interview; replace "not a route position" with "a mandatory route step that attaches the hierarchical model (app/flow/screen)."

"Route approved clickable route experiment needs to create-ui-experiment before prototype

buildout. create-ui-experiment is a branch experiment owner, not a replacement top-level

route position; the canonical route still reaches build sequencing through

user-flow-map --prototype-build-plan and prototype."

Edit: reposition as an inline, mandatory route step after ui-interview; add the batchable/deferred semantics (all interviews may complete first, then all experiments in one pass, allowing earlier-spec adjustment).

Edit: add two node types — root-level (app) model attachment (a tree-root model the first state-model session authors before per-flow iteration) and per-screen model attachment (attached as needed, recommended on the ui_experiment node). Update the node table and the "Per-user-flow-branch model attachment" prose to describe the app/flow/screen hierarchy.

2.2 docs/skill-next-step-contracts.md §8

"state-model is an orthogonal sibling … it writes only an optional model_tree_ref

pointer into the flow tree and never alters the flow-tree route array, so it is

recommended-but-skippable, not a route enum member."

Edit: drop "(optional sibling)" / "orthogonal sibling" / "recommended-but-skippable, not a route enum member"; state it is a mandatory route step (app/flow/screen, fast-pass fold) and that create-ui-experiment is a mandatory-but-batchable step after ui-interview. Note the route string here already lists create-ui-experiment's downstream (user-flow-map --prototype-build-plan) but not create-ui-experiment itself — insert it.

2.3 packs/product-design/claude/state-model/SKILL.md (+ codex mirror)

Mirror: packs/product-design/codex/state-model/SKILL.md (layer1 parity test enforces both).

The model_ref-vs-model_tree_ref contradiction is already resolved (state-model v0.8, 2026-06-24, COA 1): the Architecture section and the Constraints "flow-tree write" line now both state branches[].model_ref is the primary flow-tree write and the top-level model_tree_ref is optional back-compat — matching §4 and the design-tree-loop convention. The remaining promotion work below is the route-position change only (orthogonal-sibling → first-class route step), which v0.8 intentionally did not make.

The still-off-route framing the executor must flip:

Edit toward a first-class route step that owns app/flow/screen model attachments:

2.4 packs/product-design/claude/create-ui-experiment/SKILL.md (+ codex mirror)

Mirror: packs/product-design/codex/create-ui-experiment/SKILL.md.

2.5 packs/product-design/claude/ui-interview/SKILL.md (+ codex mirror)

Source-of-truth note: ui-interview, ux-variations, and user-flow-map are authored under

packs/product-design/claude/ (and …/codex/) — that is what the skillpacks manifest bundles.

The .claude/skills/<skill>/SKILL.md copies are gitignored generated install roots and can

lag the source; do not edit them. Re-derive the line anchors below against the packs/ source.

2.6 packs/product-design/claude/ux-variations/SKILL.md (+ codex mirror)

2.7 design/flow-tree.schema.json

2.8 design/model-tree.schema.json

2.9 design/flow-tree-sample.yaml

2.10 tests/layer1/product-design-flow-tree.test.ts

3. Versioning & mirrors checklist

Per CLAUDE.md Skill Versioning:

4. Open design questions (resolve before applying canon)

  1. Per-screen model home — attach the per-screen model_ref to the existing
  2. ui_experiment node (recommended — minimal schema surface), or introduce a dedicated screen node type? Recommendation: the ui_experiment node.

  3. Does route literally enumerate the two new steps? An 8-item tuple makes the order
  4. machine-checkable, but must be reconciled with "fast-pass" — fast-pass means always present, foldable, not sometimes absent. So state-model stays in the tuple even for trivial domains; the fold only collapses its session count, not its route membership.

  5. App-level model timing — is the app-whole model one root attachment authored in the
  6. first state-model session (before per-flow iteration begins), then refined per flow? Recommendation: yes — author the app-root model first so per-flow models inherit shared entities/vocabulary.

5. Verification (for the executor who applies this)