0071 — Workflows are the product unit, and the web splits into a site and a viewer

Status: decided 2026-10-01 by the design panel and landed the same night on main, starting from 9e3e782d, as the commits listed under As landed. Commits stay local and unpushed until the owner reviews them. This record keeps the design's structure and reasoning, and states every detail as it landed; where execution departed from the design, the section says so. It supersedes 0069 only on the viewer being launched by the CLI, multi-root and workflow-aware.

1. Context

Everything above the gnode engine was organised by who executes, while people think in terms of what they get. A person wants a named deliverable: a movie sprite, a 3D character, a universe gallery, parallax layers. Stage Gen had no first-class object for that. The same deliverable was spelled independently in about six places: the pipeline_id or recipe literal, the cache namespace, the type-id prefix, the CLI word, the docs path and the showcase slug. Several of those are cache identity, and for movie sprite and portrait they include the source files' own bytes.

Everything a reader would want to know sat outside the code. The eight showcase MDX pages restated 122 node labels, stage groupings, tools, model names and commands by hand. The four execution substrates write four run-folder layouts, so neither web surface read one contract.

There were two webs with overlapping jobs:

They duplicated players and the graph drawing. "Recipe" had at least seven meanings. There were 8 console scripts and a Godot CLI that also carried product commands.

The owner asked for four things:

2. The request, ratified at engineering level

3. Options considered

Five framings were proposed, attacked by critics, revised and scored by three judges.

4. The decision: one answer per question

QuestionAnswer
Product unit and nameWorkflow: one folder per deliverable, src/stage_gen/workflows/<snake_id>/, public id kebab-case (movie-sprite). The folder name equals the id with - written as _, and a test enforces it.
Where descriptions liveCode facts live in code (workflow.py exports CODE: WorkflowCode). Non-code facts live in workflow.toml. Prose lives in page.mdx and contract.md beside them, and an example with its own prose in examples/<id>.mdx. NodeType.title is the only per-node label. A [labels] override is allowed only for types whose title sits in a digested or frozen file: movie-sprite pipeline.py, components/portrait_motion, and the character-3d frozen set.
How evidence bindsFrozen exports in the gitignored store out/examples/<owner>/<example>/ (example.json, figures.json, media/, and for a game's example entry.json and page.mdx), pinned by sha256 in workflow.toml (and in the game's examples.toml). Each export records its source runs with their anchor-document digests.
Game-hosted deliverablesThey are examples made by a game, not a second kind of workflow. Bellweather owns their pins, prose and importers, and writes them to the store with demo-games example export bellweather.
Local clientThe Next app moved to web/viewer, launched by stage-gen view. It is read-only and multi-root. Views for runs that lack one are derived into ~/.cache/stage-gen/views/, never into run folders. It refreshes every 2 s while a run is live. Its "plan" graph comes from the catalog's offline sample plans, so there are no provider calls, no spawned processes and no endpoint.
Site stackweb/site: Next 16 with output: "export", React 19, Tailwind 4, @mdx-js/mdx with remark-gfm, and elkjs and @google/model-viewer bundled from npm. The showcase's vanilla page scripts are in web/ui/players as typed mount(el, config) modules with thin React wrappers; their logic, constants and comments are unchanged and only teardown was added.
Fate of web/ and apps/showcaseweb/ is the single Bun workspace (ui, viewer, site, one bun.lock, the hoisted linker) and stays the only Node boundary. apps/showcase was deleted in the commit that proved site parity. /universe/demo and lib/illustrated-map were deleted with the viewer launch, and gallery_page.py with the CLI.
IdentitiesSee §11. There is one deliberate bump (the portrait fingerprint). Character-3d is not moved. Its implementation stays at stage_gen.recipes.character_3d, a documented frozen path, and workflows/character_3d/ holds only its declaration, CLI and example importer. Provider composition (orchestration/movie_sprite_services.py, portrait_services.py, character_3d/) stays in orchestration/, the composition root, because the boundary test forbids concrete provider imports in workflow folders.

Why character-3d stays put, verified in code:

So any rename changes character member bytes. The owner's standing rule is that any character_3d member change needs a new paid qualification cohort, not a carry-over. There is no cross-run node cache (runner.py:486 always misses), so nothing is re-billed. The real price is a cohort before --admission-mode supported works again. That spend buys nothing a reader can see, so the path stays frozen until the next deliberate character contract change. The one remaining recipes/ directory is named in the glossary and in the architecture doc as exactly that.

5. Taxonomy

