@babylonjs-toolkit/agent 1.1.35 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Babylon Toolkit Desktop Agent (1.1.35)
1
+ # Babylon Toolkit Desktop Agent (1.1.38)
2
2
 
3
3
  The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.1.35",
3
+ "version": "1.1.38",
4
4
  "description": "Installs the Babylon Toolkit Desktop Agent for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -42,7 +42,7 @@ Work in **phases**: a `### Phase N` group in the plan, or — if the plan has no
42
42
  4. **Fix loop** for a task that failed: fix the code in the context that wrote it; re-run its tests; re-verify with a **fresh** verifier given only the failed items and the evidence (`--strict`: the whole task). A records-only slip (a stale number or note) is fixed directly and re-checked by you. 3 attempts (`--strict`: 5), each changing something material; stop early if two attempts fail the same way with no new idea. Still failing → leave it unticked, stop and report *(auto-pilot: defer and continue)*.
43
43
  5. **Report:** tasks done (for `ALL` / ranges: the range asked for, completed/total, and whether the plan is now finished; if fewer than `n` tasks remained for `NEXT:<n>`, say so), files changed, tests run (`tests: 4 passed (implementer) · verifier-checked`), verifier result (`verified (independent subagent)` or `verified (self)`), and the next task id — for reference only.
44
44
 
45
- **The verifier is told:** *"Confirm each task's Acceptance is genuinely met and run its `Verify` commands against the stated expected output. Re-run the tests and the relevant suite once; check they really cover the Acceptance and named edge cases and could fail — missing or vacuous tests are a FAIL. Read the diff for real defects: logic errors, broken callers, unhandled edge cases the plan names, a documented behavior dropped or inverted, a sibling-skill template re-implemented instead of copied. For any task whose correctness shows only at runtime — rendering, UI, interaction, Unity↔Babylon parity — check it live in the browser (and Unity where relevant) whether or not the plan marks it `live`, and do the plan's final end-to-end check live: look at the running result, beside the reference image when there is one, and judge it as a user would; passing unit tests never substitute. Do all of a phase's live checks in one session on the already-running dev server, and re-export from Unity only if the phase changed Unity-side content. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence, listing records-only slips separately."*
45
+ **The verifier is told:** *"Confirm each task's Acceptance is genuinely met and run its `Verify` commands against the stated expected output. Re-run the tests and the relevant suite once; check they really cover the Acceptance and named edge cases and could fail — missing or vacuous tests are a FAIL. Read the diff for real defects: logic errors, broken callers, unhandled edge cases the plan names, a documented behavior dropped or inverted, a sibling-skill template re-implemented instead of copied. For any task whose correctness shows only at runtime — rendering, UI, interaction, Unity↔Babylon parity — check it live in the browser (and Unity where relevant) whether or not the plan marks it `live`, and do the plan's final end-to-end check live: look at the running result, beside the reference image when there is one, and judge it as a user would; passing unit tests never substitute. Do all of a phase's live checks in one session on the already-running dev server, and re-export from Unity only if the phase changed that scene's export — then only the project and the scenes the phase works on. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence, listing records-only slips separately."*
46
46
 
47
47
  `[SCOPE]` is one of two sentences. **Standard:** *"Do not add mutation testing, fuzzing, restarts or audits of untouched files unless something you found points there; aim for about 25 tool calls and report rather than expand."* **`--strict`:** *"Be adversarial: actively look for any reason the Acceptance is NOT met, using whatever you judge worthwhile — mutation checks against the tests, randomized inputs, re-deriving values from the plan's Decisions and Design Reference, live QA of every rendered or exported surface."*
48
48
 
