@babylonjs-toolkit/agent 1.1.68 → 1.1.69

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.68)
1
+ # Babylon Toolkit Desktop Agent (1.1.69)
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
 
@@ -281,7 +281,7 @@ pair or schedule the bridge.
281
281
  | [`bt-hero`](skills/bt-hero/SKILL.md) | `/bt-hero` | Create smooth cinematic 3D scrolling hero sections. |
282
282
  | [`bt-atlas`](skills/bt-atlas/SKILL.md) | `/bt-atlas` | Generate texture atlas skin variations. |
283
283
  | [`bt-optimize`](skills/bt-optimize/SKILL.md) | `/bt-optimize` | Make an exported Unity scene run fast in the browser: profile the BabylonJS frame (draw calls per pass, lights, shadows, post-processing, resolution, materials, textures), fix the causes on a copy of the scene — runtime lights, shadows, post, exporter settings, static / lightmap / mirrored unlocks — and merge static meshes and LOD groups (packed lightmap UVs, LOD clusters); then re-bake, export and verify frame rate and look against the original. `--no-combine`, `--combine-only`. |
284
- | [`bt-profile`](skills/bt-profile/SKILL.md) | `/bt-profile` | Find and fix what makes a BabylonJS / Babylon Toolkit web game slow: drive the running game in Chrome through a repeatable scenario (a cold load, a level start, a countdown), record the CPU profile, allocations and every frame, map each millisecond to its source line and owner (your code, the toolkit runtime, BabylonJS, Havok, React), then fix the bottlenecks one at a time and re-measure each. Writes `.agents/profile/<slug>/dashboard.html`. `--analyze`, `--snapshots`, `--project`, `--slug`. |
284
+ | [`bt-profile`](skills/bt-profile/SKILL.md) | `/bt-profile` | Find what makes a web app slow and list the fixes (spec them with `/bt-spec`, or apply them with `--auto-fix`) — built for BabylonJS / Babylon Toolkit games, usable on any front end (give it a URL and the project folder): drive the running game in Chrome through a repeatable scenario (a cold load, a level start, a countdown), record the CPU profile, allocations, every frame and every GPU pipeline compile (with `--gpu-cold`, as on a first visit), map each millisecond to its source line and owner (your code, the toolkit runtime, BabylonJS, Havok, React), then list the fixes, or with `--auto-fix` apply them one at a time and re-measure each. Writes `.agents/profile/<slug>/dashboard.html` (live progress, Print / Download PDF) and a spec-ready `findings.md`. `--auto-fix`, `--snapshots`, `--watch`, `--gpu-cold`, `--stop`, `--resume`, `--restart`, `--project`, `--slug`. |
285
285
 
286
286
  Every tool derives the slash-command from the **folder name** (`bt-spec/` → `/bt-spec`) and reads
287
287
  the frontmatter `name` + `description` to decide when the skill applies. The `allowed-tools`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.1.68",
3
+ "version": "1.1.69",
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,6 +42,13 @@ Interpret creatively and make unexpected choices that feel genuinely designed fo
42
42
 
43
43
  **CODE QUALITY is not traded for visual ambition.** Every component, style and script follows the Agent Reference's **Coding Practices — ENFORCED**: clean, professional TypeScript or JavaScript in the project's own language; meaningful full-word names for components, props, state, variables, functions and CSS classes (never one- or two-letter names or obfuscation); well-structured code a human developer can read and maintain; and meaningful JSDoc on every component, hook, function and exported member (always written, but never a reason to fail a test or verification). Elaborate effects are split into well-named components and hooks, not packed into one dense file. Before finishing, re-read every file you created or changed against those rules and fix every violation.
44
44
 
45
+ **LIVE HUD VALUES are ENFORCED — a beautiful HUD that re-renders every frame is not finished.** Follow the Agent Reference's **Game UI Performance — ENFORCED** and `ui-design-system.md` › **Live HUD Values — ENFORCED** in every HUD, gauge, timer, bar and overlay you design or build:
46
+ - **Classify every HUD value.** *State* changes on discrete events (screens, pause, gear, lap, position, score, health after a hit) and lives in React. *Telemetry* changes every frame (speed, RPM, needles, arcs, timers, boost / health / charge bars, minimap markers) and **never touches React state, props, context, a store or a per-frame EventBus message**.
47
+ - **Render once, then write through refs.** Static furniture (ticks, numerals, bezels, frames, labels) is memoized or static SVG / CSS. One `useFrameLoop` per HUD reads the game (`GameManager.GlobalState`, component getters) and writes only what changed: `textContent` for numbers, `transform` for needles and markers, `scaleX` for bars, `stroke-dashoffset` on a full arc drawn once for rings and sweeps, `opacity` for fades, `classList.toggle` for state styles.
48
+ - **Never per frame:** `width` / `height` / `top` / `left`, `innerHTML`, SVG geometry (`d`, `points`), layout reads, allocations.
49
+ - **Design for it.** Prefer looks that animate with transforms, opacity and dash offsets (rotating needles, scaling fills, sweeping dashes) over looks that need geometry rebuilt every frame.
50
+ - **Before finishing**, search the HUD files for state setters, `dispatch(`, store updates and `EventBus.PostMessage(` inside `requestAnimationFrame`, `useFrameLoop`, render observables and `update()`; any hit is a violation to fix.
51
+
45
52
  **IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
46
53
 
47
54
  Remember: You are capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
