Official Codebase of 3DCodeVerse
Python
skills: cv3d-form-manifest, cv3d-threejs-forms, cv3d-scene-motion
gaoypeng510de6f80c62
diff --git a/harness/codeverse/skills/_claims/cv3d-scene-motion.toml b/harness/codeverse/skills/_claims/cv3d-scene-motion.tomlnew file mode 100644index 00000000..7d77044b--- /dev/null+++ b/harness/codeverse/skills/_claims/cv3d-scene-motion.toml@@ -0,0 +1,29 @@+# Every motion threshold the body quotes, pinned to the constant it came from.+# If frame_motion.py moves a number, the test that ships this skill fails before+# an agent is ever told the old one.++[[claim]]+key = "motion_pixel_delta"+text = "8 of 255"+python = "codeverse.spatial.frame_motion:PIXEL_DELTA"+format = "{:.0f} of 255"++[[claim]]+key = "motion_moving_frac"+text = "0.4 %"+python = "codeverse.spatial.frame_motion:MOVING_FRAC"+scale = 100+format = "{:.1f} %"++[[claim]]+key = "motion_strong_delta"+text = "60 of 255"+python = "codeverse.spatial.frame_motion:STRONG_DELTA"+format = "{:.0f} of 255"++[[claim]]+key = "motion_strong_frac"+text = "0.08 %"+python = "codeverse.spatial.frame_motion:STRONG_FRAC"+scale = 100+format = "{:.2f} %"diff --git a/harness/codeverse/skills/cv3d-form-manifest/SKILL.md b/harness/codeverse/skills/cv3d-form-manifest/SKILL.mdnew file mode 100644index 00000000..f7432c7f--- /dev/null+++ b/harness/codeverse/skills/cv3d-form-manifest/SKILL.md@@ -0,0 +1,166 @@+---+name: cv3d-form-manifest+description: "Decide every shape in language-neutral FORM words, with its dimensions, its placement and one countable refinement, BEFORE calling any geometry API. Use at the start of a baseline, part, detail or rebuild session on the static_object or articulated_object track — that is, whenever you are about to write geometry for a part you have not built yet. Turns the ENGINEERING BRIEF and the plan's part rows into a written element list the language skill's table then implements one line at a time. Skip it on a repair round: a repair is not re-planning."+license: Apache-2.0+compatibility: "static_object and articulated_object tracks, all four object languages (blender, urdf_blender, cadquery, threejs). Needs the plan and, when the run enabled it, the ENGINEERING BRIEF block in your prompt."+metadata:+ evidence: measured+ verified: "2026-08-25"+ corpus: "bench/out/*/runs/* graded records, recomputed 2026-08-25"+ pairs_with: "cv3d-blender-forms, cv3d-cadquery-forms, cv3d-threejs-forms, cv3d-part-contact"+---++# Form manifest — name the shapes before you name an API++## When to use++You are about to write geometry for a part you have not built yet. Spend three+minutes writing what each element **is** as a shape. Then implement it.+On a repair round, skip this and fix the finding.++## Why this pays (measured on this harness)++`geometry_detail` is the second-lowest judge criterion in both object tracks —+**0.622** over 47 graded blender runs and **0.699** over 23 graded urdf runs+(`bench/out/*/runs/*`, recomputed 2026-08-25). It does not improve by adding parts.+Over 44 static runs (`docs/COMPLEXITY.md` §2.2, 2026-08-24):++| what you add | correlation with `geometry_detail` | correlation with gate ERRORs |+|---|--:|--:|+| more plan parts | **−0.25** | −0.13 |+| more built top-level parts | +0.01 | **+0.55** |+| more triangles | −0.05 | +0.06 |+| more `feature_density` (small sharp edges per unit surface) | **+0.19** | +0.03 |++One axis out of four moves the criterion, and it is the one that measures modelled+features, not part count. Adding parts instead is actively expensive: when one+recorded toaster was rebuilt with more top-level parts its interpenetrating pairs+went 4 → 8, max depth 3.5 mm → 9.0 mm, and overall 0.953 → 0.658+(`docs/COMPLEXITY.md` §6).++So: **fidelity, not count.** A drawer is five panels because a real one has five+panels. Invented rivets bolted on as new parts are how floaters and+interpenetration get made.++## You are not starting from nothing++Read these three before writing a word of the manifest — they are already in your+prompt or your workspace:++| source | what it hands you |+|---|---|+| the ENGINEERING BRIEF block | the real reference instance, real dimensions in metres, the sub-assemblies a fitter would name, `visible from outside`, `inside, NOT visible (do not model)`, `it does NOT have`, and 3–6 SIGNATURE FEATURES |+| your part's row in the plan | `name` (PascalCase), `role`, `description`, `bbox`, `material`, `attach_to`, `symmetry`, `instances`, `children`, `detail_hint` |+| the DETAIL BUDGET block | the triangle target for this object and per built object |++Every SIGNATURE FEATURE must end up as an element in some part's manifest.+Nothing on the `hidden inside` or `does NOT have` lists may appear at all.++## Write it to `src/design/manifest_<snake>.md`++`src/` and `public/` are the only directories you may create files in, and the+language gates only read `.py` / `.js` / `.urdf`, so a Markdown note under+`src/design/` is inert. One element per line, in this order:++```+Element — FORM — size (m) — placement — refinement — source+```++* **size** taken from the plan's bbox or the brief's dimensions, in the units+ the contract states; never a round number you liked the look of.+* **placement** relative to your part's own bbox or to a named neighbour part+ ("top face of `Housing`", "20 mm in from the +X wall"), never an absolute+ guess.+* **source** — which signature feature, `detail_hint` phrase or `children` row+ this element discharges. An element with no source is an element to cut.++Stop when every signature feature and every `children` row is discharged. Six to+twelve lines is a normal part. If your list is longer than the part's `children`+list plus its `detail_hint`, you are padding.++## The FORM words++Language-neutral on purpose: the same word keys the table in+`cv3d-blender-forms`, `cv3d-cadquery-forms` and `cv3d-threejs-forms`, so the+manifest survives a language change and you look up exactly one row.++| form | it means |+|---|---|+| revolved profile | a 2-D outline spun about an axis — bottles, knobs, feet, turned legs |+| extruded outline | a closed 2-D outline given thickness — plates, brackets, panels |+| tube swept along a path | a circular section carried along a curve — cables, handles, rails |+| slab | a rectangular block whose thickness is much smaller than its face |+| shaft | a long constant section — a rod, a bar, a post |+| tapered solid | a section that changes size along its length — a draft, a cone, a wedge |+| ring or band | an annulus or a torus — rims, ferrules, gaskets, trim |+| carved cavity | a recess, pocket, slot, hole or notch taken out of a mass |+| shell with wall thickness | a hollow body with a visible wall — a cup, a housing, a bin |+| mirror pair | one element and its reflection across a plane |+| radial array | N copies about an axis, angle derived from N |+| layered or inset | a face broken into a proud or sunk sub-panel |+| faceted solid | a flat-sided body no primitive covers — a wedge, a prism, a hull |+| lofted transition | one section blending into a different section — a horn, a fairing |++Write the form word, not the API call. Picking the API is the language skill's+job and it changes per language; picking the shape is yours and it does not.++## Every element carries at least one refinement kind++`geometry_detail` is scored by counting **refinement kinds** visible in the+renders — this is the rubric's own countable unit+(`codeverse/judges/rubrics/static_object_v1.yaml`), not a heuristic:++1. bevel / chamfer / fillet on an edge+2. taper or draft along a part+3. curve, sweep or compound surface where a primitive would be flat+4. moulding or profile — a shaped edge, a cornice, a bead+5. cut-out, hole, slot or notch+6. visible wall thickness or hollow section — a rim, a lip, an open tube end+7. surface relief — flutes, ribs, grooves, panelling, treads, weave, bark+8. separately modelled hardware — hinge, knob, screw, bracket, strap, spoke++Colour, material and shading are **not** refinement kinds and never raise this+criterion. The anchors the judge actually uses:++* 3–4 kinds on at least half the nameable parts → **0.85**+* 5+ kinds with at least two thirds of parts carrying one, finest features at+ real hardware scale (a few mm) → **1.0**+* many parts but no refinement on any of them → **0.25–0.4**++Two or three kinds spread across the object is the difference between 0.55 and+0.85. Pick them at manifest time so they are budgeted, not bolted on later.++## Where a new element goes++An element is a **new top-level part** only if a human would unbolt it as a+separate object AND the plan already lists it. Otherwise it goes *inside* the+part you are building.++The plan's `children` are a planning device, not export nodes: the parent stays+exactly **one** named object in the export, the contract gate measures the+parent's bbox, and the connectivity gate loads one mesh per top-level node — so+shapes inside a part are never pair-tested against each other, while still+counting for `geometry_detail`. That is the cheapest detail on this harness.++One caveat, so this does not become a licence to scatter: a sub-shape that+floats free inside its parent is still caught, as a tiny-island warning on that+part. Every element in your manifest has to touch something. Contact between+parts, and its numbers, belong to `cv3d-part-contact`.++## Before you write code++1. Every signature feature appears in some manifest line.+2. Nothing from `inside, NOT visible` or `does NOT have` appears in any line.+3. At least three distinct refinement kinds across the object, and no element in+ your part is an unmodified primitive.+4. Every line carries a real dimension and a placement anchored to a bbox or a+ named neighbour.++Then implement the manifest top to bottom, one line at a time, looking up each+FORM word in your language's table.++## Depth++`references/worked_manifest.md` — a full worked manifest for one part of a+hand-crank coffee grinder, from brief fields to element lines, plus the two+failure shapes (the padded manifest and the manifest with no refinements).diff --git a/harness/codeverse/skills/cv3d-form-manifest/references/worked_manifest.md b/harness/codeverse/skills/cv3d-form-manifest/references/worked_manifest.mdnew file mode 100644index 00000000..03037cf9--- /dev/null+++ b/harness/codeverse/skills/cv3d-form-manifest/references/worked_manifest.md@@ -0,0 +1,98 @@+# A manifest, worked end to end++The session owns one part of a hand-crank coffee grinder: `BurrHousing`.+Nothing below is invented — every line is traced to a field the harness already+put in the prompt.++## 1. What the prompt gave us++From the ENGINEERING BRIEF block:++```+- reference instance: Hario Skerton Pro, ceramic conical burr, glass jar+- real-world dimensions (m): body height 0.215, jar diameter 0.092,+ crank radius 0.075, burr diameter 0.038, lid diameter 0.058+- sub-assemblies: Crank (handle, shaft, wing nut); BurrHousing (upper burr seat,+ ceramic cone, adjustment ring); Hopper (funnel, lid); Jar (glass body, thread)+- visible from outside: the wing nut, the adjustment ring's knurl, the seam+ between hopper and jar, the crank shaft entering the lid, the pour spout+- inside, NOT visible: the spring under the adjustment nut, the shaft bearing+- it does NOT have: a motor, a power cord, a hopper window+- SIGNATURE FEATURES: 1. the offset crank arm with a wooden knob;+ 2. the knurled adjustment ring under the burr; 3. the glass jar with a+ moulded shoulder; 4. the ceramic conical burr visible from above+```++From the plan's part row:++```+name: BurrHousing bbox: 0.062 x 0.062 x 0.058 m, centre (0, 0, 0.168)+role: "carries the upper burr and the grind-size adjustment"+symmetry: radial instances: 1+children: [UpperBurrSeat, CeramicCone, AdjustmentRing]+detail_hint: "carries the visible mechanism — model the burr teeth, the knurl+ and the seam where the hopper drops in"+```++Signature features 2 and 4 land here. 1 and 3 belong to `Crank` and `Jar`.++## 2. `src/design/manifest_burr_housing.md`++```+HousingBody — shell with wall thickness — outer d 0.062, wall 0.003, h 0.034,+ base at z 0.151 — coaxial with Z, its top rim is where Hopper seats —+ visible wall thickness (kind 6) at the open top rim — children/UpperBurrSeat+CeramicCone — tapered solid — d 0.038 at base tapering to 0.006 at the tip,+ h 0.026, base at z 0.155 — coaxial, tip up, inside HousingBody —+ taper (kind 2) — signature feature 4+ConeTeeth — surface relief — 14 ribs 0.0012 proud, 0.0015 wide, running up the+ cone — radial array of 14 on the cone flank — surface relief (kind 7) —+ detail_hint "burr teeth"+AdjustmentRing — ring or band — outer d 0.058, inner d 0.048, h 0.008,+ base at z 0.143 — coaxial, immediately under HousingBody — chamfer 0.0008+ on both outer edges (kind 1) — signature feature 2+RingKnurl — surface relief — 36 flutes 0.0006 deep, full ring height —+ radial array of 36 on AdjustmentRing's outer face — surface relief (kind 7)+ — signature feature 2 "knurled"+SeatLip — layered or inset — a 0.002 step sunk 0.0015 into the top rim of+ HousingBody, full circumference — the hopper drops into it —+ cut-out/notch (kind 5) — detail_hint "the seam where the hopper drops in"+```++Six lines. Four refinement kinds (2, 5, 6, 7) plus the chamfer (1) — five kinds+in one part, which is the 1.0 anchor's requirement for the whole object.+`ConeTeeth`, `RingKnurl` and `SeatLip` are **inside** `BurrHousing`; the export+still has exactly one node called `BurrHousing`, so the connectivity gate sees+one part and the penetration test never runs between the cone and its own teeth.++Nothing models the spring or the bearing: they are on the `NOT visible` list.+Nothing models a hopper window: it is on the `does NOT have` list.++## 3. The two ways this goes wrong++**Padded.** The manifest grows to nineteen lines because "a real grinder has+screws". Eight of them become new top-level parts so they get names in the+render. The measured consequence on this harness is not neutral: over 44 static+runs part count correlates **+0.55** with gate ERRORs and **+0.01** with+`geometry_detail` (`docs/COMPLEXITY.md` §2.2). The recorded toaster rebuild that+did exactly this doubled its interpenetrating pairs (4 → 8), nearly tripled the+depth (3.5 mm → 9.0 mm) and lost 0.30 of overall score (§6). If a screw matters,+it is a refinement of kind 8 *inside* the part it fastens, sunk into the surface+so it touches.++**Refinement-free.** Six lines, correct dimensions, every element an+unmodified cylinder or box. The rubric anchor for that is explicit: "Every part+is an unmodified primitive; the only variation between parts is size, position+and colour" → **0.25**. Correct dimensions do not buy detail. Each line needs a+kind before you start typing geometry, because a bevel decided at manifest time+costs one extra argument and a bevel decided after the build costs a rewrite.++## 4. Reading it back++Before you call the part done, read your manifest beside the render sheet and+point at each line in the picture. A line you cannot point at was either never+built or is too small to see. The harness renders objects at 768 x 768+(`runtime_js/render_glb.mjs`), so on a 0.2 m object that fills the frame one+millimetre is roughly three pixels and half a millimetre is not a feature at+all. That is why the 1.0 anchor says "a few mm — screw heads, hinge leaves,+bead mouldings": grow the line to hardware scale or delete it.diff --git a/harness/codeverse/skills/cv3d-scene-motion/SKILL.md b/harness/codeverse/skills/cv3d-scene-motion/SKILL.mdnew file mode 100644index 00000000..64c27027--- /dev/null+++ b/harness/codeverse/skills/cv3d-scene-motion/SKILL.md@@ -0,0 +1,189 @@+---+name: cv3d-scene-motion+description: "Make a scene_threejs scene visibly move between the two frames the harness photographs, and survive the four mechanisms that silently freeze it. Use in any scene session that authors or refines animation — baseline, zone, refine or compose — and on every repair round where the scene_frames gate reported no motion or the judge answered nothing_moves. Covers the measured motion threshold, the single update hook the harness actually calls, the amplitudes that read at 1024 x 576, and why clearing the motion gate is not the same as scoring animation_life — that is judged per item against the plan animation list."+license: Apache-2.0+compatibility: "scene track, language scene_threejs. three r182 in headless Chrome; the harness photographs each camera at t = 0 s and t = 1.5 s and diffs the pair."+metadata:+ evidence: mixed+ evidence_note: "The mechanism, thresholds and hook are read from live code (spatial/frame_motion.py, spatial/frame_metrics.py, runtime_js/lib/scene_host.mjs) and are exact. The corpus behind them is thin: 3 graded scene runs / 8 judged rounds on scenes_v1_flash, 2026-08-23. Where a number is from that battery it says so."+ verified: "2026-08-25"+ pairs_with: "cv3d-scene-composition, cv3d-scene-lighting, cv3d-threejs-shader-traps"+---++# Motion the harness can measure++## When to use++You are writing or fixing `update(t, dt)` for a scene, or a gate/judge said the+scene is frozen. Read the measurement first; it is not the one you would guess.++## What is actually measured++`animation_life` is **0.431** — the lowest mean of any criterion in any language+in the corpus (8 judged rounds over 3 graded scene runs, `scenes_v1_flash`,+2026-08-23). Since 2026-08-24 the harness no longer leaves that to perception.+`codeverse/spatial/frame_motion.py` diffs the first and last frame of every+camera and hands the judge the number:++* a **pixel** counts as changed when any channel differs by more than 8 of 255+* a camera counts as **MOVING** when at least **0.4 %** of its pixels changed, or+ when 0.08 % of them changed by more than 60 of 255 (a lit window, a spark)+* only **authored** cameras — the ones you returned from `createScene` — count.+ The harness's own orbit and eye views are measured and shown but never decide+ the verdict+* if no authored camera moves, `scene_frames` emits an **ERROR** whose message is+ "nothing moves: the largest change on an authored camera is N% of pixels …+ (measured, not perceived)", and the judge is told to treat it as fact++So the target is concrete: **one authored camera over 0.4 % of changed pixels+between t = 0 and t = 1.5 s.** On a 1024 x 576 frame that is about 2,360 pixels —+roughly a 50 x 50 patch. A few centimetres of sway on a scene tens of metres wide+does not reach it.++## Clearing the bar is necessary, and it is not sufficient++Re-measuring the stored frames of all 8 recorded rounds with today's code+(2026-08-25) gives an uncomfortable result: **every one of them cleared the bar.**+The best authored camera changed 2.1 %–4.7 % of its pixels in every round — five+to twelve times the threshold — and `animation_life` still came out between 0.1+and 0.8, averaging 0.431.++The reason is in the judge's own words on three of those rounds: "the planned+animations for water and falling leaves are completely static", "the planned+vertex animation for the plant foliage and string lights" is missing. The scene+moved; the things the plan promised did not.++`codeverse/tracks/scene.py::judge_context` hands the judge your plan's+`animation` list verbatim, item by item, alongside the measured motion table. So+the criterion is scored per item, not globally:++* **Every named item in the plan's animation list must be visibly moving on an+ authored camera.** One hero mover clears the gate; it does not discharge a+ four-item animation plan.+* **The amplitude written in the plan is intent, not a spec.** That rooftop+ scene's plan asked for "sway with sine displacement amplitude 0.035 m" and+ "oscillate amplitude 0.015 m" on a scene tens of metres wide — 3.5 cm and+ 1.5 cm are invisible at this resolution and were duly scored as absent. Keep+ the motion the plan describes; scale the number until the measurement says it+ reads.++## The four ways a scene with animation code still scores zero++Every one of these is a mechanism in `runtime_js/lib/scene_host.mjs`, not a+matter of taste. Three of the four leave your animation code visibly present in+the file, which is why they survive a refine round untouched: on four of the+eight recorded rounds, across two different scenes, the judge wrote that the+planned animation was absent while the code for it sat in `src/`.++1. **`requestAnimationFrame` is a no-op stub.** The host replaces it with a+ counter that returns 0 and never calls back. A render loop written the normal+ browser way runs exactly zero times. The lint also rejects the call outright.+ There is no loop; there is only `update`.+2. **`update` is whatever `createScene` returned, and nothing else.** If your+ returned object has no `update` function the boot records "createScene().update+ (t, dt) is not a function (scene will be static)" and moves on — the build+ still passes. A hook named `userData.tick`, `tickEnv` or `animate` is never+ found by anything: the harness calls exactly one function, and it is your job+ to make that function fan out to every mover.+3. **One throw disables animation for the whole run.** `runUpdate` catches the+ exception, sets `updateBroken`, logs "update() disabled, rendering continues+ without animation" and never calls your function again. The first call happens+ at t = 1/30 s, so a single undefined dereference on the very first step+ freezes every later frame of every camera. `scene_probe` reports this as+ `update_ok: false` with the message — check it before you conclude the+ amplitude was too small.+4. **The motion is off camera.** Only authored cameras decide it. A drifting boat+ behind the establishing camera is worth nothing; put the hero motion in the+ frame the first camera looks at.++## The shape that works++```js+export async function createScene({ THREE, renderer, loaders }) {+ const scene = new THREE.Scene();+ const env = buildEnv(THREE, scene);+ const zones = [buildGrove(THREE, ctx), buildHarbour(THREE, ctx)];+ scene.add(...zones);+ const movers = [env, ...zones].filter(Boolean);+ return {+ scene, cameras,+ update(t, dt) {+ for (const m of movers) (m.userData?.update ?? m.update)?.(t, dt);+ },+ };+}+```++One list, built once, walked by the single hook the harness calls. Add a mover to+the list in the same edit that creates it — a zone whose `userData.update` nobody+walks is failure mode 2 wearing a disguise.++## Pose from absolute `t`++The contract requires `update` to be deterministic: the same `t` gives the same+frame. The host does step the simulation in fixed 1/30 s increments and does pass+you a real `dt`, so `+=` will not desynchronise — but it makes every pose depend+on how many steps ran, which is exactly the thing a refine round changes by+accident. Write the pose, do not integrate it:++```js+// yes+pivot.rotation.z = Math.sin(t / PERIOD * 6.283 + phase) * AMP;+leaf.position.y = home.y - ((t * FALL_SPEED + phase) % CYCLE);+// no+pivot.rotation.z += dt * SPEED;+```++Two more rules that follow from the pair of frames:++* **Start mid-phase.** `Math.sin(0) = 0`, so a pure sine puts every sway at rest+ in the t = 0 photograph and the scene reads dead in the very frame the judge+ looks at first. Give each element a phase offset, or drive it with+ `Math.sin(t / P * 6.283 + 1.0)`.+* **Seed the phase per instance.** `phase = rand(i) * 6.283` from your seeded+ hash. A hundred trees sharing one phase is one big object nodding, which both+ looks wrong and cancels itself out in the pixel diff when half the crowd moves+ into the space the other half left.++Never use `Math.random()`, `Date.now()` or `performance.now()` — the contract+forbids all three, and a non-deterministic scene makes the two frames+incomparable.++## Amplitudes that clear 0.4 %++Give the scene **one unmistakable hero motion** — a turning wheel, a drifting+boat, falling leaves, a rotating beam, a flock — and then give every remaining+item on the plan's animation list an amplitude from this table. The hero clears+the gate; the rest of the list is what the criterion is scored against.++| what moves | amplitude over 1.5 s | period |+|---|---|---|+| foliage / banner sway | 0.10–0.20 rad (6–11 degrees) at the pivot | 1.6–3 s |+| grass, reeds | 0.15 rad, phase-offset per instance | 1.2–2 s |+| water | wave height at least 0.04 m **and** a scrolling uv/normal at 0.15 m/s | 2–4 s |+| falling leaves, petals, snow, dust | at least 0.6 m of travel, 60–250 particles | recycle over 6–12 s |+| flame / lantern flicker | intensity x0.75 to x1.3, plus `emissiveIntensity` | 0.1–0.3 s |+| vehicles, boats, birds | at least 1.5 m of travel | loop |++Pivot placement matters as much as amplitude: rotate a group whose origin is at+the **base** of the trunk or the **top** of the flagpole, so the far end swings.+Rotating the mesh about its own centre moves half as many pixels for the same+angle.++## Prove it before you finish++Call `scene_views` (its default is `times=[0, 1.5]`) and read the measured+motion table it prints — it names each authored camera and its changed fraction.+Then do the harder check the table cannot do for you: put the two sheets side by+side and walk the plan's animation list item by item, pointing at each one in the+picture. An item you cannot point at is the one the judge will name. If your best+authored camera is under 0.4 %, or an item is invisible, double the amplitude or+move the mover into frame. Do not ship on the strength of having written the+code — and if nothing at all moved, run `scene_probe` first: a frozen scene is+more often a thrown `update` than a small amplitude.++## Depth++`references/motion_recipes.md` — the sway pivot, the recycling particle field,+the scrolling-water uniform and the mover-registration pattern, each as code you+can paste and adapt.diff --git a/harness/codeverse/skills/cv3d-scene-motion/references/motion_recipes.md b/harness/codeverse/skills/cv3d-scene-motion/references/motion_recipes.mdnew file mode 100644index 00000000..eb5b599e--- /dev/null+++ b/harness/codeverse/skills/cv3d-scene-motion/references/motion_recipes.md@@ -0,0 +1,127 @@+# Motion recipes++Executed against the harness's own `[email protected]` in node on 2026-08-25; the+printed values are quoted under each block.++## The seeded hash you need first++`Math.random()` is forbidden (a non-deterministic scene makes the two photographs+incomparable, and the lint warns on it).++```js+const rand = (i) => { const s = Math.sin(i * 12.9898 + 78.233) * 43758.5453; return s - Math.floor(s); };+```++## Sway pivot — base-anchored, phase-seeded, mid-phase at t = 0++```js+function swayPivot(THREE, child, { name = 'Sway', amp = 0.14, period = 2.2, seed = 0 } = {}) {+ const pivot = new THREE.Group(); pivot.name = name; pivot.add(child);+ const phase = rand(seed) * 6.2832 + 0.8; // + 0.8 so t = 0 is NOT the rest pose+ pivot.userData.update = (t) => {+ pivot.rotation.z = Math.sin(t / period * 6.2832 + phase) * amp;+ pivot.rotation.x = Math.sin(t / (period * 1.37) * 6.2832 + phase * 1.7) * amp * 0.55;+ };+ return pivot;+}+// seed 3, amp 0.14: rotation.z moves 0.209 rad between t = 0 and t = 1.5, and+// sits at -0.069 rad in the t = 0 frame rather than dead upright.+```++Three things are load-bearing and all three are cheap:++* the pivot Group's origin is at the **base** of what sways, so the far end+ travels; the child geometry is translated up into it, not centred on it+* the two axes use incommensurate periods (`period` and `period * 1.37`) so the+ motion never repeats exactly and never looks like a metronome+* `+ 0.8` in the phase means the t = 0 photograph catches the element already+ leaning. A pure `Math.sin(t * k)` is exactly zero at t = 0, which is the frame+ the judge sees first.++Wrap each instance with its own `seed` (its index in the scatter loop). A hundred+trees on one phase is one large object nodding — and worse for the pixel diff,+symmetrical crowds partly cancel: half the copies move into the pixels the other+half vacated.++## Falling particles — recycled, pure function of t++```js+function fallingField(THREE, n, area, { fall = 0.9, cycle = 8, seed = 0 } = {}) {+ const pos = new Float32Array(n * 3), base = new Float32Array(n * 3), ph = new Float32Array(n);+ for (let i = 0; i < n; i++) {+ base[i*3] = area.x + (rand(i + seed) - 0.5) * area.w;+ base[i*3+1] = area.top;+ base[i*3+2] = area.z + (rand(i + seed + 600) - 0.5) * area.d;+ ph[i] = rand(i + seed + 900) * cycle; // stagger, or they fall as one sheet+ }+ const geo = new THREE.BufferGeometry();+ geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));+ const pts = new THREE.Points(geo, new THREE.PointsMaterial({ size: 0.05 }));+ pts.name = 'Leaves';+ pts.userData.update = (t) => {+ const p = geo.attributes.position.array;+ for (let i = 0; i < n; i++) {+ const u = ((t + ph[i]) % cycle) / cycle; // wraps; no state accumulates+ p[i*3] = base[i*3] + Math.sin((t + ph[i]) * 0.8) * 0.35;+ p[i*3+1] = base[i*3+1] - u * fall * cycle;+ p[i*3+2] = base[i*3+2] + Math.cos((t + ph[i]) * 0.6) * 0.35;+ }+ geo.attributes.position.needsUpdate = true; // without this nothing moves at all+ };+ return pts;+}+// 160 particles, fall 0.9 m/s: a leaf travels 1.35 m between t = 0 and t = 1.5,+// and calling update(1.5) twice returns the identical value.+```++The modulo is what makes recycling stateless: no counter to drift, no reset to+miss, and `update(1.5)` gives the same frame however many times it is called.+Allocate `pos`, `base` and `ph` once at build time — the contract budgets+`update` at under 4 ms and forbids per-frame allocation and `traverse`.++## Registering movers++```js+// in each zone / asset builder+zone.userData.update = (t, dt) => { /* ... */ };++// in src/scene.js — ONE list, built once, walked by the one hook the harness calls+const movers = [env, ...zones, ...assets].filter(Boolean);+return { scene, cameras, update(t, dt) { for (const m of movers) (m.userData?.update ?? m.update)?.(t, dt); } };+```++Add to `movers` in the same edit that creates the mover. The harness calls+nothing else: not `userData.tick`, not `animate`, not a `requestAnimationFrame`+callback (that function is a stub here that returns 0 and never fires).++## Scrolling a shader without a clock of its own++A `ShaderMaterial` animates by having its `uTime` uniform written from the same+`update`, never by reading a clock inside itself (`Date.now` and+`performance.now` are forbidden, and the render happens at a simulated time, not+a wall-clock one).++```js+const water = makeWaterMaterial(THREE, { /* ... */ }); // uniforms: { uTime: { value: 0 }, ... }+group.userData.update = (t) => { water.uniforms.uTime.value = t; };+```++Two failure shapes to avoid: a uniform declared in the shader but missing from+`uniforms` (`runtime_js/lib/host_compile.mjs` reports that as an `unbound_uniform`+ERROR, and `glsl_audit.mjs` catches it statically), and a `uTime` that is+written but multiplied by so small a factor that the surface is identical at+t = 0 and t = 1.5. For water the readable combination is a vertical wave of at+least 4 cm **and** a uv/normal scroll of at least 0.15 m/s — a mirror-flat pond+that only changes its specular highlight does not clear the pixel bar.++## Reading the verdict++`scene_views` prints the measured table under the contact sheet, one line per+camera:++```+Establishing [authored]: 3.7% of pixels changed between t=0s and t=1.5s (max delta 243/255) — MOVING+```++`MOVING` on an authored camera is the whole of the gate. It is not the whole of+`animation_life`: that is scored against the plan's animation list, item by item.diff --git a/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md b/harness/codeverse/skills/cv3d-threejs-forms/SKILL.mdnew file mode 100644index 00000000..50f2aeb4--- /dev/null+++ b/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md@@ -0,0 +1,131 @@+---+name: cv3d-threejs-forms+description: "Turn each FORM word in your manifest into the right three.js geometry maker, with the segment counts that make curves read and the traps that make a threejs part silently ship nothing. Use in any baseline, part, detail, refine, rebuild or repair session on the static_object track in language threejs — that is, whenever you are writing src/object.js or src/parts/*.js. Covers the fact that this language has no boolean/CSG at all, so cavities and shells are built into the profile instead of subtracted."+license: Apache-2.0+compatibility: "static_object track, language threejs. three r182 ESM in node, exported to GLB by the harness. Imports that resolve: three, three/addons/*, relative files under src/."+metadata:+ evidence: inherited-unverified+ evidence_note: "Zero graded threejs bench runs exist (bench/out/*/runs/*, checked 2026-08-25); the only recorded threejs run is runs/e2e_bench_threejs. Every API claim here is verified against codeverse/prompts/threejs/contract.md, codeverse/prompts/threejs/cookbook.md, codeverse/languages/threejs/lint.py and runtime_js/package.json, but the ADVICE has not been A/B'd on our corpus. Routed off unless CV3D_SKILLS_UNVERIFIED=on; upgrade to measured when threejs reaches 20 graded runs."+ verified: "2026-08-25"+ pairs_with: "cv3d-form-manifest, cv3d-part-contact, cv3d-bbox-contract"+---++# FORM to three.js++## When to use++You have a manifest (or a plan part row) and you are about to write+`src/parts/<snake>.js`. Look up each FORM word, write that element, move on.++## The table++FORM words come from `cv3d-form-manifest`; the same words key the blender and+cadquery tables, so only this column changes when the language does.++| form | three.js | notes |+|---|---|---|+| revolved profile | `LatheGeometry(points, seg)` | `points` are `Vector2(radius, y)`, spun about **Y**. Normals point out when the radius goes 0 → R → 0 bottom-up |+| extruded outline | `ExtrudeGeometry(shape, {depth, bevelEnabled:true, bevelSize, bevelSegments})` | extrudes along **+Z**; `.rotateX(-Math.PI/2)` to lay it flat with thickness along Y |+| tube swept along a path | `TubeGeometry(new CatmullRomCurve3(pts), tubular, radius, radial, closed)` | the only clean way to do a handle, cable, rail or hoop |+| slab | `BoxGeometry(w,h,d)`, or `RoundedBoxGeometry(w,h,d,seg,r)` from `three/addons/geometries/RoundedBoxGeometry.js` | use the rounded one for anything hands touch |+| shaft | `CylinderGeometry(r, r, h, radial)` | axis is **Y**; rotate the group, not the geometry, when you need another axis |+| tapered solid | `CylinderGeometry(rTop, rBottom, h, radial)` or `ConeGeometry(r,h,seg)` | a 5–15 % difference between the two radii is a visible draft and costs nothing |+| ring or band | `TorusGeometry(R, r, radial, tubular)` | lies in the **XY** plane; `.rotateX(Math.PI/2)` to lay it flat |+| carved cavity | **no boolean exists here** — put the recess in the profile: a `Shape` with a `Path` pushed into `shape.holes`, a `LatheGeometry` profile that climbs the outside and comes back down the inside, or a ring of four slabs around the opening | see "There is no CSG" below |+| shell with wall thickness | a `LatheGeometry` whose profile traces outer wall up, across the rim, inner wall down | one geometry, watertight, and the open rim is refinement kind 6 |+| mirror pair | build once, add twice with `mesh.position.x = ±d` | never `scale.set(-1,1,1)`: a negative scale inverts the winding and exports reversed normals |+| radial array | one geometry, `InstancedMesh(geo, mat, N)` with `M.makeRotationY(i/N * 2π)` | derive the angle from N; see the instancing trap below |+| layered or inset | a second slab 1–2 mm proud of or sunk into the face, its own material | the cheapest panel break there is |+| faceted solid | raw `BufferGeometry`: `Float32BufferAttribute` positions + `setIndex` + **`computeVertexNormals()`** | without the normals call it shades black |+| lofted transition | `LatheGeometry` when it is round-to-round; otherwise a raw `BufferGeometry` ring-to-ring strip | three r182 has no loft primitive |++`mergeGeometries` from `three/addons/utils/BufferGeometryUtils.js` collapses many+static pieces of one part into one mesh. Merge inputs must share the same+attribute set (`geo.deleteAttribute('uv')` or `toNonIndexed()` everything), and+call `computeVertexNormals()` after.++## Segment counts that read++Under-segmenting is the most common reason a lathe or a tube reads as a+prism in the render sheet.++| what | radial segments |+|---|---|+| visible cylinder, lathe body, knob | 24–48 |+| thin rod, spoke, baluster, screw shank | 8–12 |+| tube radial | 8–12 |+| small sphere | 16 x 12 |+| extrude `curveSegments` on a curved outline | 16 |++A `SphereGeometry(r, 64, 64)` repeated a hundred times is 800 k triangles and+blows the ceiling; the budget belongs on the shapes that fill the silhouette.++## There is no CSG++`runtime_js/package.json` ships `three`, `puppeteer` and `three-mesh-bvh` only —+there is no `three-bvh-csg`, no `Brush`, no `Evaluator`, and the lint allows+imports of `three`, `three/addons/*` and relative files under `src/` and nothing+else. So a boolean operation is not available to you at all, in either+direction.++That changes how you plan a cavity. A cup is not "a cylinder minus a smaller+cylinder"; it is one lathe profile that goes up the outer wall, across the rim+and back down the inner wall. A bracket with a bolt hole is not a plate minus a+cylinder; it is a `Shape` with an `absarc` `Path` in `shape.holes`. A slot in a+face is four slabs around the opening, or a hole in the extrude outline. Each of+those is one geometry, stays watertight, and exports cleanly — which subtraction+in this language would not, because it does not exist.++## The traps that actually bite++1. **The file name is the export name.** `src/parts/seat_cushion.js` must+ `export function buildSeatCushion(THREE)` — the lint derives the expected name+ from the file stem (`codeverse/languages/threejs/lint.py`). A misspelt name is+ a WARN; no `build*` export in the file at all is an ERROR.+2. **A part file nobody imports ships nothing.** `src/object.js` must import each+ part builder and add its Group to the root. An unimported `src/parts/*.js` is+ a WARN ("dead part file?"), the build succeeds, and the part is simply absent+ from the GLB — this is a real, recorded failure mode in the blender track and+ the same lint rule exists here.+3. **An `InstancedMesh` reads as N stray islands.** The harness exports an+ `InstancedMesh` named `Bolts` as a group `Bolts` of meshes `Bolts_0 …+ Bolts_{n-1}` with matrices baked, so the connectivity gate sees one plan part+ made of N disconnected pieces. In `runs/e2e_bench_threejs` a `FastenerBolts`+ part produced **39 tiny disconnected island** warnings. Instancing is still+ the right tool — just sink each copy into the surface it fastens so it is a+ contact, not a floater.+4. **Never resize with `root.scale`.** Writing your dimensions in one unit and+ then setting `root.scale.set(0.01, ...)` to convert makes the bounds and the+ contract gate disagree, because they read the scaled and unscaled geometry+ inconsistently. Build the geometry at the size the contract asks for.+5. **`ShaderMaterial` and every texture are lost.** GLB export keeps+ `MeshStandardMaterial` / `MeshPhysicalMaterial` and vertex colours only. The+ module is imported in node with no DOM, so `TextureLoader` / `ImageLoader` /+ `FileLoader` and any `document` or `window` reference are hard lint ERRORs —+ colour, roughness, metalness and vertex colours are the whole palette.+6. **Faceted or black shading after any manual edit** → you skipped+ `computeVertexNormals()`.+7. **`mesh.position` versus `geometry.translate()`.** Position moves the pivot+ and is what you want for a part placed at its world pose; `.translate()` bakes+ the offset into the vertices and is what you want before a merge or to move a+ blade root onto its pivot. Doing both by accident doubles the offset.+8. **Only `mergeGeometries` exists**, not `mergeBufferGeometries`, and+ `three/examples/js/*`, `Geometry`, `Face3`, `sRGBEncoding` and `outputEncoding`+ were all removed before r182.++## What the part must return++One `THREE.Group` per plan part, returned at its world pose and added to the root+in `src/object.js`. Everything inside it — merged detail, instanced repeats, raw+BufferGeometry — is invisible to the part-level gates, which is exactly why the+detail belongs in there. The object's naming and frame rules are in the contract;+dimensions and tolerances belong to `cv3d-bbox-contract`; contact and overlap+belong to `cv3d-part-contact`.++## Depth++`references/form_recipes.md` — a runnable snippet per form word, including the+cavity and shell profiles that replace the boolean you do not have.+Longer code lives in the cookbook — `read_cookbook` with section "Geometry+toolkit", "Detail (how to look good cheaply)", "Density: visual complexity+without hand-modelling every screw" or "Raw BufferGeometry and a spoked wheel".diff --git a/harness/codeverse/skills/cv3d-threejs-forms/references/form_recipes.md b/harness/codeverse/skills/cv3d-threejs-forms/references/form_recipes.mdnew file mode 100644index 00000000..e87bfd12--- /dev/null+++ b/harness/codeverse/skills/cv3d-threejs-forms/references/form_recipes.md@@ -0,0 +1,121 @@+# One recipe per FORM word++Every snippet below was executed against the harness's own `[email protected]` in node+on 2026-08-25 and printed the counts shown. Adapt the numbers; keep the shape of+the call.++## shell with wall thickness — the boolean you do not have++A cup, a housing, a bin, a pot. Not "cylinder minus cylinder": one lathe profile+that climbs the outer wall, crosses the rim and comes back down the inside.++```js+function cupGeometry(rOuter, wall, h, floor) {+ const rIn = rOuter - wall;+ const p = [[0, 0], [rOuter, 0], [rOuter, h], [rIn, h], [rIn, floor], [0, floor]];+ return new THREE.LatheGeometry(p.map(([r, y]) => new THREE.Vector2(r, y)), 48);+}+// cupGeometry(0.042, 0.004, 0.095, 0.006) -> 294 vertices+```++The rim between `[rOuter, h]` and `[rIn, h]` is the visible wall thickness —+refinement kind 6, free, and the single clearest signal that a vessel was+modelled rather than approximated by a solid cylinder.++## carved cavity — holes belong in the outline++```js+function bracketGeometry(w, d, t, holeR, holeAt) {+ const s = new THREE.Shape();+ s.moveTo(-w/2, -d/2); s.lineTo(w/2, -d/2); s.lineTo(w/2, d/2); s.lineTo(-w/2, d/2); s.closePath();+ for (const [hx, hz] of holeAt) {+ const hole = new THREE.Path();+ hole.absarc(hx, hz, holeR, 0, Math.PI * 2, true); // `true` = clockwise, required for a hole+ s.holes.push(hole);+ }+ const g = new THREE.ExtrudeGeometry(s, { depth: t, bevelEnabled: true, bevelThickness: 0.0006,+ bevelSize: 0.0006, bevelSegments: 1, curveSegments: 16 });+ g.rotateX(-Math.PI / 2); // ExtrudeGeometry grows along +Z; lay it flat+ g.translate(0, t / 2, 0); // and sit its underside on y = 0+ return g;+}+// bracketGeometry(0.09, 0.05, 0.004, 0.003, [[-0.03, 0], [0.03, 0]]) -> 548 triangles+```++Two refinement kinds in one call: the holes (kind 5) and the bevel (kind 1).++A slot or a rebate that does not pass through works the same way one level up:+build the face out of the slabs *around* the recess rather than trying to remove+material from a single slab.++## radial array — one geometry, one draw call++```js+const teeth = new THREE.InstancedMesh(+ new THREE.BoxGeometry(0.0015, 0.026, 0.0012),+ new THREE.MeshStandardMaterial({ color: 0xeeeeee }), 14);+const M = new THREE.Matrix4(), q = new THREE.Quaternion(), up = new THREE.Vector3(0, 1, 0);+const pos = new THREE.Vector3(), sc = new THREE.Vector3(1, 1, 1);+for (let i = 0; i < 14; i++) {+ const a = i / 14 * Math.PI * 2; // angle from the COUNT, never a typed list+ q.setFromAxisAngle(up, a);+ pos.set(0.016 * Math.cos(a), 0.168, 0.016 * Math.sin(a));+ M.compose(pos, q, sc);+ teeth.setMatrixAt(i, M);+}+teeth.instanceMatrix.needsUpdate = true; // or the copies all sit at the origin+teeth.computeBoundingSphere(); // or the whole mesh is frustum-culled away+teeth.name = 'ConeTeeth';+```++Remember what this costs at the gate: the exporter turns `ConeTeeth` into a+group of `ConeTeeth_0 … ConeTeeth_13`, so if the copies do not touch the body+they read as thirteen stray islands. Sink each copy into the surface.++## faceted solid — raw BufferGeometry++```js+function wedge(w, h, d) {+ const g = new THREE.BufferGeometry();+ g.setAttribute('position', new THREE.Float32BufferAttribute(+ [-w/2,0,d/2, w/2,0,d/2, w/2,0,-d/2, -w/2,0,-d/2, -w/2,h,-d/2, w/2,h,-d/2], 3));+ g.setIndex([0,2,1, 0,3,2, 0,1,5, 0,5,4, 1,2,5, 3,4,2, 4,5,2, 0,4,3]);+ g.computeVertexNormals(); // omit this and the mesh renders black+ return g;+}+```++Wind every triangle counter-clockwise seen from outside. If a face renders dark+while its neighbours are lit, that triangle's index order is reversed — fix the+order, do not add a light and do not set `side: DoubleSide` to hide it.++## merging the pieces of one part++```js+const a = new THREE.BoxGeometry(0.04, 0.012, 0.05).toNonIndexed(); a.deleteAttribute('uv');+const b = new THREE.BoxGeometry(0.04, 0.012, 0.05).translate(0, 0.02, 0).toNonIndexed(); b.deleteAttribute('uv');+const merged = mergeGeometries([a, b]); // -> 72 vertices+merged.computeVertexNormals();+```++`mergeGeometries` throws "All geometries must have compatible attributes" when+one input has `uv` or an index and another does not. Normalise first+(`toNonIndexed()` everything and delete the attributes you are not using), merge,+then recompute normals. Merging is for static detail *inside* one part — keep one+`THREE.Group` per plan part so the census and the gates still see your parts.++## revolved profile, tube and rounded slab, in one line each++```js+const knob = new THREE.LatheGeometry([[0,0],[0.014,0],[0.016,0.004],[0.010,0.018],[0,0.020]]+ .map(([r, y]) => new THREE.Vector2(r, y)), 32);+const curve = new THREE.CatmullRomCurve3([new THREE.Vector3(0.05,0.30,0), new THREE.Vector3(0.10,0.20,0.02),+ new THREE.Vector3(0.18,0.08,0), new THREE.Vector3(0.30,0.01,-0.03)]);+const handle = new THREE.TubeGeometry(curve, 48, 0.004, 10, false);+const cushion = new RoundedBoxGeometry(0.40, 0.10, 0.40, 4, 0.03); // 2916 vertices+```++The `LatheGeometry` profile is the highest-value call in this language: a taper+(kind 2), a curved flank (kind 3), a shaped edge (kind 4) and a rim (kind 6) all+come out of the same list of points at no extra cost, and it is the difference+between a knob that reads as turned and a knob that reads as a cylinder.