@@ -55,6 +55,7 @@ For a task built on a sibling skill (e.g. bt-design's 3D-Hero-Scroll), give the
55
55
  Writing the code is about a tenth of a run; keep the loop around it short.
56
56
 
57
57
  - **Iterate narrow, confirm wide.** While getting something to work, run only that task's tests, the fastest build the repo has, and one low-resolution capture on one engine. The full test chain, full build and any wider check (second engine, full resolution, numeric parity gates) run **once**, when the phase is ready to verify. A parity gate is never loosened to pass.
58
+ - **Export minimally.** Re-export only the Unity project being tested, only the scenes the task works on, and only when the change actually alters that scene's export. Never re-export other scenes or projects "for consistency" — they pick the change up at their next natural export. Exports are the slowest step of a run; brief every implementer and verifier with this rule, and never widen a plan's export step in a brief.
58
59
  - **Never sleep-poll.** No `until …; do sleep N; done`. Run long commands in the foreground with a generous timeout, or in the background and wait for the completion notice.
59
60
  - **Judge visuals by looking** — screenshot the running result and compare it to what it must match. Build numeric gates only when the plan asks for them.
60
61
  - **Reuse the project's tools; keep evidence light.** No one-off tools per task; no ledgers, md5 or environment records, archives or checked-in capture trees unless the plan asks. The report (and the run log) is the record.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bt-gauntlet
3
- description: "The Babylon Toolkit Gauntlet Skill runs a loop-engineering gauntlet: builders versus fresh harsh critics, scored against a LOCKED target image from LOCKED cameras, looping until a success condition, boundary, or stall rule stops it. Two deliverable kinds share one loop — BabylonJS / Babylon Toolkit web games, and anything authored in Unity (game levels and the individual assets in them: baked GI, IBL, reflection probes, terrain, fog, tonemapping, materials, models), with headless Blender as the tool for low-level model work. Unity plus the Toolkit exporter is the content-creation surface and asset manager, shipping interactive glTF that BabylonJS loads; iteration stays inside Unity on camera snapshots and the export is a deliberate checkpoint, not a per-round tax. Fully RESUMABLE: each job lives in its own _gauntlet/<name>/ workspace, so the user can stop any time (daily limits, calling it a night) and continue weeks later in a brand-new session with `/bt-gauntlet --resume <name>`. Use for a long-running, self-improving build of an ambitious game artifact, level, or asset (e.g. `/bt-gauntlet build me a rain-soaked neon alley level at the fidelity of this reference image`)."
3
+ description: "The Babylon Toolkit Gauntlet Skill runs a loop-engineering gauntlet: builders versus fresh harsh critics, scored against a LOCKED target image from LOCKED cameras, looping until a success condition, boundary, or stall rule stops it. Two deliverable kinds share one loop — BabylonJS / Babylon Toolkit web games, and anything authored in Unity (game levels and the individual assets in them: baked GI, IBL, reflection probes, terrain, fog, tonemapping, materials, models), with headless Blender as the tool for low-level model work. Unity plus the Toolkit exporter is the content-creation surface and asset manager, shipping interactive glTF that BabylonJS loads; iteration stays inside Unity on camera snapshots, relying on Unity→Babylon parity, with export + browser checkpoints at milestones rather than every round. Fully RESUMABLE: each job lives in its own _gauntlet/<name>/ workspace, so the user can stop any time (daily limits, calling it a night) and continue weeks later in a brand-new session with `/bt-gauntlet --resume <name>`. Use for a long-running, self-improving build of an ambitious game artifact, level, or asset (e.g. `/bt-gauntlet build me a rain-soaked neon alley level at the fidelity of this reference image`)."
4
4
  allowed-tools: Read, Grep, Glob, Edit, Write, Bash, WebFetch(domain:raw.githubusercontent.com), Agent, Task
5
5
  ---
6
6
 
@@ -98,13 +98,13 @@ The loop may not start until **every slot of the chosen template is filled**. Th
98
98
  Interview batches:
99
99
 
100
100
  0. **NAME** — Confirm the job's slug. It becomes `_gauntlet/<name>/` and must not collide with an existing job.
101
- 1. **DELIVERABLE KIND + DELIVERABLE** — Which of the three kinds is this: a **web game**, a **Unity level for export**, or a **Blender model**? Then what exactly ships (playable browser demo, one polished level, a hero asset with LODs...)? Module style: ES6/ESM default; UMD only if explicitly demanded. New project or existing? Target folder. **Read the matching pipeline reference now** and run its prerequisite gate before going further — a failed gate (no Pro licence, no GUI bootstrap, no Blender) changes what is worth agreeing to.
101
+ 1. **DELIVERABLE KIND + DELIVERABLE** — Which of the three kinds is this: a **web game**, a **Unity level for export**, or a **Blender model**? Then what exactly ships (playable browser demo, one polished level, a hero asset with LODs...)? Module style: ES6/ESM default; UMD only if explicitly demanded. New project or existing? Target folder. **Read the matching pipeline reference now** and run its prerequisite gate before going further — a failed gate (no Pro licence, no toolkit bootstrap, no rendering Editor for snapshots, no Blender) changes what is worth agreeing to.
102
102
  2. **OBJECTIVE** — The exact outcome that must become true, as one testable sentence. Rewrite with the user until it is inspectable.
103
103
  3. **THE TARGET + CAMERAS** — Per `references/target-images.md`: does the user have reference media, is there an existing artifact to refine, or do we generate the target? Agree the target image(s), run the **reachability pass** (Reachable / Approximable / **OUT OF REACH**), and agree the **locked cameras** — one per target, three to five, including a detail crop. Settle the **image-generation backend** too (kie by default, the Higgsfield CLI if it is installed and signed in or the user asks for it — `target-images.md` §1a) and record it in `pipeline.md`. Plus numeric benchmarks: target FPS @ resolution, max load time, draw-call / texture / triangle budgets. If the user has no benchmark, making a defensible one is part of the interview, not skipped.
104
104
  4. **RUBRIC + PASS THRESHOLD** — Confirm the rubric axes from `references/critic-rubrics.md` (or amend them for this job) and the score a part must reach to pass. Default: **8.0 / 10 plus every hard gate green.**
105
105
  5. **SUCCESS CONDITION** — When is the loop DONE? (e.g. "every part scores ≥8/10 from a fresh critic; sustained 60 FPS @1080p in Chrome; zero console errors; the final integration critic passes"). Success and failure defined separately.
106
106
  6. **BOUNDARIES** — Time/cost expressed in **rounds and attempts, not wall-clock** (wall-clock cannot survive a two-week pause; counters can): max total rounds, max attempts per part before a forced strategy change, max consecutive no-improvement rounds. Permission gates: no deploy, no purchases/paid services, no credentials, no destructive ops, no contacting anyone — without explicit approval. For `unity`: the **bake tier policy** (how many rounds at preview tier before a production bake). Escalation rules: what blocks and waits for the user.
107
- 7. **Kind specifics** — For `web-game`: genre & camera, physics (Havok default), input, audio, asset pipeline, scene scale, target browsers, and explicit scope cuts. For `unity`: which scene (that is where the work is authored, rendered and judged), render pipeline, terrain in scope?, existing lighting to preserve, whether Blender model work is in scope (and if so which assets, in-place or new path, tri budget, texel density, rig to match), the bake tier policy, and the checkpoint cadence (round 1 + when done, by default). The Editor runs in **copilot mode** — `-nographics` cannot render the in-loop snapshots. What finally gets exported — the whole level, or an individual asset as a container — is the user's call at checkpoint time, not something to decide now.
107
+ 7. **Kind specifics** — For `web-game`: genre & camera, physics (Havok default), input, audio, asset pipeline, scene scale, target browsers, and explicit scope cuts. For `unity`: which scene (that is where the work is authored, rendered and judged), render pipeline, terrain in scope?, existing lighting to preserve, whether Blender model work is in scope (and if so which assets, in-place or new path, tri budget, texel density, rig to match), the bake tier policy, and the **milestone checkpoints** (round 1, each major part group as it passes, and the end — by default). The Editor runs **with graphics** (never `-nographics`) and with the GPU Resident Drawer off, or its snapshots show only the sky. The level is authored like a full Unity game level and relies on Unity→Babylon parity; checkpoints confirm it. What finally gets exported — the whole level, or an individual asset as a container — is the user's call at checkpoint time, not something to decide now.
108
108
 
109
109
  8. **Loop mechanics** — confirm `--template` choice, rounds-per-session default, and any parts the user wants prioritized first.
110
110
 
@@ -140,7 +140,7 @@ _gauntlet/<name>/
140
140
  1. **Inspect** the current state: `progress.md` + `pipeline.md` + the actual project — plus `components.md` when supplied assets carry component metadata (write it now if it is owed and missing).
141
141
  2. **Select** the highest-impact unmet criterion — normally the top entries of the **standing gap list** from the last critic, respecting user priorities from the brief.
142
142
  3. **Build** — make one coherent improvement, through the deliverable kind's build surface. **Template A:** fan out builder subagents only for *genuinely independent* parts; **keep tightly coupled systems under one sequential owner** (broad fan-out performs WORSE than sequential ownership for coupled visual systems). **Template B:** single-track. When a stall tier is active, obey it — incremental tweaks are forbidden and the round must carry a `STRATEGY:` line.
143
- 4. **Verify with the real artifact** — run the pipeline's verify recipe and capture evidence **from the locked cameras** into `_gauntlet/<name>/evidence/`: screenshots plus whatever metrics that pipeline can measure in-loop. **Use the pipeline's cheap in-loop mode every round** — for `unity` that is a Unity camera snapshot, *not* a bake-export-serve-browser round trip; the expensive engine verification is a deliberate checkpoint (round 1, and when the work is done), never a per-round tax. **Screenshots are required for visual parts.** If the host cannot produce the evidence, mark the part `unverified` — it can NEVER be flipped to `- [x]` on the builder's word.
143
+ 4. **Verify with the real artifact** — run the pipeline's verify recipe and capture evidence **from the locked cameras** into `_gauntlet/<name>/evidence/`: screenshots plus whatever metrics that pipeline can measure in-loop. **Use the pipeline's cheap in-loop mode every round** — for `unity` that is a Unity camera snapshot, *not* a bake-export-serve-browser round trip; the expensive engine verification is a deliberate checkpoint (round 1, each milestone, and when the work is done), never a per-round tax. **Screenshots are required for visual parts.** If the host cannot produce the evidence, mark the part `unverified` — it can NEVER be flipped to `- [x]` on the builder's word.
144
144
 
145
145
  5. **Criticize (fresh context)** — spawn a harsh critic subagent per `references/critic-rubrics.md`. It receives the loop card, the part's spec, the target, the evidence, the metrics, **the previous round's screenshot and verdict**, and the pipeline's extra inputs — **never the builder's rationale**. It returns a **scored rubric**, the **FULL prioritized gap list** (not one gap), every **hard gate** as pass/fail, a regression note, and PASS/FAIL. It grades pixels, numbers and behaviour — never effort or intent.
146
146
  6. **Record** — append `rounds/round-NN.md` with the score and the whole gap list; update `progress.md`: on PASS flip the part to `- [x]`; on FAIL log the top gap and increment the attempt counter; update the best/last scores and the stall tier. Persist BEFORE the next round.
@@ -180,9 +180,9 @@ generate_image(
180
180
 
181
181
  **Interview settles:** kind `unity`; three locked cameras (`gauntlet_hero` down the alley, `gauntlet_side` across the puddles, `gauntlet_detail` on a sign); pass threshold 8.0; budgets 60 FPS @1080p, ≤900 draws; bake policy *preview until round 8, then production*.
182
182
 
183
- **The reachability pass matters here.** Screen-space reflections in the target have no export key — the declared approach becomes *a reflection probe per puddle group plus a wet-mask material*, recorded as **Approximable**. True volumetric light shafts go to `OUT OF REACH`; height fog stands in. Without this the critic names "no SSR" every round forever.
183
+ **The reachability pass matters here.** URP has no screen-space reflections to export — the declared approach becomes *a reflection probe per puddle group plus a wet-mask material*, recorded as **Approximable**. True volumetric light shafts go to `OUT OF REACH`; height fog stands in. Without this the critic names "no SSR" every round forever.
184
184
 
185
- **Round 1** runs the prerequisite gate (`bt_status` → `pro : True` or park), writes `pipeline.md`, authors the blockout via `eval_file`, creates the LightingSettings asset (`NewScene → build → SaveScene → assign → MarkSceneDirty → SaveOpenScenes`), places the three `gauntlet_*` cameras, and decomposes into the P1–P11 part checklist.
185
+ **Round 1** runs the prerequisite gate (`bt_status` → `pro : True` or park), writes `pipeline.md`, authors the blockout via `run_script` builders, creates the LightingSettings asset (`NewScene → build → SaveScene → assign → MarkSceneDirty → SaveOpenScenes`), places the three `gauntlet_*` cameras, and decomposes into the P1–P11 part checklist.
186
186
 
187
187
  Round 1 also runs the **one calibration checkpoint** — a single export + browser load — to prove the whole chain works before investing 12 rounds, and to record what actually crosses the export boundary.
188
188
 
@@ -190,16 +190,17 @@ Round 1 also runs the **one calibration checkpoint** — a single export + brows
190
190
 
191
191
  ```bash
192
192
  # bake (preview tier) only if this round touched anything GI-dependent
193
- unity command eval 'UnityEditor.Lightmapping.BakeAsync(); return "started";' --project-path "$PROJ"
194
- unity command eval 'return UnityEditor.Lightmapping.isRunning;' --project-path "$PROJ" # poll to False
193
+ unity command bake_lighting --project-path "$PROJ"
194
+ until unity command lighting_bake_status --project-path "$PROJ" --result-only 2>/dev/null | grep -q completed; do sleep 5; done
195
195
 
196
196
  # snapshot each locked camera straight to PNG — no export, no server, no browser
197
- unity command eval_file /tmp/snap-hero.cs --project-path "$PROJ" # -> evidence/round-NN-p7-hero.png
197
+ unity command capture_game_view --camera gauntlet_hero --width 1920 --height 1080 --project-path "$PROJ" \
198
+ --result-only | jq -r .base64 | base64 -d > _gauntlet/neon-alley/evidence/round-NN-p7-hero.png
198
199
  ```
199
200
 
200
201
  Seconds, not minutes. The critic scores hero + side + detail against their targets and returns the full gap list.
201
202
 
202
- **The export runs twice in the whole job:** the round-1 calibration, and the final pass — production bake, export the finished scene, serve it, and let the integration critic judge the real deliverable while the perf, console and export-boundary gates are measured for real. *Did `reflectionprobeintensity` actually cross, or did the round only move a Unity slider?* — that question gets answered there, not forty times over.
203
+ **The export runs at milestones, not every round:** the round-1 calibration; a checkpoint each time a part group passes (landform, light rig + GI bake + probes, materials + dressing, atmosphere + post); and the final pass — production bake, export the finished scene, serve it, and let the integration critic judge the real deliverable while the perf, console and export-boundary gates are measured for real. *Did `reflectionprobeintensity` actually cross, or did the round only move a Unity slider?* — each milestone answers that for the parts it covers, instead of forty times over or only at the very end.
203
204
 
204
205
  **Parks** at round 12 with `/bt-gauntlet --resume neon-alley`. Weeks later that resumes cold: re-read the workspace, re-launch the Editor, re-run the gate, continue at `NEXT ACTION`.
205
206
 
@@ -229,7 +230,7 @@ generate_image(
229
230
  4. **Capture the baseline score.** Round 1's critic scores the untouched level against the target. That number is the floor — every later round is measured against it, and a regression below it is a gate failure, not a preference.
230
231
  5. Bake tiering matters more here than anywhere, because the scene is already heavy: preview tier for the convergence rounds, one production bake before the integration critic — and with the export out of the loop, the bake is the only per-round cost left, so skip it entirely on rounds that change nothing GI-dependent.
231
232
 
232
- Because the scene was authored in the GUI it already has a LightingSettings asset — but **always pass `--scene`** at checkpoint exports anyway, or a fresh Editor session silently exports the template's default scene instead. Note this pipeline needs a **copilot-mode resident Editor**: `-nographics` has no graphics device and cannot render the in-loop snapshots.
233
+ Because the scene was authored in the GUI it already has a LightingSettings asset — but **always pass `--scene`** at checkpoint exports anyway, or a fresh Editor session silently exports the template's default scene instead. Note this pipeline needs an Editor that can render for the in-loop snapshots: never `-nographics`, and the GPU Resident Drawer off (`unity-pipeline.md` § 1).
233
234
 
234
235
  ## Example 3 — A high-fidelity model, polished in Blender and shipped as an interactive prefab
235
236
 
@@ -240,7 +241,7 @@ It needs a rigidbody, an LOD group and the Animator wired up. Reference is the a
240
241
  turntable.
241
242
  ```
242
243
 
243
- **Interview settles:** kind `unity`, with Blender model work in scope; **write mode IN PLACE** so the GUID and importer settings survive every round; the **render scene** is `Assets/Scenes/Level01.unity` — the level the mech actually lives in, so it is judged under the lighting it will really have (a dedicated lookdev scene only if the asset has no home yet), with its rig frozen for the run; four locked `gauntlet_*` cameras in it including a detail crop; model root `Props/Mech`; budgets 45k tris, 512 px/m texel density; checkpoints at round 1 and the finish.
244
+ **Interview settles:** kind `unity`, with Blender model work in scope; **write mode IN PLACE** so the GUID and importer settings survive every round; the **render scene** is `Assets/Scenes/Level01.unity` — the level the mech actually lives in, so it is judged under the lighting it will really have (a dedicated lookdev scene only if the asset has no home yet), with its rig frozen for the run; four locked `gauntlet_*` cameras in it including a detail crop; model root `Props/Mech`; budgets 45k tris, 512 px/m texel density; checkpoints at round 1, after the Blender parts pass, and at the finish.
244
245
 
245
246
  **Blender hands off to Unity and stops there.** Blender does geometry, UVs, bakes and skinning, editing the FBX in place; Unity assigns materials, colliders, the LODGroup, the Animator and the Babylon Toolkit script components — Blender cannot write `extras.metadata.components`, and under a community licence Unity won't either. After the hand-off the mech is just an asset in `Level01`.
246
247
 
@@ -251,7 +252,8 @@ cp "$FBX" "$FBX.bak" # the write is destructive — always
251
252
  blender --background --factory-startup --python-exit-code 1 \
252
253
  --python /tmp/round-07-bevels.py -- "$FBX" "$FBX" # same path in and out
253
254
  unity command eval 'UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.ForceSynchronousImport); return "ok";' --project-path "$PROJ"
254
- unity command eval_file /tmp/snap-hero.cs --project-path "$PROJ" # -> evidence/round-07-p2-hero.png
255
+ unity command capture_game_view --camera gauntlet_hero --width 1920 --height 1080 --project-path "$PROJ" \
256
+ --result-only | jq -r .base64 | base64 -d > _gauntlet/hero-mech/evidence/round-07-p2-hero.png
255
257
  ```
256
258
 
257
259
  Without `--python-exit-code 1` a crashed script exits `0` and the loop records a failed round as a success. Without in-place writing, every round mints a new GUID and quietly detaches the model from every scene that used it. Both are hard gates.
@@ -280,6 +282,47 @@ thing done at AAA quality—from textures to physics to anything you could think
280
282
 
281
283
  The interview turns that into a filled loop card built with **BabylonJS + the Babylon Toolkit, not ThreeJS** — and, because "AAA quality" is not a bar, into a locked target image, locked cameras, a rubric and a pass threshold before a single round runs.
282
284
 
285
+ ## Example 5 — A design-heavy kart-racing level, built in Unity, verified at milestones
286
+
287
+ ```
288
+ /bt-gauntlet --name:candy-circuit --rounds:40 Build a Mario Kart style race track — a bright
289
+ candy-themed circuit with a jump, a tunnel, boost pads and scenery everywhere. Karts must drive it.
290
+ ```
291
+
292
+ **Unity is the level editor; BabylonJS runs the race.** The track is authored in Unity the way a Unity game level would be — and relies on Unity→Babylon parity rather than exporting every round.
293
+
294
+ **Interview settles:**
295
+ - kind `unity`, with four locked cameras: start grid, the jump, the tunnel exit, and a detail crop on a boost pad;
296
+ - budgets: 60 FPS @1080p desktop, and a mobile tier with a draw-call ceiling;
297
+ - **milestones:**
298
+ - M1 landform + track spline;
299
+ - M2 light rig + GI bake + probes;
300
+ - M3 materials + set dressing;
301
+ - M4 atmosphere + post-processing;
302
+ - M5 gameplay components.
303
+
304
+ **Parts:**
305
+
306
+ | Part | Owns |
307
+ |---|---|
308
+ | Landform | terrain, road mesh along the spline, banking |
309
+ | Blockout + composition | sightlines at each locked camera, readable turns |
310
+ | Materials | candy PBR, emissive boost pads |
311
+ | Light rig | Mixed sun, Baked practicals in the tunnel |
312
+ | GI bake | lightmaps + shadowmask, `LightProbeGroup` along the racing line for the karts |
313
+ | Reflection probes | baked, box-projected in the tunnel |
314
+ | Atmosphere + post | fog, a Volume with ACES and bloom |
315
+ | Physics | road and wall colliders, boost-pad triggers |
316
+ | Karts | Rigidbody chassis, `WheelCollider`s + `RaycastWheel`s |
317
+ | Gameplay | the racing starter's `RaceTrackManager`, `CheckpointManager`, `VehicleInputController` (human + AI autopilot), `StandardCarController` |
318
+ | Perf | the draw-call and FPS budgets |
319
+
320
+ **The rhythm:**
321
+ - **Most rounds stay in Unity:** a `run_script` builder, a preview bake when GI changed, and locked-camera snapshots.
322
+ - **When a milestone's parts pass, run a checkpoint:** export (`--geometryOnly false`), serve, load the same cameras in the browser, and have the critic say which side of the export any gap is on.
323
+ - **M5 is judged driving:** a kart actually laps the track in the browser.
324
+ - **The integration pass** runs the production bake and the full perf gates, desktop and mobile.
325
+
283
326
  ---
284
327
 
285
328
  # Failure-Mode Guardrails (loop rules, non-negotiable)
@@ -1,8 +1,19 @@
1
1
  # Pipeline: `unity`
2
2
 
3
3
  **Deliverable:** anything authored in Unity and shipped through the Babylon Toolkit exporter as interactive
4
- glTF — a whole game level, or an individual asset in it. Baked GI, IBL, reflection probes, terrain, fog and
5
- tonemapping for scenes; geometry, UVs, PBR maps, LODs and skinning for models.
4
+ glTF — a whole game level, or an individual asset in it. Baked GI, IBL, light and reflection probes, terrain,
5
+ fog, post-processing volumes, physics, the Recast navmesh, Animator state machines and gameplay components for
6
+ scenes; geometry, UVs, PBR maps, LODs and skinning for models.
7
+
8
+ > ### Unity is the editor; BabylonJS is the engine
9
+ >
10
+ > Nothing here builds a Unity game or player. The level is authored in the Unity Editor exactly as a detailed
11
+ > Unity game level would be — a Mario Kart-style track, a harbour, a landscape — and exported to glTF, where the
12
+ > toolkit runtime recreates every subsystem. **The goal is Unity→Babylon parity.** So build the level in Unity,
13
+ > judge it in Unity every round, and **count on the parity** — confirming it with browser checkpoints at
14
+ > **milestones** (§ 6.B), not every round. How each feature crosses (directly, by a bake, or by a toolkit
15
+ > equivalent) is the Agent Reference's
16
+ > [Unity Authoring Recipes](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-authoring-recipes.md) §0.
6
17
 
7
18
  > ### Unity is the content-creation tool and the asset manager. Blender is a tool inside it.
8
19
  >
@@ -17,9 +28,10 @@ tonemapping for scenes; geometry, UVs, PBR maps, LODs and skinning for models.
17
28
  > and it is judged there, lit by that scene. Blender **cannot** write components — those come from Unity,
18
29
  > and only under a Pro licence.
19
30
  >
20
- > **The loop stays in Unity. Do NOT export every round.** Evidence is a Unity camera snapshot —
21
- > `Camera.Render()` straight to a PNG from the locked camera. A bake → export → dev-server → browser round
22
- > trip on every iteration costs minutes and tells the critic nothing extra about the art.
31
+ > **The loop stays in Unity. Do NOT export every round.** Evidence is a Unity camera snapshot of the locked
32
+ > camera (§ 6.A). A bake → export → dev-server → browser round trip on every iteration costs
33
+ > minutes and tells the critic nothing extra about the art. **Do export at milestones** — round 1, whenever a
34
+ > major part group passes, and the final integration pass — so parity is confirmed as the level grows.
23
35
  >
24
36
  > **Export when you are ready** — the user's call, by prompt or from the Unity Export buttons: the whole
25
37
  > scene as a **game level** (`selection == null`, full scene metadata), or one asset as an **asset
@@ -28,6 +40,7 @@ tonemapping for scenes; geometry, UVs, PBR maps, LODs and skinning for models.
28
40
 
29
41
  > **Required reading before round 1.** Fetch and read the Agent Reference's
30
42
  > [Unity Exporter Instructions](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-exporter-cli.md)
43
+ > and [Unity Authoring Recipes](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-authoring-recipes.md)
31
44
  > in full — and, for any round that touches Blender, the
32
45
  > [Blender Headless CLI Instructions](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/unity-blender-cli.md).
33
46
  > Section numbers below (§4B, §8, §10 …) refer to whichever is named. Builder subagents must be given them
@@ -46,11 +59,11 @@ unity command bt_status --project-path "$PROJ"
46
59
 
47
60
  | Must be true | Why it is fatal |
48
61
  |---|---|
49
- | `pro : True` | **Community silently drops Terrain**, plus Rigidbody, Animator, AudioSource, NavMeshAgent, CharacterController, ParticleSystem, Canvas, VideoPlayer, **PostProcess volumes** and **LOD groups**. The export still succeeds and still writes scene metadata — it just quietly omits them. See §0. |
62
+ | `pro : True` | **Community silently drops Terrain**, every physics and collision block, the Animator state machine, AudioSource, NavMeshAgent, CharacterController, ParticleSystem, Canvas, VideoPlayer, **PostProcess volumes**, camera AA and **LOD groups**. The export still succeeds and still writes scene metadata — it just quietly omits them. See §0. |
50
63
  | An Editor is reachable | `unity command` needs a live Editor (§6). |
51
- | **A graphics device is available** | In-loop evidence is a real Unity render. `-nographics` has **no** graphics device and cannot render, so this pipeline runs in **copilot mode** (a resident Editor) or batchmode *with* graphics — never `-nographics`. Verify on round 1 by taking one snapshot and confirming the PNG is non-empty. |
64
+ | **The Editor can render the locked cameras** | In-loop evidence is a real Unity render. `-nographics` has no graphics device. With the URP **GPU Resident Drawer** on, camera captures showed **only the skybox** (a failed drawer registration hides every renderer). Run the Editor **with graphics** (copilot resident Editor, or a GUI Editor via `unity open` + `set_autotick --enable true`) and the drawer **off**: `unity command eval 'return RenderPathTools.DisableResidentDrawerReport();'` (the §4B bootstrap does it). Verify on round 1 that the snapshot shows **scene geometry**, not just sky. |
52
65
  | All three packages installed | `com.unity.pipeline` + `org.khronos.unitygltf` + `com.babylontoolkit.editor` (§4.1). |
53
- | Scene Exporter panel bootstrapped once, in a GUI session | Seeds layers, FreeImage, shader list and root namespace, and writes `package.json` (§5.1). **A cold machine that has never run the GUI cannot start a gauntlet.** |
66
+ | Scene Exporter bootstrap has run | Seeds layers, FreeImage, shader list and root namespace, and writes `package.json` (§5.1). Headless is fine: the `bt-bootstrap.cs` script (§4B) replicates the panel's `OnEnable`. |
54
67
  | `npm install` run in the project root | Any build with `CompileProjectScript` needs the local `tsc` (§5.2). |
55
68
  | `unity list --format json \| grep bt_` returns the eight `bt_*` commands | The shipped CLI bridge (`com.babylontoolkit.editor` 9.22.3+, §11). If empty: `recompile` + `recompile_status`. |
56
69
  | `baking : False` | A lightmap bake in progress hard-blocks every export. |
@@ -83,16 +96,16 @@ blender -b --factory-startup --python-exit-code 1 \
83
96
  ```markdown
84
97
  # Pipeline — unity
85
98
  Unity project : /abs/path/UnityProject
86
- Editor mode : copilot (resident GUI) <- REQUIRED; -nographics cannot render
99
+ Editor mode : copilot (graphics on, GPU Resident Drawer off) <- REQUIRED; -nographics cannot render
87
100
  Editor version: 6000.5.10f1
88
101
  Toolkit : 9.22.3 licence: professional
89
102
  Scene : Assets/Scenes/Level01.unity <- authored, rendered and judged here
90
103
  Export root : /abs/path/UnityProject/Export
91
104
  Dev server : http://localhost:8888 (started via bt_devserver_start)
92
- Player page : /index.html?scene=level01.gltf (needs a web-project build — § 6.B)
105
+ Player page : /index.html?scene=Level01.gltf (needs a web-project build — § 6.B)
93
106
  Bake tier : preview | production
94
- Capture mode : unity-snapshot (in-loop) · export+browser (checkpoints only)
95
- Checkpoints : round 1 calibration done [y/n] · last checkpoint round N
107
+ Capture mode : unity-snapshot (in-loop) · export+browser (milestone checkpoints)
108
+ Checkpoints : round 1 calibration done [y/n] · milestones: <part groups> · last checkpoint round N
96
109
  Blender : 5.1.2 (/Applications/Blender.app/Contents/MacOS/Blender) [if in scope]
97
110
  Model assets : Assets/Models/mech.fbx — write mode IN PLACE, backup mech.fbx.bak
98
111
  ```
@@ -108,9 +121,16 @@ Everything runs against the **live active scene** through the CLI. The Editor ke
108
121
  sync; raw file edits cannot.
109
122
 
110
123
  ```bash
111
- unity command eval_file /tmp/round-12-lighting.cs --project-path "$PROJ" --format json
124
+ # builders: a real .cs file (using directives allowed), run with a long timeout — Unity Editor Commands §5.1
125
+ unity command run_script --file AgentScripts/Round12Lighting.cs --entry Round12Lighting.Build \
126
+ --timeout_ms 300000 --timeout 300 --project-path "$PROJ" --format json
127
+ # one-liners: unity command eval '...' (no using directives; ~5 s main-thread limit)
112
128
  ```
113
129
 
130
+ Prefer the typed commands (`create_gameobject`, `set_component_properties`, `set_lighting_settings`,
131
+ `bake_lighting`, `create_animator_controller`, …) where one exists. Check `data.result.success` on
132
+ `run_script` — a compile error still returns an outer `success: true`.
133
+
114
134
  > ⚠️ **Never hand-edit `.unity`, `.prefab` or `.asset` YAML while a live Editor is reachable.** fileIDs and
115
135
  > GUIDs are easy to get wrong, the Editor will not see the change until a reimport, and it is very easy to
116
136
  > write valid-looking YAML into the wrong scene. Only edit files directly when `unity status` /
@@ -237,12 +257,18 @@ Round 1 records the checklist in `progress.md`. A job takes the scene block, the
237
257
  | **Blockout & composition** | major masses, silhouette, sightlines, framing at each locked camera | geometry |
238
258
  | **Set dressing & scatter** | props, clutter, decals, LOD groups | geometry, LOD (**Pro-gated**) |
239
259
  | **Materials & surfacing** | albedo/roughness/metallic/normal, texel density, wear | materials, textures |
240
- | **Light rig** | sun angle + colour temp, practicals, shadow distance and softness | `light`, `sunposition`, `sunrotation` |
241
- | **GI / lightmap bake** | lightmapper, resolution, bounces, denoiser, AO, UV padding | `ambientlightmap`, `lightmaplevel`, lightmap textures |
260
+ | **Light rig** | sun (Mixed) angle + colour temp, Baked fills and practicals, shadow distance and softness | `light` components, `sunposition`, `sunrotation` — Baked lights cross as lightmaps + probes |
261
+ | **GI / lightmap bake** | lightmapper, mixed-lighting mode, resolution, bounces, denoiser, AO, UV padding | `lightmapbakemode`, `shadowmaskmode`, lightmap + shadowmask textures |
262
+ | **Light probes** | `LightProbeGroup` / APV coverage wherever dynamic objects move | `lightprobes` + `<scene>.lightprobes.bin`, `TOOLKIT.LightProbeNetwork` |
242
263
  | **IBL / skybox / ambient** | skybox material or cubemap, ambient mode/source, SH, sky reflections | `skybox`, `skyreflections`, `createpolynomials`, `ambientlighting`, `ambientskymode`, `ambientskysource`, `ambientskycolor`, `ambientgroundcolor`, `ambientlightintensity` |
243
264
  | **Reflection probes** | placement, resolution, box projection, intensity | `reflectionprobeintensity` |
244
265
  | **Atmosphere & fog** | fog type/mode/colour/density, height fog, volumetrics | `fogtype`, `fogmode`, `fogcolor`, `fogdensity`, `fogstart`, `fogend`, `fogvolumetric`, `fogbaseheight`, `fogmaximumheight`, `fogmeanfreepath`, `foganisotropy` |
245
266
  | **Image processing** | exposure, tonemapping, gamma, clear colour | `exposure`, `tonemapping`, `gammacorrection`, `imageprocessing`, `clearcolor` |
267
+ | **Post-processing volumes** | grade, bloom, vignette, DOF, AA on the camera | `TOOLKIT.PostProcessor` components (the whole colour grade baked to a LUT), camera `antialiasing` (**Pro-gated**) |
268
+ | **Navigation** | walkable surfaces, agent radius/height/slope, the toolkit **Recast** bake | `navigation.prebaked` → `scenes/<scene>.nav.bin` |
269
+ | **Physics & colliders** | colliders, rigidbodies, physics materials, triggers, vehicles (`RaycastWheel`) | node `physics` / `collision`, `TOOLKIT.RigidbodyPhysics` (**Pro-gated**) |
270
+ | **Animation & FX** | Animator controllers, particles, audio sources | `TOOLKIT.AnimationState`, `ShurikenParticles`, `AudioSource` (**Pro-gated**) |
271
+ | **Gameplay components** | TypeScript script components (e.g. the racing starter's checkpoints, track manager, kart controllers) | `extras.metadata.components` `script` entries |
246
272
  | **Perf & budget** | draw calls, texture format, lightmap memory, render groups | `webptextures`, `ktxtextures`, `webplightmaps`, `ktxlightmaps`, `rendergroups`, `freezeactivemeshes`, `prewarmup`, `performancepriority` |
247
273
 
248
274
  ### Asset parts (Blender + Unity)
@@ -271,10 +297,13 @@ Two modes. **Almost every round uses mode A.**
271
297
  #### 1. Bake
272
298
 
273
299
  ```bash
274
- unity command eval 'UnityEditor.Lightmapping.BakeAsync(); return "started";' --project-path "$PROJ"
275
- unity command eval 'return UnityEditor.Lightmapping.isRunning;' --project-path "$PROJ" # poll to False
300
+ unity command bake_lighting --project-path "$PROJ"
301
+ until unity command lighting_bake_status --project-path "$PROJ" --result-only 2>/dev/null | grep -q completed; do sleep 5; done
302
+ unity command save_scene --project-path "$PROJ"
276
303
  ```
277
304
 
305
+ (`--result-only` prints the status as a JSON-encoded string — match `completed` without quotes.)
306
+
278
307
  **Bake tiering is the dominant cost** now that the export is out of the loop. Converge on a **preview** tier
279
308
  (low lightmap resolution, few bounces, fast/no denoiser); switch to **production** only for the final rounds
280
309
  and the integration pass. Record the tier in `progress.md` and every round journal — *a preview-tier score is
@@ -283,36 +312,23 @@ entirely on rounds that change nothing GI-dependent (a roughness tweak, a prop m
283
312
 
284
313
  #### 2. Snapshot the locked camera
285
314
 
286
- Render the actual camera through the actual pipeline, straight to a PNG. No export, no server, no browser.
287
-
288
- ```csharp
289
- // eval_file: snapshot one locked camera to disk
290
- string camName = "gauntlet_hero";
291
- string outPath = "/abs/_gauntlet/<name>/evidence/round-12-p7-hero.png";
292
- int w = 1920, h = 1080;
293
-
294
- var go = UnityEngine.GameObject.Find(camName);
295
- if (go == null) throw new System.Exception("locked camera missing: " + camName);
296
- var cam = go.GetComponent<UnityEngine.Camera>();
297
-
298
- var rt = new UnityEngine.RenderTexture(w, h, 24, UnityEngine.RenderTextureFormat.ARGB32);
299
- rt.antiAliasing = 8;
300
- var prevTarget = cam.targetTexture; var prevActive = UnityEngine.RenderTexture.active;
301
- cam.targetTexture = rt;
302
- cam.Render();
303
- UnityEngine.RenderTexture.active = rt;
304
- var tex = new UnityEngine.Texture2D(w, h, UnityEngine.TextureFormat.RGB24, false);
305
- tex.ReadPixels(new UnityEngine.Rect(0, 0, w, h), 0, 0);
306
- tex.Apply();
307
- UnityEngine.RenderTexture.active = prevActive; cam.targetTexture = prevTarget;
308
- System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(outPath));
309
- System.IO.File.WriteAllBytes(outPath, tex.EncodeToPNG());
310
- UnityEngine.Object.DestroyImmediate(tex); rt.Release(); UnityEngine.Object.DestroyImmediate(rt);
311
- return "wrote " + outPath + " bytes=" + new System.IO.FileInfo(outPath).Length;
315
+ Render the actual camera through the actual pipeline, straight to a PNG (§ 1). No export, no server, no
316
+ browser. `capture_game_view` renders a named camera through URP; without `--save_path` it returns the PNG
317
+ inline, so decode it to wherever the evidence lives (a `--save_path` would land under `Assets/` and be imported):
318
+
319
+ ```bash
320
+ unity command capture_game_view --camera gauntlet_hero --width 1920 --height 1080 \
321
+ --project-path "$PROJ" --result-only | jq -r .base64 | base64 -d \
322
+ > "_gauntlet/<name>/evidence/round-12-p7-hero.png"
323
+ file "_gauntlet/<name>/evidence/round-12-p7-hero.png" # PNG image data, 1920 x 1080
312
324
  ```
313
325
 
314
- Repeat per locked camera. **Check the returned byte count** — a zero-length or tiny PNG means no graphics
315
- device (§ 1), not a dark scene.
326
+ > Do not hand-roll `Camera.Render()` into a `RenderTexture` from `eval`: under URP in a batch Editor that
327
+ > wrote an **all-black** frame, while `capture_game_view` of the same camera rendered the lit scene
328
+ > (verified, Unity 6000.5.10f1).
329
+
330
+ Repeat per locked camera. **Look at the image** — an empty file means no graphics device, and a sky-only
331
+ frame means the GPU Resident Drawer is on (§ 1), not a dark or empty scene.
316
332
 
317
333
  #### 3. Collect what Unity can measure
318
334
 
@@ -324,23 +340,31 @@ BabylonJS perf gate**; they catch a scene going wildly heavy, they do not predic
324
340
 
325
341
  That is the whole in-loop verify. Seconds, not minutes.
326
342
 
327
- ### 6.B Checkpoint verification — export + browser (rare, deliberate)
343
+ ### 6.B Checkpoint verification — export + browser (at milestones)
344
+
345
+ Checkpoints confirm the Unity→Babylon parity the loop relies on. Run one:
328
346
 
329
- Run a checkpoint **only** at round 1 (calibration — proves the chain works before investing 40 rounds, and
330
- records what actually crosses the export boundary), and when the work is done. An optional every-N cadence
331
- exists; set it in the loop card, **off by default**.
347
+ 1. **At round 1** — calibration: proves the chain works before investing 40 rounds, and records what actually
348
+ crosses the export boundary.
349
+ 2. **At each milestone** — when a major **part group** passes: landform + terrain, blockout + composition, light
350
+ rig + GI bake + probes, materials + set dressing, post-processing + atmosphere, gameplay components. Agree the
351
+ milestone groups in the interview and record them in `pipeline.md`.
352
+ 3. **At the end** — the integration pass (production bake).
353
+
354
+ Between milestones the loop stays in Unity. A fixed every-N cadence also exists; set it in the loop card, off by
355
+ default.
332
356
 
333
357
  **What you export is the user's call — by prompt, or from the Unity Export buttons.**
334
358
 
335
359
  #### Game level (the default)
336
360
 
337
361
  ```bash
338
- unity command bt_export_level --scene Assets/Scenes/Level01.unity --project-path "$PROJ" --timeout 900
362
+ unity command bt_export_level --scene Assets/Scenes/Level01.unity --geometryOnly false --project-path "$PROJ" --timeout 900
339
363
  unity command bt_devserver_start --project-path "$PROJ"
340
364
  jq '.scenes[0].extras.metadata
341
- | {license, skybox, ambientlighting, ambientskymode, ambientlightmap, lightmaplevel,
342
- reflectionprobeintensity, exposure, tonemapping, fogmode, fogvolumetric, sunposition}' \
343
- "$PROJ/Export/scenes/level01.gltf" > evidence/checkpoint-NN-metadata.json
365
+ | {license, renderpipeline, lightmapbakemode, shadowmaskmode, skybox, lightprobes, navigation,
366
+ ambientlighting, ambientskymode, exposure, tonemapping, fogmode, sunposition}' \
367
+ "$PROJ/Export/scenes/Level01.gltf" > evidence/checkpoint-NN-metadata.json
344
368
  ```
345
369
 
346
370
  `selection == null` gates the **entire scene-metadata block** — skybox, ambient/IBL, SH, reflection probe
@@ -379,8 +403,8 @@ given with no `scenes/` subfolder. Correct for a container; wrong for anything m
379
403
  | URL | Serves |
380
404
  |---|---|
381
405
  | `http://localhost:8888/index.html` | the generated web project, default scene |
382
- | `http://localhost:8888/index.html?scene=level01.gltf` | the player pointed at one scene (**file name, not a path**) |
383
- | `http://localhost:8888/scenes/level01.gltf` | the raw exported asset |
406
+ | `http://localhost:8888/index.html?scene=Level01.gltf` | the player pointed at one scene (**file name, not a path**) |
407
+ | `http://localhost:8888/scenes/Level01.gltf` | the raw exported asset |
384
408
  | `http://localhost:8888/containers/mech.glb` | an asset container written to an explicit folder |
385
409
 
386
410
  ### 6.C What the Unity snapshot cannot tell you
@@ -449,16 +473,25 @@ boundary the gap is on**:
449
473
 
450
474
  ---
451
475
 
452
- ## 8. Scope the target to what can actually cross the boundary
476
+ ## 8. Scope the target — most of Unity crosses
477
+
478
+ The goal is parity, and most of a Unity level crosses. Volumes (grade baked to a LUT, bloom, vignette, DOF,
479
+ motion blur, film grain, lens distortion, chromatic aberration), HDRP SSAO/SSR, lightmaps in every mixed-lighting
480
+ mode, light probes, baked reflection probes, IBL, fog, terrain, Animator state machines, particles, physics and
481
+ the Recast navmesh all carry. The short list that does **not** is the Agent Reference's Unity Authoring Recipes
482
+ §22, each item with a Babylon-side substitute:
483
+ - URP renderer features (SSAO, custom passes);
484
+ - Panini projection and screen-space lens flare;
485
+ - realtime GI and realtime reflection probes;
486
+ - cookies, Timeline, VFX Graph, and trail/line renderers.
453
487
 
454
- The 73-key metadata list **is** the export surface for scene-level look. Anything the target image depends on
455
- that has no key — screen-space reflections, SSGI/SSAO, custom render passes, bespoke volume stacks — does not
456
- survive, and a critic that keeps raising it will name the same gap forever.
488
+ During the interview's target-reachability pass, check the target against that list:
489
+ - Something that can be *approximated* on the BabylonJS side (a baked reflection probe for SSR, a Babylon
490
+ SSAO2 pipeline from a script component for URP SSAO) goes in **Approximable**, with that approach.
491
+ - Only what has no substitute goes in **`OUT OF REACH`**. Critics are instructed not to raise gaps against it.
457
492
 
458
- During the interview's target-reachability pass, walk the target against that key list and record whatever
459
- cannot cross in the loop card's **`OUT OF REACH`** slot. Critics are instructed not to raise gaps against it.
460
- Where an effect can be *approximated* on the BabylonJS side instead (a reflection probe standing in for SSR,
461
- baked contact shadows for SSAO), record that as the approach rather than as out of reach.
493
+ A gap found at a checkpoint that none of this explains is a **toolkit parity gap**. Record it with both frames
494
+ for the toolkit instead of re-authoring the scene around it.
462
495
 
463
496
  > The precise URP/HDRP boundary is worth **measuring on your first real export** rather than assuming. Export
464
497
  > one scene with the effects you care about, dump `scenes[0].extras.metadata`, and record what actually
@@ -487,4 +520,8 @@ baked contact shadows for SSAO), record that as the approach rather than as out
487
520
  | Every scene reference to a model broke | wrote to a new path, or delete-then-recreate | edit in place; never remove the `.meta` |
488
521
  | Model imports at 1/100 scale or on its side | FBX unit mismatch, or a generated asset's orientation | `transform_apply` after fixing scale/rotation |
489
522
  | Unity Hub cannot open the project | copilot mode leaves a resident Editor holding the lock | `bt-stop-editor.sh <ProjectPath>` (§4B.3) |
490
- | `unity command` cannot connect | Safe Mode, or a batch Editor invisible to `status` | `unity pipeline list`; gate on `unity command`, not `unity status` |
523
+ | `unity command` cannot connect | Safe Mode, a sandboxed shell blocking loopback, or several Editors (`AMBIGUOUS_EDITOR`) | `unity pipeline list`; pass `--project-path`; gate on `unity command` |
524
+ | Snapshot shows only the sky | The URP GPU Resident Drawer is on | `RenderPathTools.DisableResidentDrawerReport()` (reloads the scene) — § 1 |
525
+ | A Baked light "missing" from the export | Expected — Baked lights cross as lightmaps + light probes | Nothing to fix; but its **children** were skipped too — never parent under a Baked light |
526
+ | Dynamic objects flat in the browser | No light-probe network: no active `SceneController`, ambient not Skybox, no IBL bake, or no probe group | Fix and re-bake (Recipes §5) |
527
+ | No navigation in the export | Unity's navmesh was baked, not the toolkit Recast surface | Bake `UniRcNavMeshSurface` (Recipes §12) |
@@ -45,7 +45,8 @@ Execution time is mostly *how the work is proven*, not the code. Keep proof stro
45
45
  4. **Named tests** with expected outcomes for every task that has a testable surface. No probe suites, fuzzing or mutation testing unless the risk calls for it.
46
46
  5. **Functional proof by default:** unit tests; for anything on screen, one look per visual phase — the running result in the browser, judged against the spec and DESIGN.md, or beside a reference image when one exists (a mockup, the original site, the Unity view) — on one browser/engine at reduced resolution, with any second engine checked once in the final end-to-end task; cheap value fixtures sampled once from a reference implementation where there is one. Keep Acceptance to what a user of the feature would notice. **Numeric parity gates** (pixel thresholds, repeats, several engines) only under `--parity` / `proof: parity` or when the brief states a number — and then planned to run once per phase (iteration inside the phase uses the quick look), never loosened.
47
47
  6. **Proportional safety.** When the spec requires a safety outcome (nothing unfinished reaches the user's folders, the app keeps working between tasks), pick the cheapest mechanism that achieves it — normally a feature branch, a build output the user's folders do not read, and one copy across at the end after the live check. Version control is the archive. Add staged promotions, per-step archives or hash records only if the brief asks for them by name.
48
- 7. **No ceremony.** No standalone "verification sweep / open the review / final check" tasks, and no ledgers, md5 or environment records, archives, checked-in capture trees, standing evidence suites, doc-integrity registration or staged promotions — unless the brief asks.
48
+ 7. **Minimal exports.** A task's Steps re-export only the Unity project the task tests and only the scenes it works on, and only when the change alters that scene's export. Never write "re-export every scene" or "re-export all projects" for consistency — other scenes pick the change up at their next natural export. Name the scenes explicitly.
49
+ 8. **No ceremony.** No standalone "verification sweep / open the review / final check" tasks, and no ledgers, md5 or environment records, archives, checked-in capture trees, standing evidence suites, doc-integrity registration or staged promotions — unless the brief asks.
49
50
  8. **No brittle pins.** Never pin counts later tasks will change (tests passed, suite sizes, hashes). Say "the named tests pass, no new failures versus the baseline".
50
51
 
51
52
  ## Step 3. Write the plan
@@ -77,21 +78,27 @@ Print `✍️ [bt-plan] Writing _specs/<feature-name>_plan.md …`. The file has
77
78
  - Verify level: standard
78
79
  ```
79
80
 
80
- **`## Estimated execution time`** — **agent time, from the measured rates below — never from how long a developer would take, and never by adding up activities.** Exports, captures and browser looks are *not* separate multi-minute line items: they happen inside a task's own run and are already inside the per-task rate. Counting them separately is how a 10-hour plan gets estimated at 45 hours.
81
+ **`## Estimated execution time`** — **agent time, from the calibration below — never developer-hours, and never by adding up activities.** Builds, exports, captures and browser looks are *not* separate line items: they happen inside a task's own run and are already inside the per-task rate. Counting them separately is how a 10-hour plan gets estimated at 45 hours.
81
82
 
82
- Count only three things:
83
+ `Total ≈ tasks × 17 min + phases × 10 min`, then give a range of **±30 %**. Nothing else is added:
83
84
 
84
- | Unit | Measured agent time |
85
- | --- | --- |
86
- | each task (code + its tests, including any build, export, capture or look it needs) | 15–25 min |
87
- | each phase's independent verifier | 5–15 min |
88
- | each fix-loop round you expect (a task with real unknowns usually needs 1–3) | 15–30 min |
85
+ - **Do not budget fix rounds.** Measured across five completed plans: 4 fix rounds in 63 tasks — about one per 16 tasks. Add one round (20 min) only if the plan names a genuine unknown, and never more than one per plan. Defensively budgeting a round or two per phase was the single largest source of over-estimation.
86
+ - **Do not add a further margin.** The ±30 % is the margin.
87
+ - A task sits near the **top** of the range when it is parity work against a reference, drives two engines, or authors Unity/Blender content; near the **bottom** when it is ordinary code with unit tests. Multiply by ~2 for `proof: parity` only if the plan really carries numeric gates, and by ~2–3 for `bt-execute --strict`.
89
88
 
90
- `Total ≈ tasks × 20 min + phases × 10 min + expected fix rounds × 20 min`, then **+20 %** margin. A task sits at the top of its range — not above it — when it authors Unity/Blender content, rebuilds a native library, or needs a live look. Multiply by ~2 for `proof: parity` (numeric gates and repeat captures), and by ~2–3 for `bt-execute --strict`.
89
+ **Calibration (measured 2026-09-23 from commit + transcript timestamps, five completed plans, 63 tasks, 23 phases, 20.6 h total, 0 deferred):**
91
90
 
92
- **Calibration anchor (2026-09-21, measured from commit and transcript timestamps):** the 27-task, 8-phase `shuriken-particle-system` plan — three Unity projects, nine promotions, a full shader pass, trails, lights, collision and mesh particles — ran in **10 h 02 m** unattended, 0 deferred, 180 tests green. That is 18 min per task including everything, with one phase (T15–T16) taking 146 min because it needed three fix rounds. The formula above predicts 10.3 h for it.
91
+ | Plan | Tasks | Phases | Actual | min/task |
92
+ | --- | --- | --- | --- | --- |
93
+ | auto-exposure-parity | 8 | 3 | 1 h 19 | 9.9 |
94
+ | procedural-skybox | 8 | 3 | 2 h 12 | 16.5 |
95
+ | camera-antialiasing-parity | 11 | 4 | 2 h 56 | 16.0 |
96
+ | camera-antialiasing-taa | 9 | 5 | 4 h 08 | 27.5 |
97
+ | shuriken-particle-system (3 Unity projects, 9 promotions) | 27 | 8 | 9 h 59 | 22.2 |
93
98
 
94
- Write a table `Phase | Tasks | What makes it slow | Estimate`, then one **Total** line in hours (days only if over ~16 h), the `--strict` multiplier, and the biggest uncertainty in one line. If the total lands above ~40 min per task, the estimate is wrong before the plan is: re-check it against the three units above. An estimate, never a pin.
99
+ The formula predicts these within ±25 % except auto-exposure-parity, which came in twice as fast as any formula would guess. Every one of these plans estimated itself **2–4.5× too high**, so distrust a large number before you distrust a small one.
100
+
101
+ Write a table `Phase | Tasks | What makes it slow | Estimate`, then one **Total** line in hours (days only if over ~16 h), the `--strict` multiplier, and the biggest uncertainty in one line. If the total lands above ~30 min per task, the estimate is wrong before the plan is: re-check it. An estimate, never a pin.
95
102
 
96
103
  **`## How to execute this plan`** — this text verbatim:
97
104