@@ -295,19 +295,32 @@ export function initHeroScroll(root = document, userConfig = {}) {
295
295
  let lastP = 0;
296
296
  let journeyTop = 0;
297
297
  let journeyScroll = 1;
298
+ // Layout is read here, on load and resize — never in the frame loop, where a read after a style write
299
+ // forces a synchronous layout every frame (Agent Reference › Live HUD Values — ENFORCED).
300
+ let journeyHeight = 0;
301
+ let viewportHeight = 0;
302
+ let frameEndY = 0;
303
+
304
+ /** Writes text into an element only when it differs from what is shown. */
305
+ function writeText(element, text) {
306
+ if (element && element.textContent !== text) element.textContent = text;
307
+ }
298
308
  let frameRaf = null;
299
309
 
300
310
  function measure() {
301
311
  const sTop = isDocScroller ? 0 : scroller.getBoundingClientRect().top;
302
312
  journeyTop = journey.getBoundingClientRect().top - sTop + getY();
303
- journeyScroll = Math.max(1, journey.offsetHeight - viewportH());
313
+ journeyHeight = journey.offsetHeight;
314
+ viewportHeight = viewportH();
315
+ journeyScroll = Math.max(1, journeyHeight - viewportHeight);
316
+ frameEndY = endY();
304
317
  }
305
318
 
306
319
  // where PLAY/END consider "the end": journey end (sweep:"hero") or
307
320
  // document bottom (sweep:"page")
308
321
  const endY = () =>
309
322
  CFG.sweep === "hero"
310
- ? journeyTop + journey.offsetHeight - viewportH()
323
+ ? journeyTop + journeyHeight - viewportHeight
311
324
  : maxY();
312
325
 
313
326
  function frame() {
@@ -329,25 +342,23 @@ export function initHeroScroll(root = document, userConfig = {}) {
329
342
  lastP = smoothP;
330
343
 
331
344
  if (hud) {
332
- if (hudValue) hudValue.textContent = Math.round(valueAt(smoothP));
345
+ writeText(hudValue, String(Math.round(valueAt(smoothP))));
333
346
  if (hudProgress)
334
347
  hudProgress.style.transform = `scaleX(${smoothP.toFixed(4)})`;
335
- if (hudPct)
336
- hudPct.textContent =
337
- String(Math.round(smoothP * 100)).padStart(3, "0") + "%";
348
+ writeText(hudPct, String(Math.round(smoothP * 100)).padStart(3, "0") + "%");
338
349
  if (hudSeg && TEL && TEL.segments) {
339
350
  let seg = TEL.segments[0][1];
340
351
  for (const [at, label] of TEL.segments) if (smoothP >= at) seg = label;
341
- hudSeg.textContent = seg;
352
+ writeText(hudSeg, seg);
342
353
  }
343
354
  hud.classList.toggle(
344
355
  "hs-hud-off",
345
- getY() > journeyTop + journey.offsetHeight - viewportH() * 0.55
356
+ getY() > journeyTop + journeyHeight - viewportHeight * 0.55
346
357
  );
347
358
  }
348
359
 
349
360
  if (gotoTop) gotoTop.classList.toggle("hs-nav-dim", getY() < 4);
350
- if (gotoEnd) gotoEnd.classList.toggle("hs-nav-dim", getY() >= endY() - 4);
361
+ if (gotoEnd) gotoEnd.classList.toggle("hs-nav-dim", getY() >= frameEndY - 4);
351
362
 
352
363
  for (const o of overlays) styleOverlay(o, smoothP);
353
364
 
@@ -509,6 +520,12 @@ export function initHeroScroll(root = document, userConfig = {}) {
509
520
  // (element scroll doesn't bubble to window; capture on document catches it).
510
521
  const onResize = () => measure();
511
522
  on(window, "resize", onResize);
523
+ // Content that grows after load (images, fonts) changes the page height without a window resize.
524
+ const sizeWatcher = typeof ResizeObserver === "function" ? new ResizeObserver(onResize) : null;
525
+ if (sizeWatcher) {
526
+ sizeWatcher.observe(journey);
527
+ for (const child of (isDocScroller ? document.body : scroller).children) sizeWatcher.observe(child);
528
+ }
512
529
 
513
530
  /* ── go ────────────────────────────────────────────────────────── */
514
531
 
@@ -527,6 +544,7 @@ export function initHeroScroll(root = document, userConfig = {}) {
527
544
  timers.clear();
528
545
  for (const [target, ev, fn, opts] of bound)
529
546
  target.removeEventListener(ev, fn, opts);
547
+ if (sizeWatcher) sizeWatcher.disconnect();
530
548
  if (veil.parentNode) veil.parentNode.removeChild(veil);
531
549
  if (objectUrl) URL.revokeObjectURL(objectUrl);
532
550
  delete document.body.dataset.hsState;
@@ -48,13 +48,13 @@ Run tasks from a plan: build each one with its tests, have an independent verifi
48
48
 
49
49
  Work in **phases**: a `### Phase N` group in the plan, or — if the plan has none — up to 3 consecutive tasks (a `live` task, the `Update SPEC.md` task and the last task each close a group). A single task or `NEXT` is a phase of one. Under `--strict` every task is its own phase.
50
50
 
51
- 1. **Build** each task in the phase, in order, **following the Agent Reference's Coding Practices — ENFORCED** (clean, professional TypeScript or JavaScript in the project's own language; meaningful full-word names, never one- or two-letter names or obfuscation; well-structured, readable, maintainable code for human developers; meaningful JSDoc on every class, function, method and public member — always written, never a reason to fail a task), **with its tests**: the cases the plan's `Tests:` names (or, with none, meaningful cases for its Acceptance and edge cases), in the feature folder's `tests/` (`.agents/specs/<slug>/tests/` — never a root `tests/` folder), using the repo's test runner and style. Get them green — fix the code, not the test, unless the test is wrong. No testable surface (config, docs, assets) → say so. A task with visible output also **saves its progression snapshots** as it builds (*Snapshots tell the story*, below). The implementer keeps the **dashboard current task by task** — the live file at every step, the task's entry at start and the moment it is built — so the user never waits for the phase to end to see progress. Boxes stay unticked.
51
+ 1. **Build** each task in the phase, in order, **following the Agent Reference's Coding Practices — ENFORCED** (clean, professional TypeScript or JavaScript in the project's own language; meaningful full-word names, never one- or two-letter names or obfuscation; well-structured, readable, maintainable code for human developers; meaningful JSDoc on every class, function, method and public member — always written, never a reason to fail a task), and every HUD or overlay **following Game UI Performance — ENFORCED** (per-frame values reach the screen through refs and one frame loop, never React state, props, a store or a per-frame EventBus message; only changed values written, with cheap properties), **with its tests**: the cases the plan's `Tests:` names (or, with none, meaningful cases for its Acceptance and edge cases), in the feature folder's `tests/` (`.agents/specs/<slug>/tests/` — never a root `tests/` folder), using the repo's test runner and style. Get them green — fix the code, not the test, unless the test is wrong. No testable surface (config, docs, assets) → say so. A task with visible output also **saves its progression snapshots** as it builds (*Snapshots tell the story*, below). The implementer keeps the **dashboard current task by task** — the live file at every step, the task's entry at start and the moment it is built — so the user never waits for the phase to end to see progress. Boxes stay unticked.
52
52
  2. **Verify** the phase with a fresh **independent verifier** subagent (charter below), giving it the list of files changed. It returns PASS/FAIL per task, with evidence, and marks each task `verifying` on the dashboard (and the live file) as it checks it.
53
53
  3. **Tick** `- [ ]` → `- [x]` for every task that passed, immediately — except a task that depends on one that failed in the same phase, which waits for it. Never tick partial, skipped or unverified work. Mark each ticked task `done` on the dashboard as you tick it, then write the phase's dashboard entry before its commit.
54
54
  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)*.
55
55
  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)`), the dashboard path (`.agents/specs/<slug>/dashboard.html` — open it in a browser), and the next task id — for reference only.
56
56
 
57
- **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. Check every code file the task created or changed against the Agent Reference's Coding Practices — ENFORCED: clean, professional TypeScript or JavaScript in the language the project already uses (never converted to the other unasked); strict types with no needless `any` in TypeScript; meaningful full-word names for every class, method, property, variable and parameter (one- or two-letter names, cryptic abbreviations and code-golf tricks are violations, except the allowed loop counters, axis/`uv` names and toolkit aliases, and names that bind to exported data); no dead code, unused imports or leftover `console.log`; well-structured code a developer new to the project can read and maintain. Any violation is a FAIL for that task — quote the offending lines. JSDoc is never a FAIL: missing, thin or stale JSDoc (including JavaScript type tags) never fails a test, a verification or an Acceptance item — list it under a separate non-blocking `JSDoc notes` heading. 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. Save the frames from your live session that show each visual task's verified result to `[SNAPSHOTS]` as `T<n>-<NN>-<stage>.png` — the same camera or viewport as the implementer's progression frames, plus any angle or comparison (Unity beside browser, before beside after) that proves the Acceptance — and return each path with a one-line caption saying what it shows. Snapshots never add a page session or an export of their own. Keep the dashboard current as you go: set each task `verifying` when you start checking it, and rewrite the live file at each check (what you are checking, on what) — never 15 minutes without a write. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence and one line on what you ran live and where (or `none — tests only`), listing records-only slips separately."*
57
+ **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. Check every code file the task created or changed against the Agent Reference's Coding Practices — ENFORCED: clean, professional TypeScript or JavaScript in the language the project already uses (never converted to the other unasked); strict types with no needless `any` in TypeScript; meaningful full-word names for every class, method, property, variable and parameter (one- or two-letter names, cryptic abbreviations and code-golf tricks are violations, except the allowed loop counters, axis/`uv` names and toolkit aliases, and names that bind to exported data); no dead code, unused imports or leftover `console.log`; well-structured code a developer new to the project can read and maintain. Any violation is a FAIL for that task — quote the offending lines. Check every HUD, overlay or GUI file the task created or changed against the Agent Reference's Game UI Performance — ENFORCED: a value that changes every frame (speed, RPM, needles, timers, bars, markers) set through React state, props, context or a store, or posted on the EventBus per frame; a state setter, `dispatch(`, store update or `EventBus.PostMessage(` inside `requestAnimationFrame`, a frame-loop hook, a render observable or a component's `update()`; `width` / `height` / `top` / `left` / `innerHTML` / SVG geometry written per frame, or layout read in the loop; a Babylon GUI control assigned every frame without a changed-value check. Any of these is a FAIL for that task — quote the offending lines. JSDoc is never a FAIL: missing, thin or stale JSDoc (including JavaScript type tags) never fails a test, a verification or an Acceptance item — list it under a separate non-blocking `JSDoc notes` heading. 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. Save the frames from your live session that show each visual task's verified result to `[SNAPSHOTS]` as `T<n>-<NN>-<stage>.png` — the same camera or viewport as the implementer's progression frames, plus any angle or comparison (Unity beside browser, before beside after) that proves the Acceptance — and return each path with a one-line caption saying what it shows. Snapshots never add a page session or an export of their own. Keep the dashboard current as you go: set each task `verifying` when you start checking it, and rewrite the live file at each check (what you are checking, on what) — never 15 minutes without a write. Treat an absolute count in the plan as 'named tests pass, no new failures'. [SCOPE] Return PASS/FAIL per task with evidence and one line on what you ran live and where (or `none — tests only`), listing records-only slips separately."*
58
58
 
59
59
  `[SNAPSHOTS]` is the feature folder's `snapshots/` path (`.agents/specs/<slug>/snapshots/`). `[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."*
60
60
 
@@ -101,6 +101,7 @@ threshold AND every gate passes.**
101
101
  | **Console** | any error in the browser console (warnings are reported, not fatal, unless the card says otherwise) |
102
102
  | **Component authority** | a protected `TOOLKIT.*` component was reimplemented, bypassed or deleted without the full replacement-evidence checklist in the round journal |
103
103
  | **Coding practices** | any code the round created or changed breaks the Agent Reference's **Coding Practices — ENFORCED**: TypeScript or JavaScript that is not clean and professional (needless `any` or loose typing, code converted to the other language unasked), one- or two-letter or obfuscated names (outside the allowed loop counters, axis/`uv` names, toolkit aliases and names that bind to exported data), dead code or leftover `console.log`, or code a developer new to the project could not read and maintain. **JSDoc never fails this gate**: list missing or thin JSDoc as a low-priority entry in the gap list. Quote the offending lines |
104
+ | **Game UI performance** | any HUD, overlay or GUI the round created or changed breaks the Agent Reference's **Game UI Performance — ENFORCED**: a per-frame value (speed, RPM, needles, timers, bars, markers) set through React state, props, context or a store, or posted on the EventBus per frame; a state setter, `dispatch(` or `EventBus.PostMessage(` inside `requestAnimationFrame`, a frame-loop hook, a render observable or `update()`; `width` / `height` / `top` / `left` / `innerHTML` / SVG geometry written per frame or layout read in the loop; a Babylon GUI control assigned every frame without a changed-value check. Quote the offending lines |
104
105
  | **Camera lock** | the evidence was not captured from the transform recorded in `cameras.md` |
105
106
  | **Pipeline gate** | whatever the deliverable kind's pipeline reference declares (export-boundary integrity, GUID survival, licence tier …) |
106
107
 
@@ -52,7 +52,7 @@ Execution time is mostly *how the work is proven*, not the code. Keep proof stro
52
52
  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.
53
53
  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.
54
54
  9. **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".
55
- 10. **Plan code follows the Agent Reference's Coding Practices — ENFORCED.** Every snippet, signature, interface, class, method, property, variable, constant and file name the plan writes or decides is clean, professional TypeScript or JavaScript in the language the project uses (never switched unasked), with meaningful full-word names (never one- or two-letter names, cryptic abbreviations or code-golf tricks), well structured, readable and maintainable by human developers, and carries meaningful JSDoc on every class, function, method, interface and public member it defines. JSDoc is always written but never a gate: never write an Acceptance item, Test or Verify step that fails on missing JSDoc. The executor copies plan code word for word, so a badly named snippet ships badly named. Names that bind to exported data (component properties, serialized fields, Unity property names) keep the source's names. Code-quality checks are never a separate task; bt-execute's verifier enforces them on every task.
55
+ 10. **Plan code follows the Agent Reference's Coding Practices — ENFORCED.** Every snippet, signature, interface, class, method, property, variable, constant and file name the plan writes or decides is clean, professional TypeScript or JavaScript in the language the project uses (never switched unasked), with meaningful full-word names (never one- or two-letter names, cryptic abbreviations or code-golf tricks), well structured, readable and maintainable by human developers, and carries meaningful JSDoc on every class, function, method, interface and public member it defines. JSDoc is always written but never a gate: never write an Acceptance item, Test or Verify step that fails on missing JSDoc. The executor copies plan code word for word, so a badly named snippet ships badly named. Names that bind to exported data (component properties, serialized fields, Unity property names) keep the source's names. Plan UI code also follows **Game UI Performance — ENFORCED**: every HUD value the plan introduces is classified as *state* (React, set on events) or *telemetry* (refs and one frame loop, never React state or a per-frame EventBus message), and the plan's snippets show telemetry that way. Code-quality checks are never a separate task; bt-execute's verifier enforces them on every task.
56
56
 
57
57
  ## Step 3. Write the plan
58
58
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: bt-profile
3
- description: "The Babylon Toolkit Profile Skill finds and fixes what makes a BabylonJS / Babylon Toolkit web game slow. It drives the running game in a real Chrome over the DevTools protocol through a repeatable scenario (a cold load, a level start, a countdown, a boss fight), records a full CPU profile, per-phase allocation profiles, every frame's CPU work and Babylon timers, and maps every sampled millisecond back to the original source line and its owner — your game code, a project-owned script bundle (e.g. the Unity exporter's project bundle), the Babylon Toolkit runtime, BabylonJS, Havok, shader translation, React, the browser. It charges library work to the code of yours that triggered it, splits everything by phase and by second, then diagnoses each bottleneck, fixes it one at a time, re-measures the same scenario to prove the gain (reverting anything that does not help), and writes a code-dashboard report to `.agents/profile/<slug>/dashboard.html` (everything the slug's runs produced sits beside it in `.agents/profile/<slug>/data/`). Use when the user says the game is slow, stutters, crawls at a moment (load, start, many particles), or wants a performance analysis (e.g. `/bt-profile the race start crawls for a minute`, `/bt-profile --analyze`, `/bt-profile http://localhost:5173/play --scenario level-start`)."
3
+ description: "The Babylon Toolkit Profile Skill finds what makes a web app slow and lists the fixes (applying them one at a time with --auto-fix) — built for BabylonJS / Babylon Toolkit games, and just as usable on any front end with no Babylon in it (point it at a URL and the project folder). It drives the running game in a real Chrome over the DevTools protocol through a repeatable scenario (a cold load, a level start, a countdown, a boss fight), records a full CPU profile, per-phase allocation profiles, every frame's CPU work and Babylon timers, and maps every sampled millisecond back to the original source line and its owner — your game code, a project-owned script bundle (e.g. the Unity exporter's project bundle), the Babylon Toolkit runtime, BabylonJS, Havok, shader translation, React, the browser. It charges library work to the code of yours that triggered it, splits everything by phase and by second, then diagnoses each bottleneck and lists the fixes — each with its expected gain and risk, ready to spec one by one or as a group with bt-spec — and, with --auto-fix, applies them one at a time, re-measuring the same scenario to prove each gain (reverting anything that does not help), and writes a code-dashboard report to `.agents/profile/<slug>/dashboard.html` (everything the slug's runs produced sits beside it in `.agents/profile/<slug>/data/`). Use when the user says the game is slow, stutters, crawls at a moment (load, start, many particles), or wants a performance analysis (e.g. `/bt-profile the race start crawls for a minute`, `/bt-profile --auto-fix the race start crawls`, `/bt-profile http://localhost:5173/play --scenario level-start`)."
4
4
  allowed-tools: Read, Grep, Glob, Edit, Write, Bash
5
5
  ---
6
6
 
7
- You are an EXPERT BabylonJS, Babylon Toolkit and browser performance engineer. Always adhere to any rules or requirements set out in the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md).
7
+ You are an EXPERT BabylonJS, Babylon Toolkit and browser performance engineer. The skill is built for Babylon Toolkit projects but profiles **any web app**: a page with no Babylon engine gets everything except the engine-only numbers (see *Any web app*). Always adhere to any rules or requirements set out in the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md).
8
8
 
9
9
  Use the user's message after the skill name as the `arguments`.
10
10
 
@@ -14,17 +14,23 @@ Use the user's message after the skill name as the `arguments`.
14
14
 
15
15
  ```
16
16
  /bt-profile [<brief: what is slow, when>] [--project:<path>] [--url:<game URL>] [--scenario:<name|path>] [--slug:<name>]
17
- [--analyze] [--snapshots] [--no-warm] [--settle:<seconds>] [--runs:<n>] [--trace]
17
+ [--auto-fix] [--snapshots] [--watch] [--gpu-cold] [--no-warm] [--settle:<seconds>] [--runs:<n>] [--trace]
18
+ [--stop[:<slug>]] [--resume[:<slug>]] [--restart[:<slug>]]
18
19
  [--max-fixes:<n>] [--target-fps:<n>] [--dpr:<n>] [--args:key=value,…]
19
20
  ```
20
21
 
21
22
  - **`<brief>`** — the user's words about the slowdown ("the race start crawls for a minute", "stutters when particles spawn"). It decides the scenario and which phases matter most.
22
23
  - **`--project:`** — the web project to profile: its folder, or any folder or file inside it (absolute, `~/…`, or relative to the working directory). Default: the working directory's project (see **Which project** below).
23
- - **`--url:`** — the page that runs the game. Default: `profile.config.json` → `url`, else the dev server's `/play` (or `/`).
24
+ - **`--url:`** — the page the scenario opens. Default: `profile.config.json` → `url`, else the page a player opens first on the dev server (usually `/`) — the scenario then clicks through to the slow moment the way a player does.
24
25
  - **`--scenario:`** — the slug's `data/scenario.mjs`, or a path to copy into it. Default: the slug's own; with none, write one (Phase 0).
25
26
  - **`--slug:`** — the profiled moment, and its folder: `.agents/profile/<slug>/` holds `dashboard.html` and `data/` (config, scenario, findings, runs, logs). Default: the scenario's name (e.g. `race-start`). A new moment gets a new slug; never mix two scenarios' runs in one slug.
26
- - **`--analyze`** — measure, diagnose and report only. Changes no code.
27
+ - **`--auto-fix`** — also apply the fixes: one at a time, each re-measured and kept only when it wins (Phase 3). **Off by default**: a plain run measures and diagnoses, changes no code, and lists every fix. Either way the report has **The fixes** — every fix with its status, expected gain and risk — so the user can spec them one by one or as a group with `bt-spec` (the dashboard copies the command; `findings.md` beside it carries each fix's cause, evidence, code, proposed change, gain, risk and how to verify it). `--no-fix` / `--analyze` from earlier versions mean the default.
28
+ - **`--stop[:<slug>]`** — stop a running profile: ends its capture and Chrome (`progress.mjs stop`), marks the run stopped on the dashboard, rebuilds the report from what was captured. Without a slug: the one running profile in the project (ask when there are several).
29
+ - **`--resume[:<slug>]`** — continue a stopped profile where it stopped (`progress.mjs resume` prints the stage and the fixes' states): skip what is done, re-measure a fix left half-way, carry on. The dashboard shows it as the next run number.
30
+ - **`--restart[:<slug>]`** — profile the slug again from a fresh baseline with the same config and scenario (after code changes, a stopped run you do not want to continue, or a finished one): `progress.mjs restart` moves the earlier runs, findings and report to `data/archive/<date-time>/` — compare with them in the new report.
27
31
  - **`--snapshots`** — phase screenshots plus a filmstrip (about one small frame per second, lined up under the frame-rate chart), and the before/after look comparison. **Off by default**: a full-size screenshot stalls the game for a moment and would show up in the very profile it explains. Turn it on for the visual verification runs, or whenever the user asks.
32
+ - **`--watch`** — show the Chrome window while the profile runs, so the user can see every capture as it happens (passes `--watch true` to every `profile.mjs` run). Off by default: headless captures are the steadiest. A watched window measures like a real browser (vsync, compositing), so compare watched runs with watched runs; tell the user to keep the window uncovered and not to click or type in it unless the scenario hands them the controls.
33
+ - **`--gpu-cold`** — make every capture a true first visit for the GPU (passes `--gpu-cold true` to `profile.mjs`): each fragment shader gets a never-taken branch unique to the load, so no compiled pipeline from an earlier visit is reused. A fresh Chrome profile alone is only browser-cold — on macOS the compiled Metal pipelines live in a system cache outside it, so without this only the first capture after a shader change is GPU-cold. Use it whenever the complaint is about a first load, a cold start, or a stutter that "only happens the first time". Nothing on disk is touched.
28
34
  - **`--no-warm`** — skip the second, warm load in the same browser (on by default for the baseline: cold vs warm separates first-use costs from steady per-frame work).
29
35
  - **`--settle:`** — seconds recorded after the scenario's main event (passed to the scenario as `--args settle=`).
30
36
  - **`--runs:`** — baseline captures used to measure run-to-run noise (default 2).
@@ -38,35 +44,38 @@ Use the user's message after the skill name as the `arguments`.
38
44
  # What this skill guarantees
39
45
 
40
46
  1. **Measured, never guessed.** Every finding cites the profile: the function, its owner, its ms per frame, the phase, and the code of yours behind it. No fix is made on a hunch.
41
- 2. **One fix at a time, proven.** Each fix is re-measured with the same scenario; it is kept only when its target cost falls and the phase it serves gets faster beyond the measured noise. Otherwise it is reverted, and the report says so.
47
+ 2. **Fixes are listed; applied only with `--auto-fix`, one at a time, proven.** Each applied fix is re-measured with the same scenario; it is kept only when its target cost falls and the phase it serves gets faster beyond the measured noise. Otherwise it is reverted, and the report says so.
42
48
  3. **The user's work is safe.** Uncommitted changes in the working tree are recorded first and never reverted, stashed or committed. Fixes are made as small, reviewable edits; the report carries each diff. Nothing is committed unless the user asks.
43
49
  4. **It still works and looks the same.** After the fixes: typecheck / build, the project's tests, a clean console, and (`--snapshots`) the same phases screenshotted before and after.
44
50
  5. **Libraries are not patched.** BabylonJS, Havok, React and other node_modules code is never edited. When the time is spent inside a library, the fix changes how your code uses it (call it less, on less, configure it, cache, freeze, pool) — or, for a toolkit / engine defect, the report states it with evidence for its owner.
45
51
 
46
52
  # Talk to the user while you work
47
53
 
48
- Long runs lose people. At every phase change, post one short plain-language update: **Done** (with numbers) · **Doing now** · **Next**. When a finding is confirmed, say it in one sentence a non-specialist understands ("Physics copies every body's position back every step — 7 ms of each frame").
54
+ Long runs lose people. At every phase change, post one short plain-language update: **Done** (with numbers) · **Doing now** · **Next**. **In chat too, never go more than about 5 minutes without a message** while working: before starting anything in the background, say what it is and how long it takes; when it finishes, say what it showed before moving on; when the user writes mid-run, answer them first. A silent agent looks stuck. When a finding is confirmed, say it in one sentence a non-specialist understands ("Physics copies every body's position back every step — 7 ms of each frame").
49
55
 
50
56
  # Live progress — the dashboard follows the run
51
57
 
52
- The user watches `dashboard.html` while the profile runs, not only after it. From the run's first minute the page shows **what is happening right now**, the stages (Preflight → Baseline → Diagnose → Fix → Verify → Report), every fix with its status and before → after, and the numbers so far; it checks for changes every 10 s and, when the run ends, reloads into the finished report (where the run folds into a *How this profile ran* summary). All of it comes from `data/progress.js`, which **only `progress.mjs` writes** — never edit it by hand:
58
+ The user watches `dashboard.html` while the profile runs, not only after it. From the run's first minute the page shows **what is happening right now**, the stages (Preflight → Baseline → Diagnose → Fix → Verify → Report), every fix with its status and before → after, and the numbers so far; **while a run is going the page shows its progress only — the findings, charts and tables stay hidden (and Print / Download PDF with them) until it ends**; it checks for changes every 10 s and, when the run ends, reloads into the finished report (where the run folds into a *How this profile ran* summary). All of it comes from `data/progress.js`, which **only `progress.mjs` writes** — never edit it by hand:
53
59
 
54
60
  ```bash
55
- P="node $TOOLS/progress.mjs"; S="$PROF/$SLUG" # S is the slug folder (it holds dashboard.html and data/)
56
- $P start "$S" --title "<Project> — <scenario> performance" --brief "<the user's words>" --project "$PROJ" --url "<url>" [--mode analyze]
57
- $P stage "$S" baseline [--note "2 cold captures + 1 warm, 90 s settle"] # starting a stage finishes the one before
58
- $P now "$S" "Capturing baseline 1 of 2 — about 3 min" # what is happening this minute
59
- $P metric "$S" "Race start FPS" "24" --note "baseline · target 60"
60
- $P fix "$S" F1 --title "Stop forced world-matrix recomputes" --status trying # then measuring → kept | reverted
61
- $P fix "$S" F1 --status kept --before "24 fps" --after "41 fps" --note "−14 ms/frame in the countdown"
62
- $P note "$S" "Noise floor ±1.8 fps — a fix must beat it" # a milestone
63
- $P end "$S" --summary "<the verdict in one sentence>" # or --status stopped|failed with why
61
+ node "$TOOLS/progress.mjs" start "$S" --title "<Project> — <scenario> performance" --brief "<the user's words>" --project "$PROJ" --url "<url>" --open true [--mode auto-fix]
62
+ node "$TOOLS/progress.mjs" set "$S" --url "<url>" # details found after start (the URL, once the code is read)
63
+ node "$TOOLS/progress.mjs" stage "$S" baseline --note "2 cold captures + 1 warm, 90 s settle" # starting a stage finishes the one before
64
+ node "$TOOLS/progress.mjs" now "$S" "Capturing baseline 1 of 2 — about 3 min" # what is happening this minute
65
+ node "$TOOLS/progress.mjs" metric "$S" "Race start FPS" "24" --note "baseline · target 60"
66
+ node "$TOOLS/progress.mjs" fix "$S" F1 --title "Stop forced world-matrix recomputes" --status trying # then measuring → kept | reverted
67
+ node "$TOOLS/progress.mjs" fix "$S" F1 --status kept --before "24 fps" --after "41 fps" --note "−14 ms/frame in the countdown"
68
+ node "$TOOLS/progress.mjs" note "$S" "Noise floor ±1.8 fps — a fix must beat it" # a milestone
69
+ node "$TOOLS/progress.mjs" end "$S" --summary "<the verdict in one sentence>" # or --status stopped|failed with why
64
70
  ```
65
71
 
66
- - **Open the run before anything else** (the first lines of Phase 0): `start`, then the watchdog in the background — `node "$TOOLS/progress.mjs" watch "$S" --watch "$PROJ/src" > "$DATA/logs/watchdog.log" 2>&1 &` (add `--watch` for every other folder the fixes touch: a runtime, a Unity project's scripts). `start` writes a live page when the slug has no dashboard yet, and keeps an older report that has no panel in `data/previous-dashboard.html`.
67
- - **Write before every long command, never after only.** A capture, an analysis, a build or a test run gets a `now` line first that says what it is and roughly how long it takes; the result gets the next one. Never let 10 minutes pass without a write. The watchdog covers a silent stretch — after 5 quiet minutes it posts a heartbeat naming the newest file and the newest capture log's last line, after 30 without any file change it warns of a stall — but it is the backstop, not the narrator.
72
+ - **Write every command out in full** as above — never through a variable that holds a command (`P="node …"; $P now …`): zsh, the macOS default shell, does not split it into words, the command fails, and an `&&` chain behind it silently skips the capture. `$TOOLS`, `$S` and the other names in this skill are shorthand for absolute paths: most agent shells keep no variables between commands, so write the paths out (or set the variables at the top of the same command).
73
+ - **Open the run before anything else** (the first lines of Phase 0): `start --open true` (it opens the dashboard in the browser once; the page reloads itself from then on), then the watchdog in the background — `node "$TOOLS/progress.mjs" watch "$S" --watch "$PROJ/src" > "$DATA/logs/watchdog.log" 2>&1 &` (add `--watch` for every other folder the fixes touch: a runtime, a Unity project's scripts). `start` writes a live page when the slug has no dashboard yet, and keeps an older report that has no panel in `data/previous-dashboard.html`. Without `--auto-fix`, the Fix and Verify stages start out skipped.
74
+ - **Write before every long command, never after only.** A capture, an analysis, a build or a test run gets a `now` line first that says what it is and roughly how long it takes; the result gets the next one. **Never let 5 minutes pass without a write during active work** — reading code, diagnosing, drilling, editing, waiting on a background command and checking its output all count as active work, and each gets its own `now` line. The run is not over until `end`: keep writing between the last capture and the report, and after it until `end`. The watchdog covers a silent stretch — after 5 quiet minutes it posts a heartbeat naming the newest file and the newest capture log's last line, after 30 without any file change it warns of a stall — but it is the backstop, not the narrator.
68
75
  - **`stage`** at every phase change, **`metric`** for the figures the user cares about as soon as they are known (the brief's phases' FPS and CPU ms/frame, the noise floor, the target, the best so far — update the same label as they move), **`fix`** at every step of the fix loop: `planned` when diagnosed, `trying` while editing, `measuring` while re-capturing, then `kept` or `reverted` with before → after.
69
76
  - **Plain language** a non-specialist follows: "Re-measuring the race start with the particle fix", not "runs/fix-3 cold".
77
+ - **Waiting on a background capture** counts as active work: poll its log with a bounded loop (`until grep -qE '"runDir"|failed|Error' "$DATA/logs/<run>.log"; do sleep 5; done`, with a timeout on the command) rather than one long `sleep`, and write a `now` line at least every 5 minutes while it runs. A capture that ends in `scenario failed` or `--seconds` logs its failure evidence (see Phase 0 › Smoke run) — read it before trying again.
78
+ - **Auto-update** is always on. The page's `Auto-update on / off` button (top right of the panel) is built but hidden for now — `SHOW_LIVE_TOGGLE` in `scripts/lib/progress-panel.mjs` shows it again.
70
79
  - **End the run every time** — `end` after the report is written, or `end --status stopped|failed --summary "<why>"` when it cannot finish; a run left `running` keeps the page in live mode (the watchdog exits on its own after 12 hours).
71
80
  - Subagents that capture or fix get these commands and the slug folder, and write their own `now` lines.
72
81
 
@@ -78,7 +87,7 @@ $P end "$S" --summary "<the verdict in one sentence>" #
78
87
 
79
88
  | Tool | Does |
80
89
  |---|---|
81
- | `profile.mjs` | Launches Chrome (GPU on, fresh profile = cold caches), runs the scenario, records the V8 CPU profile, per-phase allocation profiles, the in-page probe (every frame's CPU work, draws, particles, SceneInstrumentation timers, scene counters, compiled shader count, long animation frames, phase marks), and the source + source map of every sampled script. `--warm true` repeats the scenario in the same browser. `--snapshots true` adds screenshots and the filmstrip |
90
+ | `profile.mjs` | Launches Chrome (GPU on, fresh profile = cold HTTP and browser caches), runs the scenario, records the V8 CPU profile, per-phase allocation profiles, the in-page probe (every frame's CPU work, draws, particles, SceneInstrumentation timers, scene counters, compiled shader count, every shader module / pipeline / program the page creates with its time, long animation frames, phase marks), and the source + source map of every sampled script. `--warm true` repeats the scenario in the same browser. `--snapshots true` adds screenshots and the filmstrip. `--gpu-cold true` makes the GPU compile every pipeline fresh. A failed or overrun scenario still ends the capture, with `shots/failed.png` and the page's address, title and console errors in the log |
82
91
  | `analyze.mjs` | (`--drill "Class.fn,…"` breaks a function's time into its direct callees, per phase — use it on every heavy library function before deciding what to change.) Maps every sample to its original file / line / class (source maps, then class-span scan of the script, then the config's `sourceRoots` for bundles without maps), assigns owners, charges library time to the nearest code of yours (the render loop is a frame driver and never takes the blame), and writes `analysis.json`: per phase, per second, per function (self, inclusive, callers, "your code behind it"), allocations, worst frames, hot lines, code excerpts. Prints a summary to read |
83
92
  | `compare.mjs` | Before → after per phase, owner and function, for the fix loop |
84
93
  | `report.mjs` | Builds the dashboard HTML from an analysis, an optional baseline and warm analysis, and the agent's `findings.json`, with the live progress panel at its top |
@@ -92,6 +101,8 @@ The clock of the CPU profile is tied to the page's clock by a named busy-wait ma
92
101
 
93
102
  Read the Babylon Toolkit Agent Reference router and the sub-documents the project's code touches (`node-esm.md` or `classic.md`, `scene-components.md`, `react-framework.md` for a React host, `fusion-networking.md` for networked play) before the first run in a session — unless your prompt already carries those excerpts.
94
103
 
104
+ The names below are shorthand for absolute paths used throughout this skill — write them out in every command (or set them at the top of the same command): most agent shells keep no variables between commands.
105
+
95
106
  ```bash
96
107
  PROJ=<absolute web project root> # holds package.json — resolved as in "Which project" below
97
108
  SKILL_DIR=<absolute path of this skill's folder>
@@ -122,26 +133,28 @@ Run every tool from `$DATA` (`cd "$DATA"`): run paths stay short (`runs/baseline
122
133
 
123
134
  Resolve `$PROJ` before anything else, in this order, and say which project you picked and why in the first update:
124
135
 
125
- 1. **`--project:<path>`** — walk up from the path to the nearest folder with a `package.json`.
136
+ 1. **`--project:<path>`** — the folder (or any folder or file inside it) is the project root: the nearest folder above it with a `package.json`, else the folder itself.
126
137
  2. **A project named in the brief** — a path, or a folder name ("profile BtMarioKartWeb's race start") that matches a project in or next to the working directory.
127
138
  3. **The working directory** — walk up from it to the nearest `package.json`.
128
- 4. **One level down** — when the working directory holds no project (e.g. a folder of games), look in its immediate subfolders; use the one game project found.
139
+ 4. **One level down** — when the working directory holds no project (e.g. a folder of games), look in its immediate subfolders; use the one web project found.
129
140
 
130
- A candidate counts only when it is a **web game**: a `package.json` with a dev/start script and a BabylonJS dependency (`@babylonjs/core`, `babylonjs` or `@babylonjs-toolkit/*`). A `package.json` that is not a game (a tool, a library, the Babylon Toolkit runtime itself) is skipped and the walk goes on. When steps 1–4 find none, or step 4 finds several, **ask the user** with the candidates listed — never guess between projects.
141
+ The project is just **the root folder of the web app**: where its source lives (for code lines and excerpts), where `.agents/profile/` goes, and — when it has a `package.json` with a dev/start script — how to serve it. **Any web app counts**: a Babylon Toolkit game, a plain BabylonJS app, or a front end with no Babylon at all (React, Vue, Svelte, a static site). A `package.json` that is not an app (a tool, a library, the Babylon Toolkit runtime itself) is skipped and the walk goes on. When the user gives `--url` with no `package.json` to serve from — a deployed site, a static folder they already serve — the project is the folder given (or the working directory), used for the output and to map source. When steps 1–4 find none, or step 4 finds several, **ask the user** with the candidates listed — never guess between projects.
131
142
 
132
143
  ## Phase 0 — Preflight
133
144
 
134
145
  ```bash
135
146
  mkdir -p "$TOOLS" "$DATA/runs" "$DATA/logs"
136
147
  cp -R "$SKILL_DIR"/scripts/* "$TOOLS/" # refresh on every skill update
137
- node "$TOOLS/progress.mjs" start "$S" --title "<Project> — <scenario> performance" --brief "<the user's words>" --project "$PROJ" --url "<url>"
148
+ node "$TOOLS/progress.mjs" start "$S" --title "<Project> — <scenario> performance" --brief "<the user's words>" --project "$PROJ" --url "<url, or the dev server's / until known>" --open true
138
149
  node "$TOOLS/progress.mjs" watch "$S" --watch "$PROJ/src" > "$DATA/logs/watchdog.log" 2>&1 & # the watchdog (see Live progress)
139
150
  (cd "$TOOLS" && npm install --silent) # puppeteer-core, source-map-js
140
- printf '.tools/\n*/data/runs/\n*/data/logs/\n*/data/progress.js\n*/data/previous-dashboard.html\n' > "$PROF/.gitignore"
151
+ for line in '.tools/' '*/data/runs/' '*/data/logs/' '*/data/progress.js' '*/data/previous-dashboard.html'; do
152
+ grep -qxF "$line" "$PROF/.gitignore" 2>/dev/null || printf '%s\n' "$line" >> "$PROF/.gitignore" # add what is missing, keep the rest
153
+ done
141
154
  git -C "$PROJ" status --short > "$DATA/worktree-at-start.txt" # the user's own uncommitted work
142
155
  ```
143
156
 
144
- 1. **The game must be served.** Find the dev server (package.json `dev` script, its port) and check it answers; start it in the background if it does not. Content served from elsewhere (a Unity exporter dev server, a CDN) must answer too — read the project's CLAUDE.md / SPEC for how. Profile the **dev server** by default: modules arrive one file each with source maps, so attribution is exact. Mention that React runs in development mode there (its share is inflated); profile a source-mapped production build (`vite build --sourcemap` + `vite preview`) when the React share matters.
157
+ 1. **The app must be served.** With `--url` pointing at a site that already runs (a deployed URL, a server the user started), check it answers and use it. Otherwise: Find the dev server (package.json `dev` script, its port) and check it answers; start it in the background if it does not — with `BROWSER=none` (a Vite `server.open: true` would open a stray tab) and its output in `$DATA/logs/devserver.log`. When the usual port answers but serves **another** project (check the page title or a known path), do not touch that server: start this project's on a free port (Vite: `--port <n>`, or the `PORT` its config reads; a `strictPort` config fails loudly instead of moving), and record the URL with `progress.mjs set --url`. Stop the servers you started when the run ends. Content served from elsewhere (a Unity exporter dev server, a CDN) must answer too — read the project's CLAUDE.md / SPEC for how. Profile the **dev server** by default: modules arrive one file each with source maps, so attribution is exact. Mention that React runs in development mode there (its share is inflated); profile a source-mapped production build (`vite build --sourcemap` + `vite preview`) when the React share matters.
145
158
  2. **`profile.config.json`** in `$DATA` (create it if missing; copy `owners` from a sibling slug's config when there is one):
146
159
  ```json
147
160
  { "projectRoot": "../../../..", "url": "http://localhost:5173/play", "scenario": "scenario.mjs",
@@ -149,10 +162,13 @@ git -C "$PROJ" status --short > "$DATA/worktree-at-start.txt"
149
162
  "sourceRoots": ["/abs/UnityProject/Assets/Scripts"] } ] }
150
163
  ```
151
164
  Add an owner rule for every script **the user owns that ships without a source map** — typically the Unity exporter's project bundle (`scenes/<Product>.js`), compiled from TypeScript under the Unity project's `Assets/`. `sourceRoots` lets analysis find the class's `.ts` file and method line. Owners marked `yours` are charged with the library work they trigger.
152
- 3. **The scenario.** It must play the moment the user says is slow, the way a player would, and mark its phases. Reuse `$DATA/scenario.mjs` when it exists; otherwise copy `templates/scenario.template.mjs` there and adapt it: read the game's code to find what to wait on (a component's phase field, a ready flag) and how to reach it from the page (`window.TOOLKIT.SceneManager.SearchForScriptComponentByName(scene, alias)`, `window.PROJECT.*`). Mark the **reveal** — the moment the loading screen goes away (for a toolkit splash: `#xbabylonjsSplashScreen` gets `opacity: 0`) — as its own phase: games often start their intro behind the splash, and hitches before the reveal are load time, not stutter the player sees. Hold input like a player (keys through `context.keyDown`). If the scenario must keep the game going without a player (a race after the start), hand the player's object to the game's own AI component — never skip or disable work to get there.
153
- 4. **Other sessions.** List the other agent sessions on this machine (`ListAgents`) and check `git status` / `git log` in every repo you may touch. Another session working in the same project or runtime shares the dev server, the runtime build and the commits: tell it which files you change (and ask it to leave them out of its commits), give a one-line heads-up before restarting a dev server or rebuilding a library it serves, and pause captures while it runs timing-sensitive checks. Its edits also move your numbers — compare runs taken on the same code, and say so in the report when you could not.
165
+ 3. **The scenario.** It must play the moment the user says is slow, the way a player would, and mark its phases. **Enter the app the way a player does**: open the page they open (usually the home page) and click through what they click (the menu, the level's button — `context.expectNavigation()` first when the click loads a new page). Use a URL you build yourself (query parameters, a route the UI never links to) only when that is how players really arrive: it can take a path they never take — in one game a `?scene=…gz.gltf` query made the dev server mislabel the page itself as gzip, and the capture recorded a white screen. Reuse `$DATA/scenario.mjs` when it exists; otherwise copy `templates/scenario.template.mjs` there and adapt it: read the game's code to find what to wait on (a component's phase field, a ready flag) and how to reach it from the page (`window.TOOLKIT.SceneManager.SearchForScriptComponentByName(scene, alias)`, `window.PROJECT.*`). Mark the **reveal** — the moment the loading screen goes away (for a toolkit splash: `#xbabylonjsSplashScreen` gets `opacity: 0`) — as its own phase: games often start their intro behind the splash, and hitches before the reveal are load time, not stutter the player sees. Hold input like a player (keys through `context.keyDown`). If the scenario must keep the game going without a player (a race after the start), hand the player's object to the game's own AI component — never skip or disable work to get there. **Size `settle`** (`--args settle=<seconds>`, the seconds recorded after the moment) to the moment: long enough to cover it and a calm stretch after it (a 3-second launch stutter needs ~15–20 s; a frame rate that sinks over a race needs 90), and short of where the scenario stops being realistic (the car reaches a wall, the level ends).
166
+ 4. **Other sessions.** Find the other agent sessions on this machine — the harness's session-listing tool when it has one (Claude Code: `ListAgents`); otherwise the running dev servers and browsers (`ps`, `lsof -iTCP -sTCP:LISTEN`) and recent file times — and check `git status` / `git log` in every repo you may touch. Another session working in the same project or runtime shares the dev server, the runtime build and the commits: tell it which files you change (and ask it to leave them out of its commits), give a one-line heads-up before restarting a dev server or rebuilding a library it serves, and pause captures while it runs timing-sensitive checks. Its edits also move your numbers — compare runs taken on the same code, and say so in the report when you could not.
154
167
  While anyone else edits the project, **never capture on a watching dev server**: one save hot-patches or reloads the game mid-run (the capture logs `WARNING: … restarted` and the report shows a banner). Profile a frozen copy instead: `git archive HEAD | tar -x -C <scratchpad>/snapshot`, copy in your own uncommitted project changes, link `node_modules` to the live project's, and serve it on a spare port with a config that wraps the project's — `mergeConfig(base, { cacheDir: ".vite-profile-cache", server: { watch: null, hmr: false, fs: { strict: false } } })` (its own optimizer cache, since `node_modules` is shared). Warm it once, then capture against that port. Library builds the project links to (a runtime) are still live — keep the heads-up for those.
155
168
  5. **Smoke run** (`node "$TOOLS/profile.mjs" --out runs/smoke --args settle=15 --snapshots true`, from `$DATA`): look at the screenshots and confirm the scenario really did what the user described (the countdown ran, the player moved, the particles fired). Fix the scenario before measuring anything.
169
+ - **When it fails** (`scenario failed` or `--seconds` in the log), the log names the evidence: `shots/failed.png` (what the page showed), the page's address and title, its visible text, and its console errors and failed document / script loads. A white page with a failed document load is a server or routing problem, not the game.
170
+ - **Never read the smoke run for stutter**: each screenshot stalls the page 0.5–2 s — a long frame with no script in it, lined up with a `shot` line in the log. It looks exactly like a hitch.
171
+ - **The first capture of a session may be the only GPU-cold one** (see `--gpu-cold`): if it shows a hitch the later ones do not, that is a first-visit cost, not noise — re-capture with `--gpu-cold true` to reproduce it at will.
156
172
 
157
173
  ## Phase 1 — Measure the baseline
158
174
 
@@ -168,6 +184,8 @@ node "$TOOLS/analyze.mjs" --capture runs/baseline-2/cold --quiet true
168
184
  node "$TOOLS/compare.mjs" --before runs/baseline/cold/analysis.json --after runs/baseline-2/cold/analysis.json # = the noise floor
169
185
  ```
170
186
 
187
+ (With `--gpu-cold`, add `--gpu-cold true` to every capture.) **When the baseline does not show the problem**, close the gap before diagnosing (Troubleshooting › *The profile is smooth*), and keep each attempt as its own run (`runs/repro-<what changed>`). The run that shows it — the **reproduction run** — is what Phase 2 diagnoses and Phase 5 reports.
188
+
171
189
  **A capture right after a dev-server restart is not comparable:** Vite's first load after `--force` re-optimizes dependencies and transforms every module (seconds of `(program)` time in the first phase). Load the page once (a throwaway headless visit) before every capture that follows a restart.
172
190
 
173
191
  Read `summary.txt` in full. Check first: the engine is the one the game uses (WebGPU vs WebGL — a fallback changes everything), the console errors, and that each phase lasted as long as it should. **The noise floor** is the per-phase FPS and CPU ms/frame difference between the two baseline captures; a fix must beat it.
@@ -178,18 +196,20 @@ Read `summary.txt` in full. Check first: the engine is the one the game uses (We
178
196
 
179
197
  Work from the brief's phases outward. For each phase that misses the target:
180
198
 
181
- 1. **Is the main thread the limit?** `busy` near 100% with CPU ms/frame near the frame interval → CPU-bound: find the code. `busy` low with long frame intervals → GPU-bound or waiting: draw calls, fill rate, render scale (the toolkit's `bt-optimize` skill owns scene-side GPU work).
199
+ 1. **Is the main thread the limit?** `busy` near 100% with CPU ms/frame near the frame interval → CPU-bound: find the code. `busy` low with long frame intervals → GPU-bound or waiting: draw calls, fill rate, render scale (the toolkit's `bt-optimize` skill owns scene-side GPU work). The summary's **WORST FRAMES** says which: `cpu` (the frame's own work) or `wait` (a gap the main thread sat through, with its script ms and the pipelines created just before it). A `wait` of hundreds of ms with almost no script, right after new pipelines, is the GPU process compiling shaders — see the hot-spots row *Long frame, almost no script*.
182
200
  2. **Visible or hidden?** Judge stutter only in phases after the reveal mark; a worst frame behind the loading screen costs load time (still worth shortening) but the player never sees it. Check the filmstrip when unsure.
183
201
  3. **Owners.** Which owner grew in this phase compared with the calm phases? A phase that is slow only cold (compare the warm summary) is first-use work: downloads, decoding, shader compilation, pipeline creation, JIT.
184
202
  4. **Subtrees, then functions.** In `inclusiveTop` (frame shells removed) find the subtree that dominates, then its heaviest self-time functions and their `callers` / `enteredFrom` / `yours` columns: those name the code that asks for the work. Re-run `analyze.mjs --drill "<function>"` to split a heavy function into its callees per phase — a cost that **grows** phase by phase while the scene stays the same is accumulating state (more systems switched on, caches invalidated), not load.
185
- 5. **Count, live, when the profile cannot say why.** A function that is cheap per call but runs too often needs a census: copy `templates/census.template.mjs` to the scratchpad (outside the project), adapt how it reaches the moment, and run it with `--args method=TransformNode.prototype.computeWorldMatrix,seconds=1`: it wraps the method for that long and counts calls per object with a sample stack. It names the object and the caller in one run — the Mario Kart run found 16,000 world-matrix recomputes per frame this way.
203
+ 5. **Count, live, when the profile cannot say why.** A function that is cheap per call but runs too often needs a census: copy `templates/census.template.mjs` to the scratchpad (outside the project), adapt how it reaches the moment, and run it with `--args method=TransformNode.prototype.computeWorldMatrix,seconds=1`: it wraps the method for that long and counts calls per object with a sample stack. It names the object and the caller in one run — the Mario Kart run found 16,000 world-matrix recomputes per frame this way. GPU pipelines need no census: every capture records each shader module / pipeline / program with its time (`gpuCompiles` in `analysis.json`, per phase in the summary); line them up with the marks and the scenario's own progress (a distance, a spawn) to name what first drew them.
186
204
  6. **Read the code.** Open the files and lines named (`yoursTop`, `excerpts`, `hotLines`) and the library function the time lands in. Find the mechanism — what runs, how often, on how many objects, why. A finding is not done until you can say *why* it costs what it costs.
187
205
  7. **Worst frames** name the spikes (a spawn, a burst, a compile) that averages hide.
188
206
  8. **Allocations**: phase `heap` lists show who feeds the garbage collector while playing.
189
207
 
190
208
  Write `$DATA/findings.json` (schema in `scripts/report.mjs`): per finding a severity, the phases, the cost in ms/frame and % of the phase, the cause in plain language, the evidence (numbers from the analysis), the code locations, the planned fix. Rank by the time it would win in the phases the user cares about.
191
209
 
192
- ## Phase 3 — Fix, one at a time (skipped with `--analyze`)
210
+ ## Phase 3 — Fix, one at a time (only with `--auto-fix`)
211
+
212
+ Without `--auto-fix`, skip this phase: no code changes. Every finding still carries its proposed `fix`, `gain`, `risk` and `verify`, so **The fixes** and `findings.md` are a complete brief for a later spec.
193
213
 
194
214
  `progress.mjs stage "$S" fix`; each fix moves `trying` → `measuring` → `kept` or `reverted`, with before → after (see *Live progress*).
195
215
 
@@ -203,7 +223,9 @@ For each finding, highest win first:
203
223
 
204
224
  Stop when the target FPS is met in the brief's phases, `--max-fixes` is reached, or what is left is not worth the change (say what it would take).
205
225
 
206
- ## Phase 4 — Verify
226
+ ## Phase 4 — Verify (only with `--auto-fix`)
227
+
228
+ Without `--auto-fix` no code changed: skip it (the stage is already marked skipped) and go to the report.
207
229
 
208
230
  `progress.mjs stage "$S" verify`, with a `now` line for the final captures, the tests and the screenshots.
209
231
 
@@ -225,10 +247,26 @@ node "$TOOLS/report.mjs" --analysis runs/final/cold/analysis.json --baseline run
225
247
  [--snapshots runs/final-shots/cold --snapshots-before runs/baseline-shots/cold] # writes $DASHBOARD (../dashboard.html)
226
248
  ```
227
249
 
228
- (With `--analyze`: `--analysis runs/baseline/cold/analysis.json --warm runs/baseline/warm/analysis.json`.) Then end the run — `node "$TOOLS/progress.mjs" end "$S" --summary "<the verdict in one sentence>"` — so the page leaves live mode and the watchdog exits. Open the report in the browser, screenshot it at desktop and phone width, and check it renders with no console errors. Then tell the user: the verdict in two sentences, each finding with its before → after, what was reverted and why, what remains and what it would take, and the report path.
250
+ (Without `--auto-fix`: `--analysis` is the run that shows the problem — the baseline, or the reproduction run when the baseline did not — and `--warm` its own warm capture when it has one: `--analysis runs/baseline/cold/analysis.json --warm runs/baseline/warm/analysis.json`. Every finding carries `fix` (the proposed change), `gain`, `risk` and `verify`; name the reproduction run and how it differs from a plain capture in the findings' evidence.) Every report lists **The fixes** (each with a copy-able `/bt-spec` command, and one for any group the user ticks) whether they were applied or not. The report also writes `dashboard.pdf` (its **Download PDF** button; `--pdf false` skips it) and `findings.md` (the spec-ready diagnosis). The page has **Print** too. Then end the run — `node "$TOOLS/progress.mjs" end "$S" --summary "<the verdict in one sentence>"` — so the page leaves live mode and the watchdog exits. The dashboard is already open (`start --open true`) and reloads into the report by itself — do not open a second tab; check it renders at desktop and phone width with no console errors (a headless screenshot of the file is enough). Stop every dev server and Chrome the run started. Then tell the user: the verdict in two sentences, each finding with its before → after, what was reverted and why, what remains and what it would take, and the report path.
229
251
 
230
252
  ---
231
253
 
254
+ # Any web app
255
+
256
+ A page with no Babylon engine is profiled the same way — scenario, cold and warm captures, phases, the CPU profile mapped to source lines and owners (`project`, `react`, `vendor`, `program`, `gc`), allocations, long animation frames, screenshots, the dashboard and the fix loop. The differences:
257
+
258
+ - **Frames come from the browser** (`requestAnimationFrame`, `frameSource: "raf"` in the capture): FPS, frame gaps, the worst frames and the per-second timeline are there; the per-frame CPU time, draw calls, particles, compiled shaders and the engine timers are Babylon-only and stay empty. A worst frame's window is the gap the main thread held the next frame back.
259
+ - **The scenario drives the page the way a user does**: clicks (`context.page.click(selector)`, or an `evaluate` that clicks; `context.expectNavigation()` first when it loads a new page), typing, scrolling (`context.evaluate(() => window.scrollBy(0, 800))`), route changes — with a mark per step the user calls slow.
260
+ - **What to look for:**
261
+
262
+ | Hot in the profile | Usually means | Look at |
263
+ |---|---|---|
264
+ | `renderRootSync` / `performWorkOnRoot` / `commitRoot` / `jsxDEV` (React), `patch` (Vue), `flush` (Svelte) | Re-rendering more than the change needs. **During gameplay, any React share at all is a HUD pushing per-frame values through state** — a violation of the Agent Reference's *Game UI Performance — ENFORCED* | Which component re-renders per frame / per keystroke (`yours` names it). A game HUD: the per-frame `setState` / store / EventBus calls in its loop — the fix is the reference's *Live HUD Values* pattern (render once, one frame loop, refs, write on change), and the finding cites it. Elsewhere: memoization, state placed too high, context that changes every render |
265
+ | `(program)` large during play, `Layout` / `Recalculate Style` in a `--trace` | Layout thrashing or style recalculation | Reads of layout (`offsetHeight`, `getBoundingClientRect`) after writes in a loop; animations on layout properties instead of `transform` / `opacity` |
266
+ | `(garbage collector)` | Short-lived allocations per frame or per event | Phase `heap` lists: arrays / objects / closures created in handlers and render functions |
267
+ | One long task at load | Parsing and running a large bundle | Code splitting, deferring what the first view does not need |
268
+ | `JSON.parse` / `stringify`, large `map` / `filter` chains | Big data work on the main thread | Paging, memoizing, moving it to a worker |
269
+
232
270
  # Reading BabylonJS hot spots
233
271
 
234
272
  What a heavy function usually means, and where to look. Always confirm with `callers` / `yours` before acting.
@@ -238,6 +276,7 @@ What a heavy function usually means, and where to look. Always confirm with `cal
238
276
  | `TransformNode.computeWorldMatrix` (deep self-recursion) | **Forced recomputes** (`computeWorldMatrix(true)`): a forced recompute forces every ancestor and bumps its child-update id, which marks every sibling subtree out of date, so the render and the next forced call recompute everything again — a feedback loop. Count recomputes per node live before blaming the scene size | Who calls `computeWorldMatrix(true)` per frame / per physics step (Havok pre-step, sync helpers, animator root motion, particle emitters): one forced call per frame on any node under a level's root invalidates the whole level. Probe the level root's `_childUpdateId` per frame and the forcing stacks. Fix: read the current matrix with `TOOLKIT.Utilities.CurrentWorldMatrix(node)` (recomputes only the changed nodes of the chain); static props never frozen |
239
277
  | `HavokPlugin.setPhysicsBodyTransformation` / `_getTransformInfos` | Havok TELEPORT pre-step: each body whose `disablePreStep` is false is force-synced from its node before every step. Should only be bodies that move by transform (kinematic) | Count bodies by motion type × pre-step live. Static colliders with pre-step on are pure cost (the Babylon Toolkit runtime turned it on for every exported collider before 9.30.x) |
240
278
  | `Node._getDescendants` / `getChildMeshes` / `getChildren` | A hierarchy walk — expensive when done per frame or per object | Per-frame lookups that should be cached at start |
279
+ | **Long frame, almost no script** — a `wait` in WORST FRAMES (LoAF `blockingMs` ≈ 0), right after new pipelines / programs were created (`pipelines near`, `gpu:` per phase) | **The GPU process compiling pipelines** for shaders drawn for the first time. The main thread is idle, so the CPU profile shows nothing; the browser's and the OS's shader caches hide it on later visits, so it is a **first-visit** stutter — every capture after the first may be smooth | Reproduce with `--gpu-cold true`. Which materials / effects are first drawn after the loading screen lifts (the car, the road 10 m in, a first particle burst). Fix: compile them behind the loading screen — wait for the scene and those materials to be ready (`scene.whenReadyAsync()`, `material.forceCompilationAsync(mesh)`, the toolkit's shader warm-up) and render a few frames hidden before revealing, instead of revealing on a fixed timer |
241
280
  | `ProcessIncludes`, `MaterialPluginManager` code injection, `Effect` / `ShaderProcessor`, shader regexes, `glslang` / `twgsl` wasm | A **new shader variant** being built: a material's defines changed, a new material / particle system appeared, a plugin toggled | New materials or defines appearing after load (first particle burst, boost flames, item effects) — pre-warm them at load |
242
281
  | `WebGPUEngine._draw`, `getBindGroups`, `setSubData`, `UniformBuffer.update*`, `Mesh.render`, `SubMesh.render` | Per-draw CPU cost: the frame has too many draws (meshes × passes) | Draw counts per phase, shadow casters, hidden-but-rendered meshes, instancing / merging (`bt-optimize`) |
243
282
  | `ShadowGenerator._renderSubMeshForShadowMap` | Shadow passes re-drawing casters every frame | Casters list, refresh rate, number of shadowed lights |
@@ -246,6 +285,8 @@ What a heavy function usually means, and where to look. Always confirm with `cal
246
285
  | `ParticleSystem.animate` / `_update`, `ShurikenParticles.sys._update` | CPU particle simulation: emit rate × lifetime × systems | Systems started together at an event, capacity, GPU particles |
247
286
  | `(garbage collector)` | Short-lived allocations per frame | Phase `heap` lists: vectors / arrays / closures created in update loops |
248
287
  | `(program)` | Browser-internal work (parse, compile, style, layout, GPU IPC) | Large during load = script parse / compile; during play = DOM / layout churn (HUD) |
288
+ | React (`react` owner) above ~0% during play, `jsxDEV` among the heaviest functions | A HUD re-rendering every frame: speed, timers, needles or bars pushed through React state, props or per-frame EventBus messages | The HUD's frame loop (`yours` names the component). Fix: the Agent Reference's *Live HUD Values — ENFORCED* — render once, one frame loop, write through refs only on change. Budget: ≤ 0.5 ms/frame, `react` near 0% in play phases |
289
+ | `AdvancedDynamicTexture._checkUpdate` / `_render`, `updateDynamicTexture` every frame | A Babylon GUI control assigned every frame: each change re-lays out, redraws and re-uploads the whole GUI texture | Assign a control only when its shown value changes (*Game UI Performance — ENFORCED*) |
249
290
 
250
291
  ---
251
292
 
@@ -271,5 +312,7 @@ What a heavy function usually means, and where to look. Always confirm with `cal
271
312
  | A phase lasts far longer than expected | The scenario waited on the wrong condition — check its log lines and the screenshots |
272
313
  | Functions show `(anonymous)` in a bundle | Minified without names and without a source map: profile a dev build or a `--sourcemap` build |
273
314
  | Capture logs `WARNING: … restarted`, a phase shows 0 FPS, or the compiled-shader count drops mid-run | The dev server reloaded or hot-patched the game because someone saved a file. Discard the run and capture a frozen snapshot (Phase 0 › Other sessions) |
274
- | The profile is smooth but the user feels a stutter | The scenario does not play the way the user does. Close the gap one difference at a time: `--headed true` (a visible window), `--autoplay gesture` (audio stays locked until the first key, as in a normal browser — the unlock can be the hitch), no idle waits where the player acts at once (throttle the moment the loading screen lifts), the same build and URL the user plays (dev server vs a deployed site). If it is still smooth, **let the user drive**: give the scenario a watch-only mode (`--args driver=human`: it loads the moment cold, marks progress such as distance travelled, and sends no keys), run it `--headed true`, and tell the user exactly when it is their turn and for how long |
315
+ | The profile is smooth but the user feels a stutter | The scenario does not play the way the user does. Close the gap one difference at a time, each as its own run: **`--gpu-cold true` first** when the user says "cold", "first time" or "after loading" (later captures reuse compiled GPU pipelines — see the row below), `--headed true` (a visible window), `--autoplay gesture` (audio stays locked until the first key, as in a normal browser — the unlock can be the hitch), no idle waits where the player acts at once (throttle the moment the loading screen lifts), the same build and URL the user plays (dev server vs a deployed site). If it is still smooth, **let the user drive**: give the scenario a watch-only mode (`--args driver=human`: it loads the moment cold, waits for the player's first move, marks progress such as distance travelled, and sends no keys), run it `--headed true` with `--seconds 900` (the default 240 s cap ends the capture before most people start), and tell the user exactly what to do, when, and for how long — in chat and in a `now` line (a subagent has only the `now` line: say so in its brief, and have it give up after a set wait and carry on) |
316
+ | Only the first capture of the session shows the hitch | A **first-visit GPU cost**: the GPU compiled the pipelines in that capture and every later one reused them (macOS keeps compiled Metal pipelines in a system cache that a fresh Chrome profile does not reset). Re-capture with `--gpu-cold true` — never delete the system's shader cache, it belongs to the user's everyday browser |
317
+ | A capture fails: `scenario failed`, `--seconds`, or a white page in the watched window | Read the failure evidence in the log (`shots/failed.png`, the page's address and title, its console errors and failed document / script loads). A white page with a failed document (`ERR_CONTENT_DECODING_FAILED`, 404) is the server or the route: start the app the way a player does (Phase 0 › The scenario) |
275
318
  | Numbers jump between runs | Background load on the machine, a different rival / random seed, or a cold vs warm mix-up: compare cold with cold, and use the noise floor |