TermLevelMeaningReplaces
node typebuilding block (gnode)NodeType: type_id (cache identity), title (the only per-node label, excluded from cache keys and graph digests), archetype, operation, policynode_labels, [labels] tables, kit member
nodeexecution (gnode)One operation in a sealed graph, with a cache key—
componentbuilding blockA package under src/stage_gen/components/: node types, graph fragments (add_*_nodes), contracts, services. Never runnable alone; never imports a workflownode family, kit, capability (package sense)
workflowproduct unitA folder under src/stage_gen/workflows/ with workflow.py, workflow.toml, page.mdx, contract.md, cli.py, example.py where it has an importer, inputs/ where it has sample inputs, and its code (or a reference to its frozen implementation). Run with stage-gen run <id>recipe, harness id, showcase page, pipeline (as a unit), lane, deliverable
steppresentationA labelled group of node types with a one-line note, declared in workflow.py by referencing NodeType objects. Every node type sits in exactly one step. An example made with an earlier version may declare its own steps over its node idsstage (reader grouping), [[stages]] rows
inputauthoringA folder a run reads. Committed sample inputs live in <workflow>/inputs/examples/ input bundles
runexecutionOne execution folder. A chain (take then finish, semantic then gallery) is several runsrecipe run
exampleevidenceA frozen export of real runs (example.json as workflow-example-v1, figures.json, media/; a game's example adds entry.json and page.mdx), pinned by sha256 and made by a workflow or a game. It is the only result the site showsshowcase record, record.json, demo, canonical showcase run
capabilitytoolOne headless provider or media call outside any graph: stage-gen capability image|music|…. It keeps its existing module, stage_gen/capabilities.py, and config.CapabilityName. An audition is repeated capability calls whose chosen output a run later adopts by digestdemo-games generate-* one-shots
SDKauthoring APIstage_gen.pipeline: define/plan/run/inspect, node cache, dry run, ports, and GraphDocument (the sealed-document base class). A definition is what you write with it and run with stage-gen run file <path.py:attr>harness, public harness, RecipeGraph
graph executorsubstrate (developer)stage_gen.orchestration.graph_executor.GraphExecutor/PlannedGraph/GraphRun. It lives at the composition root because it builds RunServicesRecipeExecutor, RecipePlan, RecipeRun, "historical executor adapter"
catalogdata contractstage-gen-catalog-v1 JSON written by stage-gen catalog export from the installed workflows and the example store, beside cli.json, the stage-gen-cli-v1 command tree read from argparse. It is never committedMDX front matter, MODEL_NAMES, CHECK_WORDS
sitesurfaceweb/site, the static landing and documentationshowcase, apps/showcase, landing/marketing page
viewersurfaceweb/viewer plus stage-gen view, the local read-only clientweb viewer, run viewer, "optional web-based run viewer" as a separate app

Frozen persisted strings keep old words, and the glossary lists them so nobody "fixes" them:

The domain phrases "rig recipe" (character_3d/rig_recipes.py) and Ember Hollow's "crafting recipe" are unrelated and allowed.

6. Retired terms and their fates

7. Workflow anatomy, with the real movie-sprite tree

src/stage_gen/workflows/movie_sprite/            (git mv from recipes/movie_sprite_body_idle; R100 for digested files)
  __init__.py      public exports (Authoring, GenerationSettings, create_pipeline), loaded on first use
  workflow.py      CODE = WorkflowCode(...): steps reference PREPARE/GENERATE/ADOPT/FINISH from pipeline.py;
                   identity() reads PIPELINE_ID and the namespace from create_pipeline(); sample_plan() plans the
                   generate path from a Pillow-made canonical picture in a temp dir (no FFmpeg, no provider)
  workflow.toml    id="movie-sprite", title, promise="One character picture in. A transparent idle loop out.",
                   related=["portrait-motion"], tools (FFmpeg, OpenCV), [labels] for the 4 type ids (their titles
                   sit in digested pipeline.py), [[outputs]], [try], [[examples]] yuzu-idle (approved, pinned,
                   cover, landing order 6)
  page.mdx         the old showcase body, plus the old docs/movie-sprite.md guide as "Run it yourself"
  contract.md      the old workflow README: factory, graph, cache and lineage, a "Checked by" line, and the
                   generated graph-contract block
  cli.py           plan/run flags (was interfaces/movie_sprite.py); build_definition(args) is the one place
                   a definition is built from argv
  example.py       importer for SDK runs (was showcase adapters execution_view + lineage)
  pipeline.py      BYTES UNCHANGED (digested into the paid generate/finish keys)
  authoring.py     BYTES UNCHANGED (digested)
  inputs/supplied_clip/{make_inputs.py, pipeline.py}
src/stage_gen/components/movie_sprite/            unchanged (digested by filename)
src/stage_gen/orchestration/movie_sprite_services.py   unchanged location (concrete provider composition)
tests/unit/workflows/movie_sprite/
out/examples/movie-sprite/yuzu-idle/{example.json, figures.json, media/}   local, gitignored

The other units have the same shape:

8. How the code describes itself and how drift fails

WorkflowCode (defined in stage_gen/workflows/_registry.py) holds:

workflow.toml (stage-gen-workflow-v1, lower_snake_case, pydantic extra=forbid) holds only non-code facts. It is read without importing the workflow, so stage-gen --help and stage-gen list stay cheap. An [[examples]] entry carries its pins, status, source (store or library:<path>), and optionally cover, a landing order, its own title and promise for the card, and, for an example made with an earlier version, its own footer, labels and steps over node ids.

stage-gen catalog export --check and tests/contract/test_workflow_registry.py fail when any of these happens:

Also:

9. Evidence: examples

Freeze (before any code moved). The eight showcase pages were rebuilt and found byte-identical to the verified baseline copy. Each page's record.json, figures.json and media/ were copied to the store under a frozen/ folder, with FREEZE.sha256 (354 files) and a tar. A manifest records path, size, mtime and sha256 for every source run the records name, and it was re-checked after every step. No run folder was ever written.

Convert. A one-off local script converted each record to workflow-example-v1:

figures.json was copied byte for byte, except that tavi-parts listed export.glb twice; its earlier entry was dropped and the last kept. example_sha256 and figures_sha256 are pinned approved in workflow.toml. The ported importers re-derive yuzu-idle, yuzu-face, wren-brief and tavi-parts from their runs with every media digest identical to the frozen copies. The face-rig rebuild check now compares every channel, where the showcase compared alpha only, and yuzu-face passes it.

Currency. It is derived at export. An example is current when its origin=run type ids are a subset of its owner's types and its graph kind (if any) is one of the owner's kinds. Otherwise it is "made with an earlier version", shown only inside the production-notes disclosure, with the graph drawn from the example's own nodes and steps:

Library characters. Nami, Riko and Helix are approved character-3d examples with source = "library:library/characters/<id>". They are built at export from the tracked files that sd_3d.json binds, each checked against its digest.

Clean clone. --allow-missing-examples builds every page from code-derived facts, declared facts and the library characters; a card whose example is absent is drawn faded. A present-but-mismatched example still fails. The web gate builds the site in this mode.

Publication. Nothing derived is committed and nothing is deployed. Committing run media or deploying the site stays the owner's decision under generated-media publication.

No new examples were promoted. Universe, storefront and looping-parallax appear in the workflow reference, in stage-gen list and in the viewer, but get no landing card until the owner reviews a run.

10. Game-made examples

Rule: a workflow must run from product inputs with stage-gen run <id> and no game package. Output only a game can make is an example made by that game.

The four Bellweather pages (parallax backgrounds, terrain tiles, game UI kit, sprite animation set) work like this:

The landing (amendment A1) is one ordered list of eight cards in the owner's order: the four Bellweather examples, then portrait motion, movie sprite, the 3D character and the 3D character from parts. Game-made cards are not demoted to a separate section; each carries one quiet line, "Made inside the Bellweather example game", and its page names the real command and that a whole game package is needed.

Promotion rule, recorded in CONTRIBUTING: a game output becomes a workflow once it has product-owned inputs, a standalone product graph and a real product run. The first candidates are the UI kit and parallax-from-reference.

11. Identity preservation

Pinned before anything moved. tests/contract/test_workflow_identity.py plus tests/contract/fixtures/workflow-identity.json were written on 9e3e782d in the first commit. The pins are machine-independent:

Keys over FFmpeg-made inputs (the movie-sprite adopt path) were covered by a local before-and-after diff that planned from the same input files, generated once, after every step. It showed no diff at any step. It is not a CI gate.

The existing game cache-key goldens stayed authoritative and byte-identical where they moved.

The one deliberate bump: the portrait-motion implementation fingerprint. It landed in the commit that renamed recipes/ to workflows/, and only there:

The re-pin diff listed only those files: the keys moved, __init__.py dropped out, and four hashes plus the face-location digest changed.

What the bump costs:

Character-3d closure. Every character member stayed byte- and path-identical, and the golden proves it. package_closure_sha256 changes, as it does on every commit that touches the wheel. The next supported run therefore needs the owner's usual non-capability carry-over record, not a cohort. The workflows/character_3d/ declaration files are never imported by the launcher or by a run.

Unchanged. Every type id, node id, contract_version, identity_prefix, cache namespace, GraphDocument literal and kind, and provenance name. Class renames are safe because no __module__ or __qualname__ is persisted, and gnode's build_node_cache_key and the Graph fields carry no titles. library/ and concept-studio/ paths are unchanged, and no run folder on disk changed. The demo-games model-policy snapshot moved only in path strings and in the file digests of documents whose paths it records.

12. The two webs

Site (web/site, @stage-gen/site).

Viewer (web/viewer, @stage-gen/viewer).

Shared (web/ui): the parsers for catalog-v1, example-v1 and RunView schema 3, with hand-authored fixtures that a Python test also validates, and the players the site mounts (the graph with ELK, the painter, the wipe, the UI kit, the face rig, the sprite and part stages, the parallax loop, stage and playground, the tabs and the copy buttons).

Not shared: app shells, routes, data access and deployment. The viewer keeps its own parallax preview, motion player and execution-graph layout: they inspect a run's state with React, while the site's players drive an example's authored markup.

Shipping a prebuilt viewer inside the Python distribution (the Inspect and MLflow pattern) is the named next step.

13. CLI

stage-gen list [--json]
stage-gen show <workflow> [--json] [--examples DIR]
stage-gen plan <workflow> [flags]        | stage-gen plan file <module:attr|file.py:attr> --input DIR [--output DIR] [--target T]...
stage-gen run  <workflow> [flags]        | stage-gen run  file <definition> --input DIR --output DIR --cache-dir DIR [--live] ...
stage-gen inspect <run-dir> [--verify] [--write-view DIR] [--json]
stage-gen view [--runs DIR]... [--port N] [--no-open]
stage-gen example promote <workflow> --run DIR... --id ID [--title T] [--option KEY=VALUE]... | verify [<owner>]
stage-gen catalog export --out DIR [--examples DIR] [--allow-missing-examples] [--check]
stage-gen capability image|remove-background|music|sound-effect|speech|video|inspect-video ...
stage-gen models routes
stage-gen env import

Mapping from before, with no aliases:

BeforeNow
stage-gen pipeline plan|run Fstage-gen plan|run file F
stage-gen pipeline inspect Rstage-gen inspect R
stage-gen-movie-sprite body idle plan|run|replaystage-gen plan|run movie-sprite [--replay]
stage-gen-portrait-motion prepare|run|verifystage-gen plan portrait-motion, stage-gen run portrait-motion, stage-gen inspect R --verify
stage-gen-character …stage-gen run character-3d … (argv forwarded verbatim to the frozen launcher)
stage-gen universe semantic|gallerystage-gen run universe --phase semantic|gallery
stage-gen storefront generatestage-gen run storefront
demo-games generate-*, remove-background, inspect-videostage-gen capability … (the --yes/not-a-terminal guard is ported verbatim)
demo-games import-envstage-gen env import
demo-games export-view (universe/storefront)stage-gen inspect R --write-view DIR

As landed, the CLI departs from the design in small ways:

14. Repository layout as landed

src/gnode/                      unchanged
src/stage_gen/
  workflows/                    _registry.py _catalog.py _checks.py + looping_parallax/ movie_sprite/ portrait_motion/ universe/ storefront/ character_3d/
  recipes/character_3d/         FROZEN implementation of the character-3d workflow (recipes/__init__.py says so)
  examples.py                   public example contract (workflow-example-v1, figures ledger, media derivation, recording reader)
  runs.py                       run discovery, view keys and derived views for the viewer
  pipeline/                     SDK + graph_document.py (GraphDocument); README.md points at docs/sdk/guide.md
  orchestration/                composition root: runtime, services, graph_executor.py, image_routing, env_import,
                                movie_sprite_services.py, portrait_services.py, character_3d/ (frozen)
  components/ (README.md holds the component contract) media/ providers/ resources/ (+ model_names.toml) config.py capabilities.py ...
  interfaces/cli.py + interfaces/commands/{workflows,sdk,inspect,view,capability,examples}.py
web/                            Bun workspace root (only Node boundary): ui/{contracts,players} viewer/ site/
godot/games/bellweather/        examples.toml, examples/<id>/page.mdx, pipeline/src/bellweather_pipeline/examples/
godot/games/_shared/python/src/demo_game_tools/manifest_blocks.py    (games-only code left the product)
docs/                           cross-cutting only: getting-started, glossary, viewer, site, sdk/{guide.md, pipelines/,
                                provider-neutral-image-node.md}, models/, policy, spec/, decisions/ (+0071), plans/, research/
scripts/                        + site.py, write_workflow_contracts.py, write_workflow_identity.py
tests/unit/{pipeline,orchestration,workflows/<id>,games/<old dir>}, tests/support/cache_key_golden.py
out/examples/                   local, gitignored example store
REMOVED: apps/showcase/ (after parity); examples/ (to docs/sdk/pipelines); fixtures/ (its topology reference to
         docs/spec/terrain-atlas-topology-reference.md; the packaged copies stay in resources/); output/ (the
         dialogue-framing experiment to godot/games/the_grain/docs/experiments); DESIGN.md (to
         docs/plans/2026-05-prototype-design.md); the per-workflow READMEs and the workflow guides and specs under
         docs/ (into page.mdx and contract.md); docs/component-contract.md (into components/README.md);
         docs/spec/system-overview.md; docs/tech/

docs/spec/asset-taxonomy.md stays: it is the type-id grammar that the games' format documents and package types cite.

15. Deliberately not done

16. Owner actions in the morning

  1. Review the commits, then push. The pre-push hook gates each one.
  2. Record the character-3d non-capability carry-over before the next supported run.
  3. Run uv run stage-gen list, then uv run stage-gen view --runs out --runs spikes/movie_sprite --runs spikes/3d-character-pipeline/runs, then uv run python scripts/site.py build && uv run python scripts/site.py serve.
  4. Visual QA of the site against the old showcase.
  5. Install the staged presentation copy when the presentation should show the new site.
  6. A downstream checkout that pins an older Stage Gen breaks on these when it updates, with these replacements:
    • stage-gen-character → stage-gen run character-3d;
    • stage-gen-movie-sprite → stage-gen run movie-sprite;
    • stage_gen.recipes.movie_sprite_body_idle imports → stage_gen.workflows.movie_sprite. python -m stage_gen.recipes.character_3d.corpus is unchanged.

17. As landed

CommitWhat it did
b174e1ffPin every paid identity before the workflow refactor: the identity golden and its writer.
0044a4acType the six test files mypy --strict refused on main, so every later step is held to a green aggregate gate.
b376078aRetire the recipe shims and name the substrate by what it does: GraphDocument in the SDK, GraphExecutor at the composition root; games-only modules leave the product.
6ff4d7d7Move the product workflows under stage_gen/workflows and bump the portrait fingerprint once; character-3d stays frozen.
f740e2a7Regroup tests by owner and delete dead product code.
e6da9f0aLet each workflow describe itself and pin its real examples: registry, catalog, drift checks, stage_gen.examples.
25812c04Let Bellweather publish the examples it made.
dfed0efcOne CLI: stage-gen list|show|plan|run|inspect over workflow ids, with the equivalence proof.
a3b1443dMake web/ one Bun workspace with shared contracts and the viewer.
f7355a1aLaunch the viewer from the CLI and show every workflow's runs.
c57e9698Build the site with standard tools and retire the hand-rolled showcase.
adc093c0Put workflow prose beside the code and make the vocabulary enforceable: this record, the doctrine, the checked graph contracts, the retired-term lint and the documented-command test.
2e4209a7Speak the workflow vocabulary in the agent instructions.
3576b96aStop the viewer child when stage-gen view is terminated: the launcher traps SIGTERM, SIGHUP and SIGINT and stops the whole process group (S12).
b2db530aFix what the final review found in the Python CLI and run readers: one flag vocabulary (--input, --output, --cache-dir), help on every argument, input pictures resolved against the run's own input root, clear refusals for game runs in inspect.
cb14e758Fix what the final review found in the site and viewer: the site names itself Stage Gen, the landing says what it is and how to start, pages without an example show no empty graph or footer, next-env.d.ts is generated instead of tracked.
17bea8a3Fix what the final review found in the docs: pages take output notes from workflow.toml instead of copying them, and the drift check refuses a copy; stale and contradictory prose corrected.
bbc2d921Say plainly when a run's output folder already exists.

Every commit passed the clean-worktree replica of the pre-push gate. From 0044a4ac on, every commit also passed uv run --all-groups python scripts/check.py --scope all; b174e1ff passed every step but mypy --strict, which had been red on main on six test files until 0044a4ac typed them. The identity golden, the before-and-after key diff, the frozen evidence and the untouched run folders were checked after each one.