Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

Components first: raea guide components, and the registry design

shinyobjectzd55a74c47293
diff --git a/docs/components.md b/docs/components.md
new file mode 100644
index 00000000..77b59bf1
--- /dev/null
+++ b/docs/components.md
@@ -0,0 +1,188 @@
+# Components: raea's registry, compatible with shadcn's
+
+How raea's components are shared: one registry format that the shadcn CLI and its MCP server can read, extended for
+what shadcn has no type for (3D objects, materials, shaders, looks, story-timed sets, assets, checks). The guide an
+agent works from is `raea guide components` (sdk/guides/craft/components.md); this file is the design and the plan.
+Written 11-23.
+
+## Where it starts
+
+- `raea component list | add NAME [--shared] [--force]` (engine/cli/src/index.ts, docs/layout.feature LY4) copies a
+ set or a single component from `REGISTRY`, which tools/pack.ts packs into engine/cli/src/registry.gen.ts from
+ examples/parts. Two sets today, both 2D motion: `brand` (9 parts) and `reel`. Copy-in, owned by the project, never
+ updated behind its back: shadcn's model already.
+- `--shared` puts it in the workspace's `shared/components/`, imported as `@shared/components/NAME`.
+- raea records which component drew each part, so raea/check's `named(world, part, "component:Orb")` and a note's ask
+ can name a component (sdk/guides/craft/checks/no-part.ts).
+- Each registry component has its own P26 row (docs/agents.md, L1).
+- shadcn's own components already run in raea as apps on a Blitz page (`<Screen app>`, app panels:
+ sdk/guides/craft/motion/apps.md), and docs/targets.feature T3 holds shadcn-style apps to Chrome.
+- `raea brand` reads shadcn-style theme variables (engine/cli/src/scrape.ts).
+
+What's missing: no 3D, material, shader or look items; no registries beyond the one compiled in; no assets with an
+item; no checks or fixture travelling with an item; nothing for a component's engine range; no way to publish.
+
+## The decision: shadcn's format, raea's kinds in `meta`
+
+Every raea registry item is a valid shadcn `registry-item.json`
+(ui.shadcn.com/schema/registry-item.json), and every raea registry serves a valid `registry.json` index. So:
+
+- the shadcn CLI can `add` a raea item into any project and gets its code;
+- the shadcn MCP server lists and searches raea's registry with no work on our side;
+- a raea item can depend on a shadcn item by address (`@shadcn/chart`), and shadcn items can depend on raea's;
+- raea doesn't define a competing interface kit. shadcn is the interface kit; raea is where shadcn's components go
+ into 3D scenes, rendered video and games, and raea adds the kinds an interface kit doesn't have.
+
+The mapping:
+
+| shadcn field | raea's use |
+|---|---|
+| `type` | `registry:component` for a single 2D TSX component, `registry:block` for a set, `registry:item` for every raea-only kind (its kind in `meta.raea.kind`) |
+| `files[]` | text files with inline `content`. TSX targets `@components/NAME.tsx` (the placeholder resolves from `components.json`); shader sources, checks, specs and fixtures are `registry:file` with `~/` targets: `~/components/NAME/fixture.tsx`, `~/checks/NAME.ts`, `~/NAME.parts.ts` |
+| `dependencies` | npm packages, installed by `raea add` (raea's own package manager; no Node needed) |
+| `registryDependencies` | other items by address: `@raea/brushed-steel`, `@shadcn/card`, a URL, `owner/repo/item.TAG` |
+| `cssVars` | brand tokens (`--brand-accent` and the rest, theme.css's names); see "Theme" |
+| `docs` | the item's markdown: what it is, its props, its contracts, its known limits |
+| `categories` | raea's kinds and domains: `3d`, `material`, `shader`, `motion`, `story`, `game` |
+| `meta.raea` | everything shadcn has no field for (next section) |
+
+### `meta.raea`
+
+```jsonc
+"meta": { "raea": {
+ "kind": "object", // part | set | object | material | shader | look | screen | behaviour | story-set | check
+ "engine": ">=0.1.10", // the raea versions it was checked on; `raea doctor` flags an install outside it
+ "assets": [ // binary files never go inline: fetched by URL, pinned, licensed
+ { "target": "~/assets/kettle/kettle.glb", "url": "https://.../kettle-3f2a91c0.glb",
+ "sha256": "3f2a91c0...", "bytes": 482113, "licence": "CC0-1.0", "source": "made with blender/kettle.py" }
+ ],
+ "contracts": { "size": [0.24, 0.26, 0.18], "stands": true, "band": null, "sound": "own" },
+ "controls": { "tint": { "kind": "color" }, "grain": { "kind": "number", "min": 0, "max": 1 } },
+ "pipelines": { "forward": "checked", "solari": "checked" }, // or "unchecked"; a shader or material says this
+ "plugins": [], // Bevy plugin catalog entries it needs (sdk/raea/bench/bevy-plugins/package.json)
+ "fixture": "~/components/kettle/fixture.tsx",
+ "checks": ["stands-on", "~/checks/kettle-steam.ts"],
+ "stills": [{ "frame": 0, "sha256": "...", "url": "https://.../kettle-0.png" }], // what its fixture drew when published
+ "cost": { "triangles": 18400, "draws": 3 },
+ "story": { "shows": ["product", "proof"] }, // beat roles a story-set can fill (see "Story")
+ "build": "~/blender/kettle.py" // how the asset is made again, when it was made, not drawn
+}}
+```
+
+Why each field exists:
+
+- **assets**: shadcn's `content` is text. A `.glb`, a texture or a sound is fetched from its URL by `raea component add`,
+ checked against its sha256, and written to its target. The shadcn CLI ignores `meta`, so an item it installs gets
+ its code without its assets; the component's own code then fails at render naming the fix (`raea component add NAME`
+ or `raea doctor --fix` fetches what's missing). Code stays usable everywhere; assets stay out of JSON.
+- **engine**: shadcn items have no version range because React's surface is stable. raea's isn't yet (prop names,
+ Bevy versions). An item names the raea it was checked on, and `raea doctor` (SK10) reports items outside the
+ install's version.
+- **contracts and controls**: what the guide's contract table says, as data, so a scene planner and the app's
+ Controls panel can read them without running the code.
+- **pipelines**: a shader or extended material may draw wrong or not at all under Solari (sdk/guides/craft/bevy/solari.md);
+ an item says which pipelines its fixture was checked on.
+- **fixture, checks, stills**: an item is published with the composition that renders it alone, the checks that pass
+ there, and the stills it drew, so `raea component check NAME` can tell a consumer's install drew the same.
+- **build**: an asset made in Blender or by a generator carries the script that makes it again, so the asset isn't a
+ dead end (sdk/guides/craft/components.md, "Build it in Blender, then make it a component?").
+
+### Kinds
+
+| kind | what it is | its fixture checks |
+|---|---|---|
+| part | a 2D TSX component on a video (a card, captions) | readable, contrast, in its band, cued |
+| set | several components added together (`brand`, `reel`, a material set) | each member's checks |
+| object | a 3D thing at real size | stands-on, no clipping, triangle budget at its distance |
+| material | a component returning a material (`<Mat job>`, `<BrushedSteel>`) | the four-finishes sheet looks like its name |
+| shader | a component wrapping a `ShaderExtension` with its WESL | moves when it should; nothing dropped in the log; per declared pipeline |
+| look | a grade, a fog, a paint or toon style placed once per shot | exposure and contrast measures on its fixture |
+| screen | a 3D screen or panel showing a shadcn app, depending on `@shadcn/*` items | the app renders on the screen at its resolution |
+| behaviour | a game system driving a catalog plugin | its headless program passes (`raea run`) |
+| story-set | components that fill a story's beat roles together (a proof montage, a reveal) | each beat role filled; the set's checks |
+| check | a raea/check system with its values and cheats, as craft/checks/ holds | its cheats fail it |
+
+## Addresses and configuration
+
+raea reads the same `components.json` the shadcn CLI writes, its `registries` field and its aliases, so one project
+can hold `@shadcn/*`, `@raea/*` and a team's own namespace:
+
+```json
+{ "registries": {
+ "@raea": "https://raea.io/r/{name}.json",
+ "@studio": { "url": "https://registry.example.com/r/{name}.json", "headers": { "Authorization": "Bearer ${STUDIO_TOKEN}" } }
+ },
+ "aliases": { "components": "./components" } }
+```
+
+- `raea component add @raea/kettle @shadcn/card` resolves each from its registry, with its `registryDependencies`.
+- A bare name (`raea component add reel`) keeps meaning raea's own, from the copy compiled into the binary, so it
+ works offline. That compiled copy is the `@raea` registry as of the release.
+- With no `components.json`, raea writes one the first time a namespaced item is added, with `@raea` in it.
+
+## Theme
+
+shadcn's theme and raea's brand kit are the same idea: named colour, radius and type variables that classes use.
+
+- A shadcn theme (`registry:theme`, or a site's CSS variables) becomes a brand kit: `--primary` to the brand accent,
+ `--background` and `--card` to the surfaces, `--radius` to `rounded-brand`, `--font-sans` to `font-brand`. `raea
+ brand` already reads the variables from a site; reading a `registry:theme` item is the same mapping.
+- A raea brand kit exports as a `registry:theme` with `cssVars`, so a person's shadcn app and their raea videos share
+ one theme.
+- 3D gets its colours from the same tokens through material jobs: a project's `<Mat job="accent">` maps the job to
+ the brand accent once.
+
+## Story
+
+A story (raea/story, docs/story.md) compiles to a script, one scene per beat (`compileScript`). A composition places
+one `<Sequence>` per scene and passes each component what its beat shows (`onScreenOf`). Components never import a
+story. A story-set declares the beat roles it can fill (`meta.raea.story.shows`), so a planner can pick components
+for a story's beats and a check can find a beat the story marks as shown with nothing on it.
+
+## Checks
+
+- A component's identity is already in the world (`component:NAME`), so a check written for a kind of component (no
+ orbs, steam rises from the kettle) works on every piece that uses it.
+- An item's checks are raea/check systems in `checks/`, the way sdk/guides/craft/checks/ are written: values, and the
+ cheats each check fails.
+- `raea component check NAME` renders the fixture, runs the item's checks, and compares the stills to `meta.raea.stills`
+ (SSIM, as P26 does). It's the gate for publishing to `@raea`, and what a consumer runs after adapting a component.
+
+## Where things get made
+
+The routing rule, the same in the guide and in sdk/guides/craft/bevy/scenes.md: what defines a thing picks its tool
+(numbers: solids; a rule: `sdf`/`grow`; looks: a generator or a CC0 model; hand-made looks: Blender through a saved
+script; a Godot project: Godot through `raea/godot`; an engine feature raea lacks: Rust through the rows path). The
+TSX is always the scene, and every route ends in a component. Godot and Blender aren't raea runtimes: raea's scenes run
+on Bevy so one file renders and plays and `raea check` sees every part; their work comes in as assets or frames.
+
+## Build order
+
+Each step lands on its own and is useful alone.
+
+- **CP1. The guide** (this landing): `raea guide components`, copied into the raea skill, and the skill routes to it.
+- **CP2. examples/components with fixtures**: LY4's rename of examples/parts, each component gaining a fixture
+ composition, and tools/pack.ts packing a `registry.json` and one `registry-item.json` per component beside
+ registry.gen.ts. A test validates every item against shadcn's published schema (vendored, pinned by sha256).
+- **CP3. First 3D items**: a material set (four finishes, from bevy/materials' examples), one shader (the sea, from
+ bevy/water), one object with a `.glb` asset and a `build` script, one screen showing `@shadcn/card`. Each passes
+ `raea component check`.
+- **CP4. `raea component add` reads `components.json`**: namespaced and URL addresses, `registryDependencies`
+ resolved, assets fetched and pinned, the shadcn CLI's file layout kept. Offline, bare names keep working.
+- **CP5. `raea component check NAME`**: fixture, checks, stills; P26 rows read from it.
+- **CP6. Serve `@raea`**: raea.io/r/registry.json and /r/{name}.json from the release's packed files, assets on the
+ public models release or R2 by sha. List it in shadcn's registry directory.
+- **CP7. `raea component publish DIR`**: a project's or workspace's components to a registry folder (static JSON), for a
+ team's own namespace.
+- **CP8. Theme both ways**: a `registry:theme` into a brand kit, and a brand kit out as one.
+- **CP9. Story-sets**: `meta.raea.story.shows`, a planner that proposes components for a story's beats, and the check
+ for a shown beat with nothing on it.
+- **CP10. Props from one schema** (docs/untangle.md F1): when raea's own components' props are generated from their
+ Rust structs, an item's `controls` and docs come from the same place.
+
+## Open decisions
+
+- Hosting `@raea` at raea.io/r (Cloudflare, beside the site) or as a GitHub registry (`shinyobjectz/raea-components`,
+ addressed `owner/repo/item.TAG`, which shadcn now reads directly).
+- Whether `@raea` items may carry assets on R2 (fast, ours) or only on GitHub release assets (public, permanent).
+- Whether `raea component add` should run an item's `build` script when its asset URL is gone, or only report it.
diff --git a/engine/cli/src/guide.rs b/engine/cli/src/guide.rs
index 411ca6e2..8102c541 100644
--- a/engine/cli/src/guide.rs
+++ b/engine/cli/src/guide.rs
@@ -23,7 +23,7 @@ pub fn guide(name: Option<&str>) -> R<String> {
}
let bevy: Vec<String> = bevy.iter().map(|n| format!("bevy/{n}")).collect();
let Some(n) = name.map(|n| n.trim_end_matches(".md")) else {
- return Ok(format!("raea guide NAME prints one.\n\nThe craft (router: the order of work and reading notes; craft right before any edit; a mode's guide when a brief names it):\n router\n craft\n rubric (how a critique is measured, judged and ranked)\n {}\n\nWhat a note asks for (read the one a note calls for before acting on it):\n {}\n\nWriting compositions (motion is the overview; read it first):\n motion\n {}\n\n3D and games drawn by Bevy (bevy is the overview; read it first):\n bevy\n {}\n coverage (what of Bevy and Blitz the SDK reaches, type by type)\n\nStories as data, raea/story (story/router first; a page per framework):\n {}\n\n(the files: {})", modes.join("\n "), verbs.join("\n "), names.join("\n "), bevy.join("\n "), story.join("\n "), craft.display()));
+ return Ok(format!("raea guide NAME prints one.\n\nThe craft (router: the order of work and reading notes; craft right before any edit; a mode's guide when a brief names it):\n router\n craft\n rubric (how a critique is measured, judged and ranked)\n components (anything built as components that fit together: what each owns, where each kind is made, registries)\n {}\n\nWhat a note asks for (read the one a note calls for before acting on it):\n {}\n\nWriting compositions (motion is the overview; read it first):\n motion\n {}\n\n3D and games drawn by Bevy (bevy is the overview; read it first):\n bevy\n {}\n coverage (what of Bevy and Blitz the SDK reaches, type by type)\n\nStories as data, raea/story (story/router first; a page per framework):\n {}\n\n(the files: {})", modes.join("\n "), verbs.join("\n "), names.join("\n "), bevy.join("\n "), story.join("\n "), craft.display()));
};
// what of Bevy and Blitz the SDK reaches, type by type: generated by tools/sdk-coverage, shipped beside the guides
if n == "coverage" {
diff --git a/sdk/guides/craft/ROUTER.md b/sdk/guides/craft/ROUTER.md
index 54244a2b..dbdfd866 100644
--- a/sdk/guides/craft/ROUTER.md
+++ b/sdk/guides/craft/ROUTER.md
@@ -55,7 +55,9 @@ leads. raea will add modes as its work grows; `raea context` says when a brief n
4. **Direction:** when the look or the structure is open, offer real options made with raea, and write the chosen
one into the deliverable's brief as a section headed "Direction".
5. **The floor:** read it right before you edit.
-6. **Make it.**
+6. **Make it, as components:** list the components the piece needs, look in `raea component list` and the
+ workspace's `shared/components/` first, add what exists, and write what's missing with a fixture that renders it
+ alone (`raea guide components`). The composition places them and owns the camera, the look and the mix.
7. **Evidence:** run `raea check`, look at the frames, critique against the mode's guide, fix, and look again.
A line the work must keep every round is a rule, not a reminder: a line `{ text, check, values }` in the project's
taste.ts, whose check is one of raea's by name (`text-above`, `loudness`) or a `.ts` check you write with
@@ -123,5 +125,5 @@ words still come first: if they say more than the verb, each more is another ask
## Other guides
-`raea guide` lists the rest: `motion` (writing compositions: timing, words, layout, music, sound, 3D, games) and the
+`raea guide` lists the rest: `components` (building anything as components, and where each kind is made), `motion` (writing compositions: timing, words, layout, music, sound, 3D, games) and the
3D guides. Read a guide when the work reaches its topic, not all at once.
diff --git a/sdk/guides/craft/bevy/godot.md b/sdk/guides/craft/bevy/godot.md
index 63dd3383..dcf5d2e2 100644
--- a/sdk/guides/craft/bevy/godot.md
+++ b/sdk/guides/craft/bevy/godot.md
@@ -11,6 +11,10 @@ wrong argument type before Godot runs anything.
A Godot project's scenes and meshes as `.glb` models for a raea scene, and which open Godot demos and kits may be
used, are `bevy/godot-projects`.
+Godot isn't a second runtime for raea's own scenes: they run on Bevy, so one file renders and plays and `raea check`
+sees every part. What Godot makes comes in as a model or as frames, and a component wraps it
+(`raea guide components`).
+
## Setting it up — HEADLESS
- `raea setup godot` downloads Godot 4.6.1 with GodotJS into `~/.raea/tools/godot` (JavaScriptCore on the Mac,
diff --git a/sdk/guides/craft/bevy/materials.md b/sdk/guides/craft/bevy/materials.md
index 59b09540..baba7e74 100644
--- a/sdk/guides/craft/bevy/materials.md
+++ b/sdk/guides/craft/bevy/materials.md
@@ -5,6 +5,9 @@ material sits inside the `Mesh3d` it covers.
## What to do
+- A finish used more than once is a component that returns its material (`<BrushedSteel grain={0.6} />`, or a
+ project's `<Mat job="carpet" />`), placed inside the Mesh3d after its shape: `raea guide components`, "Materials as
+ components".
- Each Mesh3d holds one material (toon shading: see "Toon" below):
- `<StandardMaterial>`: physically based, Bevy's fields: `base_color`, `perceptual_roughness`, `metallic`,
`emissive`, `base_color_texture`, `normal_map_texture`, `metallic_roughness_texture`, `occlusion_texture`,
diff --git a/sdk/guides/craft/bevy/scenes.md b/sdk/guides/craft/bevy/scenes.md
index 17810e4e..b39daffa 100644
--- a/sdk/guides/craft/bevy/scenes.md
+++ b/sdk/guides/craft/bevy/scenes.md
@@ -60,6 +60,10 @@ Ask one question of each object: **is it defined by numbers, by a rule, or by it
The TSX is always the scene. Blender is only a workshop an asset passes through on its way into `media/`, when a
check names a script (`bevy/blender`). It never places, lights, frames, materials or animates the scene.
+Every row ends as a component: `<Shelf>`, `<Kettle>`, `<Fern>`, each with its size, a fixture that renders it alone,
+and its materials as jobs (`<Mat job="steel" />`), so a note can name it and the next scene can reuse it
+(`raea guide components`).
+
| the object | made by | then in Blender when |
|---|---|---|
| **numbers**: walls, counters, shelves, boxes, frames, pipes, sign boards, anything a hinge must fit | Manifold solids (`manifold.*`, `<Mesh3d shape={solid}>`, `bevy/meshes`) | it needs real UVs or baked AO (`raea solid info` names bake.py when the file's `needs.textured` is set), a cloth falls on it (cloth.py), or a fillet solids can't make: `raea solid export` first, and log the gap |
diff --git a/sdk/guides/craft/components.md b/sdk/guides/craft/components.md
new file mode 100644
index 00000000..ea98297f
--- /dev/null
+++ b/sdk/guides/craft/components.md
@@ -0,0 +1,229 @@
+# Components: build anything as parts that fit together
+
+Everything raea makes is React components composed in one file: a 2D card, a 3D object, a material, a shader, a
+look, a game system, a screen showing an app. This guide says what a good component is, how components fit together
+without stepping on each other, where each kind gets made (TSX, solids, a generator, Blender, Godot, Rust), and how
+components are shared through registries that are compatible with shadcn's. The design and its build plan are in
+docs/components.md in the raea repository.
+
+## Component first: the order of work
+
+1. **List the components before writing any.** From the brief (and its story, and each hero's `NAME.parts.ts`), name
+ every thing the piece needs as a component: `Kitchen`, `Kettle`, `Steam`, `BrushedSteel`, `MorningLook`,
+ `PriceCard`. One component is one concern: one object, one surface, one effect, one card.
+2. **Look before making.** `raea component list` shows raea's own; a project's `components/` and the workspace's
+ `shared/components/` hold what this person already has; `raea library search "WORDS"` finds their assets. Interface
+ pieces (forms, tables, charts, dashboards) come from shadcn, never rebuilt: see "shadcn" below.
+3. **Add, then adapt.** `raea component add NAME` copies a component into `components/` (`--shared` into the
+ workspace's `shared/components/`, imported as `@shared/components/NAME`). It's the project's own once copied: change
+ it freely. Nothing updates it behind your back.
+4. **Write what's missing as a component, with its fixture.** A component isn't done until it renders alone, in a
+ small fixture composition, and passes its checks there (see "Done means checked alone").
+5. **Compose.** The composition file places components and owns what belongs to the whole piece (below). Then render
+ and check the piece as usual.
+
+A piece written as one long file of meshes and numbers can't be reused, checked part by part, tuned by a person or
+fixed by a note that names a thing. Write components even for a one-off: the next note will name one of them.
+
+## What a component is
+
+A raea component is a React function component that draws one thing from its props and the frame:
+
+- **Frame-pure.** What it draws is a function of `useCurrentFrame()` and its props alone: no `Date`, no random number
+ without a seed, no state carried from one frame to the next. A render in chunks, a still with `--at` and a live play
+ must all draw the same frame.
+- **JSON props.** Every prop is a plain JSON value (numbers, strings, booleans, arrays and objects of those), so it can
+ sit in `defaultProps` and in `controls`. Anything a person might tune is a prop with a default, never a literal
+ inside (`motion/compositions`, "Controls"). Pass elements only through `children` or a slot prop named for what goes
+ there (`material`, `extension`).
+- **Its own name on what it draws.** raea records which component drew each part, so a check or a note can name it:
+ raea/check's `named(world, part, "component:Kettle")` finds every part `<Kettle>` drew, however its meshes are
+ named (`craft/checks/no-part.ts`). Give components real nouns; a note says "the kettle", not "Group3".
+- **A one-line header** saying what it is and how to use it. A component meant for `raea component add` starts with
+ `// raea component add NAME: what it is, where it goes.`, the line `raea component list` shows.
+
+### The contracts a component keeps
+
+Each kind of component keeps the contracts that apply to it. They're what let components be dropped into a scene by
+someone who didn't write them.
+
+| contract | 2D (a card, a caption, a lower third) | 3D (an object, a set piece) | surface (a material, a shader) |
+|---|---|---|---|
+| **time** | placed by its parent's `<Sequence>`; cued by `say` (a phrase from the transcript) or `beat`, ends on `until`/`untilBeat` or its own length | still or moving as a function of the frame; clips started by a prop (`clip`, `at`), never by a timer | animated through `animate` tracks or a frame prop; uniforms that must move each frame need the workaround in "Shaders" |
+| **space** | its band or `place` (`"top"`, `"middle"`); keeps out of the face and the captions | real metres; stands on y = 0 at its origin, so `stands-on` and the clipping check work; its size is a prop or fixed in its `NAME.parts.ts` | none: it covers whatever mesh it's given |
+| **look** | colours and type from the brand kit (`text-brand-accent`, `bg-brand-surface`, `font-brand`, `theme.css`), never hex literals | materials from props or a material component, with the brand's accent as a default | finish values as props with real defaults (roughness, tint, scale in metres) |
+| **sound** | brings its own foley on its moment, `sound={false}` turns it off | brings its own (a kettle's click) when it has one | none |
+| **never** | sets the composition's size, the mix or the captions | adds a camera, a light rig, fog or post, or reads the scene's other objects | lights anything, or assumes a pipeline it doesn't declare |
+
+### Who owns what
+
+Components fit together because each concern has exactly one owner:
+
+| owner | owns |
+|---|---|
+| the composition (`<Composition>` and its root component) | size, fps, length, the camera and its moves, the look and post effects, the mix (`<Mix>`), captions |
+| the scene (or a set component like `<Kitchen>`) | the environment, the lights, the floor, where each object stands |
+| an object component | its geometry, its materials (overridable by prop), its own animation and foley |
+| a material or shader component | the surface only |
+
+So an object never brings its own light or bloom to look good: if it needs a light to read, say so in its header, and
+the scene adds it. A card never ducks the music: the mix is the root's. When a component seems to need something it
+doesn't own, give it a prop and let the owner pass it down (or read it from context: the brand kit, the cues, the
+story's beats).
+
+### How data reaches a component
+
+Down, through props and context, never sideways through globals or file reads inside a component:
+
+- the brand kit and theme: the Tailwind classes and CSS variables every project compiles with;
+- cues: the transcript's words (`useWords()`) and the beat map (`BEATS`), which a part turns into frames itself;
+- tunables: `useControl("name")` deep in a tree, for a control the composition declares;
+- the story: a composition times its scenes from the story's compiled script (raea/story's `compileScript`, one scene
+ per beat), places one `<Sequence>` per scene, and passes each component what its beat shows. A component never
+ imports the story itself; it takes the beat's content as props.
+
+## Kinds of component, and where each gets made
+
+Ask of each component: **what defines it?** That picks the tool. The TSX file is always the scene; everything else is
+a workshop an asset passes through on its way into `assets/` (or `media/`).
+
+| the component | defined by | made with | becomes a component as |
+|---|---|---|---|
+| a card, caption, lower third, chart in a video | layout and words | TSX and Tailwind (`motion/parts`, `motion/layout`) | the TSX itself |
+| an interface on a screen or panel (a form, a dashboard) | an existing UI kit | shadcn components, run as an app (`motion/apps`) | `<Screen app="dash.tsx">` in 3D, or an app panel |
+| an object with sizes that must fit (a shelf, a frame, a counter) | numbers | Manifold solids, `raea/room` (`bevy/meshes`, `bevy/rooms`) | TSX returning `<Mesh3d shape={...}>` with size props, plus its `NAME.parts.ts` |
+| something grown or organic (a tree, terrain, a creature's body) | a rule | `sdf.*`, `grow.*`, `<Instances>` | TSX with the rule's parameters as props |
+| a thing defined by its looks (a worn tool, food, a lamp) | its looks | `raea gen`, or a CC0 library model (`bevy/assets`) | `<Model src>` wrapped with props for its variants, clips and material overrides |
+| a hand-authored asset: sculpted, rigged, hand-painted | a person's or a script's work in Blender | Blender, through a saved script (`raea blender run`, `bevy/blender`) | the `.glb` is an asset; the component wraps it as above |
+| a Godot project's level, character or effect | a Godot project | Godot through `raea/godot` (`bevy/godot`) | its `.glb` export as a model, or its frames through `<GodotShot>` |
+| a surface: stone, steel, cloth, wear | its finish | `<StandardMaterial>`, texture sets, `raea/procmat`, decals, wear (`bevy/materials`) | a material component (below) |
+| an effect a material can't make: waves, a dissolve, a hologram | a shader | a `ShaderExtension` in WESL (`bevy/water` is the worked one) | a shader component (below) |
+| a look: grade, fog, bloom, a paint or toon style | the shot | `<Look>`, post components (`bevy/post`) | a look preset the composition places once per shot |
+| behaviour in a game: input, a character controller, pathfinding | a Bevy plugin | the plugin catalog and its adapters (`3d/plugins`) | a component that declares the plugin and drives it |
+| an engine feature raea doesn't reach yet | Rust | the rows path (`3d/rows`), as an SDK gap with a roadmap task | a new raea component in `raea/3d`, then wrapped like any other |
+
+### Build it in Blender, then make it a component?
+
+Yes, when the thing is defined by hand-made looks (a sculpt, a rig, painted textures) or a check names a Blender
+script (over its triangle budget, holes, no skeleton: `bevy/blender`). Then:
+
+- Blender runs a **saved script** (`raea blender run blender/NAME.py`, or a typed step with `raea/blender`), so the
+ asset can be made again from its source. A hand session in Blender ends by saving the script or the `.blend` that
+ produced the `.glb`, beside the component.
+- Blender's output is **one asset**: a `.glb` with its materials, skeleton and clips. It never places, lights, frames
+ or times anything.
+- The **component owns everything after**: where it stands, its size check, which clip plays when, material
+ overrides, its sound. A note about the kettle's colour is fixed in `<Kettle>`'s props, not by going back to Blender.
+
+No, when the thing is defined by numbers or a rule: a solid or `sdf`/`grow` in TSX is smaller, exact, checkable and
+tunable by prop. "I know bpy" is no reason to model a shelf in Blender.
+
+### Godot or Blender as raea's runtime?
+
+No. raea has bindings to both (`raea/godot` types Godot's whole API; `raea/blender` types bpy steps), and they're for
+workshops and for people's own Godot projects. raea's scenes run on one engine, Bevy through `raea/3d`, so that one
+file renders and plays, every frame is a function of its time, and `raea check` sees every part. A second scene
+runtime would split all three. Godot's and Blender's work comes in as assets (`.glb`, textures) or as frames
+(`<GodotShot>`, `<BlenderShot>`), and the component wraps it.
+
+## Materials as components
+
+A finish used more than once is a component that returns a material, so a scene says what a surface is and a person
+can tune it:
+
+```tsx
+// raea component add brushed-steel: a brushed stainless finish; put it inside a Mesh3d after its shape.
+import { ExtendedMaterial, ProceduralExtension, StandardMaterial } from "raea/pbr";
+
+/** Brushed steel. `grain` is the brushing's coarseness (0 polished, 1 coarse); `tint` a hex colour. */
+export default function BrushedSteel({ grain = 0.4, tint = "#c9ccd1" }: { grain?: number; tint?: string }) {
+ return (
+ <ExtendedMaterial
+ base={<StandardMaterial base_color={tint} metallic={1} perceptual_roughness={0.25 + 0.35 * grain} />}
+ extension={<ProceduralExtension pattern="brushed" />}
+ />
+ );
+}
+// <Mesh3d><Cylinder radius={0.09} half_height={0.12} /><BrushedSteel grain={0.6} /></Mesh3d>
+```
+
+A material component goes inside a `<Mesh3d>` after its shape, like `<StandardMaterial>` itself.
+
+- **A part asks for a job, never a colour.** A project's materials are one file of jobs (`<Mat job="carpet" w={4}
+ h={3} />`: the floor, the signage, the steel), each mapped to the palette once, so a palette change reaches every
+ room and a note about "the carpet" has one place to go.
+- Props are the finish's real knobs with real defaults: roughness, tint, scale in metres (a texture's `uv_transform`
+ from its real size, `bevy/materials`), wear amount. Keep Bevy's field names inside the component.
+- Texture sets are assets the component names (`staticFile`), CC0 or the person's own.
+- Its fixture is the four-finishes sheet (`bevy/materials`, "Example: four finishes side by side"): the material on a
+ sphere and a cube under a raking light and a soft one, at two sizes, so a tiling or roughness mistake shows.
+- A material set (a project's finishes: oak, terrazzo, brushed steel, painted plaster) is one folder of these, added
+ together like the reel's set.
+
+## Shaders as components
+
+A shader effect is a component that wraps an `ExtendedMaterial` with a `ShaderExtension`, its WESL source a string
+constant in the same file (`const SEA = /* wgsl */ \`...\``, as `bevy/water` does), and its uniforms as props:
+
+- Declare in the header what it needs: the base material it extends, whether it's been checked under Solari
+ (`bevy/solari` lists what Solari traces), and what it costs (a full-screen effect versus one object).
+- Name things outside WGSL's reserved words. `shared`, `filter`, `common`, `smooth`, `target`, `module`, `meta` and
+ `set` are reserved, and a pass named with one is dropped while the render still says 0 errors (`raea fix "WGSL pass
+ silently does nothing"`).
+- Uniforms keep the first frame's values today, and `globals.time` doesn't advance in stills. A shader that must move
+ over time carries the frame through an animated material value, an `animate={{ emissive: track(KEYS) }}` with a key
+ every frame, read in the shader (`raea fix "ShaderExtension animation frozen"`). Its fixture renders at least two
+ frames apart and checks they differ.
+- Its fixture renders it on the shapes it's meant for, in a lit scene, at two sizes.
+
+## Done means checked alone
+
+Every component you write or add gets a fixture: a small composition that renders it alone, beside the component
+(`fixtures/NAME.tsx`, or a `<Composition>` per case in one file), with the cases that break components of its kind:
+
+| kind | its fixture shows | and checks |
+|---|---|---|
+| 2D card or part | its longest and shortest text, both shapes (9:16 and 16:9), over a light and a dark frame | readable type and contrast (`raea check`), in its band, cued on its words |
+| 3D object | it at its real size beside a 1.8 m figure or a 1 m cube, from its usual distance and close | `stands-on` (it touches the floor and floats nowhere), no clipping, within its triangle budget for the distance (`raea scene lint`) |
+| material | the four-finishes sheet | it looks like its name under two lights (look at the sheet); tiling reads at the face's real size |
+| shader | two frames apart, on its shapes, lit | it moves when it should; nothing dropped in the log |
+| a set | every component of the set placed once | its components' checks, together |
+
+A component that comes with checks of its own puts them beside it (a raea/check system in `checks/NAME.ts`, as
+`craft/checks/` shows), and the composition's asks can name it: `{ check: "./checks/kettle-steam.ts", values: { what:
+"component:Kettle" } }`. Check the fixture before using the component in a piece; when a note comes back about it,
+fix the component and its fixture first, then the piece.
+
+## shadcn: compatible, not competing
+
+raea doesn't make another interface kit. shadcn's components are the interface kit, and raea puts them where shadcn
+can't go: on a screen in a 3D scene, in an app panel, in a rendered video.
+
+- A shadcn component runs as an app (`motion/apps`): `raea add` its npm packages, put the component's files in the
+ app's folder (the shadcn CLI writes them, or copy them from its registry), and show it with
+ `<Screen app="dash.tsx" resolution={[1280, 800]} />` or as a panel. Tailwind classes compile as in any raea project.
+- The brand kit and shadcn's theme speak the same tokens: `raea brand` reads a site's shadcn-style variables
+ (`--primary` and the rest, as `h s% l%`), so a site built on shadcn gives raea its colours.
+- raea's own registry follows shadcn's registry format, so the shadcn CLI and its MCP server can read it, and a raea
+ item can depend on shadcn's (a monitor in a scene that shows `@shadcn/chart`). What raea adds is the kinds shadcn
+ has no type for: 3D objects, materials, shaders, looks, story-timed sets, with their assets and checks. The format
+ is in docs/components.md.
+
+## Promote what's reused
+
+A component starts in a project's `components/`. When a second project wants it, move it to the workspace's
+`shared/components/` (`raea component add --shared` for raea's own), with its fixture. When a team or the public
+should have it, it goes in a registry. Each step keeps the same file: only where it lives changes.
+
+## Common mistakes
+
+- One giant scene file with no components: nothing can be reused, tuned, checked alone or named in a note.
+- An object component that adds its own light, fog or bloom so it looks good alone. The scene owns light; the
+ fixture adds the light the component needs.
+- Literals for anything tunable inside a component (`color="#d04a3a"` deep in a mesh). Make it a prop with that
+ default.
+- A component that reads `Date`, `Math.random()` without a seed, or keeps state across frames: renders and plays
+ disagree.
+- Modelling a thing defined by numbers in Blender, or placing, lighting or timing anything there.
+- Rebuilding an interface piece shadcn already has, instead of running shadcn's as an app.
+- Using a component in a piece before its fixture passes.
diff --git a/sdk/guides/craft/motion/parts.md b/sdk/guides/craft/motion/parts.md
index 7f6d5bfd..6dba1147 100644
--- a/sdk/guides/craft/motion/parts.md
+++ b/sdk/guides/craft/motion/parts.md
@@ -1,6 +1,6 @@
# Parts: a talking take, dressed by name
-The reel's parts are designed parts for a talking take. They're an example the project owns: `raea component add reel`
+The reel is a component set (`raea guide components` says how components fit together): designed parts for a talking take. They're an example the project owns: `raea component add reel`
copies them into components/reel/, yours to change, and you import them from "./components/reel". You place each one
with one line, and each one lands on the words that say it. You don't lay out boxes or count frames. You choose which
part goes on which beat, and what it says.
diff --git a/tools/skills.sh b/tools/skills.sh
index 8509eada..3d1ce619 100755
--- a/tools/skills.sh
+++ b/tools/skills.sh
@@ -45,6 +45,8 @@ copies() {
printf '%s\tmotion.md\n' sdk/guides/craft/motion.md
for g in sdk/guides/craft/motion/*.md; do printf '%s\tmotion/%s\n' "$g" "${g##*/}"; done
for g in ROUTER.md floor.md rubric.md NOTICE; do printf '%s\tcraft/%s\n' "sdk/guides/craft/$g" "$g"; done
+ # building anything as components (raea guide components; docs/components.md): at the skill's root, beside its routers
+ printf '%s\tcomponents.md\n' sdk/guides/craft/components.md
for g in sdk/guides/craft/modes/*.md; do printf '%s\tcraft/modes/%s\n' "$g" "${g##*/}"; done
for g in sdk/guides/craft/verbs/*.md; do printf '%s\tcraft/verbs/%s\n' "$g" "${g##*/}"; done
# stories as data (raea/story): the router, how to write, check, sample and score, and a page per framework