Skip to content

Official Codebase of 3DCodeVerse

Python

Clean harness docs and keep development studies local

gaoypengc0af246521c3
diff --git a/.gitignore b/.gitignore
index 776c215a..b1833095 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,11 @@ dist/
# in-tree virtualenv (docs/INSTALL.md tells users to create one)
.venv/
.venv*/
+
+# Local experiment history; retained on the maintainer machine, not distributed.
+/harness/docs/COST.md
+/harness/docs/DECISIONS.md
+/harness/docs/SKILLS_LEDGER.md
+
+# Developer-only visual studies; agents use the production starter library.
+/harness/examples/graphics_lab/
diff --git a/CLAUDE.md b/CLAUDE.md
index 46010359..fe964661 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -14,6 +14,3 @@ Other top-level folders are separate components: `toolkits/` owns the general da
`finetune/` owns training and its data preparation. The canonical LLaMA-Factory data scripts live in
`finetune/llamafactory/`; `finetune/configs/`, `finetune/env/`, and the training launchers in
`finetune/scripts/` retain their existing locations. Read `finetune/CLAUDE.md` before changing them.
-
-`plugins/` holds optional runtime plugins that wrap harness hooks for one process without editing
-`harness/` (`plugins/scene_director/`: art-direction notes as scene refine tasks; a prototype).
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.md
index f498a7b3..12f47e2d 100644
--- a/harness/CLAUDE.md
+++ b/harness/CLAUDE.md
@@ -16,11 +16,15 @@ data-flywheel record per run.
Read `docs/ARCHITECTURE.md` (design, package map, authoring contracts, what a run
really does, known limits), `docs/INTERFACES.md` (binding cross-package signatures as
-built), `docs/RUNBOOK.md` (how to run / resume / extend), `docs/DECISIONS.md`
-(ADR-style laws + deviations), `eval/docs/EVAL.md` (evaluation protocol + judge
+built), `docs/RUNBOOK.md` (how to run / resume / extend), `eval/docs/EVAL.md` (evaluation protocol + judge
calibration) and `eval/docs/COMPLEXITY.md` (the objective complexity vector + the
score-vs-complexity corpus study) before changing anything.
+Historical cost experiments, decision logs and skill measurements are local-only notes
+(COST.md, DECISIONS.md and SKILLS_LEDGER.md under harness/docs, ignored by Git).
+Historical citations in comments refer to these optional notes; they are not required
+to install, run or test the harness. Current rules and interfaces live in the tracked docs.
+
## Laws (do not break)
1. Generated code is raw language — never an SDK/helper import; the harness owns
wrappers/exporters (`codeverse3d/languages/wrappers/`, `languages/opengl_python/wrappers/`,
@@ -77,7 +81,7 @@ push, with `set -o pipefail` so a `| tail` cannot swallow a red exit. The versi
- Live runs under `runs/` (`e2e_*`): read-only reference material; never modify.
- Every model call and vendor session is priced into the run's `telemetry/cost.jsonl` — the ONLY record of
money: `record.total_usage` is its sum at list price (D84). A run's minutes are its steps' time minus
- the time lost to provider errors (`RunRecord.minutes`). `docs/COST.md` Part II has the cost controls.
+ the time lost to provider errors (`RunRecord.minutes`). Use `3dcode cost <slug>` for actual costs.
## Commands
```
diff --git a/harness/README.md b/harness/README.md
index 9daec78c..6444a51f 100644
--- a/harness/README.md
+++ b/harness/README.md
@@ -6,9 +6,9 @@ renders, judges, refines, textures and records every run as data-flywheel materi
* **Tracks:** `static_object` · `articulated_object` · `scene` · `graphics`
* **Languages:** `blender` · `cadquery` · `threejs` · `urdf_blender` ·
- `scene_threejs` · `glsl_shader` · `opengl_python`
-* **Backends:** Gemini / Anthropic / OpenAI chat models; coding agents `gemini-cli`,
- `claude-code`, `codex`, `agy` (Antigravity) — always a vendor's CLI — and
+ `scene_threejs` · `scene_blender` · `glsl_shader` · `opengl_python`
+* **Backends:** Gemini / Anthropic / OpenAI chat models; coding agents `claude-code`,
+ `codex`, `agy` (Antigravity) — always a vendor's CLI — and
`single-shot` generation on any chat model.
* **Spatial tools** (direct, or over the MCP server `3dcode` for the agentic CLIs): build,
measure, render, section, connectivity/contract checks, joint sweeps, scene and GL probes —
@@ -46,8 +46,8 @@ codeverse3d/
tracks/ the four track pipelines + the round loop, the one planner loop, generation strategies
(vendor-CLI agent / single-shot), repair, best-of-N, skills hook
languages/ one merged module per language (lint → skeleton → runtime) beside its
- data dirs: blender cadquery threejs urdf scene_threejs glsl_shader opengl_python
- agents/ CodingAgent protocol + the vendor-CLI backends (gemini-cli, claude-code,
+ data dirs: blender cadquery threejs urdf scene_threejs scene_blender glsl_shader opengl_python
+ agents/ CodingAgent protocol + the vendor-CLI backends (claude-code,
codex, antigravity): sessions, watchdog clocks, transcripts
models/ ChatModel + gemini/anthropic/openai adapters; key-pool retry machine,
streaming with stall detection, IPv4-pinned transport, pricing, health
@@ -87,12 +87,10 @@ pip install -e '.[all,dev]' # entry points: 3dcodeverse, 3dcode
python -m pytest tests -q -m "not live"
```
-What a run costs and how long it takes: `docs/COST.md` (measured) and `docs/RUNBOOK.md` §2
-(expected, per track).
+Expected cost and time per track: `docs/RUNBOOK.md` §2. Inspect actual run costs with
+`3dcode cost <slug>` and configured profiles with `3dcode cost profiles`.
Docs: `docs/INSTALL.md` (install / prerequisites / doctor troubleshooting) ·
`docs/ARCHITECTURE.md` (design + what a run does) · `docs/INTERFACES.md`
-(signatures) · `docs/RUNBOOK.md` (operate / extend) · `docs/DECISIONS.md` (ADRs) ·
+(signatures) · `docs/RUNBOOK.md` (operate / extend) ·
`eval/docs/EVAL.md` (evaluation protocol + judge calibration) · `CLAUDE.md` (working rules).
-
-Effect library studies: [Graphics Lab](examples/graphics_lab/README.md).
diff --git a/harness/codeverse3d/conventions.py b/harness/codeverse3d/conventions.py
index a39da02f..7ec0cc3e 100644
--- a/harness/codeverse3d/conventions.py
+++ b/harness/codeverse3d/conventions.py
@@ -188,15 +188,6 @@ def views_by_preference(views: Sequence[RenderView], names: Sequence[str]) -> li
return sorted((v for v in views if view_key(v.name) in rank), key=lambda v: rank[view_key(v.name)])
-#: the view a one-camera comparison (the reference silhouette) takes, in preference order
-FRONT_VIEW_NAMES: tuple[str, ...] = ("front", "front_right_high", "front_left_high")
-
-
-def front_view(views: Sequence[RenderView]) -> RenderView | None:
- """The first of ``FRONT_VIEW_NAMES`` among ``views``, else the first view."""
- return next(iter(views_by_preference(views, FRONT_VIEW_NAMES)), views[0] if views else None)
-
-
#: Scene overview rig (scenes sit on ground: aerial + eye level, no underside). The
#: ``overview_*`` views reach the judge (the first ``render_scene.MAX_JUDGE_OVERVIEWS``);
#: ``overview_low_front`` (2026-10-14, scene_v2) is the CONTACT camera — elevation under 10°
diff --git a/harness/codeverse3d/tracks/scene.py b/harness/codeverse3d/tracks/scene.py
index 81f7368e..ba716d88 100644
--- a/harness/codeverse3d/tracks/scene.py
+++ b/harness/codeverse3d/tracks/scene.py
@@ -3,7 +3,7 @@
Languages: every scene language, through its ``SceneRuntime`` (D101). Generation is staged (each stage cached by
``StageRunner`` for resume); the round loop then builds (probe + shaders — the
build's two gate reports join the round's gates),
-renders authored cameras + orbit at t=0 and t=1.5, judges with ``scene_v1``
+renders authored cameras + orbit at t=0 and t=1.5, judges with ``scene_v2``
(console/shader errors become gate ERRORS) and dispatches refine tasks per
zone / asset / env / camera, in parallel when file-disjoint.
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 5b89c639..c3839c9c 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -3,8 +3,7 @@
Package `codeverse3d`, CLI `3dcodeverse` (short alias `3dcode`), repo location
`harness/` in the 3dcodeverse checkout. Backend only. Python 3.13 (one fixed version), a small Node
runtime (`runtime_js/`) for everything Three.js / headless Chrome, and moderngl
-for the graphics track. Checked against the code on 2026-09-22; design history and deviations are in
-`docs/DECISIONS.md`, how-to in `docs/RUNBOOK.md`, evaluation protocol in
+for the graphics track. Checked against the code on 2026-09-22; design history is kept in optional local decision notes; how-to is in `docs/RUNBOOK.md`, evaluation protocol in
`eval/docs/EVAL.md`, complexity measurement + the score-vs-complexity study in
`eval/docs/COMPLEXITY.md`, binding signatures in `docs/INTERFACES.md`.
@@ -613,10 +612,10 @@ judge 0.686 → 0.701, materials 0.60 → 0.69, shipped.
## 9. What a run costs and how long it takes
-Measured, not restated here: `docs/COST.md` is the home of every money figure (§15: one live
-run per profile; §28: where the time goes), and RUNBOOK §2 gives the operator's expected cost
-and time per track. (This section used to hold a 2026-08-23 table of wave-1 runs, made with
-the since-deleted in-process `api-agent` and the since-removed pass / plateau stops.)
+RUNBOOK §2 gives expected cost and time per track. Use `3dcode cost <slug>` for a
+run's recorded spend and `3dcode cost profiles` for profile expectations. Historical
+measurements cited elsewhere in this document are local experiment notes and are
+not distributed with the repository.
## 10. Known limits
diff --git a/harness/docs/COST.md b/harness/docs/COST.md
deleted file mode 100644
index 1d9415bc..00000000
--- a/harness/docs/COST.md
+++ /dev/null
@@ -1,1641 +0,0 @@
-# Cost audit — where the money actually goes
-
-Measured on **61 recorded runs** (`runs/e2e_*` ×5, `eval/bench/out/{static_v1_flash,
-articulated_v1_flash,graphics_v1_flash,scenes_v1_flash}` ×46, the 10 cells of
-`eval/bench/out/compare_v1_live2`) on 2026-08-23. Every number below comes from the
-recorded telemetry, not from an estimate: `record.json`, `events.jsonl` and the
-per-call `usage` rows inside `trajectories/*/transcript.jsonl`.
-
-Reproduce:
-
-```
-3dcode cost show runs eval/bench/out/static_v1_flash … # console
-3dcode cost show runs eval/bench/out/* --md docs/cost_report.md # full tables
-3dcode cost show runs --recheck # re-price with today's table
-3dcode cost prices [--unverified] # the price table + provenance
-```
-
-The audit is `codeverse3d/addons/costreport/audit.py`. Part I was measured with a
-reconstruction of per-call rows from those runs' trajectories, verdicts and events
-(`cost/reconstruct.py`); every run since 2026-08-23 writes its own ledger, the reconstruction
-went on 2026-09-22 (434 of 467 archived runs carry a ledger; the 33 without are five v1
-batteries outside the repo), and `3dcode cost` now reads the ledger alone — so Part I's
-figures are the audit's record, not something this tree re-derives.
-`eval/bench/out/compare_v1_full` (a partial, superseded compare battery) is excluded.
-
-> **Re-run 2026-08-23 (wave 3).** Every figure in Part I below was recomputed
-> after a de-duplication bug in the reconstruction was fixed (§6): a retried agent
-> session is recorded as `<label>.a2` while the `generate.done` event that
-> summarises the job carries the plain label, so the event was counted a *second*
-> time on 14 runs. The reconstructed total drops **$89.88 → $86.30 (−4.0 %)** and
-> lands $1.22 above the runs' own `record.total_usage` ($85.08) instead of $4.80.
-> The waste analysis (§5) and the round economics are unchanged — they are built
-> from round records, not from those events.
-
----
-
-## 1. Headline
-
-| | |
-|---|---|
-| total spend | **$86.30** over 61 runs (26.4 h of run time, 7,544 model calls) |
-| per run | $1.41 (median $0.95) |
-| **per passing artifact** | **$2.40** — 36 of 61 runs passed |
-| input tokens | 278.6M, of which **80% are cache reads** |
-| output tokens | 3.94M (+0.66M thoughts) |
-| generation : judging : planning | **89.8% : 7.5% : 0.8%** |
-| identified waste | **$27.35 (32%)** — see §5 |
-| recorded vs measured | `record.total_usage` says $85.08; the ledger finds **$86.30** (§6) |
-| re-priced with the corrected table | **$89.10** (+3.2%, §7) |
-
-(The pass count and the $ per passing artifact are this audit's. Since 2026-09-22 a run is
-not passed or failed — it runs its fixed rounds and a pick hands one over — so `3dcode cost`
-reports $ per run and no longer counts passes.)
-
-**The money is generation, not judging.** Nine dollars in ten are the coding
-agent writing and rewriting code; the judge is a rounding error next to it
-(7.2%), the planner is noise (0.8%). Any cost programme that starts with "use a
-cheaper judge" is optimising 7% of the bill — and, as §8 shows, would lose money.
-
----
-
-## 2. Per stage
-
-| key | USD | share | calls | input | cached | output | $/1k tok | model time |
-|---|---|---|---|---|---|---|---|---|
-| plan | $0.7234 | 0.8% | 56 | (not recorded) | – | – | – | 0.0 h |
-| assets (scene) | $5.61 | 6.5% | 587 | 13.24M | 61% | 236.8k | $0.00041 | 1.0 h |
-| env (scene) | $0.7762 | 0.9% | 92 | 1.96M | 62% | 19.1k | $0.00039 | 0.1 h |
-| zones (scene) | $4.49 | 5.2% | 451 | 15.55M | 76% | 140.8k | $0.00028 | 0.7 h |
-| baseline | $25.06 | 29.0% | 1,814 | 86.76M | 85% | 1.39M | $0.00028 | 4.0 h |
-| repair | $1.31 | 1.5% | 152 | 5.08M | 79% | 49.9k | $0.00026 | 0.2 h |
-| **refine** | **$40.28** | **46.7%** | 4,231 | 154.50M | 80% | 1.82M | $0.00026 | 8.4 h |
-| judge | $6.48 | 7.5% | 126 | 1.33M | 8% | 212.1k | $0.00383 | 1.2 h |
-| texture | $1.10 | 1.3% | 16 | (event only) | – | – | – | 0.0 h |
-| other / unattributed | $0.4776 | 0.6% | 19 | 235.2k | 10% | 67.3k | $0.00158 | 0.0 h |
-
-`skeleton`, `assemble`, `gates` and `render` cost **$0.00**: they are
-deterministic harness work. Blender build 0.13 s, gates ~2 s, an 8-view GPU
-render ~1.5 s (that battery's rig; 14 views since D47) — the "cheap first" law is holding.
-
-## 3. Per role, track, backend, model
-
-| role | USD | share | calls | $/1k tokens |
-|---|---|---|---|---|
-| generator | $77.52 | 89.8% | 7,327 | $0.00028 |
-| judge | $6.48 | 7.5% | 126 | $0.00383 |
-| planner | $0.72 | 0.8% | 56 | – |
-| image (texturing) | $0.61 | 0.7% | 5 | – |
-| other (event-only) | $0.97 | 1.1% | 30 | – |
-
-| track | runs | USD | $/run | passed | **$/passing artifact** | median rounds |
-|---|---|---|---|---|---|---|
-| static_object | 37 | $54.45 | $1.47 | 23 | **$2.37** | 2 |
-| articulated_object | 13 | $17.34 | $1.33 | 8 | **$2.17** | 2 |
-| scene | 5 | $13.92 | $2.78 | **0** | **∞** | 2 |
-| graphics | 6 | $0.59 | $0.10 | 5 | **$0.12** | 1 |
-
-The graphics track is **18x cheaper per passing artifact** than the object
-tracks (one single-shot generation, compiler feedback, no tool loop). The scene
-track has not produced a single passing artifact in this data set at $2.83/run.
-
-| model | USD | share | calls | cached | note |
-|---|---|---|---|---|---|
-| gemini-3.7-flash | $74.13 | 85.9% | 7,400 | 80% | generator + planner + cheap judge |
-| gemini-3.1-pro-preview | $6.23 | 7.2% | 109 | 7% | default judge |
-| gpt-5.6-sol (codex) | $2.26 | 2.6% | 3 | 92% | one telescope run |
-| claude-fable-5 (claude-code) | $1.90 | 2.2% | 2 | 0% | recorded as `claude-haiku-4-5` — see §7 |
-| (event-only rows) | $1.78 | 2.1% | 30 | – | plan / texture / pairwise: cost recorded, tokens not |
-
-## 4. Tokens, caching and the clock
-
-**80% of every prompt is context we have already sent.** 259.8M of the agent
-loop's input tokens correspond to only 13.3M tokens of *final* context — the
-transcript is re-sent **19.5x** on average (median 22 model turns per session,
-p90 52). Implicit caching absorbs most of that: cache reads cost $16.98, and
-the same traffic with a 0% hit rate would have cost **$239.12 instead of $86.30**.
-Caching is already saving 64% of the bill.
-
-The uncached remainder is still ~$40 of that traffic, and the bill grows
-quadratically with session length (the 262 agent sessions that kept a per-turn
-transcript — $69.1 of the $81.1 generator spend):
-
-| model turns | USD | share of agent spend |
-|---|---|---|
-| 1–10 | $23.70 | 34.3% |
-| 11–20 | $18.26 | 26.4% |
-| 21–30 | $11.76 | 17.0% |
-| 31–40 | $7.65 | 11.1% |
-| 41–50 | $4.81 | 7.0% |
-| 51–60 | $2.90 | 4.2% |
-
-**39.3% of the agent bill is spent from turn 20 onwards.** 33 sessions ran ≥50
-model turns for $19.57 — and 19 of those 33 ended `exit_reason="budget"`, i.e.
-the money bought a session that was cut off rather than finished.
-
-**Measured cache behaviour (live, gemini-3.7-flash, 2026-08-23)** — the same
-content in two orders, 6 calls each, one key:
-
-| arrangement | prompt | cached tokens | $/call |
-|---|---|---|---|
-| stable prefix first, volatile tail last | 17.8k | 0 → **12,265 (69%)** | $0.0144 → **$0.0052** |
-| volatile first, same stable text after | 17.8k | **0 on every call** | $0.0134 |
-| stable first, fresh 29.7k corpus | 29.7k | 0 → **24,549 (83%)**, one miss in four | $0.0223 → **$0.0057** |
-| volatile first, fresh 29.7k corpus | 29.7k | **0 on all four calls** | $0.0223 |
-
-Same tokens, same model, **2.6–3.9x the price** for the wrong order (and the
-implicit cache is best-effort: one call in four missed even in the good arm). A second
-experiment sized the cache floor (fresh prefix per size, 3 calls each):
-
-| repeated prefix | cached on call 2–3 |
-|---|---|
-| 2.8k tokens | 0 |
-| 5.4k tokens | 0 |
-| 8.2k tokens | 4,080 once, then 0 (unreliable) |
-| 11.1k tokens | 0 |
-| 16.8k tokens | 12,264 (73%) |
-| 28.2k tokens | 24,548 (87%) |
-
-Implicit caching works in ~4,088-token blocks and only becomes reliable above
-~12–16k tokens of *identical* prefix. Key rotation does **not** break it (all 22
-keys share the cache).
-
-A third experiment used a **real judge payload** — `build_judge_messages` on
-`e2e_chair_blender` r01 (9,454 tokens: system + brief + plan + gates + three
-montages), sent to `gemini-3.1-pro-preview`:
-
-| judge call | cached | $/call |
-|---|---|---|
-| first send | 0 | $0.0333 |
-| identical resend (×2) | **4,079 (43%)** | **$0.0259 (−22%)** |
-| same content, montages shuffled — what `n_samples > 1` does today (×3) | **0** | $0.0333 |
-| next round (same images, changed gate/measurement text) | **0** | $0.0333 |
-
-So: the judge's stable head (system + rubric + defect checklist ≈ 3.5k) is just
-under one cache block, and every per-round or per-sample difference sits early
-enough to void it. Consequences:
-
-* the agent loop already sits far above the floor — that is why it gets 80%;
-* **judge and plan calls get almost nothing** (7% measured over 112 real
- verdicts). Two cheap fixes exist (§9 #11–12), worth ~$1 on this data set —
- the real lever on judging is *how many verdicts*, not *how cheap each prompt*.
-
-**Clock.** 26.4 h of run time against 35.5 h of model time (fan-out rounds run
-sessions in parallel). On the 37 runs with no parallel fan-out the split is 9.04 h wall vs 7.94 h
-model — **88% of the clock is waiting for a model**, 12% is the harness
-(build + gates + render + git). Cost and latency have the same owner.
-
-## 5. Where a dollar bought nothing
-
-| waste | n | USD | share |
-|---|---|---|---|
-| regression — a round scored **below** the best and was discarded | 19 | $14.23 | 16.5% |
-| post-budget — a round completed after the budget was already gone | 9 | $8.76 | 10.1% |
-| zero-delta round — score moved < 0.005 | 4 | $1.68 | 1.9% |
-| unpromoted judge — a verdict on a round that never became best | 23 | $1.37 | 1.6% |
-| repair loop that never converged (run did not pass) | 4 | $1.31 | 1.5% |
-| **total** | 59 | **$27.35** | **31.7%** |
-
-> **2026-09-22 — three of these kinds are gone.** "Regression", "zero-delta round" and
-> "unpromoted judge" measured money against the IN-RUN best round, and the owner removed
-> the in-run best with the judgement stops: a run is now the baseline + `--rounds` refine
-> rounds, each built on the round before it, every round is kept, and which one to hand
-> over is picked after the run (`addons/select`). A round that scored lower is a candidate
-> for that pick, not waste, so `3dcode cost` no longer reports those kinds (and the
-> `cost.round` event that carried their flags went too, §32). "Repair loop that never
-> converged" is now repair money spent in a round that still did not build; post-budget stays.
-
-Concrete examples:
-
-* `tool_med_hand_drill` r01: **$2.48** to go from 0.576 to **0.560**.
-* `plant_hard_bonsai` r01: **$2.36** to go from 0.384 to **0.134**, then r02
- spent another $1.29 *after* the budget was exhausted.
-* `tool_hard_bench_vise` r02: **$2.02** spent on a round that started after
- `budget.exceeded` had already fired.
-
-Marginal economics of a refine round:
-
-| round | n | USD | median $ | rounds that improved | total score gained | **$ per score point** |
-|---|---|---|---|---|---|---|
-| r00 baseline | 54 | $35.58 | $0.557 | – | – | – |
-| r01 | 33 | $20.99 | $0.475 | 22/33 | +4.26 | **$4.93** |
-| r02 | 16 | $9.18 | $0.383 | 7/16 | +1.35 | **$6.80** |
-| r03 | 4 | $2.98 | $0.569 | 1/4 | +0.09 | **$33.49** |
-
-The first refine round is the good buy. r02 is a coin flip; r03 costs 7x r01
-per point of score.
-
-## 6. $1.22 of spend is invisible to `record.total_usage` (was reported as $4.80)
-
-**Corrected 2026-08-23.** The first pass of this section said *"14 of 61 runs,
-$4.80 (5.6% of all spend)"*. Most of that was a bug in the **reconstruction**,
-not money the record lost. `cost/reconstruct.py` de-duplicates a
-`generate.done` event against the agent sessions that already accounted for the
-same work, and it keyed that on the session's own label — but a retried session
-records itself as `<label>.a2` (and a wrap-up as `<label>.wrapup`) while the
-event carries the plain job label. The retry's dollars therefore sat in a
-different bucket, the job's pool ran dry, and the event was added on top of the
-sessions. `_base_label()` now strips the attempt suffix before the lookup, and a
-test pins the three worst runs.
-
-Re-running the audit with the fixed code
-(`3dcode cost show <paths> --md <out>`, or the script in the wave-3 scratchpad):
-
-| | before the fix | after |
-|---|---|---|
-| reconstructed total | $89.88 | **$86.30** |
-| Σ `record.total_usage` | $85.08 | $85.08 |
-| runs whose ledger exceeds their record by > $0.005 | 14 | **4** |
-| **off-record total** | $4.80 | **$1.22** |
-
-What is left is real, and it is one thing plus small change:
-
-| run | record | ledger | off-record | why |
-|---|---|---|---|---|
-| `furn_hard_rolltop_desk` | $1.2165 | $1.8727 | **$0.6562** | four post-hoc texture passes, run after the record was written |
-| `cmp_easy_stool/harness_api-agent…` | $0.3434 | $0.6118 | $0.2685 | compare cell: the fixed evaluator's judge is outside the harness run's total |
-| `cmp_easy_stool/harness_gemini-cli…` | $0.8810 | $1.0437 | $0.1627 | idem |
-| `e2e_bench_threejs` | $0.6840 | $0.8186 | $0.1347 | a gemini-cli session re-priced from its own `stdout.json` stats (§7 #1) |
-
-The other 19 runs with a positive gap are all under half a cent. The three worst
-offenders of the old table reconcile to the **cent** once the double count is
-gone — `art_hard_door_handle` $3.0690 vs $3.0690, `tool_med_hand_drill` $4.0210 vs
-$4.0210, `art_easy_laptop` $1.1223 vs $1.1223 (reconstructed rows excluding the
-synthetic `residual` filler) — which is the independent recount in the wave-2
-hand-off (`waste-and-accounting/MEASUREMENTS.md` §1, "$0.00 genuinely
-off-record") reproduced by the shipped code.
-`tests/cost/test_reconstruct.py` pins all three plus a synthetic retry.
-
-**A second recount reported 25 runs / $4.65; it reproduces exactly when the RE-PRICED ledger is compared with the recorded record.total_usage (the original $4.80 / 14 runs used the old price table and a higher per-run threshold). Both numbers are correct under their own method; the re-priced 25-run figure is the current one.** That figure
-is not reproducible against this tree: with the current code the same 61 runs give
-28 runs with any positive gap / $4.797 *before* the de-duplication fix and 23 /
-$1.222 after, on either the recorded or the re-priced price table. The numbers
-above are what `audit_runs()` prints today, and the script that prints them is in
-the scratchpad; anyone who can reproduce 25/$4.37 should say which run set it used.
-
-**Both holes are now closed at the source, so this section is about history:**
-the live ledger (§12) writes one row per call at the time of the call — the planner,
-aborted rounds, retried sessions and the texture pass included — and a post-hoc pass joins
-the run's ledger (`3dcode texture pass` opens it with `create=False`); since 2026-09-22 the
-record's total IS that ledger's sum (§32). A run recorded from now on
-cannot have an off-record dollar; the reconstruction that audited the 61 runs recorded
-before it went on 2026-09-22, and with it `tests/cost/test_reconstruct.py`.
-
-## 7. Price hygiene (checked 2026-08-23)
-
-Every row of `models/pricing.PRICES` carries its provenance — source, `checked` date and a
-status of `verified` / `inferred` / `unverified` (one table since 2026-09-22; the parallel
-`PROVENANCE` dict is gone) — exposed as `price_provenance(provider, model)` and printed by
-`3dcode cost prices`. Every
-row was reconciled against the providers' live pricing pages. **Corrections
-made:**
-
-| row | was | is | effect |
-|---|---|---|---|
-| `anthropic:claude-sonnet-5` | 3.00 / 15.00 / 0.30 | **2.00 / 10.00 / 0.20** | we were over-billing sonnet-5 by 50% (the launch rate became standard) |
-| `openai:gpt-5.6-sol` | 5.00 / 30.00 / 0.50 (approx) | **4.00 / 20.00 / 0.40** | the one codex run drops $1.86 → $1.42 |
-| `gemini:gemini-3.1-flash-image` | 0.25 / 1.50 / 0.025 | **0.50 / 3.00 / 0.05 + $0.067 per 1K image** | image output is billed per image ($60/M image tokens), not as text |
-| `gemini:gemini-2.5-flash` cached | 0.075 | **0.03** | 2.5x over-billing on cache reads |
-| `gemini:gemini-2.5-flash-lite` cached | 0.025 | **0.01** | idem |
-| `gemini:gemini-3.1-pro-preview`, `gemini-3-pro-preview`, `gemini-2.5-pro` | one tier | **+ >200k tier** (4.00 / 18.00 / 0.40) | `estimate_cost` now applies the long-context tier automatically |
-| added | – | `claude-haiku-3-5`, `claude-mythos-5` | were unknown ⇒ silently $0 |
-| added 2026-08-24 | – | `openai:gpt-5.6-terra` **2.00 / 12.00 / 0.20**, `openai:gpt-5.6-luna` **0.20 / 1.20 / 0.02** | the other two codex tiers were unknown ⇒ silently $0 (luna was cut 80% on 2026-07-30) |
-| verified (no change) | – | every other gemini / anthropic / openai row | now flagged `verified` rather than "approximate" |
-| still `inferred` / `unverified` | – | `claude-haiku-4`, `o1-mini`, `gpt-5-codex`, `gpt-5.1-codex`, `gpt-5.2-codex`, `gemini-2.5-flash-image` | not listed on the pricing pages; `3dcode cost prices --unverified` lists them |
-
-Per-image prices live in the price table only (`Price.image_usd`,
-`IMAGE_USD_BY_SIZE`, `per_image_usd()`); the duplicate table in the image model is
-gone (2026-08-29) and `GeminiImageModel` prices with `per_image_usd(size=<generated
-px>)` directly — a 2K image was billed 0.067 (the 1K rate) instead of 0.134 until then,
-and a 512 request is billed as the 1K image it actually generates.
-
-**Two costing bugs the audit surfaced** (both in files owned by other engineers —
-see the hand-off notes):
-
-1. **gemini-cli runs were under-billed ~3.7x.** `e2e_bench_threejs` recorded
- $0.68; its own `stdout.json` stats say 14.19M prompt tokens (13.47M cached) +
- 128.8k output ⇒ **$2.09**. The session was recorded before
- `Usage.input_tokens` became `tokens.prompt`; the raw envelope is still on
- disk, so `3dcode cost show --recheck` rebuilds the true number. Across the
- three gemini-cli runs the correction is **+$3.43**.
-2. **claude-code attributes the cost to the wrong model.** The envelope's
- `modelUsage` shows `claude-fable-5` did the work ($1.165) and
- `claude-haiku-4-5` answered one utility call ($0.0015); the harness records
- the *first* served model, so the run is filed as haiku with
- `input_tokens=2`. The dollar is right (the CLI reports `total_cost_usd`), the
- attribution is not. Rows from such backends are marked
- `price_source="provider-reported"` and are never re-priced from the token
- table.
-
-Re-pricing everything with the corrected table moves the total from $86.30 to
-**$89.10 (+3.2%)**: +$3.43 gemini-cli, −$0.50 codex, −$0.13 elsewhere.
-
-**Not modelled** (documented in `pricing.py`): cache *storage* fees for explicit
-Gemini caching, Anthropic 1-hour cache writes, batch/flex discounts, data
-residency (1.1x) and fast-mode multipliers, per-search server-tool fees.
-
-## 8. Model routing — what to run where
-
-| role | model | $/call | measured quality | when |
-|---|---|---|---|---|
-| planner | `gemini:gemini-3.7-flash` ★ | $0.013 | no failure attributable to the planner | always — the plan is 0.8% of a run |
-| generator | `agy:gemini-4-argon` ★ | not yet measured | — | default for every track with tools since 2026-10-13 (D103: gemini-cli removed; agy in Gemini-API mode, pool key + MCP, priced at list) |
-| generator | `gemini-cli:gemini-3.7-flash` (removed in D103) | $0.73 | 0.827 on compare_v1 | the default 2026-08-28 – 2026-10-13; the expectation the agy arm is held to until a battery re-measures it |
-| generator | `single-shot:gemini:gemini-3.7-flash` | $0.05 | graphics: 5/6 passed, median 0.810 | glsl / opengl — one file, compiler feedback |
-| generator | `gemini-cli:gemini-3.6-flash` (removed in D103; `agy:gemini-3.6-flash` is its successor) | $0.52 | compare_v1 mean 0.835 (best arm measured) | the cheaper arm, and the one every recorded battery was run on |
-| generator | `codex:gpt-5.6-sol` | $1.93 in-loop / $0.20 one-shot | one-shot 0.786 | strong one-shot baseline, expensive loop |
-| generator | `oneshot:claude-code` | $1.04 | 0.673, 0/2 passed | not for bulk generation |
-| judge | `gemini:gemini-3.1-pro-preview` ★ | $0.060 | σ 0.030, pearson(gate errors, score) **+0.63** | every decision that persists |
-| judge | `gemini:gemini-3.7-flash` | $0.027 | σ 0.083, pearson **−0.33** | in-loop hints only |
-| image | `gemini:gemini-3.1-flash-image` ★ | $0.067/tile | a texture pass ≈ $0.13 | only behind the before/after gate |
-
-**When does the pro judge pay for itself?** Flash is 2.2x cheaper per verdict,
-but its noise is 2.8x larger. Matching pro's σ = 0.030 by sampling flash needs
-`(0.083/0.030)² = 8` samples = **$0.216 per verdict, 3.6x the price of one pro
-verdict** — and sampling still cannot fix the sign of flash's correlation with
-the deterministic gates (−0.33 vs +0.63), so a flash ranking stays biased no
-matter how many samples you buy. Pro is the cheap option for anything that
-persists. Concretely, the 112 verdicts in this data set cost $6.48 with the pro
-judge and would cost $24.2 as "cheap" flash at n=8.
-
-This table is its one home (the `cost/routing.py` copy of it, which only the markdown cost
-report printed, went on 2026-09-22).
-
-## 9. Ranked optimisation opportunities
-
-Savings are estimated **on this data set** (61 runs, $86.30) unless stated.
-
-| # | change | est. saving | confidence | where |
-|---|---|---|---|---|
-| 1 | ~~**Stop refining after r01 unless the last delta ≥ 0.05.** r02+r03 cost $12.16 and bought +1.44 score points across 8 of 20 rounds.~~ **Removed 2026-09-22**: the round count is fixed (owner) — spend less with a lower `--rounds` or a profile, not with a judgement stop. | $9–12 (10–13%) | high (measured) | `--rounds` / `cost/profiles.py` |
-| 2 | **Check the budget *before* starting a round, against the estimated round cost**, not only between steps. | **$8.76 (9.7%)** | high (measured waste) | `orchestrator.py` (`BudgetGuard`) + `tracks/steps.py`; use `codeverse3d.cost.estimate_call` / median round cost |
-| 3 | ~~**Cap agent turns at ~25 and compact old tool results.** 39.3% of the agent bill is turn ≥20; 19 of the 33 sessions that ran ≥50 turns were cut off by their own budget.~~ **Tested, rejected: +$0.02 and −0.21 score** (A/B, n=3 per arm, §17) — the cap is off by default. | est. $8–15, **measured $0** | high (A/B) | `DEFAULT_AGENT_MAX_TURNS=0`; `$C3D_AGENT_MAX_TURNS` / `Settings.limits.agent_max_turns` still set one |
-| 4 | **Fold the off-record spend into the budget** (cut rounds, post-hoc texture passes). | $0 saved, **$1.22 of blindness removed** | high | §6; the ledger (`codeverse3d.cost.record_call`) makes it automatic |
-| 5 | **Scene track: 73% of scene spend is assets+zones, 0/5 passed.** Trim the per-zone context (each zone session re-sends the whole scene contract) and judge assets before zones start. | ~$1/run of $2.83 | medium | `tracks/scene*.py` |
-| 6 | **Drop `oneshot:claude-code` from default compare arms** ($1.04/artifact at 0.673 — the worst score per dollar measured). | bench-only | high | `eval/bench/compare_backends.py` arms |
-| 7 | **Gate the texture pass on the materials criterion** (< 0.7) — 5 passes ran, 2 shipped, $1.10 spent. | ~$0.5 | medium | `texturing/run.py` |
-| 8 | **Keep the pro judge; do not "save" money there** (§8). | avoids a **$45** increase | high | – |
-| 9 | **Price-table corrections** (§7) — accuracy, not savings: the reported bill was 3.1% low overall and 3.7x low on gemini-cli runs. | – | done | `models/pricing.py` |
-| 10 | **Do not chase prompt caching on judge/plan calls in general** — measured below the cache floor (§4). | – | done (measured) | – |
-| 11 | **Grow the judge's stable head past one cache block** (system + rubric + defect checklist ≈ 3.5k → ≥ 4,088 tokens, e.g. by moving the shared scoring rules and a fixed worked example into the system block). Measured: one cached block = 4,079 tokens = $0.0073 per pro verdict. | ~$0.8 (112 verdicts) | medium | `judges/prompt_builder.py` |
-| 12 | **Know that `n_samples > 1` pays full price for every sample**: the montage shuffle voids the cache (measured 0 cached vs 4,079 on an identical resend, −22%/sample). Keep the shuffle — it is the noise control — but count it when choosing `n`. | – | measured | `judges/prompt_builder.py` |
-
-Not recommended on the evidence: cheaper generation models (a bare one-shot
-flash scored 0.14 and produced no buildable code in 3 of 5 cells — the loop, not
-the model, is what makes the artifact), and cheaper judges (§8).
-
-## 10. The cost ledger (`codeverse3d/cost/`)
-
-```python
-from codeverse3d.cost import record_call, load_ledger
-from codeverse3d.cost.ledger import summarise
-
-with run_ledger(ws.root): # <run>/telemetry/cost.jsonl
- record_call(res.usage, run=ws.slug, round=idx, stage="refine", role="generator",
- label=job.label, outcome=res.exit_reason) # one append-only JSONL row
-
-rows = load_ledger(ws.root) # telemetry/cost.jsonl
-summarise(rows).dimension("stage")["judge"].cost_usd
-```
-
-One row per call: `ts, run, round, stage, role, backend, provider, model,
-input/cached/output/thoughts tokens, cache_write, tool_calls, the three unit
-prices actually used, price_source + price_approximate + price_checked
-(provenance), cost_usd, recorded_usd, latency_ms, cache_hit, outcome, n_calls,
-source`. Writing never raises and never blocks a run; unknown models are
-recorded at $0 **and flagged**, never silently dropped.
-
-One helper exists for the callers:
-
-* `estimate_call(model_id, prompt=…, n_images=…, output_tokens=…)` →
- `CostEstimate` before the call (the `CostGuard` that decided on it had no caller and
- was deleted 2026-08-28). An unpriceable model is **allowed but flagged**
- (`price_source="unknown"`, $0) — refusing to run because we cannot price something
- would be worse than running it.
-
-## 11. Caveats
-
-* `plan`, `texture` and `pairwise` costs come from events that record a dollar
- but no tokens, so those rows have no token composition ($2.50 of $86.30).
- Wiring `record_call` at those call sites fixes it.
-* Wall clock per run is the sum of the stage/round clocks (the event span
- includes hours a bench run spent queued behind other runs). `budget.elapsed_min`
- is cumulative ACTIVE minutes: the budget snapshot carries `active_s` across
- `3dcode resume`, so prior sessions' minutes still count against `max_minutes`
- and downtime between sessions never does.
-* "Regression" waste is an upper bound: a round that scored worse still produced
- the diff that informed the next refine task.
-* The compare battery is only 2 prompts × 5 arms; its per-arm numbers are
- directional, not significant.
-* Prices were read from the providers' public pages on 2026-08-23 and are the
- standard, non-batch, global-endpoint tiers.
-
----
-
-# Part II — the controls (wave 2, 2026-08-23)
-
-Part I above is the audit: where $89.88 went. Part II is what was built on top of
-it and, for each item, **what it measured** — including the two things that turned
-out not to pay.
-
-## 12. The live ledger
-
-`codeverse3d.cost.instrument` meters the two places money is actually spent:
-
-* **`MeteredChatModel`** wraps everything `models.get_chat_model` hands out, so one
- `CallCost` row is appended per `ChatModel.generate` — planner, judges,
- captioner, texturing and single-shot generation.
-* **`MeteredAgent`** wraps everything `agents.get_coding_agent` hands out: it sets
- the ambient round/stage for the session (so the rows above land in the right
- bucket) and, for a backend whose calls we cannot see (claude-code / codex / agy; gemini-cli
- until D103), records one session row from `AgentResult.usage`.
-
- **Which backends those are is a property of the backend, not a guess.** The
- first version asked "did anybody write a ledger row while this session ran?"
- (a thread-local counter). That is wrong in both directions, and both were
- reproduced: a gemini-cli session during which *any* in-process tool billed a
- model — a texture pass, a captioner — looked metered, so its session row was
- dropped and **$1.23 of the reproduction vanished**; and an in-process session
- whose turns ran in a worker thread looked unmetered and was counted **twice**.
- Every shipped backend is a vendor CLI, so the session row is always written now
- (the `meters_own_calls` opt-out went with the last in-process agent), and
- `tests/cost/test_instrument.py` pins the dropped-session direction.
-
-**Attribution.** A call is filed under what *it* says it is, not under what
-surrounds it: `cost.context.attribute()` puts an explicit stage/role first, then a
-label that names a job of its own (`judge:…`, `planner`, `texture_gate`,
-`caption…`, `pairwise:…`), then the ambient agent session. A spatial tool that
-bills a model inside a refine session used to land on `stage=refine /
-role=generator`; it now lands on its own stage. A *generation* label still yields
-to the session, which knows more (best-of-N runs `job.kind="candidate"` while the retired api-agent's
-recorded turns were labelled `api-agent:baseline:tN`). A session row is filed by the task
-KIND through `cost.types.stage_for_label` (candidate → candidate, zone → zones, compose →
-assemble, rebuild → repair, asset / asset_fix → assets); before 2026-08-29 the scene kinds
-landed in `other`. Candidate generation sessions carry `stage=candidate` with labels
-`baseline_c<k>`; candidate judge money is booked `stage=judge`, and the pairwise tie-break
-`stage=pairwise` (its ledger row carries `role=judge`, label `pairwise:…`). Role, label and
-round live on the `CallCost` row — and since 2026-09-22 the guard keeps no money at all (§32).
-`audit.lost_candidate` counts
-generator sessions only, by their `baseline_c<k>` label.
-
-**Who opens a ledger.** `3dcode make` / `3dcode resume` (`cli.main._run_track`),
-`3dcode texture pass` (with `create=False`), **and the bench drivers** —
-`eval/bench/run_bench.py` opens one per prompt and `eval/bench/compare_backends.py` one per
-cell (plus a nested one for a harness arm's own run, and one for the pairwise
-arena). The batteries produce most of the runs in this repo, so until wave 3
-most priced rows were going to the per-process fallback log. `run_ledger` nests by holding
-ContextVar tokens (`bound_run` / `bound_ledger`); there is no process-wide default, so
-`--parallel N` keeps N ledgers apart. A thread that may bill a model must therefore be
-spawned through `proc.fan_out`, which copies the context — never a bare pool (D45(b): the
-old save-and-restore republished a sibling’s run the moment the first cell exited). A call
-with no run context still lands in the per-process log under `cache_dir/cost/`.
-
-The row carries run, round, stage, role, label, backend/provider/model, the four
-token counts, the three **unit prices actually used** plus their provenance
-(`price_source` / `price_approximate` / `price_checked`), $, latency,
-`cache_hit`, outcome and `n_calls`. Writing never raises and never blocks: a
-pricing failure logs and keeps the recorded dollar.
-
-**Where it lands.** `<run>/telemetry/cost.jsonl` (the run-layout telemetry bucket) — its
-one name since 2026-09-22: the root `cost_ledger.jsonl` and `telemetry/usage.jsonl` aliases
-are no longer written or read. A call made with no run context (a `3dcode judge`
-outside a run, a bench script, a notebook) goes to a per-process log under
-`<cache_dir>/cost/`. There is no off switch: the ledger is the only record of money (§32).
-
-**No double counting.** `MeteredAgent` / `MeteredChatModel` (and the image model's own row)
-are the one writer of `telemetry/cost.jsonl`, and `BaseTrack.run` opens the run ledger itself.
-The guard's own aggregate writer and its `per_call_metering()` sentinel were deleted
-2026-08-29, and its money on 2026-09-22 (§32).
-
-**Reading it.** `3dcode cost` (`addons/costreport/audit.read_run` / `read_cell`) and the run
-layout's `telemetry/cost.json` read `telemetry/cost.jsonl` and nothing else; a run without one
-has no rows. A run in a battery is named by its place under the audited path (`RunId`), so an
-A/B battery's control and variant cells of one prompt stay two runs (they shared one label
-while the name was the cell's last two path segments).
-
-### Verified on two fresh live runs
-
-| run | track / generator | rows | ledger | `record.total_usage` | difference |
-|---|---|---|---|---|---|
-| `verify_graphics` | graphics / api-agent flash | 12 | **$0.195275** | $0.195275 | **+0.000 %** |
-| `prof_chair_balanced` | static_object / api-agent flash | 55 | **$0.510770** | $0.510770 | **+0.000 %** |
-
-Both are well inside the 1 % target. The chair run also shows the audit's §6
-blindness closed: its retried `baseline.a2` session (6 calls, $0.046) is a
-first-class set of rows, and a model error mid-session is recorded as an
-`outcome="error"` row at $0 instead of vanishing.
-
-```
-3dcode cost <slug> # one run: stage/role/model + a reconciliation block
-3dcode cost --runs-dir <root> # a battery, aggregated
-3dcode cost cache <slug> # per session: cold first call, cached share, saved $ / cold $
-```
-
-## 13. Cache-friendly prompt ordering — measured, and REVERTED
-
-Wave 2 reordered the object-track generation prompts stable-prefix-first: the
-standing contract, the frame doc, the cookbook excerpt, the standing rules, the
-tool cards and the output format were hoisted into one shared include
-(`prompts/tracks/_object_head.j2`) that `generate_static.j2`,
-`generate_articulated.j2` and `refine_object.j2` each began with, byte-identical.
-
-**That include is gone (2026-08-23).** The head was not *shared* with anything
-already being sent — it was **duplicated into every prompt**, so the shared prefix
-it created was paid for four times over. Measured with `cost.prefix_report` on
-the real templates (one baseline + three refine prompts of one run, same context;
-the helper has been deleted since — `caching.py` keeps only the session-cache half):
-
-| | shared prefix | per-prompt tokens | mean per call |
-|---|---|---|---|
-| task-first (shipped, restored) | 46 tokens | 5,072 / 1,325 / 1,325 / 1,325 | **2,261** |
-| stable-head-first (reverted) | **4,970 tokens** | 5,110 / 5,211 / 5,211 / 5,211 | **5,186** |
-
-**+2,925 tokens on the average call, +3,886 on every refine call** — and the task
-prompt is message 0 of an agent session, re-sent on every turn, so the run-level
-figure is that times the session's turn count. Against it: the 4,970-token prefix
-is far below the **~12k floor** §4 measured for Gemini's implicit cache, so on a
-real run the first turn still reports `cached_tokens = 0`. The wave-2 note read
-the two arms as "≈ $0.00" run-level and kept the ordering as a free precondition;
-an independent re-measure showed the delta is not zero, it is a **net increase**,
-and the only arm that reached the cache floor did so by padding the head to 24k —
-i.e. by buying the cache block with more tokens than it returns.
-
-**Is there anywhere the prefix is genuinely long enough?** Measured, no:
-
-| candidate prefix, sent on every turn without duplication | tokens |
-|---|---|
-| api-agent system prompt (`AGENTS.md`, contract + cookbook note) | 4,879 |
-| its tool declarations (16 tools, JSON schemas) | 1,691 |
-| **total, already first in every request** | **6,570** |
-
-6.6k is still under the floor, and it is already at position 0 — there is no
-reordering left to do there. `3dcode cost cache <slug>` still reports
-what a run's sessions actually cached. The rule that measurement encodes: measure the prefix
-against the floor *before* reordering a prompt family, and never pad to reach it.
-
-## 14. The judge payload — 768 px saves bytes, not dollars
-
-Re-judged 8 recorded rounds (5 static / articulated, 1 threejs, 1 compare cell, 1
-shader) at 1024 px and 768 px, `gemini-3.1-pro-preview`, n=2 per size, detail
-crops held constant.
-
-**Payload per verdict** (1024 px): 3.0k–4.6k text tokens, 3–5 images, **311–714 KB**
-of PNG. At 768 px the same montages are **229–541 KB (−26 % bytes)**.
-
-| | 1024 px | 768 px |
-|---|---|---|
-| mean overall (8 rounds) | **0.6609** | **0.6536** |
-| sd across rounds | 0.0976 | 0.1079 |
-| mean within-round σ (n=2) | **0.0326** | **0.0421** |
-| **input tokens, 16 verdicts** | **156,834** | **156,874** |
-| total $ | $0.8779 | $0.8617 |
-
-Per-round Δ(768−1024): mean **−0.0074**, sd 0.0576, worst case −0.135
-(`e2e_cabinet_urdf`, where the 768 arm's own within-round σ was 0.155 — noise, not
-signal).
-
-The mean difference is inside the judge's noise, so by the pre-registered rule the
-cheaper size would be adoptable — **except that it is not cheaper**: Gemini bills a
-montage at the same tile count at both sizes (**+0.03 % tokens, not −20 %**), and
-768 px measurably *raises* sampling σ (0.0326 → 0.0421, +29 %). **1024 px stays
-the default for every profile.**
-
-### Payload v3 (D47, 2026-08-31): 5 montages for the 14-view rig
-
-The rig A/B (eval/docs/EVAL.md judge-experiments log) re-priced the verdict: the adopted
-payload C (14 views + clay, 5 montages + 2 crops) bills **$0.155/verdict at pro n=3
-(40.9k input tokens)** against the old 8-view payload's $0.146–0.150/30.0–34.0k — a
-+3–6 % price for the only payload change that has survived multiplicity (+0.038
-same-cap). The rejected 14-singles arm B cost $0.198 & 67.5k tok/verdict for a
-*negative* delta. `Settings.judge.montages` is 5 under every profile (economy included: the
-flash replica prices a C verdict at ~$0.032, and 3 montages would silently drop the
-low ring + poles).
-
-### Conditional slices (D48, 2026-08-31): the dirty verdict got CHEAPER
-
-The gate-ERROR-only slice channel (docs/DECISIONS.md D48) measured **$0.154/dirty
-verdict vs $0.172 baseline** (n=3, 3.1-pro, 14 conn-dirty rows) — the two extra
-small PNGs are outweighed by shorter narration — and a clean round's payload is
-byte-identical, so at production dirty ratios the channel amortises to **≤ $0**.
-The slice render itself is local CPU (shapely + matplotlib, a few seconds). No
-profile carries a dial for it; `C3D_JUDGE__SLICES=off` is the kill switch.
-
-### The crop-count experiment — INCONCLUSIVE, not adopted
-
-The other payload lever is the **image count**. The same round
-(`e2e_chair_blender` r01, `gemini-3.1-pro-preview`, n=1) was re-judged at 2 / 1 / 0
-detail crops **twice, independently**:
-
-| detail crops | input tokens | $/verdict (pro) | draw A overall | draw B overall |
-|---|---|---|---|---|
-| 2 (the default) | 9,454 | $0.0480 | 0.595 | 0.600 |
-| 1 | 8,255 | $0.0449 | **0.600** | **0.552** |
-| 0 | 7,058 | $0.0403 | 0.600 | 0.600 |
-
-One crop is **1,198 input tokens ≈ $0.0024/verdict**. Draw A read the 1-crop arm
-as unchanged and wave 2 adopted it for the economy profile; draw B read the same
-arm **0.048 lower** — **1.6× the pro judge's measured σ of 0.030** §8, and larger
-than the effect being claimed. Two draws that disagree by more than the
-instrument's noise measure nothing.
-
-**Not adopted.** No profile carries a crop count, and
-`Settings.judge.detail_crops` keeps its default of 2 — the previous image budget,
-restored. Buying a fifth of a cent per verdict is not worth a payload change we
-cannot show is harmless, and at n=1 per arm the experiment cannot show it: it
-needs ~n=8 per arm to resolve 0.048 against σ=0.030, which costs more than the
-change saves on the 112 verdicts in this data set. A caller that wants a smaller
-payload can still say so (`VlmJudge(detail_crops=…)` / `C3D_JUDGE__DETAIL_CROPS`);
-no profile says it for them.
-
-Both halves of §14 confirm §8's conclusion: on judging, the lever is *how many
-verdicts*, not how big each one is.
-
-## 15. Profiles — one name for the whole dial
-
-`Settings.profile` + `3dcode make --profile economy|balanced|quality` set model per
-role, judge samples, refine rounds, best-of-N width, the texture pass and the
-budget ceilings together (`codeverse3d/cost/profiles.py`).
-
-**One resolver, both entry points.** `codeverse3d.cli._common.resolve_dial` is the
-only place the dial is read, and it returns a `ResolvedDial` with every field.
-`--profile X` *forces* the dial over a value the user stated in `config.yaml` /
-`C3D_*`; `C3D_PROFILE=X` (or `profile:` in the config file) sets the same dial
-as a *default*, so a value you stated yourself survives it. With nothing else
-stated the two paths resolve **identically** — which they did not before: the CLI
-read `candidates` and `texture` off the *flag* rather than off the resolved
-profile, so `C3D_PROFILE=quality` silently ran best-of-1 with no texture pass.
-`tests/cost/test_profiles.py` asserts every field of the dial from both entry
-points, per profile. An explicit CLI flag still beats both, and
-`Spec.options.profile` now records the resolved name **whichever way it was
-given**, so `3dcode resume` reproduces it.
-
-| | economy | balanced | quality |
-|---|---|---|---|
-| generator | `single-shot:gemini:gemini-3.7-flash` | `agy:gemini-4-argon` | `agy:gemini-4-argon` |
-| judge | flash, n=2 | **pro, n=1** | **pro, n=3** |
-| refine rounds | 2 | 4 | 4 |
-| best-of-N | 1 | 1 | 2 |
-| agent turn cap | – (see below) | – | – |
-| judge payload | 1024 px, 2 crops | 1024 px, 2 crops | 1024 px, 2 crops |
-| texture pass | off | off | on |
-| ceilings | $1.50 / 30 min | $5 / 60 min | $8 / 90 min |
-| expected from the audit | ~$0.30/run | ~$1.47/run | ~$3.20/run |
-
-(balanced / quality expectations were measured on gemini-cli; the generator moved to agy on
-2026-10-13, D103, and they have not been re-measured on it.)
-
-Why these numbers: r01 buys a score point for $4.93 and r02 for $6.80 while r03
-costs $33.49 (§5), so economy stops at 2; the pro judge is *cheaper* than matching
-its precision with flash (§8), so balanced and quality both use it and only
-economy trades precision for price; best-of-2 and the texture pass are the two
-levers measured to raise a score, so they belong to quality.
-
-**Two dials wave 2 set were removed as unmeasurable (2026-08-23).**
-
-* **economy's 20-turn agent cap.** Economy's generator is `single-shot:`, which
- opens no agent session — the cap could never fire, and no recorded economy run
- shows it firing. The cap it was modelled on also lost its own A/B in this wave
- (§17: a 28-turn cap cost $0.02 more and 0.205 of a score point over 3 runs per
- arm), so there is no default cap anywhere now: no profile carries a turn cap
- and `tracks.generation.DEFAULT_AGENT_MAX_TURNS` is 0.
- `Settings.limits.agent_max_turns` / `C3D_AGENT_MAX_TURNS` remain the knob for a
- run or a machine that wants one by name.
-* **economy's 1 detail crop.** §14: two independent draws of the crop experiment
- disagreed by 1.6× the judge's σ over a $0.0024/verdict saving. Every profile
- sends the full payload.
-
-**`texture: false` now actually prevents the texture pass.** Three call sites used
-to answer "does this run texture?" independently — `Spec.options.texture`, a
-`texture` spec tag, `ctx.extra["texture"]` — and, worse, the `texture_pass` spatial
-tool is registered for every object track, so the coding agent could buy a pass in
-any run. That is why the quality run below shows a ledger 9.5 % above its record:
-the pass ran twice, once from inside a round-2 agent session.
-`codeverse3d.texturing.run.texture_requested(spec)` is now the single owner;
-the CLI hand-over after the run (`make`/`resume` → `addons.select.package`, which textures the
-PICKED round since 2026-09-22 — finalise no longer does) and the tool both ask it, and the tool refuses with a
-usage error (costing $0) in a run whose spec says no. `3dcode texture pass <slug>`
-is an explicit user instruction and is unaffected.
-
-### One live run per profile, same prompt
-
-`"a mid-century wooden dining chair with four tapered legs and a curved slatted
-backrest"`, static_object / blender, 2026-08-23 (during a flash 503 storm, so the
-minutes include provider backoff):
-
-| profile | baseline → final | rounds | cost | minutes | stop | judge |
-|---|---|---|---|---|---|---|
-| economy | 0.600 → **0.700** | 3 | **$0.3030** | 14.0 | max_rounds | flash n=2 |
-| balanced | 0.700 → **0.856** ✅ passed | 2 | **$0.5108** | 5.3 | pass | pro n=1 |
-| quality | 0.600 → **0.600** | 3 | **$1.8079** (ledger $1.9802) | 14.3 | diminishing_returns | pro n=3 |
-
-Every dial landed: economy really ran single-shot + flash at n=2 and stopped at 2
-refine rounds, quality really ran best-of-2 + pro at n=3 and shipped a texture
-pass (Δ materials +0.55, Δ overall +0.148 on the textured GLB). Economy came in
-at $0.303 against the $0.30 predicted from the audit; balanced at $0.51 against
-$1.47 (this prompt passed at round 1, the audit's median run does not).
-
-**The honest result is that quality lost this one**: it cost 3.5× balanced and
-finished 0.256 lower. Two mechanisms, both visible in the numbers — best-of-2
-picked a 0.600 baseline where balanced's single baseline happened to be 0.700, and
-a pro judge at n=3 has less noise to be lucky with (its three verdicts were
-0.600 / 0.600 / 0.600). **n=1 run per profile is an existence check, not an
-experiment**: it proves the dial is wired end to end, and it says nothing
-significant about which profile scores better. The audit's per-arm numbers (§8)
-remain the quality evidence.
-
-One number worth carrying forward: at `n=3` the judge is **31.5 % of that run's
-bill** ($0.62 of $1.98, 11 calls) against 6.0 % at `n=1` on the balanced run —
-§8's "keep the pro judge" is about *which* judge, not about how many samples of
-it, and `n=3` is a calibration setting, not a production one.
-
-Its ledger is also **$0.172 larger than `record.total_usage` (+9.5 %)**: the
-texture pass ran twice — once as a tool call inside the round-2 agent session,
-once post-loop — and the post-loop pass is outside the run total. The ledger made
-that visible per call instead of invisible (§6); the *second* pass should never
-have happened, and cannot now: `texture_requested()` is the single owner of the
-decision and the tool refuses in a run that did not ask (above). These three
-runs also predate the caveats above — they were run with the (now reverted)
-prompt reordering and with economy's 1-crop payload, so the economy row's judge
-payload and all three runs' prompt sizes differ slightly from what ships today.
-
-## 16. Price maintenance
-
-`3dcode cost prices` prints the table with provenance and now **flags** every row it
-cannot stand behind: `stale>90d` (checked date older than the window),
-`approximate` (the `Price.approximate` flag) and the non-`verified` statuses
-(`inferred` / `unverified`). `--stale` shows only flagged rows, `--days N` moves
-the window, `--unverified` keeps the old status filter. Today: 52 rows, 6 flagged
-(`claude-haiku-4`, `o1-mini`, `gpt-5-codex`, `gpt-5.1-codex`, `gpt-5.2-codex`,
-`gemini-2.5-flash-image`), none stale.
-
-Two tests hold the line: `test_supported_model_ids_resolve_to_a_price` (no
-silent $0 — every model id a default, route, CLI example or backend contract exposes
-must have a row) and
-`test_every_price_row_was_checked_within_the_maintenance_window` (re-read the
-providers' pages and bump `CHECKED`; never raise the threshold). Every ledger row
-carries the provenance of the price it used, so a dollar can always be traced to a
-row and a date.
-
-## 17. Two round-level controls that did not survive their own measurement
-
-Wave 2 landed four round-level controls. Two of them were re-measured, failed,
-and are gone; this section is the evidence, so nobody re-adds them from §5/§9.
-
-### The 28-turn agent cap — A/B'd, rejected, removed
-
-§4 counted 39.3 % of the agent bill at turn ≥ 20 and 19 of 33 long sessions cut
-off by their own budget, and estimated $14.29 net for a graceful 28-turn cap
-(`waste-and-accounting/turn_cap_report.txt`). That counterfactual assumed the
-turns past 28 buy nothing. A controlled A/B says they do:
-
-| arm | run 1 | run 2 | run 3 | **mean $** | **mean score** |
-|---|---|---|---|---|---|
-| `agent_max_turns=28` | $1.430 / 0.354 | $1.668 / 0.600 | $1.047 / 0.482 | **$1.381** | **0.479** |
-| uncapped (backend default) | $1.001 / 0.852 | $1.603 / 0.600 | $1.477 / 0.600 | **$1.360** | **0.684** |
-
-Same prompt (an articulated desk lamp), same generator
-(`gemini-cli:gemini-3.6-flash`), same judge (`gemini-3.1-pro-preview`),
-same budget and box; 3 runs per arm; scripts and run dirs in
-`verifier/ab_uncapped.py` + `verifier/live/vstatic_hard_lamp + vlamp_cap60*`. The cap **cost $0.02 more
-and 0.205 of a score point**: a session stopped at turn 28 leaves work the next
-round pays for again, and the wrap-up session it buys is not free either.
-
-So there is no default cap: `tracks.generation.DEFAULT_AGENT_MAX_TURNS = 0` leaves
-`AgentJob.max_turns` at the backend's own default. The plumbing stays for a machine
-that chooses one — `$C3D_AGENT_MAX_TURNS` > `Settings.limits.agent_max_turns` (the
-per-policy / per-task / `generate(max_turns=…)` knobs, never set by any caller, went
-2026-09-22) — and a cap that IS set still lands gracefully
-(wrap-up session, `generate.turn_cap` event). **Nothing sets one by default any
-more**: the profiles independently dropped their own caps in the same wave
-(`cost/profiles.py` carries none), so a cap now only exists when a
-run, a bench arm or `$C3D_AGENT_MAX_TURNS` asks for it by name.
-
-### `skip_judge_reason` — two of four branches removed
-
-A skip only saves money if the verdict is never bought. Reproductions were run
-out of tree (no such test ships here):
-
-| branch | verdict | why |
-|---|---|---|
-| `no file change` | **removed** | unreachable: a generation result is `ok` only when a file changed, so `run_generation_tasks` raises `RoundFailed` (→ the loop's `no_change` plateau) before any judge question is asked |
-| `build not repaired within the repair budget` | **removed** | a broken build never reaches the judge at all (`run_round` judges only when `build.ok`), so it only ever fired on a round that BUILT but still lint-failed — and the loop's `rejudge_round` then bought the same verdict one iteration later. Measured on the reproduction: 3 rounds "skipped", 2 verdicts re-bought as `judge.retry`, and the last round left **without a score — it was the best of the three (0.7)** and could not be promoted |
-| `budget already exceeded` | kept, then **removed 2026-09-22** | the loop's next `budget_ok` check ends the run, so the verdict was never bought later. Guard, not a measured saving: 0 of the 108 recorded rounds bought a verdict after the budget ended. Removed with the in-run best: a round's verdict is now what lets a pick choose it after the run, and the generation it scores is already paid for |
-| `no judge` / `no renders` | **kept** | pre-existing guards (nothing to buy). The third pre-existing reason, `gate errors` behind `judge_on_gate_errors=False`, went 2026-09-21: no caller ever set it |
-
-Two changes were needed to make the kept branches real:
-
-1. `rejudge_round` re-buys a verdict only after the judge was *tried* and failed
- or came back degraded — never one that policy deliberately skipped. Otherwise
- every skip is a `judge.retry` with the same price tag.
-2. `pick_best_round` never promoted a round that did not build. (Removed 2026-09-22 with
- the in-run best; `addons/select.pick` picks among JUDGED rounds only, so an unbuilt or
- unjudged round is never handed over by score.)
-
-The two controls that DID survive this correction — the regression "switch then stop"
-rule and the r03+ marginal stop, which cut 2 runs / **$1.14** with **0 best rounds lost**
-over the 107 recorded rounds (`waste-and-accounting/replay_stops.py`) — were **removed on
-2026-09-22** with every other judgement stop: the owner fixed the round count (baseline +
-`--rounds`, cut short only by the clock or a hard failure) and moved the choice of round to
-after the run.
-
----
-
-# Part III — throughput: using the 22 keys (wave 3, 2026-08-24)
-
-Parts I and II are about **money**. Part III is about **wall clock**: the owner has
-22 Gemini keys at 1 000 RPM / 1 000 000 TPM each and asked whether the harness rotates
-them and whether more parallelism would buy speed. It does rotate — `KeyPool` has done
-round-robin + per-key RPM buckets + 429 cooldown + dead-key benching since wave 1. The
-finding is that **rotation was never the constraint**: the pool was running at 0.7 % of
-its request quota and 1.6 % (median) of its token quota.
-
-Everything below is measured on this box (24 cores, 22 keys, `gemini-3.7-flash`), from
-the 6 014 live priced calls in `eval/bench/out/**` and three probes; the reusable one is
-`eval/bench/concurrency_probe.py`.
-
-## 18. The baseline: 3 % of the quota, and 17.7 h asleep
-
-| | measured | pool capacity | used |
-|---|---|---|---|
-| peak requests/minute | 154 | 22 000 | **0.7 %** |
-| peak prompt-tokens/minute | 4.00 M | 22.0 M | **18.2 %** |
-| median prompt-tokens/minute | 0.36 M | 22.0 M | **1.6 %** |
-| peak concurrent calls | 13 | 64 (§20) | 20 % |
-| mean concurrent calls | 2.05 | 64 | **3.2 %** |
-| 429s in 6 014 calls | 4 | — | all on one key |
-| 503 "capacity storm" waits | **2 833** | — | **17.72 h of thread time asleep** |
-
-Reconstructed per battery from `(ts, latency_ms)` in the cost ledgers — `mean_if` is
-the time-weighted mean of concurrent Gemini calls, `idle` the share of the span with
-none in flight:
-
-| battery | span | `--parallel` | calls | mean_if | peak_if | idle | model time | 503 sleep |
-|---|---|---|---|---|---|---|---|---|
-| static_v2_flash | 2.49 h | 3 | 4 453 | 2.57 | 10 | 5.3 % | 6.40 h | 1.65 h (504 waits) |
-| articulated_v2_flash | 5.95 h | 2 | 1 335 | 0.94 | 3 | 29.1 % | 5.60 h | 4.67 h (560) |
-| graphics_v2_flash | 1.10 h | 3 | 67 | 1.07 | 4 | 41.3 % | 1.18 h | 1.23 h (131) |
-| compare_v2_full | 1.41 h | 3 | 36 | 1.31 | 4 | 41.0 % | 1.85 h | 1.16 h (79) |
-
-Where a worker's time went, against the six candidates:
-
-* **our own thread pools — the dominant sink.** `max_parallel_agents=6`,
- `max_parallel_builds=3`, `bench --parallel 2`, `fan_out(max_workers=4)`: the harness
- never *asked* for more than 13 concurrent calls out of a measured ceiling of 64.
-* **the pool's RPM buckets — ~0.** 154 RPM peak against a 22 000 RPM bucket.
-* **provider 429 — ~0.** 4 events in 6 014 calls, all on one key, all rotated away free.
-* **provider 503 storms — 22 – 39 % of every battery's wall clock**, 17.7 h in total,
- ≈108 % of all model generation time. Model-wide, so rotation cannot help (§21).
-* **subprocesses — negligible for build.** 351 recorded blender builds cost **325 s in
- total** (mean 0.9 s, p50 0.2 s); a fresh build of a recorded `model.py` is 0.37 s.
-* **the model generating — 36 – 86 %** of worker time (p50 3.3 s, p90 14.5 s, p99 53 s).
-
-There is nothing to read from the provider: a live `POST …:generateContent` returns no
-`x-ratelimit-*` header at all, only `x-gemini-service-tier: standard`. Headroom has to
-be modelled from the quota, which is what `Settings.rate` now does.
-
-## 19. TPM, not RPM, is the binding limit
-
-Prompt tokens dominate completely — over the corpus, output + thoughts were **2 % of
-input** (243.9 M in vs 4.0 M out) — and a generator call averages **41 739 prompt
-tokens**. At that size 1 M TPM is ~24 calls/min per key (528 pool-wide) while the RPM
-quota would allow 1 000 per key. So the meaningful limiter is a *token* rate:
-
-* `KeyPool` had a `tpm_per_key` hook that was never set (`None`). It is now wired from
- `Settings.rate.tpm_per_key` (default 1 000 000) via `shared_pool`, whose registry key
- now includes the quota so two different quotas cannot silently share one set of buckets.
-* `acquire(tokens_hint=…)` **reserves** the estimated prompt tokens of the pending call.
- The estimate is `codeverse3d.models.retry.request_tokens`, a thin wrapper over
- `cost.guard.estimate_call` that walks the whole request (system prompt, tool schemas,
- response schema, tool results, a flat 1 290 per image).
-* `report(key, outcome, tokens=actual, reserved=hint)` **reconciles**: the bucket is
- charged `actual - hint`, so an over-estimate is refunded, an under-estimate is paid off
- (the bucket may go negative and is cleared by the next refill), and a call that never
- reached the model — 429 or capacity storm — gets the whole reservation back.
-
-That is what makes a 200 k judge verdict and a 2 k caption schedule differently, and §20
-shows it is not theoretical.
-
-**Deleted 2026-09-22: the buckets never engaged.** Every number above was measured while
-the in-process api-agent sent the generator's 42 k-token turns through this pool. Since it
-went (2026-08-28) the generator is a vendor CLI that makes its own calls and reserves
-nothing here, and the harness's own traffic is the planner, the judge, captions and
-texture images: over the cost ledgers 2026-08-29 .. 09-22 (2 080 Gemini calls, 11 084
-round-trips) the busiest key peaked at **39 k prompt tokens/min — 3.9 % of its 1 M TPM** —
-and **26 calls/min, 2.6 % of its 1 000 RPM** (re-counted on the ledgers on this box:
-2.7 % and 0.7 %). So the per-key RPM/TPM buckets, the reservation (`tokens_hint`,
-`request_tokens`) and its reconciliation, and `Rate.rpm_per_key` / `tpm_per_key` are
-gone; the pool rotates, cools a 429'd key down, benches a dead one and caps what is in
-flight (§20, §23). If a workload ever comes back that fills a key's quota, the 429 it
-earns is rotated away for free (§27) — that is the signal to measure again.
-
-## 20. The measured knee — and why one number is not enough
-
-`eval/bench/concurrency_probe.py` runs a fixed workload at several in-flight levels with a
-fresh `KeyPool` each time, so the `ok / 429 / 5xx` counters are exact deltas.
-
-**Generator-shaped (12 k-token prompt, 128 calls per level):**
-
-| in-flight | wall | calls/min | Mtok/min | mean_if | p50 | 429 | 5xx | $ |
-|---|---|---|---|---|---|---|---|---|
-| 16 | 259.8 s | 29.6 | 0.75 | 12.7 | 17.6 s | 0 | 32 | 0.71 |
-| 32 | 175.0 s | 43.9 | 1.12 | 24.5 | 28.6 s | 0 | 35 | 0.72 |
-| **64** | **105.4 s** | **72.9** | **1.86** | 24.6 | 13.4 s | 0 | 67 | 0.70 |
-| 128 | 162.9 s | 47.2 | 1.20 | 22.7 | 20.5 s | 0 | 41 | 0.71 |
-
-Throughput rises **2.5x** from 16 to 64 and falls back 35 % at 128 — the knee is 64.
-Cost per call is flat within ±2 % across the whole range: **concurrency buys wall clock,
-not money.**
-
-**Judge-shaped (200 k-token prompt, 32 calls per level):**
-
-| in-flight | calls/min | Mtok/min | 429 |
-|---|---|---|---|
-| 8 | 19.8 | 8.50 | 0 |
-| **16** | **46.8** | **20.05** | 2 |
-| 32 | 29.5 | 12.66 | 3 |
-
-429s appear exactly where the arithmetic predicts: 16 x 200 k ≈ **20.0 M prompt-tokens
-per minute against a 22 M pool quota** — a direct confirmation of the 1 M TPM per key
-(measured onset ≈ 0.91 M/key) and the reason a single fixed concurrency number is wrong:
-*the same in-flight count that is 3 % of quota for a caption is 91 % of it for a judge
-verdict.* The TPM buckets, not a call counter, are what keep the big-call regime honest.
-
-**The subprocess ceiling is a different, much lower number.** 32 replays of a recorded
-blender `model.py`:
-
-| workers | 1 | 4 | 8 | **16** | 24 | 32 |
-|---|---|---|---|---|---|---|
-| builds/min | 155.9 | 590.3 | 1 051.7 | **1 392.0** | 1 167.6 | 1 018.7 |
-
-Knee = **16 concurrent blender builds** on 24 cores. Headless-Chrome renders could not
-be measured cleanly (12 distinct GLBs at 1 – 12 workers, forwards and backwards, gave
-2.5 – 220 renders/min with single renders from 1.5 s to 153 s): that variance is the
-renderer's own tail, not parallelism. Renders are treated as "1.5 – 3 s typical with a
-minutes-long tail" and the subprocess pools are sized from the clean build number.
-
-**64 model calls vs 16 subprocesses is 4x apart, so the two are capped separately:**
-`Settings.rate.max_in_flight` is the number of machine-wide in-flight slots `KeyPool` takes
-(network-bound, provider-sized — §23), `Settings.limits.max_parallel_*` size the thread pools
-(CPU-bound, core-sized).
-
-### Defaults changed, each from a number above
-
-| knob | was | now | basis |
-|---|---|---|---|
-| `Rate.tpm_per_key` | *(unset)* | 1 000 000 | owner's quota; 429 onset measured at ~0.91 M/key |
-| `Rate.rpm_per_key` | 900 | 1 000 | owner's quota (never binding: 0.7 % used) |
-| `Rate.max_in_flight` | *(none)* | 64 | §20 knee |
-| `Limits.max_parallel_agents` | 6 | 12 | build knee 16, derated for the render tail |
-| `Limits.max_parallel_builds` | 3 | 8 | build knee 16 |
-| `bench --parallel` (both drivers) | 2 / 3 | 8 | a cell holds ~0.9 calls in flight → 8 cells ≈ 7, far inside the 64 knee |
-| `fan_out(max_workers=…)` fallback | 4 | 8 | inside both knees (every real caller states its own) |
-
-## 21. Making 503 storms cheap: one shared wait instead of thirty
-
-A 429 is per key and rotation cures it. A 503 *"this model is currently experiencing
-high demand"* is **model-wide**: every key sees it at once, so each worker that meets a
-storm independently spends a full failed round-trip to learn what its siblings already
-know, then sleeps on its own private backoff schedule. That is the 2 833 waits / 17.7 h
-in §18.
-
-`codeverse3d/models/retry.py` added a process-wide `StormGate` per model (deleted 2026-09-22, below):
-
-* the first worker to see a 503 calls `hit()`, which closes the gate for a short,
- escalating window (never longer than `MAX_WAIT_S` — patience comes from the *number*
- of waits, not the length of one);
-* every other worker parks in `enter()` instead of issuing a call that is almost
- certain to fail;
-* once the window elapses exactly **one** worker is let through as a probe, under a
- lease so a crashed prober cannot wedge the gate. Its success (`ok()`) reopens the
- gate for everybody.
-
-It never adds waiting when no storm is running. **And it lost its own A/B, so it ships
-OFF.** Same workload (48 calls, 32 in flight, 12 k prompts), alternated to control for
-drift in the provider's mood:
-
-| round | gate | wall | calls/min | mean_if | p50 | max | 5xx attempts | parked |
-|---|---|---|---|---|---|---|---|---|
-| 1 | off | 96.0 s | **30.0** | 14.27 | 25.8 s | 71.0 s | 18 | — |
-| 1 | on | 158.3 s | 18.2 | 5.54 | 11.7 s | **158.2 s** | 27 | 140 s |
-| 2 | off | 63.4 s | **45.4** | 13.20 | 15.6 s | 63.4 s | 6 | — |
-| 2 | on | 144.1 s | 20.0 | 9.92 | 16.0 s | **142.8 s** | 20 | 100 s |
-
-The gate costs **45 – 56 % of throughput**, consistently, and the two columns that
-explain why are `5xx` and `max`:
-
-* it produced **more** 503s, not fewer (27 vs 18, 20 vs 6) — the opposite of its purpose.
- A gate that reopens on one probe's success releases all 31 parked workers at the same
- instant, and that thundering herd is exactly the burst the provider was 503-ing.
-* median latency **improved** (11.7 s vs 25.8 s in round 1 — parking really does spare a
- worker some doomed round-trips) while the maximum blew out to the whole run length:
- with one probe at a time, whichever call keeps losing the race is starved.
-
-Underneath both is the same misreading: Gemini's 503s here are **intermittent, not an
-outage** — most calls succeed while some 503 — so treating the first 503 as "the model
-is down" parks 31 healthy workers for nothing. A shared signal only pays when the
-failure really is all-or-nothing.
-
-The A/B was run during *intermittent* 503s, which is what the logs show most of the
-time. A single sustained outage is the case the gate was designed for and is not
-covered by this measurement — that is why the mechanism is kept rather than deleted.
-So `Settings.rate.storm_gate` defaulted to **False**, and the mechanism was kept so the
-experiment stayed reproducible — until 2026-09-22, when it was **deleted**: §27 made a
-storm mean "every key in the pool 503'd inside this one call", so the gate could close
-only after a whole pool's worth of failed round-trips, and in four weeks shipped OFF
-nobody switched it on.
-
-**Caveat on the knee under a storm.** §20's knee optimises *throughput* — total calls
-per minute. A bench cell is judged on *latency* instead: it has a `--max-minutes`
-budget, and under the sustained 503 storm of 2026-08-24 03:00–05:00 one planner call
-took **2 218 s** and cells hit the old 45-minute ceiling before producing code. When
-the provider is capacity-limited, extra concurrency cannot add throughput but does add
-per-cell latency, so a long battery run in that state wants a *bigger time budget*
-(`--max-minutes 180`), not a smaller `--parallel`.
-
-What *did* make storms cheap is smaller and already in the retry loop: no single wait
-may exceed `MAX_WAIT_S` = 3 s (5 s until 2026-08-27; patience comes from the number of attempts, 60 of them),
-so a storm no longer blocks a worker for minutes — and with `--parallel 8` and
-`max_in_flight 64` the other seven cells keep working through it. Deferring a
-storm-hit item to the back of the queue was **not** built: at the gate-off settings a
-whole 128-call level costs 6 – 35 storm attempts and **zero failures**, which does not
-justify a scheduler rewrite in `fan_out`.
-
-`3dcode doctor --live` prints the pool's live picture — keys, in-flight and peak in-flight,
-429/5xx/dead counts this process.
-
-## 22. The retry budget was counted in attempts, so a "90-minute" run took 200
-
-Two independent bugs let a single provider outage burn hours of paid wall clock on
-2026-08-24. Both are cost-control failures, not model failures.
-
-**The storm budget was never a time budget.** §21's storm branch is bounded by
-`storm_attempts = 60` with each wait capped at `MAX_WAIT_S`, and its docstring claimed
-patience of "60 × ≤5 s ≈ 5 min". It never counted the read timeout each doomed
-attempt burns first: with `model_timeout_s = 300`, one logical call is
-60 × (300 + 5) s = **5.1 hours**. Measured on a fake clock, a call in a sustained
-storm consumed **5.59 h**; with the deadline it consumes **15.1 min**:
-
-| | one call in a sustained storm |
-|---|---|
-| attempts-only budget (before) | 5.59 h |
-| `RETRY_DEADLINE_S = 900 s` (after) | 15.1 min |
-
-`rotate_with_retries` now takes `max_total_s` and stops retrying once the wall clock
-says so, in both the storm branch and ordinary backoff. A slow call that is *making
-progress* is never cut — the deadline bounds retrying, not the call. Past it the cell
-is `infra_failed`, which is excluded from every rate and re-runnable with
-`--redo-status infra_failed` (`eval/docs/EVAL.md` §7).
-
-**The wall-clock ceiling is only checked when money is spent** (so it was then; since
-2026-09-22 the guard has no money path — `check()` runs at the loop head, after each agent
-session that did work, at each generation phase's end and before a session or a single-shot
-call is bought). `BudgetGuard.check()` was called from `spend()`/`charge()`, so a run whose calls never *complete* is never
-tested against `max_minutes`: nothing is billed, so nothing is checked. That is how a
-`--max-minutes 90` run reached **200 minutes**. The retry deadline is the root fix —
-every call now terminates within ~15 min and charges or raises, so the ceiling is
-evaluated again — but the residual remains real: **`max_minutes` is enforced at
-billing points, not on a timer.** Closing it properly means giving the runner a
-reference to the guard and checking at stage boundaries; not done here, because it is
-plumbing through several layers and deserves its own measured change.
-
-## 23. The key pool was per-PROCESS, so N batteries multiplied the quota by N — the slots are machine-wide now
-
-§20 measured the concurrency knee at 64 in-flight and shipped it as the default. That
-number was measured with **one process and nothing else running**, and the limiter it
-configures is per-process by construction:
-
-```python
-_pools: dict[tuple[str, ...], KeyPool] = {} # codeverse3d/models/gemini.py — MODULE level
-def shared_pool(...): """One KeyPool per distinct (key list, quota) so limiters are process-wide."""
-```
-
-Process-wide is not machine-wide. Every `bench/run_bench.py`, every `compare_backends.py`
-and every `3dcode make` is its own OS process with its own pool, each believing it owns the
-whole 22-key quota and each allowing its own 64 in-flight. On 2026-08-24 six batteries
-from different waves ran at once: **~384 concurrent calls against a quota sized for 64**.
-
-What that did, measured on the same keys and the same model within 15 minutes:
-
-| condition | `gemini-3.7-flash` trivial call |
-|---|---|
-| ~15 of our processes running | **0 / 8 succeeded** |
-| machine quiet (we killed everything) | **3 / 12 succeeded** (25 %), 7.4 – 25.5 s |
-| machine quiet, `gemini-3.1-pro-preview` | **4 / 4 succeeded**, 3.1 – 29.7 s |
-
-Read it honestly, in both directions:
-
-* **The provider really was degraded.** 25 % success at four concurrent trivial calls is
- not something we caused, and pro was healthy on the same keys at the same moment, so
- this was flash-specific capacity on Google's side — not our key quota.
-* **Our own concurrency turned a degraded service into a total outage.** 0/8 under load
- versus 3/12 quiet is the same model, same keys, minutes apart.
-
-Three consequences:
-
-1. **The knee is a per-process number and must be divided by the number of concurrent
- harness processes.** Running six batteries at `max_in_flight = 64` is asking for
- 6 × the concurrency the sweep found optimal — well past the point where §20 measured
- throughput *falling* (128 in-flight was worse than 64).
-2. **It reframes §21's negative result.** The StormGate lost its A/B, and the conclusion
- was "gemini's 503s are intermittent, so parking is a waste". But that A/B ran inside
- ONE process while five other batteries kept hammering: a per-process gate can neither
- see nor slow the traffic actually causing the storm, so the polite process paid the
- latency and its siblings took the capacity it freed. The gate was measured in a
- setting where it could not win. Its negative result stands for the configuration
- tested and should NOT be read as "back-pressure does not help".
-3. **The operational rule until 2026-09-22** was to keep the SUM of `max_in_flight` across
- every harness process at or below the knee (64), with `health.pool_budget()` reading each
- sibling's cap out of `/proc/<pid>/environ`. It was advice — `eval/bench/ab_plan.py`
- refused to start on it, `3dcode make` and `bench run` never looked — and it guessed
- siblings from argv against a hard-coded list of eval entry points, which missed
- `python -m bench.ab_plan` for a day, missed every pip console script for longer, had
- to learn not to charge an ab_plan driver for its children, and could not see a process
- whose cap was unparsable.
-
-**Machine-wide slots (2026-09-22).** `max_in_flight` is now N lock files,
-`<cache_dir>/slots/gemini/00.lock …`, and a harness API call holds one with
-`fcntl.flock(LOCK_EX | LOCK_NB)` for exactly as long as it is out (`models.retry.Slots`,
-taken inside `KeyPool.acquire` / `try_acquire`, handed back by `release`). Every process
-draws from the same files, starting its sweep at a random slot, so the machine never has
-more calls in flight than the largest N any process runs with, and a process with a smaller
-N only ever uses its own first N. A process that finds every slot busy waits inside the
-call's own budget; nothing refuses to start any more, and the `/proc` scan, its entry-point
-lists and ab_plan's admission check are gone. ab_plan still pins both children to its
-`--max-in-flight` (16 by default) — the two arms now share those 16 slots.
-
-What a slot guards is one harness API call — planner, judge, caption, texture image,
-single-shot generation — the unit §20 measured. A vendor CLI session takes its key from the
-same pool (rotation, cooldowns, the dead-key bench) but no slot: a session is minutes of
-agent time, and 64 of them holding slots would starve every judge and planner call on the
-box. Their concurrency stays bounded per process by `Limits.max_parallel_agents`.
-
-The deferral this section used to end on was about staleness — a crashed holder stranding
-its share of a file-locked bucket. flock has none: the kernel drops the lock when the
-holder's descriptors close, SIGKILL and the OOM killer included (`proc.exclusive` relies on
-the same property). `tests/models/test_slots.py`, six runs on this box: 8 processes × 6 holds
-× 0.15 s on 4 slots peaked at exactly 4 in flight (mean 3.84 – 3.93, wall 1.83 – 1.87 s
-against a 1.80 s floor); caps of 2 and 4 in one directory peaked at 4 together and 2 among
-the N=2 processes; a slot held by a SIGKILLed process came back 37 – 70 ms after the kill
-(one 50 ms poll); 12 threads of one process on 3 slots peaked at exactly 3; with every slot
-held elsewhere a waiter gave up at 0.000 s and 0.300 s for deadlines of 0 and 0.3 s.
-`3dcode doctor` prints the `in-flight slots` row: how many are busy machine-wide right now.
-
-## 24. A preflight probe must look like the work it is guarding
-
-The §23 preflight passed `gemini-3.7-flash` and the battery immediately lost its first
-two cells — `infra_failed`, 15.1 and 15.3 min, $0.00 generated. The gate was wrong in
-two independent ways, both now fixed, both worth stating because they generalise to any
-health check in front of a batch job.
-
-**1. The probe was five tokens; the work is twelve thousand.** During this degradation
-a trivial prompt answered while the planner calls beside it were still 503-ing — the
-fidelity wave observed the same thing independently. Re-measured at workload size
-(~10 k tokens), the same service that looked fine on tiny prompts is not:
-
-| model | trivial prompt | ~10 k-token prompt |
-|---|---|---|
-| `gemini-3.7-flash` | 4 / 4 | **4 / 6** |
-| `gemini-3.1-pro-preview` | 4 / 4 | **4 / 6** |
-
-`probe` now sends `PROBE_TOKENS = 8000` of filler and still asks for a one-word answer,
-so it costs input tokens — the thing under test — and about $0.003 per preflight.
-
-**2. The bar was 50 %, which for a pipeline means zero.** A preflight guards a
-BATTERY, and one cell is dozens of model calls that must all land: at per-call success
-p a 20-call cell completes with p²⁰, so p = 0.5 is not "half healthy". Retries soften
-it to roughly p ≥ 0.7 for a coin-flip chance at a cell, so `DEFAULT_MIN_OK` is now
-**0.75** over `DEFAULT_SAMPLE = 6`. The asymmetry settles the tie: refusing wrongly
-costs one 2-minute re-probe, starting wrongly costs hours. This one is a judgement
-call, not a measured optimum, and it is written here so it can be revisited with data.
-
-What did work, in production, on those two lost cells: they were recorded
-`infra_failed` with `score=None` rather than a hard 0.0 (§7 of `eval/docs/EVAL.md`), and the
-retry deadline (§22) stopped each at ~15 min instead of the 56-87 min the same cells
-burned earlier the same morning.
-
-## 25. List price is not the bill, and a subscription costs none
-
-`Usage.cost_usd` answers *"what would these tokens cost at list price?"*. That is the
-right number for a report, a $/complexity point, or a flywheel record — it is comparable
-across backends and independent of who is paying. It is the wrong number to call a bill,
-because a backend on a flat-rate local subscription bills no dollars.
-
-The harness had exactly one number and used it for both.
-
-**Measured 2026-08-25**, `tsr_scn_temple_night`, `codex:gpt-5.6-sol`, `--profile
-quality`. The two Blender hero-asset sessions were priced at OpenAI list rates
-(`agents/codex.py` → `estimate_cost("openai", …)`) and the run crossed the profile's
-soft cap 6.8 minutes in:
-
-```
-budget.degraded cost $7.712 exceeds soft cap $4.40 (55% of $8.00)
-asset.judge_skipped BronzeCenser reason=soft_budget
-asset.judge_skipped StoneLantern reason=soft_budget
-```
-
-Both heroes went unjudged and every later stage ran degraded — over a bill of **$0.00**.
-The run's own cost ledger said $0.00 the whole time; `PROVIDER_PRICED_BACKENDS` and
-`meters_own_calls()` had already got the ledger side right. Only the guard disagreed
-with it, and the guard is the half that changes what the run does.
-
-**The split.** The ledger and the reports keep pricing everything; the budget enforces
-only what is billed. `cost/billing.py` names the flat-rate backends
-(`SUBSCRIPTION_BACKENDS` = codex, claude-code, agy, antigravity — `CLAUDE.md`
-"Environment" is the source of that list), and `BudgetGuard` accumulates a second
-counter, `billed_usd`, alongside `spent.cost_usd`. `summary()` reports both:
-`spent_usd` (billed, real dollars) and `notional_usd` (list price, what the reports want).
-
-`gemini-cli` (removed in D103; agy in Gemini-API mode is the same case today) is deliberately **not** exempt: it authenticates with an API key, so its
-tokens draw on a real per-token quota even when that quota is free. Unknown backends
-bill by default — a new provider nobody classified must be enforced, not exempted.
-Getting it wrong the other way reports a run as free when someone was billed for it.
-
-The corollary for benchmarking: an arm on a subscription backend and an arm on an API
-backend do not bill comparably, so compare them on `notional_usd`, never on `spent_usd`.
-
-> **2026-09-22 — the split is gone with its reader.** Nothing enforces dollars any more (the
-> USD ceiling went in fbf89a5), so `billed_usd` and `cost/billing.py` fed nothing; the guard is a
-> clock and the record's money is the ledger at list price (the owner: 账本合计,按标价), a
-> subscription backend's rows included — which is what an arm comparison wants anyway (§32).
-
-
-## 27. A 503 is per key at any instant — rotate before you wait (2026-08-26)
-
-The retry path treated Gemini's *"This model is currently experiencing high demand"* (503) as
-model-wide: no rotation, a ≤ 5 s sleep per storm attempt (60 of them), the 900 s per-call
-deadline — and, when the gate was on, every worker in the process parked. Measured with one
-tiny request per key fired in parallel, three rounds 20 s apart, in the middle of the day's
-storm: `gemini-3.7-flash` answered on **15/22, 18/22 and 21/22 keys** while **5, 4 and 1**
-keys returned 503 at the same instant (successful latencies 1.3–38 s; the slow ones were the
-same few keys). So at any moment most keys work and the next key is the cure.
-
-`rotate_with_retries` adds the 503'd key to the call's failed set and rotates to a fresh key
-for free (no sleep, no budget, no `max_attempts`) — **exactly the 429 rule: while an untried
-key remains, rotation is free**. It is a storm, and the bounded wait budget applies, only
-once **every** key in the pool has 503'd inside one logical call (a 22-key pool rotates 21
-times first). What this buys per call is the whole storm wait it used to pay first (median
-5 s × the storm streak, up to 900 s); what it costs is one more round-trip on a fresh key.
-Follow-ups worth measuring: rank keys by recent latency (the 30 s keys are consistent), and
-record the key index in `telemetry/cost.jsonl` so the distribution of calls per key can be
-read instead of probed.
-
-**Amended 2026-08-27 (owner's rule):** the first cut of this gated the rotation behind a
-`storm_quorum` of 6 distinct 503'd keys — so a 22-key pool stopped rotating and started
-sleeping with 16 keys untried. The probes above say only **1–7 of 22 keys** are 503 at any
-instant, and the 2026-08-26 logs carry **548 "capacity storm" lines with 0 429s**: the pool
-had spare quota the whole time and the waits were pure loss. `storm_quorum` is gone; the
-guard is now `len(failed_keys) < len(pool)`.
-
-
-
-**Follow-up, same day, from the time audit (51 storm-day runs vs 52 baseline; scripts retired 2026-08-28 — findings summarised in §28 below).**
-Three accelerations, all additive and on by default:
-
-*A caller clips the retry budget to what it can afford* (`ChatRequest.max_wait_s`, None = the
-model's `RETRY_DEADLINE_S`). Of the 246 297 s a storm-day run spent waiting on the provider,
-**30 % (72 921 s) was 66 `model_error` spans** in which one call retried until the 900 s deadline —
-median span 923 s, p90 2 743 s, i.e. three consecutive give-ups on ONE agent turn through
-`api_agent.MODEL_RETRIES`; 45 sessions were hit, **~1 430 s per run**. `GeminiModel` now passes
-`max_total_s = min(900, max_wait_s)` to `rotate_with_retries`. An agent turn asks for
-`max(20, min(120, session time left))` (a successful storm-day call is 8.3 s p50 / 31 s p90) and
-stops retrying once the session deadline has passed instead of sleeping 2 + 4 s past it (97
-sessions overshot their timeout by 182 s median / 1 154 s p90); a judge sample gets
-`SAMPLE_BUDGET_S = 240` for all its attempts (the verdict is 42 s p50 / 73 s p90, 50 / 103 s under
-the storm; two rounds lost 1 162 s and 927 s to 3 × 300 s timeouts before a second sample answered
-in 128 s); the planner 300 s (13.7 s p50 / 32 s p90, max 76 s; the storm-day plan stage waited
-492 s median for 39 s of model time). Anthropic / OpenAI honour the same `max_total_s =
-ChatRequest.max_wait_s` (clipped to `RETRY_DEADLINE_S`) and a raised `ModelError` carries
-`attempts` on every provider: since 2026-09-22 they run `rotate_with_retries` itself over a
-fresh one-key pool (`parts.retry_one_key`: no cooldown, no storm patience, no hedge — the
-same `max_attempts` × ≤ 3 s backoff their own `with_retries` loop gave them, now deleted).
-
-
-*The retry of a 503 is hedged across keys* (`rotate_with_retries(hedge=2)`; `Settings.rate.hedge`,
-`C3D_RATE__HEDGE=1` for the A/B). Logged sleep was only 645 s per cell median — **13 % of the
-wait**; `(wait − sleep) / storm lines` = **21.5 s per failed attempt** (p90 28.5, ~50 s late in a
-storm): the cost of a 503 is the round-trip the provider holds before rejecting, not the ≤ 5 s
-backoff. Storm streaks average **4.7 attempts** (1 101 episodes / 5 143 lines). From a call's
-first 503 on, every further attempt is issued on two distinct fresh keys at once — the extra key
-from `KeyPool.try_acquire`, never waited for, each request holding its own `max_in_flight` slot —
-and the first success is returned; a loser finishes its own round-trip, reports its outcome to
-the pool (a late success still reports its tokens) and releases its slot; when both fail it is
-ONE storm attempt. Expected rounds per streak drop from ~4.7 to ~1.7, i.e. ~60 % of the retry
-wait: **≈ 930 s/run blender, 1 400 s threejs, 600 s cadquery, 450 s graphics**. A 503 bills
-nothing, so the hedge is free while it storms; only a success-then-success wastes one call
-(cents for a chat turn — `GeminiImageModel` keeps `hedge=1` because an image is billed per image).
-
-
-*The ledger records the key and the attempt count.* `keys.py` scanned 1 542 files of the corpus
-for the `"key": "…xxxx"` that `gemini.py:_once` puts in `ChatResponse.raw` and found none, so
-"is one key hammered" was unanswerable. `rotate_with_retries(stats=)` hands back `attempts`
-(round-trips issued, hedged siblings included; 1 = clean) and `hedged`; `GeminiModel` puts
-`attempts` in `raw` and on the raised `ModelError` (`hedged` stays in the stats); `cost/instrument.py` copies the key suffix
-(last 4 chars, never more) and `attempts` onto every `CallCost` row (`key`, `attempts`, both
-defaulted so old rows load); `3dcode cost` adds a per-key table and a
-`tries/call` column (`CostBucket.attempts_per_call`) whenever the ledger carries them.
-
-## 28. Where the time goes — the 2026-08-26 audit
-
-51 storm-day runs against 52 baseline runs, every stage and every model call, scripts in
-`bench/time_audit/` (read-only over `bench/out`; a one-off, deleted 2026-08-28). The numbers that decide what to build next:
-
-* A blender object run is **1 811 s** median on a healthy provider and **4 726 s** under the storm;
- build + gates + render together are 3–19 % of a baseline run and 1–4 % of a storm run. The
- agent session is where the time is: baseline 57 % model thinking / 11 % tools / 32 % waiting;
- storm day **22 % / 2 % / 77 %**.
-* Waiting is not the backoff sleep. Logged sleeps are ~13 % of the wait; a failed 503 costs a
- **21–50 s held round-trip** before the provider rejects it, and streaks average 4.7 attempts.
- **30 % of all storm-day waiting (72 921 s) is 66 give-up spans** — one call retrying to the
- 900 s `RETRY_DEADLINE_S`, up to three times per turn through `api_agent.MODEL_RETRIES`,
- never clipped to the session's or the round's remaining budget. 18 of 51 storm runs ended
- with zero rounds; 14 of them overshot the bench ceiling by 837 s median because the ceiling is
- only checked between stages.
-* Successful calls are also slower under the storm: flash p50 3.3 → 8.3 s, p90 17 → 31 s; the
- judge (pro) p50 42 → 50 s. The judge is not the bottleneck at the median; its tail is
- (2 rounds lost 1 100 s each to three 300 s read timeouts). The planner waits 492 s median
- per storm-day run for 39 s of model time.
-* No telemetry row records which key served a call, so per-key distribution was unanswerable
- from the corpus (the §24 probe answered it directly).
-
-Ranked by measured seconds per storm-day run: (1) clip the per-call retry budget to the
-remaining session / round budget (~1 430 s/run) — (2) hedge a 503 retry across 2–3 keys
-(~900–1 400 s/run) — (3) hedge / cap the planner and judge calls (~400 s/run + the judge tail)
-— (4) plan cache on re-runs (548 s) — (5) no sleep on 503 (≤ 13 %; landed with §24) — (6) enforce
-the ceiling inside a round (837 s sooner on killed runs) — (7) flash as the loop judge (~60 s
-baseline) — (8) 30 s render cap (≤ 100 s). (1)–(3) and the key/attempt ledger fields landed the same afternoon (§27's follow-up paragraphs).
-
-**Addendum 2026-08-27 — the render tail's root cause.** The 30–100 s renders (and the 330 s
-timeouts) were never rendering: node's own `timing_ms` reported ~0.55 s for the same GLBs while the
-Python wall clock read 100+ s, and 8 concurrent renders finished in 1.0 s total. The cost was a
-**wedged shared browser**: the daemon's Chrome degrades after hours alive (WSL GPU decay + WebGL
-pages leaked by SIGKILLed clients — every render timeout leaks one), and then *every* CDP roundtrip
-(`newPage`, `page.close`) stalls ~100 s while the heartbeat keeps it alive forever. Fixed in
-`runtime_js/`: (1) `gpu_launch.cjs` connect canary — one bounded `pages()` (6 s) per connect; an
-unresponsive or overgrown (>12 pages) browser is poisoned and a fresh daemon spawned (~1 s once,
-measured: leak 14 pages → next render 3.5 s, then 0.7 s steady); (2) `browser_daemon.cjs` reaps
-pages older than `C3D_PAGE_TTL_MS` (default 8 min > every harness ceiling); (3) cleanup steps in
-`render_glb.mjs` / `host_page.mjs` are time-bounded (≤3 s each) — the record is on disk before
-cleanup runs. Step-level stderr breadcrumbs (`[render_glb] <step> +ms`) stay in for the next audit.
-
-## 29. Fewer turns — first turn read out (`C3D_FEWER_TURNS`, `turns_v1`, 2026-08-26)
-
-Six blender prompts, plan-pinned pairs, flash, 3 rounds, storm afternoon; variant = `build` folds
-connectivity + contract in, `write_file` returns a lint verdict, refine inlines ≤ 3 files, the
-baseline prompt asks for every file in turn one.
-
-| prompt | score off → on | sessions | flash calls | model s | wall s | $ |
-|---|---|---|---|---|---|---|
-| dining_chair | 0.946 → 0.969 | 6 → 6 | 177 → 96 | 1327 → 731 | 1459 → 1716 | 1.66 → 1.08 |
-| hand_drill | 0.600 → 0.528 | 6 → 15 | 142 → 272 | 1498 → 3343 | 1991 → 3068 | 1.82 → 3.16 |
-| coffee_grinder | 0.937 → 0.600 | 7 → 3 | 291 → 100 | 2505 → 1225 | 5190 → 3528 | 2.54 → 1.50 |
-| machinist_vise | 0.576 → 0.600 | 6 → 10 | 183 → 170 | 1427 → 1495 | 2648 → 2116 | 2.28 → 2.19 |
-| spiral_stair | 0.961 → 0.750 | 3 → 2 | 83 → 66 | 631 → 510 | 1534 → 1268 | 1.22 → 1.04 |
-| drafting_table | 0.600 → 0.928 | 7 → 3 | 223 → 77 | 1338 → 432 | 3026 → 899 | 2.51 → 1.21 |
-
-Paired, n=6: score **−0.041** (sd 0.229, sign 3/6 — inside the 0.202 floor); variant/control
-ratios **calls 0.81, model time 0.91, wall 0.89, cost 0.88**. Per session the variant spends
-~25 % fewer turns and never calls `check_connectivity` / `check_contract` (build carries them),
-but the number of refine sessions per run is what moves the total (6 → 15 on the drill, 7 → 3 on
-the table): the fan-out is decided by how many refine targets the judge and the folded-in gate
-findings produce, not by the switch. The two 0.6 results on the ON arm are `missing_must`
-caps — sessions that finished earlier and verified less. `read_file` did not drop (41–47 on
-the vise / drill): the reads are of *other* part files, which the ≤ 3-file inlining does not
-cover.
-
-Verdict: stays **OFF** by default. Keep the two mechanical pieces (checks folded into `build`,
-the write verdict) — they cost nothing and remove a class of turn; the next turn of this loop
-caps refine fan-out per round and inlines the whole part set under a size budget, and A/Bs the
-turn-discipline prompt on its own, since "finish in fewer turns" is where the must-item misses
-come from.
-
-**Deleted 2026-09-22 (owner).** The switch stayed OFF and the follow-up never ran, so the whole
-bundle went: `C3D_FEWER_TURNS` / `Limits.fewer_turns`, the checks folded into `build`, the
-turn-discipline block in four templates, and the refine prompt's inlined files for agent
-sessions (single-shot still gets them: it has no read tool). The OFF prompts render byte for
-byte as before. The mechanical half never outlived the api-agent anyway: `write_file` was
-that agent's tool.
-
-## 30. A tool's FAIL verdict is not an MCP error (2026-09-02)
-
-`spatial/mcp_server.py` returned `is_error = not obs.ok`, and `obs.ok` was the tool's
-**verdict** — so every gate that ran and answered FAIL reached the model as a broken call.
-
-**Selector** (every number in this section, unless another one is named): the files
-`eval/bench/out/*/**/run/trajectories/*/stdout.json` **as they stood at 2026-09-02 20:20 UTC**
-— the corpus is live and grows with every battery, so a later re-run reads larger
-numbers (2026-09-03 00:30: 390 files, 6 154 calls, 60 of 302 rounds) — 386 of them, of
-which **224 are non-empty** — one per gemini-cli session that reported stats; the other 162 are
-zero-byte (the CLI died or was killed before printing its JSON) and every one of the
-386 belongs to a gemini-cli arm. `run/telemetry/trajectories` is a symlink to the same directory:
-count it once (a glob that follows it doubles every number). Per file, sum
-`stats.tools.byName["mcp_3dcode_<tool>"]`'s `count` and `fail`; `fail` is gemini-cli's
-own tally of results that arrived with `is_error`. Over those 224 sessions: **6 127
-MCP tool calls, 1 720 (28 %) reported as errors.**
-
-| tool | calls | reported as an error | the harness's own gate, for comparison |
-|---|---|---|---|
-| `joint_sweep` | 1 445 | 62 % | the round's `joint_sweep` GATE fails 57 of the 299 rounds that ran it (19 %) |
-| `build` | 2 144 | 23 % | — (a build that does not compile IS the answer) |
-| `check_contract` | 895 | 17 % | — |
-| `check_connectivity` | 923 | 14 % | — |
-| `isolate` | 35 | 49 % | — (these ARE mostly real usage errors: an unknown part name) |
-
-(The gate column is a second selector: all 239 `run/record.json` under `eval/bench/out/`,
-411 rounds. An earlier draft of this section quoted 217 sessions / 1 404 sweeps / 63 %
-— that was the same corpus minus the `.attempt1` retry sessions and did not reproduce;
-these numbers do, with the glob above.)
-
-A vendor CLI treats an errored tool call as a call that did not happen and retries it.
-A retried request carries the whole session context: **a mean 118 700 prompt tokens**
-(9 250 main-role requests over the 224 sessions), 73 % of them cache hits, so
-**$0.030 per retry** at `gemini-3.7-flash`'s $0.75/M input + $0.075/M cached — a
-*cache-blended* rate, not the list price ($0.089 at full input rate), and ~$0.040 with
-the response the retry also pays for.
-
-### The expensive half: an errored result re-sends its images as TEXT
-
-An independent offline investigation of the recorded requests (its own selector: the
-per-request logs, not the session stats above) found the retry is not the main bill.
-`observation_content` attaches PNGs as MCP `ImageContent`. On the success path
-gemini-cli calls `transformMcpContentToParts` and sends a real `inlineData` part; on the
-**error** path (bundle `chunk-DFPYJMVX.js:274288`) it builds
-`"MCP tool '<name>' reported tool error ... with response: " + safeJsonStringify(rawResponseParts)`
-— the image's base64 goes into the prompt as text:
-
-| the same articulation contact sheet | bytes / chars | prompt tokens |
-|---|---|---|
-| `inlineData` part (success path) | 274 572 B | ≈ 516 |
-| base64 inside an error string (error path) | 366 096 chars | ≈ 261 497 (**~507×**) |
-
-It also escapes gemini-cli's own 40 000-char truncation (bundle `:349408`), which only
-fires for a single-text-part MCP result or the shell tool. The predicted jump matches
-recorded per-request prompt jumps of +260 421, +256 907, +258 997, +257 840, +260 364 and
-+261 477 tokens. ~10 % of requests carried ~225 000 freshly *uncacheable* tokens, and that
-10 % is **67 % of the whole uncached bill (~$400 of $873)** on the corpus it measured.
-Non-blob requests already cache as well as the old in-process agent did (median 4 946
-uncached tokens vs 5 639 per turn), so nothing about settings, tool ordering or `GEMINI.md`
-needs changing — the blob is the whole anomaly.
-
-`joint_sweep` is exactly where the two findings meet: it always attaches the articulation
-contact sheet, and 900 of its 1 445 calls were errors. Corroboration inside the session
-stats above: the 205 sessions with ≥ 1 errored `joint_sweep` have a 73 % cache-hit rate and
-a median session averaging 106 250 prompt tokens per request, against 88 % and 78 349 for
-the 19 without (confounded — those are also the articulated runs — but it points the same way).
-
-### The fix
-
-A second flag, not a threshold. `Observation.failed` is what the MCP server reports as
-`is_error`; `ok` stays the verdict. `Observation.error` builds every failure caught at the
-`ToolDef.call` boundary (exception, `ToolUsageError`, missing or
-unreadable artefact), and three tools set `failed` on a result they compose themselves,
-where the failure is a fact about the result rather than an exception. Which places those
-are is a property of the code, so the list lives there (`spatial/registry.Observation.error`)
-and not in three documents.
-
-Every negative verdict now LEADS its text with `… FAIL` (`gate_observation` for the gates,
-`JOINT SWEEP: FAIL — penetration …`, `FRAME GATE: FAIL — n error(s)`, `RENDER: FAIL — n
-console error(s)`, `BUILD FAILED` as before) so the model reads the answer instead of
-retrying the question.
-
-And because the harness now decides what is an error, `mcp_server` bounds what one result
-can hand over: `MAX_TEXT_CHARS` = 6 000 characters of text (twice the largest per-tool
-limit — an Observation built by hand never passes through `observe`'s truncation), and
-`max_images_for`: 4 images on an `ok` result, **1** on a FAIL verdict, **0** on a `failed`
-one. The vendor's own 40 000-char guard does not fire for a multi-part result, so this is
-the only ceiling on the error path.
-
-### Exit codes DID change for one command
-
-`3dcode tools <name>` exits 1 on `not obs.ok` — the rule is unchanged, but `scene_probe`'s
-`ok` changed meaning (it used to mean "the probe tool ran", the workaround for this bug),
-so **`3dcode tools scene_probe` on a failing scene gate now exits 1 where it exited 0**.
-Kept deliberately: every other gate tool already exited 1 on a FAIL, and the exit code
-speaks to the human or script at the terminal, not to the model — the MCP boundary is the
-one place where calling a verdict an error costs money. The CLI panel prints three states
-(`ok` / `FAIL` / `error`) to match.
-
-What to watch on the next battery: in `tools stats`, `joint_sweep` / `build` / `check_*`
-error counts → near zero (only genuine failures — no URDF, unreadable GLB, bad arguments),
-calls per run down by the retries that used to follow each of them, per-request prompt
-tokens without the ~260 k spikes, and the uncached share of `telemetry/cost.jsonl` down
-with them. The 62 % vs 19 % gap between the sweep TOOL's verdict and the round's sweep
-GATE is a separate question — the tool flags any overlap past `tol_m` and any floating
-link, while `sweep_findings` downgrades small rest overlaps and hinge gaps to WARN.
-
-**Measured after the fix** (`eval/bench/out/wave2_lean`, the same battery and config as the
-`aa_articulated` A/A above, 2026-09-03). Both columns are printed by
-`python eval/bench/session_stats.py eval/bench/out/aa_articulated eval/bench/out/wave2_lean`, which reads
-each session's own stats block and each round's recorded `usage`:
-
-| per generator request | before (`aa_articulated`) | after (`wave2_lean`) |
-|---|--:|--:|
-| sessions with stats / killed before printing | 60 / 102 | 59 / 86 |
-| main-role requests | 2 537 | 2 657 |
-| MCP tool calls reported as errors | 26.6 % (482 / 1 814) | **1.3 %** (25 / 1 863) |
-| cache hit | 69 % | **90 %** |
-| uncached prompt tokens per request | 38 521 | **13 480** (−65 %) |
-| generator $ per round (median; the script prints medians only) | 1.572 | **0.950** (−40 %) |
-
-**Correction (2026-09-03), and what it does NOT explain.** The after column first read
-1.4 % (48 / 3 480), 13 736 uncached tokens and median \$0.967 over "108 sessions / 5 082
-requests". It was computed by hand, by a method that is not in the tree, and
-`eval/bench/session_stats.py` does not reproduce it: the ratios are 1.87x on MCP calls and on
-requests but only 1.06x on sessions, and no mechanism tested accounts for that shape —
-following the `run/telemetry/trajectories` symlink doubles the file count exactly (2.0x on
-both batteries), counting every tool instead of the MCP ones gives 2 756 not 3 480, and no
-union of recorded batteries lands on those totals. The BEFORE column reproduces to the
-digit, which says the method changed between the columns rather than the data. The
-hand-computed after column is therefore **withdrawn**, not explained; the table above is
-what the committed script prints, and the script is what a later run should be compared
-against.
-
-The residual 1.3 % are genuine `Observation.error` cases: `joint_sweep` with no
-`artifacts/robot.urdf` yet or an unparseable one, `check_connectivity` / `check_contract`
-with no readable GLB. The cache recovery is the larger half of the saving and was NOT
-predicted by the retry argument alone: the base64 blobs were breaking the implicit-cache
-prefix, so a request after one cost ~5x a normal request even when nothing was retried.
-
-Secondary observation, not a controlled comparison: the paired sd of the battery run on
-this code is 0.131 against the A/A's 0.225 on the old code (n_for_power for ±0.02: ~172
-pairs against ~506). Different runs and different arms, so it is an observation — but the
-direction is the one the fix predicts, since a retry storm is variance.
-
-## 31. Minutes: the steps of a run, minus provider errors (2026-09-22)
-
-The owner's definition: time every step of a run from start to end, do not count the time lost
-to 503 / token-limit / overloaded errors, and report the sum (按步骤记录并扣除错误时间). It
-replaced six definitions that disagreed by up to 8x (on 52 resumed runs the record span said
-209 h where the active clock said 24.6 h): the record span (gallery), the bench process's wall
-clock (bench report), the compare cell's wall clock, the cost audit's active time, the budget
-guard's `elapsed_min` (ab_view) and telemetry-else-Σ-rounds (complexity_report).
-
-**What is timed.** `contracts.run.StepTime{step, round, wall_s, lost_s}`, one per step:
-`plan`, `skeleton`, the scene's `textures`, `assets+env+layouts` (the three run side by side, so
-they are ONE step; `assets+env` with `C3D_ZONE_LAYOUTS=off`), `zones`, `assemble`, best-of-N `candidates` — run-level, on
-`RunRecord.steps` (persisted in `run_state.json` as they happen, the part of an aborted round
-that ran included) — and per round `generate` (one per phase: a phase's sessions run side by
-side), `build` (+ repair), `gates`, `render`, `judge` (+ a re-judge), on `RoundRecord.steps`.
-**`RunRecord.minutes`** = Σ (wall − lost) / 60 over all of them: THE number, the one every reader
-reports (`addons/select` per round, the gallery, `3dcode cost`, `3dcode show`, the dataset index,
-eval/bench). Work after the run — a pick's texture pass or pairwise verdict, captions — is not a step
-of it (its money joins the ledger; its time is the pick's). Harness glue between steps (git
-commits, skill bundles, writing records) is not a step either.
-
-**What is lost.** `cost/tally.py`: a step opens a `Tally`; the meters book into every open one.
-An agent session books its `AgentResult.provider_wait_s` (the CLI's own 503 / 429 retries, read
-from its log by the agents). An API call books everything outside its answered round-trips once
-one of them failed without an answer — the failed tries, their back-off and the key waits
-(`cost.instrument._RoundTrips`, fed by the per-attempt sink `models.retry.rotate_with_retries`
-already reports through; a backend that reports no round-trips — the SDK adapters — is charged
-everything outside the answer it returned). A reply that came back unusable (bad JSON, empty)
-is the model's own time and is not lost. Calls in one thread add up; threads side by side (fan-out
-sessions, judge samples, candidates) lose `max(wall) − max(wall − lost)` — what the slowest thread
-would have been spared.
-
-**One fallback.** A record or a round written before step timing (`steps is None`) counts its own
-clock: the run's `extra["budget"]["elapsed_min"]` (all 470 archived records carry it), a round's
-`duration_s`.
-
-**Minutes are a statistic, `max_minutes` is a limit.** `orchestrator.BudgetGuard` keeps counting
-every active second, errors included — it has to stop a run inside a 503 storm, which is exactly
-when the minutes stand still. A run can therefore stop on `budget` with its minutes well under
-`max_minutes` (the stool run of 2026-09-22b: 51 minutes on the clock, a 2 100 s baseline session
-killed after its 503 / 429 retries).
-
-## 32. The ledger is the only record of money (2026-09-22)
-
-The owner's rule: the money of a run is its ledger's sum at list price (账本合计,按标价). Before
-it the harness kept two books — the ledger, one row per call, and `BudgetGuard`'s running total,
-fed by twelve `charge` / `add` call sites — and `record.total_usage` took the guard's. The guard
-never saw a round-trip the provider billed and the call discarded (a hedge loser that landed
-after the winner, a charged-but-invalid reply: the ledger's `source="extra"` rows), so the two
-drifted. Selector: every `record.json` under `~/3dcodeverse_bench_out` and
-`~/3dcodeverse_runs` that has a `telemetry/cost.jsonl` (437 of 470): the ledgers sum to
-**$882.77**, the records to **$845.63**, and 119 runs differ by more than 5 %. The live stool run
-of 2026-09-22b recorded **$0.3054** over a ledger of **$0.379**: its judge's hedged retry landed a
-second, discarded verdict for $0.0736 that only the ledger saw.
-
-What a run's money is now:
-
-* **`record.total_usage`** = the sum of `telemetry/cost.jsonl` (``cost.ledger.ledger_usage``),
- read when the record is written (`BaseTrack._record`, `record.package_run`) — every billed row
- exactly once: `live` (one per call), `session` (one per CLI session), `extra` (a billed round-trip
- the call discarded). `attempt` rows are forensics, their tokens already on their call's row.
- Post-run work (a pick's texture pass, captions) joins it when the run is re-packaged.
-* **a round's `usage`** = the rows booked while it ran (`cost.tally`: `record_call` books every
- priced row into the open tallies), so a judge's discarded-but-billed verdict and a killed
- session's recovered usage land on their round; best-of-N adds its candidates' own tallies.
-* **an aborted round** reports its tally: `rounds/aborted_rNN.json` and
- `record.extra["aborted_rounds"][i].cost_usd`.
-* **money by stage** is `cost.ledger.summarise` — `telemetry/cost.json`, `3dcode cost`, the gallery.
-
-Gone: the guard's `spent` / `billed_usd` / `calls` / `by_stage`, `charge` / `add` / `mark` /
-`stage_summary`, `usage_delta`, the snapshot's money fields (an old snapshot still loads),
-`_reconcile_billed_from_ledger`, `cost/billing.py`, `record.extra["cost_by_stage"]` and
-`["rounds_summary"]` (written, never read), the `cost.round` event (no reader; it restated the
-ledger by round and stage), `CostSummary.ledger_usd` / `unattributed_usd` / `post_run_usd` (one
-number now), and `C3D_COST_LEDGER` — whose `off` turned the one money record off, and whose other
-values made every command die (a `bool` Settings field fed `none` or a path).
-`BudgetGuard` is a clock: `check` / `ok` / `timeout_s` / soft cap / grace / the active seconds a
-resume carries — unchanged (§31 says why minutes and the clock differ).
-
diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.md
deleted file mode 100644
index 7830f071..00000000
--- a/harness/docs/DECISIONS.md
+++ /dev/null
@@ -1,1917 +0,0 @@
-# Decisions (ADR-style)
-
-Each entry: context → decision → consequence. All dated 2026-08-23 unless noted;
-"Δ" entries are deviations from the first-wave plan (`INTERFACES.md` as originally
-written) that were accepted because the code works that way and the tests pin it.
-An entry keeps the decision, the one or two numbers that carried it, and a pointer to the full
-account (about 12 lines since 2026-09-22); a number kept inline is one that exists nowhere else.
-Pointers: EVAL, PAPER_WRITING = `eval/docs/*.md`; COST, RUNBOOK, ARCHITECTURE, INTERFACES =
-`harness/docs/*.md`.
-
-## Laws (standing, from CLAUDE.md)
-
-* **L1 Raw code only.** Generated code never imports an SDK/helper; the harness owns
- wrappers and exporters (`languages/wrappers/`, `languages/opengl_python/wrappers/`, `runtime_js/`). Consequence: every
- language needs a standalone wrapper that cannot import `codeverse3d` (Blender's python
- cannot see the package anyway).
-* **L2 One contracts package, one conventions module.** `contracts/` is data-only;
- `conventions.py` is the only place stating frames/units/naming. Consequence: plan
- frames are the language's native frame (Z-up for blender/cadquery/urdf) and
- `check_contract` converts to the GLB frame (Y-up) using `LANGUAGE_FRAME`.
-* **L3 Deterministic first, VLM for perception only.** Score is computed in code
- from rubric weights; floors and caps are explicit; degraded verdicts are glitches.
-* **L4 Typed, no regex-on-id, no god files.** Files ≤ 2 000 lines, 3 000 absolute (owner, 2026-08-28 — was 1 500, before that ~400).
-* **L5 Cheap first.** Lint → build → gates → montaged views → VLM. `build` tool
- skips the build when lint has ERRORs.
-* **L6 Every round = a git commit; every call = a Usage; every run = record.json.**
-
-## Architecture decisions
-
-* **D1 Single-shot lives in tracks, not agents (Δ).** `single-shot:<provider>:<model>`
- ids are dispatched by `tracks/generation.generate()`; the agents registry only knows
- real agentic kinds. Consequence: `Spec.backends.generator` accepts three id shapes;
- `is_single_shot()` is the only test.
-* **D2 generate() writes code, build_with_repair() builds (Δ).** The original
- `generate_files` import still exists, but generation never builds; `run_round`
- composes generate → commit → build+repair → gates → render → judge. Consequence:
- repair prompts are error-focused (file:line, traceback tail, lint hints,
- keyword-matched cookbook section) and escalate temperature/thinking (single-shot)
- or add a "same error again" notice (agents) on identical error signatures.
-* **D3 `RoundPolicy.max_rounds` counts refine rounds after the baseline.** `3dcode make
- --rounds 2` = baseline + 2 refine rounds — exactly 2 since D80, which also deleted
- `RoundPolicy.target` (the rubric's `pass_threshold` now sets only the judge's per-round `passed`).
-* **D4 Parallel refine only when it is safe.** Fan out only when at least
- `RoundPolicy.parallel_min_tasks` (default 2) file-disjoint groups exist and every task
- maps to a file (threejs parts, scene zones/assets/env);
- single-file languages get one whole-object task. Consequence: `Workspace` itself
- holds a per-root lock + index.lock retry (workspace.py).
-* **D5 A refine round that changes no file stops the run, not a crash.** Emits
- `round.no_change`; since D80 the status is `no_change` and the workspace stays at the last round.
-* **D6 Finalise leaves the workspace at the LAST round (D80; was: restores the best commit).** Only
- a round cut mid-way (clock, crash) leaves `src/` past it, so that is restored and rebuilt;
- artifacts match the last round's code, and every round's own build is kept in `artifacts/rNN/`.
-* **D7 Stage cache by input hash.** `StageRunner` stores `stages/<name>.json` keyed by a
- hash of the inputs, so `3dcode resume` re-runs only what changed; the budget guard is
- restored from `run_state.extra.budget_snapshot` (`BudgetSnapshot`: since D84 the clock's
- cumulative ACTIVE seconds only — the money fields went with the guard's money; grace is
- deliberately NOT persisted). Active minutes still count after a resume, so a raised
- `--max-minutes` grants only the difference.
- `run_state.extra` carries `budget_snapshot` and `spec_fingerprint` only: the
- candidate count lives in `spec.options.candidates`, the candidate table in
- `rounds/candidates.json` (which `record.extra.candidates` is read from).
-* **D8 Events carry `event`, not `kind` (Δ).** `EventLog.emit(event, **data)` so payloads
- may include `kind=` (round kind). `3dcode status` and tests follow.
-* **D9 `materialize_workspace` returns `None` (Δ 2026-08-30).** It used to return a
- `Materialized` model carrying the body files, the ignore files, the cookbook path, the MCP
- command and a `warnings` list — and every production caller discarded it
- (`tracks/common.Services.materialize` is itself typed `-> None`), so the one signal on it, an
- unresolved cookbook, was written and never read. That warning is now a `log.warning` on
- `codeverse3d.agents.materialize`, where a run log shows it; the model is gone.
- The codex `-c` overrides are NOT on it (`codex_overrides` was deleted
- 2026-08-29): the codex backend builds `codex_mcp_overrides(mcp_command)` per session.
- The cookbook is copied to `ws/.3dcode/cookbook.md` (gemini-cli cannot read outside the
- workspace); the MCP argv defaults to `cli_common.default_mcp_command(ws)`, i.e.
- `sys.executable`, for every backend (the track-side bare-`python` literals are gone).
-* **D10 gemini-cli needs a system-settings file (Δ; superseded by D103 — the gemini-cli backend is deleted).** api-key auth +
- `dynamicModelConfiguration` (else silent model substitution) + `folderTrust.enabled=false`
- (else workspace MCP servers are silently disabled even with `--skip-trust`). Served
- model is checked; mismatch → `exit_reason=model_substituted`.
-* **D11 AgentJob carries typed fields only (Δ, revised 2026-08-29).**
- `round`, `kind`, `files_hint`, `language`, `track`, `read_only`, `mcp_command` … are
- typed `AgentJob` fields; the `extra` dict and its `_lift_legacy_extra` shim (and the
- unused `model` field) were deleted 2026-08-29 — nothing in the tree built one.
-* **D13 Node ESM resolution via an import hook (Δ).** `NODE_PATH` cannot resolve bare ESM
- specifiers; `run_node(three_hook=True)` adds `--import runtime_js/lib/resolve_three.mjs`;
- browser pages get an import map from `serve.cjs`. `ThreeJsRuntime` writes
- `src/package.json {"type":"module"}` (idempotent).
-* **D14 render_glb gained keyword-only extras (Δ).** `anim_time, shadow, gpu, timeout_s,
- use_cache`; all original args/defaults unchanged; renders are cached by
- sha(glb)+params under `~/.cache/codeverse3d/renders/`.
-* **D15 `check_contract(measurement, plan, *, language, tol_m)` (Δ).** `language` is
- required for the Z-up → Y-up plan-box conversion. (`cross_section`'s `absolute` / `size` and
- the `compare_silhouette` tool are gone: D88 draws sections through the judge renderer, D82
- deleted the tool.)
-* **D16 measure: link-hierarchy rule (Δ, fixed after the cabinet run).** Parts are
- effective top-level nodes (descending through single geometry-less wrappers) with
- subtrees merged — except when the scene carries `metadata["links"]`, in which case
- each link is a part with only its own geometry. Consequence: URDF links are plan parts
- for `check_contract` / `check_connectivity`; the cabinet run's "plan part missing"
- errors were an artefact of the pre-fix rule.
-* **D17 URDF meshes are stored in raw Z-up link frames (Δ).** `meshes/<link>.glb` are
- correct in any URDF loader (verified with yourdfpy); only the canonical `object.glb`
- is Y-up with joint extras. Build `ok` is flipped only by rest-pose penetration > 5 mm
- (moved-pose overlaps and floating links are gate findings, not build failures).
-* **D18 Authoring recipe for URDF (corrected in fix batch 1 — this is the ENFORCED
- recipe).** Link meshes are built/exported in **WORLD coordinates** at q=0 (the
- authored pose = the plan's rest pose); every non-root link frame = its **pivot**;
- joint origin = pivot_child − frame_parent; visual AND collision `<origin xyz>` =
- −pivot (root `0 0 0`), verified by the FK-consistency check; `rpy="0 0 0"`
- everywhere. Skeleton URDFs shift plan limits by `JointPlan.rest` (URDF limits =
- plan lower−rest .. upper−rest) so q=0 is the authored rest pose, and annotate the
- shift inline. Lint accepts PascalCase or snake_case link names (plain
- identifiers); `world` is a reserved link name (trimesh's glTF reader stomps on it).
- The old prompts taught "visual origins zero", which the harness rejects — the
- contract/cookbook examples now all build clean through the real pipeline.
-* **D19 Scene cameras are plain dicts `{name, position, lookAt, fov}`** (matches
- `scene_host.mjs` validation); `scene.js` is assembled deterministically by the harness
- from zones/env/assets; log-depth is opt-in; missing `/assets/*.glb` is a WARN, a
- missing module is an error.
-* **D20 `probe_scene` returns `SceneProbeResult`** that unpacks as `(gate, census)`;
- use `.model_dump()`, not `dict()`.
-* **D21 Judge wire schema has fixed keys (Δ).** One property per criterion/acceptance id so
- flash-class models score every criterion; `apply_caps(rubric, overall, gates,
- acceptance_results, acceptance_items=None, *, console_errors=None) -> CapResult`; rubric
- caps use `when:` (PyYAML parses bare `on` as `True`). Missing render files raise
- (pipeline bug), only model/parse failures produce degraded verdicts.
-* **D22 Judge defaults (updated wave 3).** `Settings.default_judge =
- gemini:gemini-3.1-pro-preview`; tracks construct `VlmJudge(rubric, model_id,
- n_samples=1)` (`RoundPolicy.judge_samples`). Flash is the cheap in-loop option —
- use `n_samples ≥ 2` for decisions or re-judge with `3dcode judge --n 3`.
-* **D23 Gemini specifics (Δ).** Gemini 3.x cannot disable thinking. **Removed 2026-09-21**
- (c5ffcd4, with the function-calling surface the api-agent had served): tools + response_schema
- being mutually exclusive (schema dropped with a warning), and the in-process cache of provider
- opaque state (thought signatures / Anthropic thinking blocks) by tool-call id that stood in for a
- slot on `ToolCallPart`.
-* **D24 OpenAI via Chat Completions** (for `OPENAI_BASE_URL` compatibility); Anthropic uses
- adaptive thinking + `output_config.effort` on 4.6+ models.
-* **D25 Flywheel shapes (Δ).** `caption_sample(ws, record, model_id, *, model=None)`;
- `export_samples` keeps both `code.<ext>` and full `src/**`; parquet adds
- track/language/score/passed/generator columns; tar locators filled by `--pack`;
- `eval/bench/` lives at repo root; `3dcode tools` is one command, not a sub-app; runs whose best
- round never built are skipped unless `--include-unbuilt`.
-* **D26 Threejs exports strip textures; `userData.tick` cannot survive GLB** — recorded in
- the census (`tick_present`) for the judge/flywheel rather than faked.
-* **D27 Blender wrapper resets the active layer collection** after clearing the scene (a
- deleted factory "Collection" leaves `bpy.context.collection == None`, breaking the
- common `bpy.context.collection.objects.link` pattern) — found live, pinned by tests.
-* **D28 Superseded by D80:** `StopPolicy` is gone and `RunStatus` names every stop itself
- (`max_rounds`, `budget`, …); a record's `passed` / `plateau` status reads as `stopped`.
-* **D29 Best-of-N baseline + pairwise tie-break (second wave).** `--candidates N` runs N
- baseline candidates in parallel throw-away sub-workspaces (`<ws>/_cand/c<k>`), ranks them
- by quick 4-view judge score → fewer gate errors, breaks near-ties pairwise, copies the
- winner back. Every candidate is charged to the run budget. The per-round pairwise
- tie-break went with D80 (and the candidates' near-tie pairwise with it): pairwise is now
- `3dcode pick --by pairwise`, after the run (margin 0.03, confidence ≥ 0.6, `addons/select.py`).
-* **D30 Judge protocol v2 + pro default (third wave).** The judge sees ≤ 3 labelled
- 2×2 montages (+ ≤ 2 detail crops, ≤ 1024 px) instead of sheet + 9 views; the wire
- schema is observe-then-score (defect checklist + acceptance before criteria);
- every rubric carries binary defects with penalties/caps. Measured on the e2e
- rounds (then `judges/calibration.py`, now `addons/calibration.py`, n=3): flash std 0.083 / pearson(gate errors,
- score) −0.33; pro std 0.030 / pearson +0.63 — so `default_judge =
- gemini-3.1-pro-preview` and flash's dynamic range is carried by the checklist.
- Consequence: `VlmJudge(max_images=)` is gone (`max_montages`, `detail_crops`);
- `JudgeInput.geometry_views` routes clay/normals views to a geometry-only montage.
-* **D31 Textures are a derived asset pack, never the deliverable.** The texture
- pass (material plan → tileable tiles → world-metre UVs → `object_textured.glb`)
- runs on the PICKED round, after the run (`3dcode pick --texture` or `3dcode texture pass`); it never edits `src/` or
- `object.glb`, ships only when the before/after judge gate agrees (Δoverall ≥
- −0.01 AND materials criterion improved), and is recorded in
- `record.extra["texturing"]`. Scenes get a named tile pack under
- `public/textures/` injected into prompts instead of per-part texturing.
-* **D32 Graphics track = GL, not a 3D pipeline.** `graphics` renders through
- moderngl in a subprocess per render (contexts are not thread/fork safe), has no
- GLB/measure step, and gates on frame statistics (`gl_frames`: NaN/black/blown/
- static/flicker). The harness owns the GLSL header (`#version`, uniforms,
- `out vec4 fragColor`) — agents write shader bodies only; feedback shaders are
- simulated at 30 fps. Rubric `shader_v2` (threshold 0.70; `shader_v1` stays frozen for old runs).
-* **D33 Export as authored (fix batch 1, all languages).** No wrapper re-centres
- or grounds the object (threejs `--normalise` is an opt-in dataset flag); the
- build warns (`placement_offset`), the contract/connectivity gates report in the
- *authoring frame*, and the agent fixes the source. Consequence: exact-per-plan
- parts always pass `check_contract` even when the union is off-centre.
-* **D34 Key pool outcomes include `dead` (fix batch 1).** Auth/permission errors
- (401/403, API_KEY_INVALID…) rotate away immediately and bench the key for an
- hour once another key works; 429s rotate to untried keys without consuming the
- retry budget. A single dead key no longer fails 1/N of all Gemini calls.
-* **D35 Strict schemas mirror pydantic nullability (fix batch 1).**
- `to_openai_strict_schema` no longer adds `null` to defaulted fields (defaults
- become description hints); `pricing.lookup_price` prefix fallback matches only
- version/date/channel suffixes, so sibling models never inherit a parent's price.
-
-* **D36 Vote ties follow the representative sample (2026-08-25).** Defect votes were majority with
- ties → present and acceptance votes majority with ties → False, so at `n_samples=2` ONE
- dissenting sample applied every penalty/cap and failed every must item — n=2 was strictly harsher
- than n=1 and n=3, and the `economy` profile (n=2) was not comparable with the others. Decision:
- an exact tie (even n only) takes the *representative* sample's answer (the sample whose overall
- is closest to the mean — already the narrative source); ids decided this way are listed in
- `ScoreBreakdown.tie_broken`; `VlmJudge` warns on an even n. P(item flagged) at n=2 equals n=1's
- while the continuous scores still average over both samples; odd n is unchanged. **Amended
- 2026-08-30 for DEFECTS only:** an exact defect tie reads as ABSENT — "nearer the mean" is a float
- comparison, not evidence, so a 1-1 tie on a defect that caps the run at 0.7 was a coin flip, and
- the rubric puts the burden on the defect ("present only when an image or a gate finding shows
- it"). Acceptance ties still follow the representative: a must-item tie decides pass/fail, and
- that policy stays the owner's. Moves nothing on disk (419/419 stored verdicts are n=1). Pinned:
- `tests/judges/test_defects.py`; context: PAPER_WRITING §0.2.
-* **D37 The judge protocol is hashed (2026-08-25).** Context: only the rubric YAML was
- hashed; the role prompt, the view-rig rules and the wire schema (whose field order
- IS the observe-then-score protocol — EVAL.md §6 measured σ 0.01 → 0.08 when it
- changed) were not, so a prompt edit left no trace in any record. Decision:
- `prompt_builder.judge_prompt_hash(rubric)` = hash(system prompt + rig rules +
- wire-schema structure); stored in every `ScoreBreakdown.judge_prompt_hash` and,
- for runs, `record.prompt_hashes["judge"]` (`BaseTrack.after_plan`). Per-run content
- is excluded so runs under one protocol share the hash.
-* **D38 `harness_git_sha` resolves through git, not a `.git` probe (2026-08-25).**
- Context: `flywheel/record._harness_git_sha` looked for `harness/.git`; the repo's
- `.git` is one level up, so every record shipped an empty sha and EVAL.md §1.7's
- provenance was never met. Decision: `git ls-files --error-unmatch` on the module
- itself (a wheel / venv copy must not borrow an unrelated repo's sha), then
- `rev-parse HEAD`, `-dirty` appended when tracked files under `harness/` are modified.
-* **D39 The offline suite is run whole, locally; there is no CI (2026-08-25/26).**
- Context: `ci.yml` listed 7 of 24 directories, so 828 pure-python tests — every
- docs-vs-code drift guard among them — never ran on a PR. Decision: the local pre-push
- suite is `pytest tests -m "not live"` over every test directory (add `and not blender
- and not node` for the pure-python subset), after `ruff check codeverse3d tests` (and `cd eval && ruff check . && python -m pytest` for the evaluation code);
- there is no CI — the owner removed the GitHub workflow on 2026-08-26 (6ac06a9), so this
- names a command every push is preceded by, not a job.
-
-* **D40 A harness cell that waited instead of iterating is flagged, not trusted
- (2026-08-25).** Context: under a day-long gemini-3.7-flash 503 storm 37 of 40 harness
- runs stopped on the 45-minute ceiling with 0–2 completed rounds while the 3 that met a
- calm window finished 2–4 rounds and scored 0.92–0.95; the paired mean over the stormed
- cells (0.516) measured the weather. Decision: `compare_backends.flag_degraded` marks a
- harness cell that stopped for budget with money left, ≤ 1 completed round, after
- ≥ 40 min; the report counts them (`degraded` / `cut` columns, † per prompt) and
- `paired_compare` adds an `all −degraded` row. Scores stay — the artifact is real.
-* **D41 Failures of the arm are zeros; failures of the provider are dropped (2026-08-25).**
- Context: a `oneshot+repair` cell whose repair call died in a 503 storm was scored 0 on
- its pre-repair file; a harness run whose planner failed validation twice was recorded
- `error` / score None and vanished from the mean (5 of 14 articulated prompts). Decision:
- a one-shot arm whose LAST attempt was lost to the provider is `infra_failed` (redone);
- a harness `PlanningError` is `no_code` / 0.0, like a one-shot answer in the wrong
- format; "Error creating WebGL context" (a saturated shared GPU) is an infra marker.
- Added 2026-08-28/29 (pro planner + gemini-cli runs): a Gemini stream that exceeds its
- attempt budget, a 504 "Deadline expired", and a `finish_reason=PROHIBITED_CONTENT`
- (the content filter tripping mid-JSON on a furniture plan) are provider failures too.
-* **D42 `compare_backends` follows the battery's track (2026-08-25).** Context: the
- fixed evaluator was static_object-only. Decision: `FixedEvaluator(track=, language=)`
- picks the runtime from the battery and the rubric per cell (`_fixed_eval.rubric_for`, the
- `TRACK_INFO` row, through `judge_for(spec)` — the PR's `RUBRIC_BY_TRACK` table was folded
- into it on merge); articulated cells add
- the joint-sweep gate and the pose sheet read from the built URDF (no plan, every arm
- alike); one-shot arms get a language-aware minimal contract (the D18 recipe as rules,
- no example) and must answer with both files in the `=== FILE ===` envelope.
-* **D43 Python lints never raise on unparseable source (2026-08-25).** Context: a
- generated bpy file made CPython 3.11's `ast.parse` raise `SystemError` and the round died
- in `build_once`. Decision: `_ast_lint.safe_parse` catches SyntaxError / RecursionError /
- SystemError / MemoryError / ValueError; every python lint reports a lint ERROR with a
- flatten-the-literal hint instead. The forbidden-import floor is one set:
- `_ast_lint.BASE_FORBIDDEN_IMPORTS` (pickle, threading, importlib, webbrowser, ftplib,
- smtplib, …) — since 2026-08-29 urdf's `model.py` lint is on it too (those became
- ERRORs there) plus an explicit allow-list `{bpy, bmesh, mathutils, math, random, numpy}`;
- anything else imported is a WARN, a `codeverse3d` self-import an ERROR.
-* **D44 The 2026-08-29 cleanup: delete, do not relocate (owner).** An external review of
- `codeverse3d` proposed executor / policy abstractions (a `RoundExecutor`, a `CandidateRunner`, a
- metering seam, a per-track prompt-policy object); all rejected — each moved code between files
- without deleting any (L4: a merge must delete). Done instead: (a) **candidates are rounds** —
- `run_candidate` / `quick_judge` went; a best-of-N candidate is
- `steps._run_round(kind="candidate")` in its sub-workspace with two knobs (ARCHITECTURE §2,
- INTERFACES orchestrator/); (b) **one ledger writer** — `BudgetGuard` buckets and enforces only,
- `MeteredAgent` / `MeteredChatModel` write `telemetry/cost.jsonl` and `BaseTrack.run` opens the
- run ledger (`per_call_metering`, `_ledger_row`, `run_ledger_path` deleted; COST §12); (c) **a
- garbage env flag is OFF** — amended by D86: a typo keeps the switch's DEFAULT, which is the arm
- that never set it (for a default-ON switch "garbage is OFF" produced the variant); (d) one MCP command
- (`default_mcp_command`, `sys.executable`), one JSON-envelope finder, one union-find, one sha256,
- one `ask_structured`, one `RENDER_MODES`. Retired with their docs: `3dcode migrate-runs`,
- turntables + ffmpeg, the `C3D_SYSPROMPT=v0` arm, `shader_presence` / counterfactual renders, the
- in-process turn-cap backstop, the concurrent-session registry.
-
-* **D45 The 2026-08-30 batch: verified before applied.** A second external review (six P1s, three
- P2s, eight deletions) and a 12-subsystem, 36-claim comparison of the static_object track against
- `astra3d-brilliana` were reproduced or refuted by an independent auditor BEFORE any edit (review:
- two claims refuted outright, four downgraded; comparison: ten of 36 survived, one at high
- severity). Decision: apply what reproduced, and prefer the fix that deletes.
- (a) **`material_index` has a warning and a recipe.** One mesh object per plan part makes
- per-feature colour per-polygon `material_index`, which nothing taught: `h2h_microscope_x1b`'s 31
- materials (19 `tag_faces` calls, all silent no-ops) shipped on slot 0 and lost 0.271 to
- `untextured_flat`, which fired on 4 of 12 h2h runs — all four losses. The census warns on unused
- slots and an out-of-range index — a build WARNING, not a gate (a slot may be filled a round
- later) — and the blender cookbook carries the recipe (ARCHITECTURE §4,
- `tests/blender_cadquery/test_material_slots.py`).
- (b) **The cost ledger has no process-wide default** (`bind_run` / `set_default_ledger` /
- `default_ledger_path` gone; `bound_run` and `bound_ledger` hold ContextVar tokens —
- `cost/context.py`, COST §12). Standing rule: **a thread that may bill a model is spawned through
- `proc.fan_out`, never a bare pool** (`texturing/generate.py` was the last one).
- (c) **A paid verdict is never re-bought or reversed.** Then: `PairwiseNote` on `RoundRecord`,
- replayed by `reconcile_resume` (`candidates.replay_best_round`). Since D80 the loop buys no
- pairwise verdict at all; `3dcode pick --by pairwise` caches its one verdict per (pair, model) in
- `artifacts/judge/rAA_vs_rBB_pairwise.json` and re-reads it — same law, one place. The replay and
- its known live-vs-replay divergence (a re-judge promoted twice) went with the best round.
- (d) **One render-cache authority.** `spatial/tool_common.py` may name a deterministic out_dir;
- only `spatial/render.py` decides a PNG is still good (why the `renderset.json` marker went: the
- `cached_render_glb` docstring in `spatial/tool_common.py`).
- (e) **`bench run --no-resume` is gone**; `--redo-status` is the one fresh rerun and it archives
- first; `compare_backends --no-resume` stays and archives the cell's `run/` first (RUNBOOK §7.u).
- (f) **Anthropic/OpenAI derive each SDK call's timeout from the remaining `max_wait_s`**
- (`min(client timeout, max(20 s, remaining))`, `models/parts.attempt_timeout_s`), not a fixed
- 600 s socket timeout under a deadline only checked between attempts.
- (g) **Prompt files have no size limits** (owner, 2026-08-30): `tests/prompts/test_files.py`
- capped a cookbook at 950 lines, a contract at 150 and every prompt at > 500 chars, and the
- blender cookbook hit the cap the day a measured failure earned it a new recipe. The structural
- checks — chaptered, jinja-inert, states its units and frame, carries a runnable example — stay.
- (h) Deleted: `languages/file_lint.py` (orphaned when `api_tools.py` went 2026-08-28), the
- `Materialized` DTO (D9), `AgentJob.images`, `SkillRead.first_seen_turn`, `RenderSet.turntable`,
- `attribute_changes(own_hints=)`, `BudgetGuard.charge`'s role/label/outcome + `by_round`, the
- `spent_usage` resume fallback, the root-`cost_ledger.jsonl` leg of `existing_ledger_path`, and
- `FakeImageModel` → `tests/texturing/conftest.py`. Also fixed: `kind="detail"` files as
- `Stage.REFINE`, `Stage.ASSEMBLE` maps to the generator role, and pairwise books `Stage.PAIRWISE`
- instead of hiding in the judge bucket.
-
-* **D46 The judge is grounded in what the gates measure (2026-08-30).** A 7-study audit of 420
- judged static_object rounds: the judge READ interpenetration off the connectivity gate's text
- instead of seeing it (P(flag | gate ERROR) = 69/69); the measured-absent veto was dead; one
- unverified must item pinned 121/424 verdicts to a flat 0.600; and the gate was blind to a thin
- member's tip (`PENETRATION_MIN_FRACTION`). Every change was measured offline on the stored
- corpus first (`eval/bench/rejudge_offline.py`, 419 verdicts, $0). Details: EVAL §6 and the
- constants' docstrings in `spatial/connectivity.py` and `judges/rubrics.py`.
- (a) **`CapRule.measures`** names the checklist defect a gate rule is the measurement of; the
- object rubrics' `floating_part` / `penetration_error` watch `connectivity` only (articulated_v1
- keeps `gate: "*"` — no single gate owns either measurement there: joint_sweep + connectivity).
- The veto is depth-aware: a penetration WARN at `VETO_PENETRATION_DEPTH_M` (8 mm, not 5 — at 5
- the pipe tee's 5.8 mm designed branch socket was marked) or deeper is not "measured absent".
- With (b) the replay moves 230 verdicts, none down, pass 15.0 % → 21.0 %. `Rubric.content_hash`
- hashes what the YAML declares, so a schema field (`measures`, `graded`) never re-keys recorded
- verdicts.
- (b) **The acceptance cap is graded**: `cap + (1 − cap) · verified/total` must items; pass/fail
- unchanged (`must_missing` still fails); the 0.600 spike falls 130 → 20.
- (c) **A defect vote tie is absent** (D36 amended). `SCORING_VERSION` = 2 is stamped on every
- breakdown; the replay tool holds identity only to same-version verdicts.
- (d) **The gate measures overlap where it is**: a dense pass on the AABB-overlap region, a
- `local_fraction` trigger beside the global one, and a `through_ratio` (2·depth / thickness of the
- part entered) that is MEASURED AND NAMED, never a severity (a 0.9 ERROR line flipped 9 runs of
- designed joinery). ERROR keeps its old meaning — deep AND a visible share of the part — because
- ERROR by depth alone flipped 27 runs of joinery pass→fail on a cap the eye cannot confirm.
- (e) **The contact ledger is kept**: one INFO finding (`data.kind = "ledger"`) with every contact,
- every overlap down to sub-threshold welds, the ground gaps, and the plan's `attach_to` pairs as
- CONTACT / OPEN via the one resolver `spatial.contract.planned_joins` (INTERFACES spatial/).
- (f) **Orientation is measured** in the contract gate (lying / stood → ERROR, turned → WARN; 0
- flags over 629 corpus measurements); facing-away and upside-down are not visible to an AABB.
- (g) **World frames are composed by walking the graph's edge matrices**
- (`spatial/measure.world_transform`; EVAL §8.7's mis-measured brilliana sides); a GLB with
- duplicate / unnamed nodes lands a finding.
- (h) **The judge reads the ledger, not WARN prose** (`gates_section`, ARCHITECTURE §6); it rides
- on the v1 `judge_prompt_hash`, so its effect is measured by a paired re-judge, never by replay.
- (i) **`VlmJudge(fixed_order=True)`** and `calibration --fixed-order`: the per-sample shuffle
- measures view-order robustness; the loop's σ-keyed stops need the model's re-judge noise (σ 0.035
- over 53 items × 3, the magnitude `JUDGE_NOISE` already tables). Rejected on the way: a
- through-ratio ERROR line (d), and a per-part ground gap for every part (a shade is legitimately
- 400 mm off the floor).
- (j) **An OPEN planned join stays report-only** (census: EVAL §6). The class an ERROR exists to
- catch — a child that touches nothing and is unflagged — is empty on 217 runs; an ERROR's whole
- bite would be 46 passing runs whose open rows read as planner noise — the invented `attach_to`
- edge becoming law (D45's failure verbatim), plus a PROTECTED refine round each. Severity may not
- be smuggled through the kind string either: `rubrics._finding_tokens` matches cap kinds against
- data/message/target, so `kind=open_join` caps nothing while `kind=no_contact` silently adds the
- 0.6 cap AND blocks the measured-absent veto. Re-open only if a future battery's ledger census
- shows a touches-nothing-unflagged row, or a paired A/B (~$5.50, 46 runs × 2 arms) shows the judge
- under-prices the OPEN lines it already reads.
-
-* **D47 Judge payload v3: the 14-view rig through the montage machinery (2026-08-31).** Supersedes
- D30's ≤ 3-montage cap. `OBJECT_VIEWS` is the brilliana 14-view rig (three rings ±30° + eye-level
- cardinals + poles); the legacy clay cameras are `OBJECT_CLAY_VIEWS` (clay `top` el 88, the rig's
- 90); `OBJECT_RANK` packs montage 1 as {front_right_high, back_left_high, top, bottom} so a cap
- truncation still sees the underside; `MAX_MONTAGES` / `Judge.montages` / every profile's
- `judge_montages` go 3 → 5 (at 3 the low ring + poles are silently dropped); `OBJECT_VIEWS_QUICK`
- stays 4 views, so contact sheets, the texture pass, candidates and scene assets keep their cost.
- Why: of a 4-arm A/B (42 items × n=3 pro, ≈ $47) the only comparison that survives multiplicity
- is same-cap C−A **+0.038** (SE 0.013), with `untextured_flat` cap fires 11 → 3; 14 single views
- (arm B) cost more for a negative delta. A payload experiment must measure the exact grouping it
- ships (grouping alone moved the mean −0.044; the shipped arm Cprod's numbers are the operative
- ones). Rejected: appended underside singles (Cplus), and t = 0 (σ 0.037 → 0.022, but the mean
- shifts −0.037 and pearson(gate errors) drops −0.195 → −0.126): re-keying every σ threshold to buy
- half the noise is a bad trade; **t = 0.2 stays**. Details: EVAL judge log 2026-08-31, COST §14.
-
-* **D48 Conditional cross-section slices + provenance elicitation on gate-ERROR rounds
- (2026-08-31).** The judge's interpenetration verdicts were reading comprehension of the gate
- text (D47's provenance pass: pure-view TP 0/14 in every arm). On a round whose connectivity gate
- carries an ERROR, `spatial.sections.judge_slices` cuts the round's GLB (`JudgeInput.glb_path`) on
- the two vertical centre planes, with a typed `SliceManifest` beside the PNGs so citations stay
- auditable; the slices go AFTER the montages/crops, with the F2/F3 rig text and one neutral
- elicitation sentence in the DEFECT CHECKLIST bullet. `Settings.judge.slices` = "on-error"
- (default) | "off" (`C3D_JUDGE__SLICES`); clean rounds are byte-identical (test-pinned) and
- `judge_prompt_hash` is untouched. Why: of three iterations under a pre-registered bar (a
- guard-verified image-cited interp majority on 8 of the 14 dirty rows) only this conditional one
- reached it (2/23 citations fabricated, both guard-caught), and the dirty verdict got cheaper
- ($0.154 vs $0.172). The watch item, answered 2026-08-31: the slice IMAGES carry the move, not
- the sentence; hard-cap loss falls; the shipped arm is the more ACCURATE one (net true marks +6,
- net false −2); two slices-only sentences were rewritten (the
- `[outline only — not filled; NOT a hole]` legend, and an in-plane caveat that points at the
- shaded and geometry views instead of forbidding a mark). Rejected: a revert (it nets +6 true
- marks), dropping the elicitation (inert on dirty rounds, and it produces the citations the audit
- was read from), a cap-interaction guard (no such cap fired). Forcing the sentence onto clean
- rows costs −0.092: the on-error gate is load-bearing. Details: EVAL judge log (2026-08-31 ×2;
- the `untextured_flat` fix both arms prompted, 2026-09-01), COST §14.
-
-* **D49 An articulated plan is checked for geometric self-consistency before any code is written —
- measured, ships OFF (2026-08-28/29).** **Removed 2026-09-21**: `tracks/plan_checks.py`, the
- re-ask in `tracks/planner.py`, the `C3D_PLAN_GEOMETRY` switch and their tests are deleted. It
- re-asked the planner (event `plan.geometry`) with box-arithmetic complaints about attachment
- gaps, hinge pivots and swept collisions. On `compare_art_v4` (14 paired prompts, gemini-cli
- generator, judge pro n = 3) it fired in 7/14 cells for Δ +0.064 [−0.188, +0.315] — with
- gemini-cli generation round-0 sweep errors are near zero either way. The numbers stand:
- PAPER_WRITING §4.
-* **D50 Joint-sweep findings reach the fixer aggregated per link pair (2026-08-28).** One
- compare_art_v3 run produced 59 penetration findings for a handful of pairs — one per sampled pose
- — and `build_refine_instructions` de-duplicates by (target, kind) keeping the FIRST pose's line,
- so the agent saw a pair's shallowest instance and the loop burnt its budget without converging.
- `spatial/joints_sweep.aggregate_findings` merges a pair's poses into one line (how many poses,
- worst depth and at which q, rest count), keeps the deepest `MAX_PAIR_FINDINGS = 8` ERRORs and
- folds the rest into one WARN `penetration_summary`; `default_joint_sweep` applies it and adds
- `buried_links` (a link whose sampled surface lies ≥ 98 % inside another at rest is an ERROR —
- invisible to every view, reported "missing" by the judge). The raw sweep report is unchanged.
- It ships on rationale, not on a resolved score delta (the companion repairs bundle:
- PAPER_WRITING §4).
-* **D51 The effect library is HARNESS-OWNED STARTER CODE, not an SDK import (2026-09-01).**
- `scene_multifile_graphics` shipped 52 three.js effect modules (21.7k lines) this harness had no
- equivalent of, and every scene run re-derived worse versions inside a 60-minute budget.
- **Decision — an amendment to L1, not an exception**: L1 forbids the AGENT from reaching outside
- its workspace for someone else's abstraction; modules the HARNESS writes into `src/`, verifies on
- its own renderer and forbids the agent to rewrite are what `src/recipes.glsl` already was for
- `glsl_shader`. So `src/lib/*.js` ships into every scene workspace, is listed in
- `HARNESS_OWNED_SRC[SCENE_THREEJS]` (a DIRECTORY-prefix entry, predicate `is_harness_owned`), and
- a post-session write to it is reverted; generated code stays raw three.js + GLSL. Shipped 52
- modules / 28.8k lines (44 / 24.8k since D74), ported against the reference's own test per module
- and adapted to OUR renderer contract (exposure 1.0 not 1.1; log-depth off; their
- renderer-contract assertions dropped); every module rendered and LOOKED at (53 before/after
- pairs, 77 night renders), aesthetics measured, not asserted (linear albedo 0.02–0.8, hue variance
- inside every effect, emissives 1.5–4, fresnel on water/glass, fog in the sky's hue family); one
- test file per module at landing (678 tests; since D96 one shared `lib/test_library.py` import/catalog
- check and grouped GPU compile, plus the named-bug regressions). Companion: a post chain for scene
- renders (`runtime_js/lib/browser/post.js`, ON; `--no-post` / `C3D_POST=0`; 18 tests) whose bloom
- is SELECTIVE (an emission mask), because on this renderer a daylight sky dome reaches 1.883
- linear while the brightest authored emissive is 1.231 — the reference's 0.85 bright-pass cut a
- daylit grass frame's saturation 0.3132 → 0.0699. Same-day consolidation: `_probe.compile_scene`
- replaced 32 hand-rolled workarounds (843 lines deleted); plan-mode `write_skeleton` ships
- `src/lib/`; `signage.js`'s `unpkg.com` pin went; the workspace lint and static shader audit skip
- `src/lib/` (3 lint ERRORs + 12 WARNs + a uTime false positive had outranked the agent's own
- shader error); `patchStandard` gained `roughnessBody` / `metalnessBody` / `outputBody` hooks
- (`<color_fragment>` reaches only the albedo, so a 30 % rust crust could only be sold by dematting
- 100 % of the material). **Not A/B-judged** (rendered and eyeballed, deterministic metrics, 2 809
- offline tests green): no paired battery has scored scenes with the library against scenes without
- it, so "it raises scene scores" is unproven (the hook change was isolated: the six
- shader.js-dependent modules — grass, water, canopy, godrays, neon, clouds — against a hooks-cut
- control build give mean luminance identical to five decimals on all 12 frames). Details:
- ARCHITECTURE §4, `prompts/scene_threejs/effects_catalog.md`, `tests/scene_runtime/lib/_probe.py`.
-
-* **D52 The articulated wave measured its own instrument first, and then only the loss events
- (2026-09-02/03).** Four articulated levers (the D49 geometry re-ask, a pro planner, a
- deterministic repair bundle, `C3D_FEWER_TURNS`) all measured inside ±0.13 on 12–14 paired
- prompts, which is not evidence that they do nothing. Decision: calibrate, then change the
- channel. Details: PAPER_WRITING §2, §4, §5, §7, §9.3; COST §29–§30.
- * **The instrument**: an A/A on `articulated_v2` (`eval/bench/ab_plan.py --aa --pin-plan`, 12
- pairs, fixed judge pro n=3) has 2 SE **±0.130** and printed "revert" from identical arms.
- * **The channel that works — loss events**: `eval/bench/plan_stage_bench.py` runs the plan stage
- alone (≈ $0.03 and ≈ 85 s per call). `C3D_PLAN_RESTART` (re-sample a collapsed plan from the
- original request) cut planner losses **4.7 % → 0.7 %** over 560 calls (Fisher p = 0.0067) and
- ships ON with a kill switch; the rows are in `eval/bench/data/plan_stage/` (a p-value whose
- data is not in the tree is not reproducible). Narrowed 2026-09-03 and re-measured three-arm in
- one window: no overall separation, but dangling-link deaths 3/140 → 0/276 (p = 0.038,
- exploratory; the residue is `parent == child` joints). The rule: measure the loss event, not
- the judge mean, unless the battery is large enough for the judge mean.
- * **A fault the judge channel could not have found**: `is_error = not obs.ok` delivered verdicts
- as broken calls the model retried (and gemini-cli stringified a 275 kB sheet into ~261 k tokens
- of base64); after the fix, calls reported as errors 26.6 % → 1.3 % and generator $/round median
- 1.572 → 0.950 (`eval/bench/session_stats.py`; the earlier hand-computed column is withdrawn).
- * **`C3D_LEAN_PROMPT` stayed OFF** (+0.030, 2 SE ±0.076, no cost saving) and the switch was
- DELETED in review (2026-09-03, −569 lines); restore it from the commit named in PAPER_WRITING
- §9.3.
- * **Reading an agent's repo is a sandbox boundary**: `read_tree_at` reads via `ls-tree -r -z` +
- `cat-file --batch`, never `git archive` (a planted `filter.<name>.smudge` executes and no flag
- turns it off); pinned by a test in `tests/flywheel_cli` (`record/_git.py`).
- * **The refine transitions are the corpus this harness is for** (`3dcode flywheel refine`: one
- row per refined round); format conversion lives in `finetune/llamafactory/`, not in the harness
- (owner's boundary, 2026-09-03).
- * **`<mimic>` changes the sweep, which is what it was for**: on the 8 of 14 prompts that declare
- a coupling the sampler drives a median 3 joints per pose instead of 6; the `joint_sweep`
- failure rate did not move detectably, and the judge- and gate-side readouts predate the
- 2026-09-04 `robot_scene` follower fix and need a re-run.
-
-* **D53 Interpenetration is measured twice, and the two probes are asking different questions
- (found 2026-09-04, corrected 2026-09-06, NOT changed).** `spatial/connectivity` draws 600 points
- per surface, requires a minimum share of them inside the other part, and calls **2 mm** a WARN
- and **10 mm** an ERROR at the REST pose. `joint_sweep` poses the mechanism through fk, records
- an overlap from **2 mm** (`sweep_collisions(tol_m=)`) and makes a REST overlap an ERROR only
- above **5 mm** (`sweep_findings(rest_max_m=)`, matched by `urdf.REST_PENETRATION_MAX_M`);
- `eval/bench/penetration_thresholds.py` imports both instead of restating them. Over 374 recorded
- articulated rounds the connectivity ERROR fired **0 times** (WARN 50; depths median 2.0 mm, max
- 9.9 mm) while the sweep raised **295 ERRORs over 191 link pairs** (median 5.0 mm, max 34.3), 288
- of them overlaps that exist only in a moved pose. The probes do not disagree about depth: on the
- 4 of 19 rest-pose pairs both recorded they agree exactly (4.4/4.4, 4.4/4.4, 2.2/2.2, 2.5/2.5 mm)
- — an earlier "2-3x deeper" compared the sweep's worst-over-all-poses with rest. The threshold
- question answered itself offline: a 2 mm connectivity ERROR would fire on 50 pairs, only 7
- corroborated by the sweep (the rest designed static contacts such as
- `shoulder_lock_knob|swivel_post`, `base_underframe|center_top`); at 5 mm, 2 pairs, 0
- corroborated. Do not align the numbers; what each check is called and documented to do is the
- fix (`spatial/connectivity.py` constants).
-
-* **D54 A gate never reports the machine as a defect, and a render is retried once when the browser
- dies (2026-09-05).** Three of the first six recorded `scenes_v1` cells built, passed every gate
- that does not need pixels and kept ZERO renders (`Attempted to use detached Frame` — Chrome
- reaping the tab on a box at load 93 with swap full): $6.75 of paid generation, no verdict. Three
- general rules: (1) a driver that lost its browser is retried ONCE, on a browser of its own
- (`spatial/node.BROWSER_LOST_MARKERS`, one vocabulary for the object and scene funnels; the retry
- runs with `C3D_BROWSER_REUSE=off` — exactly one: a box out of memory stays out of memory); (2)
- two runtime trees never share a browser (the daemon endpoint, its spawn lock and its failure file
- carry a digest of the `runtime_js` that spawned them); (3) a finding that names a dead browser is
- reported apart from a defect (`eval/bench/scene_stats.py`'s `lost to the box` column). A red
- browser test is checked against `uptime` and `free -g` before it is believed. D61 later found
- the real cause of "driver output lost". Details: RUNBOOK §5.
-
-* **D55 `scene_placement` measures matter, and matter writes depth (2026-09-05).** Two of the
- first six recorded scene cells failed the gate on nothing but their own atmosphere — a haze shell
- and a moonbeam, `MeshBasicMaterial` at opacity 0.035–0.04 with `depthWrite: false`, an idiom
- every recorded scene uses 34–42 times. A pass that writes no depth supports nothing, swallows
- nothing and overlaps nothing: `host_placement` keeps `nonSolid` meshes out of the column index
- (an asset made only of them is listed exempt `volumetric`). **Opacity is deliberately not part
- of the rule** (`runtime_js/lib/backdrop.mjs`). Measured: cozy_cabin FAIL → PASS;
- japanese_garden's 3.46 m sink becomes a 0.044 m embed and the gate now fails on a real defect it
- had been reporting alongside the fog (`SubmergedRock_1 is sunken 0.48 m into ArchedBridge`). The
- same rule in `nearGeometry` does more: `repairCameraSpec` RETREATS a lens reported "in geometry",
- and cozy_cabin's two cameras were moved back 4 m for standing in a `MoonlightShaft`; re-rendered
- with the rule they go from mean luminance 0.126 / 48 % near-black and 0.149 / 56 % to 0.263 /
- 0.5 % and 0.298 / 17 %, off `dark_frame` ERROR — two of that cell's three dark-frame ERRORs were
- manufactured by the harness (`tests/scene_runtime/test_camera_volumetric.py`; what that means for
- the track's history: PAPER_WRITING §9.2).
-
-* **D56 A loaded GLB root is named after its asset (2026-09-05).** rooftop_garden's `blender_glb`
- asset `LoungeSofa` was built, loaded and in the scene, and `scene_placement` still reported it
- missing, because a glTF root carries whatever the exporter wrote and Blender writes "Scene". The
- three assembled entry points that load GLBs (`render_scene_js`, the assembler's probe module, the
- plan-written `scene.js`) had drifted into three copies of one loop; they are one emitter,
- `_glb_preload_js`, which stamps `to_pascal(key)` on the loaded root
- (`tests/scene_runtime/test_glb_asset_naming.py`). Consequence for the Blender-scene question:
- **the cross-language seam is not what fails** — the Blender asset path works end to end and only
- lost a name; an argument for a Blender assembly layer has to be made on other grounds.
-
-* **D57 A frame rate is a measurement of the renderer that produced it (2026-09-05).** One
- `scenes_v1` battery measured fps on an RTX 6000 Ada for one cell and on SwiftShader for the next
- three (`gpu_launch.cjs` caches a negative GPU verdict for 20 minutes), `render_console` told all
- four to "merge static geometry", and two of the four critical judge issues were frame-rate
- complaints. `RenderSet.hardware_fps` is the only form a gate or a judge may read;
- `RenderSet.software_rendered` reads the renderer string with the words `gpu_launch.cjs` uses; the
- judge prompt keeps a software number but LABELS it, and an unrecognised renderer string is never
- claimed as software. An fps comparison across cells is valid only within one backend
- (`contracts/artifacts.py`, `tests/scene_gates/test_software_fps.py`). Superseded by D99: no gate or
- judge reads fps at all.
-
-* **D58 The scene texture pack is wired into the loop, behind a switch that is off (2026-09-05).**
- Four of the 24 judge issues over the first `scenes_v1` battery's five scored cells say the
- GROUND is a flat untextured colour — its most consistent defect — and that was a harness gap:
- `texturing.plan.scene_texture_pack` and `texture_pack_prompt` existed and nothing in
- `tracks/scene.py` called either (the pack was reachable only through `3dcode texture scene-pack`,
- for a human to paste). A `textures` stage runs before env and zones (they can only name files
- that exist when their prompts are built) and `_ctx` carries the manifest into both prompts.
- **`C3D_SCENE_TEXTURES` is off by default**: an image-model call per run ($0.15 measured for two
- 512 px textures, an estimated $1–2 at ten 1024 px) buys a measurement nobody has made, so the
- material class cannot count as evidence for changing renderer until this arm has run. (Told
- nothing about the verdict, the pack planner put `medieval_cobblestone` first for
- medieval_market.) Details: `tests/scene_gates/test_scene_textures_stage.py`, PAPER_WRITING §9.3.
-
-* **D59 A check that reads the scene graph by name walks the whole zone subtree (2026-09-06).**
- All five `scene_placement` ERRORs left in the fixed arm were "zone X is missing planned
- contents", and none was absent content: a zone wraps what it builds in one group
- (`IslandAssembly`) or names the placed object for its behaviour (`PineSway_0`, whose root one
- level down is `SnowyPineTree`). Each placement row carries its named descendants (`inner`,
- capped at `MAX_INNER_NAMES = 24`) and the check reads them: 5 ERRORs → 0 on the three recorded
- workspaces (`tests/scene_gates/test_zone_contents_nesting.py`). The third variant of one defect
- (D56's `Scene` root, a wrapper group, a behaviour-named parent), so the rule is: **a by-name
- check on the scene graph names a SUBTREE, never a child.**
-
-* **D60 A harness failure is never handed to the agent as a repair (2026-09-06).**
- `probes.probe_report` labels a driver that produced no output with
- `harness_failure: True` and the hint "this is a harness/driver failure, not your code",
- and `build_with_repair` did not read the flag. Measured on `eval/bench/out/scene_textures`
- (japanese_garden): three repairs against that message rewrote 5, then **14**, then 3
- files — the 14 included `env.js` and every zone — and the fourth build passed on its
- own. The 14-file rewrite deleted the texture use the arm existed to measure; that cell
- scored 0.496 where the same prompt scored 0.636 without the detour. `BuildResult`
- carries the flag now and the loop re-runs the BUILD instead, bounded by
- `MAX_HARNESS_REBUILDS = 2` and costing no model call, since the node driver has already
- retried once itself. Rare (1 cell of 12 in each of two arms) and expensive when it
- fires.
-
-* **D61 A driver's summary is flushed before it exits (2026-09-06).** `lib/cli.finish()` wrote the
- JSON summary and then called `process.exit()`, which does not flush node's asynchronous stdout to
- a PIPE: the starter scene's `probe_scene.mjs --compile` summary is 10 462 bytes to a file and was
- exactly 8192 through a pipe. **This is the real mechanism behind every "driver output lost" and
- "[?] scene did not boot" in the scene batteries, which D54 attributed to the wrong cause**: it
- depends on the census size, not on how busy the machine is, so D54's retries (still right — they
- cost nothing and cover a genuinely transient loss) could never fix a deterministic truncation.
- `finish()` sets `process.exitCode` and exits from the write's completion callback, the watchdog
- too; pinned by a driver whose summary is 64 KiB (`tests/threejs_render/test_cli_flush.py`).
-
-* **D62 The `inside_mesh_bbox` term was NOT narrowed, and here is the counter-example
- (2026-09-06).** Over the 113 recorded camera checks of `scene_baseline` the ray term
- (`nearest < 0.3 m`) never fired; all ten firings came from the bbox term, each a volumetric or a
- sparse scattered field (`Drift`, `FoliageMass`, `Midges`) whose box spans the scene while the
- lens stood 1.3–10.0 m clear of any geometry. A rule counting the bbox flag only when a ray also
- lands within 1 m (or none lands) took those ten to zero on the corpus and was then REVERTED: in
- `test_a_lens_inside_geometry_retreats_until_clear` a lens inside a FrontSide `BarCounter` has its
- rays culled by the box itself, landing on the floor 1.2 m away, so a genuinely buried camera
- would stop being repaired — and the corpus holds no buried camera, which is exactly why
- validating on it was not enough. Done 2026-09-07 with a discriminator that asks about the
- CONTAINING mesh's own volume: D67.
-
-* **D63 A scene hero climbs the same ladder as a module, and its GLB is checked like one
- (2026-09-07).** Over the 18 recorded `blender_glb` heroes: 15 of 19 first sessions killed at the
- 420 s asset clip (booked at $0), 12 of 18 GLBs ONE joined vertex-painted mesh (a one-part plan +
- "one object per plan part"), every fix prompt reading "Style of the whole scene: (none)", no GLB
- check, repairs on the 1 800 s agent default, the fix never re-judged; live on 6768aae the same
- day, 3 of 4 heroes in an asset A/B and 3 of 4 in a scene A/B produced nothing before the clip.
- Decision: ONE ladder for both asset kinds (`scene_assets._ladder`: single-shot → deterministic
- check → one feedback repair → agent session), the static planner's part list for the hero (one
- call; the asset sheet is the fallback), `_soft_findings` from one measurement of the GLB,
- `build_with_repair(timeout_s=)` clipping every repair to the asset window, a re-judged fix UNDONE
- when it judges worse, the scene brief and Blender's tool cards in the hero prompt, a 20 mm ground
- self-check. Measured after: 15 of 15 heroes built across eight scenes (1 of 4 that morning);
- re-judged (n=3), four recorded hero descriptions score 0.501 vs 0.358 for the same props as
- modules; `asset_v1` passes 9 of 13 judged (0.70–0.88) against 2 of 18 recorded. Whole-scene
- verdicts still swing 0.0–0.75 on one prompt for zone, camera and judge reasons and do not measure
- this. Details: `tracks/scene_assets.py` docstrings.
-
-* **D64 A keyframed Blender part reaches the scene as a clip, and the assembled scene
- plays it (2026-09-07).** The wrapper exports animations (an object nobody keyframed
- exports exactly as before), the preload keeps `gltf.animations` on the root — which
- `.clone()` copies — and the assembled `scene.js` drives one mixer per clone by ABSOLUTE
- time from `update(t)`, so t = 0 / 1.5 s are deterministic frames. The first attempt gave
- the zone a `clipPlayer` helper and a sentence; the windmill zone placed the clone and
- played nothing, so the harness took the job and the helper was deleted. Measured: the
- windmill's `MillCapDetail` frames a quarter turn apart (19.3 % of the frame changed; the
- judge: "the windmill sails animate correctly"), the lighthouse lens sweeping its beam
- (61 %). A zone de-phases a copy with `clone.userData.clipOffset`.
-
-* **D65 The starter `env.js` lights through `sunRig` and assigns its environment map; a small thing
- kilometres away is backdrop (2026-09-07).** 0 of 127 recorded `env.js` (and 0 of 4 written that
- morning) set `scene.environment` while every recorded hero carried Blender metalness 0.7–0.9 into
- the scene: a metalness-0.9 sphere's region reads 0.24 (black with one highlight) without the map
- and 0.55 (metal, reflecting the sky) with `sunRig`'s. The starter uses the rig (13 lines of its
- own sun + hemisphere deleted) and the env prompt says to keep it. `sunRig`'s 'SunDisc' at 3.6 km
- blew the content bbox to 2.5 km (`overview_top` ground 0.0008); `backdrop.mjs` now calls anything
- small and > 1.5 km from the origin sky. Follow-through the same evening: every prompt that
- taught lighting (the cookbook's time-of-day recipe, the contract's minimal `env.js`, `system.md`,
- the lighting skill) still taught bare lights — loop 9's lighthouse stacked a "TwilightKey" on the
- night rig, loop 8's boat passed `fillSky`/`fillGround` the rig ignored; all now hand the row's
- colours to `sunRig` (which gained the two colour overrides; the env bake's ground half follows),
- the recipe's intensity columns are gone, and both snippets are run for real under node.
-
-* **D66 A procedural module is judged on the hero's rig, and the plan's largest one keeps
- its verdict (2026-09-07).** `scene_assets` had judged threejs assets through
- `runtime.render_asset` since the stage was written and nothing defined it: 0 of 860
- recorded modules were judged while every hero was, so no paired verdict existed.
- `SceneThreeJsRuntime.render_asset` exports the module with the object track's
- `export_glb.mjs` and renders the same quick sheet. With it live the 5 % share rule alone
- still judged nothing (measured over two scenes: 1e-5 .. 2e-3 of the scene volume), so
- the plan's largest module of at least 1 m³ is judged whatever its share — one extra
- verdict per scene at most; a bollard is not a hero, a boat is.
-
-* **D67 Two placement-side false positives that cost whole rounds, measured on loop 9 and fixed at
- the source (2026-09-07).** (1) *Scale of a wrapper*: a scatter's census row is its wrapper, so
- the lighthouse's `PathAndFence/PicketFences` (twelve 2.2 m panels) measured 14.73 m against the
- plan's 2.4 m panel — a "6.1x" ERROR the judge repeated ("towering over the camera" — the frame
- shows a knee-high fence) and the repair obeyed by shrinking the run to dots (`GorseBushClusters`
- 8.6x, `CoastalRockOutcrops` 9.1x the same). Rows carry `families` (per named family of ≥ 2
- members below the row, the median largest extent of ONE member) and the scale check measures the
- family the plan's key names (`AssetRow.instance_size`), else the row's box: on the recorded
- round-0 workspace four scale ERRORs → none (0.6 m gorse vs plan 1.5, 2.16 m panels vs 2.4, 4.9 m
- rocks vs 3.8). (2) *"Inside" is the mesh's volume*: the windmill's `MillDetail` camera stood
- 4.9 m from any surface yet was `camera_in_geometry` for three rounds inside the 22 m lattice
- sails' box. `eyeInsideMesh` decides by ray parity over the mesh's own triangles (six skewed
- rays, majority, both faces — so the FrontSide `BarCounter` repair test still holds), the box
- stays the pre-filter; re-rendered, `MillDetail` inside [] / nearest 12.0 m. This is the
- discriminator D62 declined to guess at. Also: the dark-frame hint speaks the rig's vocabulary
- (`sunRig({ mood, intensity, fill })`) instead of asking for a second DirectionalLight (D65).
-
-* **D68 A session that died in a 503 storm is retried through the single-shot path (2026-09-07;
- counts corrected the same night).** Loops 10–13 ran in an evening-long Gemini 503 storm: of 40
- gemini-cli sessions that ended `timeout` (env, zones, escalated heroes, refines), 0 produced a
- final answer, 14 wrote nothing and 26 wrote partial files, each dying at the wall inside the
- CLI's own retry loop (1–15 "Attempt N failed with status 503"; gemini-cli exposes no turn count),
- while every single-shot call in the same minutes got through (hedged across the 22 keys) and
- `codex:gpt-6-astra` sessions completed. The stages whose session wrote nothing shipped the
- skeleton env and empty zones and judged 0.00–0.14 (clockmaker: "the hero LongcaseClock is
- completely missing"). The session result says why it died (`AgentResult.transient`), the
- generation result carries `transient` and `storm` (transient AND nothing written), and the ONE
- call every stage makes — `tracks.common.generate_for(ctx, task)`, which replaced seven identical
- eleven-argument `generate(...)` sites — retries a storm-dead task through `single_shot_ctx`, the
- degradation the soft budget already used. Partial files are kept and gated like any other work;
- a hero's escalated session that died transient with a failing check gets ONE more single-shot
- repair (`asset.storm_repair`). The owner's rule for the storm (2026-09-07 evening): keep
- querying, keep retrying. `single_shot_agent_id` / `single_shot_ctx` live in `tracks.common`
- (they were never scene-specific). **Superseded by D103 (2026-10-13):** the single-shot storm
- fallback, `GenerationResult.storm` and `asset.storm_repair` are deleted; a transient death gets the
- round loop's one transport retry.
-
-* **D69 An interior scene's enclosure has an owner: the environment, from the plan's bounds
- (2026-09-07).** Six interior runs of the day were judged "not enclosed — a diorama on a flat
- plane" (0.0–0.3): the planner wrote the premise (even a zone called `WindowWall`), the env
- brief's rules were all outdoor, and nobody owned the walls; the harness's round 0 sat at
- 0.30–0.57 and needed a 20–30 min refine round to reach 0.73–0.93, while the bare one-file
- baseline built the room first (0.82). `ScenePlan.interior` names the case;
- `lib/environment.js roomShell()` builds four walls and a ceiling OUTWARD of the bounds' faces (a
- zone that stays in bounds is never in a wall) with openings cut as span / sill / lintel panels;
- the skeleton's `env.js` carries `INTERIOR = { center, extents, openings: [] }` from the plan, so
- a storm-dead env session ships a room, not a plane; the env brief claims the openings and the
- light, the zone brief forbids walls. Harness-owned starter geometry the agent edits, like
- `worldShell` (D51) — not a wrapper that re-centres or grounds anything (L7). Details:
- `tests/scene_runtime/lib/test_room_shell.py`. 2026-09-23: a glass house is `ScenePlan.glazed`
- → `roomShell({ glazed: true })` (glass walls and roof on an iron frame grid, panes cast no shadow,
- the outskirts are built). Every recorded `scn_med_conservatory` round on 3.7-flash (0.00–0.14)
- was a glass house inside the opaque shell ("a solid white box … blocking the exterior view and
- lighting", critical); the 3.8-flash runs that scored 0.56–0.62 had cut each wall into one
- opening and hand-built the same glass and grid.
-
-* **D70 One author for the whole world — `C3D_ONE_WORLD_SESSION`, ON by default since the
- fixed-judge confirmation of the session that is told its window (2026-09-08).** Under one fixed
- judge (pro, n=2) and one model on both sides (`codex:gpt-6-astra@low`), a bare one-file scene
- scored 0.894 / 0.82 on the clockmaker / boat workshops where the harness's round 0 — zones
- written by separate sessions of at most two small zones each — sat at 0.17 / 0.30–0.57 and needed
- two refine rounds to reach 0.60–0.93; over four prompts the harness still led on mean (0.54 vs
- 0.36), but the day's tally over 43 judged rounds was led by what appears BETWEEN authors
- (floating / scale / interpenetration 28, missing planned content 23, cameras 21). Every zone
- brief goes to ONE session that owns every zone file, its window scaled by the zone count and its
- batch header saying whose coherence it is; env, assets, heroes, gates and rounds are unchanged.
- Measured: in-loop (loop 17, the same three briefs) round 0 clockmaker 0.17 → 0.69, boat 0.51 →
- 0.58, NYC 0.44 → 0.43; best round 0.75 → 0.82 PASS, 0.73 → 0.60, 0.60 → 0.77 PASS — two passes
- where the fan-out had none; the first fixed-judge confirmation (`cmp_scene4`) did NOT reproduce
- (0.60 / 0.60 / 0.54 vs the one-shot's 0.81 / 0.83 / 0.60; its session finished four zones in five
- minutes as a block-out ("missing stove", "shelves missing", "primitive tools", 0.32 at round 0):
- one author is coherent but thin, and n=1 per arm per brief is noise-sized), so the header now
- states the window and asks for each zone's full density; then loop 18 passed all three at round 0
- (0.81 / 0.77 / 0.88; the session spends 10–19 min instead of 5) and `cmp_scene5` put the harness
- at 0.89 / 0.89 against the one-shot's 0.92 / 0.77 (whose draws move ±0.1): the bare one-file
- scene is no longer ahead on interiors, and the harness keeps its heroes, gates, library and
- rounds on top. **Removed 2026-09-21:** the fan-out control arm (`plan_zone_batches`,
- `MAX_ZONES_PER_BATCH`, `SMALL_ZONE_CONTENTS`, the small-neighbours batch header) and the
- `C3D_ONE_WORLD_SESSION` switch; one session owning every zone file is the only path.
-
-* **D71 The starter's outdoor world ships from the library (2026-09-08).** The starter's `env.js`
- was a one-colour plane under a bare shader dome with linear fog, and the day's three most
- frequent exterior defects ("flat untextured ground", "no aerial perspective / hard world edge",
- pyramid or cone backdrops) were exactly that default. The starter now builds its ground from
- `terrain.ground()` (textured, displaced, LEVEL inside `CONTENT_RADIUS` — the plan's cameras were
- written for y ≈ 0 — and rolling beyond; `heightAt` IS that function, seeded, so mesh and seat
- cannot drift), sky / ridge / fog from `worldShell()`, the middle distance from `makeOutskirts()`,
- the light from `sunRig()` (D65) and an interior's enclosure from `roomShell()` (D69), with `MOOD`
- keeping them agreeing; the env brief says tune, never replace. Found on the way: a −1.5e-14
- coordinate read past `terrain.ground()`'s lattice (15 NaN vertices), fixed at the source.
- Measured (loop 20, the four exterior briefs, in-loop): round 0 0.55 / 0.60 / 0.49 / 0.42 against
- 0.53 / 0.60 / 0.60 / 0.34 — no lift when the env session RUNS (all four rewrote env.js, kept
- `worldShell` and `sunRig`, dropped the library ground and replaced the shell's exponential fog
- with their own linear fog; 2 of 4 kept the outskirts); what the starter buys is the default a
- session that dies (the storm's 14 of 40) or keeps it ships. Not a re-centring wrapper (L7).
- Details: `tests/scene_runtime/lib/test_exterior_starter.py`.
-
-* **D72 A camera and a hero are measured where they stand, not scene-wide (2026-09-09).** Four
- false or missing verdicts from one day's batteries, each repeated by the judge as a major issue
- and each costing a refine round: an "ant's-eye view" measured against the scene's HIGHEST ground;
- a lens under a FrontSide terrain whose frame rendered "fine"; a squat pillar 0.9 m before the
- hero camera, so the judge called the hidden hero "a massive grey box"; and a hero in the scene
- but in no authored frame. `nearGeometry` measures per lens (`ground_below_m`, `ground_above_m`,
- `near_rays`, `target_hit_m`) and `glbCoverage` renders each loaded GLB as a mask per camera
- (`glb_frac`); the gate reads them as `camera_low` / `camera_high`, `camera_under_ground_mesh`,
- `camera_blocked`, `camera_target_blocked`, `hero_unseen`, `hero_small_in_its_camera` (thresholds:
- INTERFACES spatial/). The rule behind all of it: **a wrong deterministic finding is worse than
- none, because the judge repeats it** — precision over recall, and every number names the surface
- it was measured against.
-
-* **D73 The plan's cameras are repaired out of a blocked view (2026-09-09).** (Its first half —
- a refine after a regression builds on the best round — was undone by D80: a refine builds on
- the round before it.) `PylonSlopeVista` stayed cut by a snow bank for three rounds because
- cameras belong to the plan and no session moved one. `repairCameraSpec` counts a lens staring at a surface
- (`near_rays`), a sightline cut before half the distance and a terrain overhead as "not
- clear" and searches back, up and sideways out of it; a camera NAMED for a hero whose hero
- centre is outside its frustum is re-aimed at it first (loop 25's `LanternDetail` shot the
- tower wall for three rounds while `hero_unseen` read 0.0 %). Same rule as D72's: the harness
- fixes what it can measure, deterministically, before a session is paid to guess.
-
-* **D74 Eight effect modules nobody imported are removed from the library (2026-09-21).**
- Measured over the 52 recorded scene workspaces that shipped `src/lib/`: generated scene code
- imported `mirror.js`, `scatter.js`, `season.js` in 0 runs, `creature.js`, `river.js`,
- `waterfall.js` in 1, `indoor.js`, `lights.js` in 2. No other lib module, no starter file
- and no harness python imports any of them, so each went with its
- `tests/scene_runtime/lib/test_<module>.py` and its `effects_catalog.md` row (~4.1k lines of
- lib, ~3.7k of tests); the library is 44 modules / 24.8k lines. `windows.js` (0 runs) was on
- the same list and STAYS: the shared compile (`lib/test_library.py`) chains `patchNeonSpill` over
- `patchWindowInteriors`, and `urban.js` / `neon.js` document that composition.
- A catalog row is a cost every scene session reads; a module no session calls is a row that
- buys nothing. Restore any of them from git history (the commit before this one) if a
- battery needs it — module, test and catalog row together, since
- `test_skeleton.py` pins catalog == `lib_files()`.
-* **D75 The core is what a run needs; what READS finished runs is `codeverse3d/addons`
- (2026-09-21).** `codeverse/flywheel` (the package before D78) mixed the record every run writes (Law 6) with the tools
- that turn a tree of finished runs into something else. The first is now `codeverse3d/record`
- (`record.py`, `deliverable.py`, `telemetry.py`, `_git.py` — `record.py`'s whole import closure);
- the second is `codeverse3d/addons`: `gallery`, `dataset` (export, pack, pairs, refine, captions,
- index, sample, quality), `costreport` (audit, report, caching — booking money WHILE a run happens
- stays in `codeverse3d/cost`), `calibration.py`, `skill_targets.py`. The boundary is one-way and
- tested (`tests/core/test_addons_boundary.py`): outside `codeverse3d/cli` nothing imports an
- addon, so `codeverse3d.cost` and `codeverse3d.skills` stopped re-exporting `audit_runs` and
- `check_claims`. A MOVE, which L4 does not count as a simplification: an organisation decision by
- the owner, shipped with real deletions (`flywheel/code_quality.py` — written into every record,
- read by nothing — the mesh-voxel dedupe and `flywheel dedupe`, the `flywheel gallery` alias). An
- addon has no run-time hook and so no switch; one that must act during a run gets a `Settings`
- field (no plugin registry — L4).
-* **D76 The short command is `3dcode` (2026-09-21).** `3dcv` → `3dcode` for the console script,
- the workspace dir (`.3dcv/` → `.3dcode/`), the MCP server name (tools are `mcp_3dcode_<name>` /
- `mcp__3dcode__<name>`) and the workspace git author. Runs recorded earlier stay readable and
- resumable: `.3dcv` is still harness-owned and gitignored, a legacy `3dcv` server entry is
- still cleaned from a workspace `.mcp.json`, `eval/bench/session_stats` reads both tool prefixes.
- NOT renamed then: the `CV3D_` settings prefix and the `cv3d-*` skill names (both renamed by D78,
- which reads the old names), the `3dcv_*` LLaMA-Factory dataset names. The contributor CLI in
- `toolkits/3dcode_cli` gave up the script name and is `3dcode-data` (its distribution name,
- package and credentials path are unchanged; `VENDORED.md` records the difference from upstream).
-* **D77 Evaluation lives next to the harness, not inside it (2026-09-21).** `harness/bench` →
- `eval/bench` (evaluates the HARNESS: batteries, A/B rigs, reports; the python package is still
- `bench`), `finetune/3dcodeverse_eval` → `eval/llm` (evaluates a bare LLM/VLM; the 2026-09-08
- rewrite replaces the older tracked copy), the evaluation write-ups (EVAL, COMPLEXITY,
- PAPER_WRITING) → `eval/docs`, and the 24 test files of the bench scripts → `eval/tests`. The
- dependency is one-way and now visible in the tree: `eval/*` imports `codeverse3d`, nothing under
- `harness/` imports `bench`, and the harness suite passes without `eval/`. Mixed test files were
- split where they straddled the line (`test_targets`, `test_plan_features`, `test_complexity_record`).
- The launcher is `cd eval && python -m bench.run_bench` / `python -m bench.report` since D89
- (`3dcode bench` put eval on sys.path at runtime). The two evaluations share one set of battery files
- (`eval/bench/prompts`; `llm` names the ten it can ask one-shot). Run data — `eval/bench/out`,
- `eval/llm/data/prompts/*.jsonl` — is not in git.
-* **D78 One name family: `3dcodeverse` · `codeverse3d` · `C3D` (owner, 2026-09-22).** A Python
- import name cannot start with a digit, so the package that was `codeverse` is now **`codeverse3d`**
- (the distribution, the repo and the `3dcodeverse` command keep the digit-first form; the short
- command stays `3dcode`). The abbreviation is **`C3D`** — never "CV", which reads as Computer
- Vision: the settings prefix `CV3D_*` → `C3D_*`, the skill bundles `cv3d-*` → `c3d-*` (the read
- control is `zz-c3d-read-control`), contextvar/tmp names `cv3d_*` → `c3d_*`. Config files are
- `~/.config/3dcodeverse/config.yaml` and `./3dcodeverse.yaml`. What keeps working without a change:
- `CV3D_X` in a shell is copied to `C3D_X` at first import with one warning
- (`codeverse3d/__init__._adopt_legacy_env`); the old config file names are read UNDER the new ones;
- a resumed workspace drops its old `cv3d-*` skill folders (the materializer removes every folder it
- did not route). Needs `pip install -e harness` once. NOT renamed: the `astra3d` key-file path, the
- local conda env `cv3d-eval` (renaming it would move an environment another session is using), and
- recorded data (`eval/bench/data`, anything under a runs directory).
-* **D79 Second cleanup pass (2026-09-22): what changed behaviour.** Six lanes deleted ~1.2k net lines
- (dead parameters, copies of shared helpers, the compose agent session, the library's duplicated world-space
- bases — the effect modules' compiled shaders are byte-identical, checked by fingerprint) and fixed ~30 bugs.
- The deltas a run shows: the scene judge is told authored cameras by their plan names, not `cam_*`
- (`judge_prompt_hash` moved for every rubric); calibration and pairwise judge the payload the in-run judge
- sees; routes R3/R4 attach c3d-bbox-contract to object tracks only (scene sessions lack its tools);
- `--profile` no longer overrides a user-set judge size or turn cap; claude-code usage counts the whole
- prompt and an overloaded exit is transient; shader_probe compiles without the post chain; host warnings
- reach the log; the effects catalog documents `userData.update`, `ground({rand})` and `figure()` as built.
-
-* **D80 Fixed rounds; every round kept; the pick is a reader's (owner, 2026-09-22).** A run is the
- baseline plus `--rounds` refine rounds, each built on the round before it. It stops early only on
- the clock (`budget`), the vendor's quota (`agent_quota`) or a hard failure: a refine round that
- changed nothing (`no_change`), a last round with nothing to ask for (`no_refine_tasks` — 2 of 923
- recorded verdicts had an empty improvement plan) or no verdict even after one re-judge
- (`judge_unavailable`). Gone: `StopPolicy` (pass / plateau / regression / diminishing returns —
- 37 % of 466 recorded runs stopped on one of those before `--rounds` ran out), the rewrite and
- surface-detail rounds, refine-from-best, the in-loop pairwise, `RunState.best_*`,
- `pick_best_round`, `RoundPolicy.target`. A run is never passed or failed; the judge's `passed`
- is per round. Every round keeps its build in `artifacts/rNN/` (plus its commit, renders and
- verdict); `codeverse3d/addons/select.py` picks the round to hand over (highest judged score →
- fewer gate errors → earlier; `--by pairwise` asks the pairwise judge inside 0.03) and packages it
- into `deliverable/` + `selection.json`; `3dcode make` / `resume` call it unless `--no-pick`, and
- `3dcode pick <slug> [--round N]` re-picks. The texture pass runs on the picked round only.
- Records before this read on: `passed` / `plateau` load as `stopped`, a state's `best_*` keys are
- ignored and a resume goes on from the last round. Readers (gallery, dataset, cost report,
- calibration, eval/bench) all ask `select`; bench rows say `score_picked` / `picked_round`.
-* **D81 Skills are ON by default (owner, 2026-09-22).** `C3D_SKILLS` and `C3D_SKILLS_UNVERIFIED`
- default on; `C3D_SKILLS=0` is the off switch, so an A/B's no-skills arm must name it. Evidence:
- one session per vendor CLI (gemini-cli ×2, claude-code, codex, agy) activated every routed bundle
- — 20 of 20, all before writing code — and never the control. Reads are now ground truth: each
- backend records its CLI's own tool calls in `transcript.jsonl` and the read probe reads those
- first (the atime probe was wrong on every session). gemini-cli pins `skills.enabled` (moot since D103),
- claude-code streams JSON; `.agents/` is harness-owned and git-ignored. SKILLS_LEDGER §0b.
-
-* **D82 One verdict per check (2026-09-22).** A tool returns the round's own gate, computed by the
- same function on the same inputs: `joint_sweep` → `joints_sweep.sweep_gate(ws)`, `check_placement` →
- `scene_placement.placement_gate(ws, census, plan)` (layouts and unbuilt assets from `stages/`),
- `shader_probe` → the build's one-boot probe (`spatial/probes.run_probe(compile=True)` since D95). Not the rejected
- GateDef registry: nothing is registered, the tools' private checkers are deleted (on 118 recorded
- scenes the old `check_placement` passed 20 runs the round gate failed). `BuildResult.gates` carries a
- build's own reports (scene_probe + shader_preflight, gl_frames) and `_run_round` appends them after
- the track's, failed builds included, so the shader route (R21) can fire; `census_gate_report` (always
- empty) went; the URDF build collides the rest pose only (D17) and writes no `articulation.json`;
- `GateReport.of` builds every report whose verdict is its findings. Deleted as unused (owner):
- `effect_ablation`, `compare_silhouette` / `texture_pass` / `texture_preview` (0/1/0 calls in 616
- sessions; 16 tools remain), `glsl_cookbook.md`. Small A/B against its base (2026-09-22; 3 urdf + 2
- scene prompts, `--rounds 1`, one run each, inside a 503 storm): articulated picked 0.75 / 0.61 / 0.50
- → 0.63 / 0.70 / 0.59 (mean 0.621 → 0.642), scenes 0.03 / unjudged → 0.09 / 0.47 — nothing broke, and
- n this small cannot resolve a gain (runs in `~/3dcodeverse_runs/ab_verdict_2026-09-22`).
-* **D83 A vendor session gets its prompt on stdin, sees only routed skills, and is read back from its
- own record (2026-09-22).** Every CLI reads the prompt from stdin, byte-identical (a 5-zone scene prompt
- passed gemini's 2 000-line `read_file` cut when it went through `task_prompt.md`; argv caps an argument
- at 128 KiB). claude-code runs `--setting-sources project` + no bundled skills (26 extra skills
- before), so its effort is the harness's (`agents.claude_effort`, xhigh — what it inherited until
- then); codex `skills.bundled.enabled=false`; gemini `skills.disabled`; agy has no switch. A session
- with no envelope books usage from the CLI's own record (gemini chat log, claude stream): replayed
- over the 11 gemini sessions of the 2026-09-22 live runs, $0.219 booked → $5.11. `provider_wait_s`
- is the time a session lost to provider errors (a lower bound for gemini, 0 for codex). Failure
- classes travel typed (`AgentResult.transient/quota` → `RoundFailed`); a plain timeout is no longer
- retried as a transport death. One `cli_common.classify_end` decides every vendor's end (owner,
- 2026-09-24, N71): a watchdog kill is transient only when nothing was produced and the CLI's own record
- shows provider retries, and a spent usage limit or a 429 is `budget` for all four.
-* **D84 One minutes, one record of money (owner, 2026-09-22).** Every step is a `StepTime{step,
- round, wall_s, lost_s}`; `RunRecord.minutes` = Σ(wall − lost) over run and round steps — lost is a
- session's `provider_wait_s` or an API call's time outside its answered round-trips; parallel work is
- one step. Every reader (select, gallery, `3dcode show`/`cost`, dataset, eval/bench) reads it; a record
- without steps counts its own clock. `max_minutes` stays a wall-clock LIMIT (it must stop a storm).
- `telemetry/cost.jsonl` is the only money record: `total_usage` = its sum at list price (every
- `live` / `session` / `extra` row once — `extra` is a billed hedge loser), a round's cost is what it
- booked; `BudgetGuard` is a clock; gone: `billing.py`, `routing.py`, `cost/reconstruct.py` (the 33
- pre-ledger runs are outside the repo), `C3D_COST_LEDGER`, `cost.round`, PROVENANCE (one price table).
-* **D85 Machine-wide in-flight slots; the schedulers that never engaged are gone (2026-09-22).**
- `max_in_flight` is N `flock`'d slot files every process shares (`<cache>/slots/gemini/NN.lock`); a
- slot guards one harness API call, a CLI session takes a key but no slot (a session-long slot would
- starve judges). The kernel frees a dead holder's lock, so §23's staleness worry is gone, and with it
- the `/proc` sibling scan (it hard-coded eval entry points) and ab_plan's refusal. Measured
- (`tests/models/test_slots.py`): 8 processes / 4 slots peak exactly 4; a SIGKILLed holder's slot back
- in 37–70 ms; deadlines kept to 1 ms. Deleted: TokenBucket (peak 3.9 % of TPM), StormGate (shipped
- OFF), `with_retries` (one retry loop), `fewer_turns` (OFF since COST §29).
-* **D86 One switch grammar (2026-09-22).** Every `C3D_*` knob is a `Settings` field read through
- `get_settings()`; an on/off switch is a `Flag` (on/off/1/0/true/false/yes/no; a typo warns and
- keeps the default — amends D44(c)); env beats yaml; four nested knobs keep a flat spelling
- (`C3D_MAX_IN_FLIGHT`, `C3D_RENDER_GPU`, `C3D_SEED_RECIPES`, `C3D_AGENT_MAX_TURNS`). Fixed on the
- way: `=off` was ignored by `C3D_STREAM`, `C3D_IPV4`, `C3D_AXIS_REPAIR`. `env_flag`, the `*_enabled`
- helpers, `skills/config.py` and 14 hand parsers are gone; `plan_features` derives live names from
- `Settings.model_fields`. Tests set a switch through the `switch` fixture (settings are cached).
-* **D87 The pipeline states each rule once (2026-09-22).** One plan digest and one round payload
- (`judges/base.plan_summary`, `round_input`) for the live judge, `3dcode judge`, calibration, the texture
- gate and eval — replays of Z-up objects read W×H×D again and graphics replays keep passes and motion.
- One per-language prompt lookup (`prompts/catalog.language_prompt`; `RuntimeDocs`, `contract_doc` gone).
- The runtime owns the file layout (`expected_files` / `files_for`); `tracks/planner.py` owns what
- differs per track at planning (six BaseTrack hooks gone); the GLB ↔ authoring frame mapping is
- `conventions.to_authoring_frame` (L2). The round history lives only in `rounds/rNN.json` + commits
- (`RunState` caches none of it). `3dcode show` is the one single-run view (`status` = its STATUS).
-* **D88 One build plumbing (2026-09-22).** The python wrappers live in `languages/wrappers/` beside
- a stdlib-only `_wrapper_common.py` (report, memory cap, seeding, script runner, traceback mapping);
- `run_bpy_links` stopped writing its own (it failed on `sys.exit(0)`, had no seeding);
- `compose_build_result` writes the final BuildResult as `build.json`, the one build status
- (`build_last.json` gone). JS syntax: one node process per lint, a content-hash cache (scene lint
- 2.4–2.7 s → 0.01–0.24 s), `node --check` confirms any rejection. One section renderer: the
- `cross_section` tool draws through the D48 judge path, whose slices are pinned to the pixel.
- The front_back slice's note said "front left" while +Z (front) is drawn on the right; the note
- now says "front right" (owner: the label must match the image the judge gets).
-* **D89 Evaluation states uncertainty one way (2026-09-22).** `eval/bench/stats.py`: the paired 95 %
- Student-t interval ("separated" = excludes zero; 2·SE understated it by 15–38 % at n = 4–8), the
- exact sign test, `statistics.correlation`. Every journal is read through `_jsonl.read_jsonl`
- (a truncated last line is skipped) and deduplicated by `_jsonl.latest`; `ArmStats` is the one arm
- aggregate. Numbers quoted before 2026-09-22 are 2·SE bands. The battery launcher left the harness
- CLI: `cd eval && python -m bench.run_bench …` / `python -m bench.report …` (same flags).
-
-* **D90 Resume never re-pays a finished stage over existing rounds (2026-09-23).** Once rounds exist,
- `StageRunner(frozen=True)` serves every RECORDED pre-round stage whatever its key and emits
- `stage.frozen` — 81 of 91 recorded scene runs had drifted keys (e.g. `ScenePlan.interior`, 964a0a7) and
- a resume re-ran the paid env/zones sessions over refined `src/`. The zones budget check runs after the
- stage is recorded, so a finished zones session is cached even when the clock trips on it (its written
- zones are recorded ok). `resume --force` always archives the rounds to `rounds/pre_force/` and is THE
- way to regenerate a stage (owner). Not covered: a stage that never finished still re-runs. Texture
- packs join the env/zones keys only when they have files; `C3D_ZONE_LAYOUTS=off` skips the stage.
-* **D91 The pre-round pipeline is data (Phase B, owner's clarity trade, +39 lines).** Each track declares
- its pre-round stages as a `stages` tuple of `StageNode`s; `run_stages` walks them over `StageRunner`;
- ARCHITECTURE §7.1 is generated from the declarations (a test fails on drift). The round
- (`steps._run_round`, a 15-step chain nothing can cache) and the loop (`_round_loop`, a 7-exit state
- machine) stay code by design — a generic DAG framework measured +190 lines and four rejected
- abstractions (review 2, `~/3dcodeverse_runs/arch_review2_2026-09-22/REVIEW.md`). Scene refuses
- `--candidates N>1` (`TrackInfo.best_of_n`; a profile's value becomes 1); a run whose baseline session
- wrote code before the clock stop gets one judged salvage round.
-* **D92 A reader reads the round it names (2026-09-23).** `select.round_file` / `round_complexity_block`
- / `judge_for`: calibration, `3dcode judge`, the dataset export, the gallery, `texture pass` (the PICKED
- round), h2h, complexity and skill_targets read that round's own GLB / GIF / meshes / metrics and the
- live run's judge class — none falls back to the last build any more (D80's promise). Old runs keep
- their raw `best_round` across a record rewrite (a legacy read-only field) so their per-round files are
- still found. `find_run_dirs` lists a symlinked run once.
-* **D93 No agent-visible text states a harness limit (owner, 2026-09-23).** Build/render time, triangle,
- draw-call, instance, size and count caps, fps targets and gate thresholds are gone from contracts,
- system prompts, cookbooks, templates, skills (their `_claims` went with them), tool headers and starter
- comments — the inventory found most of them wrong (repair "300k" vs 600k, scenes "2 M" vs 3 M, builds
- "120 s / 20 s" vs 300 s, hero assets "60k–600k" vs a 40k check). Enforcement is unchanged, and an
- error that fires on an actual violation still states its number; geometric tolerances stay.
- DETAIL BUDGET became numberless advice. Inventory: `…/arch_review2_2026-09-22/limits/INVENTORY.md`.
-* **D94 PascalCase accepts acronyms (owner).** LED, TV, TVStand, USBPort, CPU_2 are valid names:
- `conventions.PASCAL_RE` = `^[A-Z][A-Za-z0-9]*(?:_\d+)?$`, `to_pascal` keeps a valid name as written,
- the stdlib wrapper copies are pinned to conventions by a test; snake keys (`tv_stand`) are unchanged.
-* **D95 Review-2 clean-up (2026-09-23): what it deleted and what it guards.** ≈ −600 production lines
- over 90+ commits: joints/spatial re-export facades, dead language code, the second cookbook-section
- parser, `probe_and_preflight` (one `run_probe(compile=)`), an `SdkModel` base, a metered `_Proxy` base,
- the write-only `RunTelemetry.files` / `.environment`, the `wasted_usage` money channel, the second
- round-journal reader in `skills_hook`, dead skills surfaces. One rule each for: harness-owned
- paths (a single-shot write can no longer overwrite `src/lib/`, paths are normalised first), JSONL
- resume reads in eval/llm, correlation. Guard: `tests/prompts/manifest.py` hashes every prompt and judge
- payload the fakes drive; a code-only change must leave it byte-identical, a text change re-blesses it
- (`python -m tests.prompts.manifest --bless`) in the same commit. claude-code's effort stays the
- harness's `agents.claude_effort`. Test fakes: one `FakeChatModel`, one scripted `FakeAgent` (−800 test lines).
-
-* **D96 A test earns its place (owner, 2026-09-23).** The suite had 64k lines for 52k of product code.
- A test stays when it runs production lines no other test runs (per-test coverage contexts), pins a
- contract or safety property (manifest, harness-owned paths, resume/record compatibility, the ledger,
- typed failures, a D-rule), is the regression test of a named bug, or asserts a value no other test
- does. Everything else went: python tests −31 % (coverage 91.62 → 91.57 %, 14 defensive lines lost),
- `tests/scene_runtime` 25.6k → 6.0k lines — the effect library is one shared import/catalog check and
- one grouped GPU compile plus its named-bug regressions (17 of 17 mutations still caught).
-
-* **D97 Natural-element effects, one ownership rule, and the graphics lab (2026-09-23).** Fourteen
- modules join `starter/src/lib/` as source (D51): fire / firefield / smoke / cloudvolume (bounded ray
- marches over baked 3D noise — prescribed transport, not simulation), ocean / stream / waterfall / ice,
- meadow / tree / rock / sand / paving, and `lifecycle.js`: `snapshotResources` + `attachDisposal` are the
- one rule every object factory in `src/lib/` disposes by (construction-owned geometry, materials, instance buffers released
- once; textures and caller additions borrowed). `shader.js` gained `clonePatchedMaterial`,
- `withRendererState`, alpha/normal/transmission hooks and inverse-transpose normals; finish patches now
- change roughness per pixel under their own mask, not the material's. Scenes may load
- `src/shaders/*.{vert,frag,glsl}` as text (audited by `shader_report`). Named bugs: three r182 compiles
- `PCFSoftShadowMap` as BASIC (the renderer uses `PCFShadowMap`); the census missed shader-instanced
- geometry; GlHost doubled a relative out dir. Tests follow D96 (a BUILD row + a GPU group each). The
- catalog and planner say the effects are zone code, never assets, with no limits stated (D93) — the
- "never assets" half is superseded by D100.
- `examples/graphics_lab/` is a dev lab (sixteen hand-composed studies rendered through the production
- scene and GL hosts); its `output/` is ignored and none of its media is committed. 2026-09-23: the lab's
- session notes, provenance tooling, audit logs and the unused cinematic judge were deleted (owner); the lab
- keeps build/capture/viewer/serve/scenes.
-* **D98 One statement per rule, across python/JS and prompts (review 2 C2/C4/C5, 2026-09-23).** The
- single-shot envelope is stated once, in `system/singleshot_format.md` (the brief points at it). Where
- python and JS each decided a rule, the side the recorded runs proved right became the one home:
- placement exempt words = `runtime_js/lib/placement_words.json` (gate + settle, plurals included); "camera
- named for a hero" = the host's `namesHero`, carried as `camera_checks[].hero_for`; the URDF a sweep reads
- = the built `artifacts/robot.urdf` only; an unset PBR factor = `texturing/materials.py` (a scene pack's
- roughness stays its own 0.8 surface default). The hero asset's context file omits `harness_contract.md`
- on purpose (its ±1 cm object acceptance contradicts the prop sheet). D93 extended: a gate's detection
- threshold is not stated as a geometric rule in always-on text (bbox ±0.01 m, camera 0.3/0.5 m, placement
- 2 cm/2.5x…); construction values (weld overlap, clearances, wall thickness) and the skills' pinned
- gate explanations stay.
-* **D99 The scene draw budget is a census count gated in code; fps is a record only (owner, 2026-09-24).**
- The regression: D93 took "≤ 200 draw calls" / "≤ 40 per zone" / "fps ≥ 30" / "≤ 300 meshes" out of the
- scene prompts, but nothing in code enforced draws — only a `hardware_fps < 20` WARN, which never becomes a
- task. On the same scenes_v2 prompts the new tree's agents wrote 3–6x the meshes (P3 95a9820 → P4
- 93af8d6e: cliff_monastery 506 → 1 450 meshes and 69 → 4.9 fps, conservatory 311 → 1 776, canal_town
- 1 950 → 12 665; the conservatory's round 0 drew 46 567 calls at 1 fps). Decision 1: `scene_probe` gates
- the census's `totals.draws` — one per visible Mesh / Points / Line / Sprite per material group, an
- InstancedMesh once (`host_census.mjs` `objectDraws`) — the number the probe (and the `scene_probe` tool)
- reports, independent of camera, culling, GPU and load; the render's `fps.draw_calls` is one frame from one
- camera and adds culling and shadow passes (0.54 / 0.91 / 1.81x the mesh count at p5 / p50 / p95 on
- the corpus). WARN above
- `conventions.DRAWS_WARN_SCENE` = 5 000, ERROR above `MAX_DRAWS_SCENE` = 15 000; the ERROR fails the build,
- so `build_with_repair` hands it to the round's repair session with the count, the threshold, the three
- heaviest top-level groups and the fix (InstancedMesh / `mergeGeometries`, `lib/instancing.js` /
- `lib/merge.js`). Tuned on 753 recorded rendered scene rounds (~/3dcodeverse_bench_out, ~/3dcodeverse_runs;
- mesh count, which the re-probed draws match to < 1 %): log(meshes) vs log(fps) r = −0.88 (triangles −0.54);
- median fps 232 below 500 meshes, 15 at 1–2 k, 10 at 2–4 k, 4.5 at 5–7.5 k, 2 past 10 k, 0.6 past 20 k.
- Pre-D93 harness rounds (n = 255): p50 2 943, p90 6 203, p99 12 348, max 17 291 — 20 % WARN, 0.4 % (one
- 1-fps conservatory) ERROR; post-D93 (n = 218): p90 11 212, p95 20 450, max 55 990 — 6.9 % ERROR, every one
- at ≤ 4.4 fps. One-shot baselines never pass 4 761. The `render_console` fps WARN, `perf_detail`,
- `RenderSet.hardware_fps` / `software_rendered` are deleted (D57's labelling has no reader left).
- Decision 2: fps leaves the judge — no `PROBE: … fps` line, and `scene_v1` no longer asks for "acceptable /
- healthy fps" (Law 3: the VLM judges pictures; performance is gated in code, animation by the
- frame-difference metric). `RenderSet.fps` stays as a recorded measurement (and in the `scene_views` tool's
- output). `SCORING_VERSION` stays 3: it stamps the arithmetic downstream of the model, which is unchanged,
- and a stored verdict still replays; the judge INPUT changed (manifest re-blessed), so a scene judged before
- and after this commit differs by the fps line and two rubric phrases. A draw WARN is still a gate WARN in
- the judge's list, which the judge is told never makes a defect present.
-
-* **D100 A three.js scene asset may import the effect library (owner, 2026-09-24).** `src/assets/<snake>.js`
- may `import { makeTree } from '../lib/tree.js'` and compose a factory with its own parts: `src/lib/` is
- copied into every workspace and committed with `src/`, so the deliverable and the dataset sample (both
- read the round's commit) carry it and the output stays self-contained — a copied-out deliverable boots
- alone. Until now `asset.md` said "no imports beyond three" and `plan_scene.j2` routed every effect to
- zone/env code; the code never rejected the import (lint, node check and GLB export all resolve
- `../lib/`), but the asset check did: a factory's triangles counted against the per-asset budget (one
- lean birch is 80 k, the wood alone 75 k) and its below-grade roots read as "sinks", so every such asset
- failed twice and escalated to an agent session. Now `lib/lifecycle.js` `attachDisposal` records the
- tree it claims (`isLibraryBuilt`, a WeakSet); `asset_check.mjs` loads the workspace's own lifecycle
- module (the instance the asset's imports load) and reports what a factory built as `lib_tris` — held to
- the one-object ceiling `MAX_TRIS_OBJECT`, not `ASSET_MAX_TRIS` — and seats a factory by its origin. The
- asset's own geometry keeps every rule. A `blender_glb` hero cannot import it. The asset prompt carries
- only the catalog rows of the factories its sheet names (by camelCase call or module file,
- `scene_assets.library_rows`), not the whole catalog. Not changed: the scene placement gate still
- measures an asset's lowest vertex, so a library tree's roots inside a non-exempt asset name can read
- as sunken there, as they already did for zone-placed trees.
-
-* **D101 The scene track is language-dispatched through `SceneRuntime` (2026-09-24).** In preparation for
- `scene_blender` (`~/3dcodeverse_runs/scene_blender_2026-09-24/DESIGN.md` §11 phase 0):
- `languages/base.py` `SceneRuntime` (a `LanguageRuntime` plus `zone_file`, `asset_file`, `assemble`,
- `probe`, `render_scene`) is the only way the scene stages (`tracks/scene.py`, `tracks/scene_assets.py`),
- `Services.render_scene` / `assemble_scene` (which now take the runtime), the scene tools (`scene_probe`,
- `scene_views`, `check_placement`, registered for `SCENE_LANGUAGES`), `3dcode render` and the fixed
- evaluator reach a scene language; none of them imports `scene_threejs` any more. `SceneThreeJsRuntime`
- implements it by delegation, so behaviour is byte-identical (prompt manifest unchanged, not re-blessed).
- The design's `probe_args` member was left out: the probe's driver flags are the runtime's own business
- inside `probe`/`build`, and nothing outside a runtime would read them. `shader_probe` stays three.js-only.
-
-* **D102 scene_blender phase 1: contracts, the Blender build and the geometry gates on a census GLB (2026-09-24).**
- DESIGN (`~/3dcodeverse_runs/scene_blender_2026-09-24/DESIGN.md`) §11 phase 1, owner decisions D1–D12.
- `Language.SCENE_BLENDER` is the scene track's second language (`src/scene.py` entry, Z-up frame in
- `conventions.LANGUAGE_FRAME`, `HARNESS_OWNED_SRC` `src/lib/`), with `SceneBlenderRuntime` (`languages/scene_blender`).
- `src/scene.py` is assembled DATA (`ZONES` / `ASSETS` / `HEROES` / `CAMERAS`, the plan's cameras converted
- to the Blender frame; the plan stays Y-up, D12). The build is one Blender process (`wrappers/run_bpy_scene.py`):
- env, heroes (GLB import, D6), assets and every zone each run in isolation. A builder that raises is an
- ERROR on its `file:line`, and everything it created is removed, so the zone is dropped while the rest is
- still measured. The geometry gates stay the JS ones. The wrapper writes `artifacts/census.glb` with the
- harness writer (`wrappers/_census_glb.py`, from the evaluated depsgraph: collection instances become
- clones, other instance clouds become `EXT_mesh_gpu_instancing`, fog volumes are not matter, custom props
- become `extras`). `probe_scene.mjs --glb` boots `runtime_js/lib/glb_scene.mjs` on it with no settle
- and no camera repair (D3). `probes.run_probe(glb=, facts=)` merges the bpy facts the GLB cannot carry
- (fog, background, lamps, drivers, handlers, unique/instanced triangles). D2: no draw gate offline; an
- ERROR above `MAX_TRIS_SCENE` UNIQUE triangles instead. D10: Python drivers and added `bpy.app.handlers`
- are a lint ERROR and a census ERROR. `AssetPlan.kind` gains `bpy` (D5). The schema a planner is
- handed keeps scene_threejs's enum (`SCENE_ASSET_KINDS`), so every scene_threejs payload stays
- byte-identical (manifest not re-blessed). scene_blender's tool list is held out of the manifest
- (`UNBLESSED_LANGUAGES`) and its prompt files are pending (`PROMPTS_PENDING`) until phase 3. The
- object lint's bpy traps are shared (`blender.call_traps` / `store_traps` / `source_traps`), not copied.
- Measured on the design's probe scenes: bpy 520 760 / 619 968 triangles = census 520 760 / 619 968;
- build 5.0 s / 7.5 s (wrapper 3.4–5.3 s, of which GLB 0.1 / 0.8 s; JS probe 1–2.4 s).
- `render_scene` raises NotImplementedError until phase 2.
-
-* **D102b scene_blender pictures come from Blender; the camera checks and the metrics schema stay the JS host's
- (2026-09-24, lane B of D102; written as "D103, the lead renumbers" — renumbered D102b, as its commit names it).** DESIGN §11 phase 2, owner D1/D2/D3/D8.
- `spatial/render_blender.render_blender_scene` is what the language's `render_scene` calls: (1)
- `runtime_js/fit_orbit.mjs` fits the orbit rig to the build's `census.json` with the unchanged `orbit.mjs`; (2)
- `languages/wrappers/render_bpy_scene.py` opens `artifacts/scene.blend` and renders the authored cameras × every
- time plus the first three overviews at t0 — the judge's views and the motion pair, nothing else — with
- harness-owned settings (Cycles CUDA 32 spp adaptive + OIDN, fixed seed, AgX / exposure 0, RGB PNG; frames
- `1 + round(30 t)`); (3) `render_scene.mjs --external-frames` loads the census GLB through the language's host
- entry and computes every camera check on it, but its luminance statistics from the Blender PNG
- (`host_metrics.imageFrameStats` = the one `frameStats` on an image), no settle / repair / post; (4)
- `render_scene.render_set_from_metrics` (split out of `render_scene`, byte-identical for three.js) builds the
- RenderSet. metrics.json has the three.js schema plus `language` and `blender` (engine, device, samples, the
- fallback, per-frame and per-step times). GPU sharing (D8): `Settings.render.blender_gpu_slots` (2) flock'd
- slots under `<cache_dir>/slots/blender_gpu/`; a render waits `blender_gpu_wait_s` (60 s) and then renders on the
- CPU, and a GPU run that dies without a result is rendered once more on the CPU; a timeout is the scene's, no
- retry. `blender_engine` (cycles | eevee — EEVEE runs under `gl_render.GPU_ENV`) and `blender_samples` (the
- profile dial: economy 16 · balanced 32 · quality 64). The frame and placement gates keep one set of
- thresholds and carry a per-language fix-hint table (`frame_metrics.HINTS` keyed by `metrics["language"]`,
- `scene_placement.LANGUAGE_WORDS` by `census["language"]`); D2's render-time WARN is `slow_frame` (median
- judged frame > 10 s GPU / 33 s CPU, naming the content group with the most triangles). `3dcode doctor` gains
- `blender cycles` / `blender eevee` / `blender gpu slots`. Measured on this box, 1024x576, 7 frames (2 authored ×
- 2 times + 3 overviews), GPU shared with other work: Cycles CUDA 32 spp 0.9-1.6 s/frame on the 520 k-tri probe
- scene (13.3 s for the whole render incl. 2.4-3.6 s geometry pass), 1.4-4.2 s/frame on the heavy one (21.1 s);
- 16 spp 10.5 / 18.9 s; 64 spp 14.1 / 36.2 s; CPU 32 spp 33.7 / 80.9 s; EEVEE 64 24.3 / 66.4 s (first frame
- 9-20 s of shader compile). Not done here: the eye-level rig views get no Blender pixels (DESIGN §5.2: nobody
- reads them), so their exposure is unmeasured; `no_fog` overviews unlink only the world volume (a bounded fog
- object still renders).
-
-* **D103 gemini-cli is deleted; Google's models run through agy (owner, 2026-10-13).** gemini-cli and its
- retry layers were the heaviest vendor-specific burden in `agents/` (a per-session system settings file,
- chat-record reading, stderr retry-line parsing, a key-rotating retry loop inside the backend, a storm
- fallback above it), and agy 1.3.4 now takes a Gemini API key and an MCP server, so Google's models lose
- nothing. Deleted: `GeminiCliAgent`, its system settings file, `read_gemini_chats`, `GeminiRetries`, the
- 2–3-attempt retry loop with `retry_window_left` / `_retry_key` / `RETRY_KEY_WAIT_S` / `QUOTA_MAX_ATTEMPTS`,
- `Settings.binaries.gemini_cli`, `cli_common.invoke`'s `attempt` / `soft_timeout_s` (captures are always
- `stdout.json` / `stderr.log`), `find_json_object`'s multi-line scan (only gemini-cli printed indented
- JSON), the doctor rows `gemini-cli` and `gemini-cli skills setting`. `agents/registry.KINDS` =
- `("claude-code", "codex", "agy")`; the default generator (and balanced / quality) is `agy:gemini-4-argon`.
- agy runs in **Gemini-API mode only** (owner, same day: no subscription sign-in, no Claude models, and
- the default is `agy:gemini-4-argon`, `DEFAULT_AGY_MODEL` for a bare `agy`; no keys → `available()` is
- false, the session fails at once) — one key per session from THE shared pool (`models.gemini.shared_pool`,
- `KeyPool.lease_session_key`, no in-flight slot; a machine-wide flock lease per key keeps parallel runs
- one session per key until the keys run out, then shares — added after a 14-run parallel wave put 4
- sessions on one key; `shared_pool` also starts each process at a random key), the outcome reported back (429 → cooldown, 401/403/
- `API_KEY_INVALID` → dead, 5xx, ok, skip); a fresh HOME under `<cache_dir>/agy_homes/…` holding
- `.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (without it agy ignores
- `GEMINI_API_KEY` and demands a login) and `.gemini/config/mcp_config.json` with the `3dcode` server
- (`env.HOME` = the real home), deleted after the session once the tool trace is read from its
- conversation db; argv `--model gemini-api://<bare id> --effort <low|medium|high>` (any id goes verbatim,
- e.g. gemini-4-argon; effort from an agy-style `-low/-medium/-high` suffix, default `high` — the Gemini
- API's own default, what gemini-cli sessions ran at); priced at Gemini list price with output = output −
- thinking and thoughts = thinking (agy's `output_tokens` already include thinking: billed once);
- `PUPPETEER_CACHE_DIR` = the real cache for the agent's shell. Deleted with the subscription mode:
- `available_models` / `resolve_model` (the `agy models` probe that added an effort suffix), the AGENTS.md
- shell-fallback paragraph, and the $0 booking. No retry loop in the backend: agy retries its own
- model calls (≤ 30 s waits since 1.3.4, stops at once on a spent daily quota), and a transient death goes
- to the round loop's ONE transport retry (`tracks/lifecycle`), which takes a fresh key. Workspace
- materialisation writes `AGENTS.md` + `CLAUDE.md` only — no `GEMINI.md` (agy reads it AND `AGENTS.md`,
- so the body was loaded twice), no `.gemini/settings.json` — and `.antigravityignore` replaces
- `.geminiignore` / `.aiexclude`. doctor: CLI rows agy / claude / codex and a new `agy gemini keys` row
- (OK "N-key pool"; FAIL without keys). Prompt manifest re-blessed
- (context files, generator id). Consequences: **no single-shot storm fallback** — `tracks.common.
- generate_for` is plain `generate()`, `GenerationResult.storm` is gone, and so are the asset ladder's
- storm-repair rung (strategy `escalated+repair`) and the events `generate.storm_fallback` /
- `asset.storm_repair` (D68 superseded; `repair.storm` and the lifecycle transport retry stay); agy gets
- the 3dcode MCP tools (it had none); the GEMINI.md double load is fixed; effort defaults to
- `high`. Live facts (2026-10-13, agy 1.3.4): API mode lists gemini-3.8/3.7/3.6-flash and 3.1-pro; the
- subscription sign-in no longer serves gemini-3.7-flash (only 3.8-flash, claude-sonnet/opus-4-6, gpt-oss).
- The profiles' $ / score expectations were measured on gemini-cli:gemini-3.6-flash and are not re-measured
- on agy:gemini-4-argon ($2.00 / $10.00 per M, ~2.7× 3.6-flash).
-
-* **D104 Blender 5.2.2 LTS is THE supported Blender; the judged-frame fast path is Cycles CUDA + GPU OIDN +
- persistent data (owner, 2026-10-14).** The owner replaced 5.0.1 with 5.2.2 LTS and dropped 4.2 / 5.0
- compatibility ("不需要兼容5.0.1了"): `BLENDER_MIN = (5, 2)`, `resolve_blender()` looks for `blender-5.2`
- then `blender`, doctor fails anything older. Verified on 5.2.2 (this box, RTX 5090, driver 610.88): the
- whole offline suite (1634) passes unchanged; the API facts the lints and prompts state were re-probed —
- Principled inputs ('Anisotropic' and 'Specular Tint' still exist; 'Thin Wall', 'Thin Film Thickness/IOR'
- are new), boolean solvers are FLOAT / EXACT / MANIFOLD ('FAST' raises), sky types SINGLE_SCATTERING /
- MULTIPLE_SCATTERING / PREETHAM / HOSEK_WILKIE, `Material/World/Light.use_nodes` are deprecated (removed in
- 6.0; every new datablock already has a node tree), geometry-nodes modifier inputs moved to
- `getattr(mod.properties.inputs, 'Socket_2').value = v` (`mod['Socket_2'] = v` raises TypeError — 5.2
- Python API notes), Blender's python is 3.13 and the user site is no longer loaded (the wrappers are
- stdlib + bpy + numpy only, as before). Render measurements (1024x576, 460 objects): Cycles CUDA 32 spp
- + GPU OIDN 0.64 s/frame; with `render.use_persistent_data` the synced scene + BVH survive between the
- cameras of one job — 8 frames 5.3 s → 2.2 s, 0.21 s/frame after the first; 64 spp 0.69 s, 128 spp
- 0.86 s; CPU 2.3 s; EEVEE in background 5.2 s/frame + a 12 s shader compile (slower than Cycles GPU here,
- so Cycles stays the default); Workbench 0.12 s. OptiX is unavailable under WSL2 (libnvoptix: init error
- 7804) and setting `compute_device_type = 'OPTIX'` then back to CUDA crashes Blender — the harness never
- probes it (`render_bpy_scene.setup_render`, doctor). Shipped: persistent data on for every Cycles job,
- `Settings.render.blender_frame_time_limit_s` (20 s cap per frame via `cycles.time_limit`, 0 = none) in
- the job and in `metrics.blender`, the doctor times one 256x144 32-spp frame on the fast path, two lint
- traps shared by both bpy languages (`solver = 'FAST'` → ERROR; `x["Socket_…"] = …` → ERROR with the 5.2
- idiom), and the cookbook / contract / docs say 5.2 LTS. Not re-measured on 5.2.2: the skills' "verified
- on 5.0.1" geometry numbers (subsurf shrink, primitive extents) — properties of the mesh code, not of the
- renderer; the live gate tests that exercise them pass on 5.2.2.
-
-* **D105 The argon scene-tuning program: per-model variants, scene_blender first-class, scene judge v2 with
- strict placement standards, and the eval loop with argon as generator AND judge (owner, 2026-10-14/15).**
- The owner wants the harness specialised per model and looped — "变体按单个模型分", scene_blender "都可以补齐",
- a judge that "彻底解决 floating、穿模", "连通性…标准…严格一些", ~30 generated prompts per iteration that get
- harder, both scene languages at once, "argon 用来生成 code … 同时也要用来作为 judge", and a standalone repo.
- Decisions. (a) **Variants** (`prompts/variants.py`): an overlay `codeverse3d/prompts/variants/<name>/`
- shadows prompt files (a jinja ChoiceLoader; the base environment is untouched so base rendering is
- byte-identical), `codeverse3d/skills/variants/<name>/` shadows bundles and `routes.toml` adds typed
- boosts / disables / rows (a standing row never reaches the gate-fired floor 90), `variant.toml` names
- version + generators + knobs ⊂ {skills_max, skills_only}. Selected EXPLICITLY — `3dcode make --variant`,
- `Settings.variant`, or `Settings.variants` by the exact generator id then `<kind>:<served model>` — never a
- regex over the id (L4); frozen on `RunOptions.variant`; recorded in `environment.variant`, `extra.variant`
- {name, version, hash}, `prompt_hashes.variant` and `SettingsSnapshot.variant*`; the plan stage key names
- the variant only when set. One variant per process (knobs are process-wide, the overlays are
- context-local). The `argon` variant ships EMPTY (v1) so the loop's iteration 0 measures the base. The
- judge is NOT variant-scoped: it is the instrument. (b) **scene_blender** runs end to end: prompts
- (system / contract / cookbook / asset / effects_catalog), bpy sibling templates chosen by
- `tracks.scene.SCENE_TEMPLATES[language]` (the three.js payloads stay byte-identical), a planner template per
- (track, language) whose schema carries the language's asset kinds (`bpy`, `blender_glb`), a bpy asset ladder
- checked in Blender, a harness-owned starter library (13 modules under `languages/scene_blender/starter/src/lib/`
- — D51 extended to scene_blender; the skeleton is built from it), one transport retry per stage session, and
- three bundles `c3d-bpy-scene-{placement,lighting,materials}` on routes R29–R34 (R34 is the three.js gate-fired
- twin on the seating kinds). (c) **scene judge v2** (`scene_v2.yaml`; `scene_v1` frozen for replays):
- defects floating_asset .10/.60, sunken_asset .08/.65, interpenetration .08/.70, wrong_scale .06/.75,
- hard_edged_particles, missing_planned_element, hero_misplaced; placement caps per measured kind incl.
- free_exempt .75; graded must-acceptance; a CALIBRATION block and six anchors per criterion so the judge uses
- the whole range; overview views are declared to hide ceilings; CONTACT CROPs at the worst placement findings
- (the gate writes `data.bbox`); a fourth overview `overview_low_front` (el 7°, `fitContactCamera`) and a scene
- montage cap of 4; the measured-absent veto is scoped to the rule's kinds with `veto_warn_keys` (a WARN-band
- hover keeps the judge's tick, a `no_fog` ERROR no longer cancels the floating veto) — SCORING_VERSION 4;
- `Settings.judge.thinking` (argon thinks only from 'medium') + `3dcode judge --thinking`; the fixed evaluator
- runs the placement gate on scene cells. `judge_prompt_hash` moved for every rubric (RIG_RULES is shared).
- (d) **Strict placement standards** (`Settings.placement`, read at call time): floating ERROR 0.08 m or > 2
- (was 0.15 / > 3), sunk ERROR 0.20 m + 20 % (was 0.30 + 25 %), interpenetration WARN 0.10 / ERROR 0.35 (was
- 0.20 / 0.60; the host's OVERLAP_MIN_FRAC is 0.10); new kinds `free_exempt` (share of 'free'-tagged assets
- > 25 % WARN / > 50 % ERROR — the tearoom run had tagged 47 %) and `cantilevered` (resting on ≤ 1 of ≥ 4
- foot columns); the summary carries measured counts and the thresholds; a hero's size is one instance, not
- the union of its clones; `scene_regate` / `scene_stats` count typed kinds and accept Blender records.
- Object-track connectivity thresholds are unchanged (follow-up). (e) **The loop** (`eval/bench/loop.py`,
- EVAL.md §10): init / generate / run / diagnose / compare / judge-calib / accept / rollback / status.
- Batteries are generated by the planner model from typed rung rules (five rungs: zones, asset types,
- instance counts, lighting, interior / water / particles, a moving hero, scale constraints), ids stable per
- rung so iterations pair; `run` = one child `run_bench --variant` per language with `C3D_JUDGE__THINKING`
- and stop handlers; the judge of the loop is `gemini:gemini-4-argon` at medium on `scene_v2`; the verdict is
- `stats.decide` plus a placement-ERROR veto; the ledger is `eval/bench/data/loop/<name>/ledger.jsonl`;
- `accept` bumps the variant version and snapshots the overlays, `rollback` restores them. (f) **Standalone**:
- the head-to-head scripts and batteries that compared this harness with other checkouts were deleted; no
- path under a home directory remains in the tree. Consequences: the prompt manifest gained the scene_blender
- and variant scenarios and was re-blessed (judge payloads + the new `"variant": ""` spec field); ARCHITECTURE
- §2 names the starter tree; every C3D_VARIANT* switch is plan-side (no `--pin-plan`). Known limits: agy's
- MCP config has no tool-timeout key; the materials bundle has no deterministic target (SKILLS_LEDGER §6.1);
- the loop's first live `generate` / 30-run `run` are iteration 0. **Amended 2026-10-15 (iteration 0, first
- wave):** 24 of the 41 Blender `interpenetration` ERRORs were members of ONE room shell (lintel × lid, trim ×
- trim) — the placement host now exempts every row under a `RoomShell…` root as the enclosure (both scene
- languages; the same name the overview rig lifts; superseded by D111: a room shell is a scenery root of a
- marked scene and the name rule is deleted), and `lib.architecture.room_shell` clamps an opening's
- sill/head into the wall (a 3.2 m door head in a 3 m room had inverted the lintel into a slab above the lid).
- Runs of iteration 0 that built before the fix were gated by the old rule (noted in the loop ledger).
- **Amended 2026-10-15 (iteration 0 read, iteration 1 written):** 60 argon scenes (30 per language, rung 1,
- argon@medium judge): picked mean 0.758 three.js / 0.754 Blender, baseline 0.672 / 0.647 (the refine
- round is worth +0.09 and the 90-min clock cut it in 55 % / 43 % of the runs). What the gates and the
- judge measured, and what changed for it: (a) placement — three.js 7/30 runs with interpenetration
- ERRORs + 5/30 sunken, Blender 13/30 + 5/30; every agy zone session had called `check_placement` and
- then edited without re-checking; 11 of the 29 three.js rows were props inside a `…MidProps` Group
- (measured as one union box), 9 of the 13 Blender runs had scattered small props INTO placed carts /
- racks / shrubs. `lib.place.clear_mask` (Blender) + a `keepClear` recipe (three.js) mask placed
- footprints out of scatter; the cookbooks' placement chapters state "one placed thing = one direct
- child" and the slope rule; (b) `hard_edged_particles` 27 % / 17 % of runs, and the brief's "soft
- particle effect" must-item failed with it — Blender had NO soft particle at all (translucent
- Principled puffs, metaballs, tori): `lib.materials.volume` (a Principled Volume, no surface; 40
- puffs = +0.7 s per 32-spp frame on 5.2.2) and a "Soft particles" chapter in BOTH cookbooks, inlined
- into every zone brief (`ZONE_RECIPES`; the inlining budget rose 24 k → 30 k chars because the last
- chapter was being clipped on scene_blender); the three.js fireflies recipe now carries a radial
- `softDot` sprite instead of the bare `PointsMaterial` the judge penalises; (c) three.js zones
- DROPPED at assembly (a run scored 0.0 with three empty zones): `walk(fig)` at build time, `import {
- concrete }` of a name `lib/materials.js` does not export, `mergeGeometries` → null — the JS lint now
- verifies every named import against the target module's exports (`_js_lint.check_named_imports`,
- ERROR), the other two are prompt rules; (d) the brief's camera line "tracks / dollies along … at
- 1.6 m" was a must-have no fixed-camera render can satisfy (unverified in 5/60 runs, a
- `missing_must_acceptance` cap on the whole score): the loop's brief generator writes a FIXED
- eye-level viewpoint and migrates the cached rung prompts in place (ids unchanged, so the pairs
- hold); (e) 172 `asset.generate_failed` outages in the first ten minutes (30 runs planning and
- single-shotting assets at once against the 64-slot pool; 8 zone stages fell back to single-shot and
- shipped the crashes in (c)): `run_bench --stagger` (loop default 40 s, the two languages offset by
- half of it). The argon overlay (variant v1 → v2 on accept) now shadows `tracks/scene_zone.j2` and
- `tracks/scene_zone_bpy.j2` with a "Before you return" block stating (a)–(c) with their numbers, and
- `routes.toml` boosts the two placement skills to the top of the standing list (R14 75 → 89, R29
- 80 → 89). Not changed on purpose: the judge (frozen for the compare), the run shape (2 rounds, 90
- min, 15 + 15 parallel), the refine briefs (iteration 2's lever). Skills deep-read rate stays low
- (three.js 0.013, Blender 0.175): the chapters now travel inside the brief instead.
-
-* **D106 The scene track states REQUIREMENTS, never templates (owner, 2026-10-15).** Iteration 0 of the
- argon loop produced 60 scenes of one shape — a block in the middle of a flat plate, ringed 360° by
- identical hills, three zones tiled in a ~40 m square, nothing beyond the bounds — and the owner ruled
- that copying must be impossible to reproduce it: the harness states what must be true, where, and how it
- is measured, and mandates no shape, count, construction, layout, camera formula or code structure the
- brief did not ask for. Kept, and only these: (1) INTERFACE — file / function names the wrapper calls,
- ctx fields, frames / units / naming from `conventions.py`, what the harness hands in; (2) sandbox rules;
- (3) MEASURED requirements with their thresholds, phrased as requirement + measurement (never as the one
- construction that satisfies them), plus the library as an OPTIONAL toolbox under its real API names.
- "always / never / must" wording outside those three classes is gone. DELETED: both scene cookbooks
- (`prompts/scene_threejs/cookbook.md` 1 015 lines, `prompts/scene_blender/cookbook.md` 1 365 lines —
- interface and language facts moved into `contract.md` / `system.md`, the craft condensed into SHORT
- optional practices in the skills: no code block over ~12 lines in any prompt or skill, prose + the
- library's API names, numbers only where a gate or the judge measures them); `ENV_RECIPES` /
- `ZONE_RECIPES` / `ZONE_RECIPES_MAX_CHARS` / `refine_recipes` / `cookbook_sections` and every
- `recipes=` kwarg in `tracks/scene.py` and `tracks/prompting.py` (the same four ENV + six ZONE chapters
- inlined into every session, "copy their numbers and snippets"); the plate-and-ring env SKELETONS
- (three.js `starter/src/env.js` CONTENT_RADIUS + radial flat mask + `worldShell` ridge +
- `makeOutskirts` under "TUNE these; do not replace", kept byte for byte by 29 of 30 scenes;
- scene_blender's `flat = span/2 + 15` feeding `terrain.make_height_at`, 21 of 30) — both are now
- placeholders: the interface exports, a level plate named Ground sized from the plan, one light rig, a
- fog, `INTERIOR` as data, and a comment listing the measured requirements; the zone / asset stubs no
- longer grid contents inside the bbox or say "keep everything inside it"; the RING GATE (`no_backdrop`
- ERROR whose hint prescribed "24-40 SOLID pieces at 0.6 × fog far", written by 57 of 59 plans) is now
- `world_edge`, a WARN stating the measure (standing geometry ≥ 2 m past 1.25 × the half-extent) with
- open closures; the `underdressed` ERROR with its 12-25 / 25-60 / 300-800 per-zone counts is an INFO
- `density_note` (the counts the brief states are its acceptance items); `out_of_bounds` is a WARN on
- PLANNED contents only, margin max(5 m, 10 % of the span) — unplanned scenery past the bounds is never
- reported; the three-depth-layer COMPOSITION rule (planner brief, both cookbooks, `scene_v2.yaml`,
- `prompt_builder`, `c3d-scene-composition`'s "Build in this order" + bounds-centre camera formula +
- ring arithmetic) and the camera recipe (D = 1.5 r / tan(fov/2), 3-4 cameras, "sees 2+ zones / ≥ 70 %
- of the bounds", frame-gate hints "distance ≈ 1.2 × span, fill the bounds"); "bounds = the playable
- area, as small as the brief allows" + "3-6 zones tile the bounds" + "terrain within ±1.5 m of y = 0"
- (`lib/terrain` `flat_radius` default 45 → 0); the argon `c3d-scene-composition +14` boost. REPLACED
- BY: planner briefs that state the measurements (`cameras[0]` content ≥ 20 %, lens ≥ 0.5 m clear, no
- world edge from any authored camera, seat thresholds, exposure band, motion visible at t = 0..1.5 s,
- `stamped_ring` ≥ 8 same-size copies on a circle, unmet `must` caps 0.60) and define `bounds` as the
- DETAILED area the harness measures against, not a cage — the world continues past it; zone / env / asset
- / refine briefs and the ten scene skills rewritten as requirement + measurement + a few strong optional
- practices; the brief's `beyond` field (what continues past the detailed area, a must item); `scene_v2`
- anchors and defects rewritten to "what the BRIEF's place would have" plus a `diorama_look` defect
- (penalty 0.05, no cap); the loop's brief generator writes ONE fixed viewpoint at a height the place
- justifies and 15 prompts per language (was 30). Consequences: `materialize_workspace` writes no
- cookbook section / file for a language that ships none; `prompts/_claims.toml` rows re-pointed at the
- contracts; `tests/prompts/manifest.json` re-blessed for every scene scenario; the judge's calibration
- (`bench.loop judge-calib`) must be re-run before the next `accept`, since what the judge is asked
- changed. NEXT (done, D107): the other six cookbooks (blender, cadquery, threejs, urdf_blender,
- glsl_shader, opengl_python) follow the same rule — the graphics `seed_recipes` path and
- `select_cookbook_chapters` stay until then. Open: `content_small` still grades `cameras[0]` as ≥ 20 % content excluding ground
- and water (a beach / moor / lake viewpoint fails by nature); planner temperature 0.4 unmeasured for
- plan diversity.
-
-* **D107 Every track states REQUIREMENTS, never templates — no language ships a cookbook (owner,
- 2026-10-15).** D106's rule applied to the six remaining languages. DELETED: `prompts/{blender,
- cadquery,threejs,urdf,glsl_shader,opengl_python}/cookbook.md` (999 / 413 / 523 / 434 / 293 / 166
- lines) and `glsl_shader/examples/aurora_ridge.frag`; their INTERFACE and LANGUAGE facts (what the
- wrapper calls, frames / units / naming, API traps that are build or lint errors, what the census /
- renderer measures) moved into `contract.md` / `system.md` as short statements, their CRAFT into a few
- short optional practices in the track's skills; recipe libraries, snippet collections and
- prescriptive numbers are gone. KEPT exactly: the object tracks' bbox / dims / connectivity / joint /
- part-naming contracts, sandbox rules, triangle budgets — and ONE executable interface example per
- `contract.md`, which `tests/prompts/test_snippets_run.py` (blender / cadquery / threejs / urdf /
- glsl_shader) and `tests/graphics/test_gl_runtime.py` (opengl_python) run through the real runtime,
- pinning the interface (builds, exports, on the ground, moves), never a shape, a part name or a count.
- The PLUMBING went in the same change, so a cookbook is not a concept any more rather than a tolerated
- absence: `RunContext.cookbook_text` and every reader; `materialize_workspace(cookbook_text=…)`, the
- `.3dcode/cookbook.md` copy and the "## Cookbook" body section; `format_error_report`'s cookbook
- argument and `repair.relevant_cookbook_section` (the repair prompt now carries the error report, the
- lint findings' fix hints and the routed skills' pointers — nothing language-specific beyond that);
- `prompting.select_cookbook_chapters` / `is_always_chapter` / `COOKBOOK_SYNONYMS` / `COOKBOOK_ALWAYS`
- and the `cookbook_excerpt` template variable (generate_static / generate_articulated /
- generate_graphics / generate_static_part / repair lose their "copyable snippets live in
- .3dcode/cookbook.md" lines); `prompts/sections.py` whole (`find_section` and the splitter
- nothing called); the graphics recipe SEEDING
- (`tracks/graphics.seed_recipes` and its helpers, the uncached "recipes" stage, the harness-owned
- `src/recipes.glsl`, `compose(recipes_src=…)`, the `redefines_recipe` lint, `Settings.limits.seed_recipes`
- / `C3D_SEED_RECIPES`, the `recipes.seeded` event); `record.prompt_hashes["cookbook"]` (no new
- session records it; a pre-D107 run resumed after it carries its earlier sessions' hash
- forward, which is correct for those rounds). PLANNER (the same rule, applied to the plan
- budget): the PLAN BUDGET block states a floor and a detail minimum ONLY when the request is
- evidence of them (a brief, or ≥ `EVIDENCE_MIN_CHECKLIST` checklist items) — the only case
- `plan_quality_complaint` re-asks on them; without evidence it states the ceiling and "nothing
- here sets a count" (the "boxes at different sizes" complaint rides along as soft, so "a stool"
- may be four boxes); the `target_leaves` line and every "(2 or more)" / "3-6 elements" count are
- gone; the graphics pass floor is 1 (`GRAPHICS_MIN` 3 → 1, `min_assemblies` 0) and the
- "pass count correlates +0.40" sentence, the three-dust-layer example and "numbers everywhere"
- left `plan_graphics.j2` (the graphics twin of D106's three-depth-layer rule); the graphics
- plan example is a tide pool with two passes (it was the CLAUDE.md demo brief, with a
- "Grade: vignette, aberration, tonemap + gamma" pass that every skeleton then carried as a TODO);
- `plan_static.j2` lost "do NOT nest a leg / prefer nesting" and the mandated dimension /
- ground acceptance items (the harness adds those itself); the brief's and the plan schema's
- "3-8 / 6-12 / 8-16" ranges are now the validators' real maxima ("up to N"). JUDGES
- (non-scene) softened where a criterion rewarded a construction rather than the object: the static
- 0.9 calibration point ("every part crisp with bevels/chamfers/tapers/profiles") → "the edge
- treatment, profile and hardware the real object has"; `primitive_only` / `detail_below_part_count`
- (static, articulated, asset, reference) fire only where the real object has the shaping that is
- missing; articulated's geometry-detail anchors count the hardware the real mechanism SHOWS
- (concealed hardware is not expected); shader_v2's depth criterion credits the scales the subject
- has (a flat style the brief allows is not docked for depth) and `candy_saturation` excuses a palette
- the brief asked for; the judge's improvement-plan example no longer prescribes tapering legs from
- 45 to 30 mm; the static proportion anchor states the contract gate's real tolerance
- (max(10 mm, 10 % of the extent) per axis) instead of an unmeasured ±5 %. Every measured cap,
- floor and penalty is unchanged. SKILLS: no code fence over 12 lines in SKILL.md or a reference
- (`tests/skills/test_library.py`, was 20 in the body only); `test_freshness` no longer treats prompt
- markdown as a source of callable names and fails any bundle that mentions a cookbook.
- CONSEQUENCES, read as known changes, not bugs: (0) a run made before D107 still rebuilds and
- resumes: the glsl build composes its `src/recipes.glsl` when the file exists
- (`glsl_shader.LEGACY_RECIPES`, never a stray file), and `ensure_materialized` re-materialises a
- workspace that still holds `.3dcode/cookbook.md` (`agents.materialize.needs_rematerialize`),
- which also deletes the file; (1) the glsl baseline loses the seeded recipes
- (measured 2026-08-26, refs_v2_graphics aurora brief, flash: seeding was the lever against the
- comb-of-bars aurora) — the next graphics battery is the measurement; (2) a single-shot repair prompt
- has no language-specific excerpt any more, so a lint ERROR's `fix_hint` is the whole guidance;
- (3) `tests/prompts/manifest.json` must be re-blessed once, after every lane's prompt / skill /
- skeleton change, for every non-scene scenario (and the scene ones whose judge text moved); (4) the
- judge calibration (`bench.loop judge-calib` / `addons.calibration`) is re-run before comparing an
- object-track battery with one judged before this change.
- PER TRACK, what replaced each cookbook: **blender** — contract.md states every measured rule with its
- number and gate (size tolerance, ground / footprint, the 2 mm contact band and 10 mm interpenetration
- ERROR, the 5 % island rule, triangle and time budget, export as authored), an "API traps the lint
- reports" list and a Materials section; four facts re-measured on 5.2.2 (a curve with
- `bevel_depth = 0` exports no node at all, `primitive_cube_add(scale=…)` without `size=1` doubles every
- extent, a level-2 subsurfed cube loses 16 % per extent, a hidden boolean cutter stays out of the GLB);
- the craft went to c3d-blender-forms / c3d-repeats-and-mirrors / c3d-part-contact / c3d-bbox-contract
- as options; the plan example is an object nobody asks for (`HerbDryingRack`), the articulated one
- carries its own summary, size and acceptance (it inherited the chair's). **cadquery** — contract.md
- "Kernel facts" (workplane normals, `.box` centring, revolve r ≥ 0, the hemisphere trap, OCC
- refusals) and the measured thresholds; the import list now matches the lint, so `numpy`, `random`
- and the stdlib data helpers are stated as ALLOWED (a widening of what the prompt permits, not of
- the sandbox), and the INFO the lint raised on every `.fillet()` / `.chamfer()` is gone (the
- build's OCC refusal is the signal: uncaught it fails the whole build, which the contract now
- says; the floating-part ERROR is stated too); the interface example is an abstract Body + Knob
- × 2 like the other two languages'. **threejs** — contract.md gains the geometry-axis facts, GLB
- naming, the export-material facts and a "What is measured" section; the part stub is a plain
- `BoxGeometry` with no recipe block or preset material. **urdf_blender** — contract.md states the
- 1 mm FK tolerance, the real limit / axis severities, and the clearance thresholds per pose; the
- harness's axis fix hint (`articulated_object.axis_fix_hint`, `joints_sweep`) no longer offers
- "or swap lower/upper". **glsl_shader** — the recipe seeding is gone (above); contract.md states the
- frame-gate caps as `frame_stats.py` computes them; c3d-glsl-craft is short practices with no
- `references/` (telemetry reports its depth as unmeasurable); the skeleton's `src/common.glsl`
- is a comment and PI / TAU (it seeded hash / noise / fbm / the cosine palette / a gamma tonemap
- into every workspace — the recipe library in miniature). **opengl_python** — the 195-line
- example became a 20-line full-screen pass and a "moderngl facts that decide whether the build runs"
- list; the skeleton is a stub. SHARED: `prompts/system/harness_contract.md` (every agent workspace)
- no longer says "overlap by ≥ 2 mm" (the WARN line), "≥ 15 mm clearance", wall thicknesses, sample
- heights, "constants on top, one function per part" or a mandated tool order — it states what the
- gates measure (the floating rule as the gate measures it — the ground-touching component, not
- "touches another part"; scene bounds as the detailed area, not a cage; the build timeout and,
- on the static track, the triangle / build-time budget that every object contract now states
- with the `detail_budget` constants, pinned in `prompts/_claims.toml`); skills route R20 (c3d-threejs-shader-traps on a planned custom shader) is scene-only,
- since a ShaderMaterial does not survive the static track's GLB export; `examples/graphics_lab`'s
- recipe studies (`build_recipes.py`, `glsl_cases/`) went with the seeding. THE RUNNABLE-EXAMPLE
- RULE: each `contract.md` keeps exactly one example that a test executes through the real runtime
- and that pins the interface only; the ~12-line fence cap holds everywhere except three executable
- interface examples the owner should confirm as exemptions — urdf's frame arithmetic (17 xml
- lines: the origins the wrapper verifies; its python block is 10), opengl_python's full-screen
- pass (19 lines: a moderngl program cannot be shorter and still build) and D106's two
- scene_blender modules. REVIEW PASS (same day, three reviewers): the contact "weld" band
- (0.5-1.5 mm, "aim ~1 mm") is gone everywhere — flush is contact; the blender skeleton's
- self-check fails only past the ground gate's ERROR line and the layout text no longer says
- "glue only"; wrong facts corrected against the code (the wrappers SEED `random` / numpy /
- `mathutils.noise` and three.js `Math.random`; `mat.blend_method` exists on 5.2.2; the removed
- APIs the lint does not catch are listed as such; URDF `<axis>` is in the joint frame, world-aligned
- when every rpy is 0); the snippet collections in c3d-threejs-forms / c3d-blender-forms
- references became prose under the API names with only their trap lines.
-
-* **D108 A stage that waits must not starve the next one: single-shot calls are bounded by their task,
- the zone window comes from the hard budget, unwritten zones are recovered (2026-10-15).** Iteration 2
- of the argon loop shipped two Blender scenes with three EMPTY zones (0.18 each, both rounds). The
- chain, measured: one single-shot asset call streamed 1 087 chunks for ~20 minutes before the retry
- layer gave up (31 of 2 697 asset calls ran past their 420 s task timeout, all the way to the 1 800 s
- retry ceiling; p50 96 s, p95 260 s) — `generate_files` bounded the call by the RUN's remaining
- clock, never by the task's own `timeout_s`; the asset stage took 47-49 min instead of ~4; the zone
- stage started 0.4 min before the scene track's 0.55 soft cap, so it was neither degraded to
- single-shot nor given a real window — an agent session clipped to the 180 s floor that read 24-27
- files and was killed before writing a zone; `zones.done` listed all three as failed and nothing acted;
- the refine round, whose targets named the three empty zones, spent its 15 minutes on asset files.
- Fixes: (a) `generation.single_shot_wait_s` — a single-shot call waits at most its task's
- `timeout_s`, never below `SINGLE_SHOT_MIN_WAIT_S` = 420 s (a stage degraded by a spent soft budget
- carries the budget's 120-180 s floor, shorter than a legitimate call) and never past the retry
- ceiling; tasks without a timeout (the object tracks) are unchanged; (b) `scene.zone_window_s` — the
- zone session's window is `ZONE_TIMEOUT_S` per zone clipped to the HARD budget minus `ROUND0_RESERVE_S`
- (600 s: assemble, build, render, gates, judge), floor `ZONE_MIN_S` (300 s); the zones are the scene,
- refine gets what they leave; past the soft cap the stage still degrades to single-shot;
- (c) `SceneTrack._recover_zones` — every zone the batched session left unwritten gets ONE single-shot
- generation of its own brief, side by side (`zones.recover` / `zones.recovered` events, a `.recover`
- label), before assembly; a recovery that fails leaves the stub as before. Also measured, fixed in the
- same change: the judge's fog-free Blender views only unlinked the WORLD volume while `lib.sky.haze`
- builds a volume-only BOX (30/30 and 14/15 envs), so the placement views were rendered through the
- haze — `render_bpy_scene.hide_fog_boxes` hides volume-only meshes ≥ 8 m in `no_fog` views (soft
- particles stay; `fog_hidden` in the frame record). Pinned: `tests/orchestrator_tracks/test_zone_starvation.py`,
- `tests/scene_runtime/test_render_blender.py::…fog_box…` (real Blender).
-
-* **D110 Objects are baseline-first: ONE session drafts the whole object, ONE session refines it in place per
- round; agy's argon stays at effort high; a typed `placeholder_part` gate (owner, 2026-10-15).** Every
- object language — static_object blender / threejs / cadquery and articulated_object urdf_blender — takes
- the draft-then-improve shape (the concept from astra3d-brilliana's Blender path, reimplemented; nothing
- copied): round 0 is `BaseTrack.baseline_tasks`, one agent session that writes every part file and the
- entry (`generate_static.j2` / `generate_articulated.j2`); the round is built, measured, gated, rendered and
- judged; every refine round is ONE session over the whole object (`StaticObjectTrack.allow_refine_fanout =
- False`, articulated inherits it) carrying the gate ERRORs — a placeholder part first of all — then failed
- must-acceptance items, then the judge's plan (≤ `max_refine_tasks`, compacted to
- `max_instructions_per_task` lines), with `measurement_vs_plan` kept. EVIDENCE (argon loop iteration 0,
- 15 runs per language, `--rounds 2 --max-minutes 60`): the scoped baseline (`d104409e`, 2026-08-24, motivated
- by correlations only — no A/B, no DECISIONS entry) was built for the parallel in-process api-agent and has
- run SERIALLY since `50734755` / `66175ec1` (the per-workspace session lock, api-agent deleted): 3-5 scope
- sessions × median 18.2 min + an assemble session against a 58-minute generation window, so blender /
- threejs reached the end of round 0 at the budget (61.0 min median), 0 of 30 runs finished a refine round,
- 13 and 14 of 15 shipped placeholder or missing parts (33 % / 21 % of part files still the skeleton box)
- and scored 0.509 / 0.588 mean. The single-session languages in the same iteration: cadquery judged round
- 0 at 26.8 min, 0.934 median, refine beat it in 13 of 15 runs (picked 0.966); urdf_blender 29.6 min, 0.923
- → 0.969. The two blender runs whose scopes all finished scored 0.907 / 0.932. Session time follows
- generated tokens (ρ 0.94-0.96, ~72 tok/s); output tokens were 4.3-6.4 × the final files' tokens, and 85 % of
- the characters blender / threejs sessions wrote went through whole-file writes. A parallel-sandbox trial (scopes side by side against placeholder
- neighbours) cut round 0 to 46 min and dropped the dining chair from 0.907 to 0.404 (floating parts) — no
- parallel work before a real draft exists. THE DRAFT BRIEF states requirements with their measurements
- (D106/D107): every planned part at its box and joined before any detail — a session stopped at its window
- must still leave the whole object (`check_contract` / `check_connectivity` measure it); each skeleton file
- replaced in one write and then changed only with targeted edits. The refine brief (`refine_object.j2`)
- says edit in place, never rewrite a whole file to change a few lines. The measurement the briefs cite is
- the chair pair (iteration 0's dining chair rewrote files whole — 8 rewrites over 9 files, ~136k characters
- written; the baseline-first smoke's chair wrote each file once, ~49k), not the 4.3-6.4 × ratio: the smoke's
- rewrite-free draft still generated ~4.2 × its final code in output tokens, so that ratio is not a rewrite
- cost. No agent refine is fenced to a part subset; a SINGLE-SHOT refine still is (`edit_only`, the
- `edit_only_these` branch kept for it alone) — it sees only the files inlined for it and could otherwise
- rewrite one it was never shown (review 2026-10-15). REFINE WINDOW: an object refine session gets
- `static_object.object_session_window_s` — the agent default clipped to end `OBJECT_ROUND_RESERVE_S` (180 s;
- build + gates + renders + judge measured 0.7 min) plus the watchdog's `HARD_GRACE_S` before the run's hard
- ceiling. Without it a busy session ran to the run clock: the smoke's blender refine (started at 25.8 of
- 60 min, 30-min window + 5-min grace) was killed at 60.0 min after $4.63 and the round dropped unbuilt and
- unjudged, as were all three refines of iteration 0's chair. PLACEHOLDER GATE:
- `check_contract` emits an ERROR `data.kind = "placeholder_part"` (`contracts.artifacts.PLACEHOLDER_PART`)
- when `spatial.contract.is_placeholder` holds — every measured row of the part ≤ 12 triangles
- (`PLACEHOLDER_MAX_TRIS`, what blender / urdf `primitive_cube_add`, three.js `BoxGeometry` and cadquery
- `Workplane.box` export), watertight with a volume ≥ 0.999 of its own box (`PLACEHOLDER_MIN_FILL` — a real
- 12-triangle hexahedron does not fill it: review 2026-10-15 found a tapered cadquery fretboard at its plan box,
- fill 0.879, flagged; over 942 loop part rows the 68 true placeholders were all watertight at fill 1.000) and
- its extents within 1 mm (`PLACEHOLDER_TOL_M`) of the plan box, a single
- instance also at the plan centre (copies are placed by the symmetry hint, so only their size is compared);
- 0 triangles (not measured) never fires. KNOWN LIMIT, pinned: a real bare 12-triangle box built to the
- plan's millimetre fires too — measurement cannot tell it from the skeleton's, and the corpus held none
- (every hit was a part file byte-identical to the `skeleton` commit); keying on that git fact instead was
- not taken, the gate sees only the measurement. Computed from `Measurement.parts`, no grep of names or sources
- (Law 4); the box checks for that part are skipped (it would pass them by construction).
- `orchestrator.build_refine_instructions` sorts it ahead of every other gate ERROR. CONSEQUENCE, a known
- change: a contract ERROR fires the `contract_violation` cap (0.75), so a run that ships placeholder parts
- now scores ≤ 0.75 where the gates used to call those parts perfect. EFFORT (owner, 2026-10-15, final:
- "argon 强度就直接设置high"): agy with gemini-4-argon runs at `--effort high` on every track — no default
- was lowered. Plumbing only: `AgentJob.effort: AgentEffort | None` is filled from
- `GenerationTask.thinking` by `tracks.generation.session_effort` ONLY when a caller explicitly asks
- (`thinking` is now `Literal["", "off", "low", "medium", "high"]`, default "" = nobody asked; a single-shot
- call then thinks at `SINGLE_SHOT_THINKING` = medium, unchanged); agy's precedence is the id's
- `-low/-medium/-high` suffix, then `job.effort`, then `AGY_API_EFFORT` = high. The misleading
- `thinking="medium"` on the object draft / refine, the graphics refine and the first repair attempt —
- which agy never honoured — are removed, so code and behaviour agree; the rebuild / later repair tasks ask
- for "high", which is agy's default anyway. No caller asks for less than high today. The effort used is on
- the session's `invoke` transcript line, in `result.json` (`AgentResult.effort`) and on its `cost.jsonl`
- row (`effort`). claude-code takes `--effort` from `Settings.agents.claude_effort` (default xhigh) and
- codex `-c model_reasoning_effort=` from `codex_reasoning_effort` / an `@<effort>` id (default high); both
- ignore `job.effort` (behaviour unchanged) and now record what they passed. RECORDED MEASUREMENT, NOT
- ACTED ON: the graphics loop's iteration 1 ran agy at medium (`agy:gemini-4-argon-medium`,
- `eval/bench/out/loop_argon_graphics/iter_01`) against iteration 0 at high: glsl_shader (n = 9) picked
- 0.837 → 0.909, minutes 55.7 → 48.3, $40.50 → $37.51; opengl_python (n = 5) 0.932 → 0.939, 59.6 → 45.6
- min, $22.55 → $18.17 — unpaired, n ≤ 9, inside judge noise on opengl; argon stays at high. DELETED (a
- deletion, not a move): `StaticObjectTrack.baseline_tasks` / `scopes` / `scoped_baseline_tasks` /
- `scope_system_prompt` / `part_template` / `assemble_template`; `tracks/depth.py` `PartScope`,
- `scope_groups`, `_files_for`, `_attachment_units`, `_pack`, `interfaces_text`, `scoped_generation_enabled`,
- `MIN_PARTS_FOR_SCOPED`; `prompting.scope_context`, `parts_table_for`, `part_details_for`;
- `prompts/tracks/generate_static_part.j2`, `assemble_static.j2`, `system/role_scope.j2`;
- `Settings.scoped_parts` (`C3D_SCOPED_PARTS` is now a dead key an A/B rig refuses, `plan_features`);
- `GenerationTask.phase` and the phase loop in `steps.run_generation_tasks` (its one user); the
- `generate.scoped` event; the scoped tests (`test_generation_depth.py`). Kept exactly: the planner, part
- naming and one-file-per-part layout, the skeleton, the contract and connectivity gates, `detail_budget`,
- the picker. Pinned: `tests/orchestrator_tracks/test_baseline_first.py` (one draft task owning every file,
- one refine task with the placeholder ERROR first, the single-shot fence, the refine window, articulated
- end to end with fakes),
- `tests/spatial_tools/test_placeholder_gate.py` (the rule; each language's REAL skeleton fires and a rebuilt
- part does not: blender, cadquery, threejs; a tapered cadquery extrude at its plan box does not; a bare box
- exactly at it does), `tests/agents/test_antigravity.py::test_effort_reaches…` /
- `…object_and_scene_tasks_run_argon_at_high`, `tests/agents/test_agent_job_wiring.py`.
-
-* **D111 Stage honesty and measured scenery: the env stage counts only its own file, placement rows come
- from the plan's zone roots, a probe timeout is the code's (2026-10-16).** Evidence: argon loop iteration 4,
- scene_threejs (`eval/bench/out/loop_argon/iter_04/scene_threejs`, 15 runs, read-only investigation of
- r1_01 / r1_02 / r1_08 / r1_10). (1) The env session wrote `src/env.js` in 3 of 15 runs; in the other 12 it
- read for 7-10 min, was killed idle, and was credited with the `src/assets/*` files the asset single-shots
- wrote beside it (whole-tree diff, `attribute_changes`), so `stages/env.json` read `ok:true`; the same asset
- writes kept its idle clock alive (the 12 ended at 421-616 s on a 420 s window; the 3 that wrote ran into the 720 s hard cap). Round 0 was unlit (dark_frame,
- no_fog, no_background; round-0 mean 0.394) and the single refine round wrote the whole environment from the
- skeleton; in r1_01 a zone author built a replacement world inside its zone file. (2) `host_placement.
- collectAssets` made every direct child of every top-level root a placed asset, so a wall merged per material
- became overlapping body / flashing rows and a two-mesh bollard a cap "interpenetrating" its post. Replayed
- with the stored scenes (probe unmarked vs marked): 9 / 10 / 3 / 15 placement ERRORs on roots outside the plan's
- zones in r1_01 / r1_02 / r1_03 / r1_10, and r1_02's and r1_10's final ERRORs were all of that kind. r1_01 is
- mixed: its final round's 10 ERRORs were 5 real clips of the zone asset `BakeryStoop/BakeryStorefrontFacade`
- into `AlleyFallbackEnvelope` (337 meshes that a ZONE added straight to the scene, `scene.add`, not the env),
- the `zone_empty` the envelope caused by filling the 400-row table before `ScooterParkingNook`, and scenery
- pairs. (3) r1_08's refine terrain made the zones' per-vertex raycast
- seating exceed the 120 s probe; the probe said "harness/driver failure, not your code", and the round spent
- 3 x 240 s rebuilding identical code and was never scored. (4) `build_refine_instructions` deduplicated on
- (target, `gate:<gate>`), so `no_fog` hid `no_background`. CHANGED: `AgentJob` / `GenerationTask`
- `shared_tree` (typed; needs a `files_hint`, excludes `edit_only`): such a session's `files_changed` is its
- `files_hint` only (`cli_common.attribute_changes(only=)`, also `generation._attributed_fallback`) and the
- watchdog polls only those files (`cli_common.activity_paths`; `_latest_mtime` takes a file). The scene env
- task sets it; `SceneTrack._env_stage` is ok only when `env_file(ctx)` is in `files_changed` or rewritten
- since the stage began (`_touched`, the zone stage's test) and otherwise runs ONE single-shot
- `_recover_env` before the zones (events `env.recover` / `env.recovered`; the env window the budget still
- allows) — both scene languages, through `env_file`. Plain sessions keep the whole diff: a refine that also
- fixed a file outside its hint must not turn into `ok=False` and a RoundFailed. The assembler marks every
- zone root `userData[conventions.ZONE_ROOT_KEY]` (`render_scene_js` `addZone`, the assembler's own probe), the
- scene_blender census GLB writes the same key into each zone node's `extras` (`--zone-key` argv →
- `_census_glb.write_census_glb(zone_key=)`; GLTFLoader turns it into `userData`); `host_placement` measures
- only the children of marked roots as rows — every other root is scenery: no rows, not in the free share, never
- paired with other scenery, listed in the table's `scenery` {n, names} and the summary. Its children are still
- measured as SCENERY PIECES (`measurePiece`, the zone assets' own exemptions: a ground / water / enclosing piece
- is a backdrop): a support and something to sink into, something a zone asset is mounted on (`attached`, so
- neither the gate nor the boot settle calls a sconce on an env facade floating) and something a zone asset can
- clip (a zone-vs-scenery interpenetration names the zone asset `a`, the one its author can move — r1_01's five
- storefront clips stay measured). A scene with no mark at all (one the harness did not assemble) keeps the old
- rule. A table cut by its ROW CAP (`total` > rows; a time-budget cut still writes a row per asset) gives an INFO
- `zone_unmeasured` instead of `zone_empty` for a zone whose census group is built (`content` / `ground`, not
- `empty`), and instead of `missing_content` for the zone at the cut (the last row's). The `missing_content`
- hint says where a row comes from: a direct child of the zone's group (scene_blender: a root object linked into
- the zone's collection). A probe timeout is typed: `SceneRenderError.timed_out` + `phase`, the phase
- `probe_scene.mjs`'s watchdog reports (`armWatchdog`'s `onFire` returns it; `host_page.openHost(onBoot=)` marks
- the import); `run_scene_script` retries a watchdog timeout once on a browser of its own (a wedged shared browser
- times out the same way), and only `SceneRenderError.scene_timed_out` — the phase is `scene` (import,
- createScene, the boot settle), `census` or `update` (`render_scene.SCENE_PHASES`) — makes `probes.run_probe`
- file an ERROR `probe_timeout` on the entry file with no "not your code" hint, so `build_with_repair` sends it to
- a repair session instead of `MAX_HARNESS_REBUILDS` rebuilds. The box keeps every other timeout: `host`
- (browser launch, page ready), `report`, `compile` (the shader preflight), `close`, the process clock (node
- itself starved) — and every census-GLB boot (scene_blender: Blender already ran the author's code; the GLB is
- the harness's export). The `scene_probe` tool probes under the build's budget (`probe(timeout_s=None)`; it was
- 60 s against the build's 120 s, so a timeout now the code's would have condemned a scene the build accepts).
- The refine dedup key carries the finding's `data["kind"]`. BEHAVIOUR that changes with the mark: env scenery
- is no longer moved by the boot settle — it renders as authored (r1_03 replay: the settle had lifted the env's
- `PerimeterPromenadeDecks` 1.42 m, and the zone's landing deck now clips it, a new zone-vs-scenery finding); a
- floating env prop is no longer measured at all; planned content a zone adds with `scene.add` is not that zone's
- (`missing_content`). Accepted, not fixed: a pre-D111 three.js run resumed or replayed keeps its unmarked
- `scene.js` (the assemble stage is keyed on the plan) and is measured by the old rule WITHOUT the RoomShell
- exemption (Law 4: no name rule comes back for old runs); an env session writes nothing to its own file
- inside its 420 s window → the same idle kill every agy session gets (agy prints nothing until it exits, so
- its only activity is its own writes), then `_recover_env`; an env session that COMPLETES without writing gets
- the generic silent-bail rerun before `_recover_env`, as the zones stage does (0 of 15 in iteration 4: all
- ended `timeout`). DELETED: the `RoomShell…` name-prefix enclosure exemption in `host_placement`
- (D105 follow-up of 2026-10-15) — a room shell is a scenery root of a marked scene. NOT changed: no prompt
- text, no template, no default env (requirement-only prompts untouched; argon effort stays high); the idle
- watchdog for read-only refine sessions; `probeColumn`'s ground-like burial rule (no zone-asset repro).
- `tests/prompts/manifest.json` re-blessed for the job `scope` payloads only (the new `shared_tree` field in
- every `AgentJob` dump, true on the scene env jobs) — no prompt, system, context or judge payload changed.
- Model-visible outside the manifest: the assembled `src/scene.js` (a file refine sessions read) gains the one
- harness-owned mark line per zone, and the `missing_content` / `probe_timeout` finding texts.
- Measure next: env-stage write rate (3/15 → ≥ 13/15 from `git log -- src/env.js`), round-0 mean, share of
- round-1 diffs that are 300+-line env rewrites, `build.harness_retry` events, placement ERRORs on non-zone
- roots (0). Pinned: `tests/agents/test_shared_tree.py`, `tests/orchestrator_tracks/test_env_stage_honest.py`,
- `tests/scene_runtime/test_zone_roots.py` (env parapet merged by material + two-mesh bollards + room shell →
- no rows, the zone's sunken / interpenetration findings identical to a zone-only scene; sconces and a sign flush
- on an env facade attached and left by the settle, a kiosk pushed into it an interpenetration on the kiosk; the
- unmarked control),
- `tests/scene_blender/test_build.py::test_the_zone_mark_survives_the_census_glb`,
- `tests/scene_runtime/test_probe_timeout.py` (phases; the owned-browser retry; the process clock; the census
- GLB; one budget for the tool and the build; a real driver whose createScene blocks reports `phase: scene`),
- `tests/orchestrator_tracks/test_orchestrator.py::test_two_env_errors_of_one_gate_are_two_refine_tasks`,
- `tests/scene_gates/test_placement.py::test_a_zone_past_a_truncated_tables_cut_is_unmeasured_not_empty` /
- `::test_the_zone_at_a_truncated_tables_cut_is_partly_measured`.
-
-* **D112 A session that takes steps is never idle-killed; the env recovery is checked; the clock leaves room to
- judge (2026-10-16).** Evidence: argon loop iteration 5, both scene languages (the first iteration on D111;
- `eval/bench/out/loop_argon/iter_05/{scene_threejs,scene_blender}`, read-only investigation of 26 env stages and
- r1_07 / r1_08 / r1_09 threejs, r1_10 blender). Round 0 rose (threejs mean 0.325 → 0.623, blender 0.584 → 0.675)
- only because D111's honest env stage handed the env to `_recover_env`; what was left lost on seven defects:
- (S1) agy prints nothing until it exits and D111 watched a `shared_tree` session's own file only, so a session
- READING was idle from second 0 and its soft window was a hard kill — 22 of 26 env sessions died at 420-423 s
- with nothing written (every iteration-4 session that lived ≥ 646 s wrote: 13 / 13), 4 of 21 refines at 901 s;
- (S2) `_recover_env` was `ok` when the file was touched: 5 of 21 recovered modules failed the assembly probe
- (blender r1_02's `SyntaxError` at `curb_ mats = …`, `materials.js does not export 'gravel'`, `pavingPatch is not
- defined`, `mineral_surface() got an unexpected keyword argument 'roughness'`, a `list` with no `.name`), and the
- two that never reached assembly were broken too (blender r1_10's `noise_ centered = …` did not parse, r1_04's
- passed a tuple rotation — a `TypeError`): S4 had put the placeholder back in both, which is why those two
- rounds 0 showed no sky;
- (S3) `is_interior` was `bool(flag) or infer_indoor(text)`, so `interior: False` lost to the word list
- (`GiantTrunkCorridor` → "corridor", "luminance inside 0.42-0.62" → "inside"): 6 of 26 outdoor plans measured at
- the 2 cm indoor tolerance — r1_07's three 4-5 cm boulder gaps became floating ERRORs and a 0.60 cap; (S4) in
- two blender runs an escalated asset session held the workspace while `env.recover` committed — r1_10's burlap
- session (+391 lines, `24282df`) and r1_04's woven olive basket (+482, `a336df6`) — and its scope check restored
- `src/env.py` to its own `head_before` (the 49-line placeholder); (S7) the placeholder's
- "no lamps and no world" was a WARN, so round 0 built, the repair fixed an asset, and every frame was 96-99 %
- black (0.109); (S6) the harness's own `lib/sky.js` set `scene.background = null` and its own gate raised
- `no_background` (threejs r1_03 / r1_09 / r1_10 — the first refine target each time); (S5) a watchdog kill was
- transient whenever agy's log held any provider retry — the same 901 s / zero-file kill was retried in r1_05 /
- r1_09 (one 4 s 503) and ended r1_07 / r1_08 as no_change; and r1_09's transport retry, launched with 15 min left
- and cut at the budget edge, committed the camera fix that capped the run and was never built or judged.
- CHANGED, in the investigation's order:
- (1) `cli_common.activity_paths(s, steps)` / `invoke(..., activity=)`: what the CLI records per step is activity;
- `AntigravityAgent.run` passes its session HOME's `AGY_STEP_DIRS` (`.gemini/antigravity-cli/brain`,
- `…/conversations` — by name: the watchdog's walk skips `.gemini`; the presence lock / updater / caches are
- start-up writes, not steps) for EVERY agy session, `shared_tree` or not. A session that takes steps now runs to
- its hard limit (window + `HARD_GRACE_S` 300 s, still min'd with the run's deadline); one that records nothing for
- `IDLE_GRACE_S` past its window is still killed there. Object / articulated / graphics agy sessions: the same —
- a reading refine was killed at its window (when nothing under `src/` / `public/` moved), now it may use the
- grace; every hard limit is unchanged (`timeout_s + HARD_GRACE_S`, the job's `hard_deadline_s`, agy's own
- `--print-timeout` a minute past it), so the worst case per session is the one it always had. `SCAN_S` (the
- mtime poll, 5 s) is now a module constant tests turn down. (2) `scene_placement.is_interior`: a bool flag —
- `ScenePlan.interior` or a dict's `interior` — wins either way; the words only when it is absent / None. (3)
- `SceneRuntime.check_env(ws) -> str` (new, both languages): the env module alone — its own lint findings
- (scene_threejs: `lint` filtered to `src/env.js`, which includes the import-vs-export check; scene_blender:
- `lint_scene_source(role="env")`), then a build with nothing beside it (`probe_scene.mjs` on a deleted-after-use
- `src/_c3v_env_probe.js`; `run_wrapper(entry=src/_c3d_env_check.py, zones={})`), then `probes.unlit`; a check the
- harness cannot run is `""`. `SceneRuntime.lib_interface(ws) -> str` (new): every `src/lib` module's exported
- names with their parameter lists as written (`_js_lint.export_signatures`; `ast` for bpy) — 6.9 k / 12.2 k chars,
- facts, no call examples. `SceneTrack._recover_env`: single-shot → `check_env` → on failure ONE repair
- single-shot (`env.recover.repair`) whose prompt carries the check's words and the file as written; both carry
- the lib interface (`scene_env*.j2` blocks rendered only when the recovery passes them — the session's prompt is
- unchanged); a module still failing is replaced by what it overwrote (zones import the env's interface; a broken
- env breaks every one) and the stage reports failed; `env.checked` events. (4) S4: `_recover_env` runs inside
- `cli_common.exclusive_workspace(ws)` — the session lock. Chosen over "restore out-of-scope paths to HEAD":
- every commit is `git add -A`, so a harness commit inside a session's window also absorbs that session's
- in-flight writes, and restoring to HEAD would keep exactly the out-of-scope writes the revert exists to undo,
- on every track; with the lock no harness commit lands inside a window and `head_before` stays the whole truth
- (cost: an escalated asset session and the recovery wait for each other — they were serialised against the env
- session anyway). S7: `probes.unlit` — no lamp and no world (bpy), or no light, no `scene.background` and no
- `scene.environment` (three.js: the analogue; a sky with no light keeps its WARN) — is an ERROR `unlit` on the
- env file: the build fails and the round's repair is handed the env before anything is rendered or judged (so the bare skeleton's build now fails on exactly that one ERROR — by design; a test fixture scene that lit nothing got a background).
- (5) S6: `makeSky` keeps a `scene.background` the caller set and gives an unset one the dome's own graded
- horizon colour (`skyRadiance` on the side away from the sun) — the gate is unchanged (it is right: an unset
- background renders the raw clear colour wherever the dome does not cover); `celestial.js`, the
- `effects_catalog.md` row and the `c3d-scene-atmosphere` skill say so. (6) A floating row states its gap to the
- millimetre, the tolerance applied (`indoor/outdoor tolerance 0.0N m`) and why it is an ERROR (`past 0.08 m` /
- `N rows float, more than 2`); an unsupported row its gap and "within the … tolerance" — so the refine prompt's
- task lines (`GateFinding.as_line`) carry them; both refine templates state that `artifacts/scene_probe.json` is
- the probe driver's raw dump and `check_placement` returns the rows. (7) `RoundPolicy.judge_reserve_s` (240 s:
- 201 s measured in r1_09) and `min_session_s` (180 s); `RoundPolicy.can_open(budget)` gates every refine round,
- a refine round's transport / stall retry (`round.skipped_budget` → BUDGET) and the scene stage retry — round 0's
- retry is not gated (it has no round to fall back on); refine / rebuild tasks
- carry `GenerationTask.reserve_s` (their session's hard deadline ends that much before the budget);
- `BaseTrack._salvage` (was `_salvage_baseline`) also salvages a refine round: a budget stop after its sessions
- changed `src/` / `public/` since the last round's commit gets the same ONE bounded grace (max(5 min, 15 %)) and a
- no-generation round that builds, gates, renders and judges those edits. The object tracks' own
- `OBJECT_ROUND_RESERVE_S` (180 s) is deleted: `object_session_window_s` uses `judge_reserve_s` (one reserve) —
- an object refine window now ends 60 s earlier, and no object refine round launches with < 7 min left.
- (8) `classify_end` has no `provider_retried`: a watchdog kill is never `transient` (the key is not cooled); it is
- `stalled` (`SessionEnd` / `AgentResult` / `GenerationResult` / `RoundFailed.stalled`) when the watchdog found it
- IDLE and it answered nothing, and a stalled round / stage session gets the transport retry's ONE more session
- when `can_open` holds; a kill at the hard limit (worked its window, wrote nothing) is not retried. eval's
- one-shot drops a stalled cell as infra (`_oneshot.py`, beside transient / quota). NOT changed: argon effort
- (high everywhere); `ENV_TIMEOUT_S` / `REFINE_TIMEOUT_S` (the investigation: widening a window buys nothing
- until the first write); the session-written env is not run through `check_env` (1 of 17 failed in iteration 4);
- the `run_state.json` control-file revert during `shared_tree` sessions (19 of 25 env sessions; no score effect
- measured); deferred, single cases: an establishing-camera FOV check at plan time (r1_09 content_small) and a
- ground-mesh-vs-`height_at` env check (blender r1_10 round 1). Known, not fixed: an asset single-shot rewriting
- its skeleton stub while ANOTHER asset's escalated (edit_only) session runs is outside that session's files and is
- reverted by its scope check — the same lock-free-writer class as S4, which the single-shots (minutes of model
- call, many in parallel) cannot take the session lock for without serialising the asset stage. Model-visible:
- `tests/prompts/manifest.json` re-blessed for the refine templates' scene_probe.json / check_placement sentence (13
- refine prompts) and the `makeSky` catalog row (12 prompts); outside the manifest: the recovery prompts' lib
- interface and check blocks, the placement finding texts, the `unlit` finding, the atmosphere skill sentence.
- Measure next (iteration 6): env files written by the session (4/26 → ≥ 20/26), recovered envs failing assembly
- (5 → ≤ 1), round-0 lighting mean (0.71 → ≥ 0.82), zero-file refines (4/21 → ≤ 1), no_change stops (5 → ≤ 2),
- `thresholds.indoor == plan.interior` (100 %), round-0 dark_frame from an unlit census (0), `no_background` on
- `makeSky` scenes (0), refine calls before the first write (median 23-30 today), `budget.salvage` rounds judged.
- Pinned: `tests/agents/test_agy_activity.py` (a fake agy recording steps under its HOME survives past its window
- to the hard limit, shared_tree and not; one recording nothing dies at the window; a hang ends the same with or
- without a logged 503), `tests/scene_gates/test_placement.py::test_an_outdoor_flag_is_not_overruled_by_indoor_sounding_words`
- / `::test_a_floating_row_states_its_gap_to_the_millimetre_and_the_tolerance_applied`,
- `tests/orchestrator_tracks/test_env_stage_honest.py` (check + one repair with the error and the lib index; twice
- failed → placeholder back; the recovery waits for a session holding the workspace),
- `tests/scene_runtime/test_env_check.py` / `tests/scene_blender/test_env_check.py` (real Chrome / Blender:
- a missing export, a ReferenceError, a SyntaxError, a NameError, unlit), `tests/scene_blender/test_layout.py::
- test_an_unlit_scene_fails_the_build_in_both_languages`, `tests/scene_runtime/lib/test_environment.py::
- test_the_sky_dome_keeps_or_sets_the_background_the_gate_reads`, `tests/orchestrator_tracks/test_refine_evidence.py`,
- `tests/orchestrator_tracks/test_transport_retry.py` (a hung refine retried once; a hard-limit kill not; no refine
- launched under the reserve; the refine deadline leaves the reserve; stopped refine edits judged; nothing to
- salvage when nothing changed).
- Review fixes (two reviews of the change, same day): (a) the `unlit` ERROR failed EVERY build while the env was
- the placeholder, mid-session too — an escalated asset session beside the env stage, a zone session after a
- failed env stage — and those sessions cannot write the env module (their scope check reverts it); the round's
- build still fails on it (its repair gets the env), but the MCP `build` tool reports an unlit-only failure as a
- `SCENE UNLIT — …` line above BUILD OK (`spatial.tools._env_unlit_only`; any other ERROR beside it is still BUILD
- FAILED); (b) `run_best_of_n`'s every-candidate-failed `RoundFailed` dropped `stalled` (a hung `--candidates 2`
- round 0 failed the run where one candidate got the retry) — carried now; (c) `RoundFailed.of` sets `stalled` only
- when EVERY result hung or died of transport: the loop retries a round whole, and a sibling that worked to its
- hard limit is not to be re-run; (d) `RoundPolicy.can_open(budget, *, single_shot=)` / `need_s`: a single-shot
- generation (the economy profile) needs the judge reserve only, not the agent session minimum (it would have
- stopped as BUDGET with 4-7 min left for a one-minute call); (e) bpy `check_env` quoted the innermost `src/`
- frame — `src/lib/mesh.py:69` for r1_04, a file the repair single-shot never sees — and now leads with the env's
- own calling line from the traceback (`scene_blender.env_frame`: "src/env.py:287 `sky_batch.box(` (raised in
- src/lib/mesh.py:69)"); (f) `_js_lint.export_signatures` listed `export const asphalt = (o = {}) => …` as a bare
- name (25 of 208 lib exports, all 18 material factories) — a const bound to an arrow / function expression is
- listed with its parameters (7 bare names left, all constants); (g) eval: `stalled` is infra wherever `transient`
- was (`_infra._looks_infra` — a harness run whose round 0 hung twice; compare_backends' bare arm with no file;
- `_bare_agent` does not cache a hung session as done), as the one-shot already did — before D112 the same hang
- was transient whenever the CLI had logged a provider retry. Pinned:
- `tests/orchestrator_tracks/test_transport_retry.py::test_a_split_round_is_stalled_only_when_every_session_hung` /
- `::test_hung_best_of_n_candidates_get_the_round_loops_retry` / `::test_a_single_shot_refine_needs_only_the_judge_reserve`,
- `tests/spatial_tools/test_tools.py::test_a_session_build_reports_an_unlit_env_above_build_ok`,
- `tests/scene_blender/test_env_check.py::test_check_env_leads_with_the_env_line_when_a_lib_helper_raised`,
- `tests/scene_runtime/test_env_check.py::test_an_arrow_function_export_is_listed_with_its_parameters`, eval's
- `test_infra_failures.py::test_a_hung_*` and `test_bare_agent.py::test_a_hung_session_is_not_cached_so_a_redo_runs_it`.
-
-* **D113 Raw mode for scene_blender: an opt-in run where no harness library ships and the model writes every
- line of bpy — the `argon_raw` variant (2026-10-17).** WHY: the owner's game-world demo must have ALL scene
- modeling code written by `agy:gemini-4-argon`; every scene_blender workspace shipped the ~3 000-line harness bpy
- library (`src/lib/*.py`: `vegetation.tree`, `architecture.timber_house`, `terrain.boulder`, `figure`, the material
- recipes, the sky worlds …), so part of every scene's geometry was harness code. WHAT: `Settings.scene_lib`
- (`C3D_SCENE_LIB`, default **on** — every existing run and the manifest's base and `argon` payloads are
- byte-identical) and, OFF, raw mode: (1) `write_skeleton(..., lib=False)` writes no `src/lib/`, and the env /
- asset / zone stubs are raw bpy / bmesh that import and name nothing of it (the env placeholder still builds ONE
- level plate named Ground and nothing else); the plan-less example is refused (`ValueError`: it is built on the
- library); (2) the lint drops `lib` from the workspace packages — an import of it is a `bad_import` ERROR saying
- no library ships, shared code goes in `src/env.py` (zones `from env import`; an asset module is self-contained:
- its check builds it without `env`); a write under `src/lib/` is still reverted (`HARNESS_OWNED_SRC`);
- (3) ONE decision, per run: `prompts.variants.run_knob("scene_lib", settings)` — a stated value wins; inside a run
- (the `activate` ContextVar, per thread and copied into fan-out) the ACTIVE variant's `[knobs]` value, else the
- default; outside any run the settings object as it stands. `SceneBlenderRuntime.ships_lib` asks it at CALL time
- (`lib_interface` → `""`), `scene_assets.ships_lib(ctx)` asks the run's real runtime (a stand-in runtime: the
- same rule over `ctx.settings`) and gates the catalog rows (`library_rows` → `""`) and the asset API's placing
- line (a collection-instance Empty, not `lib.scatter.instance`), and the two placement hints that named
- `lib.place.seat` say what it does (`scene_placement.RAW_BPY_WORDS`); the skeleton stage's cache key carries
- `scene_lib: False` in raw mode only (a pre-round resume that changed the mode rewrites the skeleton, and a raw
- skeleton removes a library one's `src/lib/`; library-mode keys are unchanged); (4) `scene_lib` is a variant knob
- (`prompts/variants.KNOB_FIELDS`, bool) of a new kind, `RUN_KNOBS`: `knobs_applied` reports it but never writes it
- onto a shared `Settings` — the bench runs `--parallel N` runs as threads of ONE process sharing the singleton, and
- a written knob, put back by whichever run ended first, flipped its siblings between raw and library mode mid-run
- (the review's two-thread race; `skills_max` / `skills_only` keep the old write-and-restore) — and it is applied
- by the MCP server at start (`mcp_server.apply_run_knobs`: the spec's frozen variant,
- else the process switch by the spec's generator), because the server is its own process and its `build` lint
- would otherwise pass a `lib` import the round's lint fails; (5) the variant `argon_raw` (v1, generators
- `agy:gemini-4-argon`, `[knobs] scene_lib = false`) shadows, for scene_blender, `scene_blender/{system,contract,
- asset,effects_catalog}.md`, `tracks/scene_{env,zone,asset,refine}_bpy.j2`, `tracks/plan_scene_bpy.j2` and
- `system/harness_contract.md` with copies that replace every library reference by what the gate measures and the
- raw bpy that meets it (seating from the root's lowest world-space vertices, boxes kept apart, soft particles as
- volume-only materials, motion on the slotted action's channelbag f-curves or simple `frame` drivers), plus the
- owner's realism REQUIREMENTS stated as what is judged / measured (multi-scale procedural surfaces, organic
- silhouettes, a world that continues past the content); the contract keeps ONE executable example per module
- type (env + one zone) in raw bpy / bmesh; the effects catalog is a statement that no library ships plus the
- generic Blender 5.2 / renderer facts; the skills overlay shadows `c3d-bpy-scene-{placement,lighting,materials}`
- with lib-free copies that keep every claimed sentence (their `_claims` are the base's), `routes.toml` with no
- rows. HOW: `3dcode make "..." --track scene --language scene_blender --variant argon_raw` (or
- `C3D_VARIANT=argon_raw`; `C3D_SCENE_LIB=0` alone gives raw mode under the BASE prompts, which still describe the
- library — not a supported combination). Model-visible: a new manifest scenario
- `scene.scene_blender.agent.variant_argon_raw` (43 payloads, blessed); no existing payload moved. Pinned:
- `tests/scene_blender/test_raw_mode.py` (raw skeleton, refused example, the knob at call time, two overlapping
- runs in threads keeping their own mode, the real runtime deciding for the track and the skeleton key, the lint in both
- modes, the knob's typing and precedence, no overlay file names the library, every overlaid template renders
- with the scene track's context, the whole run offline, the MCP server applying the run's knobs, and in Blender
- the raw placeholder env + an empty zone),
- `tests/prompts/test_snippets_run.py::test_the_argon_raw_contract_examples_build_through_the_runtime_in_raw_mode`,
- `tests/core/test_doctor.py::test_doctor_skills_reports_every_shipped_overlay` (two shipped variants, one row each).
-
-* **D114 A NaN in the model's bpy scene is the MODEL's build error; a `.blend` keeps the images made in memory
- (2026-10-17).** WHY: (1) a live scene_blender run (`world_demo/scenes_v1`, `w6_sky_island_ruins` round 2):
- `src/assets/mossy_arch.py` left NaN vertices (`MossyArchStone_v0`, ~455 of 3 900 evaluated), the zone
- (`middle_cascade_zone.py`) placed its arches at a `z` computed from those vertices — NaN locations; rebuilt
- from the round's commit, the old writer put the NaN into the GLB's JSON (accessor `min`/`max`, and
- `"matrix":[NaN,…]` from the placement), the probe host's
- `JSON.parse` failed, `offline_report` marks any host load failure `harness_failure`, so `build_with_repair`
- re-ran the identical build twice (`build.harness_retry` ×2) and gave up — the model never got a repair task
- naming the object and the round scored None (~$2.8, 20 min). The static and URDF paths had the quieter twin:
- the official glTF exporter DROPS a NaN translation (the part exports at the origin, measured on 5.2.2) and
- writes NaN vertices into the buffer. (2) `run_bpy.py --blend` and `run_bpy_scene.py`'s `scene.blend` were saved
- with `save_as_mainfile(copy=True)` and nothing packed: an image the script made in memory (`images.new` +
- `pixels`; a character's 32 generated textures) reopens as a blank generated image — black. `scene.blend` is
- what `render_bpy_scene.py` opens for EVERY judged frame, so on scene_blender this was a judged-frames bug: any
- procedural texture baked through `pixels` was judged black, while the census GLB (no images) and the gates
- never saw it. WHAT: (1) `wrappers/_finite.py` (numpy + duck-typed bpy, unit-testable): `own_channels`
- (location / the rotation channel the object's `rotation_mode` uses / scale / the deltas /
- `matrix_parent_inverse`), `transform_culprit` (walks up the parent chain: the Empty whose rotation is NaN is
- named, "makes 'Arch' non-finite"; nothing on the way → `matrix_world`, a constraint or driver), `Offenders`
- (one row per object × kind — transform / vertices / instances of a scatter cloud — with the FILE that built the
- object) whose `report()` is the build error: `error_type` `NonFiniteTransform` (`NonFiniteGeometry` when only
- vertices), a message naming each object, its file and channel values plus the usual causes, `error_file` the
- first known file, the rows under `nonfinite`. `_census_glb` checks every node matrix, every mesh's vertices
- and every cloud's instance matrices as it goes — an instanced mesh's NaN vertices never hide a NaN in what
- places it (one report, not two repair attempts; a geometry-nodes cloud is named by the mesh it scatters) —
- skips the offender and raises `NonFiniteError` before writing anything; `run_bpy_scene` reports it as the build's error (not `CensusGlbError`, which stays the harness's), so
- `run_wrapper` → `build` returns a failed, NOT `harness_failure` result and the repair loop hands it to the model
- like any script error (the env check quotes it; the bpy asset check reports it file-first, not as "did not finish"). The file: `Stages` maps
- every object a builder that returned created (`as_pointer`) to its file — `src/zones/<z>.py`,
- `src/assets/<a>.py`, `src/env.py`, the entry's own top-level `src/scene.py`. `json.dumps(allow_nan=False)`
- is the last line (a writer bug, then, is a `CensusGlbError`, never a NaN on disk); a non-finite float custom
- property is dropped from `extras`. `run_bpy.py` scans what it would export (`scan_objects`: world matrix +
- evaluated vertices) and exports nothing on a hit; `run_bpy_links.py` scans each link's group before baking it.
- Measured: an `inf` written to a transform channel is clamped by RNA to FLT_MAX (finite), so NaN is the case
- that reaches a writer; the w6 round-2 source rebuilt with this change fails as `NonFiniteTransform` at
- `src/assets/mossy_arch.py`, 9 objects named (the arch's vertices + each NaN-placed arch with its zone file),
- `harness_failure` false. (2) `run_bpy.save_blend` packs every non-viewer image that `is_dirty` (8-bit → PNG,
- float → OpenEXR, measured to reopen with the same pixels; an untouched generated image regenerates and is left
- alone — note a generated image's `type` is `UV_TEST`, not `IMAGE`) before `save_as_mainfile(copy=True)`; both
- `object.blend` and `scene.blend` save through it. Model-visible: only the new error text on a NaN build; no
- prompt payload moved. Pinned: `tests/scene_blender/test_nonfinite.py` (the detector, the report, the writer
- refusing a NaN matrix / custom property / JSON; in Blender a zone with a NaN location and a NaN-rotated parent
- failing with both objects and `src/zones/ruins.py` named, no `census.glb`, and `build_with_repair` dispatching
- a repair — no `build.harness_retry` — whose report leads with the file; `scene.blend` reopening a generated
- texture with its pixels; an instanced NaN-vertex mesh AND its NaN placement both reported, a geometry-nodes
- scatter named by its mesh), `tests/scene_blender/test_prompts.py` (the asset check's NaN error),
- `tests/blender_cadquery/test_blender_nonfinite.py` (NaN location / NaN vertex fail
- the static build, `object.blend` keeps an 8-bit and a float generated image),
- `tests/urdf_joints/test_live_blender.py::test_a_nan_in_a_link_is_the_scripts_error`.
-
-## Rejected / deferred
-
-* A versioned `Spec`/`RunRecord`/`RunState` load-normaliser (rejected 2026-08-30: of the seven
- compatibility branches it was meant to absorb, only two are schema-shaped — 14 lines — so it
- would add an abstraction and delete nothing, L4).
-* Deleting `spatial/sections.py` (rejected 2026-08-30: it IS the registered `cross_section` MCP
- tool, imported at module level by `spatial/tools.py`; removing it takes down the MCP server).
-* Registering `single-shot` as a CodingAgent kind (rejected: it has no tools/session).
-* A free-form `dict` judge schema (rejected: flash skips criteria).
-* Storing URDF meshes Y-up and converting on load (rejected: breaks foreign loaders).
-* Per-asset judging for threejs scene assets — done 2026-09-07 (D66: `render_asset` on the scene runtime).
-* Proposed and not yet done (owner-level files): `n_samples` in Settings. (Done since first written: `Workspace._git`
- lock + index.lock retry; the `languages/**` package-data globs.)
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
index b560f2dd..ba98ee97 100644
--- a/harness/docs/INTERFACES.md
+++ b/harness/docs/INTERFACES.md
@@ -5,7 +5,7 @@ This file lists the signatures other packages may rely on. Types live in
`languages/base.py`, `spatial/registry.py`, `tracks/__init__.py` (judges are
duck-typed `.judge(JudgeInput) -> Judgment`; `judges/base.py` defines no protocol).
Where the build deviated from the original plan the deviation is called out as
-**Δ** — see `docs/DECISIONS.md` for the why. When in doubt the code wins; this
+**Δ** — the rationale is kept in optional local decision notes. When in doubt the code wins; this
file was last checked against it on 2026-09-22, and every `codeverse3d` name it cites is
test-pinned (`tests/core/test_interfaces_names.py`).
diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.md
index eb517d16..ea36294a 100644
--- a/harness/docs/SKILLS.md
+++ b/harness/docs/SKILLS.md
@@ -190,7 +190,7 @@ record refers to a routing decision by id, so recycling it would silently relabe
declares **one deterministic quantity it claims to move**, in its own frontmatter
(`target_metric`, `target_direction`, `target_baseline`) and in `codeverse3d/addons/skill_targets.py`.
`python eval/bench/skill_targets.py eval/bench/out` prints them all — per battery or paired across an
-A/B's two arms — and **`docs/SKILLS_LEDGER.md` is the row-by-row maintenance surface**.
+A/B's two arms — and the optional local skills ledger records historical measurements.
`cadquery-forms` and `threejs-forms` stay `inherited-unverified` — routed by default since
2026-09-22, but unranked: their languages have **4 (cadquery) and 3 (threejs) graded runs**
@@ -292,7 +292,7 @@ CLI launched by its own backend's `run()`, a chair brief that never mentions ski
Every CLI read every routed body and no reference file; the atime probe on the same four
sessions reported every reference "read" and the control opened — git, not the agent.
-Details, costs and commands: `docs/SKILLS_LEDGER.md` §0b.
+Details, costs and commands: the local skills ledger (not distributed) §0b.
### Measured 2026-08-25, on the atime probe
@@ -388,7 +388,7 @@ Two contradiction checks are worth separating, because they answer different que
native skill loader, and the ground-truth channel this section wished it had (§9, "CLI
backends' read rate is UNMEASURED") now exists: each backend logs its CLI's own tool calls.
2. **All four CLIs load the bundles, unprompted, and it is proven from their transcripts**
- (§4 table; `docs/SKILLS_LEDGER.md` §0b): gemini-cli, claude-code, codex and agy each
+ (§4 table; the local skills ledger (not distributed) §0b): gemini-cli, claude-code, codex and agy each
activated **4 of 4** routed bundles on an ordinary chair brief, none touched the control,
none read a reference file. The discovery wiring was re-read from the installed binaries
and two gaps were closed: gemini-cli's `skills.enabled` is now pinned in the per-session
@@ -642,7 +642,7 @@ chose to go deeper" (§1).
direction, and its baseline from `python eval/bench/skill_targets.py eval/bench/out`. If no
deterministic instrument can see the claim, say so with `measurable=False` and a
`caveat`: that is a finding about the bundle, not a gap to paper over with a judged
- criterion. Then add its row to `docs/SKILLS_LEDGER.md`.
+ criterion. Maintainers may also record the measurement in their local skills ledger.
6. `3dcode skills validate --strict` and `pytest tests/skills`.
Body rules: ≤ 350 lines and ≤ 2,500 tokens; no code fence over 12 lines (D107); never restate a
@@ -693,7 +693,7 @@ so; the rest are live.
`c3d-threejs-shader-traps` is instrumented from that date on. Runs recorded before it carry
no `shader_preflight` gate: a readout across the date must not mix the two.
* ~~**`eval/bench/_fixed_eval.FixedEvaluator` is blender-only.**~~ Fixed 2026-08-26; the entry
- lives in `docs/SKILLS_LEDGER.md` §4.
+ lives in the local skills ledger (not distributed) §4.
* ~~**The atime probe is blind in any git workspace, and its control proves it.**~~ **Worked
around 2026-09-22**: the probe reads each CLI's own tool calls first (§4) and falls back to
atime only for a session that left no trace. The atime probe itself is as blind as ever —
diff --git a/harness/docs/SKILLS_LEDGER.md b/harness/docs/SKILLS_LEDGER.md
deleted file mode 100644
index 026c3402..00000000
--- a/harness/docs/SKILLS_LEDGER.md
+++ /dev/null
@@ -1,424 +0,0 @@
-# Skills ledger — what each bundle claims, and whether it is earning its place
-
-A skill library you cannot measure per-skill is one you can only maintain by taste. This is
-the maintenance surface: **one row per bundle**, naming the single deterministic quantity it
-claims to move, the direction, the number it has to beat, and what it owes before it can be
-called earned.
-
-**Library: 17 bundles** (13 + the 2026-09-01 scene-graphics port: atmosphere, water,
-night, materials — routes R25-R28, evidence `inherited-unverified` from the
-scene_multifile_graphics reference ledger). **All 17 route by default since 2026-09-22**
-(`C3D_SKILLS` and `C3D_SKILLS_UNVERIFIED` default on; `C3D_SKILLS=0` is the off switch) —
-the owner's call, on the live evidence in §0b. They shipped OFF from 2026-08-25 to
-2026-09-22; §5 records why that was the honest default then. Zero have a measured effect.
-
-Three files hold it up:
-
-| file | what it is |
-|---|---|
-| `codeverse3d/addons/skill_targets.py` | the table — one `Target` row per bundle |
-| `eval/bench/skill_targets.py` | the readout — one command, battery **or** A/B |
-| `tests/skills/test_targets.py` | the pins — the rows exist, the gate kinds are still live, the frontmatter agrees, the readout counts what the row says |
-
-```
-python eval/bench/skill_targets.py eval/bench/out # every baseline, whole corpus
-python eval/bench/skill_targets.py eval/bench/out --round first # where a bundle acts, before repair
-python eval/bench/skill_targets.py eval/bench/out/ab_skills # control vs variant, paired
-python eval/bench/skill_targets.py eval/bench/out --skill c3d-part-contact --per-run --json
-```
-
----
-
-## 0a. In flight — the first whole-library pinned A/B (2026-08-26)
-
-`eval/bench/out/fancy_v1/{bl_a,bl_b,cq,tj}`: 16 hard, design-realistic object prompts (blender 10,
-cadquery 3, threejs 3), `C3D_SKILLS=1` (the whole library) against OFF, plans pinned, the same
-fixed judge, on all 22 keys. Read it out with `python eval/bench/skill_targets.py eval/bench/out/fancy_v1/<driver>`
-per driver, or the merged paired table. What it can and cannot say, stated before the data
-lands: n ≤ 16 pairs against a judged-score floor of 0.202 resolves a ~0.2 mean move, not a
-per-bundle effect (§5); its value is the first paired data on the library *as shipped* and the
-first-round gate rates (`--round first`) where the bundles act. Gemini spent the night in a
-503 storm; pairs recorded `infra_failed` / `error` / `budget`-with-no-judged-round are outages
-(EVAL §7) and are re-run with `--redo-status`, never scored.
-
-**Final readout, 12:50 (wave finished; 13 pairs, plan-pinned, ON − OFF, fixed pro judge):**
-microscope +0.087, carousel −0.109, chamber_organ 0.000, harp +0.012, lamp −0.362 (−0.242
-re-aggregated), orbital_shaker −0.211, lever_espresso −0.575, ships_wheel −0.256, gate_valve
-−0.058, turbocharger +0.331 (control 0.000 was the evaluator's cadquery build defect, a303086 —
-not a result; drop it), jukebox −0.326, marimba +0.077, smock_windmill +0.260. With
-turbocharger dropped: n=12, mean **−0.122** (re-aggregated −0.112), sd 0.24, sign 4/12 —
-inside the 0.202 floor on the mean, with the large negatives being real defects in the ON runs
-(a lever espresso that fell apart, a lamp and a wheel that lost must-items). The whole
-library, measured as shipped, does not help flash on hard objects and may hurt; **skills stay
-OFF**. Storm cost of this wave: 16 pairs took 12 h of wall clock across four drivers for 13
-real pairs; the redo machinery (RUNBOOK 7.x/7.w) is what produced the last seven.
-
-**07:00 readout (5 real pairs, plan-pinned, ON − OFF):** harp +0.012, microscope +0.087,
-lamp −0.362, ships_wheel −0.256, bubbler_jukebox −0.326; mean −0.169, sd 0.204, sign 2/5.
-Three ON cells landed on exactly 0.600 — what a cap looks like from the outside. Reading
-the raw judgments: the lamp's cap was a false `floating_part` on a passed connectivity gate
-(fixed in scoring, EVAL §6; re-aggregated 0.720 → pair −0.242), the ships_wheel's is a
-`missing_must_acceptance` cap (a must-item the ON run really lacks), the jukebox's is
-interpenetration (15–18 mm WARNs) plus flat materials. With the lamp re-aggregated: mean
-−0.145, sd 0.182 — still inside the 0.202 floor, still 2/5 on sign; nothing here says the
-library helps, and the two large negatives are real defects in the ON runs, not judge noise.
-Skills stay OFF. Pairs still in flight (carousel_horse, lever_espresso, smock_windmill,
-gate_valve, turbocharger, marimba, jacobs_chuck redo) land in `results.jsonl` per driver;
-merge with `python eval/bench/skill_targets.py` or the paired readout (scratch `fancy_readout.py`
-— rows are only paired when both arms are `scored`).
-
-## 0b. 2026-09-22 — all four vendor CLIs load the bundles; default ON
-
-**Question.** With `api-agent` gone (2026-08-28), does each vendor CLI the harness drives
-actually see the routed bundles and load them — and can we tell from the CLI's own record
-instead of from atime?
-
-**Rig** (scratch, not a battery). One workspace per CLI, built through the harness's own
-code path: `Workspace.create` → `spec.json` (static_object / blender) →
-`agents.materialize.materialize_workspace` → `skills.attach_skills(kind="baseline")` with a
-chair plan (4 parts, 4 mirrored legs, 3 slats). The router picked **four** bundles —
-`c3d-blender-forms` (R8), `c3d-part-contact` (R1), `c3d-bbox-contract` (R3),
-`c3d-repeats-and-mirrors` (R6) — and materialised the never-routed control
-`zz-c3d-read-control` beside them in both roots. Each session was launched by
-`get_coding_agent("<kind>:<model>").run(AgentJob(..., kind="baseline", spatial_tools=True))`
-— the metered backend and the argv/env/settings builders the round loop uses — with the
-blender `system.md` as `system_append` and a chair brief that never mentions skills (the
-only skills text in the session is the harness's one mandate sentence in the body file).
-Workspaces under an untrusted `/tmp` path on purpose. Reads come from the tool trace each
-backend now writes (`agents/cli_common.record_tool_calls`); the atime probe was run on the
-same workspace afterwards for comparison.
-
-**Static checks first, no model call:** `gemini skills list` under the harness's per-session
-system settings listed the four + the control, all `[Enabled]`, from
-`<ws>/.agents/skills`; `codex debug prompt-input` in an untrusted workspace rendered a
-`## Skills` section with the four + the control as `r1/<name>/SKILL.md`, `r1` =
-`<ws>/.agents/skills` (plus codex's five `.system` skills).
-
-| CLI · model | exit | index the model was shown | activated (surfaced) | refs (deep) | control | atime probe, same session | cost |
-|---|---|---|---|---|---|---|---|
-| gemini-cli 0.53.0 · gemini-3.7-flash, session 1 | timeout 1 202 s — a `fetch failed` / 503 storm inside the CLI's retry loop | the 4 + control (`gemini skills list`) | **4 / 4** — `activate_skill` ×4 in its FIRST turn | 0 | untouched | 4/4 deep, control "read" (blind) | harness $0 (no envelope); its chat record: 1.19 M prompt (0.92 M cached), 19.0 k out+thoughts ≈ **$0.34** |
-| gemini-cli 0.53.0 · gemini-3.7-flash, session 2 | timeout 902 s — same storm | same | **4 / 4** — `activate_skill` ×4 in its first turn | 0 | untouched | 4/4 deep, control "read" (blind) | harness $0; chat record ≈ **$0.34** |
-| claude-code 2.1.280 · sonnet (served claude-sonnet-5) | completed, 294 s, 25 turns, 20 calls | `init.skills`: the 4 + control (+ 26 bundled / user-level) | **4 / 4** — `Skill` ×4, its first four calls | 0 | untouched | 4/4 deep, control "read" (blind) | $0.955 reported (subscription) |
-| codex 0.155.1 · gpt-5.6-luna (effort high) | completed, 545 s, 29 calls | `## Skills`: the 4 + control (+ 5 `.system`) | **4 / 4** — `sed` of each `SKILL.md`; its first `sed` mis-expanded `r1` as `r0`, exited 2 and is NOT credited (`failed`) | 0 | untouched | 4/4 deep, control "read" (blind) | ≈ $0.085 at API prices (subscription) |
-| agy 1.2.2 · gemini-3.7-flash-medium | completed, 102 s, 22 calls | its first four calls were the four absolute `SKILL.md` paths, no listing before them | **4 / 4** — `view_file` ×4 | 0 | untouched | 4/4 deep, control "read" (blind) | $0 (subscription) |
-
-**Read-out.**
-* **Every CLI loaded every routed bundle, unprompted, and never the control** — 20 of 20
- activations across five sessions, all before the agent wrote a line of code. codex said
- so in its first message ("I'm using the chair-relevant 3D skills: Blender form construction,
- bbox/contract control, part-contact checks, and mirrored/repeated-part handling").
-* **No session opened a single `references/` file.** The depth tier is unused on a baseline;
- the old "deep" 100%s were git (§4 of docs/SKILLS.md). This is now a measured 0, not an
- unmeasured one — the first honest reading of the design's depth metric.
-* **The atime probe was wrong on every session** and its control said so each time — the
- reason the probe now reads transcripts first.
-* The two gemini sessions were killed by a provider storm, not by skills; both still left
- their tool trace (found by `.project_root` + mtime, not `session_id`, for exactly this
- case). They also expose a cost gap outside this lane: a killed gemini-cli session is
- recorded at $0 although its chat record holds ~$0.34 of tokens (closed the same day:
- the chat record is such a session's usage — `agents/backends.read_gemini_chats`; deleted with the
- gemini-cli backend in D103).
-* codex's MCP server did not start in this rig (codex hands MCP servers a scrubbed env; the
- lane worktree is on `PYTHONPATH`, not installed), so it spent its session probing the
- server by hand — a rig artefact, not a skills result.
-
-**Gaps closed** (code, 2026-09-22): gemini-cli `skills.enabled` pinned in the per-session
-system settings (merged last; a user's `false` would have hidden every bundle — moot since D103
-deleted that backend); claude-code
-switched to `--output-format stream-json --verbose` (its `json` output carried no tool
-calls); every backend writes its CLI's tool calls into `transcript.jsonl` and the read probe
-reads them first; agy's `AgentResult.tool_calls` is the trace count (was always 0).
-**Verified not to be gaps:** gemini-cli folder trust (off ⇒ trusted ⇒ both workspace roots
-load; ON would skip them), codex trust (none needed), agy's `--disable-slash-commands` (only
-`/name` prompt expansion), claude-code's `Skill` in `--allowedTools` (present since 2026-08-25).
-
-**Decision:** `C3D_SKILLS` and `C3D_SKILLS_UNVERIFIED` default ON (docs/SKILLS.md §6, the
-2026-09-22 note). An A/B of skills now names its no-skills arm explicitly:
-`eval/bench/ab_plan.py --variant-env C3D_SKILLS=0` (ab_plan's control inherits the driver's
-env minus the variant keys, so `C3D_SKILLS=1` would be two identical arms).
-
-## 0. What this wave decided (2026-08-25, curate)
-
-Three measurement waves ran: a description A/B read out on **read rate** (ground truth from
-api-agent's `read_skill` tool calls), and three independent **effect** A/Bs on the bundles'
-own target metrics. The results, stated plainly:
-
-* **No bundle's target moved, separated from that metric's own A/A floor.** Not one. Every
- A/B came back `underpowered`, and for several the underpowering is structural rather than
- a matter of n. **So nothing was promoted to `measured`, and nothing ships on.**
-* **One bundle was cut**: `c3d-form-manifest`, read 2 of 19 times before *and* after its
- description was rewritten. The numbers are in this ledger; the bundle's text is in git history
- (`docs/skills-attic/`, removed 2026-09-21).
-* **Four bundles were revised by fixing their delivery, not their prose.** The scene track
- never handed its skills to the sessions that do the work. That is now fixed (§3).
-* **`cadquery-forms` and `threejs-forms` stay `inherited-unverified`.** Their languages have
- **4 (cadquery) and 3 (threejs) graded runs**, against the 20 the rule requires. Neither
- moved this wave.
-
-### Two words this ledger keeps apart
-
-`metadata.evidence` is about **provenance** — where the bundle's prose came from. A row can
-say `measured` because its defect descriptions were derived from our corpus, and still have
-**no measured effect**. Those are different axes and this wave separated them everywhere:
-5 bundles are `measured` for provenance; **0** are measured for effect.
-
----
-
-## 1. Why these are gate numbers and not scores — and why that was not enough
-
-An 8-prompt A/A of `eval/bench/ab_plan.py` put the paired sd of the judged score at **0.202** and
-printed *~408 paired prompts to resolve +0.02* (`eval/docs/EVAL.md` §8). Every row below is read
-from a gate report, a `BuildResult`, the exported GLB or the sampled frames — never the judge.
-
-The premise this wave was built on was that **pinning the plan** would collapse the noise,
-because `eval/docs/EVAL.md` §8.1 showed the variance is the planner's. Pinning was built, wired
-and verified in production (one planner call per pair, both arms cache-HIT on the same
-`inputs_hash`). **The premise was half wrong, and that is the wave's most useful finding.**
-
-* Regressing `contract_findings` on `n_parts` over 198 runs gives **R² = 0.103**. Removing
- the plan-size term moves paired sd only 2.49 → 2.36. Among the 44 runs that all planned
- 8 parts, sd is still 2.02. **The spread is generation noise at fixed plan size.**
-* Measured directly: a pinned A/A pair scored **0.450 vs 0.654** on identical, plan-pinned
- arms — a 0.204 spread, indistinguishable from the 0.202 measured *without* pinning.
-* A shader plan has no parts, so pinning removes almost nothing on the graphics track.
-
-Pinning is still correct and still **cheaper** (one planner call per pair, not two). It is
-just not the lever. Measured A/A floors on the target metrics themselves:
-
-```
-metric A/A delta (identical arms) paired sd ±2SE n to resolve 25%
-interpenetrating_pairs +5.667 8.963 10.349 483
-feature_density +3904.7 3057.6 3530.6 92 [bundle cut]
-contract_findings -2.000 2.646 3.055 449
-mean_edge_density (pinned) +0.069 0.1275 0.1804 123
-```
-
-`±2SE` on `interpenetrating_pairs` is **3.2× the entire corpus mean it is meant to measure**.
-
-**The single highest-leverage statistical fix, unspent:** read these metrics as a **hit
-rate**, not a mean count. `P(run has ≥1 contract finding)` = 63%; halving *that* needs ~24
-pairs instead of 449. The counts are spiky (38–83% zeros, max 10–13), so a mean ± 2SE throws
-away most of the signal. 24 pairs is affordable; 449 is not.
-
----
-
-## 2. The ledger
-
-Baselines are recomputed 2026-08-25 from every run under `eval/bench/out` that a gate reported on
-(`python eval/bench/skill_targets.py eval/bench/out`). Both rounds are shown where they differ, because
-**several bundles act on the first round and the repair loop hides them by the last.**
-
-Graded runs per language (a run is a sample **iff** it has a round carrying a gate report):
-**blender 145, urdf_blender 25, glsl_shader 17, scene_threejs 9, opengl_python 6, scene_blender 0 (2026-10-14: the loop's iteration 0 is the first sample),
-cadquery 4, threejs 3.** The corpus is live — sibling batteries land runs during a wave —
-so every number below carries the snapshot it was read from.
-
-| bundle | evidence (provenance) | target metric | dir | baseline — last round | first round | graded n | effect | status |
-|---|---|---|---|---|---|---|---|---|
-| **c3d-part-contact** | measured | `interpenetrating_pairs` | down | **3.25** mean / 2.0 med, n=177; 71 at 0 | 4.91 / 3.0 | 145+25 | none — underpowered (needs ~483 pairs) | **best live candidate.** Routed, delivered, read 55%. Blocked only by the noise floor. Needs a *rate* metric (§5) |
-| **c3d-bbox-contract** | measured | `contract_findings` | down | **1.47** mean / 1.0 med, n=186; 72 at 0 | 1.20 / 1.0 | 145+25+9 | none — underpowered (~449 pairs) | most-listed and best-read bundle (68%). Its A/B produced 0 usable pairs: the variant hit its budget cap with **zero gated rounds** while still being judged (§4) |
-| **c3d-repeats-and-mirrors** | measured | `contract_instance_findings` | down | **0.37** mean / 0.0 med, n=177; **142 of 177 at 0** | 0.32 / 0.0 | 145+25 | none — 1 pinned A/A pair, tied | **floor effect.** Read 38%, the lowest of any delivered bundle. Needs an instanced-prompt slice *and* a read-rate re-check |
-| **c3d-blender-forms** | measured | `blender_lint_findings` | down | **0.87** mean / 0.0 med, n=170; **137 of 170 at 0** | 0.60 / 0.0 | 145+25 | none — structural (~230 pairs to halve) | 81% of runs are already clean and sd (2.31) is 2.7× the mean. The metric also cannot see the form-to-technique table, which is half the bundle |
-| **c3d-urdf-joints** | measured | `joint_sweep_errors` | down | **6.96** mean / 0.0 med, n=25; 21 at 0, worst 101 | 9.72 / 0.0 | 25 | none — **~1420 pairs**, not bought | heavily tailed: three runs carry every error. Do not A/B this metric. Read 4/4 |
-| **c3d-glsl-craft** | mixed | `mean_edge_density` | up | **0.221** mean / 0.186 med, n=17 (0.031–0.464) | 0.220 / 0.192 | 17 | none — pinned A/A gave ±0.180 on identical arms | corpus nearly doubled (9→17). Still needs ~123 pairs; **its own A/A is the evidence against this metric** |
-| **c3d-opengl-pipeline** | mixed | `gl_frame_findings` | down | **0.167** mean, n=6; 5 of 6 at 0 | same | 6 | none — floor effect | one finding in the whole corpus. Cannot go down much. Read 4/4 |
-| **c3d-scene-lighting** | mixed | `dark_or_flat_frames` | down | **2.89** mean / 3.0 med, n=9 | **4.89 / 4.0 — 0 of 9 runs clean** | 9 | **never delivered until now** (§3) | **revised.** The largest untouched headroom in the library, in the exact stage that was skipped. Gate semantics changed today (§4) — re-baseline before pairing |
-| **c3d-scene-composition** | mixed | `camera_placement_findings` | down | **0.56** mean, n=9; 7 at 0 | 0.44 / 0.0 | 9 | **never delivered until now** (§3) | **revised.** But the metric **under-counts by ~2×** — see §4. True first-round rate is 1.44/run, not 0.44 |
-| **c3d-scene-motion** | mixed | `min_authored_changed_frac` | up | 0.038 mean / 0.027 med, n=9 | 0.024 / 0.019 | 9 | **UNMEASURABLE** (`measurable=false`) — see §6 | **revised (delivery).** Kept: its read demand has never been measurable either, so the cut rule's *and* is not satisfied |
-| **c3d-threejs-shader-traps** | mixed | `shader_preflight_findings` | down | **0.00**, n=9 | 0.00, n=9 | 9 | **NOT INSTRUMENTED** — see §4 | **revised (delivery).** Every listing it has ever had was in a scene session that was never offered the read tool, so it is *unmeasured*, not unread |
-| **c3d-cadquery-forms** | inherited-unverified | `build_failure_rate` | down | 0.00, n=4 (all 4 built) | same | **4** | no variance to move | **routed OFF.** Needs 20 graded cadquery runs; has **4**. Read 2/2 when forced on |
-| **c3d-threejs-forms** | inherited-unverified | `missing_parts` | down | 0.00, n=3 | same | **3** | no variance to move | **routed OFF.** Needs 20 graded threejs runs; has 3. Read 2/2 when forced on |
-| **c3d-bpy-scene-placement** | mixed (gate code read 2026-10-14; no corpus) | `bpy_placement_errors` | down | **n=0** — no gated scene_blender runs (2026-10-14) | — | 0 | not yet measured | **new (D105).** Routed R29 (standing, 80) and R30 (gate-fired, the six seating kinds). The metric is the loop's own accept veto (floating + sunken + interpenetration ERRORs per run), so iteration 0 reads it for free. `unsupported` is WARN-only today and counts zero. **De-templated 2026-10-15** (owner's rule): requirements + their measurements, `lib.place` / `lib.scatter` / `lib.terrain` as an optional toolbox, `make_height_at` one landform option, the world continuing past the bounds, `world_edge` (was `no_backdrop`) stated as its measure (1.25 × half-extent), no ring / plate / counts |
-| **c3d-bpy-scene-lighting** | mixed (gate code read 2026-10-14; bands measured that day on a synthetic scene, not on runs) | `bpy_exposure_findings` | down | **n=0** — no gated scene_blender runs (2026-10-14) | — | 0 | not yet measured | **new (D105).** Routed R31 / R32. Counts the same three `scene_frames` kinds as `c3d-scene-lighting` over `scene_blender` only — a run is one language, so each A/B keeps one owner; `test_no_two_bundles_claim_the_same_quantity` has to key on (kind, language). **De-templated 2026-10-15**: the band as the requirement, the lib pairs as measured ways, the `no_fog` census fact and the rig's `Ceiling…`/`RoomShell…` lid rule stated as interface, the one-sun rule replaced by the 0.83 two-sun measurement |
-| **c3d-bpy-scene-materials** | mixed (census code read 2026-10-14; no corpus) | `flat_principled_materials` | down | **UNMEASURABLE** (`measurable=false`) — see §6 | — | 0 | — | **new (D105).** Routed R33 (standing only: no gate sees material work). The census GLB reads three Principled default values and a linked socket exports as its default, so the honest instrument — a per-material linked-socket census — is a harness change, not a skill change (`wrappers/_census_glb.py`). **De-templated 2026-10-15**: `flat_ground` stated as the judged requirement with options by brief (slope/height mix, worn band, apron, vertex colours, paving), `noise_scale` where the brief's material varies, soft particles as volumes (8 of 30 iteration-0 scenes graded `hard_edged_particles`) |
-
-**Cut this wave:** `c3d-form-manifest` (text in git history; `docs/skills-attic/` was removed 2026-09-21).
-
-### Read rate — the cheap filter, and the only thing that resolved
-
-Ground truth is api-agent's `read_skill` tool calls, extracted from trajectories. The atime
-probe behind `3dcode skills report` **cannot** measure this and its own control says so: the
-control bundle came back "opened" in 27 of 33 sessions.
-
-| bundle | opened / listed (pooled) | 95% CI |
-|---|---|---|
-| `c3d-cadquery-forms`, `c3d-threejs-forms`, `c3d-urdf-joints`, `c3d-glsl-craft`, `c3d-opengl-pipeline` | 4/4 – 5/5 = **100%** | wide; 1-skill sets flatter |
-| `c3d-bbox-contract` | 13/19 = **68%** | [46%, 85%] |
-| `c3d-blender-forms` | 6/10 = **60%** | — |
-| `c3d-part-contact` | 6/11 = **55%** | [28%, 79%] |
-| `c3d-repeats-and-mirrors` | 3/8 = **38%** | [14%, 69%] |
-| ~~`c3d-form-manifest`~~ | 2/19 = **11%** | **[3%, 31%] — excludes every other bundle. Cut.** |
-| the 4 scene bundles | 0/30 — **never delivered**, see §3 | not a read failure |
-
-Overall, restricted to sessions actually offered the tool: **58% (51/88)** against the
-design's 80% target. **Confound to respect:** read rate tracks how many bundles are listed —
-every 1-skill session read its bundle 4/4 while 5-skill sessions averaged ~55%. Any future
-wording A/B must hold the routed set size fixed or it measures the cap, not the copy.
-
----
-
-## 3. The revision this wave shipped: the scene track never delivered its skills
-
-The read loop saw `c3d-scene-composition` / `-lighting` / `-motion` / `-threejs-shader-traps`
-at **0 opens across 30 listings** and revised their descriptions. That was the wrong fix, and
-two effect owners independently found the right one in the code:
-
-* `SceneTrack.prepare()` (the pre-round hook then; the declared `stages` since 2026-09-22)
- generated the **entire** scene baseline — `_env_stage`, `_zones_stage`, `_assemble_stage`
- each called `tracks.generation.generate` directly.
-* `skills_hook.attach_for_round` was reached from **exactly one place**, `steps.run_round`.
-* `SceneTrack.baseline_tasks` returns `[]`, so round 0 listed the bundles to a round with no
- generation task to consume them — which is precisely "listed 3, opened 0".
-* The router had `kinds=("env", "zone", "compose")` rows for these bundles all along
- (registry R14–R21). **They were selected for the stages that need them and delivered to
- nobody.** `c3d-scene-lighting` routes for `kind="env"` — the stage where a scene's
- lighting is authored.
-
-**Fixed.** `_env_stage` / `_zones_stage` / `_assemble_stage` now go through
-`_deliver_skills` (attach + inline) and `_record_skills` (telemetry), attaching with their
-own kind so the router's rows fire as written. The zone fan-out attaches **once**, outside
-the worker, because three parallel sessions share one workspace and would race the same
-`AGENTS.md`. The prompt manifest's scene scenarios (`tests/prompts/manifest.py`) now pin
-each stage's `skills.attached` event and the bundles it routed (the dedicated
-`test_delivery_reaches_the_session.py` went in the 2026-09-23 test cut).
-(Since D70 the zones stage is ONE session; the fan-out arm was removed 2026-09-21 and the
-test now pins one attach before that one session. Since 2026-09-22 env and zones share one
-wrapper, `SceneTrack._stage_session`, in place of `_deliver_skills` / `_record_skills`.)
-
-**What I expect it to do.** `dark_or_flat_frames` is **4.38 per run on the first gated
-round with 0 of 8 runs clean** — the largest untouched headroom in the library, sitting in
-the one stage that was being skipped. If `c3d-scene-lighting` does anything at all, this is
-where it shows up. **This is a prediction, not a result** — no scene run has yet been made
-with delivery working. The read-rate re-measurement is the next wave's first job, and until
-it lands these four rows stay `mixed`, not `measured`.
-
----
-
-## 4. Instrumentation gaps — nine, and five would have produced confident wrong answers
-
-* **`camera_placement_findings` sees less than half its own defect class.** The classifier
- matches the *message*, and `scene_frames` emits four camera faults under three wordings.
- Counted today: `camera_in_geometry` (17 findings) and `camera_underground` (3). **Not
- counted: `camera_below_high_ground` (21) and `camera_low` (3)** — both plainly camera
- placement, both invisible to `c3d-scene-composition`'s target. True first-round rate is
- **1.44 findings/run against the 0.44 the row reports**, and 5 of 9 runs that read as clean
- are not. The gate already emits a structured `data["kind"]`; `finding_kind` regexes the
- prose instead. **Not fixed here on purpose** — widening the classifier also widens
- *routing*, which is an effect claim needing its own evidence (same reason
- `scene_frames/content_*` is left alone). Fix it as its own change, with a re-baseline.
-* **The `dark_or_flat` gate changed semantics today** (`fcf2afe`, "a night scene is not a
- broken render"). A dim frame with real contrast (`lum_std ≥ LOWKEY_MIN_STD`) is now a WARN
- reading *"frame is dim but lit … low-key by design"*, and **that message classifies as
- `None`** — so it counts nowhere. No historical run carries it, so the baselines above are
- intact; but any A/B straddling this commit compares two different metrics.
- `c3d-scene-lighting` must be re-baselined against the new gate before it is paired.
-* **`shader_preflight` is not a gate at all.** It appears in **zero** `record.json` files
- corpus-wide: `check_shaders` is an agent-invocable tool (`spatial/tools.py`), never a
- pipeline gate, so no round appends its report. The only evidence is 8 per-run
- `artifacts/shader_preflight.json` files, all clean. "Not instrumented" and "measured,
- always clean" must not print the same number — the readout now returns `None` when the
- artefact is absent, so the row's denominator is 8 and not 198. Rule of three puts the 95%
- upper bound on the base rate at 0.43/run. **Since 2026-09-22** every scene round carries
- it (`BuildResult.gates`, appended by the round built or not); runs before that date still
- do not.
-* **A run is a sample iff it has a round carrying a gate report.** `RunRecord.status` says
- how the round loop *ended* (then `passed`/`plateau`/`budget`/`failed`; since 2026-09-22
- only the stop reason, `max_rounds`/`budget`/…), not whether gates ran.
- Filtering on status dropped every `budget` run — about half the corpus — and would have
- admitted a `passed` run with no gated round as a clean 0.
-* **A budget cap tuned for the judged score starves the gate readout.** The `bbox-contract`
- A/B's variant produced a *scored* artefact with **zero gated rounds**, so the primary
- metric lost the cell while the secondary kept it. Raise `--max-minutes` for
- any A/B whose readout is a gate.
-* **The A/B rig scored four of seven languages 0.0.** `compare_backends._run_harness` gated
- the harness arm on `src/model.py`; a glsl run that finished `passed` having written
- `src/shader.frag` was recorded `no_code`. Both arms would have scored 0.0 and the rig would
- have reported "no effect" for a switch it never tested. **Fixed** (`entry_of(spec)` reads
- `contracts.common.ENTRY_FILE`). This is why no graphics or three.js bundle has ever had a
- readable A/B.
-* **`eval/bench/_fixed_eval.FixedEvaluator` was blender-only.** It pinned `get_runtime(BLENDER)`
- and ran only lint and connectivity, so the *judged* column of any non-blender A/B was
- meaningless. **Fixed** 2026-08-26: each cell builds with its own language's runtime
- (`eval/tests/test_fixed_eval_language.py`); articulated cells add the joint sweep, graphics
- cells their frame metrics, scene cells (2026-09-07) the `scene_frames` gate — contract still
- never runs (it has no plan). It never sank the primary readout either:
- `eval/bench/skill_targets.py` reads each arm's own harness record. (`docs/SKILLS.md` §9 points
- here.)
-* **`telemetry.record_exact_read` is wired to `read_file` only** (`agents/api_agent.py`), so
- `read_skill` — api-agent's actual read channel — never reaches `skill_reads.jsonl`.
- *(Moot since 2026-08-28: the api-agent and its `read_skill` channel were deleted with it;
- vendor-CLI reads go through the filesystem and leave no exact-read channel to wire.)*
-* **`scene_frames/content_*` has no classified kind.** Frame coverage is half of what
- `c3d-scene-composition` teaches; it neither routes nor counts. Left alone deliberately:
- adding a kind widens routing, which is an effect claim needing its own evidence.
-
----
-
-## 5. What ships, and why the answer was "nothing" (2026-08-25; superseded 2026-09-22, §0b)
-
-The library does **not** have to share one switch. `C3D_SKILLS_ONLY` restricts the library
-*before* routing, so shipping a subset is one env var:
-
-```
-C3D_SKILLS=1 C3D_SKILLS_ONLY=c3d-part-contact,c3d-bbox-contract # the vehicle
-```
-
-**Today that list is empty, and all 17 bundles default OFF.** Not for lack of a mechanism,
-and not because the wave ran out of time — because **zero bundles have a measured effect**,
-and every candidate default-on is a token cost per session against an unmeasured benefit.
-
-Read rate is a *leading* indicator, not an outcome. `c3d-bbox-contract` being opened 68% of
-the time is evidence it is discoverable; it is not evidence it helps.
-
-**What flips a bundle to default-on:** a pinned A/B on a metric with enough headroom to
-resolve at an affordable n — which today means a **hit-rate** readout (§1) rather than a mean
-count — moving in the stated direction with more prompts better than worse. `24` pairs is the
-realistic bar for `contract_findings`; `449` is what the mean costs. Get the metric right
-first, then buy the pairs.
-
-### When a bundle is cut
-
-A bundle is cut when **any** of these holds, and cutting is a win for the wave:
-
-1. it is **unread after a revision** — `c3d-form-manifest`, 2/19 pooled, CI [3%, 31%];
-2. its target did not move and it has **no understood failure mode**;
-3. it has **no honest deterministic proxy AND no read demand**.
-
-`c3d-scene-motion` satisfies the first half of (3) and **not** the second: it has never been
-delivered, so its read demand has never been measurable. It is kept, and it is now delivered.
-The distinction matters — cutting on an instrument that was never pointed at the thing is how
-a library loses the bundles that were fine.
-
----
-
-## 6. The one bundle with no honest proxy
-
-`c3d-scene-motion` is marked `measurable=false`, and its own body is the evidence.
-
-* The deterministic instrument is `spatial/frame_motion.py`: a camera counts as moving when
- ≥0.4% of its pixels change between t=0 s and t=1.5 s.
-* `scene_moves` is an **any**, not an **all**: one authored camera over the bar clears the
- gate for the whole scene. `scn_easy_desert_canyon` ships an establishing shot frozen at
- **0.13%** in both rounds and passes anyway, because two other cameras move.
-* The judge scores animation **item by item** — *"the planned animations for water and
- falling leaves are completely static"* — and `animation_life` averages **0.431, the lowest
- criterion in the corpus**.
-
-No deterministic instrument attributes motion to a *named plan item*, so any number here
-would be a proxy invented to fill the row. `min_authored_changed_frac` is printed as a
-**regression guard only**: a drop below the 0.4% bar is a fault the gate would fire on.
-Raising it is not evidence the bundle worked.
-
-Building the honest instrument — mask the plan's animated objects, diff only those pixels —
-is a harness change, not a skill change.
-
-### 6.1 (2026-10-14) a second bundle with no honest proxy
-
-`c3d-bpy-scene-materials` joins `c3d-scene-motion` under `measurable=false`, for the same
-reason in a different instrument: the deterministic side cannot see the claim. The placement
-and frame gates read the census GLB and the PNGs; the GLB writer exports each material as its
-Principled `Base Color` / `Metallic` / `Roughness` default values (`_census_glb._Writer.material`),
-and a LINKED socket — every noise map, every bump — exports as its default. A variance census
-over the sampled texels, or simply "which sockets are linked" per material, is the candidate
-instrument; it is written beside the values the writer already reads, and until then the row is
-a finding about the bundle, not a number to move.
diff --git a/harness/examples/graphics_lab/.gitignore b/harness/examples/graphics_lab/.gitignore
deleted file mode 100644
index fd6aad7f..00000000
--- a/harness/examples/graphics_lab/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-output/
-__pycache__/
diff --git a/harness/examples/graphics_lab/README.md b/harness/examples/graphics_lab/README.md
deleted file mode 100644
index 9892aa3e..00000000
--- a/harness/examples/graphics_lab/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Graphics Lab
-
-Seventeen hand-composed studies of fire, water, terrain, vegetation, atmosphere,
-worked materials and independent shader files, covering the effect modules in
-`codeverse3d/languages/scene_threejs/starter/src/lib/`. Every image and film
-comes from Three.js scene code rendered through the production scene host; there
-are no prerendered backgrounds or generated image assets. It is a development
-lab: no run path uses it.
-
-From the `harness/` directory:
-
-```bash
-python examples/graphics_lab/build.py --out /tmp/graphics-lab --render --video
-node examples/graphics_lab/serve.mjs --out /tmp/graphics-lab
-```
-
-Open the loopback URL printed by the server. The gallery offers H.264 films,
-full-resolution stills, and live orbit controls with authored camera presets,
-pause and time scrubbing. Everything, including Three.js, is served locally;
-opening `index.html` as a `file:` URL does not load browser ES modules. The
-default output is `examples/graphics_lab/output/` (git-ignored).
-
-`--case fire` renders one case again (repeat it to select several); the gallery
-still lists every case. `--width 1920 --height 1080` raises capture resolution;
-`--seconds 6 --fps 24` controls the film. Video export needs ffmpeg on PATH or an
-installed `imageio-ffmpeg`. Without `--render`/`--video` the build only stages
-source workspaces.
-
-Each scene in `scenes/` implements the normal
-`createScene({THREE, renderer, loaders}) -> {scene, cameras, update}` contract.
-The builder stages one self-contained workspace per case in `<out>/cases/`, with a
-copy of the current `src/lib` modules and the `.vert`/`.frag`/`.glsl` files under
-`shaders/` (relative paths kept). Stills use `runtime_js/render_scene.mjs`; films
-(`capture.mjs`) use the same scene host, deterministic absolute simulation times
-and the same ACES/GTAO/bloom/grade chain. `renders/<case>/metrics.json` and
-`<case>.capture.json` record the renderer and timing. `overview.jpg` is a
-three-column contact sheet of the available stills.
-
-The scenes demonstrate realtime approximations, not combustion, fluid or granular
-solvers; each module's JSDoc states its limits, and
-`codeverse3d/prompts/scene_threejs/effects_catalog.md` is the factory table.
-
-## Independent shader files
-
-The external shader study loads [a vertex shader](shaders/external_shader.vert),
-[a fragment shader](shaders/external_shader.frag) and
-[shared GLSL helpers](shaders/external_shader_common.glsl) from async
-[scene creation](scenes/external_shader.js), with `THREE.FileLoader`,
-module-relative URLs and `ShaderMaterial` + `THREE.GLSL3` — the loading pattern the
-scene contract (`prompts/scene_threejs/contract.md`) teaches.
-
-All example UI, code and documentation stay in English.
-
-## Library regression checks
-
-Run `python -m pytest tests/scene_runtime/lib tests/graphics -q -n2` from
-`harness/` when maintaining effects. Besides shader compilation, these checks
-measure transformed wind and cloth normals, light selection, underwater
-transport, material filtering, and feedback initialization on the real rendering
-paths. Use the rendered studies above to assess appearance and motion as well;
-passing numerical checks alone does not establish visual realism.
-
-The moonlit coast (`--case night`) exercises the connected cloud deck, restrained
-star field, physical moon size, and their reflections. `makeClouds` now integrates
-one 3D density field; `quality: 'low' | 'balanced' | 'high'` controls sampling cost.
-The original alpha-map helper `cloudTexture` remains available for custom sprites.
diff --git a/harness/examples/graphics_lab/build.py b/harness/examples/graphics_lab/build.py
deleted file mode 100644
index 9ac213ac..00000000
--- a/harness/examples/graphics_lab/build.py
+++ /dev/null
@@ -1,159 +0,0 @@
-"""Stage reproducible effect cases and optionally render stills and animation.
-
-From harness/: python examples/graphics_lab/build.py --render --video
-The default output is ignored by git. No provider calls or external downloads.
-"""
-from __future__ import annotations
-
-import argparse
-import json
-import shutil
-import subprocess
-from pathlib import Path
-
-HERE = Path(__file__).resolve().parent
-HARNESS = HERE.parents[1]
-LIB = HARNESS / "codeverse3d/languages/scene_threejs/starter/src/lib"
-SHADER_SUFFIXES = {".glsl", ".vert", ".frag"}
-CASES = (
- ("fire", "01", "Fire & candlelight", "Volumetric flames · Wax and embers", "flame"),
- ("ocean", "02", "Open water", "Displaced waves · Reflections and whitecaps", "water"),
- ("stream", "03", "A moving stream", "Shallow water · Flow over a stone bed", "water"),
- ("sand", "04", "Wind over sand", "Sculpted dunes · Ripples and fine grains", "earth"),
- ("rocks", "05", "Stone studies", "Fractured surfaces · Layers and weathering", "earth"),
- ("meadow", "06", "The living meadow", "Folded blades · Wind and transmitted light", "life"),
- ("tree", "07", "A woodland edge", "Connected branches · Living leaves and bark", "life"),
- ("cloud_volume", "08", "Clouds in depth", "Volumetric light · Evolving cloud banks", "air"),
- ("smoke", "09", "Smoke & steam", "Rising plumes · Light through suspended density", "air"),
- ("ice", "10", "Frozen water", "Transmitted light · Frost and trapped detail", "water"),
- ("waterfall", "11", "The falling sheet", "Accelerating flow · Spray and impact foam", "water"),
- ("rain_shelter", "12", "Shelter from rain", "Rainfall · Wet surfaces and reflected light", "weather"),
- ("workshop", "13", "The material workshop", "Worked surfaces · Light and weathering", "materials"),
- ("campfire", "14", "Fire in the clearing", "Campfire and bonfire · Char, embers and rising smoke", "flame"),
- ("structural_fire", "15", "Fire through a structure", "Window and roof flames · Opaque-depth intersections", "flame"),
- ("external_shader", "16", "Light on alloy", "External GLSL · An animated material study", "shader study"),
- ("night", "17", "The moonlit coast", "Connected cloud volumes · Moonlight over open water", "night"),
-)
-
-
-def write_source_tree(root: Path, files: dict[str, bytes]) -> None:
- """Replace generated source only, removing obsolete staged modules as well."""
- if root.exists():
- shutil.rmtree(root)
- root.mkdir(parents=True)
- for relative, data in files.items():
- path = root / relative
- path.parent.mkdir(parents=True, exist_ok=True)
- path.write_bytes(data)
-
-
-def stage(out: Path, selected: list[str]) -> list[dict]:
- unknown = set(selected) - {case[0] for case in CASES}
- if unknown:
- raise ValueError(f"Unknown showcase cases: {', '.join(sorted(unknown))}")
- library_files = {p.name: p.read_bytes() for p in sorted(LIB.glob("*.js"))}
- if not library_files:
- raise FileNotFoundError(f"Showcase library missing or empty: {LIB}")
- shader_root = HERE / "shaders"
- shader_files = {p.relative_to(shader_root).as_posix(): p.read_bytes()
- for p in sorted(shader_root.rglob("*"))
- if p.is_file() and p.suffix in SHADER_SUFFIXES}
- cases, sources = [], {}
- for key, number, title, subtitle, kind in CASES:
- source = HERE / "scenes" / f"{key}.js"
- if not source.is_file():
- raise FileNotFoundError(f"Showcase scene missing: {source}")
- sources[key] = source.read_bytes()
- cases.append({"id": key, "number": number, "title": title, "subtitle": subtitle,
- "kind": kind, "module": f"./src/scenes/{key}.js"})
- shared = {**{f"lib/{name}": data for name, data in library_files.items()},
- **{f"shaders/{name}": data for name, data in shader_files.items()}}
- write_source_tree(out / "src", {**shared, **{f"scenes/{key}.js": data for key, data in sources.items()}})
- for case in cases:
- key = case["id"]
- write_source_tree(out / "cases" / key / "src", {
- **shared, f"scenes/{key}.js": sources[key],
- "scene.js": f"export {{createScene}} from './scenes/{key}.js';\n".encode(),
- })
- for name in ("index.html", "viewer.js", "viewer.css"):
- (out / name).write_bytes((HERE / name).read_bytes())
- (out / "manifest.json").write_text(json.dumps({"cases": cases}, indent=2, ensure_ascii=False))
- return [case for case in cases if not selected or case["id"] in selected]
-
-
-def overview(out: Path) -> None:
- """A contact sheet of the available studies, using actual rendered frames."""
- from PIL import Image, ImageDraw, ImageFont
-
- studies = [case for case in CASES if (out / f"{case[0]}.png").is_file()]
- if not studies:
- return
- rows = (len(studies) + 2) // 3
- sheet = Image.new("RGB", (1920, rows * 404), (17, 22, 25))
- draw = ImageDraw.Draw(sheet)
- try:
- font = ImageFont.truetype("DejaVuSans.ttf", 24)
- except OSError:
- font = ImageFont.load_default()
- for i, (key, number, title, _, _) in enumerate(studies):
- x, y = (i % 3) * 640, (i // 3) * 404
- with Image.open(out / f"{key}.png") as frame:
- sheet.paste(frame.convert("RGB").resize((640, 360), Image.Resampling.LANCZOS), (x, y))
- draw.text((x + 14, y + 370), f"{number} {title}", font=font, fill=(230, 235, 228))
- sheet.save(out / "overview.jpg", quality=94)
-
-
-def main() -> None:
- parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument("--out", type=Path, default=HERE / "output")
- parser.add_argument("--case", action="append", choices=[c[0] for c in CASES], default=[])
- parser.add_argument("--render", action="store_true")
- parser.add_argument("--video", action="store_true")
- parser.add_argument("--width", type=int, default=1280)
- parser.add_argument("--height", type=int, default=720)
- parser.add_argument("--seconds", type=float, default=6)
- parser.add_argument("--fps", type=int, default=24)
- args = parser.parse_args()
- out = args.out.resolve()
- try:
- cases = stage(out, args.case)
- except (ValueError, FileNotFoundError) as exc:
- parser.error(str(exc))
- ffmpeg = None
- if args.video:
- ffmpeg = shutil.which("ffmpeg")
- if not ffmpeg:
- try:
- import imageio_ffmpeg
- ffmpeg = imageio_ffmpeg.get_ffmpeg_exe()
- except ImportError as exc:
- raise SystemExit("Video export needs ffmpeg on PATH or imageio-ffmpeg installed") from exc
- for case in cases:
- key = case["id"]
- ws = out / "cases" / key
- if args.render:
- print(f"Rendering {key}", flush=True)
- subprocess.run([
- "node", str(HARNESS / "runtime_js/render_scene.mjs"),
- "--ws", str(ws), "--out", str(out / "renders" / key),
- "--times", "0,1.5,3", "--width", str(args.width), "--height", str(args.height),
- "--fps-seconds", "0", "--no-settle", "--timeout-ms", "180000",
- ], check=True, cwd=HARNESS, timeout=200)
- views = json.loads((out / "renders" / key / "views.json").read_text())
- if views:
- shutil.copy2(out / "renders" / key / views[0]["path"], out / f"{key}.png")
- if args.video:
- print(f"Capturing {key}", flush=True)
- subprocess.run([
- "node", str(HERE / "capture.mjs"), "--ws", str(ws),
- "--out", str(out / f"{key}.mp4"), "--ffmpeg", ffmpeg,
- "--width", str(args.width), "--height", str(args.height),
- "--seconds", str(args.seconds), "--fps", str(args.fps),
- ], check=True, cwd=HARNESS, timeout=max(240, args.seconds * args.fps * 3))
- overview(out)
- print(f"Gallery: {out / 'index.html'}")
- print(f"Serve: node {HERE / 'serve.mjs'} --out {out}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/harness/examples/graphics_lab/capture.mjs b/harness/examples/graphics_lab/capture.mjs
deleted file mode 100644
index 85034934..00000000
--- a/harness/examples/graphics_lab/capture.mjs
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env node
-/** Deterministic frames from the production scene host, encoded as H.264. */
-import fs from 'node:fs';
-import path from 'node:path';
-import {spawn} from 'node:child_process';
-import {parseArgs} from 'node:util';
-import {openHost} from '../../runtime_js/lib/host_page.mjs';
-const {values:a} = parseArgs({options:{ws:{type:'string'},out:{type:'string'},
- ffmpeg:{type:'string',default:'ffmpeg'},width:{type:'string',default:'1280'},
- height:{type:'string',default:'720'},seconds:{type:'string',default:'6'},
- fps:{type:'string',default:'24'},camera:{type:'string',default:'0'}}});
-if (!a.ws || !a.out) throw new Error('--ws and --out required');
-if (!/\.mp4$/i.test(a.out)) throw new Error('--out must end in .mp4');
-const fps = Number(a.fps), count = Math.round(Number(a.seconds) * fps);
-if (!(fps>0 && fps<=60 && count>0 && count<=3600)) throw new Error('Invalid capture duration/fps');
-for (const size of [Number(a.width), Number(a.height)]) {
- if (!Number.isInteger(size) || size < 2 || size > 8192 || size % 2) {
- throw new Error('H.264 width and height must be even integers from 2 to 8192');
- }
-}
-const host = await openHost(a.ws,{width:Number(a.width),height:Number(a.height),
- gpu:'auto',post:true,settle:false,createSceneTimeoutMs:60000});
-let encoder;
-try {
- if (!host.boot.ok) throw new Error(host.boot.error);
- const camera = host.boot.cameras[Number(a.camera)];
- if (!camera) throw new Error('Camera not found');
- fs.mkdirSync(path.dirname(path.resolve(a.out)),{recursive:true});
- encoder = spawn(a.ffmpeg,['-y','-loglevel','error','-f','image2pipe','-vcodec','png',
- '-r',String(fps),'-i','-','-an','-c:v','libx264','-crf','18','-pix_fmt','yuv420p',
- '-movflags','+faststart',a.out],{stdio:['pipe','ignore','pipe']});
- let stderr=''; encoder.stderr.on('data',b=>{stderr=(stderr+b).slice(-4000);});
- let encoderError;
- encoder.on('error', error => { encoderError = error; });
- encoder.stdin.on('error', error => { encoderError = error; });
- const done = new Promise(resolve => encoder.once('close', resolve));
- const timings=[];
- for (let i=0;i<count;i++) {
- const frame=await host.page.evaluate((spec,t)=>window.__c3v.renderAt(spec,t),camera,i/fps);
- timings.push(frame.ms);
- const png=Buffer.from(frame.dataUrl.split(',')[1],'base64');
- if (encoderError) throw encoderError;
- await new Promise((resolve, reject) => {
- encoder.stdin.write(png, error => error ? reject(error) : resolve());
- });
- }
- encoder.stdin.end();
- const code=await done;
- if (encoderError) throw encoderError;
- if (code!==0) throw new Error(`ffmpeg exited ${code}: ${stderr}`);
- if (host.errors.console.length || host.errors.page.length || host.errors.shader_console.length) {
- throw new Error(JSON.stringify(host.errors));
- }
- const summary={ok:true,frames:count,fps,seconds:count/fps,camera:camera.name,
- gpu:host.gpu,renderer:host.boot.renderer,width:Number(a.width),height:Number(a.height),
- console_errors:host.errors.console,shader_errors:host.errors.shader_console,
- render_ms_mean:timings.reduce((s,t)=>s+t,0)/count};
- fs.writeFileSync(a.out.replace(/\.mp4$/i,'.capture.json'),JSON.stringify(summary,null,2));
- console.log(JSON.stringify(summary));
-} finally {
- if (encoder && encoder.exitCode===null) encoder.kill();
- await host.close();
-}
diff --git a/harness/examples/graphics_lab/index.html b/harness/examples/graphics_lab/index.html
deleted file mode 100644
index 35a5888b..00000000
--- a/harness/examples/graphics_lab/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!doctype html>
-<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
-<title>Graphics Lab · Material & Motion</title><link rel="stylesheet" href="./viewer.css">
-<script type="importmap">{"imports":{"three":"/__runtime/node_modules/three/build/three.module.js","three/addons/":"/__runtime/node_modules/three/examples/jsm/"}}</script>
-</head><body>
-<header><a class="brand" href="./">3D CODEVERSE <span>/ GRAPHICS LAB</span></a><span class="edition">MATERIAL & MOTION</span></header>
-<main><section class="intro"><p class="eyebrow">NATURE, MATERIALS & ATMOSPHERE</p><h1>Light. Form. Motion.</h1>
-<p>Fire, water, stone, living vegetation and changing weather. Explore library studies, from cloud banks and waterfalls to intimate material details. Watch the films or step inside each scene.</p></section>
-<section id="gallery" aria-label="Scene gallery"></section>
-<section id="stage" hidden><div class="stage-heading"><div><p class="eyebrow" id="category"></p><h2 id="title"></h2><p id="subtitle"></p></div>
-<button id="close" class="quiet">Back to gallery ↗</button></div>
-<div id="screen"><video id="video" controls loop playsinline></video><div id="live" hidden><canvas id="canvas"></canvas></div><p id="status" role="status"></p></div>
-<div class="toolbar"><div class="tabs"><button id="watch" class="active">Watch film</button><button id="explore">Explore live</button></div>
-<div class="live-controls" hidden><button id="pause">Pause</button><label>Camera <select id="camera"></select></label>
-<label>Time <input id="time" type="range" min="0" max="20" step=".02" value="0"></label><output id="seconds">0.00 s</output></div>
-<a id="still" href="#" target="_blank">Open still ↗</a></div>
-<p id="hint">Films are rendered frame by frame from scene code. In live mode, drag to orbit and scroll to zoom.</p></section>
-</main><footer><span>THREE.JS · LOCAL RENDERING</span><span>Procedural scenes. Every frame comes from code.</span></footer>
-<script type="module" src="./viewer.js"></script></body></html>
diff --git a/harness/examples/graphics_lab/scenes/campfire.js b/harness/examples/graphics_lab/scenes/campfire.js
deleted file mode 100644
index 51a5fd19..00000000
--- a/harness/examples/graphics_lab/scenes/campfire.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/** Two fuel-bed scales: a campfire and open bonfire in a wooded clearing. */
-import * as THREE from 'three';
-import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
-import { makeFireField } from '../lib/firefield.js';
-import { makeRock } from '../lib/rock.js';
-import { makeTree } from '../lib/tree.js';
-import { makeMeadow } from '../lib/meadow.js';
-import { patchStandard } from '../lib/shader.js';
-import { patchMicroBreakup } from '../lib/surface_wear.js';
-import { attachDisposal, snapshotResources } from '../lib/lifecycle.js';
-import { fbm2, mulberry32 } from '../lib/noise.js';
-
-const smooth = THREE.MathUtils.smoothstep;
-
-export function createScene() {
- const scene = new THREE.Scene();
- scene.background = new THREE.Color(0x202d35);
- scene.fog = new THREE.FogExp2(0x202d35, .044);
- scene.add(new THREE.HemisphereLight(0x9cb3c3, 0x241a11, .65));
- const moon = new THREE.DirectionalLight(0xaabdc9, 1.15);
- moon.position.set(-7, 12, -5); moon.castShadow = true;
- moon.shadow.mapSize.set(2048, 2048); moon.shadow.normalBias = .009;
- Object.assign(moon.shadow.camera, {left:-14, right:17, top:14, bottom:-14, far:38});
- scene.add(moon);
- const actors = [], random = mulberry32(341);
- const ownEffect = object => { actors.push(object); return object; };
- const groundHeight = (x, z) => fbm2(x * .22, z * .22, {seed:43, octaves:3}) * .23
- * smooth(Math.hypot(x, z), 1.2, 3.0) * smooth(Math.hypot(x-8, z+1), 2.8, 4.5);
- const groundMat = new THREE.MeshStandardMaterial({color:0x51483b, roughness:.98});
- patchStandard(groundMat, {name:'CampSoil',
- vertexHead:'varying vec3 vCampEarth;',
- vertexBody:'vCampEarth=(modelMatrix*vec4(transformed,1.0)).xyz;',
- fragmentHead:'varying vec3 vCampEarth;',
- fragmentBody:`
- float campSoil=astraFbm2(vCampEarth.xz*13.0,4);
- float campBed=min(length(vCampEarth.xz),length(vCampEarth.xz-vec2(8.0,-1.0))/2.6);
- float campAsh=(1.0-smoothstep(.40,.73,campBed))
- *smoothstep(.24,.73,astraFbm2(vCampEarth.xz*31.0,3));
- diffuseColor.rgb*=.63+campSoil*.60;
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.14,.13,.115),campAsh*.68);
- `});
- patchMicroBreakup(groundMat, {scale:.055, strength:.14, seed:41});
- const groundGeometry = new THREE.PlaneGeometry(150, 150, 220, 220);
- groundGeometry.rotateX(-Math.PI/2);
- const gp = groundGeometry.attributes.position;
- for(let i=0; i<gp.count; i++) gp.setY(i,groundHeight(gp.getX(i),gp.getZ(i)));
- groundGeometry.computeVertexNormals();
- const ground = new THREE.Mesh(groundGeometry, groundMat);
- ground.name='ForestClearing'; ground.receiveShadow=true; scene.add(ground);
- const grass=ownEffect(makeMeadow({size:[34,28], ground:false, density:360,
- height:.12, bladeWidth:.006, maxBlades:135000, dry:.43, seed:31,
- heightAt:groundHeight, shadows:false,
- mask:(x,z)=>smooth(Math.hypot(x,z),1.04,2.0)*smooth(Math.hypot(x-8,z+1),2.65,3.7),
- wind:{dir:[1,.3],strength:.24,speed:.8/1.2}}));scene.add(grass);
- const grove=[[-9,-6],[-9.6,-10],[-.7,-10],[3.7,-11],[9.4,-10],
- [13,-6],[-8.5,.5],[15,1.5],[-2.8,-17],[6.8,-19]];
- for(let i=0;i<grove.length;i++) {
- const tree=ownEffect(makeTree({species:i%4===0?'birch':'oak', height:7+random()*2.8,
- crownRadius:2.6+random()*.9, leafDensity:.8, maxLeaves:11000, leafSegments:4,
- seed:140+i, wind:{strength:.12,speed:.7}, shadows:false}));
- const [x,z]=grove[i];tree.position.set(x,groundHeight(x,z),z);scene.add(tree);
- }
-
- // Preserve local log coordinates when batching. Fine cracks emit between
- // dark charcoal blocks; powdery ash remains a rough reflective surface.
- const char = new THREE.MeshStandardMaterial({color:0x2c2722, roughness:.96});
- patchStandard(char,{name:'CampChar',
- vertexHead:'attribute vec3 fuelLocal; attribute float fuelEnd; varying vec3 vFuel; varying float vFuelEnd;',
- vertexBody:'vFuel=fuelLocal;vFuelEnd=fuelEnd;', fragmentHead:`
- varying vec3 vFuel; varying float vFuelEnd;
- vec3 campCharField(vec3 p) {
- float theta=atan(p.z+1e-7,p.x+1e-7);
- vec2 q=mix(vec2(theta*3.0,p.y*19.0),p.xz*43.0,step(.5,vFuelEnd));
- q+=vec2(astraNoise2(q*.44),astraNoise2(q*.39+19.0))*.85;
- vec2 cell=abs(fract(q)-.5);
- float crack=smoothstep(.445,.495,max(cell.x,cell.y));
- float ash=smoothstep(.40,.73,astraFbm2(q*.8+vec2(2.0,11.0),3));
- float heat=smoothstep(.54,.75,astraFbm2(q*.71+2.7,3));
- return vec3(crack,ash,heat);
- }
- `, fragmentBody:`
- vec3 charField=campCharField(vFuel);
- diffuseColor.rgb*=.52+.42*astraNoise2(vec2(atan(vFuel.z+1e-7,vFuel.x+1e-7)*42.0,vFuel.y*4.0));
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.19,.175,.16),charField.y*.67);
- diffuseColor.rgb*=1.0-charField.x*.70;
- `, normalBody:`
- float charRelief=(1.0-campCharField(vFuel).x)*.00075;
- vec3 charDx=dFdx(-vViewPosition),charDy=dFdy(-vViewPosition);
- vec3 charR1=cross(charDy,normal),charR2=cross(normal,charDx);
- float charDet=dot(charDx,charR1);
- normal=normalize(normal-sign(charDet)*(dFdx(charRelief)*charR1+dFdy(charRelief)*charR2)
- /max(abs(charDet),1e-9));
- `, outputBody:`
- vec3 charEmission=campCharField(vFuel);
- gl_FragColor.rgb+=vec3(.32,.017,.0005)*charEmission.x*charEmission.z*(1.0-charEmission.y*.7);
- `});
- const coalMaterial=new THREE.MeshStandardMaterial({color:0x201e1b, roughness:.98});
- patchStandard(coalMaterial,{name:'CampCoals',
- vertexHead:'attribute float coalHeat; varying float vCoalHeat; varying vec3 vCoalLocal;',
- vertexBody:'vCoalHeat=coalHeat;vCoalLocal=position;',
- fragmentHead:'varying float vCoalHeat; varying vec3 vCoalLocal;',
- fragmentBody:`
- float coalAsh=smoothstep(.34,.67,astraNoise2(vCoalLocal.xz*5.0+vCoalHeat*21.0));
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.12,.115,.10),coalAsh*.7);
- `, outputBody:`
- float coalLine=1.0-smoothstep(.025,.11,abs(astraFbm2(vCoalLocal.xy*7.0,3)-.49));
- gl_FragColor.rgb+=vec3(.95,.032,.0008)*coalLine*vCoalHeat*vCoalHeat;
- `});
-
- function fuelBed(x,z,scale,seed) {
- const group=new THREE.Group();group.name='CharredFuelBed';group.position.set(x,0,z);scene.add(group);
- const rand=mulberry32(seed), parts=[], transform=new THREE.Matrix4();
- const position=new THREE.Vector3(), rotation=new THREE.Quaternion(), euler=new THREE.Euler();
- for(let i=0;i<12;i++) {
- const angle=i/12*Math.PI*2+.09*rand();
- const rock=ownEffect(makeRock({type:'granite', seed:seed+i,
- size:[(.25+rand()*.10)*scale,(.18+rand()*.06)*scale,(.22+rand()*.10)*scale],
- detail:4, weathering:1.7, color:0x625f57, moisture:.2, burial:.045}));
- rock.position.set(Math.cos(angle)*.72*scale,0,Math.sin(angle)*.72*scale);
- rock.rotation.y=rand()*Math.PI*2;group.add(rock);
- }
- for(let i=0;i<8;i++) {
- const geometry=new THREE.CylinderGeometry((.045+rand()*.021)*scale,
- (.065+rand()*.021)*scale,(.70+rand()*.24)*scale,20,16);
- const p=geometry.attributes.position;
- for(let j=0;j<p.count;j++) {
- const irregular=1+.06*Math.sin(p.getY(j)*29/scale+i)+.035*Math.sin(p.getY(j)*61/scale+p.getX(j)*17/scale);
- const endWear=Math.sign(p.getY(j))*.010*scale
- *Math.sin(p.getX(j)*91/scale+i)*Math.cos(p.getZ(j)*76/scale-i);
- p.setXYZ(j,p.getX(j)*irregular,p.getY(j)+endWear,p.getZ(j)*irregular);
- }
- geometry.computeVertexNormals();
- const normals=geometry.attributes.normal;
- geometry.setAttribute('fuelEnd',new THREE.Float32BufferAttribute(
- Array.from({length:p.count},(_,j)=>Math.abs(normals.getY(j))),1));
- const local=p.clone();for(let j=0;j<local.count;j++)local.setXYZ(j,local.getX(j)/scale,local.getY(j)/scale,local.getZ(j)/scale);
- geometry.setAttribute('fuelLocal',local);
- euler.set(Math.PI*.5+(rand()-.5)*.31,0,i*1.93);
- rotation.setFromEuler(euler);
- position.set((rand()-.5)*.25*scale,(.10+i*.018)*scale,(rand()-.5)*.25*scale);
- geometry.applyMatrix4(transform.compose(position,rotation,new THREE.Vector3(1,1,1)));parts.push(geometry);
- }
- const logs=new THREE.Mesh(mergeGeometries(parts),char);parts.forEach(p=>p.dispose());
- logs.name='PartlyConsumedLogs';logs.castShadow=logs.receiveShadow=true;group.add(logs);
- const count=210,coalGeometry=new THREE.DodecahedronGeometry(1,1),heat=new Float32Array(count);
- const coals=new THREE.InstancedMesh(coalGeometry,coalMaterial,count);coals.name='AshAndCoal';
- for(let i=0;i<count;i++) {
- const angle=rand()*Math.PI*2,r=Math.sqrt(rand())*.46*scale,s=(.007+rand()*.021)*scale;
- position.set(Math.cos(angle)*r,.35*s+.003*scale,Math.sin(angle)*r);
- rotation.setFromEuler(euler.set(rand(),rand(),rand()));
- transform.compose(position,rotation,new THREE.Vector3(s,s*.34,s*.8));coals.setMatrixAt(i,transform);
- heat[i]=.1+Math.pow(rand(),1.8)*.9;
- }
- coalGeometry.setAttribute('coalHeat',new THREE.InstancedBufferAttribute(heat,1));
- coals.receiveShadow=true;coals.computeBoundingSphere();group.add(coals);
- return group;
- }
- const fuel=fuelBed(0,0,1,7),bigFuel=fuelBed(8,-1,2.6,29);
- const fire=ownEffect(makeFireField({name:'CampsiteFire',seed:51,quality:'high',wind:[.06,.035],intensity:.8,
- emitters:[{position:[-.23,.10,.08],radius:.18,height:.73},{position:[.20,.14,-.02],radius:.20,height:1.05},
- {position:[-.04,.16,-.22],radius:.18,height:.90},{position:[.09,.10,.23],radius:.17,height:.65}],
- smoke:{height:3.6,density:.6,albedo:0x685f54},embers:{count:42,size:[.001,.0045],lifetime:[1.5,3]},
- lighting:{count:2,intensity:2.6},occluders:[fuel,ground],depthResolution:768}));scene.add(fire);
- const bonfire=ownEffect(makeFireField({name:'OpenBonfire',seed:79,quality:'high',wind:[.23,.08],intensity:.8,
- emitters:[{position:[-.54,.22,.1],radius:.52,height:2.3},{position:[.42,.24,.12],radius:.48,height:2.8},
- {position:[.03,.30,-.53],radius:.44,height:2.5},{position:[.14,.18,.53],radius:.47,height:1.9}],
- smoke:{height:8,density:.48,albedo:0x504a43},embers:{count:120,size:[.002,.009],lifetime:[2,5]},
- lighting:{count:3,intensity:14},occluders:[bigFuel,ground],depthResolution:768}));
- bonfire.position.set(8,0,-1);scene.add(bonfire);
-
- const resources=snapshotResources(scene);
- for(const actor of actors) {
- for(const resource of snapshotResources(actor))resources.delete(resource);
- resources.add({dispose:()=>actor.userData.dispose()});
- }
- resources.add({dispose:()=>moon.shadow.dispose()});attachDisposal(scene,resources);
- return {scene,cameras:[
- {name:'campfire',position:[1.9,1.25,2.7],lookAt:[0,.69,0],fov:42},
- {name:'embers_and_char',position:[.85,.58,1.22],lookAt:[0,.34,0],fov:44},
- {name:'open_bonfire',position:[12.9,3.4,5.7],lookAt:[8,2,-1],fov:43},
- ],update(t,dt){actors.forEach(actor=>actor.userData.update(t,dt));},dispose(){scene.userData.dispose();}};
-}
diff --git a/harness/examples/graphics_lab/scenes/cloud_volume.js b/harness/examples/graphics_lab/scenes/cloud_volume.js
deleted file mode 100644
index a29b0d5f..00000000
--- a/harness/examples/graphics_lab/scenes/cloud_volume.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/** Mountain lake under a drifting, self-shadowed cumulus field. */
-import * as THREE from 'three';
-import { makeCloudVolume } from '../lib/cloudvolume.js';
-import { makeOcean } from '../lib/water.js';
-import { makeRock } from '../lib/rock.js';
-import { makeMeadow } from '../lib/meadow.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { fbm2 } from '../lib/noise.js';
-
-export const BOUNDS = { min: [-90, -5, -120], max: [90, 35, 90] };
-export function heightAt(x, z) {
- const bank = .095 * z + .015 * x;
- return -3 + Math.max(0, bank) + fbm2(x * .07, z * .07, { seed: 27 }) * 2;
-}
-
-export function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({ mood: 'day', azimuth: -135, elevation: 32, bounds: 70, disc: false });
- scene.add(rig.sun, rig.fill);
- scene.environment = rig.envTex;
- scene.fog = new THREE.FogExp2(0xb2cad8, .00075);
- makeSky(scene, { rig, turbidity: 2.3, rayleigh: 1.45, scale: 8000 });
-
- const cloudOptions = [
- { size: [980, 660, 750], position: [-220, 700, -1900], seed: 29, coverage: .64 },
- { size: [1200, 520, 680], position: [900, 560, -2900], seed: 54, coverage: .61 },
- { size: [1300, 390, 680], position: [-1450, 540, -3200], seed: 87, coverage: .66 },
- ];
- const clouds = cloudOptions.map(({ position, ...options }) => {
- const cloud = makeCloudVolume({
- ...options, density: .07, quality: 'high', wind: [8, 1.3],
- sunDirection: rig.sunDir, sunColor: 0xfff7ea,
- skyColor: 0xacbfd8, sunIntensity: 1.55,
- });
- cloud.position.fromArray(position);
- scene.add(cloud);
- return cloud;
- });
-
- const lake = makeOcean(6000, 6000, {
- sunDir: rig.sunDir, waterColor: 0x153d44, distortionScale: .45,
- glitter: .3, rttSize: 1024, size: .65,
- });
- scene.add(lake);
-
- // Two staggered ridges supply a distance reference for the cloud scale.
- for (let layer = 0; layer < 2; layer++) {
- const geometry = new THREE.PlaneGeometry(4200, 850, 128, 40);
- geometry.rotateX(-Math.PI / 2);
- const position = geometry.attributes.position;
- for (let i = 0; i < position.count; i++) {
- const x = position.getX(i), z = position.getZ(i);
- const spine = Math.exp(-Math.pow((z + 80) / 270, 2));
- const ridge = 130 + 180 * fbm2(x * .0015, layer * 10, { seed: 13 + layer })
- + 70 * Math.sin(x * .0028 + layer * 2.1);
- position.setY(i, Math.max(-8, ridge * spine
- + fbm2(x * .011, z * .011, { seed: 11 + layer, octaves: 4 }) * 60));
- }
- geometry.computeVertexNormals();
- const ridge = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({
- color: layer ? 0x566661 : 0x4e6155, roughness: .96,
- }));
- ridge.position.set(layer * 180, -6, -1150 - layer * 620);
- ridge.receiveShadow = true;
- scene.add(ridge);
- }
-
- const bankGeometry = new THREE.PlaneGeometry(180, 150, 90, 75);
- bankGeometry.rotateX(-Math.PI / 2);
- const bankPosition = bankGeometry.attributes.position;
- for (let i = 0; i < bankPosition.count; i++) {
- bankPosition.setY(i, heightAt(bankPosition.getX(i), bankPosition.getZ(i)));
- }
- bankGeometry.computeVertexNormals();
- const bank = new THREE.Mesh(bankGeometry, new THREE.MeshStandardMaterial({ color: 0x4d5140, roughness: .98 }));
- bank.receiveShadow = true;
- scene.add(bank);
- const grass = makeMeadow({
- size: [160, 130], density: 8, maxBlades: 70000, height: .34,
- seed: 63, color: 0x596b35, dry: .15, ground: false,
- heightAt, mask: (x, z) => THREE.MathUtils.smoothstep(heightAt(x, z), .4, 2),
- wind: { dir: [1, .2], strength: .9, speed: 1 / 1.2 },
- });
- scene.add(grass);
- for (let i = 0; i < 17; i++) {
- const x = -48 + i * 5.4;
- const z = 26 + Math.sin(i * 1.7) * 3;
- const rock = makeRock({
- seed: 90 + i, type: 'granite', size: [3.1 + i % 3, 1.8 + i % 2, 2.3 + i % 3],
- color: 0x767970, moisture: .75, moss: .12, burial: .16,
- });
- rock.position.set(x, heightAt(x, z) - .4, z);
- rock.rotation.y = i * .87;
- scene.add(rock);
- }
- return {
- scene,
- cameras: [
- { name: 'lake', position: [24, 8.5, 60], lookAt: [-75, 165, -950], fov: 53 },
- { name: 'clouds', position: [-200, 220, -600], lookAt: [-220, 670, -1900], fov: 46 },
- { name: 'inside', position: [-220, 650, -1820], lookAt: [200, 700, -1920], fov: 64 },
- ],
- update(t, dt) {
- clouds.forEach((cloud) => cloud.userData.update(t));
- lake.userData.update(t);
- grass.userData.update(t, dt);
- },
- };
-}
diff --git a/harness/examples/graphics_lab/scenes/external_shader.js b/harness/examples/graphics_lab/scenes/external_shader.js
deleted file mode 100644
index c9595c85..00000000
--- a/harness/examples/graphics_lab/scenes/external_shader.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * External shader files: a controlled alloy-material sculpture study.
- * The animated colour phase is artistic, not a thermal or optical simulation.
- * Scene creation awaits all local files; update only changes cached uniforms.
- */
-import * as THREE from 'three';
-import { attachDisposal, snapshotResources } from '../lib/lifecycle.js';
-
-export async function createScene({ loaders }) {
- const text = new THREE.FileLoader(loaders.manager);
- const [vertexShader, fragmentSource, commonSource] = await Promise.all([
- text.loadAsync(new URL('../shaders/external_shader.vert', import.meta.url).href),
- text.loadAsync(new URL('../shaders/external_shader.frag', import.meta.url).href),
- text.loadAsync(new URL('../shaders/external_shader_common.glsl', import.meta.url).href),
- ]);
- const scene = new THREE.Scene();
- scene.name = 'ChromaticAlloyStudy';
- scene.background = new THREE.Color(0x252c33);
- const group = new THREE.Group();
- group.name = 'AlloyExhibit';
- scene.add(group);
-
- const hemisphere = new THREE.HemisphereLight(0xcbdcf0, 0x5a493b, 1.8);
- const key = new THREE.DirectionalLight(0xffdfb0, 1.8);
- key.position.set(-3, 4, 3);
- key.castShadow = true;
- key.shadow.mapSize.set(1024, 1024);
- key.shadow.camera.left = -5;
- key.shadow.camera.right = 5;
- key.shadow.camera.top = 5;
- key.shadow.camera.bottom = -5;
- key.shadow.camera.near = 0.1;
- key.shadow.camera.far = 20;
- key.shadow.normalBias = 0.018;
- key.shadow.radius = 12;
- const fill = new THREE.DirectionalLight(0x9bc8ff, 0.7);
- fill.position.set(4, 2, -3);
- scene.add(hemisphere, key, fill);
-
- const studioMaterial = new THREE.MeshStandardMaterial({ color: 0x33383c, roughness: 0.78 });
- const floor = new THREE.Mesh(new THREE.CircleGeometry(8, 192), studioMaterial);
- floor.name = 'StudioFloor';
- floor.rotation.x = -Math.PI / 2;
- floor.receiveShadow = true;
- group.add(floor);
-
- // A continuous circular cyclorama avoids a clipped floor/background horizon.
- // Its inward normals join the floor smoothly and work from every fixed camera.
- const positions = [], normals = [], indices = [];
- const radialSegments = 32, aroundSegments = 192;
- for (let ring = 0; ring <= radialSegments + 1; ring++) {
- const angle = Math.min(ring, radialSegments) / radialSegments * Math.PI / 2;
- const radius = 8 + 4 * Math.sin(angle);
- const y = ring > radialSegments ? 16 : 4 * (1 - Math.cos(angle));
- for (let column = 0; column <= aroundSegments; column++) {
- const azimuth = column / aroundSegments * Math.PI * 2;
- const x = Math.sin(azimuth), z = Math.cos(azimuth);
- positions.push(x * radius, y, z * radius);
- normals.push(-x * Math.sin(angle), Math.cos(angle), -z * Math.sin(angle));
- if (ring < radialSegments + 1 && column < aroundSegments) {
- const a = ring * (aroundSegments + 1) + column;
- const b = a + aroundSegments + 1;
- indices.push(a, b, a + 1, a + 1, b, b + 1);
- }
- }
- }
- const coveGeometry = new THREE.BufferGeometry();
- coveGeometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
- coveGeometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3));
- coveGeometry.setIndex(indices);
- const cove = new THREE.Mesh(coveGeometry, studioMaterial);
- cove.name = 'StudioCyclorama';
- cove.receiveShadow = true;
- group.add(cove);
- const plinth = new THREE.Mesh(new THREE.CylinderGeometry(1.62, 1.66, 0.25, 128),
- new THREE.MeshStandardMaterial({ color: 0x282e34, roughness: 0.58, metalness: 0.08 }));
- plinth.name = 'ExhibitPlinth';
- plinth.position.y = 0.125;
- plinth.castShadow = plinth.receiveShadow = true;
- group.add(plinth);
- const edge = new THREE.Mesh(new THREE.TorusGeometry(1.62, 0.009, 8, 192),
- new THREE.MeshStandardMaterial({ color: 0xa78d60, roughness: 0.28, metalness: 0.7 }));
- edge.name = 'BrassRim';
- edge.rotation.x = Math.PI / 2;
- edge.position.y = 0.235;
- group.add(edge);
-
- // The external shader uses an analytic studio environment. Its warm key and
- // blue fill share the host lights' world directions; it does not sample
- // environment maps or receive shadows from surrounding scene objects.
- const material = new THREE.ShaderMaterial({
- name: 'ExternalAnodizedAlloy',
- glslVersion: THREE.GLSL3,
- vertexShader,
- fragmentShader: `${commonSource}\n${fragmentSource}`,
- uniforms: {
- uTime: { value: 0 },
- uRoughness: { value: 0.39 },
- uFilmStrength: { value: 0.42 },
- uBaseReflectance: { value: new THREE.Color(0.50, 0.52, 0.56) },
- },
- fog: false,
- });
- const sculpture = new THREE.Mesh(new THREE.TorusKnotGeometry(0.84, 0.255, 320, 64, 2, 3), material);
- sculpture.name = 'ChromaticFold';
- sculpture.rotation.set(0.25, 0.22, -0.22);
- sculpture.geometry.computeBoundingBox();
- sculpture.position.y = 1.57;
- sculpture.castShadow = true;
- group.add(sculpture);
- const stem = new THREE.Mesh(new THREE.CylinderGeometry(0.045, 0.055, 0.54, 32),
- new THREE.MeshStandardMaterial({ color: 0x272a2e, metalness: 0.75, roughness: 0.32 }));
- stem.name = 'SculptureMount';
- stem.position.y = 0.52;
- stem.castShadow = true;
- group.add(stem);
-
- const resources = snapshotResources(group);
- resources.add({ dispose() { key.shadow.dispose(); } });
- attachDisposal(group, resources);
- return {
- scene,
- cameras: [
- { name: 'alloy', position: [4.5, 3.05, 5.8], lookAt: [0, 1.35, 0], fov: 37 },
- { name: 'surface', position: [2.05, 1.95, 3.05], lookAt: [0, 1.55, 0], fov: 34 },
- { name: 'profile', position: [-4.5, 2.25, 3.7], lookAt: [0, 1.38, 0], fov: 37 },
- ],
- update(t) {
- material.uniforms.uTime.value = t;
- sculpture.rotation.y = 0.22 + 0.18 * Math.sin(t * 0.4);
- },
- dispose() { group.userData.dispose(); },
- };
-}
diff --git a/harness/examples/graphics_lab/scenes/fire.js b/harness/examples/graphics_lab/scenes/fire.js
deleted file mode 100644
index 197fdf0e..00000000
--- a/harness/examples/graphics_lab/scenes/fire.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/** Candlelit still life + a wood hearth. No image textures or external assets. */
-import * as THREE from 'three';
-import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
-import { makeFire, makeCandle } from '../lib/fire.js';
-import { patchStandard } from '../lib/shader.js';
-import { mulberry32 } from '../lib/noise.js';
-
-export function createScene({ renderer }) {
- const scene = new THREE.Scene();
- scene.background = new THREE.Color(0x080b10);
- scene.fog = new THREE.FogExp2(0x080b10, 0.025);
- const pmrem = new THREE.PMREMGenerator(renderer), room = new RoomEnvironment();
- const envTarget = pmrem.fromScene(room, 0.04);
- scene.environment = envTarget.texture; scene.environmentIntensity = 0.12;
- pmrem.dispose(); room.dispose();
- scene.add(new THREE.HemisphereLight(0x607b99, 0x1b120d, 0.35));
- const moon = new THREE.DirectionalLight(0x9bbbd6, 1.4);
- moon.position.set(-3, 4, -1); scene.add(moon);
-
- const stone = new THREE.MeshStandardMaterial({ color: 0x434443, roughness: 0.96 });
- patchStandard(stone, { name: 'LabFireStone', vertexHead: 'varying vec3 vStone;',
- vertexBody: 'vStone = (modelMatrix * vec4(position, 1.0)).xyz;',
- fragmentHead: 'varying vec3 vStone;', fragmentBody: `
- float n = astraFbm2(vStone.xy * 23.0 + vStone.z * 0.17, 4) * 0.5
- + astraFbm2(vStone.xz * 31.0, 3) * 0.5;
- diffuseColor.rgb *= 0.55 + n * 1.2;
- ` });
- const floor = new THREE.Mesh(new THREE.PlaneGeometry(20, 20), stone);
- floor.name = 'SlateFloor'; floor.rotation.x = -Math.PI / 2; floor.receiveShadow = true; scene.add(floor);
- const wall = new THREE.Mesh(new THREE.BoxGeometry(24, 6, 0.3), stone);
- wall.name = 'StoneWall'; wall.position.set(0, 2, -2.3); scene.add(wall);
-
- const oak = new THREE.MeshStandardMaterial({ color: 0x654026, roughness: 0.7 });
- patchStandard(oak, { name: 'LabFireOak', vertexHead: 'varying vec3 vOak;',
- vertexBody: 'vOak = (modelMatrix * vec4(position, 1.0)).xyz;',
- fragmentHead: 'varying vec3 vOak;', fragmentBody: `
- float warp = astraNoise2(vOak.xz * vec2(1.8, 9.0)) * 0.007;
- float ring = sin((vOak.z + warp) * 850.0 + astraNoise2(vOak.xz * 14.0) * 5.0);
- float fine = astraNoise2(vOak.xz * vec2(65.0, 1200.0));
- diffuseColor.rgb *= 0.70 + ring * 0.11 + fine * 0.38;
- ` });
- const table = new THREE.Group(); table.name = 'CandleTable';
- for (let i = 0; i < 5; i++) {
- const plank = new THREE.Mesh(new THREE.BoxGeometry(1.18, 0.075, 0.182), oak);
- plank.name = `OakPlank_${i}`; plank.position.set(0.03 * Math.sin(i), 0.77, (i - 2) * 0.185);
- plank.castShadow = true; plank.receiveShadow = true; table.add(plank);
- }
- for (const x of [-0.43, 0.43]) for (const z of [-0.32, 0.32]) {
- const leg = new THREE.Mesh(new THREE.BoxGeometry(0.085, 0.74, 0.085), oak);
- leg.name = 'TableLeg'; leg.position.set(x, 0.37, z); table.add(leg);
- }
- scene.add(table);
- const brass = new THREE.MeshStandardMaterial({ color: 0x9c793a, metalness: 0.87, roughness: 0.32 });
- const actors = [];
- const candleSpecs = [[-0.12, -0.025, 0.075, 0.30, 15], [0.10, 0.08, 0.055, 0.185, 8], [-0.02, -0.20, 0.053, 0.225, 2]];
- for (const [x, z, radius, height, seed] of candleSpecs) {
- const tray = new THREE.Mesh(new THREE.CylinderGeometry(radius * 1.45, radius * 1.38, 0.012, 64), brass);
- tray.name = 'BrassCandleSaucer'; tray.position.set(x, 0.814, z); tray.receiveShadow = true; scene.add(tray);
- const rim = new THREE.Mesh(new THREE.TorusGeometry(radius * 1.40, 0.0045, 8, 64), brass);
- rim.name = 'SaucerRolledEdge'; rim.rotation.x = Math.PI / 2; rim.position.set(x, 0.824, z); scene.add(rim);
- const candle = makeCandle({ radius, height, seed, drips: 10, flameHeight: 0.071,
- color: 0xe6d2a8, lightIntensity: 0.035, quality: 'high' });
- candle.position.set(x, 0.821, z); scene.add(candle); actors.push(candle);
- }
- // A used brass wick trimmer and matches anchor the scale of the still life.
- for (const x of [0.29, 0.34]) {
- const ring = new THREE.Mesh(new THREE.TorusGeometry(0.025, 0.003, 8, 32), brass);
- ring.name = 'WickTrimmerHandle'; ring.rotation.x = Math.PI / 2;
- ring.position.set(x, 0.815, 0.14); scene.add(ring);
- const shaft = new THREE.Mesh(new THREE.BoxGeometry(0.007, 0.006, 0.115), brass);
- shaft.name = 'WickTrimmerArm'; shaft.rotation.y = x < 0.3 ? -0.22 : 0.22;
- shaft.position.set(x + (x < 0.3 ? 0.01 : -0.01), 0.815, 0.055); scene.add(shaft);
- }
-
- const hearth = new THREE.Group(); hearth.name = 'WoodHearth'; hearth.position.set(-4.0, 0.04, -0.9);
- const random = mulberry32(49);
- for (let i = 0; i < 13; i++) {
- const angle = i / 13 * Math.PI * 2;
- const rock = new THREE.Mesh(new THREE.DodecahedronGeometry(0.15 + random() * 0.045, 1), stone);
- rock.name = `HearthStone_${i}`;
- rock.scale.set(1.25, 0.72, 1); rock.rotation.set(random(), random(), random());
- rock.position.set(Math.cos(angle) * 0.58, 0.075, Math.sin(angle) * 0.58);
- rock.castShadow = true; rock.receiveShadow = true; hearth.add(rock);
- }
- const char = new THREE.MeshStandardMaterial({ color: 0x231710, roughness: 0.97, emissive: 0x160200 });
- patchStandard(char, { name: 'LabCharcoal', vertexHead: 'varying vec3 vChar;',
- vertexBody: 'vChar = position;', fragmentHead: 'varying vec3 vChar;',
- fragmentBody: `
- float grain = astraNoise2(vChar.xy * vec2(80.0, 13.0));
- diffuseColor.rgb *= 0.5 + grain;
- `,
- outputBody: `
- float angle = atan(vChar.z, vChar.x);
- vec2 cell = vec2(angle * 3.9, vChar.y * 24.0);
- cell += vec2(astraNoise2(cell * 0.7), astraNoise2(cell * 0.81 + 12.7)) * 0.5;
- vec2 edge = abs(fract(cell) - 0.5);
- float cracks = smoothstep(0.456, 0.49, max(edge.x, edge.y));
- float live = astraNoise2(vChar.xy * 27.0);
- gl_FragColor.rgb += vec3(0.45, 0.035, 0.001) * cracks * smoothstep(0.33, 0.77, live);
- ` });
- for (let i = 0; i < 7; i++) {
- const log = new THREE.Mesh(new THREE.CylinderGeometry(0.055, 0.08, 0.83, 13, 7), char);
- const lp = log.geometry.attributes.position;
- for(let j=0;j<lp.count;j++) {
- const s = 1 + 0.11*Math.sin(lp.getY(j)*21 + i) + 0.06*Math.cos(lp.getX(j)*87 + lp.getY(j)*45);
- lp.setXYZ(j, lp.getX(j)*s, lp.getY(j), lp.getZ(j)*s);
- }
- log.geometry.computeVertexNormals();
- log.name = `CharredLog_${i}`; log.rotation.set(Math.PI / 2 + (random() - 0.5) * 0.45, 0, i * 1.79);
- log.position.set((random() - 0.5) * 0.22, 0.10 + i * 0.022, (random() - 0.5) * 0.22);
- log.castShadow = true; log.receiveShadow = true; hearth.add(log);
- }
- const coals = new THREE.MeshStandardMaterial({ color: 0x180a04, roughness: 1, emissive: 0xf33102, emissiveIntensity: 0.75 });
- for (let i = 0; i < 25; i++) {
- const coal = new THREE.Mesh(new THREE.DodecahedronGeometry(0.028 + random() * 0.025, 0), coals);
- coal.name = `Coal_${i}`; coal.position.set((random() - 0.5) * 0.65, 0.026, (random() - 0.5) * 0.65);
- coal.scale.y = 0.6; hearth.add(coal);
- }
- const fire = makeFire({ radius: 0.28, height: 0.85, seed: 27, quality: 'high',
- lightIntensity: 2.5, embers: 32, wind: [0.055, 0.02] });
- fire.position.y = 0.15; hearth.add(fire); scene.add(hearth); actors.push(fire);
- const cameras = [
- { name: 'candle_macro', position: [0.49, 1.22, 0.71], lookAt: [-0.01, 0.995, -0.025], fov: 37 },
- { name: 'hearth', position: [-2.78, 1.22, 1.0], lookAt: [-4.0, 0.54, -0.9], fov: 37 },
- ];
- return { scene, cameras, update(t, dt) { actors.forEach((a) => a.userData.update(t, dt)); } };
-}
diff --git a/harness/examples/graphics_lab/scenes/ice.js b/harness/examples/graphics_lab/scenes/ice.js
deleted file mode 100644
index 92d7cafa..00000000
--- a/harness/examples/graphics_lab/scenes/ice.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/** Winter thaw: fractured lake ice, trapped air and a snow-covered rocky shore. */
-import * as THREE from 'three';
-import { makeFracturedIce } from '../lib/ice.js';
-import { makeWaterNormals } from '../lib/water.js';
-import { makeRock } from '../lib/rock.js';
-import { patchSnow } from '../lib/accumulation.js';
-import { patchMicroBreakup } from '../lib/surface_wear.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { fbm2, mulberry32 } from '../lib/noise.js';
-import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
-
-const smooth = (a, b, value) => {
- const t = Math.max(0, Math.min(1, (value - a) / (b - a)));
- return t * t * (3 - 2 * t);
-};
-
-export function createScene() {
- const scene = new THREE.Scene(), owned = [], rocks = [], rand = mulberry32(314);
- const rig = sunRig({ mood: 'overcast', elevation: 27, azimuth: -128, bounds: 35,
- intensity: 2.2, fill: 1.7, disc: false });
- rig.sun.shadow.mapSize.set(4096, 4096); rig.sun.shadow.normalBias = 0.015;
- scene.add(rig.sun, rig.fill); scene.environment = rig.envTex;
- makeSky(scene, { rig, turbidity: 2.2, rayleigh: 1.4 });
- scene.fog = new THREE.FogExp2(0xcbd7dd, 0.009);
- const floorHeight = (x, z) => {
- const angle=Math.atan2(z+0.3,x);
- const r = Math.hypot(x / 5.6, (z + 0.3) / 4.6)
- + Math.sin(angle*5+.4)*.027 + fbm2(x*.9,z*.9,{seed:119,octaves:2})*.055;
- return -0.69 + smooth(0.82, 1.2, r) * 1.15
- + fbm2(x * 0.45, z * 0.45, { seed: 34, octaves: 3 }) * 0.17
- + smooth(10, 46, -z) * (2.6 + fbm2(x * 0.022, z * 0.034, {seed:18,octaves:4}) * 11);
- };
- const groundGeometry = new THREE.PlaneGeometry(180, 180, 320, 320);
- groundGeometry.rotateX(-Math.PI / 2);
- const p = groundGeometry.attributes.position, colors = [], color = new THREE.Color();
- const mud = new THREE.Color(0x28312e), snow = new THREE.Color(0xbac8d0);
- for (let i = 0; i < p.count; i++) {
- // Spend vertices at the pond contact rather than on distant snow.
- const focus=value=>Math.sign(value)*90*Math.pow(Math.abs(value)/90,1.65);
- const x = focus(p.getX(i)), z = focus(p.getZ(i)), h = floorHeight(x, z);
- p.setX(i,x);p.setZ(i,z);
- p.setY(i, h); color.copy(mud).lerp(snow, smooth(-0.4, 0.14, h));
- colors.push(color.r, color.g, color.b);
- }
- groundGeometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
- groundGeometry.computeVertexNormals();
- const groundMaterial = new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.91 });
- patchMicroBreakup(groundMaterial, { scale: 0.11, strength: 0.12, hue: 0.018, seed: 31 });
- const ground = new THREE.Mesh(groundGeometry, groundMaterial);
- ground.name = 'SnowAndLakebed'; ground.receiveShadow = true; scene.add(ground);
- owned.push(groundGeometry, groundMaterial);
-
- const ice = makeFracturedIce({
- outline: [[-4.7,-1.2],[-3.3,-3.4],[-0.2,-4.0],[2.5,-3.5],[4.4,-1.5],
- [4.6,1.0],[3.1,2.8],[0.5,3.6],[-2.5,3.0],[-4.4,1.3]].map(([x,z])=>[x*1.3,z*1.3]),
- thickness: 0.24, crackDensity: 0.42, gap: 0.009, heave: 0.012,
- frost: 0.26, bubbles: 0.85, chipping: 0.18, seed: 73, attenuationDistance: 1.3,
- });
- scene.add(ice);
- // Water occupies only the open fissures and the narrow exposed perimeter.
- // It sits just below the ice freeboard, while the clear volume retains a
- // view of the lakebed and trapped air through its own transmission pass.
- const rim = Array.from({length:96},(_,i)=>{
- const angle=i/96*Math.PI*2;return [Math.cos(angle)*7,Math.sin(angle)*6-0.3];
- });
- const waterShape = new THREE.Shape(rim.map(([x,z]) => new THREE.Vector2(x,-z)));
- for (const polygon of ice.userData.floeOutlines) {
- waterShape.holes.push(new THREE.Path(polygon.map(([x,z]) => new THREE.Vector2(x,-z))));
- }
- const waterGeometry = new THREE.ShapeGeometry(waterShape);
- waterGeometry.rotateX(-Math.PI/2);
- const waterNormals = makeWaterNormals(256, {broadband:true});
- waterNormals.repeat.set(0.3,0.3);
- const waterMaterial = new THREE.MeshStandardMaterial({color:0x0a2025,roughness:0.19,metalness:0,
- normalMap:waterNormals,normalScale:new THREE.Vector2(0.09,0.09)});
- const water = new THREE.Mesh(waterGeometry, waterMaterial); water.position.y = -0.027;
- water.name = 'WaterBetweenFloes'; scene.add(water); owned.push(waterGeometry,waterMaterial,waterNormals);
- const addRock = (x, z, s, seed, snowy = true) => {
- const rock = makeRock({ type: 'granite', seed, size: [s * 1.3, s * 0.7, s],
- detail: s > 1 ? 7 : 3, color: 0x606664, moisture: 0.65, weathering: 1.0, burial: 0.1 });
- rock.position.set(x, floorHeight(x, z), z); rock.rotation.y = rand() * Math.PI;
- if (snowy) patchSnow(rock.material, { depth: 0.06, color: 0xc0cbd0, seed: seed + 13 });
- scene.add(rock); rocks.push(rock); return rock;
- };
- addRock(-4.6, -1.9, 2.2, 304); addRock(4.1, -2.4, 1.8, 32);
- addRock(-3.2, -3.8, 1.45, 102); addRock(0.4, -4.7, 1.0, 59);
- addRock(3.0, 3.15, 0.8, 930); addRock(-3.3, 2.65, 0.7, 12);
- // The bed remains visible through clear portions, making refraction and
- // trapped air depth observable rather than relying on a blue color alone.
- for (let i = 0; i < 65; i++) {
- const a = rand() * Math.PI * 2, r = Math.sqrt(rand()) * 4;
- const x = Math.cos(a) * r, z = Math.sin(a) * r * 0.78;
- addRock(x, z, 0.06 + rand() * 0.22, 2000 + i, false);
- }
- for (let i = 0; i < 22; i++) {
- const a = rand() * Math.PI * 2, r = 5.4 + rand() * 2.5;
- addRock(Math.cos(a) * r, Math.sin(a) * r * 0.86,
- 0.18 + rand() * 0.56, 700 + i);
- }
- // Broken pressure slabs expose a thick edge beside the main sheet.
- const slab = makeFracturedIce({ outline: [[-1.0,-0.5],[-0.1,-0.85],[0.85,-0.42],
- [1.03,0.3],[0.3,0.76],[-0.85,0.48]], thickness: 0.23, crackDensity: 0,
- gap: 0, frost: 0.42, bubbles: 0.8, chipping: 1, seed: 49, attenuationDistance: 0.85 });
- slab.position.set(-2.0, 0.16, 2.8); slab.rotation.set(-0.06, 0.42, -0.15);
- scene.add(slab);
- // A lower floe makes the pressure ridge's support visible. Seat the
- // raised slab on it using actual transformed vertices and local height.
- const support=makeFracturedIce({outline:[[-.9,-.55],[.35,-.8],[.95,-.05],
- [.6,.62],[-.55,.72]],thickness:.16,crackDensity:0,gap:0,
- frost:.82,bubbles:.35,chipping:.7,seed:59});
- support.position.set(-2.7,.055,3.12);scene.add(support);
- slab.updateMatrixWorld(true);
- const sp=slab.getObjectByName('IceVolume').geometry.attributes.position;
- const contact=new THREE.Vector3();let lift=-Infinity;
- for(let i=0;i<sp.count;i++){
- contact.fromBufferAttribute(sp,i).applyMatrix4(slab.matrixWorld);
- const height=support.userData.sampleHeight(contact.x-support.position.x,contact.z-support.position.z);
- if(height!==null)lift=Math.max(lift,height+support.position.y-contact.y);
- const sheet=ice.userData.sampleHeight(contact.x,contact.z);
- if(sheet!==null)lift=Math.max(lift,sheet-contact.y);
- }
- if(Number.isFinite(lift))slab.position.y+=lift+.001;
-
- // Sparse dead reeds break the shoreline silhouette without obscuring ice.
- const reedParts = [];
- for (let i = 0; i < 65; i++) {
- const x = -5.0 + rand() * 1.2, z = -2 + rand() * 5;
- const y = floorHeight(x, z), h = 0.36 + rand() * 0.62;
- const curve = new THREE.QuadraticBezierCurve3(new THREE.Vector3(x,y,z),
- new THREE.Vector3(x + 0.04,y+h*0.55,z), new THREE.Vector3(x+0.12,y+h,z+0.04));
- reedParts.push(new THREE.TubeGeometry(curve, 5, 0.004, 3, false));
- }
- const reedGeometry = mergeGeometries(reedParts); reedParts.forEach(g => g.dispose());
- const reedMaterial = new THREE.MeshStandardMaterial({ color: 0x6a5740, roughness: 0.85 });
- const reeds = new THREE.Mesh(reedGeometry, reedMaterial); reeds.name = 'WinterReeds';
- reeds.castShadow = true; scene.add(reeds); owned.push(reedGeometry, reedMaterial);
-
- // A distant broken ridge provides reflected shape and a winter horizon.
- for (let i = 0; i < 9; i++) {
- const rock = makeRock({ type: 'granite', seed: 803 + i,
- size: [8 + rand()*6, 3 + rand()*3, 8], detail: 4, color: 0x7c8588 });
- const x=-65+i*16,z=-63-rand()*16;
- rock.position.set(x,floorHeight(x,z)-1.8,z);
- patchSnow(rock.material, { depth: 0.1, color: 0xc6d2d8, seed: i + 81 });
- scene.add(rock); rocks.push(rock);
- }
- scene.userData.grade = { exposure: 0.94, contrast: 1.04, saturation: 0.92 };
- return { scene, cameras: [
- { name: 'frozen_shore', position: [6.9, 3.2, 7.7], lookAt: [-0.3, 0.1, -0.5], fov: 48 },
- { name: 'clear_ice', position: [1.8, 1.1, 3.2], lookAt: [0.15, -0.07, 0.65], fov: 48 },
- { name: 'fracture_edge', position: [-0.2, 0.64, 5.0], lookAt: [-1.9, 0.08, 2.6], fov: 42 },
- ], update(t, dt) { ice.userData.update(t, dt); slab.userData.update(t, dt);support.userData.update(t,dt);
- waterNormals.offset.set(t*0.008,t*0.004); },
- dispose() { ice.userData.dispose(); slab.userData.dispose();support.userData.dispose();rocks.forEach(r => r.userData.dispose());
- owned.forEach(r => r.dispose()); rig.envTex.dispose(); } };
-}
diff --git a/harness/examples/graphics_lab/scenes/meadow.js b/harness/examples/graphics_lab/scenes/meadow.js
deleted file mode 100644
index 768d6392..00000000
--- a/harness/examples/graphics_lab/scenes/meadow.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/** Wind crossing a lush upland meadow, with close leaf geometry and far slopes. */
-import * as THREE from 'three';
-import { makeMeadow } from '../lib/meadow.js';
-import { makeRock } from '../lib/rock.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { patchStandard } from '../lib/shader.js';
-
-export function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({mood:'day', azimuth:125, elevation:31, bounds:9,
- intensity:4.3, fill:1.3});
- scene.add(rig.sun, rig.sun.target, rig.fill);
- rig.sun.shadow.mapSize.set(4096,4096);
- rig.sun.shadow.normalBias=.0015;
- rig.sun.shadow.radius=2.2;
- scene.environment=rig.envTex;
- makeSky(scene,{rig});
- scene.fog=new THREE.FogExp2(0xc0c6b2,.019);
- scene.userData.grade={contrast:1.03,saturation:.93,warmth:.01};
- const heightAt=(x,z)=>.12*Math.sin(x*.45)+.09*Math.cos(z*.48)
- +.16*Math.sin(z*.19+x*.17) + 2.2*Math.exp(-Math.pow((z+14)/8,2));
- const wind={dir:[1,.4],strength:.92,speed:1.15/1.2};
- const field=makeMeadow({size:[14,14],density:1650,maxBlades:145000,segments:4,
- height:.32,bladeWidth:.012,seed:41,dry:.065,heightAt,
- color:0x537e2c,wind});
- scene.add(field);
- const distant=makeMeadow({size:[24,8],density:250,maxBlades:48000,segments:3,
- height:.42,bladeWidth:.037,seed:114,dry:.065,ground:true,
- heightAt:(x,z)=>heightAt(x,z-11),
- mask:(x,z)=>Math.abs(x)<7 && Math.abs(z-11)<7 ? 0:1,
- color:0x537e2c,wind});
- distant.position.z=-11;scene.add(distant);
-
- // Rooted stones show leaf-scale occlusion and anchor the field's depth.
- for(const [x,z,s,seed] of [[-1.15,-.4,.9,19],[1.7,-3.8,.72,91],[-3.4,-4.1,.54,44]]) {
- const rock=makeRock({size:[s,s*.62,s*.85],type:'granite',seed,moss:.4,detail:4});
- rock.position.set(x,heightAt(x,z)-.05,z);rock.rotation.y=seed*.47;scene.add(rock);
- }
-
- const ground=new THREE.PlaneGeometry(260,260,110,110);ground.rotateX(-Math.PI/2);
- const p=ground.attributes.position;
- for(let i=0;i<p.count;i++) {
- const x=p.getX(i),z=p.getZ(i);
- // The real near soil belongs to the meadow; broad hills stay beneath it.
- const far=THREE.MathUtils.smoothstep(Math.hypot(x,z),28,55);
- p.setY(i,heightAt(x,z)+far*(1.6+1.6*Math.sin(x*.065+z*.028)));
- }
- ground.computeVertexNormals();
- const soil=new THREE.MeshStandardMaterial({color:0x293e18,roughness:1});
- patchStandard(soil,{name:'LabMeadowHills',vertexHead:'varying vec3 vHill;',
- vertexBody:'vHill = transformed;',fragmentHead:'varying vec3 vHill;',
- fragmentBody:`
- if(abs(vHill.x)<6.95 && abs(vHill.z)<6.95) discard;
- if(abs(vHill.x)<11.95 && vHill.z< -7.05 && vHill.z> -14.95) discard;
- float field = astraFbm2(vHill.xz*.55,3);
- diffuseColor.rgb *= .79+field*.5;`});
- const earth=new THREE.Mesh(ground,soil);earth.name='DistantMeadow';
- earth.receiveShadow=true;scene.add(earth);
- const cameras=[
- {name:'meadow',position:[1.3,1.3,4.3],lookAt:[.8,.40,-1],fov:36},
- {name:'blades',position:[.60,.76,2.8],lookAt:[.4,.18,1.0],fov:36},
- ];
- return {scene,cameras,update(t,dt){field.userData.update(t,dt);distant.userData.update(t,dt);}};
-}
diff --git a/harness/examples/graphics_lab/scenes/night.js b/harness/examples/graphics_lab/scenes/night.js
deleted file mode 100644
index 81c9f43a..00000000
--- a/harness/examples/graphics_lab/scenes/night.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/** Moonlight over a basalt headland and a quiet, open sea. */
-import * as THREE from 'three';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { makeClouds } from '../lib/clouds.js';
-import { makeStars } from '../lib/celestial.js';
-import { makeOceanSurface } from '../lib/ocean.js';
-import { makeRock } from '../lib/rock.js';
-import { fbm2, mulberry32 } from '../lib/noise.js';
-
-export const BOUNDS = { min: [-500, -8, -780], max: [140, 55, 220] };
-
-function shoreX(z) {
- return 8 + z * 0.18 + 5 * Math.sin(z * 0.016)
- - 12 * Math.exp(-(((z + 50) / 50) ** 2));
-}
-
-export function heightAt(x, z) {
- const inland = shoreX(z) - x;
- const coastalSlope = THREE.MathUtils.smoothstep(inland, -7, 28);
- const hills = 12 + 24 * Math.exp(-(((z + 230) / 150) ** 2))
- + 33 * Math.exp(-(((z + 570) / 170) ** 2));
- const rockRelief = fbm2(x * 0.055, z * 0.055, { seed: 53, octaves: 4 });
- return -3.2 + 7.4 * coastalSlope
- + hills * THREE.MathUtils.smoothstep(inland, 10, 150)
- + rockRelief * 3.1 * coastalSlope;
-}
-
-export function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({
- mood: 'night', azimuth: -72, elevation: 21, bounds: 95,
- intensity: 0.55, fill: 0.36, fillSky: 0x8293ab, fillGround: 0x121823,
- radius: 4000, disc: true,
- });
- // The general rig has a readability floor; this exposure calls for a
- // dimmer sky fill so moonlit faces separate from sheltered basalt.
- rig.fill.intensity = 0.36;
- scene.add(rig.sun, rig.fill, rig.sunDisc);
- scene.environment = rig.envTex;
- scene.environmentIntensity = 0.55;
- const sky = makeSky(scene, { rig, turbidity: 2.7, scale: 4500 });
- scene.fog = new THREE.FogExp2(0x253143, 0.00065);
- scene.userData.grade = { exposure: 0.95, contrast: 1.015, saturation: 0.78 };
-
- const stars = makeStars({
- seed: 18, count: 650, magnitude: 0.34, twinkle: 0.1, milkyWay: false,
- });
- scene.add(stars);
- const clouds = makeClouds({
- preset: 'night', seed: 19, count: 14, area: 2400, altitude: 190, spread: 70,
- sunDir: rig.lightDir, alpha: 0.6, wind: 1.5, rim: 0.22, haze: 0.14, quality: 'high',
- });
- clouds.rotation.y = 0.65;
- scene.add(clouds);
-
- const ocean = makeOceanSurface({
- seed: 83, width: 2400, depth: 2400, segments: 320,
- waveHeight: 0.32, wavelength: 22, windDirection: [0.35, 1],
- choppiness: 0.5, foam: 0.06, reflectionSize: 1024,
- waterColor: 0x081b23, shallowColor: 0x183339, sunDir: rig.lightDir,
- });
- scene.add(ocean);
-
- // A continuous coast extends beneath the water. Height and dressing share
- // one field, keeping the foreshore attached even between large outcrops.
- const terrainGeometry = new THREE.PlaneGeometry(650, 1000, 180, 240);
- terrainGeometry.rotateX(-Math.PI / 2);
- terrainGeometry.translate(-190, 0, -280);
- const positions = terrainGeometry.attributes.position;
- const colors = new Float32Array(positions.count * 3);
- const base = new THREE.Color(0x55534d), color = new THREE.Color();
- for (let i = 0; i < positions.count; i++) {
- const x = positions.getX(i), z = positions.getZ(i);
- positions.setY(i, heightAt(x, z));
- const variation = fbm2(x * 0.035, z * 0.035, { seed: 117, octaves: 3 });
- color.copy(base).multiplyScalar(0.88 + variation * 0.46).toArray(colors, i * 3);
- }
- terrainGeometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
- terrainGeometry.computeVertexNormals();
- const terrainMaterial = new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.94 });
- const terrain = new THREE.Mesh(terrainGeometry, terrainMaterial);
- terrain.name = 'CoastalHeadland';
- terrain.castShadow = terrain.receiveShadow = true;
- scene.add(terrain);
-
- const rocks = [], rng = mulberry32(271);
- const addRock = (x, z, size, seed) => {
- const rock = makeRock({
- type: 'basalt', seed, size, detail: 5, color: 0x555b60,
- moisture: 0.65, weathering: 1.2, moss: 0.02, burial: 0.13,
- });
- rock.position.set(x, heightAt(x, z) - 0.22, z);
- rock.rotation.y = rng() * Math.PI * 2;
- scene.add(rock); rocks.push(rock);
- };
- addRock(-7, 12, [13, 4.6, 12], 72);
- addRock(2, 23, [10, 3.2, 9], 18);
- addRock(-8, -5, [8, 3.8, 10], 84);
- addRock(-23, -32, [11, 5.8, 14], 46);
- for (let i = 0; i < 22; i++) {
- const z = -46 + rng() * 83, x = shoreX(z) - 1 - rng() * 16;
- const size = 0.7 + rng() ** 2 * 3.3;
- addRock(x, z, [size * 1.5, size * 0.62, size], 401 + i);
- }
-
- let disposed = false;
- return {
- scene,
- cameras: [
- { name: 'moonlit_coast', position: [8, 4.8, 23], lookAt: [0, 22, -115], fov: 46 },
- { name: 'waterline', position: [11, 2.2, 4], lookAt: [5, 17, -120], fov: 43 },
- ],
- update(t, dt) {
- stars.userData.update(t); clouds.userData.update(t); ocean.userData.update(t, dt);
- },
- dispose() {
- if (disposed) return;
- disposed = true;
- for (const object of [stars, clouds, ocean, ...rocks]) object.userData.dispose();
- terrainGeometry.dispose(); terrainMaterial.dispose(); sky.dispose(); rig.dispose();
- },
- };
-}
diff --git a/harness/examples/graphics_lab/scenes/ocean.js b/harness/examples/graphics_lab/scenes/ocean.js
deleted file mode 100644
index 52ce181c..00000000
--- a/harness/examples/graphics_lab/scenes/ocean.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/** Atlantic cove: displaced water and fracture-plane basalt in late afternoon. */
-import * as THREE from 'three';
-import { makeOceanSurface } from '../lib/ocean.js';
-import { makeRock } from '../lib/rock.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-export const BOUNDS = { min: [-110, -4, -110], max: [110, 14, 90] };
-export function heightAt() {
- return -3;
-}
-export async function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({
- mood: 'golden',
- azimuth: -120,
- elevation: 16,
- bounds: 42,
- intensity: 4.1,
- fill: 1.25,
- disc: false,
- });
- scene.add(rig.sun, rig.fill);
- scene.environment = rig.envTex;
- makeSky(scene, { rig, turbidity: 3.4, rayleigh: 1.6, scale: 3500 });
- scene.fog = new THREE.FogExp2(0xbec8c7, 0.0022);
- const ocean = makeOceanSurface({
- width: 1800,
- depth: 1800,
- segments: 384,
- waveHeight: 1.65,
- wavelength: 31,
- windDirection: [0.35, 1],
- choppiness: 1,
- foam: 0.9,
- seed: 83,
- reflectionSize: 1024,
- waterColor: 0x07353e,
- shallowColor: 0x278779,
- shoreline: { direction: [0, -1], position: -22, width: 5 },
- });
- scene.add(ocean);
- const rocks = [
- [-13, -0.7, 13, 8, 4.5, 8],
- [15, -1.2, 8, 8, 5.3, 8],
- [21, -1.8, -3, 7, 4.8, 6],
- [-21, -1.6, -8, 12, 8, 11],
- [-26, -2, -14, 8, 11, 8],
- [-18, -1.3, 22, 7, 3.4, 7],
- [20, -1, 22, 10, 4, 9],
- [-8, -1, 25, 5, 2, 5],
- ];
- for (let i = 0; i < rocks.length; i++) {
- const [x, y, z, w, h, d] = rocks[i];
- const rock = makeRock({
- type: 'basalt',
- seed: 91 + i,
- size: [w, h, d],
- detail: 5,
- moisture: 0.75,
- weathering: 1.15,
- moss: 0.08,
- });
- rock.position.set(x, y, z);
- rock.rotation.y = i * 0.77;
- scene.add(rock);
- }
- // The beach actually intersects the mean sea level; swash remains on its wet edge.
- const g = new THREE.PlaneGeometry(220, 90, 80, 35);
- g.rotateX(-Math.PI / 2);
- const p = g.attributes.position;
- for (let i = 0; i < p.count; i++) {
- const x = p.getX(i),
- z = p.getZ(i) + 52;
- p.setXYZ(i, x, (z - 22) * 0.115 + Math.sin(x * 0.14) * 0.16, z);
- }
- g.computeVertexNormals();
- const beach = new THREE.Mesh(
- g,
- new THREE.MeshStandardMaterial({ color: 0x85775d, roughness: 0.94 })
- );
- beach.name = 'WetBeach';
- beach.receiveShadow = true;
- scene.add(beach);
- return {
- scene,
- cameras: [
- { name: 'ocean', position: [5, 3.8, 21], lookAt: [-2, 0.2, -11], fov: 51 },
- { name: 'wave_detail', position: [7, 2.0, 8], lookAt: [-4, 0.1, -9], fov: 44 },
- ],
- update(t, dt) {
- ocean.userData.update(t, dt);
- },
- };
-}
diff --git a/harness/examples/graphics_lab/scenes/rain_shelter.js b/harness/examples/graphics_lab/scenes/rain_shelter.js
deleted file mode 100644
index 2e2861be..00000000
--- a/harness/examples/graphics_lab/scenes/rain_shelter.js
+++ /dev/null
@@ -1,174 +0,0 @@
-/** Rain on a woodland shelter: covered timber, wet gravel and reflected trees. */
-import * as THREE from 'three';
-import { makeRain, makeSplashes, wetten } from '../lib/rain.js';
-import { makeRock } from '../lib/rock.js';
-import { makeTree, makeShrub } from '../lib/tree.js';
-import { makeMeadow } from '../lib/meadow.js';
-import { sunRig } from '../lib/environment.js';
-import { makeMirrorFloor } from '../lib/wetground.js';
-import { patchTriplanar } from '../lib/terrain_shade.js';
-import { weatheredWood } from '../lib/materials.js';
-import { mergeStatic } from '../lib/merge.js';
-import { mulberry32, fbm2 } from '../lib/noise.js';
-
-const smooth=(a,b,value)=>THREE.MathUtils.smoothstep(value,a,b);
-export const BOUNDS = { min: [-38, -.5, -38], max: [38, 15, 38] };
-export function heightAt(x,z) {
- const clearing=Math.hypot(x/10.0,(z+1)/11.8);
- return -.018+smooth(.61,1.14,clearing)*(.16+Math.abs(fbm2(x*.18,z*.18,{seed:101}))*1.8)
- +smooth(1.1,2.8,clearing)*(.48+.25*Math.sin(x*.2+z*.11));
-}
-
-export function createScene() {
- const scene=new THREE.Scene(),owned=new Set(),effects=[],rand=mulberry32(35);
- const own=value=>{owned.add(value);return value;};
- const effect=value=>{effects.push(value);scene.add(value);return value;};
- const rig=sunRig({mood:'overcast',intensity:1.35,fill:1.55,bounds:23,disc:false,
- azimuth:135,elevation:46});
- rig.sun.shadow.mapSize.set(2048,2048);rig.sun.shadow.normalBias=.012;
- scene.add(rig.sun,rig.fill);scene.environment=rig.envTex;
- scene.background=new THREE.Color(0x88979d);scene.fog=new THREE.FogExp2(0x88979d,.018);
-
- const groundGeometry=own(new THREE.PlaneGeometry(76,76,100,100));groundGeometry.rotateX(-Math.PI/2);
- const p=groundGeometry.attributes.position;
- for(let i=0;i<p.count;i++)p.setY(i,heightAt(p.getX(i),p.getZ(i)));
- groundGeometry.computeVertexNormals();
- const soil=own(new THREE.MeshStandardMaterial({color:0x464b39,roughness:.95}));
- patchTriplanar(soil,{scale:.11,relief:.0015,roughness:.93,colorA:0x242923,colorB:0x58604a});
- const ground=new THREE.Mesh(groundGeometry,soil);ground.name='RaisedForestFloor';ground.receiveShadow=true;
- scene.add(ground);
- const wetFloor=effect(makeMirrorFloor(32,36,{seed:7,rttSize:1024,color:0x727979,
- overlayColor:0x554f42,overlayOpacity:.84,puddleMask:true,ripple:.10,rippleScale:10,detail:1}));
- wetFloor.name='RainFilledClearing';
-
- const timber=new THREE.Group(),roofParts=new THREE.Group();
- timber.name='ShelterCarpentry';roofParts.name='PitchedSheetRoof';
- const wood=weatheredWood({color:0x79654d,roughness:.91,bump:.0008,scale:5,contrast:.20,seed:24});
- const roofMaterial=own(new THREE.MeshStandardMaterial({color:0x4b5149,roughness:.69,metalness:.14}));
- wetten(roofMaterial,.65,{minRoughness:.25,darken:.22});
- let part=0;
- const box=(name,size,position,material=wood,rotation=[0,0,0],parent=timber)=>{
- const geometry=new THREE.BoxGeometry(...size),pos=geometry.attributes.position,uv=geometry.attributes.uv;
- if(material===wood){
- // Growth grain follows the long axis of each board in metric units.
- const along=size.indexOf(Math.max(...size)),across=(along+1)%3;
- for(let i=0;i<uv.count;i++)uv.setXY(i,pos.getComponent(i,across)*.45+part*.117,
- pos.getComponent(i,along)*.32+part*.173);
- }
- const mesh=new THREE.Mesh(geometry,material);mesh.name=name;mesh.position.set(...position);mesh.rotation.set(...rotation);
- mesh.castShadow=mesh.receiveShadow=true;parent.add(mesh);part++;return mesh;
- };
- const beam=(name,a,b,width,depth=width)=>{
- const from=new THREE.Vector3(...a),to=new THREE.Vector3(...b),direction=to.clone().sub(from);
- const mesh=box(name,[width,direction.length(),depth],from.add(to).multiplyScalar(.5).toArray());
- mesh.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),direction.normalize());return mesh;
- };
- for(let plank=0;plank<25;plank++)box('DeckBoard',[.277,.065,6.8],[-3.456+plank*.288,.104,0]);
- for(const x of [-3.5,3.5])for(const z of [-3.4,3.4]){
- box('Upright',[.24,3.68,.24],[x,1.84,z]);
- for(const sign of [-1,1])if(Math.abs(x+sign*.90)<3.6)
- beam('KneeBrace',[x,2.77,z],[x+sign*.90,3.56,z],.13);
- beam('LongBrace',[x,2.91,z],[x,3.54,z-Math.sign(z)*.82],.13);
- }
- for(const z of [-3.4,3.4])box('CrossBeam',[7.3,.26,.25],[0,3.60,z]);
- for(const x of [-3.5,3.5])box('LongBeam',[.22,.22,7.1],[x,3.52,0]);
- box('RidgeBeam',[.17,.22,8.12],[0,4.39,0]);
- for(const z of [-3.85,-2.3,-.76,.76,2.3,3.85])for(const side of [-1,1])
- beam('RoofRafter',[0,4.36,z],[side*4.1,3.45,z],.10,.18);
- for(const side of [-1,1]){
- box('RoofPanel',[4.3,.055,8.4],[side*2.06,4.0,0],roofMaterial,[0,0,-side*.22],roofParts);
- for(let k=-5;k<=5;k++)box('StandingSeam',[4.3,.029,.035],[side*2.06,4.045,k*.78],
- roofMaterial,[0,0,-side*.22],roofParts);
- box('EaveTrim',[.075,.13,8.44],[side*4.15,3.55,0],roofMaterial,[0,0,0],roofParts);
- }
- // Bench and a small table make the roof's physical scale legible.
- for(const x of [-2.9,2.9]){
- for(let plank=0;plank<3;plank++)box('BenchSeat',[.145,.048,4.55],[x+(plank-1)*.157,.50,0]);
- for(const z of [-1.8,1.8]){
- box('BenchLeg',[.095,.40,.15],[x,.30,z]);
- box('BenchBearer',[.54,.085,.17],[x,.43,z]);
- box('BackrestUpright',[.06,.67,.08],[x+Math.sign(x)*.26,.73,z]);
- }
- for(let plank=0;plank<2;plank++)box('BenchBack',[.045,.15,4.50],[x+Math.sign(x)*.26,.81+plank*.17,0]);
- }
- for(let i=0;i<4;i++)box('TableTop',[1.5,.06,.17],[0,.86,-1.72+i*.182]);
- for(const x of [-.55,.55])for(const z of [-1.62,-1.12])box('TableLeg',[.09,.69,.09],[x,.49,z]);
- const collectParts=(parts,name)=>{
- const result=mergeStatic([parts],{variance:.05});result.name=name;
- parts.traverse(o=>o.geometry?.dispose());return effect(result);
- };
- collectParts(timber,'CoveredTimberStructure');
- const roof=collectParts(roofParts,'RainShelterRoof');
- // A soft, warm sheltered lamp contrasts with the cool wet clearing.
- const lampMaterial=own(new THREE.MeshStandardMaterial({color:0xffe4b5,emissive:0xffcb80,emissiveIntensity:2,roughness:.5}));
- const shadeMaterial=own(new THREE.MeshStandardMaterial({color:0x202826,roughness:.55,metalness:.4}));
- const bulb=new THREE.Mesh(own(new THREE.SphereGeometry(.058,16,12)),lampMaterial);bulb.position.set(0,3.47,-1.35);scene.add(bulb);
- const shade=new THREE.Mesh(own(new THREE.ConeGeometry(.24,.15,24,1,true)),shadeMaterial);
- shade.position.set(0,3.55,-1.35);shade.material.side=THREE.DoubleSide;scene.add(shade);
- const lamp=own(new THREE.PointLight(0xffd69d,13,8,2));lamp.position.copy(bulb.position);scene.add(lamp);
-
- for(let i=0;i<48;i++){
- const side=i%2?1:-1,x=side*(6.0+rand()*8),z=-13+rand()*27;
- const s=.17+Math.pow(rand(),2)*1.0;
- const rock=makeRock({seed:101+i,type:i%4?'granite':'sandstone',size:[s*1.3,s*.55,s],
- detail:4,color:0x697266,moisture:.82,moss:.30,weathering:1});
- rock.position.set(x,heightAt(x,z)-s*.12,z);rock.rotation.y=rand()*6.28;effect(rock);
- }
- effect(makeMeadow({size:[34,36],height:.27,density:720,maxBlades:240000,
- bladeWidth:.012,segments:5,seed:83,color:0x486032,dry:.14,ground:false,seedHeads:.001,
- heightAt,mask:(x,z)=>smooth(.78,1.18,Math.hypot(x/10,(z+1)/11.8))
- *(.40+.6*smooth(-.15,.16,fbm2(x*.32,z*.32,{seed:85}))),
- wind:{dir:[.65,.3],strength:.36,speed:.7/1.2}}));
- // A close strip has enough short blades to read as turf at eye level.
- // Sampling converts its local patch coordinates back to the terrain frame.
- const turf=makeMeadow({size:[16,16],height:.13,density:3000,maxBlades:300000,
- bladeWidth:.005,segments:4,seed:89,color:0x485b34,dry:.12,ground:false,seedHeads:0,
- heightAt:(x,z)=>heightAt(x+5,z+8),
- mask:(x,z)=>smooth(.83,1.08,Math.hypot((x+5)/10,(z+9)/11.8))
- *(.5+.5*smooth(-.16,.2,fbm2((x+5)*.32,(z+8)*.32,{seed:85}))),
- wind:{dir:[.65,.3],strength:.20,speed:.7/1.2}});
- turf.position.set(5,0,8);effect(turf);
- for(let i=0;i<18;i++){
- const angle=2.2+i*2.39996,r=14+rand()*16,x=Math.cos(angle)*r,z=Math.sin(angle)*r-4;
- if(z>0&&x>3)continue; // Keep the established exterior camera's sightline open.
- const species=i%4===0?'birch':i%3===0?'willow':'oak';
- const tree=makeTree({species,seed:800+i,height:6+rand()*2.5,crownRadius:2.3+rand()*1.1,
- maxLeaves:17000,leafDensity:1.1,leafSegments:4,shadows:false,wind:{dir:[.65,.3],strength:.16,speed:.7}});
- tree.position.set(x,heightAt(x,z)-.045,z);effect(tree);
- }
- for(const [x,z,h] of [[-7,-2,1.8],[7,-5,2.4],[-5,-9,1.4],[9,3,1.6],[-9,8,1.3],[4,-12,2.3]]){
- const shrub=makeShrub({seed:1010+Math.round(x*3+z),height:h,crownRadius:h*.7,
- maxLeaves:1100,leafDensity:.42,wind:{dir:[.65,.3],strength:.16,speed:.7}});
- shrub.position.set(x,heightAt(x,z)-.035,z);effect(shrub);
- }
- // Small physical gravel interrupts the wet clearing without hiding its pools.
- const gravelGeometry=own(new THREE.IcosahedronGeometry(1,1));
- const gravelMaterial=own(new THREE.MeshStandardMaterial({color:0x8d9380,roughness:.55}));
- const gravel=own(new THREE.InstancedMesh(gravelGeometry,gravelMaterial,1600));
- gravel.name='WetGravel';gravel.receiveShadow=true;
- const pebble=new THREE.Object3D(),tint=new THREE.Color();
- for(let i=0;i<gravel.count;i++){
- const angle=rand()*Math.PI*2,r=Math.sqrt(rand())*9.5;
- const x=Math.cos(angle)*r,z=Math.sin(angle)*r*1.12-1;
- const size=.007+Math.pow(rand(),2)*.028;
- const y=Math.max(.004,heightAt(x,z));
- pebble.position.set(x,y+size*.26,z);pebble.scale.set(size,size*.50,size*(.6+rand()*.5));
- pebble.rotation.set(rand(),rand()*6.28,rand());pebble.updateMatrix();gravel.setMatrixAt(i,pebble.matrix);
- tint.setHSL(.10+rand()*.08,.10+rand()*.10,.14+rand()*.11);gravel.setColorAt(i,tint);
- }
- gravel.instanceMatrix.needsUpdate=true;gravel.instanceColor.needsUpdate=true;scene.add(gravel);
- const surfaces=[roof,ground];
- // The authored terrain function avoids casting every rain-atlas ray through
- // the full terrain mesh whenever the camera moves. Roof rays remain exact.
- effect(makeRain({seed:5,count:11000,radius:24,height:22,length:.46,
- surfaces:[roof],heightAt,groundY:0,shelterResolution:48,shelterUpdateDistance:3}));
- effect(makeSplashes({seed:11,count:720,surfaces,surfaceBias:.35,
- area:{x:0,z:0,w:32,d:32},y:0,size:.13,opacity:.42}));
- // Library updates accept absolute time, including scrub and rewind.
- return {scene,cameras:[
- {name:'courtyard',position:[13,4.1,16],lookAt:[0,1.8,0],fov:51},
- {name:'sheltered',position:[.5,1.55,2.7],lookAt:[.5,1.55,-9],fov:62},
- {name:'rain_and_reflections',position:[7.5,.78,9.7],lookAt:[-.8,1.2,-1.4],fov:46},
- ],update(t,dt){for(const item of effects)item.userData.update?.(t,dt);},
- dispose(){for(const item of effects)item.userData.dispose?.();for(const item of owned)item.dispose();rig.dispose();}};
-}
diff --git a/harness/examples/graphics_lab/scenes/rocks.js b/harness/examples/graphics_lab/scenes/rocks.js
deleted file mode 100644
index 072f652c..00000000
--- a/harness/examples/graphics_lab/scenes/rocks.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import * as THREE from 'three';
-import { makeRock, makeRockField } from '../lib/rock.js';
-import { makeSandTerrain } from '../lib/sand.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { mulberry32 } from '../lib/noise.js';
-
-/** A weathered outcrop: sedimentary ledges, mineral grains and damp talus. */
-export function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({ mood: 'day', bounds: 24, azimuth: 138, elevation: 24, intensity: 5.2, fill: 0.7 });
- rig.sun.shadow.mapSize.set(4096, 4096);
- rig.sun.shadow.normalBias = 0.014;
- scene.add(rig.sun, rig.fill); scene.environment = rig.envTex;
- makeSky(scene, { rig, turbidity: 2.8 });
- scene.fog = new THREE.FogExp2(0xafbdc4, 0.007);
- const ground = makeSandTerrain({ seed: 61, size: 140, segments: 256, duneHeight: 0.30, duneSpacing: 13,
- color: 0x766c57, rippleSpacing: 0.10, detailStrength: 0.30 });
- scene.add(ground);
- const h = ground.userData.sampleHeight, rocks = [];
- const add = (opts, x, z, a = 0) => {
- const rock = makeRock(opts); rock.position.set(x, h(x, z), z); rock.rotation.y = a;
- scene.add(rock); rocks.push(rock); return rock;
- };
- add({ type: 'sandstone', seed: 19, size: [5.2, 3.8, 3.6], color: 0x947155, detail: 12, moisture: 0.15 }, -1.2, -1.6, 0.5);
- add({ type: 'sandstone', seed: 73, size: [3.0, 1.0, 2.0], color: 0x947155, detail: 10 }, -3.6, 0.1, -0.6);
- add({ type: 'granite', seed: 31, size: [2.8, 1.9, 2.3], detail: 10, moisture: 0.6, moss: 0.35 }, 2.0, 1.7, 0.3);
- add({ type: 'granite', seed: 52, size: [1.2, 0.85, 1.0], detail: 7, moisture: 0.55, moss: 0.6 }, 0.4, 3.1, 0.8);
- add({ type: 'basalt', seed: 84, size: [2.1, 1.8, 1.7], detail: 8, moisture: 0.28 }, 3.5, -2.2, 0.35);
- add({ type: 'basalt', seed: 81, size: [1.7, 0.9, 1.2], detail: 6, moisture: 0.2 }, 4.4, -1.7, 0.7);
- // Broken blocks accumulate at the parent outcrop. A second size tier and
- // smaller scree connect the hero stones to the substrate instead of leaving
- // unrelated samples evenly spaced across an empty plane.
- const rand = mulberry32(908);
- for (let i = 0; i < 23; i++) {
- const a = rand() * Math.PI * 2, r = 1.5 + rand() * 2.8;
- const x = -1.7 + Math.cos(a) * r, z = -1.1 + Math.sin(a) * r;
- if (x > 0.3 && z > 0.5) continue;
- const s = 0.42 + rand() * 1.0;
- add({ type: 'sandstone', seed: 801 + i, size: [s * 1.4, s * 0.65, s], detail: 5,
- color: 0x8b7053, weathering: 0.75, burial: 0.13 }, x, z, a);
- }
- const talus = makeRockField({ type: 'granite', seed: 35, radius: 7, count: 110, size: 0.3, detail: 2, moisture: 0.35, heightAt: h });
- scene.add(talus);
- for (let i = 0; i < 15; i++) add({ type: 'sandstone', seed: 210 + i,
- size: [9 + (i % 3) * 3, 3 + (i % 4), 8], color: 0x847b68, detail: 4, burial: 0.22 },
- -43 + i * 6, -23 - (i % 2) * 3, i * 0.7);
- scene.userData.grade = { exposure: 1, contrast: 1.04, saturation: 0.99 };
- return { scene, cameras: [
- { name: 'outcrop', position: [10.4, 5.2, 12.9], lookAt: [0.1, 1.5, -0.3], fov: 47 },
- { name: 'granite', position: [4.3, 2.8, 5.5], lookAt: [1.8, 0.8, 1.6], fov: 43 },
- { name: 'strata', position: [-4.8, 3.0, 4.0], lookAt: [-1.3, 1.8, -0.8], fov: 42 },
- ], update() {}, dispose() { ground.userData.dispose(); talus.userData.dispose(); rocks.forEach((r) => r.userData.dispose()); rig.envTex.dispose(); } };
-}
diff --git a/harness/examples/graphics_lab/scenes/sand.js b/harness/examples/graphics_lab/scenes/sand.js
deleted file mode 100644
index 408c3228..00000000
--- a/harness/examples/graphics_lab/scenes/sand.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import * as THREE from 'three';
-import { makeSandTerrain } from '../lib/sand.js';
-import { makeRock } from '../lib/rock.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-
-/** Long stoss slopes, crisp lee crests and ripples lit across the wind. */
-export function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({ mood: 'golden', bounds: 90, azimuth: 128, elevation: 16, intensity: 4.8, fill: 0.8,
- fillSky: 0x9eafd2, fillGround: 0x795333 });
- scene.add(rig.sun, rig.fill);
- scene.environment = rig.envTex;
- makeSky(scene, { rig, turbidity: 3.1 });
- scene.fog = new THREE.FogExp2(0xc9b291, 0.0038);
- const sand = makeSandTerrain({ seed: 42, size: 240, segments: 512,
- duneHeight: 7.4, duneSpacing: 37, windDirection: [0.96, 0.28],
- rippleSpacing: 0.19, color: 0xc39b68, grains: 420, windSpeed: 1.2 });
- scene.add(sand);
- const h = sand.userData.sampleHeight;
- for (const [i, p] of [[-46, -55], [-57, -58], [-49, -66], [59, -73]].entries()) {
- const rock = makeRock({ seed: 118 + i, type: 'sandstone', size: [9 + i * 1.6, 8 + i, 8], detail: 6,
- color: 0x9b7253, burial: 0.20 });
- rock.position.set(p[0], h(...p), p[1]); rock.rotation.y = i * 0.74;
- scene.add(rock);
- }
- scene.userData.grade = { exposure: 0.98, contrast: 1.04, saturation: 1.02, warmth: 0.03 };
- const cameras = [
- { name: 'dunes', position: [28, h(28, 48) + 7.0, 48], lookAt: [-8, 3.4, -22], fov: 48 },
- { name: 'ripples', position: [3, h(3, 8) + 1.3, 8], lookAt: [-2, h(-2, -1), -1], fov: 48 },
- { name: 'crest', position: [-12, h(-12, 27) + 3.1, 27], lookAt: [-35, 2.4, -27], fov: 44 },
- ];
- return { scene, cameras, update(t, dt) { sand.userData.update(t, dt); },
- dispose() { sand.userData.dispose(); scene.traverse((o) => { if (o.userData.rockType) o.userData.dispose(); }); rig.envTex.dispose(); } };
-}
diff --git a/harness/examples/graphics_lab/scenes/smoke.js b/harness/examples/graphics_lab/scenes/smoke.js
deleted file mode 100644
index 81fb6eae..00000000
--- a/harness/examples/graphics_lab/scenes/smoke.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/** Two scales of rising density: warm tea and a cooling charcoal brazier. */
-import * as THREE from 'three';
-import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
-import { makeSmoke, makeSteam } from '../lib/smoke.js';
-import { patchStandard } from '../lib/shader.js';
-import { mulberry32 } from '../lib/noise.js';
-
-export function createScene({renderer}) {
- const scene = new THREE.Scene();scene.background = new THREE.Color(0x15202b);
- const room = new RoomEnvironment(), generator = new THREE.PMREMGenerator(renderer);
- const environment = generator.fromScene(room,.03);generator.dispose();room.dispose();
- scene.environment = environment.texture;scene.environmentIntensity = .36;
- scene.add(new THREE.HemisphereLight(0xb5d4e8,0x554936,.6));
- const sun = new THREE.DirectionalLight(0xffecd2,5.6);
- sun.position.set(-1.4,2.7,-2.0);sun.castShadow = true;
- sun.shadow.mapSize.set(2048,2048);sun.shadow.camera.left = -6;sun.shadow.camera.right = 6;
- sun.shadow.camera.top = 6;sun.shadow.camera.bottom = -6;sun.shadow.normalBias = .002;
- scene.add(sun);
- const stone = new THREE.MeshStandardMaterial({color:0x262b2d,roughness:.87});
- patchStandard(stone,{name:'PlumeSlate',vertexHead:'varying vec3 vSlate;',vertexBody:'vSlate=(modelMatrix*vec4(position,1.0)).xyz;',
- fragmentHead:'varying vec3 vSlate;',fragmentBody:`
- float mottling=astraFbm2(vSlate.xz*46.0+vSlate.y*4.0,4);
- diffuseColor.rgb*=.91+mottling*.22;`,roughnessBody:'roughnessFactor=clamp(roughnessFactor+astraNoise2(vSlate.xz*110.0)*.06,0.0,1.0);'});
- const table = new THREE.Mesh(new THREE.BoxGeometry(2.4,.06,2),stone);
- table.name = 'SlateCounter';table.position.y = .72;table.receiveShadow = true;scene.add(table);
- const ceramic = new THREE.MeshPhysicalMaterial({color:0x879994,roughness:.32,clearcoat:.38,clearcoatRoughness:.23});
- patchStandard(ceramic,{name:'PlumeGlaze',vertexHead:'varying vec3 vGlaze;',vertexBody:'vGlaze=position;',
- fragmentHead:'varying vec3 vGlaze;',fragmentBody:`
- float grain=astraNoise2(vGlaze.xy*240.0+vGlaze.z*91.0);
- diffuseColor.rgb*=.96+grain*.065;`});
- const cupProfile = [[.033,0],[.039,.005],[.042,.012],[.045,.033],[.049,.071],[.051,.095],
- [.050,.10],[.047,.10],[.046,.094],[.044,.074],[.039,.03],[.035,.009],[0,.009]];
- const cup = new THREE.Mesh(new THREE.LatheGeometry(cupProfile.map(p=>new THREE.Vector2(...p)),96),ceramic);
- cup.name = 'CeladonTeaCup';cup.position.y = .754;cup.castShadow = true;cup.receiveShadow = true;scene.add(cup);
- const handle = new THREE.Mesh(new THREE.TorusGeometry(.032,.006,14,48),ceramic);
- handle.name = 'CupHandle';handle.position.set(.064,.806,0);handle.scale.x = .8;scene.add(handle);
- const tea = new THREE.Mesh(new THREE.CircleGeometry(.046,96),new THREE.MeshPhysicalMaterial({
- color:0x422518,roughness:.11,metalness:0,clearcoat:1,ior:1.333}));
- tea.name = 'TeaSurface';tea.rotation.x = -Math.PI/2;tea.position.y = .845;scene.add(tea);
- const saucer = new THREE.Mesh(new THREE.LatheGeometry([[0,0],[.058,0],[.074,.004],[.084,.011],
- [.084,.014],[.074,.009],[.047,.005],[0,.005]].map(p=>new THREE.Vector2(...p)),96),ceramic);
- saucer.name = 'TeaSaucer';saucer.position.y = .750;scene.add(saucer);
- const steam = makeSteam({height:.29,radius:.03,spread:.12,riseSpeed:.12,
- wind:[.009,-.002],quality:'high',density:5.5,dissipation:2.8,turbulence:.9,seed:18});
- steam.position.y = .849;scene.add(steam);
- const steamLight=new THREE.PointLight(0xffead0,1.8,1.6,2);
- steamLight.name='SteamBacklight';steamLight.position.set(-.12,.98,-.40);scene.add(steamLight);
- const teaBackdrop = new THREE.Mesh(new THREE.PlaneGeometry(2.2,2.3),
- new THREE.MeshStandardMaterial({color:0x182026,roughness:1}));
- teaBackdrop.name = 'TeaAlcove';teaBackdrop.position.set(-.12,1.6,-.90);scene.add(teaBackdrop);
-
- const copper = new THREE.MeshStandardMaterial({color:0xb66b43,metalness:.95,roughness:.3});
- patchStandard(copper,{name:'PlumeHammeredCopper',vertexHead:'varying vec3 vCopper;',vertexBody:'vCopper=position;',
- fragmentHead:'varying vec3 vCopper;',fragmentBody:'diffuseColor.rgb*=.8+.2*astraFbm2(vCopper.xy*18.0,3);',
- roughnessBody:'roughnessFactor+=astraNoise2(vCopper.xy*170.0)*.1;'});
- const kettle = new THREE.Group();kettle.name = 'CopperKettle';kettle.position.set(-.36,.754,.03);
- kettle.rotation.y=2.2;
- const kettleProfile = new THREE.SplineCurve([[0,0],[.073,0],[.106,.034],[.119,.080],
- [.112,.139],[.075,.174],[.061,.178]].map(p=>new THREE.Vector2(...p))).getPoints(64);
- const body = new THREE.Mesh(new THREE.LatheGeometry(kettleProfile,96),copper);body.castShadow=true;kettle.add(body);
- const lid = new THREE.Mesh(new THREE.SphereGeometry(.064,64,24,0,Math.PI*2,0,Math.PI/2),copper);
- lid.scale.y = .28;lid.position.y = .176;kettle.add(lid);
- const dark = new THREE.MeshStandardMaterial({color:0x27211e,roughness:.62});
- const knob = new THREE.Mesh(new THREE.SphereGeometry(.014,24,16),dark);knob.position.y=.208;kettle.add(knob);
- const arch = new THREE.Mesh(new THREE.TorusGeometry(.11,.009,12,64,Math.PI),dark);
- arch.position.y=.133;kettle.add(arch);
- const spoutPath = new THREE.CatmullRomCurve3([new THREE.Vector3(.085,.052,0),
- new THREE.Vector3(.143,.076,0),new THREE.Vector3(.17,.13,0),new THREE.Vector3(.18,.171,0)]);
- const spout = new THREE.Mesh(new THREE.TubeGeometry(spoutPath,40,.014,18,false),copper);kettle.add(spout);scene.add(kettle);
- const silver = new THREE.MeshStandardMaterial({color:0xb7b5aa,metalness:.95,roughness:.22});
- const spoon = new THREE.Mesh(new THREE.SphereGeometry(.018,32,20),silver);
- spoon.scale.set(.7,.10,1.3);spoon.position.set(.14,.757,.02);scene.add(spoon);
- const stem = new THREE.Mesh(new THREE.CapsuleGeometry(.0024,.096,6,12),silver);
- stem.rotation.x=Math.PI/2;stem.position.set(.14,.757,.086);scene.add(stem);
-
- const floor = new THREE.Mesh(new THREE.PlaneGeometry(30,30),stone);floor.rotation.x=-Math.PI/2;
- floor.name='WorkshopFloor';floor.receiveShadow=true;scene.add(floor);
- const wall = new THREE.Mesh(new THREE.PlaneGeometry(40,14),new THREE.MeshStandardMaterial({color:0x152026,roughness:1}));wall.name='WorkshopWall';wall.position.set(0,5,-2.7);scene.add(wall);
- const brazier = new THREE.Group();brazier.name='CoolingBrazier';brazier.position.set(8,0,0);scene.add(brazier);
- const iron = new THREE.MeshStandardMaterial({color:0x313739,metalness:.7,roughness:.7});
- const bowl = new THREE.Mesh(new THREE.LatheGeometry([[0,0],[.16,0],[.22,.04],[.29,.17],
- [.31,.24],[.305,.248],[.297,.24],[.277,.175],[.21,.052],[.16,.014],[0,.014]].map(p=>new THREE.Vector2(...p)),64),iron);
- bowl.position.y=.44;brazier.add(bowl);
- for(const angle of [0,2.094,4.189]) {
- const leg=new THREE.Mesh(new THREE.CylinderGeometry(.013,.017,.47,12),iron);
- leg.position.set(Math.cos(angle)*.18,.235,Math.sin(angle)*.18);leg.castShadow=true;brazier.add(leg);
- }
- const char = new THREE.MeshStandardMaterial({color:0x181615,roughness:1});
- const random=mulberry32(8);
- for(let i=0;i<28;i++) {
- const coal=new THREE.Mesh(new THREE.DodecahedronGeometry(.034+random()*.025),char);
- const angle=random()*Math.PI*2,radial=Math.sqrt(random())*.21;
- coal.position.set(Math.cos(angle)*radial,.54+random()*.03,Math.sin(angle)*radial);
- coal.rotation.set(random()*3,random()*3,random()*3);coal.castShadow=true;brazier.add(coal);
- }
- const smoke=makeSmoke({height:1.9,radius:.075,spread:.19,riseSpeed:.43,wind:[.075,.012],
- color:0xc8d0d4,density:4.2,quality:'high',seed:33});
- smoke.position.set(8,.691,0);scene.add(smoke);
- return {scene,cameras:[
- {name:'tea_steam',position:[.40,1.14,.72],lookAt:[-.055,.975,-.005],fov:38},
- {name:'charcoal_smoke',position:[10.7,1.95,4.2],lookAt:[8.16,1.38,0],fov:39},
- ],update(t){steam.userData.update(t);smoke.userData.update(t);}};
-}
diff --git a/harness/examples/graphics_lab/scenes/stream.js b/harness/examples/graphics_lab/scenes/stream.js
deleted file mode 100644
index e1445188..00000000
--- a/harness/examples/graphics_lab/scenes/stream.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/** A close study of a clear brook, wet granite, gravel and continuous meadow banks. */
-import * as THREE from 'three';
-import { makeStream } from '../lib/stream.js';
-import { makeRock } from '../lib/rock.js';
-import { makeMeadow } from '../lib/meadow.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { patchStandard } from '../lib/shader.js';
-import { mulberry32 } from '../lib/noise.js';
-
-export const BOUNDS = { min: [-18, -2, -22], max: [18, 5, 22] };
-export function heightAt() {
- return 0;
-}
-
-export async function createScene() {
- const scene = new THREE.Scene();
- const rig = sunRig({
- mood: 'day',
- azimuth: 145,
- elevation: 39,
- bounds: 23,
- intensity: 4.6,
- fill: 1.25,
- disc: false,
- });
- scene.add(rig.sun, rig.fill);
- scene.environment = rig.envTex;
- makeSky(scene, { rig, turbidity: 3.8, scale: 2500 });
- scene.fog = new THREE.FogExp2(0xb4c7b6, 0.012);
- const obstacles = [
- { u: 0.3, lateral: -0.3, radius: 0.36 },
- { u: 0.48, lateral: 0.4, radius: 0.4 },
- { u: 0.66, lateral: -0.3, radius: 0.35 },
- { u: 0.78, lateral: 0.36, radius: 0.24 },
- ];
-
- const stream = makeStream({
- points: [
- [-2, 1, -19],
- [0.7, 0.7, -10],
- [-1.2, 0.35, -2],
- [1, 0.12, 7],
- [2, 0, 20],
- ],
- width: 3.8,
- widthVariation: 0.22,
- depth: 0.43,
- speed: 1.25,
- roughness: 0.6,
- segments: 320,
- widthSegments: 36,
- stoneCount: 1200,
- seed: 81,
- waterColor: 0x376b57,
- attenuationDistance: 4.5,
- reflectionSize: 1024,
- bedColor: 0x4f422a,
- obstacles,
- });
- scene.add(stream);
- // The same hydrodynamic obstacles get fractured, wet granite silhouettes in
- // this composition. Their positions and wake parameters remain unchanged.
- obstacles.forEach((obstacle, i) => {
- stream.getObjectByName(`StreamObstacle_${i}`).visible = false;
- const sample = stream.userData.sample(obstacle.u, obstacle.lateral);
- const r = obstacle.radius;
- const rock = makeRock({
- seed: 405 + i,
- type: 'granite',
- size: [r * 1.9, r * 1.1, r * 2.3],
- detail: 5,
- color: 0x5c625c,
- moisture: 0.9,
- moss: 0.08,
- weathering: 1.4,
- });
- rock.position.copy(sample.position);
- rock.position.y -= r * 0.65;
- rock.rotation.y = i * 1.65;
- scene.add(rock);
- });
-
- // One continuous terrain surface avoids visible outer berms or ribbon seams.
- // Its channel is below the separate stream bed, and its bank grows from the
- // exact authored water boundary rather than intersecting a rectangular slab.
- const samples = Array.from({ length: 241 }, (_, i) => stream.userData.sample(i / 240));
- function nearest(x, z) {
- const index = Math.max(0, Math.min(240, Math.round(((z + 19) / 39) * 240)));
- let best = samples[index],
- distance = Infinity;
- for (let i = Math.max(0, index - 14); i <= Math.min(240, index + 14); i++) {
- const sample = samples[i];
- const d = (x - sample.position.x) ** 2 + (z - sample.position.z) ** 2;
- if (d < distance) {
- best = sample;
- distance = d;
- }
- }
- return { sample: best, offset: Math.sqrt(distance) - best.width * 0.5 };
- }
- function terrainHeight(x, z) {
- const { sample, offset } = nearest(x, z);
- const outside = Math.max(0, offset);
- const bank =
- sample.position.y +
- (1 - Math.exp(-outside * 0.8)) * 0.55 +
- Math.sin(x * 0.71 + z * 0.28) * Math.min(outside * 0.15, 0.15) -
- 0.045;
- const blend = THREE.MathUtils.smoothstep(offset, -0.24, 0.06);
- return THREE.MathUtils.lerp(sample.position.y - 0.66, bank, blend);
- }
- const terrainGeometry = new THREE.PlaneGeometry(54, 65, 240, 260);
- terrainGeometry.rotateX(-Math.PI / 2);
- const p = terrainGeometry.attributes.position;
- for (let i = 0; i < p.count; i++) p.setY(i, terrainHeight(p.getX(i), p.getZ(i)));
- terrainGeometry.computeVertexNormals();
- const terrainMaterial = new THREE.MeshStandardMaterial({ color: 0x414629, roughness: 1 });
- patchStandard(terrainMaterial, {
- name: 'MossAndLitter',
- vertexHead: 'varying vec3 bankP;',
- vertexBody: 'bankP=position;',
- fragmentHead: 'varying vec3 bankP;',
- fragmentBody: `
- float moss=astraNoise2(bankP.xz*1.8)*.60+astraNoise2(bankP.xz*6.2)*.27+astraNoise2(bankP.xz*25.0)*.13;
- diffuseColor.rgb*=.42+moss*.75;
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.046,.031,.014),smoothstep(.39,.68,moss)*.55);
- `,
- });
- const terrain = new THREE.Mesh(terrainGeometry, terrainMaterial);
- terrain.name = 'ContinuousBrookBanks';
- terrain.receiveShadow = true;
- scene.add(terrain);
-
- const rng = mulberry32(801);
- for (const side of [-1, 1]) {
- for (let i = 0; i < 42; i++) {
- // Deposits form loose groups with open gravel between them, rather than
- // two evenly spaced rows enclosing a landscaped water channel.
- const cluster = Math.floor(i / 3);
- const u = 0.05 + (cluster / 14) * .9 + (rng() - .5) * .035;
- if (rng() < .22) continue;
- const sample = stream.userData.sample(u, side);
- const across = new THREE.Vector3(sample.tangent.z, 0, -sample.tangent.x)
- .normalize()
- .multiplyScalar(side);
- const size = 0.20 + rng() ** 1.8 * 1.05;
- const rock = makeRock({
- seed: 122 + i + (side + 1) * 30,
- type: 'granite',
- size: [size * 1.2, size * 0.62, size],
- detail: 4,
- color: 0x62615b,
- moisture: 0.8,
- moss: 0.3,
- });
- rock.position.copy(sample.position).addScaledVector(across, -.07 + rng() * .92);
- rock.position.y = terrainHeight(rock.position.x, rock.position.z) - 0.08;
- rock.rotation.y = rng() * Math.PI * 2;
- scene.add(rock);
- }
- }
- const shingleGeometry = new THREE.IcosahedronGeometry(1, 1);
- const shingle = new THREE.InstancedMesh(shingleGeometry,
- new THREE.MeshStandardMaterial({color:0x827b68,roughness:.83}), 1800);
- shingle.name = 'BankShingle';
- shingle.receiveShadow = true;
- const shinglePose = new THREE.Object3D(), shingleColour = new THREE.Color();
- for (let i=0;i<shingle.count;i++) {
- const side = rng()<.5 ? -1 : 1;
- const sample=stream.userData.sample(.02+rng()*.96,side);
- const across=new THREE.Vector3(sample.tangent.z,0,-sample.tangent.x).normalize();
- shinglePose.position.copy(sample.position).addScaledVector(across,side*(.02+rng()**1.9*.9));
- const radius=.013+rng()**2*.067;
- shinglePose.position.y=terrainHeight(shinglePose.position.x,shinglePose.position.z)+radius*.12;
- shinglePose.scale.set(radius*(.8+rng()*.6),radius*(.3+rng()*.25),radius);
- shinglePose.rotation.set((rng()-.5)*.3,rng()*Math.PI*2,(rng()-.5)*.3);
- shinglePose.updateMatrix();shingle.setMatrixAt(i,shinglePose.matrix);
- shingleColour.setHSL(.07+rng()*.055,.06+rng()*.2,.13+rng()*.23);
- shingle.setColorAt(i,shingleColour);
- }
- scene.add(shingle);
- // Two spatially continuous banks keep a high local blade density while
- // respecting the per-field memory bound. Their masks meet at the channel.
- const grasses = [-1, 1].map((side) => {
- const xOffset = side * 4.5;
- const grass = makeMeadow({
- size: [9, 26],
- density: 1400,
- maxBlades: 300000,
- height: 0.26,
- bladeWidth: 0.013,
- seed: 193 + (side + 1) * 3,
- color: 0x405717,
- dry: 0.1,
- ground: false,
- shadows: false,
- heightAt: (x, z) => terrainHeight(x + xOffset, z),
- mask(x, z) {
- x += xOffset;
- const { offset } = nearest(x, z);
- const raggedEdge=.16+.14*Math.sin(z*1.17+x*2.8)+.12*Math.sin(z*3.3-x*1.1);
- const edge = THREE.MathUtils.smoothstep(offset, Math.max(.03,raggedEdge), raggedEdge+.48);
- const thin = .7+.3*Math.sin(x*1.9+z*.7)*Math.sin(z*1.2-x*.4);
- return edge * thin;
- },
- wind: { dir: [0.8, 0.3], strength: 1.0, speed: 0.8 / 1.2 },
- });
- grass.position.x = xOffset;
- scene.add(grass);
- return grass;
- });
-
- return {
- scene,
- cameras: [
- { name: 'stream', position: [4.4, 4.7, 7.5], lookAt: [0.1, 0.15, 1.4], fov: 43 },
- { name: 'riffles', position: [2.6, 2.5, 5.8], lookAt: [0.3, 0.12, 2], fov: 40 },
- ],
- update(t, dt) {
- stream.userData.update(t, dt);
- grasses.forEach((grass) => grass.userData.update(t, dt));
- },
- };
-}
diff --git a/harness/examples/graphics_lab/scenes/structural_fire.js b/harness/examples/graphics_lab/scenes/structural_fire.js
deleted file mode 100644
index e05650be..00000000
--- a/harness/examples/graphics_lab/scenes/structural_fire.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/** A authored damaged cottage with one shared fire/soot field. No structural simulation. */
-import * as THREE from 'three';
-import {makeFireField} from '../lib/firefield.js';
-import {makeMeadow} from '../lib/meadow.js';
-import {makeTree} from '../lib/tree.js';
-import {patchStandard} from '../lib/shader.js';
-import {mulberry32} from '../lib/noise.js';
-import {snapshotResources,attachDisposal} from '../lib/lifecycle.js';
-
-export function createScene(){
- const scene=new THREE.Scene();scene.background=new THREE.Color(0x3b4652);scene.fog=new THREE.FogExp2(0x3b4652,.014);
- scene.add(new THREE.HemisphereLight(0xbdcbd7,0x28211c,.8));
- const sky=new THREE.DirectionalLight(0xc1d2e0,2);sky.position.set(-8,16,4);sky.castShadow=true;sky.shadow.mapSize.set(2048,2048);
- Object.assign(sky.shadow.camera,{left:-12,right:12,top:12,bottom:-12});sky.shadow.normalBias=.018;scene.add(sky);
- const random=mulberry32(251),actors=[],opaque=new THREE.Group();opaque.name='BorrowedHouseOccluders';scene.add(opaque);
- const earthMat=new THREE.MeshStandardMaterial({color:0x666252,roughness:1});
- patchStandard(earthMat,{name:'CottageYard',vertexHead:'varying vec3 vYard;',vertexBody:'vYard=position;',fragmentHead:'varying vec3 vYard;',fragmentBody:'diffuseColor.rgb*=.65+astraFbm2(vYard.xy*7.0,3)*.6;'});
- const groundGeometry=new THREE.PlaneGeometry(90,90,80,80),gp=groundGeometry.attributes.position;
- for(let i=0;i<gp.count;i++){const x=gp.getX(i),z=-gp.getY(i),edge=Math.max(0,Math.hypot(x,z)-14)/30;gp.setZ(i,edge*.8*(1+Math.sin(x*.21+z*.13)));}groundGeometry.computeVertexNormals();
- const ground=new THREE.Mesh(groundGeometry,earthMat);ground.rotation.x=-Math.PI/2;ground.receiveShadow=true;ground.name='EarthYard';opaque.add(ground);
- const plaster=new THREE.MeshStandardMaterial({color:0xa39682,roughness:.96});
- patchStandard(plaster,{name:'SmokeStainedPlaster',vertexHead:'varying vec3 vWall;',vertexBody:'vWall=(modelMatrix*vec4(position,1.0)).xyz;',fragmentHead:'varying vec3 vWall;',fragmentBody:`
- float n=astraFbm2(vWall.xy*3.0+vWall.z*.2,4);
- float soot=smoothstep(1.2,2.8,vWall.y)*(.28+.7*astraNoise2(vWall.xz*1.4));
- diffuseColor.rgb*=mix(.74+n*.4,.17+n*.14,soot);
- `});
- const char=new THREE.MeshStandardMaterial({color:0x251f1c,roughness:.94});
- patchStandard(char,{name:'CharredStructuralTimber',vertexHead:'varying vec3 vBeam;',vertexBody:'vBeam=position;',fragmentHead:'varying vec3 vBeam;',fragmentBody:`
- float grain=astraFbm2(vBeam.xy*vec2(36.0,5.0)+vBeam.z*4.0,3);diffuseColor.rgb*=.5+grain;
- `,outputBody:`
- float split=pow(max(0.0,sin(vBeam.x*109.0+astraNoise2(vBeam.xy*8.0)*5.0)),35.0);
- gl_FragColor.rgb+=vec3(.035,.001,.00002)*split*smoothstep(.65,.90,astraNoise2(vBeam.xy*5.0+11.0));
- `});
- const tile=new THREE.MeshStandardMaterial({color:0x55443a,roughness:.9});
- const stone=new THREE.MeshStandardMaterial({color:0x575652,roughness:.96});
- function box(name,size,pos,mat=plaster){const m=new THREE.Mesh(new THREE.BoxGeometry(...size),mat);m.name=name;m.position.set(...pos);m.castShadow=m.receiveShadow=true;opaque.add(m);return m;}
- // Wall strips make real empty door/window apertures; depth capture can see through them.
- box('RubbleFoundation',[5.7,.35,4.4],[0,.16,0],stone);box('InteriorFloor',[5.2,.09,4],[0,.36,0],char);
- box('RearWall',[5.5,2.9,.22],[0,1.78,-2.0]);box('WestWall',[.22,2.9,4],[ -2.65,1.78,0]);
- box('EastWallLower',[.22,.8,4],[2.65,.72,0]);box('EastWallUpper',[.22,.8,4],[2.65,2.72,0]);
- for(const z of [-1.6,.0,1.6])box('EastWindowPier',[.22,1.2,.55],[2.65,1.72,z]);
- box('LeftWindowSill',[2.25,.75,.22],[-1.65,.71,2.0]);box('RightWindowSill',[1.55,.75,.22],[1.98,.71,2.0]);box('FacadeLintel',[5.5,.63,.22],[0,2.91,2.0]);
- for(const [x,w] of [[-2.47,.56],[-.7,.50],[1.45,.53],[2.51,.48]])box('FacadePier',[w,1.50,.22],[x,1.83,2.0]);
- // Charred framing and actual roof gaps expose the upper fire without a transparent wall.
- for(const x of [-2.75,-.88,.88,2.75])box('TimberUpright',[.15,2.9,.27],[x,1.78,2.06],char);
- for(const y of [2.59,3.18])box('FacadeCrossbeam',[5.65,.15,.28],[0,y,2.08],char);
- box('LeftWindowSillTimber',[2.30,.15,.28],[-1.65,1.11,2.08],char);box('RightWindowSillTimber',[1.58,.15,.28],[1.98,1.11,2.08],char);
- for(const x of [-2.75,-1.83,-.91,0,.91,1.83,2.75])for(const side of [-1,1]){
- const rafter=box('ExposedRoofRafter',[.105,.12,2.53],[x,3.80,side*1.06],char);rafter.rotation.x=side*.51;
- }
- box('CharredRidgeBeam',[5.8,.18,.18],[0,4.42,0],char);
- for(let ix=0;ix<19;ix++)for(let row=0;row<7;row++)for(const side of [-1,1]){
- const x=-2.8+ix*.31,z=side*(.18+row*.31),y=4.43-Math.abs(z)*.555;
- const damage=Math.exp(-((x-.55)**2+(z-.6)**2)*.9)+Math.exp(-((x+1.7)**2+(z+.5)**2)*1.2)*.7;
- if(random()<damage*.94)continue;
- const t=box('WeatheredRoofTile',[.304,.035,.36],[x,y,z],tile);t.rotation.x=side*.51;t.rotation.z=(random()-.5)*.035;
- }
- box('BrickChimney',[.56,1.62,.62],[-1.95,4.32,-.57],stone);
- for(let row=0;row<9;row++){const band=box('ChimneyMortar',[.57,.016,.63],[-1.95,3.56+row*.18,-.57],plaster);band.material=plaster;}
- // A few fallen beams and fragments connect the damaged roof to the yard.
- for(let i=0;i<18;i++){const debris=box('FallenTimber',[.10+random()*.05,.08,.35+random()*.7],[(random()-.5)*5.7,.08,2.4+random()*1.7],char);debris.rotation.y=random()*Math.PI;debris.rotation.z=(random()-.5)*.15;}
- const grass=makeMeadow({size:[30,26],density:170,height:.22,dry:.24,maxBlades:90000,seed:32,
- mask:(x,z)=>Math.min(1,Math.max(0,(Math.max(Math.abs(x)-3.8,Math.abs(z)-3.5))*.9)),wind:{dir:[1,.3],strength:.68,speed:1.1/1.2}});scene.add(grass);actors.push(grass);
- for(let i=0;i<5;i++){const tree=makeTree({height:8+i*.5,crownRadius:2.5,leafDensity:.40,maxLeaves:5500,leafSegments:4,seed:100+i,shadows:false});tree.position.set((i-2)*5.5,0,-9-random()*3);scene.add(tree);actors.push(tree);}
- const fire=makeFireField({name:'CottageSharedFire',seed:107,quality:'high',wind:[.32,.10],intensity:.88,
- emitters:[
- {position:[-1.62,.65,1.55],radius:.68,height:2.5},{position:[.33,.58,1.53],radius:.65,height:3.1},
- {position:[1.86,.50,.93],radius:.64,height:2.7},{position:[2.44,1.25,.75],radius:.42,height:2.2},
- {position:[-.85,1.5,.05],radius:.75,height:3.7},{position:[1.1,2.4,-.15],radius:.78,height:3.8},
- {position:[-1.60,2.92,-.50],radius:.54,height:2.7},{position:[.18,3.4,.74],radius:.60,height:3.1},
- ],smoke:{height:10,density:2.0,albedo:0x4f4a43},embers:{count:160,size:[.002,.010],lifetime:[2,5],riseSpeed:2.2},lighting:{count:4,intensity:38},occluders:[opaque],depthResolution:1024});scene.add(fire);actors.push(fire);
- for(const light of fire.children.filter(o=>o.isPointLight).slice(0,2)){light.castShadow=true;light.shadow.mapSize.set(512,512);light.shadow.camera.near=.1;light.shadow.camera.far=18;light.shadow.normalBias=.025;}
- const resources=snapshotResources(opaque);resources.add(sky);
- for(const actor of actors)resources.add({dispose:()=>actor.userData.dispose()});attachDisposal(scene,resources);
- return {scene,cameras:[
- {name:'cottage_fire',position:[10.5,6.3,14.7],lookAt:[0,3.8,0],fov:43},
- {name:'window_fire',position:[.9,2.45,7.2],lookAt:[.25,1.75,1.1],fov:47},
- {name:'roof_fire',position:[6.8,7.8,8.3],lookAt:[0,4.0,.0],fov:44},
- ],update(t,dt){actors.forEach(a=>a.userData.update(t,dt));},dispose(){scene.userData.dispose();}};
-}
diff --git a/harness/examples/graphics_lab/scenes/tree.js b/harness/examples/graphics_lab/scenes/tree.js
deleted file mode 100644
index e0309745..00000000
--- a/harness/examples/graphics_lab/scenes/tree.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/** A sunlit woodland edge: connected oak limbs, birch bark and a low hazel-like understory. */
-import * as THREE from 'three';
-import {makeTree,makeShrub} from '../lib/tree.js';
-import {makeMeadow} from '../lib/meadow.js';
-import {makeRock} from '../lib/rock.js';
-import {makeImposters} from '../lib/woodland.js';
-import {sunRig} from '../lib/environment.js';
-import {makeSky} from '../lib/sky.js';
-import {patchStandard} from '../lib/shader.js';
-
-export function createScene(){
- const scene=new THREE.Scene();
- const rig=sunRig({mood:'day',azimuth:125,elevation:31,bounds:12,intensity:4,fill:1.2});
- scene.add(rig.sun,rig.sun.target,rig.fill);scene.environment=rig.envTex;makeSky(scene,{rig});
- rig.sun.shadow.mapSize.set(4096,4096);rig.sun.shadow.normalBias=.004;rig.sun.shadow.radius=1.8;
- scene.fog=new THREE.FogExp2(0xb5c3b5,.015);
- scene.userData.grade={contrast:1.03,saturation:.94,warmth:.01};
- const heightAt=(x,z)=>.08*Math.sin(x*.5)+.055*Math.sin(z*.4+x*.25);
- const wind={dir:[1,.3],strength:.75,speed:.85};
- const oak=makeTree({species:'oak',height:6.8,crownRadius:2.8,seed:23,wind});
- oak.position.set(-.8,heightAt(-.8,0),0);scene.add(oak);
- const birch=makeTree({species:'birch',height:6.6,crownRadius:1.5,leafDensity:.30,seed:76,wind});
- birch.position.set(4,heightAt(4,-3),-3);scene.add(birch);
- const willow=makeTree({species:'willow',height:5.3,crownRadius:2.1,leafDensity:.28,seed:12,wind});
- willow.position.set(-5.2,heightAt(-5.2,-5),-5);scene.add(willow);
- const shrub=makeShrub({height:1.35,crownRadius:1.1,leafSize:.09,leafDensity:.22,seed:41,wind});
- shrub.position.set(3.3,heightAt(3.3,1),1);scene.add(shrub);
- const grass=makeMeadow({size:[19,17],height:.30,density:550,maxBlades:80000,segments:3,bladeWidth:.022,
- seed:39,color:0x526b2c,dry:.12,heightAt,wind,ground:false,seedHeads:.001,
- mask:(x,z)=>(.25+.75*THREE.MathUtils.smoothstep(Math.hypot(x+.8,z),.35,1.1))
- *THREE.MathUtils.smoothstep(Math.min(9.5-Math.abs(x),8.5-Math.abs(z)),0,2)});
- scene.add(grass);
- const terrain=new THREE.PlaneGeometry(600,600,220,220);terrain.rotateX(-Math.PI/2);
- const p=terrain.attributes.position;
- const earthHeight=(x,z)=>heightAt(x,z)-.008+1.7*Math.exp(-(((z+29)/14)**2))*THREE.MathUtils.smoothstep(-z,15,30);
- for(let i=0;i<p.count;i++){
- const x=Math.sign(p.getX(i))*300*Math.pow(Math.abs(p.getX(i))/300,1.8);
- const z=Math.sign(p.getZ(i))*300*Math.pow(Math.abs(p.getZ(i))/300,1.8);
- p.setXYZ(i,x,earthHeight(x,z),z);
- }
- terrain.computeVertexNormals();
- const material=new THREE.MeshStandardMaterial({color:0x34321e,roughness:1,envMapIntensity:.65});
- patchStandard(material,{name:'TreeGladeEarth',vertexHead:'varying vec3 vGlade;',vertexBody:'vGlade=transformed;',
- uniforms:{uGladeFar:{value:new THREE.Color(0x5d6544)}},
- fragmentHead:'varying vec3 vGlade; uniform vec3 uGladeFar;',
- fragmentBody:`float earthDistance=smoothstep(10.,26.,length(vGlade.xz));
- diffuseColor.rgb=mix(diffuseColor.rgb,uGladeFar,earthDistance);
- diffuseColor.rgb*=.66+.62*astraFbm2(vGlade.xz*14.,3);
- float litter=astraFbm2(vGlade.xz*2.1,2);
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.08,.063,.027),smoothstep(.48,.70,litter)*.4);`});
- const ground=new THREE.Mesh(terrain,material);ground.receiveShadow=true;scene.add(ground);
- const distant=makeImposters({source:'tree',count:230,extent:110,height:8,seed:51,
- color:0x49672b,rig,wind,heightAt:(x,z)=>earthHeight(x,z-142)});
- distant.position.z=-142;scene.add(distant);
- const rock=makeRock({size:[1.1,.55,.8],seed:97,type:'granite',detail:3,moss:.4});
- rock.position.set(-2.5,heightAt(-2.5,2.2)-.08,2.2);scene.add(rock);
- const animated=[oak,birch,willow,shrub,grass,distant];
- return {scene,cameras:[
- {name:'woodland',position:[9.5,4.3,13.8],lookAt:[-.4,3.15,-.7],fov:43},
- {name:'branches',position:[2.7,3.5,4.5],lookAt:[-.1,3.55,-.1],fov:42},
- ],update(t,dt){for(const object of animated)object.userData.update(t,dt);}};
-}
diff --git a/harness/examples/graphics_lab/scenes/waterfall.js b/harness/examples/graphics_lab/scenes/waterfall.js
deleted file mode 100644
index 492da5ee..00000000
--- a/harness/examples/graphics_lab/scenes/waterfall.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/** An old stone weir in a wooded stream: a falling sheet and a shallow plunge pool. */
-import * as THREE from 'three';
-import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js';
-import { makeWaterfall } from '../lib/waterfall.js';
-import { makeStream } from '../lib/stream.js';
-import { makeRock } from '../lib/rock.js';
-import { makeMeadow } from '../lib/meadow.js';
-import { makeTree, makeShrub } from '../lib/tree.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { patchTriplanar } from '../lib/terrain_shade.js';
-import { patchStandard } from '../lib/shader.js';
-import { mulberry32, fbm2 } from '../lib/noise.js';
-
-export function createScene() {
- const scene = new THREE.Scene(), height = 1.85;
- const rig = sunRig({mood:'day',azimuth:138,elevation:44,bounds:14,
- intensity:4.1,fill:.82,disc:false});
- scene.add(rig.sun,rig.fill); scene.environment=rig.envTex;
- rig.sun.shadow.mapSize.set(4096,4096); rig.sun.shadow.normalBias=.009;
- makeSky(scene,{rig,turbidity:3.2,scale:1800});
- scene.fog=new THREE.FogExp2(0x9ca99b,.018);
- const waterfall=makeWaterfall({height,width:2.2,speed:.9,thickness:.055,
- breakup:.68,foam:.56,quality:'high',seed:17,sprayRate:280});
- // Surface froth has a little height above the receiving stream's wave crests.
- waterfall.getObjectByName('WaterfallImpactFoam').position.y=.037;
- scene.add(waterfall);
- const upstream=makeStream({points:[[.6,height,-13],[.2,height,-6],[0,height,-2],[0,height,0]],
- width:2.2,widthVariation:0,endFade:.65,depth:.22,speed:.9,segments:120,widthSegments:20,
- stoneCount:140,obstacles:[],seed:88,roughness:.20,reflectionSize:0,
- bedColor:0x4b4833,waterColor:0x92af88,attenuationDistance:4.2});
- const downstream=makeStream({points:[[0,0,-.02],[0,0,2.1],[.32,-.035,5],[.9,-.10,13]],
- width:3.8,widthVariation:.11,depth:.43,speed:.72,segments:180,widthSegments:28,
- stoneCount:420,seed:81,roughness:.26,reflectionSize:512,
- bedColor:0x5a503c,waterColor:0x647f59,attenuationDistance:4.5,obstacles:[]});
- scene.add(upstream,downstream);
- const smooth=(a,b,v)=>THREE.MathUtils.smoothstep(v,a,b);
- const lowerSamples=Array.from({length:261},(_,i)=>downstream.userData.sample(i/260));
- const upperSamples=Array.from({length:161},(_,i)=>upstream.userData.sample(i/160));
- const closest=(x,z,samples)=>{
- let best=samples[0],distance=Infinity;
- for(const sample of samples) {
- const d=(x-sample.position.x)**2+(z-sample.position.z)**2;
- if(d<distance){distance=d;best=sample;}
- }
- return {sample:best,offset:Math.sqrt(distance)-best.width*.5};
- };
- const heightAt=(x,z)=>{
- // Only the short built weir retains a sharp level change. The earth at its
- // ends grades continuously between upstream and downstream elevations.
- const upper=closest(x,z,upperSamples),lower=closest(x,z,lowerSamples);
- const span=.01+2.0*smooth(1.7,3.0,Math.abs(x));
- const blend=smooth(-.28-span,-.28+span,z);
- const waterY=THREE.MathUtils.lerp(upper.sample.position.y,lower.sample.position.y,blend);
- const offset=THREE.MathUtils.lerp(upper.offset,lower.offset,blend);
- const outside=Math.max(0,offset),noise=fbm2(x*.32,z*.32,{seed:37});
- const grade=height*(1-smooth(-2.3-Math.abs(x)*.13,2.0+Math.abs(x)*.12,z));
- const hill=.55*Math.sin(x*.24+z*.13)+.30*Math.cos(z*.28-x*.16)+noise*.35;
- const upland=grade+.25+hill*smooth(.3,3.2,outside);
- const bank=waterY-.025+outside*.16+noise*.07;
- if(Math.abs(x)<1.23 && z>-.28 && z<.9) return -.63;
- const channel=waterY-.66;
- const shore=THREE.MathUtils.lerp(channel,bank,smooth(-.17,.045,offset));
- return THREE.MathUtils.lerp(shore,upland,smooth(.30,2.8,outside));
- };
- const groundMaterial=new THREE.MeshStandardMaterial({color:0x4c4c32,roughness:.98});
- patchTriplanar(groundMaterial,{scale:.24,relief:.006,roughness:.98,colorA:0x20291a,colorB:0x4c5032});
- const groundGeometry=new THREE.PlaneGeometry(46,54,240,280);groundGeometry.rotateX(-Math.PI/2);
- const p=groundGeometry.attributes.position;
- for(let i=0;i<p.count;i++) p.setY(i,heightAt(p.getX(i),p.getZ(i)));
- groundGeometry.computeVertexNormals();
- const ground=new THREE.Mesh(groundGeometry,groundMaterial);
- ground.name='WoodlandBanks';ground.receiveShadow=true;scene.add(ground);
-
- // Weathered masonry explains the straight spillway. The banks roll around
- // its abutments instead of continuing as a sheer, uninterrupted earth wall.
- const random=mulberry32(47),masonry=new THREE.Group();masonry.name='OldStoneWeir';
- const materials=[],wetMaterials=[];
- for(let i=0;i<8;i++) {
- for(const wet of [false,true]) {
- const material=new THREE.MeshStandardMaterial({roughness:wet?.50:.93});
- const tint=(random()-.5)*.11;
- patchTriplanar(material,{scale:.053,relief:.004,roughness:wet?.50:.93,
- colorA:new THREE.Color(wet?0x343d30:0x575a4c).offsetHSL(0,0,tint*.6),
- colorB:new THREE.Color(wet?0x59634f:0x777463).offsetHSL(0,0,tint)});
- patchStandard(material,{name:'WeirStoneAge',fragmentBody:`
- float weirColony=smoothstep(.36,.66,astraFbm2(vAstraWorld.xz*8.0+vAstraWorld.y*2.6,3));
- float weirMoss=(pow(max(0.0,vAstraWorldN.y),3.0)*.36
- +exp(-max(0.0,vAstraWorld.y)*3.0)*.57)*weirColony;
- diffuseColor.rgb=mix(diffuseColor.rgb,vec3(.058,.075,.025),weirMoss);
- float weirWet=(1.0-smoothstep(.03,.43,vAstraWorld.y))*.38;
- diffuseColor.rgb*=1.0-weirWet;`});
- (wet?wetMaterials:materials).push(material);
- }
- }
- let blockId=0;
- const block=(name,x,y,z,w,h,d,wet=false)=>{
- // Broken corners give each stone a broad face and a rough, chipped outline.
- // Face planes remain connected; this is dressed rubble, not a pile of spheres.
- const vertices=[],shear=(random()-.5)*.065,tilt=(random()-.5)*.035;
- for(const sx of [-1,1])for(const sy of [-1,1])for(const sz of [-1,1]) {
- const px=sx*w*.50+sy*shear,py=sy*h*.50, pz=sz*d*.50+sx*tilt;
- const cx=w*(.025+random()*.11),cy=h*(.045+random()*.19),cz=d*(.015+random()*.045);
- vertices.push(new THREE.Vector3(px-sx*cx,py,pz),new THREE.Vector3(px,py-sy*cy,pz),
- new THREE.Vector3(px,py,pz-sz*cz));
- }
- const material=(wet?wetMaterials:materials)[blockId++%8];
- const mesh=new THREE.Mesh(new ConvexGeometry(vertices),material);
- mesh.name=name;mesh.position.set(x,y,z);mesh.rotation.z=(random()-.5)*.025;
- mesh.castShadow=true;mesh.receiveShadow=true;masonry.add(mesh);return mesh;
- };
- // A recessed backing fills small mortar joints without a bright earth leak.
- const backing=new THREE.Mesh(new THREE.BoxGeometry(3.10,2.05,.45),
- new THREE.MeshStandardMaterial({color:0x242820,roughness:.95}));
- backing.position.set(0,.8,-.30);backing.receiveShadow=true;masonry.add(backing);
- for(let row=0;row<7;row++) {
- let left=-1.65;
- while(left<1.65) {
- const w=Math.min(1.65-left,.36+random()*.32);if(w<.07)break;
- block('WetWeirCourse',left+w*.5,-.15+row*.295,-.23-random()*.025,w-.008,.28,.44,true);
- left+=w;
- }
- }
- // Coping sits below the six-centimetre water layer at the crest.
- for(let i=0;i<6;i++)block('SubmergedCoping',-1.10+(i+.5)*2.2/6,height-.145,-.34,
- 2.2/6-.005,.16,.76,true);
- for(const side of [-1,1]) {
- for(let row=0;row<8;row++) {
- let edge=1.15;
- while(edge<2.50) {
- const w=Math.min(2.50-edge,.30+random()*.36);if(w<.06)break;
- block('WeirAbutment',side*(edge+w*.5),-.10+row*.30,-.22-random()*.04,w,.282,.90+random()*.12);
- edge+=w;
- }
- }
- for(let j=0;j<3;j++)block('WornAbutmentCap',side*(1.36+j*.45),2.16,-.24,.46,.17,1.02);
- for(let i=0;i<4;i++)block('UpstreamWing',side*(1.43+i*.05),height+.15,-1.0-i*.54,.47,.52,.53);
- }
- scene.add(masonry);
-
- const stones=[];
- for(let i=0;i<59;i++) {
- const side=i%2?1:-1,z=-5+random()*14;
- const reference=closest(0,z,z<-.3?upperSamples:lowerSamples).sample;
- const x=reference.position.x+side*(reference.width*.5+.06+random()*.60);
- if(Math.abs(z)<.95)continue;
- const size=[.19+random()*.48,.13+random()*.30,.20+random()*.52];
- const stone=makeRock({type:i%5===0?'sandstone':'basalt',size,seed:310+i,detail:4,
- color:i%5===0?0x71674d:0x565b4a,moisture:.52,moss:.18,weathering:1.1});
- stone.position.set(x,heightAt(x,z)-size[1]*.24,z);stone.rotation.y=random()*6.28;
- scene.add(stone);stones.push({x,z,r:Math.max(size[0],size[2])*.48});
- }
- for(const [x,z,s] of [[-2.25,1.0,1.0],[2.62,.60,.8],[-2.55,-.55,.76],[2.9,-1.4,1.10]]) {
- const rock=makeRock({type:'sandstone',size:[s,s*.62,s*.8],seed:700+Math.round(s*100),
- detail:5,color:0x65624c,moisture:.32,moss:.35,weathering:1.3});
- rock.position.set(x,heightAt(x,z)-s*.20,z);rock.rotation.y=random()*6.28;scene.add(rock);
- stones.push({x,z,r:s*.48});
- }
- const meadow=makeMeadow({size:[17,23],height:.26,density:1400,maxBlades:230000,segments:4,seed:83,
- color:0x4c6428,bladeWidth:.014,dry:.12,ground:false,seedHeads:.002,heightAt,
- mask:(x,z)=>{
- const {offset}=closest(x,z,z<-.3?upperSamples:lowerSamples);
- let mask=smooth(.03,.46,offset)*(.70+.30*smooth(.15,.8,.5+2*fbm2(x*.8,z*.8,{seed:16})));
- mask*=1-smooth(.88,1,Math.max(Math.abs(x)/8.5,Math.abs(z)/11.5));
- if(Math.abs(x)<2.52&&z>-.76&&z<.34)return 0;
- if(Math.abs(Math.abs(x)-1.52)<.42&&z<-1&&z>-3.1)return 0;
- for(const rock of stones)mask*=smooth(rock.r*.45,rock.r,Math.hypot(x-rock.x,z-rock.z));
- return mask;
- },wind:{dir:[1,.4],strength:.56,speed:.7/1.2}});
- scene.add(meadow);
- const distantGrass=makeMeadow({size:[42,47],height:.22,density:100,maxBlades:50000,segments:3,seed:21,
- color:0x526332,bladeWidth:.018,dry:.16,ground:false,seedHeads:0,heightAt,
- mask:(x,z)=>smooth(.83,1,Math.max(Math.abs(x)/8.5,Math.abs(z)/11.5))*smooth(.10,.9,
- closest(x,z,z<-.3?upperSamples:lowerSamples).offset),
- wind:{dir:[1,.4],strength:.48,speed:.7/1.2}});
- scene.add(distantGrass);
- const plants=[];
- for(const [species,x,z,h,r,seed] of [
- ['willow',-4.4,-3.8,5.8,2.65,37],['birch',4.8,-6.4,6.7,2.0,83],
- ['oak',-7.5,-8.2,7.0,3.3,52],['birch',1.5,-11.0,5.8,1.9,73],
- ]) {
- const tree=makeTree({species,height:h,crownRadius:r,seed,leafDensity:.58,maxLeaves:species==='willow'?5200:3000,
- wind:{dir:[1,.4],strength:.24,speed:.7},shadows:true});
- tree.position.set(x,heightAt(x,z)-.06,z);scene.add(tree);plants.push(tree);
- }
- for(const [x,z,h,seed] of [[-3.0,-.5,1.25,10],[3.1,-2.2,1.5,18],[-3.1,3.4,.82,14],
- [4.4,1.5,1.15,48],[-6,-4.8,2.25,63],[3.8,-8.3,2.7,82]]) {
- const shrub=makeShrub({height:h,crownRadius:h*.67,seed,leafDensity:.42,maxLeaves:1600,
- wind:{dir:[1,.4],strength:.20,speed:.7}});
- shrub.position.set(x,heightAt(x,z)-.055,z);scene.add(shrub);plants.push(shrub);
- }
- return {scene,cameras:[
- {name:'basalt_falls',position:[3.3,2.0,4.9],lookAt:[0,.95,.35],fov:43},
- {name:'falling_film',position:[1.28,1.05,2.42],lookAt:[.02,.95,.48],fov:38},
- {name:'spillway_lip',position:[2.8,3.2,1.9],lookAt:[0,1.52,-.12],fov:42},
- {name:'woodland_weir',position:[4.6,2.6,7.0],lookAt:[-.2,1.30,-.4],fov:43},
- ],update(t,dt){
- waterfall.userData.update(t,dt);upstream.userData.update(t,dt);downstream.userData.update(t,dt);
- meadow.userData.update(t,dt);distantGrass.userData.update(t,dt);
- for(const plant of plants)plant.userData.update(t,dt);
- }};
-}
diff --git a/harness/examples/graphics_lab/scenes/workshop.js b/harness/examples/graphics_lab/scenes/workshop.js
deleted file mode 100644
index c0a14d64..00000000
--- a/harness/examples/graphics_lab/scenes/workshop.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/** A weathered workshop courtyard: masonry, worn metal, cloth and road detail. */
-import * as THREE from 'three';
-import * as MAT from '../lib/materials.js';
-import { clonePatchedMaterial } from '../lib/shader.js';
-import { patchDripStains, patchRust, patchDust } from '../lib/aging.js';
-import { patchMicroBreakup } from '../lib/surface_wear.js';
-import { patchRoadSurface, patchSeamBand, patchTracks } from '../lib/roadway.js';
-import { makeText, loadHelvetiker } from '../lib/signage.js';
-import { sunRig } from '../lib/environment.js';
-import { makeSky } from '../lib/sky.js';
-import { snapshotResources, attachDisposal } from '../lib/lifecycle.js';
-import { mulberry32 } from '../lib/noise.js';
-import { makePaving } from '../lib/paving.js';
-
-export async function createScene() {
- const scene=new THREE.Scene(),rand=mulberry32(62);
- const rig=sunRig({mood:'day',elevation:34,azimuth:138,bounds:22,disc:false});
- rig.sun.shadow.mapSize.set(4096,4096);rig.sun.shadow.normalBias=.012;
- scene.add(rig.sun,rig.fill);scene.environment=rig.envTex;
- makeSky(scene,{rig,turbidity:2.8});scene.fog=new THREE.FogExp2(0xc5bba5,.012);
- const own=material=>clonePatchedMaterial(material);
- const brick=own(MAT.brick({color:0x795343,bump:.012,roughness:.88}));
- patchDripStains(brick,{from:3.4,strength:.45,scale:.7,seed:19});
- patchDust(brick,{strength:.16,seed:9});
- const stone=own(MAT.travertine({color:0x929082,roughness:.94}));
- patchMicroBreakup(stone,{scale:.16,strength:.15,seed:13});
- const wood=own(MAT.weatheredWood({color:0x655341,roughness:.9}));
- patchDripStains(wood,{strength:.22,scale:.4,seed:23});
- const iron=new THREE.MeshStandardMaterial({color:0x777b78,roughness:.38,metalness:1});
- patchRust(iron,{strength:1,scale:.34,seed:8});
- patchDust(iron,{strength:.12,seed:48});
- const dark=new THREE.MeshStandardMaterial({color:0x181b1c,roughness:.94});
-
- // Planar world-metre UVs register courses across separately modelled piers.
- function box(name,size,position,material,rotation=0) {
- const g=new THREE.BoxGeometry(...size),p=g.attributes.position,n=g.attributes.normal,uv=g.attributes.uv;
- for(let i=0;i<p.count;i++){
- const x=p.getX(i)+position[0],y=p.getY(i)+position[1],z=p.getZ(i)+position[2];
- if(Math.abs(n.getY(i))>.5)uv.setXY(i,x,z);
- else if(Math.abs(n.getX(i))>.5)uv.setXY(i,z,y);
- else uv.setXY(i,x,y);
- }
- if(material===wood){
- const offset=rand(),along=rand();
- for(let i=0;i<uv.count;i++){
- const u=uv.getX(i),v=uv.getY(i);
- uv.setXY(i,(size[0]>size[1]?v:u)+offset,(size[0]>size[1]?u:v)+along);
- }
- }
- const mesh=new THREE.Mesh(g,material);mesh.name=name;mesh.position.set(...position);mesh.rotation.y=rotation;
- mesh.castShadow=true;mesh.receiveShadow=true;mesh.userData.placement='free';scene.add(mesh);return mesh;
- }
- const earth=own(MAT.soil({color:0x665e4c,roughness:.98,repeat:2}));
- box('CourtyardFoundation',[50,.25,50],[0,-.17,0],earth);
- box('LeftBrickPier',[3.35,3.65,.42],[-3.325,1.825,-3.25],brick);
- box('RightBrickPier',[3.35,3.65,.42],[3.325,1.825,-3.25],brick);
- box('DoorLintelBrick',[3.3,1.05,.42],[0,3.125,-3.25],brick);
- box('WorkshopSideWall',[.4,3.65,5.8],[-5.0,1.825,-6],brick);
- box('WorkshopOtherSide',[.4,3.65,5.8],[5.0,1.825,-6],brick);
- box('ShadowedBackWall',[10,3.5,.3],[0,1.7,-8.8],dark);
- box('WorkshopRoof',[10.65,.18,6.4],[0,3.8,-6.0],dark);
- box('RoofStoneCoping',[10.35,.13,.65],[0,3.7,-3.22],stone);
- box('StoneDoorLintel',[3.65,.25,.62],[0,2.72,-3.14],stone);
- box('DoorStep',[3.7,.16,1.0],[0,.07,-2.85],stone);
- for(const x of [-1.75,1.75])box('StoneDoorJamb',[.22,2.65,.6],[x,1.4,-3.13],stone);
- // A leaf left ajar reveals real interior depth and lets its hinges catch light.
- const leaf=new THREE.Group();leaf.position.set(-1.61,.16,-3.0);leaf.rotation.y=-.48;
- for(let i=0;i<7;i++){
- const board=box('DoorBoard',[.215,2.42,.065],[0,0,0],wood);
- scene.remove(board);leaf.add(board);board.position.set(.117+i*.23,1.21,0);
- }
- for(const y of [.35,1.95]){
- const strap=box('ForgedDoorStrap',[1.43,.085,.025],[0,0,0],iron);
- scene.remove(strap);leaf.add(strap);strap.position.set(.74,y,.055);
- }
- scene.add(leaf);
- const shutter=own(MAT.paintedWood({color:0x495a4a,roughness:.83}));
- patchDripStains(shutter,{strength:.4,scale:.24,seed:12});
- box('ShutterRecess',[2.2,1.45,.06],[-3.25,1.74,-2.994],dark);
- for(let i=0;i<10;i++)box('WindowShutterBoard',[.204,1.37,.045],[-4.25+i*.22,1.74,-2.941],shutter);
- for(const y of [1.22,2.26])box('ShutterBrace',[2.17,.055,.03],[-3.25,y,-2.903],iron);
- const pipe=new THREE.Mesh(new THREE.CylinderGeometry(.047,.047,3.5,16),iron);
- pipe.name='Downpipe';pipe.position.set(4.67,1.8,-2.94);pipe.castShadow=true;scene.add(pipe);
- for(let i=0;i<3;i++)box('InteriorTimberStack',[2.2,.22,.35],[.5,.24+i*.25,-4.6],wood,.08);
-
- // Real stones give the foreground a walkable profile and joint shadows.
- const yard=makePaving({size:[6.9,11],stoneSize:.24,joint:.009,thickness:.105,
- relief:.014,color:0x64625b,jointColor:0x514b3e,roughness:.89,seed:62});
- yard.position.set(-1.55,.035,2.4);scene.add(yard);
- const roadMat=new THREE.MeshStandardMaterial({color:0x4c4b46,roughness:.9});
- patchRoadSurface(roadMat,{aggregate:.62,wear:.68,patches:.28,gutter:.4,halfWidth:1.7,lane:3.4,seed:36});
- patchSeamBand(roadMat,{width:.26,weeds:.16});
- const road=box('ServiceLane',[3.4,.075,30],[3.65,-.025,3],roadMat);
- // Rotate the geometry's frame with the mesh: the road patch sees this axis.
- road.rotation.y=0;
- for(let i=0;i<22;i++)box('KerbStone',[.22,.18,.49],[1.86,.035,-2.9+i*.51],stone);
- const mud=new THREE.MeshStandardMaterial({color:0x5d5140,roughness:.95});
- patchMicroBreakup(mud,{scale:.13,strength:.22,seed:32});
- patchTracks(mud,{depth:.8,kind:'foot',count:1,offset:.1,seed:42});
- box('SoftVerge',[1.65,.052,12],[-5.5,-.015,2.3],mud);
-
- // Woven canvas has a sagged silhouette, hanging hem and a fine weave finish.
- const cloth=own(MAT.fabric({color:0x666b4d,repeat:5,bump:.0008,roughness:.94}));
- const clothGeo=new THREE.PlaneGeometry(3.2,1.25,48,18),cp=clothGeo.attributes.position;
- for(let i=0;i<cp.count;i++){
- const x=cp.getX(i),depth=cp.getY(i)+.625;
- cp.setXYZ(i,x,2.76-depth*.23-.13*Math.cos(x/3.2*Math.PI),-3+depth);
- }
- clothGeo.computeVertexNormals();const canopy=new THREE.Mesh(clothGeo,cloth);canopy.name='CanvasAwning';
- canopy.position.x=-3.25;canopy.castShadow=true;canopy.receiveShadow=true;cloth.side=THREE.DoubleSide;scene.add(canopy);
- for(const x of [-4.78,-1.72])box('AwningSupport',[.045,.045,1.45],[x,2.59,-2.43],iron);
- const hemGeometry=new THREE.PlaneGeometry(3.2,.12,48,1),hp=hemGeometry.attributes.position;
- for(let i=0;i<hp.count;i++){
- const x=hp.getX(i),drop=hp.getY(i)-.06;
- hp.setXYZ(i,x,2.4725-.13*Math.cos(x/3.2*Math.PI)+drop,-1.745);
- }
- hemGeometry.computeVertexNormals();const hem=new THREE.Mesh(hemGeometry,cloth);hem.position.x=-3.25;
- hem.name='AwningHem';hem.castShadow=true;scene.add(hem);
- // A small crate gives the fabric and iron real contact and human scale.
- for(let level=0;level<3;level++){
- for(const z of [-.14,.72])box('CrateSideBoard',[1.2,.18,.05],[-2.85,.18+level*.205,z],wood);
- for(const x of [-3.45,-2.25])box('CrateEndBoard',[.05,.18,.88],[x,.18+level*.205,.29],wood);
- }
- for(const x of [-3.4,-2.3])for(const z of [-.1,.68])box('CrateCorner',[.07,.66,.07],[x,.36,z],wood);
- const drum=new THREE.Mesh(new THREE.CylinderGeometry(.38,.37,.92,64,12),iron);
- drum.name='WeatheredSteelDrum';drum.position.set(-4.18,.47,-.23);drum.castShadow=true;drum.receiveShadow=true;scene.add(drum);
- for(const y of [.13,.44,.79]){
- const hoop=new THREE.Mesh(new THREE.TorusGeometry(.382,.015,8,64),iron);hoop.rotation.x=Math.PI/2;
- hoop.position.set(-4.18,y,-.23);hoop.castShadow=true;scene.add(hoop);
- }
- // Irregular chips settle against the kerb and masonry instead of floating.
- for(let i=0;i<36;i++){
- const x=i<20?1.56+rand()*.18:-4.75+rand()*.4,z=-2.5+rand()*9;
- box('LooseStoneChip',[.025+rand()*.065,.018+rand()*.025,.025+rand()*.06],
- [x,.055,z],stone,rand()*Math.PI);
- }
- const signBacking=box('SignBacking',[2.6,.42,.07],[-3.3,3.17,-2.98],dark);
- const font=await loadHelvetiker();
- const sign=await makeText('RIVER WORKSHOP',{font,size:.18,depth:.006,color:0xc3ba97});
- sign.position.set(-3.3,3.10,signBacking.position.z+.045);scene.add(sign);
- scene.userData.grade={exposure:1.0,contrast:1.035,saturation:.96};
- const resources=snapshotResources(scene);resources.add(rig.envTex);
- // Delegate nested effect ownership so their individual disposal guards
- // remain correct when a caller removes one before closing the scene.
- for(const effect of [yard,sign]){
- for(const resource of snapshotResources(effect))resources.delete(resource);
- resources.add({dispose:()=>effect.userData.dispose()});
- }
- attachDisposal(scene,resources);
- return {scene,cameras:[
- {name:'courtyard',position:[7.6,3.6,9.5],lookAt:[-1.0,1.05,-1.2],fov:48},
- {name:'masonry_and_cloth',position:[-5.15,2.02,.9],lookAt:[-3.12,1.91,-2.65],fov:49},
- {name:'stone_and_tracks',position:[-.8,.65,6.5],lookAt:[1.2,.15,1.5],fov:51},
- {name:'rust_and_grain',position:[-3.35,1.05,1.35],lookAt:[-3.7,.75,-.12],fov:45},
- ],update(){},dispose(){scene.userData.dispose();}};
-}
diff --git a/harness/examples/graphics_lab/serve.mjs b/harness/examples/graphics_lab/serve.mjs
deleted file mode 100644
index a5b21cae..00000000
--- a/harness/examples/graphics_lab/serve.mjs
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env node
-import fs from 'node:fs';
-import path from 'node:path';
-import {fileURLToPath} from 'node:url';
-import {parseArgs} from 'node:util';
-import {createRequire} from 'node:module';
-const require = createRequire(import.meta.url);
-const {serveDirs} = require('../../runtime_js/serve.cjs');
-const here = path.dirname(fileURLToPath(import.meta.url));
-const {values} = parseArgs({options:{out:{type:'string', default:path.join(here,'output')}}});
-const root = path.resolve(values.out);
-if (!fs.existsSync(path.join(root,'index.html'))) throw new Error('Run build.py first');
-const server = await serveDirs({root, routes:{'/':{body:fs.readFileSync(path.join(root,'index.html'),'utf8')}}});
-console.log(`Graphics Lab: ${server.base}/`);
-for (const signal of ['SIGINT','SIGTERM']) process.on(signal, async()=>{await server.close();process.exit(0);});
diff --git a/harness/examples/graphics_lab/shaders/external_shader.frag b/harness/examples/graphics_lab/shaders/external_shader.frag
deleted file mode 100644
index 1de08c4e..00000000
--- a/harness/examples/graphics_lab/shaders/external_shader.frag
+++ /dev/null
@@ -1,47 +0,0 @@
-uniform float uTime;
-uniform float uRoughness;
-uniform float uFilmStrength;
-uniform vec3 uBaseReflectance;
-in vec3 alloyObjectPosition;
-in vec3 alloyViewPosition;
-in vec3 alloyViewNormal;
-out vec4 alloyOutput;
-
-void main() {
- vec3 p = alloyObjectPosition;
- vec3 n = normalize(alloyViewNormal);
- vec3 v = normalize(-alloyViewPosition);
- float forging = alloyNoise(p * 19.0) + 0.4 * alloyNoise(p * 47.0);
- float brushPhase = p.y * 380.0 + sin(p.x * 4.0) * 5.0;
- float brushFilter = exp(-0.8 * pow(fwidth(brushPhase), 2.0));
- float height = forging * 0.0005 + sin(brushPhase) * brushFilter * 0.000035;
-
- // Surface-gradient normal relief, with a finite grazing-angle fallback.
- vec3 dx = dFdx(alloyViewPosition), dy = dFdy(alloyViewPosition);
- vec3 r1 = cross(dy, n), r2 = cross(n, dx);
- float determinant = dot(dx, r1);
- if (abs(determinant) > 1e-10) {
- vec3 gradient = (dFdx(height) * r1 + dFdy(height) * r2) / determinant;
- n = normalize(n - gradient);
- }
- float roughness = clamp(uRoughness + (forging - 0.7) * 0.06, 0.16, 0.7);
- float phase = p.y * 1.45 + p.x * 0.22 + 0.30 * sin(uTime * 0.55)
- + pow(clamp(1.0 - dot(n, v), 0.0, 1.0), 1.5) * 1.8;
- vec3 film = 0.47 + 0.30 * cos(phase * 3.2 + vec3(0.0, 2.0, 4.0));
- vec3 f0 = mix(uBaseReflectance, film, uFilmStrength);
- vec3 worldN = normalize(transpose(mat3(viewMatrix)) * n);
- vec3 worldV = normalize(transpose(mat3(viewMatrix)) * v);
- vec3 reflected = reflect(-worldV, worldN);
- vec3 colour = alloyStudio(reflected, roughness) * alloyFresnel(f0, max(dot(n, v), 0.0));
- colour += alloyGgx(n, v, normalize(mat3(viewMatrix) * vec3(-3, 4, 3)), f0,
- roughness, vec3(1.6, 1.3, 0.95));
- colour += alloyGgx(n, v, normalize(mat3(viewMatrix) * vec3(4, 2, -3)), f0,
- roughness, vec3(0.45, 0.7, 1.3));
- alloyOutput = vec4(colour, 1.0);
- // These standard output chunks use the host's fixed tone/exposure policy.
- // GLSL3 names the fragment output explicitly; no gl_FragColor alias is used.
- #ifdef TONE_MAPPING
- alloyOutput.rgb = toneMapping(alloyOutput.rgb);
- #endif
- alloyOutput = linearToOutputTexel(alloyOutput);
-}
diff --git a/harness/examples/graphics_lab/shaders/external_shader.vert b/harness/examples/graphics_lab/shaders/external_shader.vert
deleted file mode 100644
index 4a6d2b84..00000000
--- a/harness/examples/graphics_lab/shaders/external_shader.vert
+++ /dev/null
@@ -1,13 +0,0 @@
-// ShaderMaterial supplies position/normal and the camera/object matrices.
-// glslVersion: THREE.GLSL3 owns the version directive.
-out vec3 alloyObjectPosition;
-out vec3 alloyViewPosition;
-out vec3 alloyViewNormal;
-
-void main() {
- vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);
- alloyObjectPosition = position;
- alloyViewPosition = viewPosition.xyz;
- alloyViewNormal = normalize(normalMatrix * normal);
- gl_Position = projectionMatrix * viewPosition;
-}
diff --git a/harness/examples/graphics_lab/shaders/external_shader_common.glsl b/harness/examples/graphics_lab/shaders/external_shader_common.glsl
deleted file mode 100644
index 923e05d3..00000000
--- a/harness/examples/graphics_lab/shaders/external_shader_common.glsl
+++ /dev/null
@@ -1,62 +0,0 @@
-// Reusable source fragment, explicitly joined before external_shader.frag.
-// A compact direct GGX lobe and authored studio environment. The colour phase
-// is an artistic thin-film accent, not a multilayer optical solver.
-const float ALLOY_PI = 3.141592653589793;
-
-float alloyHash(vec3 p) {
- p = fract(p * 0.1031);
- p += dot(p, p.yzx + 33.33);
- return fract((p.x + p.y) * p.z);
-}
-
-float alloyNoise(vec3 p) {
- vec3 i = floor(p), f = fract(p);
- f = f * f * (3.0 - 2.0 * f);
- return mix(mix(mix(alloyHash(i), alloyHash(i + vec3(1, 0, 0)), f.x),
- mix(alloyHash(i + vec3(0, 1, 0)), alloyHash(i + vec3(1, 1, 0)), f.x), f.y),
- mix(mix(alloyHash(i + vec3(0, 0, 1)), alloyHash(i + vec3(1, 0, 1)), f.x),
- mix(alloyHash(i + vec3(0, 1, 1)), alloyHash(i + vec3(1)), f.x), f.y), f.z);
-}
-
-vec3 alloyFresnel(vec3 f0, float cosine) {
- float x = clamp(1.0 - cosine, 0.0, 1.0);
- float x2 = x * x;
- return f0 + (1.0 - f0) * x2 * x2 * x;
-}
-
-vec3 alloyGgx(vec3 n, vec3 v, vec3 l, vec3 f0, float roughness, vec3 radiance) {
- vec3 halfVector = v + l;
- vec3 h = halfVector / max(length(halfVector), 0.0001);
- float nv = max(dot(n, v), 0.0001), nl = max(dot(n, l), 0.0);
- float nh = max(dot(n, h), 0.0), vh = max(dot(v, h), 0.0);
- float alpha = roughness * roughness, a2 = alpha * alpha;
- float denominator = nh * nh * (a2 - 1.0) + 1.0;
- float distribution = a2 / max(ALLOY_PI * denominator * denominator, 0.00001);
- float visibility = 0.5 / max(nl * sqrt(nv * nv * (1.0 - a2) + a2)
- + nv * sqrt(nl * nl * (1.0 - a2) + a2), 0.0001);
- return radiance * nl * distribution * visibility * alloyFresnel(f0, vh);
-}
-
-float alloySoftbox(vec3 r, vec3 center, vec3 across, vec2 halfSize, float blur) {
- vec3 axis = normalize(center);
- vec3 right = normalize(cross(axis, across));
- vec3 up = cross(right, axis);
- float facing = dot(r, axis);
- vec2 uv = vec2(dot(r, right), dot(r, up)) / max(facing, 0.001);
- vec2 edge = abs(uv) - halfSize;
- float border = max(edge.x, edge.y);
- return (1.0 - smoothstep(-blur, blur, border)) * smoothstep(0.0, 0.2, facing);
-}
-
-vec3 alloyStudio(vec3 r, float roughness) {
- vec3 colour = mix(vec3(0.11, 0.12, 0.14), vec3(0.34, 0.39, 0.46),
- smoothstep(-0.2, 0.8, r.y));
- float blur = 0.065 + roughness * roughness * 1.2;
- colour += vec3(2.8, 2.4, 1.9) * alloySoftbox(r, vec3(-3, 4, 3),
- vec3(0, 1, 0), vec2(0.22, 0.78), blur);
- colour += vec3(1.0, 1.55, 2.4) * alloySoftbox(r, vec3(4, 2, -3),
- vec3(0, 1, 0), vec2(0.12, 0.9), blur);
- colour += vec3(0.9) * alloySoftbox(r, vec3(0, 5, -1),
- vec3(1, 0, 0), vec2(0.8, 0.14), blur);
- return colour;
-}
diff --git a/harness/examples/graphics_lab/viewer.css b/harness/examples/graphics_lab/viewer.css
deleted file mode 100644
index 75ef23fb..00000000
--- a/harness/examples/graphics_lab/viewer.css
+++ /dev/null
@@ -1 +0,0 @@
-:root{color-scheme:dark;--bg:#10120f;--panel:#1a1d18;--ink:#eef0e4;--dim:#989e91;--line:#353b30;--accent:#d7e9a2}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.6 system-ui,sans-serif}header,footer{display:flex;justify-content:space-between;align-items:center;margin:0 5vw;padding:28px 0;border-bottom:1px solid var(--line);font-size:11px;letter-spacing:1.4px}.brand{font-weight:650;text-decoration:none;color:var(--ink)}.brand span{color:var(--dim);margin-left:10px}.edition{color:var(--dim)}main{max-width:1500px;margin:auto;padding:0 5vw 80px}.intro{padding:65px 0 48px;max-width:690px}.eyebrow{color:var(--accent);font-size:10px;letter-spacing:2px;font-weight:600}h1{font-size:clamp(32px,5vw,58px);letter-spacing:-2px;font-weight:450;margin:16px 0}h2{font-size:34px;font-weight:450;margin:2px 0}.intro>p:last-child,#subtitle,#hint{color:var(--dim);font-size:14px}.intro>p:last-child{max-width:560px}#gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:36px 24px}.card{border:0;padding:0;background:none;text-align:left;color:var(--ink);cursor:pointer}.thumbnail{position:relative;aspect-ratio:16/9;background:var(--panel);overflow:hidden;border-radius:3px}.thumbnail img{width:100%;height:100%;object-fit:cover;transition:transform .45s}.card:hover img{transform:scale(1.035)}.play{position:absolute;right:18px;bottom:18px;border:1px solid #ffffff65;background:#1118;backdrop-filter:blur(6px);width:40px;height:40px;display:grid;place-items:center;border-radius:50%;font-size:13px}.caption{display:flex;gap:17px;padding:17px 0}.number{font:11px monospace;color:var(--dim);padding-top:5px}.caption h3{font-size:20px;font-weight:450;letter-spacing:-.3px;margin:0}.caption p{font-size:12px;margin:3px 0;color:var(--dim)}.stage-heading{display:flex;justify-content:space-between;align-items:center;margin:42px 0 24px}button,select{font:inherit}button.quiet{border:1px solid var(--line);background:none;color:var(--ink);padding:9px 14px;font-size:12px;cursor:pointer}#screen{position:relative;aspect-ratio:16/9;background:#060706;border:1px solid var(--line)}video,#live,canvas{width:100%;height:100%;display:block}#live[hidden],video[hidden],[hidden]{display:none!important}#status{position:absolute;top:45%;left:0;width:100%;text-align:center;pointer-events:none;color:var(--dim)}.toolbar{display:flex;align-items:center;gap:20px;flex-wrap:wrap;padding:18px 0;border-bottom:1px solid var(--line);font-size:12px}.tabs{display:flex;background:var(--panel);padding:4px}.tabs button,.live-controls button{border:0;background:transparent;color:var(--dim);padding:8px 14px;cursor:pointer}.tabs .active{background:var(--line);color:var(--ink)}.toolbar a{margin-left:auto;color:var(--dim);text-decoration:none}.live-controls{display:flex;gap:16px;align-items:center}.live-controls label{display:flex;gap:7px;align-items:center}select{max-width:130px;background:var(--panel);color:var(--ink);border:1px solid var(--line);padding:6px}input[type=range]{width:110px;accent-color:var(--accent)}output{font:11px monospace;color:var(--dim)}#hint{font-size:12px}footer{margin-top:10px;border-top:1px solid var(--line);border-bottom:0;color:var(--dim)}@media(max-width:750px){.edition{display:none}.intro{padding:40px 0 32px}#gallery{grid-template-columns:1fr;gap:24px}h2{font-size:25px}.live-controls{gap:8px;flex-wrap:wrap}.stage-heading{gap:15px}footer{font-size:9px;gap:20px}.toolbar{gap:12px}}
diff --git a/harness/examples/graphics_lab/viewer.js b/harness/examples/graphics_lab/viewer.js
deleted file mode 100644
index 1ebf066e..00000000
--- a/harness/examples/graphics_lab/viewer.js
+++ /dev/null
@@ -1,244 +0,0 @@
-import * as THREE from 'three';
-import {OrbitControls} from 'three/addons/controls/OrbitControls.js';
-import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
-import {makeRenderer} from '/__runtime/lib/browser/renderer.js';
-import {makePostChain} from '/__runtime/lib/browser/post.js';
-
-const $ = (selector) => document.querySelector(selector);
-const manifest = await (await fetch('./manifest.json')).json();
-let current, bundle, camera, controls;
-let running = false, time = 0, last = 0, bootSerial = 0;
-
-for (const item of manifest.cases) {
- const card = document.createElement('button');
- card.className = 'card';
- const thumb = document.createElement('div');
- thumb.className = 'thumbnail';
- const img = document.createElement('img');
- img.src = `./${item.id}.png`;
- img.alt = item.subtitle;
- const play = document.createElement('span');
- play.className = 'play';
- play.textContent = '▶';
- thumb.append(img, play);
- const caption = document.createElement('div');
- caption.className = 'caption';
- const num = document.createElement('span');
- num.className = 'number';
- num.textContent = item.number;
- const copy = document.createElement('div');
- const title = document.createElement('h3');
- title.textContent = item.title;
- const subtitle = document.createElement('p');
- subtitle.textContent = item.subtitle;
- copy.append(title, subtitle);
- caption.append(num, copy);
- card.append(thumb, caption);
- card.onclick = () => open(item);
- $('#gallery').append(card);
-}
-
-function disposeBundle(value) {
- if (!value || value.disposed) return;
- value.disposed = true;
- const errors = [];
- const attempt = operation => {
- try { operation(); } catch (error) { errors.push(error); }
- };
- const result = value.result;
- attempt(() => {
- if (typeof result?.dispose === 'function') {
- // An explicit scene disposer is authoritative about owned resources.
- result.dispose();
- } else if (result?.scene?.isObject3D) {
- const unmanaged = new Set(), protectedResources = new Set(), owners = [];
- const collect = (object, resources) => {
- if (object.geometry) resources.add(object.geometry);
- if (object.isInstancedMesh) resources.add(object);
- for (const material of [].concat(object.material || [],
- object.customDepthMaterial || [], object.customDistanceMaterial || [])) {
- if (material) resources.add(material);
- }
- };
- const visit = object => {
- if (typeof object.userData?.dispose === 'function') {
- // Do not cross an ownership boundary: it may contain borrowed assets
- // or later caller attachments that its disposer deliberately leaves.
- owners.push(() => object.userData.dispose());
- object.traverse(child => collect(child, protectedResources));
- } else {
- collect(object, unmanaged);
- object.children.forEach(visit);
- }
- };
- visit(result.scene);
- owners.forEach(attempt);
- for (const resource of unmanaged) {
- // A resource can also be referenced outside the subtree that owns it.
- // Cached materials and all textures remain borrowed by this fallback.
- if (!protectedResources.has(resource) && !resource.userData?.shared && !resource.userData?.astraShared) {
- attempt(() => resource.dispose());
- }
- }
- }
- });
- // The production post chain has no disposal API. Release its entire context.
- // Each new scene gets a NEW canvas; a lost context cannot safely be reused.
- attempt(() => value.renderer?.dispose());
- attempt(() => value.renderer?.forceContextLoss());
- attempt(() => value.canvas?.remove());
- if (errors.length) console.warn('Scene cleanup failed', new AggregateError(errors, 'Scene cleanup failed'));
-}
-
-function release() {
- running = false;
- const previousControls = controls, previousBundle = bundle;
- controls = null;
- bundle = null;
- try { previousControls?.dispose(); }
- catch (error) { console.warn('Camera controls cleanup failed', error); }
- disposeBundle(previousBundle);
-}
-
-function open(item) {
- bootSerial++;
- release();
- current = item;
- time = 0;
- $('.intro').hidden = true;
- $('#gallery').hidden = true;
- $('#stage').hidden = false;
- $('#title').textContent = item.title;
- $('#subtitle').textContent = item.subtitle;
- $('#category').textContent = `${item.number} / ${item.kind.toUpperCase()}`;
- $('#still').href = `./${item.id}.png`;
- $('#video').src = `./${item.id}.mp4`;
- $('#video').poster = `./${item.id}.png`;
- watch();
- window.scrollTo({top: 0, behavior: 'smooth'});
-}
-
-function watch() {
- bootSerial++; // Cancel a pending asynchronous live scene boot.
- running = false;
- $('#live').hidden = true;
- $('#video').hidden = false;
- $('.live-controls').hidden = true;
- $('#watch').classList.add('active');
- $('#explore').classList.remove('active');
- $('#status').textContent = '';
- $('#video').play().catch(() => {});
-}
-
-async function explore() {
- $('#video').pause();
- $('#video').hidden = true;
- $('#live').hidden = false;
- $('.live-controls').hidden = false;
- $('#explore').classList.add('active');
- $('#watch').classList.remove('active');
- $('#pause').textContent = 'Pause';
- if (bundle) { running = true; return; }
- $('#status').textContent = 'Preparing scene…';
- const serial = ++bootSerial;
- const item = current;
- let pending;
- try {
- const mod = await import(item.module);
- if (serial !== bootSerial) return;
- const width = Math.min(1600, Math.round($('#screen').clientWidth));
- const height = Math.round(width * 9 / 16);
- const canvas = document.createElement('canvas');
- canvas.id = 'canvas';
- const renderer = makeRenderer(canvas, width, height);
- pending = {canvas, renderer};
- const manager = new THREE.LoadingManager();
- const loaders = {
- gltf: new GLTFLoader(manager), texture: new THREE.TextureLoader(manager),
- cube: new THREE.CubeTextureLoader(manager), manager,
- };
- pending.result = await mod.createScene({THREE, renderer, loaders});
- if (serial !== bootSerial) { disposeBundle(pending); return; }
- const {scene, cameras, update} = pending.result || {};
- if (!scene?.isScene || !cameras?.length || typeof update !== 'function') {
- throw new Error('Scene does not implement the scene contract');
- }
- pending.post = makePostChain(renderer, scene, {width, height});
- bundle = pending;
- $('#live').replaceChildren(canvas);
- camera = new THREE.PerspectiveCamera(45, width / height, .04, 3000);
- controls = new OrbitControls(camera, canvas);
- controls.enableDamping = true;
- $('#camera').replaceChildren();
- cameras.forEach((spec, index) => {
- const option = document.createElement('option');
- option.value = index;
- option.textContent = spec.name;
- $('#camera').append(option);
- });
- setCamera(0);
- update(time, 0);
- pending.post.render(camera);
- $('#status').textContent = '';
- running = true;
- } catch (error) {
- disposeBundle(pending);
- if (serial !== bootSerial) return;
- release();
- $('#status').textContent = `Scene could not load: ${error.message}`;
- console.error(error);
- }
-}
-
-function setCamera(index) {
- const spec = bundle?.result.cameras[index];
- if (!spec) return;
- camera.position.fromArray(spec.position);
- camera.fov = spec.fov ?? 45;
- camera.updateProjectionMatrix();
- controls.target.fromArray(spec.lookAt);
- controls.update();
-}
-
-$('#watch').onclick = watch;
-$('#explore').onclick = explore;
-$('#camera').onchange = event => setCamera(Number(event.target.value));
-$('#pause').onclick = () => {
- running = !running;
- $('#pause').textContent = running ? 'Pause' : 'Resume';
-};
-$('#time').oninput = event => {
- time = Number(event.target.value);
- bundle?.result.update(time, 0);
-};
-$('#close').onclick = () => {
- bootSerial++;
- release();
- $('#video').pause();
- $('#video').removeAttribute('src');
- $('#stage').hidden = true;
- $('.intro').hidden = false;
- $('#gallery').hidden = false;
-};
-$('#video').onerror = () => {
- // A late film error must not overwrite a live scene's boot failure.
- if (!$('#video').hidden) $('#status').textContent = 'Choose “Explore live” to view this scene.';
-};
-
-function frame(now) {
- requestAnimationFrame(frame);
- const dt = Math.min((now - last) / 1000, .05);
- last = now;
- if (!bundle || $('#live').hidden) return;
- if (running) {
- time += dt;
- bundle.result.update(time, dt);
- }
- controls.update();
- bundle.post.refreshGrade();
- bundle.post.render(camera);
- $('#time').value = Math.min(time, 20);
- $('#seconds').textContent = `${time.toFixed(2)} s`;
-}
-requestAnimationFrame(frame);
-