Skip to content

Official Codebase of 3DCodeVerse

Python

docs: keep only what running the harness needs in the tracked harness docs

gaoypeng8a2695926e55
diff --git a/.gitignore b/.gitignore
index edcfa17e..ce00b3de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,8 @@ dist/
/harness/docs/COST.md
/harness/docs/DECISIONS.md
/harness/docs/SKILLS_LEDGER.md
+/harness/docs/INTERFACES.md
+/harness/docs/HISTORY.md
# Developer-only visual studies; agents use the production starter library.
/harness/examples/graphics_lab/
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.md
index c3b0be47..4fdd032b 100644
--- a/harness/CLAUDE.md
+++ b/harness/CLAUDE.md
@@ -14,13 +14,14 @@ It does not implement an agent loop: the in-process `api-agent` was deleted
this project's job). Plus a 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), `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.
+really does, known limits), `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 cost experiments, decision logs, skill measurements, the cross-package signature
+notes and the pre-trim docs are local-only notes (COST.md, DECISIONS.md, SKILLS_LEDGER.md,
+INTERFACES.md and HISTORY.md under harness/docs, ignored by Git; the tracked docs carry only
+what running the harness needs).
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.
diff --git a/harness/README.md b/harness/README.md
index 6cbe2844..b5ad0e40 100644
--- a/harness/README.md
+++ b/harness/README.md
@@ -89,6 +89,5 @@ Expected cost and time per track: `docs/RUNBOOK.md` §2. Inspect actual run cost
`3dcode cost <slug>` and a call's expected price with `3dcode cost estimate`.
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/ARCHITECTURE.md` (design + what a run does) · `docs/RUNBOOK.md` (operate / extend) ·
`eval/docs/EVAL.md` (evaluation protocol + judge calibration) · `CLAUDE.md` (working rules).
diff --git a/harness/codeverse3d/agents/backends.py b/harness/codeverse3d/agents/backends.py
index 16577a76..72dccde3 100644
--- a/harness/codeverse3d/agents/backends.py
+++ b/harness/codeverse3d/agents/backends.py
@@ -118,7 +118,7 @@ class ClaudeStream:
Since 2026-09-22 the backend streams instead of printing one envelope: the envelope
(the last, ``type == "result"`` line) is unchanged, and the lines before it are the
- only record of which skills the session activated (docs/SKILLS.md §9 — "the logs
+ only record of which skills the session activated (docs/SKILLS.md §4 — "the logs
contain zero occurrences of any c3d- name" under ``--output-format json``)."""
def __init__(self) -> None:
diff --git a/harness/codeverse3d/agents/cli_common.py b/harness/codeverse3d/agents/cli_common.py
index 9e6ebae2..05fa3ac1 100644
--- a/harness/codeverse3d/agents/cli_common.py
+++ b/harness/codeverse3d/agents/cli_common.py
@@ -680,7 +680,7 @@ def watchdog_error(proc: CompletedProc) -> str:
#: :data:`TOOL_TRACE_ROW` saying "this session's calls are all here" — a session without
#: it left no trace, and its silence must not read as "called nothing". The skill read
#: probe (``skills/telemetry.py``) reads these rows instead of file atimes, which its own
-#: control bundle caught "reading" in 27 of 33 sessions (docs/SKILLS.md §9). Arguments are
+#: control bundle caught "reading" in 27 of 33 sessions (docs/SKILLS.md §4). Arguments are
#: compacted to :data:`TRACE_ARG_CHARS` per value: a path survives, a file body does not.
TOOL_CALL_ROW = "tool_call"
TOOL_TRACE_ROW = "tool_trace"
diff --git a/harness/codeverse3d/models/gemini.py b/harness/codeverse3d/models/gemini.py
index 0079afd8..37d7cd17 100644
--- a/harness/codeverse3d/models/gemini.py
+++ b/harness/codeverse3d/models/gemini.py
@@ -45,7 +45,7 @@ from codeverse3d.models.pricing import estimate_cost
from codeverse3d.models.retry import KeyPool, KeyPoolExhausted, OnAttempt, _Try, rotate_with_retries
from codeverse3d.models.schema_utils import JsonParseError, parse_json_lenient, to_gemini_schema
-#: INTERFACES.md mapping; ``off`` → 0 where the model allows it
+#: thinking level → token budget; ``off`` → 0 where the model allows it
THINKING_BUDGET: dict[str, int] = {"off": 0, "low": 1024, "medium": 4096, "high": 16384}
#: finish reasons that are worth one more attempt (transient model glitches)
diff --git a/harness/codeverse3d/skills/telemetry.py b/harness/codeverse3d/skills/telemetry.py
index b607ca00..895f72c4 100644
--- a/harness/codeverse3d/skills/telemetry.py
+++ b/harness/codeverse3d/skills/telemetry.py
@@ -17,7 +17,7 @@ deep is still deep when a file under its ``references/`` was opened and the cont
2.1.317 read them with ``cd …/<name> && … cat "$f"`` (live, 2026-11-03), a call that names
no path to match. Only when a session after the attach left
no trace does the probe fall back to the atime signals below, which the control proved
-blind in 27 of 33 sessions (docs/SKILLS.md §9):
+blind in 27 of 33 sessions (docs/SKILLS.md §4):
1. **atime probe** — the root filesystem is ext4 with ``relatime``, where the first read
after a write bumps ``atime``. ``materialize_skills`` stamps ``atime == mtime`` on
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 92501224..4ba0143d 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -1,77 +1,69 @@
# 3dcodeverse harness — architecture
-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 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`.
+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.
+How-to is in `docs/RUNBOOK.md`, the run directory in `docs/RUN_LAYOUT.md`, the skill library in
+`docs/SKILLS.md`, the evaluation protocol in `eval/docs/EVAL.md`.
## 0. What it is
-A data-flywheel harness in which LLMs write **raw executable 3D code** — no SDK
-layered on top of the language — for four **tracks**:
+A data-flywheel harness in which LLMs write **raw executable 3D code** — no SDK layered on top
+of the language — for four **tracks**:
| track | languages | deliverable |
|---|---|---|
| `static_object` | `blender` (bpy), `cadquery`, `threejs` | code + canonical `object.glb` (+stl/step) |
| `articulated_object` | `urdf_blender` (bpy link meshes + hand-written URDF) | code + `robot.urdf` + `meshes/*.glb` (raw link frames) + `object.glb` (node hierarchy with joint extras) |
-| `scene` | `scene_threejs` (multi-file three.js + GLSL; optional bpy-built GLB assets) | `src/**` + `public/assets/*.glb` + renders + probes |
+| `scene` | `scene_threejs` (multi-file three.js + GLSL; optional bpy-built GLB assets), `scene_blender` (bpy on a harness-owned library) | `src/**` + `public/assets/*.glb` + renders + probes |
| `graphics` | `glsl_shader` (Shadertoy-style fragment shader), `opengl_python` (raw moderngl + GLSL, multi-pass) | shader/program source + judged animation frames + sheet + GIF + frame metrics |
-…driven by **any** of these backends behind two protocols:
-
-* `ChatModel` (API): `gemini:*`, `anthropic:*`, `openai:*` — planner, judge,
- captioner, single-shot generation.
-* `CodingAgent` (agentic session on a workspace): always a vendor CLI —
- `agy:*` (Antigravity — Google's models, in Gemini-API mode with pool keys + MCP),
- `claude-code:*`, `codex:*`; the in-process `api-agent` was deleted 2026-08-28 and
- `gemini-cli:*` on 2026-10-13 (D103). Plus `single-shot:<chat-model>` (one envelope
- of files, no tools) handled inside `tracks/generation.py`.
-
-Every run is: **spec → plan → skeleton → [scene stages] → baseline round
-(optionally best-of-N candidates) → `max_rounds` refine rounds → finalise → record**.
-Which round to hand over is decided AFTER the run, by the `addons/select` reader
-(`3dcode pick`; `3dcode make` calls it by score): it writes `deliverable/` for that
-round. The record (plus git history of
-`src/` and every round's kept build) is the flywheel unit.
-
-## 1. Design laws (from the reference post-mortems)
-
-1. **Code is truth; artifacts are derived.** Raw code in `src/` is the
- deliverable; GLB/renders are regenerated from it. Every round is a commit and
- keeps its own built files under `artifacts/rNN/`, so any round can be handed over
- without a rebuild; the workspace ends at the last round.
-2. **Requirements, never templates (D106 scene track, D107 every track, owner 2026-10-15).**
- The harness states what must be true, where, and how it is measured — interface (the files and
- functions the wrapper calls, frames / units / naming), sandbox rules, and measured requirements
- with their thresholds (bbox / dims / connectivity / joint / part-naming contracts, triangle
- budgets) — and never a mandated shape, count, construction, layout or code structure the brief
- did not ask for. No language ships a cookbook; each `contract.md` keeps ONE executable interface
- example (`tests/prompts/test_snippets_run.py` runs it), the craft is a few short optional
- practices in the skills, and no code block in a prompt or skill is over ~12 lines (60 argon
- scenes of one shape were the inlined chapters executed verbatim).
-3. **Code answers when code can answer.** Deterministic gates / measurements run
- by the harness; the VLM is used only for perception and judgement, and its
- score is computed in code from rubric weights.
-4. **Move responsibility out of agent code**: export wrappers, camera rigs,
- placement validation, URDF composition math, scene assembly, GLSL headers.
-5. **Evidence-based acceptance.** Every plan carries an acceptance checklist;
- items are proved by measurements/probes/judge votes, not prose.
-6. **Typed everything.** One contracts package; no regex-on-id control flow, no
- stringly-typed dicts, no god files (cap 2 000 lines per file, 3 000 absolute; owner 2026-08-28).
- A merge must delete code, not merely move it.
+…driven by any of these backends behind two protocols:
+
+* `ChatModel` (API): `gemini:*`, `anthropic:*`, `openai:*` — planner, judge, captioner,
+ single-shot generation.
+* `CodingAgent` (agentic session on a workspace): always a vendor CLI — `agy:*` (Antigravity,
+ Google's models, Gemini-API mode with pool keys + MCP), `claude-code:*`, `codex:*`. Plus
+ `single-shot:<chat-model>` (one envelope of files, no tools) handled inside
+ `tracks/generation.py`. The harness implements no agent loop of its own.
+
+Every run is: **spec → plan → skeleton → [scene stages] → baseline round (optionally best-of-N
+candidates) → `max_rounds` refine rounds → finalise → record**. Which round to hand over is
+decided AFTER the run by the `addons/select` reader (`3dcode pick`; `3dcode make` calls it by
+score): it writes `deliverable/` for that round. The record, the git history of `src/` and every
+round's kept build are the flywheel unit.
+
+## 1. Design laws
+
+1. **Code is truth; artifacts are derived.** Raw code in `src/` is the deliverable; GLB/renders
+ are regenerated from it. Every round is a commit and keeps its own build under
+ `artifacts/rNN/`, so any round can be handed over without a rebuild.
+2. **Requirements, never templates.** The harness states what must be true, where, and how it is
+ measured — interface (files, functions, frames / units / naming), sandbox rules, measured
+ thresholds — never a mandated shape, count, layout or code structure the brief did not ask
+ for. No language ships a cookbook; each `contract.md` keeps ONE executable interface example
+ (`tests/prompts/test_snippets_run.py` runs it), the craft is a few short optional practices in
+ the skills, and no code block in a prompt or skill is over ~12 lines.
+3. **Code answers when code can answer.** Deterministic gates / measurements run by the harness;
+ the VLM is used only for perception and judgement, and its score is computed in code from
+ rubric weights.
+4. **Move responsibility out of agent code**: export wrappers, camera rigs, placement validation,
+ URDF composition math, scene assembly, GLSL headers.
+5. **Evidence-based acceptance.** Every plan carries an acceptance checklist; items are proved by
+ measurements / probes / judge votes, not prose.
+6. **Typed everything.** One contracts package; no regex-on-id control flow, no stringly-typed
+ dicts, no god files (cap 2 000 lines per file, 3 000 absolute). A merge must delete code, not
+ merely move it.
7. **Cheap first.** Lint → build → deterministic gates → montaged views → VLM.
-8. **Separate generator from judge.** The judge sees spec + renders +
- measurements + acceptance list; never the generator's reasoning.
+8. **Separate generator from judge.** The judge sees spec + renders + measurements + acceptance
+ list; never the generator's reasoning.
9. **Money is measured, time is bounded.** The wall clock is the hard per-run ceiling
- (`BudgetGuard`), key pools have per-key limiters, and every call is one row of the
- run's ledger, `telemetry/cost.jsonl` — the only record of money.
-10. **Reproducible.** Prompt/rubric/skill hashes and tool versions are
- recorded on every run (`record.prompt_hashes`, `record.environment`).
-11. **Export as authored.** No wrapper re-centres, rescales or grounds the
- object; builds warn, `check_contract`/`check_connectivity` gate, the agent
- fixes the source.
+ (`BudgetGuard`), key pools have per-key limiters, and every call is one row of the run's
+ ledger, `telemetry/cost.jsonl` — the only record of money.
+10. **Reproducible.** Prompt / rubric / skill hashes and tool versions are recorded on every run
+ (`record.prompt_hashes`, `record.environment`).
+11. **Export as authored.** No wrapper re-centres, rescales or grounds the object; builds warn,
+ `check_contract` / `check_connectivity` gate, the agent fixes the source.
## 2. Package map (as built)
@@ -79,369 +71,236 @@ round. The record (plus git history of
codeverse3d/
conventions.py frames (LANGUAGE_FRAME, GLB_FRAME), units, OBJECT_VIEWS/_QUICK/_CLAY_VIEWS, SCENE_VIEWS,
to_snake/to_pascal/slugify, MAX_TRIS_*, BBOX_TOLERANCE_M, CONTACT_GAP_M (THE source)
- config.py Settings (C3D_* env, ~/.config/3dcodeverse/config.yaml; role defaults come from
- contracts Backends; Settings.backends(**overrides) builds a Spec's Backends;
- default_candidates=1). ONE switch grammar: every C3D_* knob is a field, read
- through get_settings() where it is used — no module reads the environment by
- hand; an on/off switch is a Flag, Settings.FLAT holds the flat spellings of
- nested knobs (the grammar and the names: docs/INSTALL.md §8.3)
+ config.py Settings (C3D_* env, ~/.config/3dcodeverse/config.yaml; Settings.backends(**overrides)
+ builds a Spec's Backends). ONE switch grammar: every C3D_* knob is a field, read through
+ get_settings() where it is used; an on/off switch is a Flag, Settings.FLAT holds the flat
+ spellings of nested knobs (docs/INSTALL.md §8.3)
contracts/ pydantic: common (Track, Language, Usage, Budget, Backends, TRACK_INFO registry,
ENTRY_FILE/code_file/LANGUAGE_LABEL tables), spec (+ RunOptions), plan, artifacts
- (GateFinding.as_line, GateReport.of, BuildResult.gates, RenderView.judge,
- RenderSet.out_dir, + Judgment), run
- (+ SkillsUsage/SkillRead: what was attached, what was read), chat,
- agent (typed AgentJob)
+ (GateFinding, GateReport, BuildResult.gates, RenderView, RenderSet, Judgment), run
+ (+ SkillsUsage/SkillRead), chat, agent (typed AgentJob)
workspace.py run-dir layout + git snapshots
- doctor.py the environment checks behind `3dcode doctor` (deps, Blender,
- node, GPU probe, keys, pool admission, vendor CLIs, MCP, skills)
- proc.py stdlib-only subprocess + atomic-JSON primitives (ManagedProcess owns every
- child's lifecycle: group kill on ANY exception, bounded pumps, stdin writer;
- run_subprocess, tail, write_json_atomic, scrub_secrets) and the tolerant readers/writer
- (read_json_or_none, iter_jsonl_lines, read_jsonl_lenient, append_jsonl_line) —
- shared by languages/spatial/cli/cost/record/addons and eval/bench. RULE: any
- stdlib-only file / JSON / JSONL helper lives HERE; grep proc.py before writing a
- try/except read (the 2026-08-26 review found the same tolerant read written
- eight times because this module had not grown it). Also home, since
- 2026-08-28, to the JSONL event log (EventLog), the run lock (ONE writer per
- run dir: an fcntl.flock at <runs>/.locks/<slug>.lock whose record NAMES the
- holder, printed by `3dcode status`) and the bounded parallel fan-out
- (fan_out); sha256_file and version_line live here too — still a leaf:
- imports nothing from codeverse3d
- models/ ChatModel (base.py), parts.py; gemini.py (the whole Gemini stack:
- request/response shapes, dead-key + free 429 rotation);
- anthropic.py openai.py (each with its own request/response shapes);
- retry.py (the scheduling machine: KeyPool with outcomes ok | 429 | 5xx |
- error | dead | skip and the max_in_flight cap as machine-wide flock'd
- slots (Slots, docs/COST.md §23) — no RPM/TPM buckets since 2026-09-22,
- docs/COST.md §19 — and rotate_with_retries, the one retry loop, which
- the SDK adapters run over a one-key pool; bounded by max_total_s ≤
- RETRY_DEADLINE_S with MAX_WAIT_S ≤ 3 s single waits); pricing.py
- (version-suffix-only fallback), health.py (preflight
- probe: no retries, no backoff), schema_utils.py (strict schema), registry.py
- agents/ registry.py (the CodingAgent protocol + dispatch — every backend is a
- vendor CLI; the in-process api-agent died 2026-08-28), backends.py
- (claude-code / codex / antigravity: argv, env, each CLI's own record read
- back — envelope, stream, conversation db, retry reports; agy's API-mode
- HOME + pool key), cli_common.py (sessions, the watchdog clocks, the prompt
- on stdin, the transcript, files_changed attribution — a `shared_tree` job's to
- its files_hint, D111 —, THE failure vocabulary,
- provider_wait), materialize.py
+ doctor.py the environment checks behind `3dcode doctor` (deps, Blender, node, GPU probe, keys,
+ pool admission, vendor CLIs, MCP, skills)
+ proc.py stdlib-only subprocess + atomic-JSON primitives (ManagedProcess owns every child's
+ lifecycle: group kill on ANY exception, bounded pumps, stdin writer; run_subprocess,
+ write_json_atomic, scrub_secrets), the tolerant readers/writer (read_json_or_none,
+ iter_jsonl_lines, read_jsonl_lenient, append_jsonl_line), the JSONL event log (EventLog),
+ the run lock (ONE writer per run dir: fcntl.flock at <runs>/.locks/<slug>.lock naming the
+ holder, printed by `3dcode status`), fan_out, sha256_file, version_line. RULE: any
+ stdlib-only file / JSON / JSONL helper lives HERE. A leaf: imports nothing from codeverse3d
+ models/ ChatModel (base.py), parts.py; gemini.py (request/response shapes, dead-key + 429 rotation);
+ anthropic.py openai.py; retry.py (KeyPool with outcomes ok | 429 | 5xx | error | dead | skip,
+ the max_in_flight cap as machine-wide flock'd slots, rotate_with_retries — the one retry
+ loop); pricing.py, health.py (preflight probe: no retries), schema_utils.py (strict schema),
+ registry.py
+ agents/ registry.py (the CodingAgent protocol + dispatch — every backend is a vendor CLI),
+ backends.py (claude-code / codex / antigravity: argv, env, each CLI's own record read back;
+ agy's API-mode HOME + pool key), cli_common.py (sessions, the watchdog clocks, the prompt on
+ stdin, the transcript, files_changed attribution, THE failure vocabulary, provider_wait),
+ materialize.py (workspace context files + hard rules)
languages/ LanguageRuntime + RuntimeLayout (base.py: every runtime states its file layout —
- expected_files / files_for — and the tracks ask it); one merged module per language since 2026-08-28 —
- blender/ cadquery/ threejs/ urdf/ scene_threejs/ scene_blender/ glsl_shader/ opengl_python/ are each
- a single __init__.py (lint → skeleton → runtime, in dependency order) beside their
- data (starter/, opengl_python/wrappers/run_gl.py; the contract text is
- prompts/<lang>/contract.md, found like every per-language prompt file by
- prompts/catalog.language_prompt — a runtime holds no prompt text); wrappers/
+ expected_files / files_for — and the tracks ask it); one module per language:
+ blender/ cadquery/ threejs/ urdf/ scene_threejs/ scene_blender/ glsl_shader/ opengl_python/
+ are each a single __init__.py (lint → skeleton → runtime) beside their data (starter/,
+ opengl_python/wrappers/run_gl.py; the contract text is prompts/<lang>/contract.md); wrappers/
holds the python build wrappers (run_bpy, run_bpy_links, run_cq, run_bpy_scene), the
- scene_blender render driver (render_bpy_scene) and what they
- share (_wrapper_common: script run + error mapping + report; _census: the Blender census;
- _census_glb: scene_blender's census GLB writer, D102; _finite: the NaN / inf check every
- Blender wrapper runs on what it writes — the model's build error, D114)
- scene_blender/starter/src/ is its plan-less example (scene.py, env.py, zones/{hamlet,
- lakeside, orchard}.py, assets/{crate, lantern_post}.py) and lib/ the harness-owned bpy library
- (D51 for this language: noise, mesh, materials, terrain, sky, lighting, water, vegetation,
- architecture, scatter, place, figure, motion), indexed by prompts/scene_blender/effects_catalog.md;
- Settings.scene_lib off is RAW mode (D113, the argon_raw variant): no lib/ ships, a `lib` import
- is a lint ERROR, the stubs and prompts are raw bpy / bmesh
+ scene_blender render driver (render_bpy_scene) and what they share (_wrapper_common,
+ _census, _census_glb, _finite — the NaN / inf check on everything a Blender wrapper writes).
+ scene_blender/starter/src/ is its example scene (scene.py, env.py, zones/{hamlet, lakeside,
+ orchard}.py, assets/{crate, lantern_post}.py) and lib/ the harness-owned bpy library (noise,
+ mesh, materials, terrain, sky, lighting, water, vegetation, architecture, scatter, place,
+ figure, motion), indexed by prompts/scene_blender/effects_catalog.md; Settings.scene_lib off
+ is RAW mode (the argon_raw variant): no lib/ ships, a `lib` import is a lint ERROR
spatial/ node.py, render.py, observe.py, tool_common.py (shared tool plumbing),
- render_scene.py (judge view subset, content-fitted orbit),
- render_blender.py (scene_blender: Blender pixels under a GPU slot + CPU fallback,
- the JS host's camera checks on them, the same metrics.json),
+ render_scene.py (judge view subset, content-fitted orbit), render_blender.py (scene_blender:
+ Blender pixels under a GPU slot + CPU fallback, the same metrics.json),
frame_metrics.py (scene_frames gate), frame_motion.py (measured inter-frame motion),
- scene_placement.py (scene_placement gate = the check_placement tool's verdict,
- placement_gate(ws, census, plan) for both: floating / sunken /
- unsupported / interpenetration / cantilevered per placed asset + free_exempt per
- report from the probe census's placement table, runtime_js/lib/host_placement.mjs;
- thresholds = Settings.placement, D105; added 2026-08-26),
- gl_render.py (GlHost), frame_stats.py (gl_frames),
- sheet.py (montage_2x2, crop_region), measure.py, connectivity.py,
- contract.py (authoring-frame hints), sections.py (the cross_section tool and the
- D48 judge slices: one matplotlib section renderer), silhouette.py, probes.py,
- complexity.py (objective complexity vector -> Measurement.extra, eval/docs/COMPLEXITY.md),
- joints*.py + joints_collide.py (deterministic penetration; joints_sweep.sweep_gate is
- THE joint_sweep verdict — the round's gate and the tool's), registry.py,
- tools.py (every @tool registration since 2026-08-28; every import is a plain
- one — codeverse3d.languages is imported inside the tool bodies),
- mcp_server.py (MCP name: 3dcode).
- Render modes are contracts.artifacts.RENDER_MODES (shaded wire normals silhouette
- clay — no 'depth'); build error_type spellings are languages/_common.MISSING_ENTRY
- ("MissingEntryFile") and BUILD_TIMEOUT ("BuildTimeout") for every runtime
- skills/ registry.py (typed ROUTES + the router that evaluates them; select takes a
- variant's extra rows / boosts / disabled ids, effective_priority clamps a
- boost at the gate-fired floor), model.py (Skill/Selection + the SKILL.md
- loader), prompting.py (per-backend delivery policy + the index/mandate text),
- materialize.py, telemetry.py (the read probe: the CLIs' own tool calls first,
- atime as fallback); its switches are Settings fields (C3D_SKILLS*, ON by
- default since 2026-09-22). variants/<name>/ (D105) is the skills half of a
- variant overlay: bundles that shadow base bundles by name (library_roots /
- all_skills merge it while the variant is active), their _claims/, and
- routes.toml parsed by __init__.variants_table into typed rows (tomllib)
- cost/ types.py (CallCost/Stage/Role) ledger.py (append-only telemetry/cost.jsonl + price provenance)
- context.py (per-call > ambient attribution) instrument.py (MeteredChatModel /
- MeteredAgent — one row per ChatModel.generate; one session row only for a backend
- that does NOT meter itself; run_ledger nests + is context-local so bench --parallel works)
- tally.py (a block's money = its ledger rows, its lost seconds → StepTime; COST §31)
- guard.py (a call's cost estimated before it is sent — `3dcode cost estimate`)
- judges/ base.py (JudgeInput; `round_input` + `plan_summary(plan, language)`, the ONE payload
- builder and plan digest the in-run judge, `3dcode judge`, calibration
- and eval all use; the pure replay helpers), rubrics.py + rubrics/*.yaml (defect checklists, the wire
- schema, caps and scoring), prompt_builder.py (image prep, montages, the
- judge messages), vlm_judge.py (+ the reference/likeness judges),
- pairwise.py.
- No Judge Protocol: a judge is
- duck-typed `.judge(JudgeInput) -> Judgment`
- reference.py a user `--image` against the render: proportions (does the picture agree
- with the brief?) and the render-vs-reference mismatch diff
- orchestrator.py the round loop's LIBRARY, not the loop: the round knobs (RoundPolicy —
- no stop knob besides max_rounds), refine-task compilation + grouping,
+ scene_placement.py (scene_placement gate = the check_placement tool's verdict: floating /
+ sunken / unsupported / interpenetration / cantilevered per placed asset; thresholds =
+ Settings.placement), gl_render.py (GlHost), frame_stats.py (gl_frames),
+ sheet.py (montage_2x2, crop_region), measure.py, connectivity.py, contract.py
+ (authoring-frame hints), sections.py (the cross_section tool + the judge slices), silhouette.py,
+ probes.py, complexity.py (objective complexity vector → Measurement.extra),
+ joints_model.py joints_poses.py joints_export.py joints_sweep.py joints_collide.py
+ (deterministic penetration; joints_sweep.sweep_gate is THE joint_sweep verdict — the round's
+ gate and the tool's), registry.py, tools.py (every @tool registration), mcp_server.py
+ (MCP name: 3dcode). Render modes are contracts.artifacts.RENDER_MODES (shaded wire normals
+ silhouette clay); build error_type spellings are languages/_common.MISSING_ENTRY and
+ BUILD_TIMEOUT for every runtime
+ skills/ registry.py (typed ROUTES + the router; select takes a variant's extra rows / boosts /
+ disabled ids), model.py (Skill/Selection + the SKILL.md loader), prompting.py (per-backend
+ discovery root + the mandate text), materialize.py, telemetry.py (the read probe: the CLIs'
+ own tool calls first, atime as fallback); switches are Settings fields (C3D_SKILLS*, on by
+ default). variants/<name>/ is the skills half of a variant overlay: bundles that shadow base
+ bundles by name, their _claims/, and routes.toml (docs/SKILLS.md)
+ cost/ types.py (CallCost/Stage/Role) ledger.py (append-only telemetry/cost.jsonl + price
+ provenance) context.py (per-call > ambient attribution) instrument.py (MeteredChatModel /
+ MeteredAgent — one row per ChatModel.generate; one session row for a backend that does NOT
+ meter itself; run_ledger is context-local so parallel batteries work) tally.py (a block's
+ money = its ledger rows, its lost seconds → StepTime) guard.py (a call's cost estimated
+ before it is sent — `3dcode cost estimate`)
+ judges/ base.py (JudgeInput; round_input + plan_summary, the ONE payload builder the in-run judge,
+ `3dcode judge`, calibration and eval all use), rubrics.py + rubrics/*.yaml (defect
+ checklists, the wire schema, caps and scoring), prompt_builder.py (image prep, montages, the
+ judge messages), vlm_judge.py (+ the reference/likeness judges), pairwise.py. No Judge
+ Protocol: a judge is duck-typed `.judge(JudgeInput) -> Judgment`
+ reference.py a user `--image` against the render: proportions and the render-vs-reference mismatch diff
+ orchestrator.py the round loop's LIBRARY, not the loop: RoundPolicy, refine-task compilation + grouping,
StageRunner + RunState (resume), BudgetGuard (the clock). The loop itself is
- tracks/lifecycle.py:_round_loop → tracks/steps.py:run_round. A best-of-N
- candidate IS steps._run_round(kind='candidate') in a _cand/c<k> sub-workspace
- with two knobs (render=candidates.quick_render, geometry_views=False), its
- own _cand/c<k>/events.jsonl and a one-sample judge
- tracks/ __init__.py (get_track(track, **options) → a lifecycle.BaseTrack),
- lifecycle.py, steps.py, candidates.py (best-of-N baseline candidates and
- their ranking), generation.py (agent + single-shot strategies + the file
- envelope), repair.py, planner.py, prompting.py (prompt helpers, split from common),
- common.py (RunContext, Services), static_object.py (+ the reference-image
- gates), articulated_object.py (+ the planned-motion gate),
- scene.py, scene_assets.py (+ cheap single-shot asset generation),
- zone_layout.py (L2 zone director: per-zone structured layout calls + deterministic validator),
- graphics.py (the whole graphics track: prompt context and the frame
- RenderSet; the recipe seeding into src/recipes.glsl went with the
- cookbooks, D107),
- planner.py (the ONE planner loop + the cached EngineeringBrief
- (C3D_PLAN_BRIEF), plan budgets and the worked examples — and the ONE owner of
- what differs per track when planning: template, example, temperature, output
- floor, acceptance, all dispatched on spec.track),
- plan_features.py (eval-only: which C3D_* names are live, derived from
- Settings, and pin_plan_blockers() deciding when two arms may share one
- plan — eval/docs/EVAL.md §8.1),
- depth.py,
- skills_hook.py (the round's view of codeverse3d/skills: attach before generating,
- probe reads after — a no-op under C3D_SKILLS=0; on by default since 2026-09-22)
+ tracks/lifecycle.py:_round_loop → tracks/steps.py:run_round; a best-of-N candidate IS
+ steps._run_round(kind='candidate') in a _cand/c<k> sub-workspace
+ tracks/ __init__.py (get_track(track, **options) → a lifecycle.BaseTrack), lifecycle.py, steps.py,
+ candidates.py (best-of-N baseline candidates and their ranking), generation.py (agent +
+ single-shot strategies + the file envelope), repair.py, planner.py (the ONE planner loop + the
+ cached EngineeringBrief, plan budgets, and the ONE owner of what differs per track when
+ planning: template, example, temperature, output floor, acceptance), prompting.py (prompt
+ helpers), common.py (RunContext, Services), static_object.py (+ the reference-image gates),
+ articulated_object.py (+ the planned-motion gate), scene.py, scene_assets.py (+ cheap
+ single-shot asset generation), zone_layout.py (per-zone structured layout calls +
+ deterministic validator), graphics.py (the whole graphics track), plan_features.py
+ (eval-only: which C3D_* names are live, and pin_plan_blockers() deciding when two arms may
+ share one plan), depth.py, skills_hook.py (the round's view of codeverse3d/skills: attach
+ before generating, probe reads after — a no-op under C3D_SKILLS=0)
record/ what every run WRITES: record.py (finalize_record, load_record, iter_runs,
- effective_judgment), deliverable.py (every round's kept build under
- artifacts/rNN/, and deliverable/ for ONE round — built by addons/select),
- telemetry.py, git_history.py (files at a round's commit)
+ effective_judgment), deliverable.py (every round's kept build under artifacts/rNN/, and
+ deliverable/ for ONE round — built by addons/select), telemetry.py, git_history.py (files at
+ a round's commit)
addons/ optional tools that READ finished runs; outside cli/ nothing imports them
- (tests/core/test_addons_boundary.py). dataset/ = export.py, pack.py, pairs.py,
- refine.py, captions.py, index.py, sample.py, quality.py (tiers + code fingerprints +
- duplicate groups) — `3dcode flywheel …`; costreport/ = audit.py, report.py,
- caching.py (session_cache/session_key — measurement only, docs/COST.md §13) —
- `3dcode cost`; calibration.py (judge repeatability over recorded runs);
- skill_targets.py (measured targets + claims per skill bundle);
- select.py (round_rows / pick / summarise / package: which round of a
- finished run to hand over, deliverable/ + selection.json for it —
- `3dcode pick`, and `3dcode make` after the run); gallery/ = below
- addons/gallery/ THE local run gallery (`3dcode gallery serve|build`): cards.py,
- compare.py (side-by-side arms), index.py (run roots →
- typed RunEntry, tolerant of half-written records), model.py, page.py (cards +
- table + filters + per-filter summary), detail.py (/run/<battery>/<slug>),
- code.py (src browser), viewer.py (GLB orbit viewer on the vendored three.js),
- urls.py (server vs file:// targets + content types + the traversal guard),
- server.py (stdlib http.server, loopback-only; page.py also renders the
- static single-file form), theme.py (CSS + the index-page JS)
- prompts/ EVERY piece of prompt material the harness writes, and the only place it
- lives: <lang>/{system,contract}.md (incl. glsl_shader/,
- opengl_python/; NO language ships a cookbook, D106 / D107 — contract.md
- and system.md carry the interface facts), system/* (harness contract, single-shot envelope,
- role_{scope,asset,repair}.j2), tracks/*.j2.
- catalog.py answers "what exists and how does each piece reach the model"
- — including the ONE per-language lookup, language_prompt(language, name) /
- language_text: contract.md, system.md, effects_catalog.md, asset.md
- (the prompts/<dir> mapping used to be copied four times and missing in a fifth;
- until 2026-09-22 the contract came through the runtime, the system prompt
- and the catalog through tracks/prompting). sections.py (the `## ` heading
- splitter) was deleted in D107 — no stage picks chapters any more.
- variants.py (D105): per-model OVERLAYS — variants/<name>/<rel> shadows <rel> for
- load_text / render / language_text while that variant is active (a ContextVar
- BaseTrack.run sets around the whole run from RunOptions.variant, else the
- C3D_VARIANT / C3D_VARIANTS switch, resolved by exact generator id — never a
- regex); variant.toml = name/version/generators/knobs, variant_hash covers the
- prompt + skills overlays and lands in the record. variants/argon/ ships empty;
- variants/argon_raw/ (D113) is scene_blender raw mode ([knobs] scene_lib = false).
- The other half of the split: codeverse3d/skills/ is what an AGENT chooses
- to read (SKILL.md + references/ + a _claims file pinning its numbers to
- live constants). A file that tries to be both is the bug this prevents.
- cli/ main.py (app wiring, make/resume/mcp + the doctor/tools/gallery
- commands), inspect_cmd.py (render/judge on one existing run), layout_cmd.py
- (THE single-run view: `show` = STATUS / DELIVERABLE / QUALITY EVIDENCE / COST &
- SETTINGS; `status` = `show --section status`, which also reads a run in flight),
- flywheel_cmd.py, cost_cmd.py (`3dcode cost`),
- skills_cmd.py (`3dcode skills list|show|validate|report` — the read-rate report)
-eval/bench/ run_bench.py + report.py (the battery launcher, `python -m bench.run_bench` / `bench.report`;
- the report renders through codeverse3d/addons/gallery), compare_backends.py
- (preflights every model it needs; --wait-for-provider / --no-preflight),
- _infra.py (outage vs model failure: infra_failed / budget_exhausted, eval/docs/EVAL.md §7),
- pin_plan.py (seed one plan into both arms so the paired delta stops carrying
- the planner's spread — permitted only by plan_features.pin_plan_blockers),
- _compare_report.py (arm table incl. the `dropped` / `over budget` loss columns;
- ArmStats, the one arm aggregate — the A/B summary reads it too),
- _jsonl.py (the ONE tolerant reader, dedup rule — `latest`, the last row per
- key — and append-sealer for the resumable *.jsonl journals: a truncated last
- line never costs the paid rows), stats.py (the one t-interval, exact sign
- test and correlation every report states),
- ab_plan.py (paired control/variant A/B for plan + brief switches, --aa
- calibration mode; pins both children to the cap the §23 admission check
- reserved), _ab_report.py,
- ab_gate_rates.py (the same run's DETERMINISTIC readouts, paired per
- prompt: penetrating pairs, worst depth, floating parts, contract findings),
- _oneshot.py, _fixed_eval.py,
- concurrency_probe.py (in-flight knee sweep), complexity_report.py,
- prompts/*.yaml (the batteries: eval/docs/EVAL.md §2)
-runtime_js/ export_glb.mjs (placement policy, instance baking, selfcheck) render_glb.mjs
- render_scene.mjs probe_scene.mjs check_shaders.mjs (the lib tests' compile driver) gpu_launch.cjs serve.cjs
- lib/{resolve_three, scene_host, host_coverage, host_census, host_placement, orbit, instances,
- census, glsl_audit, browser/…}
- browser/post.js — scene post chain: GTAO + SELECTIVE bloom (an emissive
- mask, not a luminance bright-pass: on our renderer the sky dome at 1.88
- linear outshines every authored emissive, so a threshold cannot separate
- them) + a colour grade that is the identity unless the scene sets
- `scene.userData.grade`. ON for scene renders, `C3D_POST=0` / `--no-post`
- to disable; object renders never come through this driver.
-tests/ agents blender_cadquery core cost flywheel_cli gallery graphics
- install judges languages models orchestrator_tracks prompts reference scene_gates
- scene_prompts scene_runtime skills spatial_tools threejs_render urdf_joints
- (22 dirs; the count is `pytest --collect-only`'s; the bench tests are ../eval/tests)
+ (tests/core/test_addons_boundary.py). dataset/ = export.py, pack.py, pairs.py, refine.py,
+ captions.py, index.py, sample.py, quality.py (tiers + code fingerprints + duplicate groups)
+ — `3dcode flywheel …`; costreport/ = audit.py, report.py, caching.py — `3dcode cost`;
+ calibration.py (judge repeatability over recorded runs); skill_targets.py (measured targets
+ + claims per skill bundle); select.py (round_rows / pick / summarise / package: which round
+ of a finished run to hand over — `3dcode pick`, and `3dcode make` after the run)
+ addons/gallery/ THE local run gallery (`3dcode gallery serve|build`): cards.py, compare.py (side-by-side
+ arms), index.py (run roots → typed RunEntry, tolerant of half-written records), model.py,
+ page.py (cards + table + filters + per-filter summary), detail.py (/run/<battery>/<slug>),
+ code.py (src browser), viewer.py (GLB orbit viewer on the vendored three.js), urls.py
+ (server vs file:// targets + content types + the traversal guard), server.py (stdlib
+ http.server, loopback-only), theme.py (CSS + the index-page JS)
+ prompts/ EVERY piece of prompt material the harness writes, and the only place it lives:
+ <lang>/{system,contract}.md (+ effects_catalog.md, asset.md where a language has them),
+ system/* (harness contract, single-shot envelope, role_{scope,asset,repair}.j2),
+ tracks/*.j2. catalog.py answers "what exists and how does each piece reach the model",
+ including the ONE per-language lookup language_prompt(language, name) / language_text.
+ variants.py: per-model OVERLAYS — variants/<name>/<rel> shadows <rel> for load_text /
+ render / language_text while that variant is active (a ContextVar BaseTrack.run sets from
+ RunOptions.variant, else C3D_VARIANT / C3D_VARIANTS, resolved by exact generator id);
+ variant.toml = name/version/generators/knobs, variant_hash lands in the record.
+ codeverse3d/skills/ is what an AGENT chooses to read; a file that tries to be both is the
+ bug this split prevents
+ cli/ main.py (app wiring, make/resume/mcp + the doctor/tools/gallery commands), inspect_cmd.py
+ (render/judge on one existing run), layout_cmd.py (THE single-run view: `show` = STATUS /
+ DELIVERABLE / QUALITY EVIDENCE / COST & SETTINGS; `status` = `show --section status`),
+ flywheel_cmd.py, cost_cmd.py (`3dcode cost`), skills_cmd.py (`3dcode skills
+ list|show|validate|report`)
+eval/bench/ the battery launcher and reports (`python -m bench.run_bench` / `bench.report`,
+ compare_backends.py, ab_plan.py, complexity_report.py, prompts/*.yaml); never imported by
+ the harness — eval/docs/EVAL.md
+runtime_js/ export_glb.mjs (placement policy, instance baking, selfcheck) render_glb.mjs render_scene.mjs
+ probe_scene.mjs check_shaders.mjs gpu_launch.cjs serve.cjs lib/{resolve_three, scene_host,
+ host_coverage, host_census, host_placement, orbit, instances, census, glsl_audit, browser/…}
+ browser/post.js — scene post chain: GTAO + selective (emissive-mask) bloom + an optional
+ colour grade; ON for scene renders, `C3D_POST=0` / `--no-post` to disable
+tests/ one directory per package area (the count is `pytest --collect-only`'s; the bench tests are
+ ../eval/tests)
```
## 3. Workspace layout
One run is one directory, `runs/<slug>/`: `src/` is the code (git, one commit per round),
-`artifacts/` the last round's build plus every round's own `artifacts/rNN/`, and a pick
-writes `deliverable/` + `selection.json`. The full tree and the
-three buckets are in `docs/RUN_LAYOUT.md`, their one home.
+`artifacts/` the last round's build plus every round's own `artifacts/rNN/`, and a pick writes
+`deliverable/` + `selection.json`. The full tree and the three buckets are in
+`docs/RUN_LAYOUT.md`, their one home.
## 4. Per-language authoring contracts (raw code; the harness owns export)
-Authoritative text lives in `codeverse3d/prompts/<lang>/contract.md` (+ `system.md`; no cookbook, D107);
-summary:
-
-* **blender** (multi-file): `src/model.py` entry + `src/parts/<snake>.py` each
- defining `def build_<snake>()` (self-contained; optional `src/parts/_x.py`
- helpers) — pure bpy, Z-up, -Y front, meters; PascalCase object names = part
- names. Small objects may stay single-file. Harness wrapper (`languages/wrappers/run_bpy.py`
- + `_wrapper_common.py` + `_census.py`) puts `src/` on sys.path, maps errors to workspace-relative
- `src/parts/<x>.py:line`, collects census, exports GLB (Y-up) + STL. The census
- records `n_material_slots` + `material_indices_used` (read off the EVALUATED mesh,
- so modifier-added indices count) and warns when a mesh carries slots no polygon
- uses, or sits on an index past the last slot — one part is one mesh object, so
- per-feature colour is per-polygon `material_index`, and an assignment that
- silently no-ops ships the whole part in one flat colour (2026-08-30).
-* **cadquery**: `src/model.py` — `import cadquery as cq` (+math) only; module-level
- `result` = `cq.Assembly` or `Workplane`. A chain ending in a selector exports the
- parent solid with a warning (ExportError when no solid exists); helper-module
- errors map to `src/<file>.py:line`.
+Authoritative text lives in `codeverse3d/prompts/<lang>/contract.md` (+ `system.md`); summary:
+
+* **blender** (multi-file): `src/model.py` entry + `src/parts/<snake>.py` each defining
+ `def build_<snake>()` (self-contained; optional `src/parts/_x.py` helpers) — pure bpy, Z-up,
+ -Y front, meters; PascalCase object names = part names. Small objects may stay single-file.
+ The wrapper (`languages/wrappers/run_bpy.py`) puts `src/` on sys.path, maps errors to
+ workspace-relative `src/parts/<x>.py:line`, collects a census (incl. material-slot use, read
+ off the evaluated mesh) and exports GLB (Y-up) + STL.
+* **cadquery**: `src/model.py` — `import cadquery as cq` (+math) only; module-level `result` =
+ `cq.Assembly` or `Workplane`. A chain ending in a selector exports the parent solid with a
+ warning (ExportError when no solid exists); helper-module errors map to `src/<file>.py:line`.
* **threejs** (static): `src/parts/<snake>.js` each `export function build<Pascal>(THREE) → THREE.Group`
- at world pose (Y-up, +Z front, meters); `src/object.js` `export function build(THREE)`.
- Export is **as authored** (no re-centring);
- `InstancedMesh` is baked to plain `<Name>_<i>` meshes (trimesh ignores
- EXT_mesh_gpu_instancing); an exported `selfcheck(THREE, root)` is called and a
- throw fails the build as `SelfCheckError`; NaN-geometry errors name mesh + part
- and route to the part file.
-* **urdf_blender**: `src/model.py` builds one object per link named `<link>` in
- **WORLD coordinates** at the rest pose (q=0 = authored pose); `src/robot.urdf`
- hand-written: link frame = its pivot, joint origin = pivot_child − frame_parent,
- `rpy="0 0 0"`, visual AND collision `<origin xyz>` = −pivot (root `0 0 0`) —
- verified by the FK-consistency check; URDF limits = plan lower−rest .. upper−rest.
- Link name `world` is reserved. Harness exports `meshes/<link>.glb` (raw Z-up link
- frames), fails the build on a rest-pose penetration > 5 mm (D17; the rest pose is the
- only one the build collides), builds hierarchical `object.glb`; the round's
- `joint_sweep` gate sweeps every pose (deterministic; python-fcl) and a gate checks
- motion direction against the plan text.
+ at world pose (Y-up, +Z front, meters); `src/object.js` `export function build(THREE)`. Export
+ is **as authored**; `InstancedMesh` is baked to plain `<Name>_<i>` meshes; an exported
+ `selfcheck(THREE, root)` is called and a throw fails the build as `SelfCheckError`.
+* **urdf_blender**: `src/model.py` builds one object per link named `<link>` in **WORLD
+ coordinates** at the rest pose (q=0 = authored pose); `src/robot.urdf` hand-written: link frame
+ = its pivot, joint origin = pivot_child − frame_parent, `rpy="0 0 0"`, visual AND collision
+ `<origin xyz>` = −pivot (root `0 0 0`) — verified by the FK-consistency check; URDF limits =
+ plan lower−rest .. upper−rest. Link name `world` is reserved. The harness exports
+ `meshes/<link>.glb` (raw Z-up link frames), fails the build on a rest-pose penetration > 5 mm,
+ builds hierarchical `object.glb`; the round's `joint_sweep` gate sweeps every pose
+ (deterministic; python-fcl) and `motion_direction` checks the axis against the plan text.
* **scene_threejs**: `src/scene.js` `createScene({THREE, renderer, loaders}) → {scene, cameras, update(t,dt)}`;
`src/env.js`, `src/zones/*.js`, `src/assets/*.js`, `src/shaders/*.js`; GLBs at
- `public/assets/<name>.glb`. The harness assembles `scene.js` deterministically.
- Plus the harness-owned, read-only **effect library** `src/lib/*.js` (the starter's other
- `.js` files are the example scene), shipped into every workspace by BOTH skeleton paths and
- listed in `HARNESS_OWNED_SRC` so agent writes to it are reverted (D51, D97). The want → call
- table the prompts carry is `prompts/scene_threejs/effects_catalog.md`. A three.js asset module
- may compose it too (D100): its prompt carries the catalog rows of the factories its sheet names
- (`scene_assets.library_rows`), and the asset check (`runtime_js/lib/asset_check.mjs`) counts what
- a factory built — `lib/lifecycle.js` `isLibraryBuilt` — as `lib_tris` against the one-object
- ceiling, not the per-asset budget, and seats a factory by its origin. `src/lib/` is committed
- with `src/`, so the deliverable and the dataset sample carry it.
-* **glsl_shader**: `src/shader.frag` (+ optional `src/common.glsl`,
- `src/buffer_a.frag` for feedback) — the agent never writes
- `#version`, uniform declarations or `out vec4`; the harness header provides
- `u_time/u_resolution/u_mouse/u_frame/u_prev/u_noise/u_buffer_a` (+ Shadertoy
+ `public/assets/<name>.glb`. The harness assembles `scene.js` deterministically. The
+ harness-owned, read-only **effect library** `src/lib/*.js` ships into every workspace and is
+ listed in `HARNESS_OWNED_SRC` so agent writes to it are reverted; the want → call table the
+ prompts carry is `prompts/scene_threejs/effects_catalog.md`. `src/lib/` is committed with
+ `src/`, so the deliverable and the dataset sample carry it.
+* **scene_blender**: the same shape in bpy (`src/scene.py`, `src/env.py`, `src/zones/*.py`,
+ `src/assets/*.py`) on the harness-owned `src/lib/` bpy library; judged frames render in Cycles.
+* **glsl_shader**: `src/shader.frag` (+ optional `src/common.glsl`, `src/buffer_a.frag` for
+ feedback) — the agent never writes `#version`, uniform declarations or `out vec4`; the harness
+ header provides `u_time/u_resolution/u_mouse/u_frame/u_prev/u_noise/u_buffer_a` (+ Shadertoy
`iTime/iResolution/iChannel*` aliases). Feedback shaders are simulated at 30 fps.
* **opengl_python**: `src/program.py` with `setup(ctx, w, h) -> state` and
- `render(ctx, state, t, frame, fbo)` — moderngl only, no window libs, no wall
- clock, no file writes; GLSL may live in `src/*.glsl` or in-string (errors carry
- both line numbers). Runs in a fresh subprocess per render (contexts are not
- thread-safe); GPU d3d12 first, llvmpipe fallback.
+ `render(ctx, state, t, frame, fbo)` — moderngl only, no window libs, no wall clock, no file
+ writes; GLSL may live in `src/*.glsl` or in-string (errors carry both line numbers). Runs in a
+ fresh subprocess per render; GPU d3d12 first, llvmpipe fallback.
## 5. Spatial tool registry
`@tool(name, ArgsModel, description, *, tracks=(), languages=(), cost_hint)` registers
-`fn(ctx, args) -> Observation` → (a) direct call from tracks, (b) the stdio MCP
-server (name `3dcode`) for the vendor CLIs, (c) a native tool schema for any embedder
-(`ToolDef.schema()`), (d) a prompt card. The 16 tools: `build` (every track), `measure`,
-`render_views`, `render_sheet`, `isolate`, `cross_section`, `check_connectivity`,
-`check_contract`, `compare_reference` (object tracks), `joint_sweep` (articulated),
-`shader_probe`, `scene_probe`, `scene_views`, `check_placement` (scene), `gl_probe`,
-`gl_frames` (graphics).
-
-An `Observation` carries two different answers: `ok` is the **verdict** and `failed`
-says the tool **could not run** (exception, missing artefact, unusable arguments).
-`Observation.error` builds every failure caught at the `ToolDef.call` boundary; three
-tools set `failed` on an observation they compose themselves; the list of those places
-lives with the field, in `spatial/registry.Observation.error`. MCP `is_error` is `failed` alone: a
-negative verdict is a result whose text leads with FAIL, because a vendor CLI retries an
-errored call, and over 224 recorded gemini-cli sessions (removed in D103) `is_error = not ok` made 62 % of
-1 445 `joint_sweep` calls, 23 % of 2 144 `build`s and ~15 % of the connectivity/contract
-calls look broken (a mean 119 k prompt tokens ≈ $0.030 blended a retry — docs/COST.md §30
-for the selector, and for what an errored result costs when it carries an image).
-The MCP server also bounds every payload it hands over (`MAX_TEXT_CHARS`,
+`fn(ctx, args) -> Observation` → (a) direct call from tracks, (b) the stdio MCP server (name
+`3dcode`) for the vendor CLIs, (c) a native tool schema for any embedder (`ToolDef.schema()`),
+(d) a prompt card. The 16 tools: `build` (every track), `measure`, `render_views`,
+`render_sheet`, `isolate`, `cross_section`, `check_connectivity`, `check_contract`,
+`compare_reference` (object tracks), `joint_sweep` (articulated), `shader_probe`, `scene_probe`,
+`scene_views`, `check_placement` (scene), `gl_probe`, `gl_frames` (graphics).
+
+An `Observation` carries two different answers: `ok` is the **verdict** and `failed` says the
+tool **could not run** (exception, missing artefact, unusable arguments). MCP `is_error` is
+`failed` alone: a negative verdict is a result whose text leads with FAIL, because a vendor CLI
+retries an errored call. The MCP server bounds every payload it hands over (`MAX_TEXT_CHARS`,
`max_images_for`): no image at all on a `failed` result, one on a FAIL verdict.
-## 6. Judging (protocol v2)
-
-`VlmJudge(rubric, model_id, n_samples)` sends **montages, not loose views**: ≤ 5
-labelled 2×2 montages (shaded / geometry-only clay-or-normals / poses) + ≤ 2 detail
-crops at ≤ 1024 px, shuffled per sample — sized for the 14-view object rig + the
-clay montage (D47; was ≤ 3 under the 8-view rig). The wire schema is **observe-then-score**
-(summary, strengths, issues, **defect checklist**, acceptance *before* criteria) —
-criteria-first measurably compressed flash to 0.6–0.7. Every rubric carries binary
-`defects` (id/text/penalty/cap); defect and acceptance votes are majority (an exact
-tie — even `n_samples` only — reads as absent for a defect and follows the
-representative sample for an acceptance item, D36 as amended 2026-08-30) and
-`overall = caps(weighted_mean − Σ penalties)`. On the static track the judge's structure
-facts come from the connectivity gate's **contact ledger** (2026-08-30): `gates_section`
-renders one measured overlap line instead of the per-pair "interpenetrate by ≈d mm"
-WARN prose (1 254 such sentences on 241 stored rounds → 0), a MEASURED STRUCTURE block
-(parts / contacts / floating / deepest overlap, the plan's PLANNED JOINS as contact or
-OPEN with the gap, the lowest point above the floor) and a CONNECTIVITY PASSED paragraph
-that also forbids the interpenetration checklist claim. It is rendered from the stored
-`GateReport`, so `3dcode judge <slug>` and calibration see exactly what the in-run judge
-saw, and a round recorded before the ledger existed renders byte-identical to before
-(`ObjectPipeline.judge_context` stays empty on purpose — one source). On an
-object-track round whose connectivity gate carries an ERROR, the payload
-conditionally grows **cross-section slices** (D48, `Settings.judge.slices =
-"on-error"`): `spatial.sections.judge_slices` cuts the round's GLB
-(`JudgeInput.glb_path`) on the two vertical centre planes — per-part fills with a
-legend, red hatch ONLY on the gate's ERROR penetration pairs, plain darkened blends
-for every other in-plane overlap, degenerate slices dropped — and the ≤ 2 PNGs are
-appended AFTER the montages and crops with a factual rig-text block (an in-plane gap
-is not evidence of disconnection) plus one provenance-elicitation sentence in the
-defect-checklist bullet ("say where it is visible … or state that it rests on the
-measured text alone"). A clean round's payload is **byte-identical** to the
-unconditional one (test-pinned; `judge_prompt_hash` unchanged), the render is local
-CPU, and the typed `SliceManifest` beside the PNGs keeps every "visible in slice n"
-citation auditable. Floors,
-deterministic caps from gate findings (`data["kind"]`), console errors, missing
-must-acceptance and
-`missing_views` rules apply on top; degraded verdicts are glitches, not scores.
-`PairwiseJudge` (position-swapped, tie on disagreement; only `3dcode pick --by pairwise` asks it); `ReferenceJudge` for
-image-conditioned specs.
-Rubrics (pass threshold 0.70 unless named): `static_object` (0.72), `articulated`
-(requires pose views: the `missing_pose_sheet` cap), `scene` (D105: placement caps floating 0.60 / sunken 0.65 /
-interpenetration 0.70 / scale 0.75 / free_exempt 0.75 measured by `scene_placement`, frame-gate caps
-dark/blown/flat/content_small, graded must-acceptance), `asset`, `reference`, `shader` (graphics, `gl_frames`
-caps; also the `LikenessJudge` default). Retired `scene_v1` and `shader_v1` are no longer distributed.
+## 6. Judging
+
+`VlmJudge(rubric, model_id, n_samples)` sends **montages, not loose views**: ≤ 5 labelled 2×2
+montages (shaded / geometry-only clay-or-normals / poses) + ≤ 2 detail crops at ≤ 1024 px,
+shuffled per sample. The wire schema is **observe-then-score** (summary, strengths, issues,
+**defect checklist**, acceptance *before* criteria). Every rubric carries binary `defects`
+(id/text/penalty/cap); defect and acceptance votes are majority and
+`overall = caps(weighted_mean − Σ penalties)`. Floors, deterministic caps from gate findings
+(`data["kind"]`), console errors, missing must-acceptance and `missing_views` rules apply on
+top; degraded verdicts are glitches, not scores.
+
+The judge's structure facts come from the gates, rendered from the stored `GateReport` so
+`3dcode judge <slug>` and calibration see exactly what the in-run judge saw: on the static track
+the connectivity gate's **contact ledger** (parts / contacts / floating / deepest overlap, the
+plan's PLANNED JOINS as contact or OPEN with the gap, the lowest point above the floor); on an
+object-track round whose connectivity gate carries an ERROR, the payload grows **cross-section
+slices** (`Settings.judge.slices = "on-error"`): `spatial.sections.judge_slices` cuts the round's
+GLB on the two vertical centre planes, red hatch only on the gate's ERROR penetration pairs,
+appended after the montages with a factual rig-text block. A clean round's payload is
+byte-identical to the unconditional one (test-pinned).
+
+`PairwiseJudge` (position-swapped, tie on disagreement; only `3dcode pick --by pairwise` asks
+it); `ReferenceJudge` for image-conditioned specs. Rubrics (pass threshold 0.70 unless named):
+`static_object` (0.72), `articulated` (requires pose views: the `missing_pose_sheet` cap), `scene`
+(placement caps floating 0.60 / sunken 0.65 / interpenetration 0.70 / scale 0.75 / free_exempt
+0.75 measured by `scene_placement`, frame-gate caps dark/blown/flat/content_small, graded
+must-acceptance), `asset`, `reference`, `shader` (graphics, `gl_frames` caps; also the
+`LikenessJudge` default).
**Calibration** (`addons/calibration.py`: re-judges recorded rounds, n samples each) is why the
default judge is `gemini-3.1-pro-preview` (`Settings.default_judge`) and flash is the cheap
@@ -451,10 +310,10 @@ option that needs `n_samples ≥ 2` for decisions; the numbers are in `eval/docs
A run is three parts, and only the first is a graph.
-**7.1 The pre-round stages — declared, one tuple per track.** `BaseTrack.stages` (the tracks'
-`stages` class attribute) is a tuple of `StageNode`s, walked by `lifecycle.run_stages` over
-`StageRunner`. The block below is drawn from those declarations (`tests/install/test_docs.py`
-fails when it drifts, printing the block to paste):
+**7.1 The pre-round stages — declared, one tuple per track.** `BaseTrack.stages` is a tuple of
+`StageNode`s, walked by `lifecycle.run_stages` over `StageRunner`. The block below is drawn from
+those declarations (`tests/install/test_docs.py` fails when it drifts, printing the block to
+paste):
```stage-graph
static_object plan → skeleton → materialize* → round 0
@@ -463,193 +322,135 @@ scene plan → skeleton → materialize* → (assets ∥ env ∥ l
graphics plan → skeleton → materialize* → round 0
```
-`→` in order; `(a ∥ b)` siblings side by side, each its own cached stage, timed as ONE step of the
-run's minutes, a failing sibling raised after every sibling has finished and cached; `?` runs under a
-`Settings` switch (`layouts`: `zone_layouts`, on); `*`
-is not cached — it runs every session. Every other stage is cached under its key
-(`stages/<name>.json`): what its result depends on, named in the declaration. **Once rounds exist**
-a recorded stage is served whatever its key (`stage.frozen`), and the skeleton (`seeds_src`) never
-runs at all; `3dcode resume --force` is the one way to regenerate a stage under them: it archives
-the round journal + `record.json` to `rounds/pre_force/` whether or not the spec changed, and the run
-starts again at round 0 with no stage frozen. The plan itself is `run()`'s, before the graph (`plan_stage_key`). What the
-scene stages do: `assets` — both kinds climb one ladder (single-shot → check → one repair → agent;
-blender_glb heroes get a sub-workspace with the static planner's parts + asset judge + one
-re-judged fix pass, undone when worse; a degraded asset verdict leaves score None / judged False,
-emits asset.judge_degraded and skips the fix pass); `env` — `env_file` (`src/env.js` / `src/env.py`): its
-session shares the tree with the asset single-shots, so it is a `shared_tree` job (credited with its own file
-only, watched for activity on its own file and — **D112** — on the steps agy records under its session HOME) and
-the stage is ok only when that file itself was written; else ONE single-shot `_recover_env` runs before the zones
-(`env.recover` / `env.recovered`, **D111**), CHECKED (**D112**): it counts only once `SceneRuntime.check_env` passes
-(the env module alone lints, builds and lights what it builds), a failure gets ONE repair single-shot with the
-check's words and the file fed back, both prompts carry `SceneRuntime.lib_interface` (src/lib names + parameter
-lists; a const-bound arrow function counts as a function), a module that still fails is replaced by the
-placeholder it overwrote, and the whole recovery holds the
-workspace session lock (`cli_common.exclusive_workspace`) so it never commits inside an escalated asset session's
-window (whose scope check would revert it). An env that lights nothing (`probes.unlit`: no lamp and no world /
-no light, background or environment map) is a `scene_probe` ERROR, so the ROUND's build fails and its repair is
-handed the env; a session's own MCP `build` states it on a `SCENE UNLIT` line above BUILD OK when it is the only
-error (an asset or zone session building beside the placeholder env cannot write the env module); `layouts` — L2 zone
-layouts (planner calls, never fatal); `asset_api` — what the zones are told about the assets;
-`zones` — ONE session owns every zone file (D70; a session whose charge crossed the ceiling after
-it finished records the zones it wrote as written, the `BudgetExceeded` as their note); `clock` — the
-run stops here when the hard budget is spent, after the zones are recorded; `assemble` — `scene.js`, deterministic.
-
-**7.2 The round — `steps._run_round`, a fixed chain in code.** Not nodes: nothing in a round can
-be cached (every step reads the git tree the step before it wrote), and articulated's axis repair
-ties gates to render. **7.3 The round loop — `BaseTrack._round_loop`, a state machine in code**:
-each round's tasks come from the previous round's verdict, with seven exits and two retry-once sets.
-Best-of-N, refine planning and the asset ladder are sized at run time; they stay code too.
+`→` in order; `(a ∥ b)` siblings side by side, each its own cached stage, timed as ONE step of
+the run's minutes, a failing sibling raised after every sibling has finished and cached; `?` runs
+under a `Settings` switch (`layouts`: `zone_layouts`, on); `*` is not cached — it runs every
+session. Every other stage is cached under its key (`stages/<name>.json`): what its result
+depends on, named in the declaration. **Once rounds exist** a recorded stage is served whatever
+its key (`stage.frozen`), and the skeleton never runs at all; `3dcode resume --force` is the one
+way to regenerate a stage under them: it archives the round journal + `record.json` to
+`rounds/pre_force/` and the run starts again at round 0. The plan itself is `run()`'s, before
+the graph (`plan_stage_key`).
+
+What the scene stages do: `assets` — both kinds climb one ladder (single-shot → check → one
+repair → agent; blender_glb heroes get a sub-workspace with the static planner's parts + asset
+judge + one re-judged fix pass, undone when worse); `env` — `env_file` (`src/env.js` /
+`src/env.py`): a `shared_tree` session credited with its own file only; when that file was not
+written, ONE single-shot recovery runs before the zones, checked by `SceneRuntime.check_env` (the
+env module alone lints, builds and lights what it builds), one repair on failure, the placeholder
+restored if it still fails. An env that lights nothing is a `scene_probe` ERROR, so the ROUND's
+build fails and its repair is handed the env. `layouts` — per-zone layouts (planner calls, never
+fatal); `asset_api` — what the zones are told about the assets; `zones` — ONE session owns every
+zone file; `clock` — the run stops here when the hard budget is spent, after the zones are
+recorded; `assemble` — `scene.js`, deterministic.
+
+**7.2 The round — `steps._run_round`, a fixed chain in code.** Nothing in a round can be cached
+(every step reads the git tree the step before it wrote). **7.3 The round loop —
+`BaseTrack._round_loop`, a state machine in code**: each round's tasks come from the previous
+round's verdict.
```
round 0 "baseline": generate → build_with_repair → measure → gates → render → post-render gates → judge
- (object tracks, every language — D110 baseline-first: ONE session drafts the WHOLE object, every part
- file + the entry (BaseTrack.baseline_tasks over generate_static.j2 / generate_articulated.j2), the brief
- requiring every planned part at its box and joined before any detail, each file written once and then
- edited; a part still the skeleton's box is a `placeholder_part` contract ERROR. The per-part scoped
- baseline — 3-5 scope sessions + an "assemble" session, serial behind the workspace lock — is deleted.)
- (--candidates N: N parallel baselines in <ws>/_cand/c<k>, quick 4-view judge, crashed candidate retried once,
- selection build_ok → quick score → fewer gate errors → the earlier candidate; winner copied back, normal r00 follows)
-then max_rounds refine rounds, EACH built on the round before it — FIXED rounds (owner, 2026-09-22): no pass,
-plateau, regression or diminishing-returns stop, no rewrite or surface-detail round, no refine-from-best:
+ object tracks: ONE session drafts the WHOLE object — every part file + the entry — each file written once and
+ then edited; a part still the skeleton's box is a `placeholder_part` contract ERROR
+ --candidates N: N parallel baselines in <ws>/_cand/c<k>, quick 4-view judge, a crashed candidate retried once,
+ selection build_ok → quick score → fewer gate errors → the earlier candidate; the winner is copied back
+then max_rounds refine rounds, EACH built on the round before it — a FIXED count: no pass, plateau or regression stop
refine tasks = the previous round's gate ERRORS (fix hints, authoring-frame numbers) ∪ failed must-acceptance
- ∪ its judge improvement plan
- (≤ 6 tasks, ≤ 6 compacted instruction lines each; reference runs add an IoU task when silhouette IoU < 0.6)
- (a placeholder part's ERROR first of all — orchestrator.build_refine_instructions)
+ ∪ its judge improvement plan (≤ 6 tasks, ≤ 6 compacted instruction lines each; a placeholder part's ERROR first)
fan out when the track allows it (scene: zones/assets/env) AND ≥ 2 file-disjoint groups AND every task maps to
- files; the object tracks never fan out (allow_refine_fanout = False, D110): ONE session edits the whole
- object in place, told to make targeted edits, never whole-file rewrites — its window ends
- RoundPolicy.judge_reserve_s (4 min; D112, was 3 min) + the watchdog's grace before the run's hard ceiling, so the round is still
- built and judged (static_object.object_session_window_s); a single-shot refine is fenced (edit_only) to
- the files its tasks name, the only ones it is shown; graphics is one program
- generate (no HARNESS turn cap by default — claude-code runs under AgentJob.max_turns=60 (+6-turn wrap-up),
- the other vendor CLIs have no turn cap at all; 28 was A/B'd and rejected, +$0.02/−0.21 score, docs/COST.md §17;
- a cap the machine sets (C3D_AGENT_MAX_TURNS / limits.agent_max_turns) still buys a wrap-up session
- that lands a final build + summary instead of being killed) → build+repair (error-focused,
- escalates on identical signatures) → gates → … → judge (SKIPPED only where the verdict is never
- bought at all: no judge or no renders — a round that finishes past the clock is still judged)
+ files; the object tracks never fan out: ONE session edits the whole object in place, told to make targeted edits,
+ never whole-file rewrites; its window ends RoundPolicy.judge_reserve_s before the run's hard ceiling so the
+ round is still built and judged; a single-shot refine is fenced to the files its tasks name
+ generate → build+repair (error-focused, escalates on identical signatures) → gates → render → judge
→ commit src/ (the round's commit) and copy its build to artifacts/rNN/
- a round left without a verdict (judge outage / degraded) is re-judged once before the next is planned,
- and so is the LAST round before the run ends (still none → judge_unavailable, `--rounds 0` included)
- a round's cost is the ledger rows it booked (a cost.tally) and its steps are timed (RoundRecord.steps); a round
- that raises mid-way still reports what it burned (rounds/aborted_rNN.json + record.extra["aborted_rounds"])
- a round whose every task failed raises RoundFailed, TYPED (2026-09-22 — the loop never reads its message):
- .quota (a backend saw the vendor's usage limit) → agent_quota; .transient (a session died of a provider
- failure — AgentResult.transient, or a ModelError outage) or .stalled (D112: the watchdog found a session hung —
- idle past its window, nothing produced — whatever the vendor's log says; a split round only when EVERY session
- hung or died of transport, and best-of-N candidates carry it too) → the SAME round re-runs once,
- baseline included; neither → no_change (a refine round) / the run fails (the baseline)
- D112: a refine round (and its retry) launches only while RoundPolicy.can_open — judge_reserve_s, plus
- min_session_s for an agent session (a single-shot call needs the reserve only), left on the hard clock (else
- round.skipped_budget → budget; round 0's retry is not gated); refine / rebuild sessions end judge_reserve_s before
- the budget (GenerationTask.reserve_s); a budget stop after refine sessions changed src/ / public/ gets ONE bounded
- grace and a no-generation round that builds, renders and judges those edits (BaseTrack._salvage, like the
- baseline salvage before round 0)
-stop reasons: max_rounds | budget (the wall clock — BudgetGuard / max_minutes) | agent_quota | no_change (a refine
- round's sessions changed nothing) | no_refine_tasks | judge_unavailable | failed
- (a record from before 2026-09-22 may say passed / plateau: it loads as `stopped`)
-finalise: the workspace ENDS AT THE LAST ROUND — src/ a cut round left dirty is put back and that round rebuilt;
- finalize_record → record.json. No best round, no deliverable/ in the run.
+ a round left without a verdict (judge outage / degraded) is re-judged once before the next is planned, and so
+ is the LAST round before the run ends (still none → judge_unavailable)
+ a round that raises mid-way still reports what it burned (rounds/aborted_rNN.json)
+ a round whose every task failed raises RoundFailed, TYPED: .quota → agent_quota; .transient (a provider
+ failure) or .stalled (the watchdog found a session hung) → the SAME round re-runs once, baseline included;
+ neither → no_change (a refine round) / the run fails (the baseline)
+ a refine round launches only while RoundPolicy.can_open — judge_reserve_s plus min_session_s left on the hard
+ clock (else round.skipped_budget → budget); a budget stop after refine sessions changed src/ gets ONE bounded
+ grace and a no-generation round that builds, renders and judges those edits (BaseTrack._salvage)
+stop reasons: max_rounds | budget (the wall clock — BudgetGuard / max_minutes) | agent_quota | no_change |
+ no_refine_tasks | judge_unavailable | failed
+finalise: the workspace ENDS AT THE LAST ROUND; finalize_record → record.json. No best round, no deliverable/
after the run (`3dcode make`, unless --no-pick): addons/select.pick(by="score") — highest effective score, ties →
fewer gate errors → the earlier round — then package(): deliverable/ + selection.json
```
-Track-specific gates: static `connectivity` + `contract` (+ `reference_silhouette`),
-articulated + `joint_sweep` + `motion_direction` (URDF axis vs plan motion text),
-scene `scene_placement` (`spatial/scene_placement.py`, the one gate `ScenePipeline.gates` adds: per placed
-asset — a direct child of a ZONE root, the roots the assembler marks `userData[conventions.ZONE_ROOT_KEY]`
-(scene_blender: the census GLB's zone-node extras); every other root is scenery, never a row and never paired
-with other scenery, but its pieces still support, bury, hold (`attached`) and clip the zone assets, **D111** —
-foot-column gap to the surface beneath, burial depth,
-water, contacts and 3-D interpenetration pairs from `runtime_js/lib/host_placement.mjs` — the
-first deterministic placement check on the track; before 2026-08-26 the scene_v1
-`floating_part` cap could never fire and floating/sunken was left to the VLM) +
-`render_console` + `scene_frames` (`spatial/frame_metrics.py`, wired in
-`ScenePipeline.post_render_gates`: dark/blown/flat frames, camera in geometry, content
-too small, and **`no_motion`** — the frames of one camera at the first and last animation
-time are diffed in `spatial/frame_motion.py` and the per-camera "% of pixels changed"
-goes to the judge as a fact, because two tiles in different montage images are not
-comparable by eye and every scene judged before it was told "nothing moves" while its
-water was rippling, and **`unused_glb_asset`** — the scene host wraps `loaders.gltf` and
-records each GLB's geometry UUIDs, so the census can say whether any of it reached the
-rendered frame; `Object3D.clone()` shares geometry, so a cloned hero still counts and only
-a discarded load does not), graphics `gl_frames` (NaN/black/blown/static/flicker).
-A build's OWN gate reports ride `BuildResult.gates` — scene `scene_probe` + `shader_preflight`
-(one browser boot), graphics `gl_frames` — and `steps._run_round` appends them to the round's
-gates after the track's (a failed build's too: a shader compile error is what routes the
-shader-traps skill); before 2026-09-22 the scene's two never reached a round, and an always-empty
-`scene_census` gate parsed census keys the probe had stopped writing. `scene_probe` also holds the scene draw budget
-(D99): the census's `totals.draws` WARNs past `conventions.DRAWS_WARN_SCENE` and fails the build past
-`MAX_DRAWS_SCENE`, so the round's repair session gets it; no gate or judge reads fps.
-
-## 8. What a run costs and how long it takes
-
-RUNBOOK §2 gives expected cost and time per track. Use `3dcode cost <slug>` for a
-run's recorded spend and `3dcode cost estimate` for a call's expected price. Historical
-measurements cited elsewhere in this document are local experiment notes and are
-not distributed with the repository.
+
+Track-specific gates: static `connectivity` + `contract` (+ `reference_silhouette`); articulated
++ `joint_sweep` + `motion_direction`; scene `scene_placement` (per placed asset — a direct child
+of a zone root — foot-column gap to the surface beneath, burial depth, water, contacts and 3-D
+interpenetration pairs from `runtime_js/lib/host_placement.mjs`; every other root is scenery,
+never a row, but still supports, buries, holds and clips the zone assets) + `render_console` +
+`scene_frames` (`spatial/frame_metrics.py`: dark/blown/flat frames, camera in geometry, content
+too small, `no_motion` — the first and last animation frame of one camera diffed, the per-camera
+"% of pixels changed" handed to the judge as a fact — and `unused_glb_asset`, from the geometry
+UUIDs the scene host records per loaded GLB); graphics `gl_frames`
+(NaN/black/blown/static/flicker). A build's OWN gate reports ride `BuildResult.gates` — scene
+`scene_probe` + `shader_preflight`, graphics `gl_frames` — and `steps._run_round` appends them to
+the round's gates after the track's (a failed build's too: a shader compile error is what routes
+the shader-traps skill). `scene_probe` also holds the scene draw budget: the census's
+`totals.draws` WARNs past `conventions.DRAWS_WARN_SCENE` and fails the build past
+`MAX_DRAWS_SCENE`; no gate or judge reads fps.
+
+## 8. Cost and time
+
+`docs/RUNBOOK.md` §2 gives expected cost and time per track. `3dcode cost <slug>` prints a
+run's recorded spend, `3dcode cost estimate` a call's expected price.
## 9. Known limits
-* Judge: flash is lenient/noisy on fine distinctions (overall std ≈ 0.08–0.12 at
- n=3); its dynamic range comes from the defect checklist. Use pro (default) or
- `n_samples ≥ 3` for decisions. Detail crops are position-heuristic (no 2D part
- boxes yet).
-* Scene judging is deliberately narrow: the judge sees the scene's OWN cameras (first,
- and the detail crop is taken from one of them) plus at most four overview-rig tiles (the fourth is the low contact camera `overview_low_front`, D105);
- the harness's eye-level rig is a diagnostic only. A `must` acceptance item the harness
- cannot verify caps a round at 0.60 AND fails its verdict, so on the scene track only the spec's
- `must_have` list keeps that priority (the plan's own checklist is `should`).
-* Articulated: candidate selection uses the quick 4-view rig plus the sweep's pose views;
- mimic joints are honoured (the sweep drives independent joints only and resolves
- followers through the chain); sweep is O(links² × poses).
-* Scenes: fps is a record only (machine- and load-dependent; the draw count is what is gated);
- camera-in-geometry can miss open-back enclosures.
+* Judge: flash is lenient/noisy on fine distinctions (overall std ≈ 0.08–0.12 at n=3); its
+ dynamic range comes from the defect checklist. Use pro (default) or `n_samples ≥ 3` for
+ decisions. Detail crops are position-heuristic (no 2D part boxes).
+* Scene judging is deliberately narrow: the judge sees the scene's OWN cameras plus at most four
+ overview-rig tiles; the harness's eye-level rig is a diagnostic only. A `must` acceptance item
+ the harness cannot verify caps a round at 0.60 AND fails its verdict, so on the scene track
+ only the spec's `must_have` list keeps that priority (the plan's own checklist is `should`).
+* Articulated: candidate selection uses the quick 4-view rig plus the sweep's pose views; mimic
+ joints are honoured; the sweep is O(links² × poses).
+* Scenes: fps is a record only (the draw count is what is gated); camera-in-geometry can miss
+ open-back enclosures.
* threejs: textures are stripped on GLB export; `userData.tick` cannot survive export.
-* agy has no per-workspace MCP: each session (Gemini-API mode, the only one the harness runs)
- gets a HOME of its own with the 3dcode server in it. A killed agy session books no usage (its tokens are in the envelope only). A killed codex session books an ESTIMATE
- (usage is per turn and `--ephemeral` leaves no rollout; `CodexEvents.estimated_usage` prices
- the stream it left, ledger `source="estimate"`, $ within 0.62–1.34× of actual on 356 recorded
- sessions); a killed claude-code session books its
- per-message usage, whose output side is a floor.
-* Vendor sessions see only the routed skill bundles, except agy (5 built-ins; no
- per-session switch) and any user-level skill root codex might grow.
-* Anthropic / OpenAI backends are mock-tested only (no keys on this box).
-* Budget checks run between steps: a round the clock cuts mid-way is rolled back (its
- spend stays in `aborted_rounds`) — give scenes `--max-minutes 60`.
-* Gemini flash 503 storms happen; dead keys and 429s rotate freely now, but a
- sustained outage can still fail a round (`3dcode resume` re-uses cached stages). A
- storm-dead agent session gets the round loop's ONE transport retry (fresh key), no
- single-shot fallback (D103).
+* agy has no per-workspace MCP: each session gets a HOME of its own with the 3dcode server in it.
+ A killed agy session books no usage; a killed codex session books an ESTIMATE (ledger
+ `source="estimate"`); a killed claude-code session books its per-message usage, whose output
+ side is a floor.
+* Vendor sessions see only the routed skill bundles, except agy (5 built-ins; no per-session
+ switch) and any user-level skill root codex might grow.
+* Anthropic / OpenAI backends are mock-tested only.
+* Budget checks run between steps: a round the clock cuts mid-way is rolled back (its spend
+ stays in `aborted_rounds`) — give scenes `--max-minutes 60`.
+* A sustained Gemini outage can still fail a round (`3dcode resume` re-uses cached stages). A
+ storm-dead agent session gets the round loop's ONE transport retry (fresh key), no single-shot
+ fallback.
## 10. Flywheel
`record.json` per run + git history; `3dcode flywheel export` writes sample folders
-(`<out>/<track>/<language>/<slug>/{code.<ext>, src/**, robot.urdf, meta.json,
-captions.json, renders/}`) of the PICKED round (`addons/select`; the last built round
-when none was judged) with **quality tiers** from that round's verdict (A passed & 0 gate
-errors, B passed, C score ≥ 0.6, D else), acceptance checklists, gate summaries and
-`(code fingerprint, prompt)` dedupe (`--drop-duplicates`; side-car captions via
-`--captions-dir`); `metadata.parquet`/`.jsonl` carry tier, gate
-errors, cost, fingerprints, `duplicate_of`; `--pack` tars with byte-range locators.
-`flywheel pairs` emits preference pairs (round i < j by judge Δ ≥ τ) and round-level
-repair pairs (in-session trajectory mining died with the api-agent, 2026-08-28 —
-vendor CLIs log raw stdout, not structured tool turns); `flywheel refine` emits the loop's OWN transitions — one row per (round i → round
-i+1) where the harness asked for a change, carrying what condemned the round, the
-instructions written in response, both code snapshots and whether the score moved
-(the row is `addons/dataset/refine.RefineTransition`; INTERFACES has the fields and the
-drop reasons). That is the supervision the harness produces that a
-one-shot corpus cannot: what a failing artefact looked like, what was wrong with it
-in the harness's own words, and what the fix changed. `finetune/llamafactory/`
-turns those rows into training files; the harness writes the measurement, not the
-trainer's format. `flywheel caption` adds
-{detailed, instruction, factory} captions (image-grounded, brand-free, `--out` for
-side-car mode); the gallery is `3dcode gallery build --embed`
-(the dataset addon has no renderer of its own).
+(`<out>/<track>/<language>/<slug>/{code.<ext>, src/**, robot.urdf, meta.json, captions.json,
+renders/}`) of the PICKED round (the last built round when none was judged) with **quality
+tiers** from that round's verdict (A passed & 0 gate errors, B passed, C score ≥ 0.6, D else),
+acceptance checklists, gate summaries and `(code fingerprint, prompt)` dedupe
+(`--drop-duplicates`; side-car captions via `--captions-dir`); `metadata.parquet`/`.jsonl` carry
+tier, gate errors, cost, fingerprints, `duplicate_of`; `--pack` tars with byte-range locators.
+`flywheel pairs` emits preference pairs (round i < j by judge Δ ≥ τ) and round-level repair
+pairs; `flywheel refine` emits the loop's OWN transitions — one row per (round i → round i+1)
+where the harness asked for a change, carrying what condemned the round, the instructions
+written in response, both code snapshots and whether the score moved
+(`addons/dataset/refine.RefineTransition`). That is the supervision the harness produces that a
+one-shot corpus cannot. `finetune/llamafactory/` turns those rows into training files; the
+harness writes the measurement, not the trainer's format. `flywheel caption` adds {detailed,
+instruction, factory} captions (`--out` for side-car mode); the gallery is `3dcode gallery build
+--embed`.
`codeverse3d/addons/gallery/` is the **local** answer to the same question: `3dcode gallery
serve` indexes `runs/` + every `eval/bench/out/*/runs`, serves the page **and the run
-directories** on 127.0.0.1 (so every link opens: sheet, renders, `src/`, `object.glb`
-in an orbit viewer built on the vendored three.js, `record.json`), and re-reads a
-run's record per request so a battery that is still writing shows up live (how to use it:
-RUNBOOK §4). Two gates keep it safe: a URL can only name a `(battery, slug)` the scanner found under
-a declared root, and `urls.safe_join` refuses anything that escapes that run
+directories** on 127.0.0.1 (sheet, renders, `src/`, `object.glb` in an orbit viewer built on the
+vendored three.js, `record.json`), and re-reads a run's record per request so a battery that is
+still writing shows up live (RUNBOOK §4). A URL can only name a `(battery, slug)` the scanner
+found under a declared root, and `urls.safe_join` refuses anything that escapes that run
directory. `3dcode gallery build [--embed]` writes the same page as one file.
diff --git a/harness/docs/INSTALL.md b/harness/docs/INSTALL.md
index 8bd70a48..97a71bef 100644
--- a/harness/docs/INSTALL.md
+++ b/harness/docs/INSTALL.md
@@ -1,12 +1,8 @@
# Installing the 3dcodeverse harness
-Everything below was executed on this machine (WSL2 Ubuntu, RTX 5090, Python
-3.13.9, node v24.14.0, Blender 5.2.2 LTS — since 2026-10-14, was 5.0.1) on 2026-08-23; the version numbers and the
-`3dcodeverse doctor` output in §9 are real, not illustrative. Paths are relative
-to the harness root (`harness/` in the 3dcodeverse checkout) unless absolute.
-
-Once installed, read `docs/RUNBOOK.md` (how to run), `docs/ARCHITECTURE.md`
-(what a run does) and `CLAUDE.md` (working rules).
+Paths are relative to the harness root (`harness/` in the 3dcodeverse checkout) unless absolute.
+Once installed, read `docs/RUNBOOK.md` (how to run) and `docs/ARCHITECTURE.md` (what a run
+does).
1. [TL;DR](#1-tldr) · 2. [Prerequisites](#2-prerequisites)
(incl. [supported versions](#21-supported-versions)) ·
@@ -15,8 +11,7 @@ Once installed, read `docs/RUNBOOK.md` (how to run), `docs/ARCHITECTURE.md`
7. [GPU / headless rendering](#7-gpu--headless-rendering) ·
8. [Keys, CLIs and settings](#8-keys-clis-and-settings) ·
9. [Verify — `3dcodeverse doctor`](#9-verify--3dcodeverse-doctor) ·
-10. [5-minute smoke](#10-5-minute-smoke) · 11. [Uninstall / cleanup](#11-uninstall--cleanup) ·
-12. [Appendix: verified versions](#12-appendix-verified-versions-on-this-box)
+10. [5-minute smoke](#10-5-minute-smoke) · 11. [Uninstall / cleanup](#11-uninstall--cleanup)
---
@@ -30,11 +25,9 @@ bash harness/setup.sh # python + node deps + chrome + the agy / claud
```
`setup.sh` is idempotent — it checks the interpreter versions, runs
-`pip install -e 'harness[all,dev]'`, runs `npm ci` in `runtime_js/` **only when the
-lockfile actually moved**, makes sure puppeteer's Chrome is downloaded, brings the three
-coding-agent CLIs to their latest release (§8.2: `agy update`, or Google's installer when there
-is no agy; `npm i -g` for claude and codex whenever the installed npm version differs from the
-registry's `latest`), and finishes by printing `3dcodeverse doctor`. Useful flags:
+`pip install -e 'harness[all,dev]'`, runs `npm ci` in `runtime_js/` **only when the lockfile
+actually moved**, makes sure puppeteer's Chrome is downloaded, brings the three coding-agent
+CLIs to their latest release (§8.2), and finishes by printing `3dcodeverse doctor`. Flags:
`--extras cad,urdf`, `--python /path/to/python`, `--no-python`, `--no-node`, `--no-chrome`,
`--no-clis`, `--no-doctor`, `--no-gpu`, `--force-npm`, `--help`.
@@ -48,10 +41,9 @@ npm i -g @anthropic-ai/claude-code@latest @openai/codex@latest # the optional
3dcodeverse doctor
```
-> **Running installs on a busy box.** `npm ci` deletes `node_modules/` before
-> re-creating it, and `pip install -e` rewrites the entry points. If benches or
-> renders are running against this checkout, use `setup.sh --no-clis` (it skips `npm ci`
-> when the lockfile is unchanged, and `--no-clis` leaves the generators' CLIs alone) or
+> **Running installs on a busy box.** `npm ci` deletes `node_modules/` before re-creating it,
+> and `pip install -e` rewrites the entry points. If benches or renders are running against
+> this checkout, use `setup.sh --no-clis` (it skips `npm ci` when the lockfile is unchanged) or
> wait for them to finish.
---
@@ -60,38 +52,33 @@ npm i -g @anthropic-ai/claude-code@latest @openai/codex@latest # the optional
### 2.1 Supported versions
-One fixed Python version — **3.13** — by the owner's decision (2026-08-26): no floor, no
-matrix, no compatibility shims, and — since the same day — no CI: the owner removed the
-workflow, so the offline suite and `ruff` are run locally before every push (see CLAUDE.md).
+One fixed Python version — **3.13** — no floor, no matrix, no compatibility shims, and no CI: the
+offline suite and `ruff` are run locally before every push (see `CLAUDE.md`).
| component | version | how it is enforced | notes |
|---|---|---|---|
| **python** | **3.13** | `requires-python = ">=3.13"`; ruff `target-version = "py313"`; `PY_FLOOR` in `tests/core/test_portability.py`; `MIN_PY_MINOR` in `setup.sh` | the four places are pinned together by the portability test |
| **node** | **20.6.0+** (developed on 24 LTS) | `runtime_js/package.json` `engines.node`; `codeverse3d.spatial.node.NODE_MIN` fails every node workload with an actionable message | 20.6 is the `--import` module-hook floor |
-| **Blender** | **5.2 LTS** only (developed and measured on 5.2.2; D104, 2026-10-14) | `BLENDER_MIN = (5, 2)` in `codeverse3d/config.py`; `3dcode doctor` fails anything older; `Settings.resolve_blender()` | `blender`, `urdf_blender` and `scene_blender` are the users |
-| **OS** | Linux x86_64 (WSL2 Ubuntu here) | — | macOS should work (nothing is Linux-specific except `resource.setrlimit` guards) but is not tested |
-
-The offline suite on this box, 2026-09-23: **1332 passed of the 1332 selected**
-(22 deselected are `live`).
+| **Blender** | **5.2 LTS** only | `BLENDER_MIN = (5, 2)` in `codeverse3d/config.py`; `3dcode doctor` fails anything older; `Settings.resolve_blender()` | `blender`, `urdf_blender` and `scene_blender` are the users; the prompts and lints state 5.2 API facts |
+| **OS** | Linux x86_64 (WSL2 works) | — | macOS should work (nothing is Linux-specific except `resource.setrlimit` guards) but is not tested |
Moving to another Python later is the same four-line change (`requires-python`, ruff
`target-version`, `PY_FLOOR`, `MIN_PY_MINOR`).
### 2.2 What you need installed
-| what | required? | verified here | how it degrades without it |
-|---|---|---|---|
-| **Python 3.13** | yes | 3.13.9 (`~/miniconda3/bin/python`) | nothing runs; `requires-python = ">=3.13"` (§2.1) |
-| **pip + venv** | yes | pip 25.3, `python -m venv` | `setup.sh` cannot install the package. A stock Debian/Ubuntu `/usr/bin/python3` ships **without** pip and is PEP 668 `EXTERNALLY-MANAGED`, so `pip install -e harness` refuses even once pip is present: `sudo apt install python3-venv python3-pip`, then use a virtualenv |
-| **git** | yes | 2.53.0 | run workspaces are git repos (one commit per round); `Workspace.create()` and the flywheel pair miners fail |
-| **node ≥ 20.6** | yes, except for the `graphics` track | v24.14.0 (npm 11.9.0) | the `threejs` / `scene_threejs` languages disappear **and no object renders happen at all**: `spatial/render.py` renders *every* GLB (Blender-built and CadQuery-built included) with three.js in headless Chrome. Only `graphics` (moderngl) is node-free |
-| **Blender 5.2 LTS** | optional | 5.2.2 LTS (`~/.local/bin/blender-5.2`) | `blender`, `urdf_blender` and `scene_blender` languages unavailable → the `static_object` default language and the whole `articulated_object` track cannot build (`BlenderNotFoundError`); scenes lose planner-chosen bpy GLB assets |
-| **EGL-capable GPU stack** | optional | ANGLE / D3D12 / RTX 5090 Laptop | headless Chrome falls back to **SwiftShader** and moderngl to **llvmpipe** — everything still renders, just several times slower; no correctness change |
-| C toolchain | usually no | — | only if pip has to build a wheel from source (`python-fcl` ships wheels for cp310–cp313 x86_64) |
-
-Disk: ~100 MB for `runtime_js/node_modules`, ~640 MB for puppeteer's Chrome,
-~1 GB for a Blender tarball, plus whatever `runs/` and `~/.cache/codeverse3d` grow
-to (619 MB here after a week of benches).
+| what | required? | how it degrades without it |
+|---|---|---|
+| **Python 3.13** | yes | nothing runs; `requires-python = ">=3.13"` (§2.1) |
+| **pip + venv** | yes | `setup.sh` cannot install the package. A stock Debian/Ubuntu `/usr/bin/python3` ships **without** pip and is PEP 668 `EXTERNALLY-MANAGED`, so `pip install -e harness` refuses even once pip is present: `sudo apt install python3-venv python3-pip`, then use a virtualenv |
+| **git** | yes | run workspaces are git repos (one commit per round); `Workspace.create()` and the flywheel pair miners fail |
+| **node ≥ 20.6** | yes, except for the `graphics` track | the `threejs` / `scene_threejs` languages disappear **and no object renders happen at all**: `spatial/render.py` renders *every* GLB (Blender-built and CadQuery-built included) with three.js in headless Chrome. Only `graphics` (moderngl) is node-free |
+| **Blender 5.2 LTS** | optional | `blender`, `urdf_blender` and `scene_blender` languages unavailable → the `static_object` default language and the whole `articulated_object` track cannot build (`BlenderNotFoundError`); scenes lose planner-chosen bpy GLB assets |
+| **EGL-capable GPU stack** | optional | headless Chrome falls back to **SwiftShader** and moderngl to **llvmpipe** — everything still renders, just several times slower; no correctness change |
+| C toolchain | usually no | only if pip has to build a wheel from source (`python-fcl` ships wheels for cp310–cp313 x86_64) |
+
+Disk: ~100 MB for `runtime_js/node_modules`, ~640 MB for puppeteer's Chrome, ~1 GB for a
+Blender tarball, plus whatever `runs/` and `~/.cache/codeverse3d` grow to.
---
@@ -102,14 +89,13 @@ git clone <repo> 3dcodeverse
cd 3dcodeverse
```
-Layout: the harness is the `harness/` subdirectory (python dist `3dcodeverse`,
-import package `codeverse3d`, CLIs `3dcodeverse` and `3dcode`). See the repo
-`README.md` for the other top-level components.
+Layout: the harness is the `harness/` subdirectory (python dist `3dcodeverse`, import package
+`codeverse3d`, CLIs `3dcodeverse` and `3dcode`). See the repo `README.md` for the other
+top-level components.
-Use a virtualenv (or a conda env — this box installs into a conda base env). It is
-only optional when your interpreter already owns its site-packages: a distro
-`/usr/bin/python3` is PEP 668 `EXTERNALLY-MANAGED` and pip will refuse to install into
-it. `setup.sh` checks for pip and for that marker up front and tells you which
+Use a virtualenv or a conda env. It is only optional when your interpreter already owns its
+site-packages: a distro `/usr/bin/python3` is PEP 668 `EXTERNALLY-MANAGED` and pip will refuse
+to install into it. `setup.sh` checks for pip and for that marker up front and tells you which
of the two you hit.
```bash
@@ -125,30 +111,29 @@ pip install -e harness # core only
pip install -e 'harness[all,dev]' # everything (what setup.sh does)
```
-`-e` (editable) is the intended mode: the harness is developed in place and the
-console scripts (`3dcodeverse`, `3dcode`) point back at the checkout.
+`-e` (editable) is the intended mode: the harness is developed in place and the console scripts
+(`3dcodeverse`, `3dcode`) point back at the checkout.
-Core dependencies (always installed): pydantic + pydantic-settings (contracts,
-settings), typer + rich (CLI), jinja2 (prompt templates), pyyaml, numpy, trimesh
-(mesh measurement), python-fcl (collision), pillow, google-genai, anthropic,
-openai.
+Core dependencies (always installed): pydantic + pydantic-settings (contracts, settings), typer +
+rich (CLI), jinja2 (prompt templates), pyyaml, numpy, trimesh (mesh measurement), python-fcl
+(collision), pillow, google-genai, anthropic, openai.
| extra | pulls | unlocks |
|---|---|---|
| `cad` | cadquery | the `cadquery` language (`--language cadquery`) |
| `urdf` | yourdfpy, scipy | the `articulated_object` track: URDF parse/validate + joint math |
| `graphics` | moderngl | the `graphics` track (`glsl_shader`, `opengl_python`) — headless GL rendering in `spatial/gl_render.py` |
-| `mesh` | shapely, networkx, matplotlib | `cross_section` (filled area / hollow ratio from shapely, the image drawn by the judge-slice renderer in matplotlib), mesh split / connectivity (networkx), judge cross-section slices on gate-ERROR rounds (`judge_slices`, D48; without the extra the judge logs a warning and sends the pre-D48 payload) |
-| `mcp` | mcp | `3dcode mcp` / `codeverse3d.spatial.mcp_server`, i.e. spatial tools for the `agy` (Gemini-API mode), `claude-code` and `codex` backends |
-| `flywheel` | pyarrow | `3dcode flywheel export --pack` (parquet shards). A plain `flywheel export` needs nothing: without pyarrow it writes `metadata.jsonl` and skips `metadata.parquet` with a warning. |
+| `mesh` | shapely, networkx, matplotlib | `cross_section` (filled area / hollow ratio from shapely, the image drawn in matplotlib), mesh split / connectivity (networkx), judge cross-section slices on gate-ERROR rounds (without the extra the judge logs a warning and sends the payload without slices) |
+| `mcp` | mcp | `3dcode mcp` / `codeverse3d.spatial.mcp_server`, i.e. spatial tools for the `agy`, `claude-code` and `codex` backends |
+| `flywheel` | pyarrow | `3dcode flywheel export --pack` (parquet shards). A plain `flywheel export` needs nothing: without pyarrow it writes `metadata.jsonl` and skips `metadata.parquet` with a warning |
| `all` | all of the above | — |
| `dev` | pytest, pytest-timeout, ruff | the test suite and the linter |
-`graphics`, `mesh`, `mcp` and `flywheel` are lazily imported: without them the
-harness installs and starts fine and only the named feature raises `ImportError`
-at the moment you use it. `3dcodeverse doctor` lists every one of these modules
-under `python deps` and only tolerates the optional-extra modules — `shapely` (mesh), `yourdfpy` (urdf), `mcp`, `moderngl` (graphics), `cadquery` (cad) —
-as WARN, naming the extra to install; everything else missing is a FAIL.
+`graphics`, `mesh`, `mcp` and `flywheel` are lazily imported: without them the harness installs
+and starts fine and only the named feature raises `ImportError` at the moment you use it.
+`3dcodeverse doctor` lists every one of these modules under `python deps` and only tolerates the
+optional-extra modules — `shapely` (mesh), `yourdfpy` (urdf), `mcp`, `moderngl` (graphics),
+`cadquery` (cad) — as WARN, naming the extra to install; everything else missing is a FAIL.
Run the offline test suite to confirm the install:
@@ -160,108 +145,81 @@ python -m pytest tests -q -m "not live and not blender and not node" # pure-p
python -m pytest tests -q -m live # OPT-IN: real API calls, needs keys
```
-Live tests are deselected by default (`addopts = ["-m", "not live"]` in `pyproject.toml`),
-so a bare `pytest` never spends money and never hangs waiting on a provider outage. A
-command-line `-m` **replaces** that default rather than adding to it, so any subset you
-select must spell `not live` itself — as the line above does.
+Live tests are deselected by default (`addopts = ["-m", "not live"]` in `pyproject.toml`), so a
+bare `pytest` never spends money and never hangs waiting on a provider outage. A command-line
+`-m` **replaces** that default rather than adding to it, so any subset you select must spell
+`not live` itself — as the line above does.
---
## 5. runtime_js — the node side
-**Short answer to "is `runtime_js/node_modules` basically an installation of
-node.js?"** — no. Node.js itself is a *system prerequisite* you install once
-(§2). `runtime_js/` is a small **npm package owned by the harness**, and
-`node_modules/` is that package's dependency tree, downloaded by npm into the
-checkout. It is not optional decoration: apart from the `graphics` track, every
-render in the harness goes through it (`spatial/render.py` → `render_glb.mjs` →
-three.js in headless Chrome), whichever language produced the GLB.
+Node.js itself is a *system prerequisite* you install once (§2). `runtime_js/` is a small **npm
+package owned by the harness**, and `node_modules/` is that package's dependency tree, downloaded
+by npm into the checkout. Apart from the `graphics` track, every render in the harness goes
+through it (`spatial/render.py` → `render_glb.mjs` → three.js in headless Chrome), whichever
+language produced the GLB.
```
harness/runtime_js/
package.json committed — 2 direct deps
- package-lock.json committed — exact tree (99 packages), the reproducibility unit
- node_modules/ NOT committed — .gitignore'd, ~97 MB, created by `npm ci`
+ package-lock.json committed — exact tree, the reproducibility unit
+ node_modules/ NOT committed — .gitignore'd, ~100 MB, created by `npm ci`
*.mjs *.cjs lib/ the harness's own node code (see runtime_js/README.md)
```
-Direct dependencies and what they are for:
-
-| package | version here | used for |
-|---|---|---|
-| `three` | 0.182.0 | GLB export (`export_glb.mjs`), the render rig, the scene host, GLSL preflight |
-| `puppeteer` | 24.43.1 | headless Chrome for WebGL rendering (`gpu_launch.cjs`, `browser_daemon.cjs`) |
+Direct dependencies: `three` (GLB export, the render rig, the scene host, GLSL preflight) and
+`puppeteer` (headless Chrome for WebGL rendering).
### Install / refresh
```bash
cd harness/runtime_js
-npm ci # exact lockfile install; ~2 s, 99 packages, 95–97 MB
+npm ci # exact lockfile install
npx puppeteer browsers install chrome # only if the Chrome cache is missing (see below)
```
-Use **`npm ci`**, not `npm install`: `ci` installs exactly what
-`package-lock.json` pins and never rewrites it, which is what keeps renders
-reproducible. `npm ci` **deletes `node_modules/` first**, so do not run it while
-a bench or render is using this checkout.
-
-You need to re-run it when:
-
-* `node_modules/` does not exist (fresh clone — it is gitignored, so cloning
- never brings it), or
-* you pulled a change to `runtime_js/package.json` / `package-lock.json`, or
-* `3dcodeverse doctor` reports `three` or `puppeteer` FAIL.
-
-`setup.sh` automates exactly that test: it compares the mtime of
-`package-lock.json` against `node_modules/.package-lock.json` and skips the
-reinstall when nothing moved (`--force-npm` overrides).
+Use **`npm ci`**, not `npm install`: `ci` installs exactly what `package-lock.json` pins and
+never rewrites it, which is what keeps renders reproducible. `npm ci` **deletes
+`node_modules/` first**, so do not run it while a bench or render is using this checkout. Re-run
+it when `node_modules/` does not exist (fresh clone), when you pulled a change to
+`runtime_js/package.json` / `package-lock.json`, or when `3dcodeverse doctor` reports `three` or
+`puppeteer` FAIL. `setup.sh` automates exactly that test (`--force-npm` overrides).
### Chrome
-puppeteer downloads its own Chrome build (it does **not** use a system Chrome)
-into `~/.cache/puppeteer` — here `chrome/linux-148.0.7778.97` and
-`chrome-headless-shell/linux-148.0.7778.97`, 636 MB together. npm's
-`postinstall` normally does this for you; run the explicit command when the
-cache was cleared or when `PUPPETEER_SKIP_DOWNLOAD` was set:
+puppeteer downloads its own Chrome build (it does **not** use a system Chrome) into
+`~/.cache/puppeteer` (~640 MB). npm's `postinstall` normally does this for you; run the explicit
+command when the cache was cleared or when `PUPPETEER_SKIP_DOWNLOAD` was set:
```bash
cd harness/runtime_js && npx puppeteer browsers install chrome
-# [email protected] ~/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
```
-Re-running it is a no-op that just prints the cached path. `PUPPETEER_CACHE_DIR`
-moves the cache elsewhere (keep it consistent between install and run).
+Re-running it is a no-op that just prints the cached path. `PUPPETEER_CACHE_DIR` moves the
+cache elsewhere (keep it consistent between install and run).
### Why generated code never sees this directory
-Agent-written Three.js code is **raw** — it does `import * as THREE from 'three'`
-and nothing else; it never imports a harness module and never gets a
-`node_modules/` of its own inside the run workspace. The harness resolves that
-bare specifier for it in two places:
-
-* **node**: `node --import runtime_js/lib/resolve_three.mjs …` installs a
- `registerHooks` resolver that redirects `three` and `three/addons/*` into
- `runtime_js/node_modules`, for a module living anywhere
- on disk (`NODE_PATH` cannot do this — it is CommonJS-only). Python side:
- `spatial.node.run_node(..., three_hook=True)`.
-* **browser**: `serve.cjs` mounts `runtime_js/` at `/__runtime/` on the loopback
- server and `importMapHtml()` emits an import map pointing `three` at
- `/__runtime/node_modules/three/build/three.module.js`. Nothing is ever fetched
- from a CDN.
-
-So `runtime_js/node_modules` is a *harness* dependency, on the same footing as
-the harness's python dependencies — not part of the generated artifact, and not
-something the agent may install into.
+Agent-written Three.js code is **raw** — it does `import * as THREE from 'three'` and nothing
+else; it never imports a harness module and never gets a `node_modules/` of its own inside the
+run workspace. The harness resolves that bare specifier for it in two places:
+
+* **node**: `node --import runtime_js/lib/resolve_three.mjs …` installs a `registerHooks`
+ resolver that redirects `three` and `three/addons/*` into `runtime_js/node_modules`, for a
+ module living anywhere on disk (`NODE_PATH` cannot do this — it is CommonJS-only). Python
+ side: `spatial.node.run_node(..., three_hook=True)`.
+* **browser**: `serve.cjs` mounts `runtime_js/` at `/__runtime/` on the loopback server and
+ `importMapHtml()` emits an import map pointing `three` at
+ `/__runtime/node_modules/three/build/three.module.js`. Nothing is ever fetched from a CDN.
---
## 6. Blender
-Optional, but the `static_object` default language, the entire `articulated_object`
-track and the `scene_blender` scene language need it. **Blender 5.2 LTS is the one
-supported version** (D104, 2026-10-14: developed and measured on 5.2.2; `doctor` fails
-anything older — 4.2 / 5.0 compatibility was dropped on purpose, the prompts and lints
-state 5.2 API facts).
+Optional, but the `static_object` default language, the entire `articulated_object` track and
+the `scene_blender` scene language need it. **Blender 5.2 LTS is the one supported version**
+(`doctor` fails anything older).
Option A — distro package (only if it ships 5.2 LTS):
@@ -269,8 +227,8 @@ Option A — distro package (only if it ships 5.2 LTS):
sudo apt-get install blender # or: brew install --cask blender
```
-Option B — official tarball (what this box uses, no sudo needed); verify the checksum
-against <https://download.blender.org/release/Blender5.2/blender-5.2.2.sha256>:
+Option B — official tarball (no sudo needed); verify the checksum against
+<https://download.blender.org/release/Blender5.2/blender-5.2.2.sha256>:
```bash
mkdir -p ~/tools && cd ~/tools
@@ -279,27 +237,12 @@ tar xf blender-5.2.2-linux-x64.tar.xz
~/tools/blender-5.2.2-linux-x64/blender --version # Blender 5.2.2 LTS
```
-### The judged-frame fast path (scene_blender, measured on 5.2.2)
+### Missing X11 libraries (no sudo)
-`render_bpy_scene.py` owns every render setting. On this box (RTX 5090, 1024×576, a
-460-object scene) one Cycles frame at 32 spp with GPU OIDN costs 0.64 s; with
-`render.use_persistent_data` the synced scene and BVH survive between the cameras of
-one job, so 8 frames take 2.2 s instead of 5.3 s (0.21 s per frame after the first).
-64 spp 0.69 s, 128 spp 0.86 s, CPU 2.3 s. EEVEE in background mode is *slower* here
-(5.2 s per frame plus a 12 s shader compile per process) and Workbench is 0.12 s.
-`Settings.render.blender_frame_time_limit_s` (default 20 s, `cycles.time_limit`) caps
-a heavy scene's sampling per frame. **OptiX is not available under WSL2** (no
-`libnvoptix`, init error 7804) and setting the compute device type to OPTIX and back
-crashes Blender 5.2.2 — the harness only ever enumerates CUDA; `3dcode doctor` times one
-256×144 frame on exactly this path.
-
-### The `LD_LIBRARY_PATH` wrapper trick
-
-The stock Linux build links `libSM.so.6` / `libICE.so.6` even in `--background`
-mode, and those are not installed system-wide here (no sudo). They were
-extracted from the Ubuntu debs into `~/.local/xlibs`, and a one-line wrapper on
-`PATH` prepends that directory to the loader path so no caller has to remember —
-`~/.local/bin/blender-5.2`:
+The stock Linux build links `libSM.so.6` / `libICE.so.6` even in `--background` mode. If they
+are not installed system-wide, extract them from the distro packages into a directory of your
+own and put a one-line wrapper on `PATH` named `blender-5.2` (the first name the harness looks
+for):
```bash
#!/bin/bash
@@ -308,49 +251,48 @@ export LD_LIBRARY_PATH="$HOME/.local/xlibs/usr/lib/x86_64-linux-gnu:${LD_LIBRARY
exec "$BLENDER_HOME/blender" "$@"
```
-Make it executable (`chmod +x ~/.local/bin/blender-5.2`) and keep the name — it
-is the first candidate the harness looks for. If your distro does have the X11
-libs, point the wrapper at the tarball and drop the `LD_LIBRARY_PATH` line, or
-skip the wrapper entirely.
+### Rendering
+
+`languages/wrappers/render_bpy_scene.py` owns every render setting for `scene_blender`'s judged
+frames: Cycles on CUDA with GPU denoising and persistent data when a CUDA device exists, CPU
+otherwise; `Settings.render.blender_frame_time_limit_s` (default 20 s) caps a heavy scene's
+sampling per frame. **OptiX is never enumerated** (it is unavailable under WSL2 and probing it
+crashes Blender). `3dcode doctor` times one small frame on exactly this path.
### How the harness finds it
`Settings.resolve_blender()` (`codeverse3d/config.py`) returns the first hit of:
1. `settings.binaries.blender` when it is set — in the settings YAML or with
- `C3D_BINARIES__BLENDER=/path/to/blender`. A configured binary is never replaced
- by one from `PATH`: if it is missing or not executable, builds raise
- `BlenderNotFoundError` and `doctor` reports `blender FAIL`;
+ `C3D_BINARIES__BLENDER=/path/to/blender`. A configured binary is never replaced by one from
+ `PATH`: if it is missing or not executable, builds raise `BlenderNotFoundError` and `doctor`
+ reports `blender FAIL`;
2. only when nothing is configured: `blender-5.2`, then `blender` on `PATH`.
Nothing found → `3dcodeverse doctor` reports `blender FAIL` and builds raise
`BlenderNotFoundError`. Blender is always invoked `-b --factory-startup` with
-`PYTHONPATH`/`PYTHONHOME` stripped from the child env, so your conda env cannot
-leak into bpy.
+`PYTHONPATH`/`PYTHONHOME` stripped from the child env, so your conda env cannot leak into bpy.
---
## 7. GPU / headless rendering
-Nothing to install beyond the `graphics` extra (§4) and `runtime_js` (§5) — the
-harness picks the backend itself and both paths have a software fallback.
+Nothing to install beyond the `graphics` extra (§4) and `runtime_js` (§5) — the harness picks
+the backend itself and both paths have a software fallback.
-* **Three.js / scenes** → headless Chrome via `runtime_js/gpu_launch.cjs`, which
- tries `--use-angle=gl-egl` plus the Mesa d3d12 env and probes
- `UNMASKED_RENDERER`; a negative verdict is cached 20 minutes in
- `~/.cache/codeverse3d/gpu_probe.json`, and it falls back to SwiftShader.
- Force with `C3D_RENDER_GPU=on|off|auto` (node side) or `render.gpu` in the
+* **Three.js / scenes** → headless Chrome via `runtime_js/gpu_launch.cjs`, which tries
+ `--use-angle=gl-egl` plus the Mesa d3d12 env and probes `UNMASKED_RENDERER`; a negative
+ verdict is cached 20 minutes in `~/.cache/codeverse3d/gpu_probe.json`, and it falls back to
+ SwiftShader. Force with `C3D_RENDER_GPU=on|off|auto` (node side) or `render.gpu` in the
settings YAML / `C3D_RENDER__GPU`.
-* **graphics track** → moderngl in a fresh subprocess per render
- (`spatial/gl_render.py`), which sets `GALLIUM_DRIVER=d3d12` +
- `MESA_LOADER_DRIVER_OVERRIDE=d3d12` first and retries with
- `LIBGL_ALWAYS_SOFTWARE=1` + llvmpipe if the context cannot be created. You do
- not set these yourself.
+* **graphics track** → moderngl in a fresh subprocess per render (`spatial/gl_render.py`), which
+ sets `GALLIUM_DRIVER=d3d12` + `MESA_LOADER_DRIVER_OVERRIDE=d3d12` first and retries with
+ `LIBGL_ALWAYS_SOFTWARE=1` + llvmpipe if the context cannot be created. You do not set these
+ yourself.
-On a headless Linux server without a GPU, both fallbacks work out of the box;
-expect renders to take a few times longer. On WSL2 you need the vendor's WSL
-driver installed on the Windows side for the d3d12 path — check with
-`3dcodeverse doctor`'s `chrome webgl` row.
+On a headless Linux server without a GPU, both fallbacks work out of the box; expect renders to
+take a few times longer. On WSL2 you need the vendor's WSL driver installed on the Windows side
+for the d3d12 path — check with `3dcodeverse doctor`'s `chrome webgl` row.
---
@@ -360,18 +302,15 @@ driver installed on the Windows side for the d3d12 path — check with
| variable | needed for | notes |
|---|---|---|
-| `GEMINI_API_KEYS` | all `gemini:*` models (planner, judge, captioner, generators) | comma-separated list; the whole list becomes one `KeyPool` (a 429 rotates to another key and cools the key ≤ 3 s, dead keys benched 1 h; no per-key RPM buckets since 2026-09-22) |
+| `GEMINI_API_KEYS` | all `gemini:*` models (planner, judge, captioner, generators) and `agy` | comma-separated list; the whole list becomes one `KeyPool` (a 429 rotates to another key, dead keys are benched 1 h) |
| `GEMINI_API_KEY` / `GOOGLE_API_KEY` | same | single-key fallback when `GEMINI_API_KEYS` is unset |
-| `ANTHROPIC_API_KEY` | `anthropic:*` chat models | optional; not set here → those backends are unavailable (doctor WARN) |
+| `ANTHROPIC_API_KEY` | `anthropic:*` chat models | optional; unset → those backends are unavailable (doctor WARN) |
| `OPENAI_API_KEY` | `openai:*` chat models | optional; `C3D_OPENAI_BASE_URL` points at a compatible gateway |
-Resolution order for the Gemini keys (`codeverse3d/config.py`), first non-empty wins:
-settings YAML `gemini_api_keys:` → `GEMINI_API_KEYS` (csv) → `GEMINI_API_KEY` /
-`GOOGLE_API_KEY` → the legacy compatibility file
-`~/.config/astra3d/gemini_keys.env`, from which a line
-`GEMINI_API_KEYS="key1,key2,…"` is read (this is where this box's keys
-come from). Duplicates are removed, order preserved. Keys are never written
-into run records.
+Resolution order for the Gemini keys (`codeverse3d/config.py`), first non-empty wins: settings
+YAML `gemini_api_keys:` → `GEMINI_API_KEYS` (csv) → `GEMINI_API_KEY` / `GOOGLE_API_KEY` → a
+line `GEMINI_API_KEYS="key1,key2,…"` in `~/.config/astra3d/gemini_keys.env`. Duplicates are
+removed, order preserved. Keys are never written into run records.
```bash
export GEMINI_API_KEYS="key1,key2,key3" # e.g. in ~/.bashrc
@@ -380,40 +319,36 @@ export GEMINI_API_KEYS="key1,key2,key3" # e.g. in ~/.bashrc
### 8.2 The coding-agent CLIs (`agy` required, the rest optional)
-The generator is always a vendor CLI: `--generator agy:… | claude-code:… | codex:…`.
-Since 2026-10-13 (D103; gemini-cli was removed) the default is `agy:gemini-4-argon`, so **`agy` is
-the one CLI a default run needs**. The harness runs agy **only in Gemini-API mode**, so it needs
-Gemini keys (§8.1): one key from the harness's own pool per session, the 3dcode MCP tools, priced at
-Gemini list price — no sign-in, no non-Gemini model. Without keys an agy session fails at once
-(doctor row `agy gemini keys`). The other two are needed only when you name them.
+The generator is always a vendor CLI: `--generator agy:… | claude-code:… | codex:…`. The
+default is `agy:gemini-4-argon`, so **`agy` is the one CLI a default run needs**. The harness
+runs agy **only in Gemini-API mode**, so it needs Gemini keys (§8.1): one key from the harness's
+own pool per session, the 3dcode MCP tools, priced at Gemini list price — no sign-in, no
+non-Gemini model. Without keys an agy session fails at once (doctor row `agy gemini keys`).
+The other two are needed only when you name them.
`setup.sh` brings all three to their latest release on every run (`--no-clis` skips it): agy
through its own `agy update` — or, when there is no agy at all, Google's checksum-verified
-installer into `~/.local/bin`, which also adds that directory to your shell profile — and the
-two npm globals whenever the installed version differs from the registry's `latest`. A claude
-or codex installed another way (a native installer, Homebrew) is left to its own updater.
-Nothing pins a version; the closing `doctor` prints the three it found. By hand:
+installer into `~/.local/bin` — and the two npm globals whenever the installed version differs
+from the registry's `latest`. A claude or codex installed another way (a native installer,
+Homebrew) is left to its own updater. Nothing pins a version; the closing `doctor` prints the
+three it found. By hand:
```bash
curl -fsSL https://antigravity.google/cli/install.sh | bash # agy; later: `agy update`
npm i -g @anthropic-ai/claude-code@latest @openai/codex@latest # claude, codex
-agy --version && claude --version && codex --version # 1.4.12 / 2.1.317 / 0.166.0 here (2026-11-03)
+agy --version && claude --version && codex --version
```
-`claude` and `codex` authenticate against your local subscription
-(their own `login` flows) — test lightly. The harness handles the per-CLI quirks for you
-(agy's per-session API-mode HOME, codex's MCP approval mode); what each one is and why it must
-not be undone: `docs/RUNBOOK.md` §3.
-
-The spatial MCP server itself is the `mcp` extra (§4); check it with
-`python -m codeverse3d.spatial.mcp_server --workspace <ws> --list`.
+`claude` and `codex` authenticate against your local subscription (their own `login` flows).
+The harness handles the per-CLI quirks for you (agy's per-session API-mode HOME, codex's MCP
+approval mode): `docs/RUNBOOK.md` §3. The spatial MCP server itself is the `mcp` extra (§4);
+check it with `python -m codeverse3d.spatial.mcp_server --workspace <ws> --list`.
### 8.3 Settings file and `C3D_` overrides
-Loaded in this order, later wins: built-in defaults →
-`~/.config/3dcodeverse/config.yaml` → `./3dcodeverse.yaml` (current working
-directory) → `C3D_*` environment variables. Neither YAML file is required —
-this box runs on defaults plus env.
+Loaded in this order, later wins: built-in defaults → `~/.config/3dcodeverse/config.yaml` →
+`./3dcodeverse.yaml` (current working directory) → `C3D_*` environment variables. Neither YAML
+file is required.
```yaml
# ~/.config/3dcodeverse/config.yaml
@@ -439,17 +374,16 @@ export C3D_BINARIES__BLENDER=/opt/blender/blender
export C3D_RENDER__GPU=off
export C3D_LIMITS__AGENT_TIMEOUT_S=900
export C3D_DEFAULT_CANDIDATES=2
-export C3D_VARIANTS='{"agy:gemini-4-argon": "argon"}' # per-model prompt/skill variant by exact generator id (D105); C3D_VARIANT=argon names one for every run
+export C3D_VARIANTS='{"agy:gemini-4-argon": "argon"}' # per-model prompt/skill variant by exact generator id; C3D_VARIANT=argon names one for every run
```
-Every knob the harness reads is a `Settings` field (`codeverse3d/config.py`, one
-description each): `C3D_<FIELD>` at the top level, `C3D_<SECTION>__<FIELD>` nested, plus
-three flat spellings of nested knobs — `C3D_MAX_IN_FLIGHT`, `C3D_RENDER_GPU`,
-`C3D_AGENT_MAX_TURNS` (`C3D_SEED_RECIPES` went with the graphics recipe seeding, D107). An on/off switch (`C3D_SKILLS`, `C3D_STREAM`,
-`C3D_PLAN_BRIEF`, … — every `Flag` field) takes on/off, 1/0, true/false or yes/no in any
-case; a typo warns and keeps the default, and an empty value is unset. The node side also
-reads `C3D_RENDER_GPU` and `C3D_CACHE_DIR` itself, and one variable only it reads:
-`C3D_BROWSER_REUSE=off` disables the shared headless-Chrome daemon.
+Every knob the harness reads is a `Settings` field (`codeverse3d/config.py`, one description
+each): `C3D_<FIELD>` at the top level, `C3D_<SECTION>__<FIELD>` nested, plus three flat
+spellings of nested knobs — `C3D_MAX_IN_FLIGHT`, `C3D_RENDER_GPU`, `C3D_AGENT_MAX_TURNS`. An
+on/off switch (`C3D_SKILLS`, `C3D_STREAM`, `C3D_PLAN_BRIEF`, … — every `Flag` field) takes
+on/off, 1/0, true/false or yes/no in any case; a typo warns and keeps the default, and an empty
+value is unset. The node side also reads `C3D_RENDER_GPU` and `C3D_CACHE_DIR` itself, and one
+variable only it reads: `C3D_BROWSER_REUSE=off` disables the shared headless-Chrome daemon.
---
@@ -459,54 +393,11 @@ reads `C3D_RENDER_GPU` and `C3D_CACHE_DIR` itself, and one variable only it read
cd harness && 3dcodeverse doctor # add --live for one tiny Gemini call, --no-gpu to skip the Chrome probe, --json for machine output
```
-Real output on this box (exit code 0; any FAIL row makes it exit 1):
-
-```
- 3dcode doctor
-┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
-┃ check ┃ status ┃ detail ┃
-┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
-│ python │ OK │ 3.13.9 (~/miniconda3/bin/python) │
-│ python deps │ OK │ 23/23 importable │
-│ blender │ OK │ Blender 5.2.2 LTS @ │
-│ │ │ ~/.local/bin/blender-5.2 │
-│ blender cycles │ OK │ CUDA: NVIDIA GeForce RTX 5090 Laptop GPU, 32 spp │
-│ │ │ 256x144 frame 348 ms (GPU OIDN + persistent data); │
-│ │ │ judged frames: cycles 32 spp, device gpu, frame │
-│ │ │ cap 20s │
-│ blender eevee │ OK │ GPU (Mesa d3d12 env): D3D12 (NVIDIA GeForce RTX │
-│ │ │ 5090 Laptop GPU) │
-│ blender gpu slots │ OK │ 0/2 busy machine-wide │
-│ │ │ (~/.cache/codeverse3d/slots/blender_gp… │
-│ │ │ a render waits 60s, then the CPU │
-│ node │ OK │ v24.14.0 │
-│ three │ OK │ 0.182.0 │
-│ │ │ (~/3dcodeverse/harness/runtime_js/node… │
-│ puppeteer │ OK │ v24.43.1; chrome cache found │
-│ │ │ (~/.cache/puppeteer) │
-│ chrome webgl │ OK │ GPU: ANGLE (Microsoft Corporation, D3D12 (NVIDIA │
-│ │ │ GeForce RTX 5090 Laptop GPU), OpenGL ES 3.1) │
-│ gemini keys │ OK │ 30 key(s) │
-│ in-flight slots │ OK │ 2/96 busy machine-wide │
-│ │ │ (~/.cache/codeverse3d/slots/gemini; │
-│ │ │ docs/COST.md §23) │
-│ anthropic key │ WARN │ not set (anthropic:* backends unavailable) │
-│ openai key │ WARN │ not set (openai:* backends unavailable) │
-│ agy │ OK │ 1.4.12 │
-│ claude │ OK │ 2.1.317 (Claude Code) │
-│ codex │ OK │ codex-cli 0.166.0 │
-│ git │ OK │ git version 2.53.0 │
-│ agy gemini keys │ OK │ 30-key pool (Gemini-API mode, 3dcode MCP, priced) │
-│ mcp │ OK │ mcp + codeverse3d.spatial.mcp_server importable │
-└───────────────────┴────────┴────────────────────────────────────────────────────┘
-```
-
-`--live` adds one more row (real output here, and the cheapest possible proof
-that the keys work end to end):
-
-```
-│ gemini live call │ OK │ 'pong' cost=$0.00001 │
-```
+One row per check (`python`, `python deps`, `blender`, `blender cycles`, `blender eevee`,
+`blender gpu slots`, `node`, `three`, `puppeteer`, `chrome webgl`, `gemini keys`, `in-flight
+slots`, `anthropic key`, `openai key`, `agy`, `claude`, `codex`, `git`, `agy gemini keys`,
+`mcp`; `--live` adds `gemini live call` and `gemini pool`); any FAIL row makes it exit 1, WARN
+rows name what is optional or busy.
### Troubleshooting table
@@ -516,7 +407,7 @@ that the keys work end to end):
| `python deps` | FAIL | a core import is missing/broken | `pip install -e 'harness[all]'`; a broken native lib (`fcl`) shows up here too — reinstall that wheel (`pip install --force-reinstall python-fcl`) |
| `python deps` | WARN | only optional-extra modules missing (`shapely` / `yourdfpy` / `mcp` / `moderngl` / `cadquery`) | install the extra the row names, e.g. `pip install -e 'harness[mesh,urdf,mcp,graphics,cad]'` (§4) |
| `blender` | FAIL | no binary found, or `--version` failed | §6 — install Blender, or `export C3D_BINARIES__BLENDER=/path/to/blender`. If it is found but fails, run it by hand: a `libSM.so.6`/`libICE.so.6` error means you need the `LD_LIBRARY_PATH` wrapper |
-| `blender cycles` | WARN | Cycles sees no CUDA device | scene_blender's judged frames render on the CPU (~3.3x slower, measured) — fine without an NVIDIA GPU; on WSL2 install the vendor WSL GPU driver. The row also names the judged-frame engine / samples / device (`C3D_RENDER__BLENDER_*`) |
+| `blender cycles` | WARN | Cycles sees no CUDA device | scene_blender's judged frames render on the CPU (a few times slower) — fine without an NVIDIA GPU; on WSL2 install the vendor WSL GPU driver. The row also names the judged-frame engine / samples / device (`C3D_RENDER__BLENDER_*`) |
| `blender eevee` | WARN / FAIL | the EEVEE smoke frame ran on llvmpipe (software GL), or did not render | only matters with `C3D_RENDER__BLENDER_ENGINE=eevee`: the harness runs EEVEE under the Mesa d3d12 env (`spatial/gl_render.GPU_ENV`); llvmpipe here means that env found no GPU. `--no-gpu` skips the smoke frame |
| `blender render` | FAIL / SKIP | the render probe could not run Blender (or there is none) | see the `blender` row |
| `blender gpu slots` | WARN | every machine-wide GPU Blender render slot is held right now | other renders are on the GPU; a render waits `C3D_RENDER__BLENDER_GPU_WAIT_S` for a slot and then renders on the CPU — nothing to fix unless it stays full. `C3D_RENDER__BLENDER_GPU_SLOTS` sizes it |
@@ -535,16 +426,16 @@ that the keys work end to end):
| `agy gemini keys` | FAIL | no Gemini keys: agy runs on API keys only, so the default generator cannot run | export `GEMINI_API_KEYS` (§8.1), or name a `claude-code:` / `codex:` generator |
| `mcp` | WARN | `mcp` package or the server module missing | `pip install -e 'harness[mcp]'`; only affects the agentic CLI backends |
| `gemini live call` (`--live`) | FAIL | key rejected / no network | check the key value and outbound access; a `503 … high demand` is transient, not an install problem |
-| `in-flight slots` | WARN | every machine-wide slot is held right now (`busy n/n`), or `max_in_flight=0` switched the cap off | busy: other harness processes are mid-call and new calls wait for a slot (docs/COST.md §23) — nothing to fix unless it stays full; a slot is held only while a call is out and a killed process frees its slots at once. Off: unset `C3D_MAX_IN_FLIGHT` |
+| `in-flight slots` | WARN | every machine-wide slot is held right now (`busy n/n`), or `max_in_flight=0` switched the cap off | busy: other harness processes are mid-call and new calls wait for a slot — nothing to fix unless it stays full; a slot is held only while a call is out and a killed process frees its slots at once. Off: unset `C3D_MAX_IN_FLIGHT` |
| `gemini pool` (`--live`) | WARN | a key is benched as dead | that key 401/403'd; rotate or remove it — the pool re-probes it after an hour. The row also shows in-flight and this process's 429/5xx counts |
---
## 10. 5-minute smoke
-The cheapest end-to-end run is a single-shot shader on the `graphics` track
-(~$0.05, ~2 minutes, no Blender, no node). Point it at a throwaway runs
-directory so you do not mix it into real data:
+The cheapest end-to-end run is a single-shot shader on the `graphics` track (~$0.05, ~2
+minutes, no Blender, no node). Point it at a throwaway runs directory so you do not mix it into
+real data:
```bash
cd harness
@@ -558,8 +449,7 @@ cd harness
If node and Blender are installed, the equivalent object-track smoke is
`3dcode make "a simple wooden stool" --track static_object --language blender
---generator single-shot:gemini:gemini-3.8-flash --rounds 0` (~$0.1, a few
-minutes).
+--generator single-shot:gemini:gemini-3.8-flash --rounds 0` (~$0.1, a few minutes).
Artifacts land in `<runs-dir>/<slug>/`:
@@ -575,18 +465,14 @@ artifacts/judge/rNN.json the VLM verdict and the computed score
trajectories/ per-call transcripts
```
-`3dcode status <slug>` prints the rounds table, cost and last events; the full
-operating guide is `docs/RUNBOOK.md`.
+`3dcode status <slug>` prints the rounds table, cost and last events; the full operating guide is
+`docs/RUNBOOK.md`.
-> **`capacity storm N/10 … waiting Ns`** means the Gemini endpoint is busy, not
-> that your install is broken: the harness backs off (up to 10 waits, ~10 min in
-> total) and rotates keys. While the bench batteries on this box were saturating
-> `gemini-3.7-flash`, a smoke with `--max-minutes 8` gave up in the planner with
-> `status=budget … elapsed 11.2 min exceeds max_minutes 8.0` after spending
-> $0.0091 — hence the roomier `--max-minutes 20` above. `3dcode resume <slug>
-> --runs-dir …` continues from the last completed stage. To prove the key path
-> alone, `3dcodeverse doctor --live` is the one-call version
-> (`gemini live call OK 'pong' cost=$0.00001`).
+> **`capacity storm N/10 … waiting Ns`** means the Gemini endpoint is busy, not that your
+> install is broken: the harness backs off (up to 10 waits, ~10 min in total) and rotates keys,
+> which is why the smoke above gets `--max-minutes 20`. `3dcode resume <slug> --runs-dir …`
+> continues from the last completed stage. To prove the key path alone, `3dcodeverse doctor
+> --live` is the one-call version.
---
@@ -594,38 +480,20 @@ operating guide is `docs/RUNBOOK.md`.
```bash
pip uninstall 3dcodeverse # removes the editable install + 3dcodeverse/3dcode
-rm -rf harness/runtime_js/node_modules # ~97 MB, re-creatable with `npm ci`
-rm -rf ~/.cache/puppeteer # ~636 MB of downloaded Chrome builds
-rm -rf ~/.cache/codeverse3d # harness cache (619 MB here) — see below
+rm -rf harness/runtime_js/node_modules # re-creatable with `npm ci`
+rm -rf ~/.cache/puppeteer # downloaded Chrome builds
+rm -rf ~/.cache/codeverse3d # harness cache — see below
rm -rf harness/3dcodeverse.egg-info harness/.pytest_cache harness/.ruff_cache
```
-`~/.cache/codeverse3d` (or `cache_dir` / `C3D_CACHE_DIR`) holds only regenerable
-things: `renders/` and `judge_images/` (render + montage cache), `gpu_probe.json`, `browser_*.lock` (the shared
-headless-Chrome endpoint file — do not delete it while renders are running).
+`~/.cache/codeverse3d` (or `cache_dir` / `C3D_CACHE_DIR`) holds only regenerable things:
+`renders/` and `judge_images/` (render + montage cache), `gpu_probe.json`, `browser_*.lock` (the
+shared headless-Chrome endpoint file — do not delete it while renders are running).
-**Your data is not in either cache.** `runs/`, `eval/bench/out/` and any exported
-dataset are the flywheel output — delete them deliberately, never as part of a
-cleanup. On this machine `eval/bench/out/` is read-only reference material
-(the early `e2e_*` reference runs were archived off-repo on 2026-08-29).
+**Your data is not in either cache.** `runs/`, `eval/bench/out/` and any exported dataset are
+the flywheel output — delete them deliberately, never as part of a cleanup.
Uninstalling does not touch `~/.config/3dcodeverse/config.yaml`,
-`~/.config/astra3d/gemini_keys.env` or the globally installed CLIs — remove
-those by hand (`npm rm -g @anthropic-ai/claude-code @openai/codex`; agy: `rm ~/.local/bin/agy`
-and the `# Added by Antigravity CLI installer` PATH lines in `~/.bashrc` / `~/.profile`).
-
----
-
-## 12. Appendix: verified versions on this box
-
-| component | version | where |
-|---|---|---|
-| python | 3.13.9 (the one supported version — §2.1) | `~/miniconda3/bin/python` |
-| pip packages | pydantic 2.13.2 · trimesh 4.12.2 · python-fcl 0.7.0.11 · moderngl 5.12.0 · shapely 2.1.2 · networkx 3.6.1 · pyarrow 24.0.0 · mcp 2.0.0 · scipy 1.18.0 · yourdfpy 0.0.60 · cadquery 2.8.0 · google-genai 2.10.0 · pytest 9.1.1 · ruff 0.15.20 | editable install of `harness/` |
-| node / npm | v24.14.0 / 11.9.0 (floor 20.6.0 — §2.1, verified against node 20.19.5) | `~/miniconda3/bin/node` |
-| runtime_js deps | three 0.182.0 · puppeteer 24.43.1 (99 packages, 97 MB) | `harness/runtime_js/node_modules` |
-| Chrome (puppeteer) | 148.0.7778.97 (+ headless-shell) | `~/.cache/puppeteer` |
-| Blender | 5.2.2 LTS (build 2026-09-15; installed 2026-10-14, sha256-verified) | `~/.local/bin/blender-5.2` → `~/tools/blender-5.2.2-linux-x64` (any directory: the wrapper's `BLENDER_HOME`) |
-| git | 2.53.0 | `/usr/bin/git` |
-| agy / claude / codex | 1.4.12 / 2.1.317 / 0.166.0 (the latest releases on 2026-11-03, D115; `setup.sh` keeps them there) | `~/.local/bin/agy` · npm global (`~/miniconda3/bin`) |
-| GPU (Chrome WebGL) | ANGLE · D3D12 · NVIDIA GeForce RTX 5090 Laptop GPU · OpenGL ES 3.1 | via `--use-angle=gl-egl` + Mesa d3d12 |
+`~/.config/astra3d/gemini_keys.env` or the globally installed CLIs — remove those by hand
+(`npm rm -g @anthropic-ai/claude-code @openai/codex`; agy: `rm ~/.local/bin/agy` and the
+`# Added by Antigravity CLI installer` PATH lines in `~/.bashrc` / `~/.profile`).
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
deleted file mode 100644
index e38e4ee3..00000000
--- a/harness/docs/INTERFACES.md
+++ /dev/null
@@ -1,819 +0,0 @@
-# Cross-package interfaces (as built)
-
-This file lists the signatures other packages may rely on. Types live in
-`codeverse3d/contracts/`; protocols in `models/base.py`, `agents/registry.py`,
-`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
-**Δ** — 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`).
-
-## Ids
-
-* Chat models: `<provider>:<model>` — `gemini:*` · `anthropic:*` · `openai:*`
- (`models.registry.parse_model_id`).
-* Coding agents: `<kind>:<model>` — `agy:*` · `claude-code:*` · `codex:*`
- (`agents.registry.parse_agent_id`; `KINDS`; `gemini-cli:*` deleted in D103).
-* **Δ** Single-shot generation ids: `single-shot:<provider>:<model>` — handled only
- inside `tracks/generation.py` (`is_single_shot`, `single_shot_model_id`); never
- registered in `agents/`. `Spec.backends.generator` accepts any of the three.
-
-## core (contracts · config · proc)
-
-```python
-from codeverse3d.contracts.common import TRACK_INFO, TrackInfo # {Track: TrackInfo(rubric, label, best_of_n, likeness_refs)} — THE track registry
-from codeverse3d.contracts.common import ENTRY_FILE, code_file, LANGUAGE_LABEL # {Language: "src/<entry>"}; code_file(lang) -> "code.<ext>"
-from codeverse3d.contracts.spec import RunOptions # Spec.options: candidates (int|None, ≥1), variant (str)
-GateFinding.as_line(with_gate=False, with_severity=False, with_target=False, with_hint=True) -> str
- # "GATE <gate>: [<sev>] <message> [<target>] FIX: <hint>" — flags opt in; no leading "- "
-GateReport.of(gate, findings=(), *, duration_ms=0) -> GateReport # passed iff no ERROR — every gate whose verdict IS its findings
-BuildResult.gates: list[GateReport] # the build's own reports (scene_probe + shader_preflight; gl_frames);
- # tracks/steps appends them to the round's gates, after the track's, built or not
-RenderView.judge: bool | None # stamped True/False at render time; None = legacy round (every stored view is judged)
-RenderSet.out_dir: str # directory the views (+ views.json/metrics.json) were written to ("" on old rounds)
-from codeverse3d.config import get_settings, Flag # every C3D_* switch is a Settings field (C3D_X -> .x,
- # C3D_S__X -> .s.x, Settings.FLAT for four flat spellings); Flag: on/off/1/0/true/false/yes/no, any case;
- # unset/empty -> the default; garbage -> warning + the DEFAULT, never a crash
-get_settings().backends(planner=..., generator=..., judge=..., captioner=...) -> Backends
- # settings defaults (default_planner/... mirror contracts Backends literals; + default_captioner);
- # truthy keyword overrides win, None/"" falls through, unknown role -> TypeError
-from codeverse3d.proc import ProcResult, run_subprocess, tail, write_json_atomic
-run_subprocess(cmd, *, cwd, timeout_s, env=None, stdin_text=None, preexec_fn=None) -> ProcResult
- # own session/process group, group-kill on timeout, never raises on rc != 0; stdlib-only module
-from codeverse3d.proc import read_json_or_none, iter_jsonl_lines, read_jsonl_lenient, append_jsonl_line
-read_json_or_none(path, *, errors=None) -> dict | None # None when absent / unreadable / malformed / not a dict
-iter_jsonl_lines(path) -> Iterator[tuple[int, str]] # (1-based line_no, line); missing file -> nothing; blanks skipped
-read_jsonl_lenient(path, *, log=None, dicts_only=False) -> list # bad lines skipped (debug-logged when `log` given)
-append_jsonl_line(path, rec, lock) -> None # one json.dumps(ensure_ascii=False, default=str) line under `lock`
-```
-`Spec.options` is plan-hash safe (`plan_stage_inputs` whitelists spec fields).
-`Workspace.write_json` delegates to `proc.write_json_atomic`.
-`Workspace.stage_artifacts(*names) -> ArtifactStage` (2026-08-27): enter invalidates the
-canonical `artifacts/` names, writes land under `artifacts/.staging/<pid-nonce>/`,
-`promote()` `os.replace`s on success, exit-without-promote discards — canonical always
-means the last OK build. `Workspace.restore_paths(commit, paths)` = per-path
-`git checkout <commit> -- <paths>` under the per-root lock.
-
-## models/
-```python
-from codeverse3d.models import get_chat_model # (model_id) -> ChatModel, lru-cached, thread-safe
-resp = m.generate(ChatRequest(messages=[...], system=..., response_schema=..., temperature=..., thinking=..., label=..., max_wait_s=None))
-# max_wait_s: the longest this ONE call may spend, retries included (None = models.retry.RETRY_DEADLINE_S = 1800 s);
-# GeminiModel clips its retry deadline to it; VlmJudge 240 s per sample, planner 300 s
-# resp.raw["key"] = "…ab12" (the key that answered), resp.raw["attempts"] = round-trips issued (hedged siblings included)
-resp.parsed / resp.text / resp.usage # Usage always has cost_usd (models.pricing)
-from codeverse3d.models.retry import KeyPool, KeyPoolExhausted
-KeyPool(keys, *, max_in_flight=0, slots_dir=None, cooldown_s=3, dead_cooldown_s=3600) # a cap needs slots_dir:
- # the slots are flock'd files every process shares (Slots(n, root): try_take / take(timeout) / give / busy)
-pool.acquire(*, exclude=None, timeout_s=120) -> key # a slot + a key; raises immediately when every key is dead/cooling past the deadline
-pool.try_acquire(*, exclude=None) -> key | None # never waits (a hedged retry's extra key); holds a slot like acquire
-pool.lease_session_key(leases_dir, *, timeout_s=120) -> (key, lease|None) # + one live session per key machine-wide (flock); KeyPool.end_lease(lease)
-KeyPool(keys, ..., start=0) # shared_pool passes a random start: parallel processes spread
-pool.report(key, "ok"|"429"|"5xx"|"error"|"dead"|"skip", *, retry_after_s=None) # Δ "dead": health 0, benched dead_cooldown_s,
- # re-probed after; "skip" (a content failure the key did not cause) leaves health and counters untouched
-from codeverse3d.models.retry import rotate_with_retries, RETRY_DEADLINE_S
-rotate_with_retries(pool, call, *, classify, outcome_of=failure_outcome, max_attempts=6, max_total_s=RETRY_DEADLINE_S, hedge=2, ...)
- # the ONE retry loop; the SDK adapters run it over a one-key pool (parts.retry_one_key: no cooldown, no storm
- # patience, no hedge). max_total_s = ChatRequest.max_wait_s clipped to RETRY_DEADLINE_S; a raised ModelError carries .attempts
-from codeverse3d.models.pricing import estimate_cost # (provider, model, usage) -> usd (unknown model -> 0.0 + one warning)
-from codeverse3d.models.pricing import openai_usage # (backend, model, *, prompt, cached, completion, reasoning, **extra)
- # -> a priced Usage: the OpenAI SDK adapter and codex both; reasoning moves out of completion into thoughts
-from codeverse3d.models.registry import build_chat_model # (model_id, **constructor kw) -> the bare, UNMETERED model
-from codeverse3d.models.schema_utils import to_gemini_schema, to_openai_strict_schema, to_anthropic_schema, parse_json_lenient
-from codeverse3d.models.schema_utils import ask_structured # (model, Schema, *, system, text, images=(), temperature, label)
- # -> (obj | None, Usage, err): one schema-bound call; call failure and parse failure are the same `err` family
-```
-Backends: `GeminiModel(model, *, keys=None, pool=None, ...)` (one shared KeyPool per
-key list), `AnthropicModel(model)` (a response schema is a forced `submit` tool),
-`OpenAIModel(model)` (Chat Completions; key and `C3D_OPENAI_BASE_URL` from Settings).
-Rules that callers must know:
-* **Δ** Gemini key handling: auth/permission errors (401/403, or 400 with
- API_KEY_INVALID / expired / PERMISSION_DENIED / suspended markers) classify as
- outcome `dead` — the call rotates to the next key at once (no retry budget, no
- sleep) and the key is benched for an hour once another key succeeds; it raises
- only when *every* key fails the same way. A 429 while an untried key remains is
- a **free** rotation (does not consume `max_attempts`); only when all keys are
- throttled do 429s count against the budget with backoff.
-* Gemini 3.x cannot disable thinking; keep `max_output_tokens ≥ ~1000` even for
- one-word answers.
-* Anthropic 4.6+ models use adaptive thinking + `output_config.effort`.
-* **Δ** `to_openai_strict_schema` never adds `null` to defaulted fields: a property
- is nullable iff the *source* pydantic schema is (`T | None`); non-null defaults
- are surfaced as a `[default: …]` description hint. Wire contract == pydantic contract.
-* **Δ** `pricing.lookup_price` prefix fallback matches only pure version/date/channel
- suffixes (`-`/`_`/`@`/`:` + digits/latest/preview/exp/beta/…); sibling models
- (`-nano`, `-mini`, `-codex`, `-lite`) never inherit the parent's price — they are
- unknown (0.0 + warning) unless a row exists.
-
-## cost/ (ledger · price provenance)
-```python
-from codeverse3d.cost import record_call, load_ledger
-from codeverse3d.cost.ledger import summarise
-record_call(usage, *, run="", round=None, stage=None, role=None, label="", backend="", model="",
- outcome="ok", latency_ms=None, n_calls=1, source="live", ledger=None, reprice=False,
- tallies=None) -> CallCost
- # Δ everything left out is resolved from the ambient context + the call label (cost.context);
- # unknown model -> $0 and price_source="unknown" (flagged, never silently dropped); never raises.
- # books every non-attempt row into the open cost.tally tallies (or `tallies`, captured by a caller
- # whose row lands later in a context-less thread). source: live | session | extra (a round-trip the
- # provider billed and the call discarded — counts) | attempt (forensics — load_ledger leaves it out)
-from codeverse3d.cost.ledger import ledger_usage # (rows) -> Usage: how record.total_usage is read off the ledger
-from codeverse3d.cost.instrument import (run_ledger, metered_chat_model, metered_agent,
- MeteredAgent, MeteredChatModel) # always on: no off switch
-with run_ledger(ws.root, run=slug): # binds the run, points record_call at <run>/telemetry/cost.jsonl
- ... # (its one name: no root alias since 2026-09-22)
- # NESTS by holding ContextVar tokens (bound_run / bound_ledger) — context-local ONLY, no
- # process-wide default — so bench.run_bench / compare_backends hold one ledger per prompt
- # across N threads, and a thread that may bill a model goes through proc.fan_out.
- # BaseTrack.run opens `run_ledger(ws.root, run=ws.root.name)` ITSELF, so a track run started
- # outside the CLI/bench still meters; the CLI/bench ledger for the same run dir is the same file.
- # models.get_chat_model returns a MeteredChatModel → ONE row per ChatModel.generate
- # agents.get_coding_agent returns a MeteredAgent (registry wrap, from the first call) → ambient
- # round/stage for the session and one source='session' row (n_calls, latency, outcome,
- # AgentResult.turns) — every backend is a vendor CLI whose calls the harness cannot see.
- # These two are the ONLY ledger writers; BudgetGuard keeps no money.
- # The rule is the BACKEND, never "did a row get written while it ran": a CLI session with one
- # in-process tool call used to be dropped entirely.
-from codeverse3d.cost.context import CallContext, call_context, bound_run, context_from_label, SELF_DESCRIBING
-from codeverse3d.cost.ledger import bound_ledger, process_ledger_path # (Δ 2026-08-30) both are context
- # managers holding a ContextVar token; there is no process-wide default any more — a thread that
- # may bill a model is spawned through proc.fan_out (which copies context), never a bare pool.
- # precedence: explicit > a label naming a job of its OWN (SELF_DESCRIBING = plan/judge/pairwise/
- # caption) > ambient (call_context) > the rest of the label > nothing. A judge or a
- # captioner that bills a model INSIDE an agent session is filed under its own stage, not the
- # session's; a generation label yields to the session (best-of-N: kind="candidate" beats
- # label="baseline"); Stage.OTHER means "the label said nothing" and displaces nothing.
- # labels understood: judge:<rubric>:r<NN>:s<k> · planner · pairwise:… · caption… (api-agent:<label>:t<turn> in historical ledgers only)
-from codeverse3d.addons.costreport.caching import session_cache, session_key
-session_cache(rows) -> [SessionCache] # per session: cold first call, cached share, saved_usd, cold_usd
-from codeverse3d.cli._common import resolve_variant, ResolvedVariant, record_variant, replay_variant # D105
-resolve_variant(settings, generator, flag=None) -> ResolvedVariant{name, version, hash, source, label}
- # `--variant` > settings.variant (C3D_VARIANT) > settings.variants[<generator>] (as typed, then by the served
- # model) > "" (base); an unknown name is the typed 'bad configuration' refusal (exit 2) before a run dir exists;
- # `3dcode make` freezes .name on RunOptions.variant. record_variant(record) -> the name a stored run used;
- # replay_variant(record): a context that activates it for `3dcode judge` (a retired name warns → base)
-from codeverse3d.prompts.variants import VARIANTS_DIR, VariantInfo, list_variants, variant_info, resolve_variant, \
- active_variant, activate, variant_root, variant_hash, variant_block, apply_variant_knobs, served_id
- # the variant layer (D105): VariantInfo{name, version, generators, description, knobs} from
- # prompts/variants/<name>/variant.toml; variant_info(name) / activate(name) raise ValueError for an unknown name;
- # resolve_variant(settings, generator_id) -> "" | name (plain dict lookups, served_id("agy:x-high") == "agy:x");
- # active_variant() = the ContextVar `activate` sets (BaseTrack.run wraps the whole run; proc.fan_out copies it
- # into worker threads), else get_settings().variant; variant_hash(name) = sha256[:12] over the prompt AND skills
- # overlay files (README.md excluded; "" = base); variant_block(name) -> {name, version, hash} for the record;
- # apply_variant_knobs(settings, info) sets [knobs] (skills_max / skills_only) as DEFAULTS — a stated field wins
-from codeverse3d.prompts import load_text, render # every name resolves through the active variant
-from codeverse3d.skills import library_roots, all_skills, load_skill, variants_table, parse_routes, VariantRoutes, RouteBoost, variant_dir
-library_roots(variant=None) -> [skills_dir(), <skills_dir>/variants/<v>] # the second only when it exists
-all_skills() -> base ∪ overlay (same name shadows, new names added); all_skills(root) -> that root alone
-variants_table(name) -> VariantRoutes{variant, routes: (Route…), boosts: (RouteBoost{skill, delta}…), disabled}
- # <skills_dir>/variants/<name>/routes.toml parsed with tomllib into typed rows (parse_routes(path)): a typing
- # error is a ValueError naming the row; attach_skills logs it and routes with the base table
-from codeverse3d.skills.registry import select, effective_priority, GATE_FIRED_PRIORITY
-select(track, language, kind, *, signals=None, findings=(), library=None, max_skills=5, allow_unverified=False,
- routes=ROUTES, boosts=None, disabled=frozenset()) -> [Selection]
- # routes: the rows to evaluate in order (a variant's extra rows after the base ones — ties keep base order);
- # boosts: skill -> priority delta, clamped by effective_priority (a standing row stays below 90, a gate-fired
- # row never drops under it); disabled: rule ids skipped. SkillsMaterialized.variant, the skills.attached
- # event and the telemetry/skills.jsonl row name the variant the attach ran under
-from codeverse3d.models.pricing import price_provenance # (provider, model) -> PriceRow(price, match, status, checked)
-```
-`3dcode cost <slug|path>…` · `3dcode cost --runs-dir <root>` · `3dcode cost cache <slug>` ·
-`3dcode cost prices [--stale] [--days N] [--unverified]` · `3dcode cost estimate`.
-Every run is read from its ledger alone (`addons.costreport.audit.read_run` / `read_cell` /
-`find_runs`); `cost/reconstruct.py` and its rebuild of pre-ledger runs went on 2026-09-22.
-
-## agents/
-```python
-from codeverse3d.agents import get_coding_agent # (agent_id) -> CodingAgent .run(job) .available() .kind .model
-from codeverse3d.agents.materialize import materialize_workspace, codex_mcp_overrides
-materialize_workspace(ws, *, agent_kind, contract_md, mcp_command=None) -> None
-# Δ D107: no cookbook_text — no language ships a cookbook; the body is hard rules + tool cards + the language contract
-# mcp_command defaults to cli_common.default_mcp_command(ws) = [sys.executable, -m codeverse3d.spatial.mcp_server --workspace …]
-# (None/[] = the default — no ValueError); tracks/common.Services.materialize takes no mcp_command
-# writes AGENTS.md + CLAUDE.md (same body; Δ D103 no GEMINI.md — agy reads it AND AGENTS.md, so the body loaded
-# twice), .antigravityignore (Δ D107: no .3dcode/cookbook.md copy),
-# and NO MCP file in the workspace (it is agent-writable — audit 2026-08-27); MCP wiring is per session:
-# claude-code → trajectories/<label>_rNN/mcp.json codex → codex_mcp_overrides(mcp_command) built PER SESSION:
-# -c mcp_servers.3dcode.command=… -c mcp_servers.3dcode.args=[…] -c mcp_servers.3dcode.default_tools_approval_mode="approve"
-# (Δ without the approval mode every MCP tool call is elicited and auto-cancelled)
-# agy → API mode (Gemini model + keys): <cache_dir>/agy_homes/<session>/.gemini/config/mcp_config.json in the
-# session's own HOME (its env.HOME = the real home); subscription mode: none. The body documents the shell
-# fallback `python -m codeverse3d.cli.main tools <name> --json …` either way
-res = agent.run(AgentJob(workspace=..., prompt=..., label="baseline", timeout_s=1800, max_turns=60,
- spatial_tools=True, write_roots=["src","public"])) # typed kwargs only: no extra=, no model=
-res.ok, res.exit_reason # completed | timeout | error | budget (model_substituted: gemini-cli's, no backend sets it since D103)
-res.turns # claude-code num_turns · codex turn.completed count · agy num_turns
-res.files_changed (git-derived, attributed per session), res.usage, res.transcript_path, res.tool_calls, res.errors
-res.transient # a provider failure a retry may get through (5xx / overloaded / 429 / dropped connection)
-res.quota # Δ 2026-09-22 the vendor's usage limit is spent — never also transient
-res.stalled # Δ D112 the watchdog killed it IDLE (no output / write / recorded step for IDLE_GRACE_S past
- # its window) and it answered nothing: a hang — never transient; retried by the clock
- # (RoundPolicy.can_open), never by the vendor's log (classify_end has no provider_retried)
-res.provider_wait_s # Δ seconds of duration_s lost to provider errors (cli_common.provider_wait; codex: 0.0)
-# Δ 2026-09-22 the prompt reaches EVERY CLI on stdin (cli_common.invoke; no -p / --print / positional text,
-# codex "-"), byte for byte; the >100 kB task_prompt.md stub is gone. The transcript's invoke row keeps
-# argv + stdin_bytes. res.usage is the CLI's envelope; with none (killed / given up) claude-code's comes
-# from its stream's per-message usage (output a floor), codex's is an estimate, agy books none;
-# result.json "usage_from" says which. A session sees only the routed skill bundles:
-# claude --setting-sources project + CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1 + --settings skillOverrides;
-# codex -c skills.bundled.enabled=false; agy: no switch.
-from codeverse3d.agents.cli_common import is_transient_failure, is_quota_failure, is_rate_limited, provider_wait
-# THE failure vocabulary (one place; the backends apply it to what the CLI said about the call that ended
-# its session) and provider_wait(failures=[(t, backoff_s)], end, progress=[t] | None) -> seconds
-```
-`AgentJob` carries typed job context: `round`, `kind`, `language`, `track`,
-`hard_deadline_s` (optional absolute `time.monotonic()` deadline on this host:
-generation derives it from the remaining hard run clock before queueing; every CLI
-attempt clips its watchdog after acquiring the workspace lock, including retries.
-An expired job never launches a CLI. Recomputed on resume; `None` keeps standalone
-session grace. Process termination and final packaging can finish after the deadline),
-`files_hint` (workspace-relative files/dirs the task is
-expected to touch — used to attribute `files_changed`; harness-owned paths are dropped;
-agent sessions on one workspace are serialised, so there is no sibling filter), **Δ D111**
-`shared_tree: bool` (harness writers that take no session lock — the scene asset single-shots — write
-the tree while the session runs: `files_changed` is the `files_hint` paths only
-(`cli_common.attribute_changes(files, write_roots=, only=)`) and the
-watchdog polls only those files (`cli_common.activity_paths(s, steps=())`; **Δ D112** plus `steps`, where the CLI
-records each step it takes — agy passes its session HOME's `backends.AGY_STEP_DIRS` (brain/, conversations/) through
-`invoke(..., activity=)` for every agy session, shared_tree or not); needs a `files_hint`, never with
-`edit_only` — a validator; `GenerationTask.shared_tree` carries it; the scene env task sets it),
-`edit_only` / `always_writable` (a scoped refine may overwrite only its hinted files +
-the entry file), **Δ D110** `effort: AgentEffort | None` (`Literal["low","medium","high"]`; filled from
-`GenerationTask.thinking` only when the caller asked — `tracks.generation.session_effort`; None = the
-backend's default; agy alone reads it, claude-code / codex keep their `Settings.agents` effort), `read_only: list[str]` (harness-owned files INSIDE the write roots the
-session may read but never write — `contracts.common.HARNESS_OWNED_SRC[language]`, i.e.
-`src/lib/` for scene_threejs / scene_blender (Δ D107: glsl_shader's seeded `src/recipes.glsl` is gone); `tracks/generation.py`
-sets it on every job of the run and `agents/cli_common._enforce_scope` reverts a
-post-session write to one and fails that session. **Δ** an entry ending in `/` is a
-DIRECTORY prefix — `contracts.common.is_harness_owned(rel, owned)` is the predicate, and
-it is what names the effect library without listing every module).
-Each session writes `trajectories/<label>_rNN/` (files: docs/RUN_LAYOUT.md); **Δ** a re-run of the
-same label+round lands in `<label>.a2_rNN` (then `.a3` …) — the first attempt is never overwritten;
-`result.json` records `attempt` + `job_label`. Each session makes two git commits (`pre:`/`agent:<label>`).
-agy specifics (**Δ D103**, which deleted the gemini-cli backend): Gemini-API mode only — no keys →
-`available()` false; a bare `agy` runs `DEFAULT_AGY_MODEL` = `gemini-4-argon`. One key per session from THE shared pool
-(`models.gemini.shared_pool`, `pool.lease_session_key(<cache_dir>/slots/agy_keys)`, no in-flight slot, one
-live session per key machine-wide while keys last), outcome reported back
-(`_pool_outcome`: 401/403/API_KEY_INVALID → dead, 429 → cooldown, 5xx, ok, skip); a fresh HOME under
-`<cache_dir>/agy_homes/` holds `.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (without
-it agy ignores `GEMINI_API_KEY` and asks for a login) + the MCP config, and is deleted after the session (the
-tool trace is read from its conversation db first); argv `--model gemini-api://<bare id> --effort <e>`, effort
-(**Δ D110**, `backends.api_model_effort(model, job.effort)`): the id's `-low/-medium/-high` suffix, else
-`AgentJob.effort`, else `AGY_API_EFFORT` = `high` — no track asks for less, so every argon session runs at high
-(owner, 2026-10-15); the effort used is on the `invoke` transcript line, in `result.json` / `AgentResult.effort`
-and on the session's `cost.jsonl` row (`effort`, an extra column; claude-code / codex record theirs too); usage priced at Gemini list price with
-output = output − thinking, thoughts = thinking (agy's output already includes thinking). KeyPoolExhausted never escapes
-`run()` (→ `exit_reason=budget`). No retry loop in the backend: agy retries its own calls; a transient
-death goes to the round loop's one retry, which takes a fresh key.
-## languages/
-```python
-from codeverse3d.languages import get_runtime # (Language | str) -> LanguageRuntime
-rt.language; rt.entry_globs
-rt.lint(ws) -> GateReport # gate = "lint:<language>"
-rt.build(ws, *, timeout_s=None, **per_runtime) -> BuildResult # Δ BuildResult.error_file is WORKSPACE-relative for
-rt.skeleton(ws, plan) -> list[Path] # every runtime ("src/model.py", "src/parts/leg.py", "src/helpers.py")
-rt.expected_files(plan) -> list[str] # Δ 2026-09-22 THE file layout, asked by every track: the files a
-rt.files_for(plan, target) -> list[str] # whole-artifact session writes (entry first) / the files that own a refine
- # target ([] = no owner → one whole-artifact task). languages/base.RuntimeLayout answers for the object + graphics
- # runtimes (entry + extra_files, + part_file per part for blender / three.js); the scene runtime answers with
- # languages/scene_threejs.{SCENE_FILES, zone_file, asset_file, scene_files_for} (files_for(..., alias=) — the dedupe
- # note). Gone: tracks/prompting.expected_files / file_for_target_factory / SCENE_FILES, graphics EXPECTED_FILES,
- # BaseTrack.round_files_hint, StaticObjectTrack.entry_files, scene.zone_file, scene_assets.asset_file,
- # BlenderRuntime.file_for_part (now part_file)
-# Δ 2026-09-24 (D101) a scene-track runtime is a languages/base.SceneRuntime — the scene stages, Services, the scene
-# tools, `3dcode render` and eval's fixed evaluator reach a scene language only through it (none imports scene_threejs):
-rt.zone_file(name) -> str # src/zones/<snake>.<ext>
-rt.asset_file(asset: AssetPlan) -> str # factory module, or public/assets/<snake>.glb for a hero
-rt.assemble(ws, plan: ScenePlan) -> BaseModel # writes the entry; plan cameras, else derived; artifacts/assemble.json
-rt.probe(ws, *, timeout_s=60.0) -> SceneProbeResult # scene_probe gate + census.json (scene_probe / check_placement tools)
-rt.render_scene(ws, out_dir, *, cameras=None, orbit=True, times=(0.0, 1.5), width=1024, height=576, sheet=True) -> RenderSet
-rt.env_file: str # Δ 2026-10-14 (D105) src/env.js / src/env.py — the env stage's one file,
- # declared on languages/base.SceneRuntime; tracks.scene.env_file(ctx) reads it (tracks.scene.ENV_FILES is the typed fallback)
-rt.lib_interface(ws) -> str # Δ D112 src/lib/ as facts: one line per module, exported names +
- # parameter lists read off the files (_js_lint.export_signatures: `export function` and a const bound to an
- # arrow / function expression; ast for bpy) — the env recovery's single-shot prompt
-rt.check_env(ws) -> str # Δ D112 "" = the env module alone lints clean, builds with nothing
- # beside it (scene_threejs: src/_c3v_env_probe.js in probe_scene.mjs; scene_blender: run_wrapper(entry=
- # ENV_CHECK_REL, zones={})) and lights what it builds (spatial.probes.unlit); else the failure, quoted (bpy: a
- # raise inside a src/lib helper leads with the env's own calling line, scene_blender.env_frame). A check the
- # harness cannot run returns "" (never a verdict on the module)
-# Δ 2026-09-24 (D102) spatial.probes.run_probe(ws, *, compile=False, timeout_s=None, glb: Path | None = None, facts=None):
-# glb = an OFFLINE scene's census GLB (probe_scene.mjs --glb → runtime_js/lib/glb_scene.mjs, served at /__census.glb;
-# host_page.openHost(..., glb=)), facts merged into the census by probes.merge_facts before any finding;
-# probes.probe_result (was _result); conventions.glb_basis(language) (3×3, language frame → GLB frame)
-# Δ 2026-10-16 (D111) render_scene.SceneRenderError(message, *, timed_out=False, phase=""): timed_out = the driver
-# ran out of its budget (its watchdog's summary `timed_out: true` + `phase`, exit 3 — retried once on an OWNED
-# browser — or the process clock, phase ""); .scene_timed_out = timed_out and phase in render_scene.SCENE_PHASES
-# {"scene", "census", "update"} (probe_scene.mjs sets the phase; lib/cli.armWatchdog(ms, onFire) merges onFire()'s
-# return into the summary; host_page.openHost(..., onBoot=) is called before the import). Only then, and never
-# for a census GLB (glb=), run_probe returns probes.timeout_finding(timeout_s, *, phase) — an ERROR kind
-# "probe_timeout" on the entry file, NOT harness_failure (build_with_repair hands it to a repair session).
-# probes.probe_scene / rt.probe(ws, *, timeout_s: float | None = None): None = the build's budget.
-# Δ (D111) conventions.ZONE_ROOT_KEY = "c3d_zone": the assembler sets userData[ZONE_ROOT_KEY] = <zone> on every zone
-# root (render_scene_js addZone; scene_blender: write_census_glb(..., zone_key=) ← run_bpy_scene.py --zone-key);
-# host_placement.mjs (ZONE_ROOT_KEY, pinned) rows = children of marked roots only; the other roots' children are
-# scenery pieces — supports, `attached` targets (gate + settle), interpenetration partners of zone assets only
-# (the zone asset is `a`); the table gains scenery {n, names} (scene_placement.PlacementTable.scenery:
-# SceneryRoots); an unmarked scene keeps the old rule. contract_findings: a table cut by its row cap
-# (total > rows) → INFO "zone_unmeasured" instead of zone_empty (the zone's census group content/ground) and
-# instead of missing_content for the last row's zone.
-from codeverse3d.prompts.catalog import language_prompt, language_text
-language_prompt(language, name) -> str # "<dir>/<name>" under prompts/ (urdf_blender → urdf/): THE per-language prompt
-language_text(language, name) -> str # its text, "" for a file the language does not ship (Δ 2026-09-22: replaces
- # LanguageRuntime.contract_doc / RuntimeDocs, tracks/common.language_contract / load_prompt_or,
- # tracks/prompting.effects_catalog_text; planner.plan / build_system_prompt take no runtime=)
-BuildResult.error_type spellings (languages/_common.py): MISSING_ENTRY = "MissingEntryFile" (every runtime, threejs'
- export_glb.mjs included) · BUILD_TIMEOUT = "BuildTimeout" (compose_build_result, threejs, urdf)
-```
-| runtime | entry_globs | notes / artifacts |
-|---|---|---|
-| `BlenderRuntime` | `src/model.py`, `src/parts/*.py` | **Δ multi-file**: `part_file(name) -> "src/parts/<snake>.py"` (`def build_<snake>()`); lint = `layout.lint_workspace` over every src/*.py; skeleton writes model.py + per-part files; object.glb/stl, build.json, census.json |
-| `CadQueryRuntime` | `src/model.py` | trailing selector on the stack → parent solid exported + warning (ExportError when no solid exists); helper-module errors map to `src/<file>.py:line`; object.glb/stl/step |
-| `ThreeJsRuntime` | `src/object.js`, `src/parts/*.js` | **Δ export as authored** (census `placement_offset`); InstancedMesh baked to `<Name>_<i>` meshes (`instanced_meshes_baked`); exported `selfcheck(THREE, root)` is called (throw → SelfCheckError); NaN geometry errors name mesh/part → routed to `src/parts/<snake>.js` |
-| `UrdfBlenderRuntime` | `src/model.py`, `src/robot.urdf` | object.glb (Y-up, node=link, joint extras), meshes/<link>.glb (raw Z-up link frames); link name `world` is reserved (lint ERROR + UrdfError); robot GLB root gets `__root` suffix on name clash; the build collides the REST pose only (RestPenetration > 5 mm, D17) — every pose is the round's `joint_sweep` gate — and writes no articulation.json / census.articulation (Δ 2026-09-22) |
-| `SceneThreeJsRuntime` | `src/scene.js`, `src/zones/*.js`, `src/assets/*.js`, `src/env.js`, `src/shaders/*.{js,vert,frag,glsl}` | glb_path=None; local shader text loads inside async createScene; ok iff `spatial.probes.run_probe(ws, *, compile=True, timeout_s=None) -> (scene_probe, shader_preflight, census)` (one `probe_scene.mjs --compile` boot; `probe_scene` is the same call without `compile`) passes both; both reports ride `BuildResult.gates`, and the `shader_probe` tool reports the same call |
-| `SceneBlenderRuntime` | `src/scene.py`, `src/zones/*.py`, `src/assets/*.py`, `src/env.py` | **Δ 2026-09-24 (D102)** glb_path=None; `scene.py` is assembled DATA (`ZONES`/`ASSETS`/`HEROES` `{snake: Pascal}`, `CAMERAS` in the Blender frame, vertical fov); build = one Blender process (`wrappers/run_bpy_scene.py`: env, heroes, assets, zones each isolated — a raise is an ERROR on its `file:line` and the zone is dropped) → `artifacts/{census.glb, scene.blend, bpy_build.json, bpy_census.json}` → `run_probe(ws, glb=artifacts/census.glb, facts=bpy_census)` (no settle / camera repair; D2 unique-tri ERROR, no draw gate; D10 python drivers ERROR) → `BuildResult.gates=[scene_probe]`; `probe()` = the same measurement without touching build.json; `render_scene` = `spatial.render_blender.render_blender_scene` (**Δ D102b**: Blender renders the authored cameras × times + the overviews from `artifacts/scene.blend`, the JS host keeps the camera checks and the metrics schema; **Δ 2026-10-14 (D105)** the track runs end to end — `env_file` = `src/env.py`, the bpy templates, planner schema and asset ladder under orchestrator/ + tracks/ below); frame clock `scene_blender.FPS`/`frame_of(t) = 1 + round(30 t)` |
-| `GlslShaderRuntime` | `src/shader.frag`, `src/common.glsl`, `src/buffer_a.frag` | harness owns `#version`/uniforms/`out` (wrap.HEADER: u_time/u_resolution/u_mouse/u_frame/u_prev/u_noise + iTime/iChannel* aliases); `compose(shader, common, *, shader_file, common_file)` pastes header < common < shader (Δ D107: no `recipes_src`, no `redefines_recipe` lint, no harness-owned `src/recipes.glsl`); build renders judge frames via GlHost; compile errors → GlslCompileError at mapped src file:line; artifacts frames/, frames_sheet.png, preview.gif, metrics.json |
-| `OpenGLPythonRuntime` | `src/program.py`, `src/*.glsl` | `setup(ctx,w,h)->state` + `render(ctx,state,t,frame,fbo)` run in a moderngl subprocess (`wrappers/run_gl.py`); exceptions map to src/program.py:line, in-string GLSL errors carry both line numbers |
-
-**Scene effect ownership and shader composition** are stated where they live: `src/lib/lifecycle.js`
-(`snapshotResources` / `attachDisposal`) and `src/lib/shader.js` (`patchStandard`, `clonePatchedMaterial`) (D97).
-Scene drawables whose materials all have `depthWrite: false` may set
-`userData.sceneBackdrop = 'sky'` to exclude themselves from content camera framing
-and classify as sky in census/coverage regardless of name or scale; opaque drawables
-cannot opt in (`runtime_js/lib/backdrop.mjs`).
-
-Wrappers are standalone (never import codeverse3d). The three python build wrappers live
-together in `languages/wrappers/` — `run_bpy.py`, `run_bpy_links.py` (Blender's python 3.11),
-`run_cq.py`, and `run_bpy_scene.py` + `_census_glb.py` (scene_blender, D102) — beside the sibling modules they import from their own directory:
-`_wrapper_common.py` (stdlib only: rlimit, seeding, running the script with `src/` on
-`sys.path`, traceback → `src/<file>:<line>`, `sys.exit(0)` is not a failure, the atomic
-report) and `_census.py` (the Blender census, blender AND urdf_blender); copy the directory
-whole. Each writes its report as `build.json` + `census.json`, which the runtime reads
-once through `_common.compose_build_result` (blender and cadquery: `_common.run_wrapper_build`, the
-invalidate → missing entry → subprocess prologue around it) and replaces with the final `BuildResult` — for
-EVERY runtime `artifacts/build.json` is the BuildResult (urdf_blender after its post-wrapper
-checks). `opengl_python/wrappers/run_gl.py` is the moderngl runner; threejs/scene
-export+render live in `runtime_js/` (`export_glb.mjs`, `render_glb.mjs`,
-`render_scene.mjs`, `probe_scene.mjs`, `lib/instances.mjs`; `check_shaders.mjs` is the effect-library tests' compile driver).
-**Placement policy (all languages)**: nothing re-centres or drops to ground at
-export; the build warns and the contract/connectivity gates report it.
-**Δ Node ESM resolution**: bare `import 'three'` needs
-`run_node(..., three_hook=True)` (`--import runtime_js/lib/resolve_three.mjs`;
-`module.registerHooks` on node >= 22.15, `module.register` +
-`lib/resolve_three_async.mjs` down to the 20.6 floor — same resolutions).
-**Δ Node floor**: `spatial.node.NODE_MIN = (20, 6, 0)` is the single source of truth
-(`runtime_js/package.json` `engines.node` mirrors it). `run_node` calls
-`require_node_version()` before spawning, so an old node raises `NodeError` with the fix
-in the message instead of failing obscurely; `parse_node_version` / `node_version_error`
-are the pure helpers `3dcode doctor` reuses for its `node` row.
-
-## spatial/
-
-`tool_common.glb_path` refuses (`ToolUsageError`) when `artifacts/build.json` says the last
-build failed — the one build status: every runtime publishes its final BuildResult there and
-a tool's lint refusal writes a `LintError` one (`build_last.json` is gone, 2026-09-22). Tools
-never measure a stale GLB; missing/unreadable status stays permissive (hand-placed GLBs).
-```python
-from codeverse3d.spatial.render import render_glb
-from codeverse3d.contracts.artifacts import RENDER_MODES # ('shaded','wire','normals','silhouette','clay') — THE mode tuple (no 'depth')
-render_glb(glb, out_dir, *, views=None, mode="shaded|wire|normals|silhouette|clay", width=768, height=768,
- isolate=None, explode=0.0, sheet=True, background=..., anim_time=None, shadow=True, gpu=None,
- timeout_s=None, use_cache=True) -> RenderSet
-from codeverse3d.spatial.render_scene import render_scene
-render_scene(ws, out_dir, *, cameras=None, orbit=True, times=(0.0, 1.5), width=1024, height=576, sheet=True,
- bounds=None) -> RenderSet
- # Δ bounds default from ws plan.json → orbit rig frustum-fits the CONTENT box (not ground/sky);
- # contact sheet = judge subset only; views.json entries get judge: true|false
-from codeverse3d.spatial.render_scene import render_set_from_metrics # metrics.json payload → RenderSet (both scene languages)
-from codeverse3d.spatial.render_blender import render_blender_scene # scene_blender (lane B): Blender pixels, JS camera checks
-render_blender_scene(ws, out_dir, *, cameras=None, orbit=True, times=(0.0, 1.5), width=1024, height=576, sheet=True,
- orbit_views=SCENE_VIEWS, timeout_s=None, bounds=None, blend=None, census=None,
- glb=None, engine=None, samples=None) -> RenderSet
- # blend = artifacts/scene.blend, census = artifacts/census.json (orbit fit), glb = artifacts/census.glb (booted by
- # render_scene.mjs --glb through lib/glb_scene.mjs); metrics.json = the three.js schema + {"language": "scene_blender", "blender": {engine, device, samples,
- # fallback, frame_ms, timings_ms}}; Settings.render.blender_{engine,samples,device,gpu_slots,gpu_wait_s}
-from codeverse3d.spatial.render_scene import select_judge_views, JUDGE_MAX_VIEWS, plan_bounds
-select_judge_views(rs, max_n=10) -> RenderSet # priority: authored@t0, MAX_JUDGE_OVERVIEWS=4 overview@t0 (Δ 2026-10-14,
- # scene: the fourth is conventions.SCENE_VIEWS' overview_low_front, az 20° el 7°, orbit.mjs fitContactCamera), 2 authored@t_last, rest
-from codeverse3d.spatial.frame_metrics import frame_gate_from_renders, frame_findings, frame_summary_text, FRAME_GATE
-frame_gate_from_renders(renders) -> GateReport # gate "scene_frames"; data.kind ∈ dark_frame | blown_frame | flat_frame |
- # camera_in_geometry | camera_underground | camera_low | camera_high | content_small; authored cameras → ERROR, orbit rig → WARN
- # Δ camera_low / camera_high measure camera_checks.ground_below_m (the ray straight down from the eye, nearGeometry);
- # the scene-wide census ground_y is the fallback when nothing lies beneath the lens
- # Δ camera_blocked (ERROR: ≥ 6 of the 9 sight rays end within near_limit_m 1.5) · camera_target_blocked (WARN: the line of
- # sight to the plan's lookAt is cut before half the distance, names the cutter) · camera_under_ground_mesh (WARN, ERROR
- # when the frame agrees: a terrain-scale ground surface straight above the eye, ground_above_m; the camera repair lifts it)
- # Δ hero_unseen (ERROR: a loaded GLB in the scene fills < 0.5 % of every authored frame — camera_checks[].glb_frac, one mask
- # render per GLB per camera, occlusion included) · hero_small_in_its_camera (WARN: < 2 % in the camera named for it)
- # Δ scene_placement stamped_ring (WARN): census groups[].stamps — per family of ≥ 8 copies {n, radius_m, radius_cv,
- # gap_cv, size_cv}; ≥ 8 same-size copies evenly on a ring at ≥ 0.6 × the plan's half-extent (host_census stampStats)
- # Δ census.camera_repair rows carry moved_side_m, blocked_before, cut_before, under_before, aimed_at (D73: a camera named
- # for a hero — a name word of its GLB file in the camera name — is re-aimed at the hero's centre when that centre is
- # outside its frustum, before the retreat search); the overview rig
- # (noFog views) hides see-through sky layers whose box lies below the eye; roomShell tags userData.placement='free'
-from codeverse3d.spatial.measure import measure_glb # link-hierarchy rule: metadata["links"] → each link is its own part
- # Δ Measurement.extra["complexity"] = ComplexityVector.model_dump() (additive, best-effort, never raises)
-from codeverse3d.spatial.complexity import (ComplexityVector, COMPLEXITY_WEIGHTS, COMPLEXITY_VERSION,
- complexity_of_glb, complexity_of_parts, band_of)
-complexity_of_glb(glb) -> ComplexityVector # part_count, assembly_depth, tri_count, materials, silhouette,
- # feature_density, symmetry_groups, hollowness, + index 0-1 (documented weights) and band
- # (trivial|simple|moderate|complex|intricate). Deterministic, no VLM/render. eval/docs/COMPLEXITY.md
-from codeverse3d.spatial.connectivity import check_connectivity # (glb, *, gap_m=…, …, language="", planned_edges=()) — planned_edges: (child, parent | (copies…)); Δ language selects the
-from codeverse3d.spatial.contract import check_contract # frame of fix hints; both gates emit hints in the AUTHORING frame
- # (labelled "blender frame: Z-up, -Y front" etc.), GLB vectors in data
- # (Δ 2026-08-30) connectivity measures overlap WHERE it is (a dense pass on the AABB-overlap region), so a thin
- # member's tip is no longer diluted under PENETRATION_MIN_FRACTION; every interpenetration finding carries
- # data{kind="penetration", other, entering, container, depth_m, fraction_inside, local_fraction, inside_count,
- # through_ratio (2·depth/thickness of the part entered — MEASURED, never a severity), thickness_m}; severity is
- # depth alone (2 mm WARN / 10 mm ERROR). One INFO "contact ledger" finding closes every report:
- # data{parts, contacts [[a,b,gap_mm]], overlaps [[a,b,depth_mm,through]] incl. sub-threshold welds, ground_gap_mm{part},
- # planned [[a,b,gap_mm,"contact"|"open"]] for the plan's attach_to pairs (spatial/contract.planned_joins — a child against
- # every parent copy its box touches; the gate keeps each CONTACT row, else the nearest), planned_unresolved}.
- # (Δ 2026-08-30) check_contract adds ONE orientation finding on a StaticPlan (data.kind="orientation", pose lying|stood → ERROR,
- # turned → WARN; planned_up_m, measured_up_m, best_axis): an extents-permutation test in the plan frame, 0 flags over
- # 629 corpus measurements, fires on brilliana's c-clamp / gate-valve.
- # (Δ D110) check_contract ERROR data.kind="placeholder_part" (contracts.artifacts.PLACEHOLDER_PART; tri_count, instances)
- # when spatial.contract.is_placeholder(rows, plan_box_glb): every measured row ≤ PLACEHOLDER_MAX_TRIS (12) triangles,
- # watertight with volume_m3 ≥ PLACEHOLDER_MIN_FILL (0.999) × its own box (open / unmeasured never fires),
- # extents within PLACEHOLDER_TOL_M (1 mm) of the plan's, a single instance also at the plan centre — the skeleton's box
- # in every object language, measured, never grepped. build_refine_instructions routes it ahead of every gate ERROR.
-from codeverse3d.spatial.measure import measure_glb, world_transform, node_name_findings # (Δ 2026-08-30) world frames are composed
- # by walking the graph's edge matrices (trimesh's get() dropped a root pivot's rotation); a GLB with duplicate / unnamed nodes
- # lands a finding in Measurement.extra["findings"] — trimesh re-parents renamed nodes and the numbers are approximate
-from codeverse3d.spatial.scene_placement import placement_findings, placement_gate, placement_gate_safe, placement_census, placement_table_text
-placement_census(ws, probe, *, force_probe=False, timeout_s=60.0) -> dict # Δ D101: probe = the language's SceneRuntime.probe
-placement_findings(table, *, indoor=False, language=None, thresholds=None) -> GateReport # gate "scene_placement"; data.kind ∈ floating | sunken |
- # unsupported | interpenetration | summary | probe_failed; target "Zone/Asset" (routes to src/zones/<zone>.js);
- # Δ D106 (2026-10-15) the PLAN kinds placement_gate adds: zone_empty | missing_content | scale | stamped_ring (WARN) | no_fog |
- # fog_short | world_edge (WARN; was no_backdrop ERROR: standing geometry ≥ WORLD_EDGE_MIN_HEIGHT_M past WORLD_EDGE_REACH_FACTOR ×
- # the half-extent) | density_note (INFO; was underdressed ERROR) | out_of_bounds (WARN on rows carrying a PLANNED content's name
- # only, margin max(BOUNDS_MARGIN_MIN_M 5, BOUNDS_MARGIN_FRAC 10 % of span); unplanned geometry past the bounds is never reported)
- # messages carry the scene cap words (floating / sunken / interpenetration / scale / free_exempt); reads artifacts/census.json["placement"] (host_placement.mjs)
- # Δ D105 (2026-10-14): thresholds = Settings.placement (config.Placement) read at CALL time, `thresholds=` overrides; the
- # summary INFO's data carries `thresholds` (what graded) + `counts` (measured) / `listed` (after the per-kind cap);
- # + kinds cantilevered (WARN: rests on ≤ 1 of ≥ 4 foot columns, host_placement rows gap_max_m / columns_resting / tilt_m)
- # and free_exempt (one per report: share of assets tagged placement='free' past free_exempt_warn / _error);
- # every per-asset / pair finding carries data.bbox = {center, size} (GLB frame) for the judge's contact crops
-placement_gate(ws, census, plan) -> GateReport | None # THE verdict (Δ 2026-09-22): ScenePipeline.gates and the check_placement
- # tool both return it — placement_gate_safe fed the zone layouts and the unbuilt assets from ws/stages/{layouts,assets}.json
-placement_gate_safe(census, *, plan=None, layouts=None, unavailable=()) -> GateReport | None # the pure core: None without a table, WARN on failure, never raises; `unavailable` = assets the stage could not build (not "missing planned contents")
-from codeverse3d.spatial.scene_placement import setting_text # (plan: dict | model) -> the indoor/outdoor setting line
-from codeverse3d.spatial.silhouette import compare_silhouette # the reference gate + compare_reference's IoU (no tool of its own)
-from codeverse3d.spatial.sections import judge_slices, SliceManifest, JUDGE_SLICE_PLANES # (D48)
-judge_slices(glb, error_pairs, out_dir, planes=("front_back","left_right")) -> SliceManifest # two vertical centre slices,
- # red hatch ONLY on error_pairs (the connectivity gate's ERROR penetration pairs), plain darkened blend otherwise,
- # degenerate slices dropped (F4) → 0–2 PNGs (slice_<name>.png, manifest.json beside them; JudgeSlice.png is a bare
- # file name); needs the mesh extra (shapely + matplotlib), ImportError propagates; a bad GLB → manifest.errors, no raise
-cross_section(glb, axis, at, out_png, *, parts=None) -> Observation # the tool's body: any axis, `at` a fraction of
- # the SELECTED parts' bbox; loops / filled area / hollow ratio + the same renderer's image (overlaps plain, never
- # hatched); a plane that cuts nothing answers in text with no image
-from codeverse3d.spatial.joints_model import load_urdf, fk, UrdfError # RESERVED_LINK_NAMES={'world'}; Robot/Link/Joint
-from codeverse3d.spatial.joints_poses import pose_samples, limit_poses
-from codeverse3d.spatial.joints_export import urdf_to_glb, render_poses, ARTICULATION_SHEET_NAME
-from codeverse3d.spatial.joints_sweep import sweep_gate, sweep_collisions, find_urdf, motion_direction_check, SWEEP_GATE
-sweep_gate(ws) -> (GateReport "joint_sweep", Robot | None) # THE verdict (Δ 2026-09-22): pose_samples → sweep_collisions →
- # aggregate_findings(sweep_findings) + buried_links. tracks/articulated_object.default_joint_sweep (the round's gate,
- # + pose renders) and the joint_sweep TOOL (spatial/tools.py: gate_observation of it + a narrowed pose sheet) both
- # report exactly this; the tool used to run its own sweep (fail on any overlap > 2 mm or any gap, no buried links)
-from codeverse3d.spatial.joints_collide import components # (names, edges) -> list[set[str]]: THE union-find (connectivity + sweep)
-# joints_collide.py: deterministic penetration (oriented islands + fixed-direction parity ray test; python-fcl is a
-# core dependency)
-from codeverse3d.spatial.gl_render import GlHost, GlResult, GlHostError, write_contact_sheet, write_gif
-GlHost(gpu="auto|on|off", timeout_s=240, fps=30, max_steps=240)
- .render_fragment_shader(frag_src, out_dir, *, width=1280, height=720, times=..., buffer_a_src=None, feedback=False)
- .run_program(program_path, out_dir, *, width, height, times) -> GlResult{ok, stage, frames[GlFrame], renderer, gpu, …}
-from codeverse3d.spatial.frame_stats import sequence_stats, frame_gate # gate "gl_frames"; data.kind ∈ nan | black | blown |
- # static | flicker | low_detail | duplicate | no_frames
-from codeverse3d.spatial.registry import tool, get_tool, list_tools, tool_cards, ToolContext, Observation
-Observation{ok: VERDICT, failed: the tool could not run, text, numbers, images, duration_ms} # is_error == failed,
- # never `not ok`. failed is set by Observation.error(...) and by exactly three tools that compose
- # their own result: build (no readable GLB), scene_probe (driver died), render_observation (no view
- # and no console error — with one it is a verdict)
-from codeverse3d.spatial.mcp_server import observation_content, max_images_for, MAX_TEXT_CHARS
- # payload bound at the MCP boundary: text truncated; images 4 (ok) | 1 (FAIL verdict) | 0 (failed)
-import codeverse3d.spatial.tools # registers every tool (the list and their tracks: docs/ARCHITECTURE.md §5)
-python -m codeverse3d.spatial.mcp_server --workspace <ws> [--track X] [--language Y] [--round N] [--list] # MCP name: 3dcode
-```
-
-## judges/
-```python
-from codeverse3d.judges.rubrics import load_rubric, Rubric # Rubric{…, defects: [DefectItem{id, text, penalty, cap}], caps[{…, when:, kinds}]}
-from codeverse3d.judges.vlm_judge import VlmJudge
-VlmJudge(rubric="static_object", model_id=None (settings.default_judge = gemini-3.1-pro-preview), n_samples=1,
- temperature=0.2, *, thinking=None, max_attempts=3, max_montages=None, detail_crops=None, max_px=None,
- sample_budget_s=None, fixed_order=False, chat_model=None, cache_dir=None, label="judge")
- # Δ max_images is GONE → montage budget. The None params resolve through Settings.judge
- # (montages=5 since D47, detail_crops=2, max_px=1024, thinking="low" — Δ 2026-10-14 D105: thinking=None reads
- # Settings.judge.thinking / C3D_JUDGE__THINKING, `3dcode judge --thinking` and calibrate(thinking=None) too) and
- # SAMPLE_BUDGET_S=900.0; TRACK_MONTAGE_CAP = {"scene": 4, "graphics": 3} bounds the dial per track
-VlmJudge.judge(inp) -> Judgment # clay/normals views travel ONLY as JudgeInput.geometry_views (no kwarg)
-VlmJudge.slice_payload(inp) -> (list[(label, png_path)], provenance_elicitation: bool) # (D48) ([], False) unless
- # Settings.judge.slices=="on-error" AND spec.track in judges.base.SLICE_TRACKS AND inp.glb_path exists AND the
- # connectivity gate has ≥1 ERROR; renders judge_slices into the judge cache (keyed by glb identity + error pairs)
-from codeverse3d.judges.base import JudgeInput # (spec, renders, measurement=None, gates=[], acceptance=[], plan_summary="",
- # part_names=[] (an object plan's parts: ReferenceJudge's mismatch diff),
- # round_index=0, previous=None, extra_context="", geometry_views=None,
- # glb_path=None (D48: the round's canonical GLB; object tracks + 3dcode judge fill it))
-from codeverse3d.judges.base import round_input, plan_summary
-round_input(spec, plan, rnd, *, renders, gates, previous, extra_context, geometry_views, glb_path) -> JudgeInput
- # THE payload of one round: tracks/steps._judge builds it from the round in hand, cli/_judge.build_judge_input
- # (`3dcode judge`, addons/calibration) from the stored one — acceptance + digest + part_names from the plan, glb_path only on
- # SLICE_TRACKS; eval's fixed judge (eval/bench/_fixed_eval.fixed_input, plan=None, acceptance = the brief's must_have) too. Δ 2026-09-22: replays used a dict digest of plan.json (a Z-up object read W×D×H, a shader lost
- # style / passes / key visuals / motion); cli/_judge.stored_plan types plan.json when record.json has no plan
-plan_summary(plan, language) -> str # the digest for every track (object: "Overall W×H×D m" in the GLB frame);
-from codeverse3d.judges.prompt_builder import plan_montages, render_montage, Montage # ≤5 2×2 montages (shaded/geometry/poses) + ≤2 detail
- # crops @≤1024px replace the sheet + the 14-view rig (D47); clay/normals views (RenderView.mode) auto-route to the GEOMETRY montage
- # Δ 2026-10-14 (scene): plan_montages(…, gates=()) / plan_detail_crops(shaded, *, scene, gates=(), limit) — a scene sends the
- # centre crop + ≤ limit CONTACT CROPs (plan_contact_crops: a scene_placement finding's data.bbox projected through the judged
- # overview tile that shows it largest, project_box); gates_section(gates, *, scene=False) has a scene branch (placement →
- # frames → lint, WARNs grouped by kind, one MEASURED PLACEMENT line: placement_block); the object text is unchanged
-from codeverse3d.judges.prompt_builder import build_judge_messages, connectivity_error_pairs, PROVENANCE_ELICITATION
-build_judge_messages(inp, rubric, *, …, extra_images=None (PREpended: references), extra_text="",
- slice_images=None, provenance_elicitation=False) -> (system, [ChatMessage]) # (D48) slice_images
- # (label, path) are APPENDED after the montages/crops + described by slice_rig_section in the view-rig text;
- # provenance_elicitation appends one sentence to the DEFECT CHECKLIST bullet. Defaults build the byte-identical
- # pre-D48 payload; judge_prompt_hash(rubric) is unchanged either way (per-round content stays outside the hash)
-connectivity_error_pairs(gates) -> list[(a, b)] # the gate's ERROR penetration pairs via finding.target/data.other
-from codeverse3d.judges.rubrics import aggregate_samples, SCORING_VERSION # (Judgment.degraded: a glitch, not a score) ScoreBreakdown adds defects,
- # defect_votes (majority; a defect tie → absent, an acceptance tie → representative sample, D36 as amended
- # 2026-08-30), tie_broken, defect_penalty, overall_after_defects, overridden (defects the measured-absent
- # veto switched off), scoring_version (= SCORING_VERSION, 2; older records carry 0), judge_prompt_hash (D37);
- # overall = caps(weighted_mean − Σpenalty)
- # CapRule gains measures: list[str] (the checklist defect ids a gate rule is the MEASUREMENT of —
- # penetration_error.measures = [interpenetration]) and graded: bool (an acceptance rule caps at
- # cap + (1−cap)·verified/total instead of a flat cap); rubrics._rule_evidence is now _rule_hit -> CapApplied | None
-from codeverse3d.judges.rubrics import apply_caps # (rubric, overall, gates, acceptance_results, acceptance_items=None, *,
- # console_errors=None, views=None, defects_present=None) -> CapResult;
- # cap rules add when="missing_views" and ledger lines "defect:<id>"
-from codeverse3d.judges.pairwise import PairwiseJudge # .compare(spec, renders_a, renders_b, *, rubric=…) -> PairwiseResult
-from codeverse3d.addons.calibration import calibrate, CalibrationTable # (run_dirs, *, model_id, n_samples=3, out_dir, geometry_mode,
- # rounds, …) -> rows + pearson/spearman(errors vs score), mean_std, cost; CLI: python -m codeverse3d.addons.calibration RUN… --n 3
-from codeverse3d.judges.vlm_judge import ReferenceJudge # image-conditioned specs
-from codeverse3d.judges.vlm_judge import judge_for # (track, rubric, *, references) -> type[VlmJudge]: the ONE class rule
- # for the live run (BaseTrack.make_judge) and every replay (3dcode judge, calibration): measured rubric or photos on an
- # object track -> ReferenceJudge, photos on graphics/scene -> LikenessJudge, else VlmJudge
-```
-The rubric list is ARCHITECTURE §6's. Wire schema order is
-observe-then-score (summary/issues/defects/acceptance before criteria) — measured to
-restore flash's dynamic range. `passed = overall ≥ threshold ∧ no floor ∧ all
-must-acceptance`; gate authors set `GateFinding.data["kind"]` so caps match precisely.
-
-## orchestrator/ + tracks/
-```python
-from codeverse3d.tracks import get_track
-rec = get_track(spec.track, **options).run(spec, ws, resume=False) -> RunRecord # Δ kwargs forwarded to the constructor:
-# services=, judge=, agent=, model=, runtime=, policy=RoundPolicy, settings=, planner_model=, n_candidates=
-# (CLI --candidates > spec.options.candidates > settings.default_candidates; 1 where not TRACK_INFO[track].best_of_n: scene)
-# StaticObject | Articulated | Scene | Graphics
-BaseTrack.run(spec, ws, *, resume=False, force=False) -> RunRecord # get_track returns a tracks.lifecycle.BaseTrack
-BaseTrack.stages: Stages = (SKELETON, MATERIALIZE) # the pre-round graph (docs/ARCHITECTURE.md §7.1); Stages =
- # tuple[StageNode | tuple[StageNode, ...], ...], an inner tuple = siblings side by side
-StageNode(name, run: (track, ctx) -> Any, key: (ctx) -> dict | None = None, when: (Settings) -> bool | None = None,
- seeds_src=False) # key None = uncached; the result lands in ctx.extra[name]
-run_stages(track, ctx, runner, stages) -> None; plan_stage_key(spec, track) -> dict # the plan's key (eval pin_plan too)
-StageRunner(ws, events, state=None, *, frozen=False) # frozen (rounds exist): a recorded stage is served whatever its key
-from codeverse3d.orchestrator import RoundPolicy, build_refine_instructions, compact_instructions, gate_error_count
-# Δ 2026-10-16 (D111) build_refine_instructions de-duplicates a gate task on (target, "gate:<gate>", finding
-# data["kind"]): two env ERRORs of scene_placement (no_fog, no_background) are two tasks
-RoundPolicy(max_rounds=4, max_refine_tasks=6, max_instructions_per_task=6, parallel_min_tasks=2,
- n_candidates=1, judge_samples=1, judge_reserve_s=240.0, min_session_s=180.0)
- # Δ D112 .can_open(budget, *, single_shot=False) = budget.left_s() >= .need_s(single_shot=...) (judge_reserve_s,
- # + min_session_s unless the generation is single-shot): no refine round, a refine round's transport / stall
- # retry or a stage retry launches without it (round.skipped_budget → BUDGET; round 0's retry is not gated —
- # it has no round to fall back on); refine / rebuild tasks carry
- # GenerationTask.reserve_s = judge_reserve_s (their session's hard deadline ends that much before the budget) # lifecycle.build_context: judge_samples = Settings.judge.samples (N74), n_candidates by ONE dataclasses.replace
- # Δ 2026-09-22 FIXED rounds: a run is the baseline + max_rounds refine rounds, EACH built on the round before
- # it; only the clock (BudgetGuard) or a hard failure ends it early. Gone with the judgement stops: StopPolicy /
- # StopDecision, pick_best_round, judge_sigma, best_score, last_gain, REWRITE_KIND / DETAIL_KIND /
- # KIND_FOR_STRATEGY / detail_blocked, RunState.best_* / update_best, and the RoundPolicy fields plateau_window,
- # min_delta, target, pairwise_*, judge_model, regression_sigma, marginal_*, detail_*.
-from codeverse3d.orchestrator import BudgetGuard, BudgetSnapshot
-BudgetGuard(budget, start_time=None, *, soft_fraction=1.0) # THE CLOCK, nothing else (Δ 2026-09-22)
- .check() / .ok() / .elapsed_minutes() / .timeout_s(want_s, *, floor_s, soft) / .soft_exceeded() / .left_s(*, soft=False)
- .grant_grace(minutes=) / .snapshot() -> BudgetSnapshot{active_s} / .restore(snap) / .summary() -> {elapsed_min,
- max_minutes}
- # Δ 2026-09-22: charge / add / mark / stage_summary / spent / billed_usd / by_stage and usage_delta are gone —
- # the ledger (telemetry/cost.jsonl) is the only record of money; a run's total is its sum at list price
- # (record.package_run / BaseTrack._record), a round's cost the rows booked inside it (cost.tally.tally)
-from codeverse3d.cost.tally import tally, timed, book_usage, book_time # a block's money + lost seconds
-with tally() as t: ... # t.usage = the ledger rows booked inside (nests; fan_out copies it)
-with timed("judge", steps, round_index=i): ... # appends StepTime{step, round, wall_s, lost_s} (docs/COST.md §31)
-RunRecord.minutes / RoundRecord.minutes # Σ (wall − lost) over the steps; no steps → its own clock
-from codeverse3d.tracks.candidates import CandidateRecord, rank_candidates # the one in-loop choice left
-from codeverse3d.tracks.candidates import run_best_of_n, quick_render # N parallel baselines in <ws>/_cand/c<k>
-# each candidate IS steps._run_round(kind="candidate") in its sub-workspace: render=quick_render(ctx, round_index, build,
-# measurement, *, pipeline) (4 views + the articulated pose views), geometry_views=False, its own events.jsonl and a
-# one-sample judge → _cand/c<k>/judge/r00.json (a degraded verdict stays score None); crashed candidate retried once;
-# selection by build_ok → quick score → fewer gate errors → the earlier candidate (no pairwise since 2026-09-22);
-# winner copied back, normal r00 pipeline follows; rounds/candidates.json IS record.extra["candidates"] (n, selected,
-# candidates[])
-from codeverse3d.tracks.articulated_object import default_motion_checks, expected_direction # gate "motion_direction"
-from codeverse3d.tracks.static_object import silhouette_gate, reference_refine_tasks # gate "reference_silhouette" (IoU<0.6 → WARN + refine task)
-from codeverse3d.tracks.depth import depth_budget, DepthBudget, DETAIL_ADVICE # complexity-aware budgets
- # (Δ D110: scope_groups / PartScope / interfaces_text / scoped_generation_enabled deleted with the scoped baseline)
-depth_budget(plan, build_timeout_s) -> DepthBudget # min/target/max triangles + max_build_s sized from
- # the plan's LEAF count (parts × instances × children); only budget_gate reads it — no prompt states it.
- # DETAIL_ADVICE: the numberless "spend detail inside the planned parts" bullet the generate/refine
- # templates show as {{ detail_advice }}
-from codeverse3d.tracks.prompting import base_prompt_context, reference_images # Δ split out of
- # Δ D107: select_cookbook_chapters / is_always_chapter / COOKBOOK_SYNONYMS and the graphics recipe seeding
- # (tracks/graphics.seed_recipes, cookbook_functions, the "recipes" stage, Settings.limits.seed_recipes /
- # C3D_SEED_RECIPES) are deleted with the cookbooks; base_prompt_context carries no cookbook_excerpt
-from codeverse3d.tracks.common import RunContext, Services # common.py; RunContext.single_shot / .agent_kind
- # (Δ 2026-08-30) Services.connectivity(glb, language="", planned_edges=()) forwards the plan's attach_to pairs;
- # spatial.contract.planned_joins(plan, measurement) -> [(child, (parent copies…))] spells them in GLB part names via
- # spatial.contract.match_parts (instance copies Leg_0..n join the nearest parent copy — no regex on ids)
-from codeverse3d.judges.prompt_builder import gates_section, contact_ledger # (Δ 2026-08-30) contact_ledger(gates) finds the
- # connectivity report's INFO ledger; with it gates_section renders MEASURED STRUCTURE + one overlap line + planned joins
- # (LEDGER_MAX_CONTACTS 24, LEDGER_MAX_JOINS 20, ground line for parts within GROUND_BAND_MM of the lowest point whose gap
- # exceeds GROUND_GAP_REPORT_MM) and drops the per-pair penetration WARN prose; without it the pre-change text, byte for byte
-from codeverse3d.tracks.generation import write_files # (ws, files, *, allowed_roots, only=None, frozen=(), on_skip=None):
- # frozen = harness-owned paths a single-shot envelope may not rewrite (skipped with a reason, never an error)
-from codeverse3d.agents.cli_common import find_json_object, default_mcp_command # THE one JSON-envelope finder behind
- # parse_claude_json / parse_agy_json; default_mcp_command(ws, *, language, track, round_index)
-from codeverse3d.tracks.generation import generate, run_agent_task, parse_multifile, is_single_shot
-GenerationTask.thinking: Literal["", "off", "low", "medium", "high"] = "" # Δ D110: '' = nobody asked —
- # a single-shot call thinks at SINGLE_SHOT_THINKING ("medium"), an agent session at its backend's default;
- # anything else is explicit and also becomes AgentJob.effort (session_effort). GenerationTask.phase is
- # deleted with its one user (the scoped baseline): run_generation_tasks runs one side-by-side batch.
-generate(ws, *, agent_id, task, ..., budget=BudgetGuard) -> GenerationResult
- # Δ 2026-09-22 GenerationResult.transient / .quota carry the backend's typed class; a call that RAISED is
- # GenerationResult.from_error(label, e) — transient = tracks.generation.is_model_outage(e) (ModelError
- # retryable or 429/5xx; moved from scene_assets, the one exception classifier)
-from codeverse3d.tracks.steps import RoundFailed # RoundFailed(message, *, transient=False, quota=False, stalled=False);
- # RoundFailed.of(results, default) — the round loop reads .quota (→ agent_quota) and .transient / Δ D112 .stalled
- # (.of: stalled only when EVERY result hung or died of transport; run_best_of_n's failure carries it too)
- # (→ re-run the round once, when RoundPolicy.can_open), never the message (looks_transport / looks_quota deleted)
- # Δ D112 GenerationResult.stalled (AgentResult.stalled, nothing changed); GenerationTask.reserve_s.
- # BaseTrack._salvage(ctx, rounds) (was _salvage_baseline): on a budget stop, ONE grace (max(5, 15 % of the
- # budget) min) and a no-generation round — the baseline before round 0, or (Δ D112) the refine edits the clock
- # stopped (src/ / public/ changed since the last round's commit)
-tracks.common.generate_for(ctx: RunContext, task: GenerationTask) -> GenerationResult
- # THE call every stage makes (env, zones, rounds, repairs, asset ladder, judged fix): generate()
- # with everything ctx knows; Δ D103 no storm fallback (D68's single-shot retry, GenerationResult.storm and
- # the asset ladder's storm-repair rung are gone): a transient death reaches the round loop's one retry
-tracks.common.single_shot_ctx(ctx) -> RunContext | None
- # moved from tracks.scene_assets 2026-09-07 (never scene-specific)
- # The generate.done event carries turns / sessions / turn_capped. A turn cap is applied ONLY if the machine
- # asks: $C3D_AGENT_MAX_TURNS > settings.limits.agent_max_turns >
- # DEFAULT_AGENT_MAX_TURNS (0 = leave AgentJob.max_turns at the backend's own default — a 28-turn
- # default was measured and rejected, docs/COST.md §17). A session that hits a cap that IS set is
- # asked for a final build + summary (WRAPUP_PROMPT) instead of being killed.
- # EVERY session (attempt 1, <label>.a2 retry, <label>.wrapup) is charged as it ends.
-from codeverse3d.tracks.repair import build_with_repair # RepairOutcome(.ok/.max_attempts, attempts, usage); build_with_repair(ctx, *, round_index, label, files_hint=None, max_attempts=None, timeout_s=None) — timeout_s clips every repair session (a scene asset's window)
-# scene assets (tracks/scene_assets.py): build_module_asset (three.js and bpy modules) / build_blender_asset (Δ D105) climb ONE ladder (_ladder: single-shot → check → one feedback repair → agent session); a hero's parts come from the static planner (hero_plan); SceneThreeJsRuntime.render_asset(ws, name, out_dir) renders a module on the hero's quick rig; the assembled scene.js plays every GLB clone's clips (clone.userData.clipOffset de-phases a copy)
-# languages/blender.write_blender_skeleton(ws, plan, *, ground_tol_m=0.002) — the self-check's stands-on-z=0 tolerance (a scene hero passes 0.02)
-# Δ 2026-10-14 (D105) scene_blender first class: the scene track reaches a language through typed tables, never a suffix test
-tracks.scene.SCENE_TEMPLATES: dict[Language, SceneTemplates] # the env / zone / refine / asset templates per scene language
- # (scene_templates(language) -> KeyError for a language the track does not run); the three.js files are byte-identical,
- # the bpy twins carry the same context keys with Blender wording and the bpy library's calls
-tracks.scene.ENV_FILES: dict[Language, str] # src/env.js / src/env.py — the typed fallback of
-tracks.scene.env_file(ctx) -> str # the runtime's SceneRuntime.env_file (a fake, an older runtime)
-tracks.planner.PLAN_TEMPLATES: dict[tuple[Track, Language | None], str] # (track, None) = the track's default and the
-tracks.planner.plan_template(track, language=None) -> str # fallback; (SCENE, SCENE_BLENDER) = tracks/plan_scene_bpy.j2
-tracks.planner.plan_schema(spec, plan_model) -> dict # the planner call's response schema: a scene's names ITS language's
-contracts.plan.scene_plan_schema(language) -> dict # asset kinds (bpy / blender_glb; scene_threejs's = ScenePlan.model_json_schema())
-tracks.scene_assets.build_module_asset(ctx, asset, *, judge) -> AssetResult # bpy: src/assets/<snake>.py (build_<snake>(ctx, variant=0)); three.js: build<Pascal>
- # on the one ladder; no render_asset, so the scene judge sees the module placed
-tracks.scene_assets.check_bpy_asset(ctx, rel, snake, *, expected_size_m=None, timeout_s=None) -> AssetCheck # ONE Blender
- # build of the module alone (<ws>/_assets/<snake>_check): a raise is fatal on its file:line; a runtime without Blender or
- # a harness fault inside the wrapper (BuildResult.harness_failure: the census-GLB writer) is ran=False, ok=True — never a blocker
-tracks.zone_layout.layout_block(layout, *, language=Language.SCENE_THREEJS) -> str # the director's placements in the
- # AUTHORING frame of `language`: the plan's own numbers for three.js, (x, -z) for bpy (a -0.0 folded to 0.0)
-from codeverse3d.tracks.steps import run_round, skip_judge_reason, record_aborted_round
-skip_judge_reason(ctx, *, renders, ignore_budget=False) -> str # "" = judge it. ONLY states where the
- # verdict is never bought at all: no judge / no renders / budget already exceeded
- # (docs/COST.md §17 — "no file change" and "build not repaired" were removed)
-run_round(ctx, *, index, kind, tasks, pipeline, ..., previous=None, findings=()) -> RoundRecord
- # previous / findings: the previous round's verdict (the judge reads it) and gates (the skill router's input)
- # steps._run_round (the same round, no aborted-round record) also takes render: RenderFn | None (swaps the
- # pipeline's render; candidates pass quick_render) and geometry_views=False (skips the clay/normals views)
- # rec.usage = the ledger rows the round booked (its tally) + extra_usage; rec.steps = generate (per phase) /
- # build / gates / render / judge; on ANY exception it records what the round burned and the steps it ran
- # (rounds/aborted_rNN.json, ctx.extra["aborted_rounds"], RunState.steps) and re-raises
-from codeverse3d.tracks.planner import plan, ensure_acceptance, plan_example, plan_temperature
-plan(spec, model_id, plan_model, ws, *, model=None, events=None, budget=None) -> Plan # no runtime= (the contract is the catalog's)
- # Δ 2026-09-22: every track, graphics included, through ONE loop that dispatches on spec.track — PLAN_TEMPLATES,
- # plan_example(track), plan_temperature(track) (graphics 0.5, else 0.4; record/telemetry reports it), the output
- # floor (graphics PLAN_TOKENS_MAX, else PLAN_OUTPUT_FLOOR), plan_budget's unit (passes) and ensure_acceptance
- # (graphics: must_have / must_not + a motion probe item, never dimensions / triangles / ground). The six BaseTrack
- # planner hooks and plan()'s template / example / temperature / max_output_tokens / finalise / event_stats are gone
-```
-`run_round` = generate → commit → `build_with_repair` → measure → gates → render →
-post-render gates → the build's own `BuildResult.gates` (also when the build failed) → judge → commit. Post-render gates: static `reference_silhouette`
-(when references), articulated `joint_sweep` + `motion_direction`, scene
-`render_console` + `scene_frames` (via `ctx.services.frame_gate` ->
-`frame_gate_from_renders`; advisory, a failure is logged not raised), graphics `gl_frames`. Reference specs get a
-`ReferenceJudge` (rubric `reference` for static_object; `LikenessJudge` on graphics/scene —
-`vlm_judge.judge_for`) and images attached to generation prompts.
-
-## record/ + addons/ + cli/
-```python
-from codeverse3d.record.record import finalize_record, load_record, iter_runs, effective_judgment, effective_score
- # Δ 2026-09-22: best_round_index / best_round_record are gone, and fill_derived no longer derives a best round,
- # baseline or final score — which round counts is addons.select's question
-from codeverse3d.record.deliverable import keep_round_artifacts, round_outputs, build_deliverable, load_deliverable
- # keep_round_artifacts(ws, round_index) -> [names]: steps._run_round copies a BUILT round's hand-over files
- # (object.glb object.stl object.step robot.urdf preview.gif frames_sheet.png meshes/*.glb) to artifacts/rNN/
- # round_outputs(ws, rnd) -> Path | None: artifacts/rNN/, else artifacts/ for the best round a pre-2026-09-22
- # record.json names, else None
- # build_deliverable(ws, record, round_index, *, clean=True) -> RunDeliverable: deliverable/ for ONE round —
- # its commit's code + its kept files + its sheet (+ graphics: its judged frames); never rebuilds. Only addons.select.package calls it.
-from codeverse3d.addons import select # which round of a FINISHED run to hand over (cli/ + addons only)
-select.round_rows(run_dir, *, record=None) -> [RoundRow{index, kind, score (effective), passed (the judge's own
- # verdict for THAT round), gate_errors, build_ok, commit, cost_usd, minutes}]
-select.pick(run_dir, *, by="score"|"pairwise", pairwise_model=None, record=None, judge=None) -> int | None
- # highest effective score → fewer gate errors → the earlier round; None when no round was judged. "pairwise":
- # the top two within PAIRWISE_MARGIN=0.03 go to judges.pairwise.PairwiseJudge (position-swapped); the runner-up
- # wins at confidence ≥ 0.6; one paid verdict per (pair, model), cached at artifacts/judge/rAA_vs_rBB_pairwise.json
-select.summarise(run_dir, *, record=None) -> RunSummary{rounds, stop_reason, baseline_score (r00's effective
- # score), picked_round, picked_score, delta, method}: selection.json's round when the run was packaged, else pick()
-select.package(run_dir, round_index, *, method="round") -> Path (deliverable/)
- # + selection.json {round, method, scores, selected_at}
-select.round_file(ws, rnd, name="object.glb") -> Path | None # the round's OWN output (round_outputs), never the
- # canonical artifacts/<name> (the last build's): calibration, `3dcode judge`, export, eval/bench
-select.round_complexity_block(ws, rnd) -> dict | None # its own measurement's vector (legacy: measurement.json only
- # when the canonical build is this round's); gallery cards and dataset meta. Never record.extra["complexity"]
-from codeverse3d.addons.gallery.index import hero_view # (ws, rec, picked) -> (rel, label, n_views): the card image
-from codeverse3d.record.record import complexity_block, round_complexity # objective complexity of what was built
- # finalize_record fills record.extra["complexity"] = the LAST measured round's vector + plan_parts /
- # parts_per_plan_part / by_round; readers that show one round (gallery, dataset) read that round's own
- # round_complexity (a dataset sample's rounds_summary rows carry it)
-from codeverse3d.addons.dataset.export import export_samples # (runs_dir, out_dir, *, min_score=None, only_passed=False,
- # include_unbuilt=False, captions_dir=None, drop_duplicates=False) -> ExportReport{…, n_duplicates, duplicates, tiers}
-from codeverse3d.addons.dataset.quality import quality_tier, prompt_id, find_duplicates # tiers (of the exported round's verdict):
- # A passed & 0 gate errors, B passed, C score ≥ 0.6, D else; dedupe = (code fingerprint, prompt)
-from codeverse3d.addons.dataset.pairs import build_pairs # (runs_dir, out_jsonl, *, min_delta=0.05) -> n
-from codeverse3d.addons.dataset.refine import build_refine, transitions, RefineTransition, REFINE_KINDS, outcome_of
- # build_refine(runs_dir, out_jsonl, **kw) -> (rows written, Counter of drop reasons); writes via a .part file
- # transitions(runs_dir, *, threshold=MIN_PREFERENCE_DELTA, max_diff_bytes=200_000, with_code=False,
- # drops=None) -> Iterator[RefineTransition]; outcome_of(delta, threshold) -> the label
- # one row per round i -> i+1 the harness asked to change; outcome improved|regressed|unchanged|unscored
- # (threshold: pairs.MIN_PREFERENCE_DELTA); dropped rows carry the reason (no_predecessor / no_commit /
- # predecessor_build_failed / predecessor_unjudged / git_read_failed)
-from codeverse3d.record.git_history import read_tree_at, diff_between, changed_files_between, GitReadError
- # read_tree_at(ws, commit, *, paths=None) -> {path: bytes} via ls-tree + cat-file --batch — NEVER
- # `git archive`, which renders content through a planted filter.<name>.smudge and has no --no-filters
- # (tests/flywheel_cli); symlinks (mode 120000) are skipped; `paths` reads only those files
-from codeverse3d.record.record import unique_files, SUBRUN_DIRS, BATTERY_MARKERS
- # unique_files(root, name) -> [Path]: every file called `name` under root ONCE per file on disk (follows
- # the run/telemetry/trajectories symlink and collapses it; skips SUBRUN_DIRS = {_cand, _assets}) — the
- # one walker behind eval/bench/session_stats.py and eval/bench/coupling_stats.py (costreport.audit.find_runs
- # skips SUBRUN_DIRS the same way)
- # diff_between(ws, before, after, *, max_bytes=None) -> (text, untruncated size, was_truncated)
- # changed_files_between(ws, before, after) -> [path]; "is the commit there?" is Workspace.has_commit
- # both under GIT_SAFE_DIFF_FLAGS (--no-ext-diff --no-textconv) on top of workspace.GIT_SAFE_FLAGS
-from codeverse3d.workspace import GIT_SAFE_FLAGS, GIT_SAFE_DIFF_FLAGS, git_safe_env
- # every read of an agent-written repo goes through these. They do NOT disable .git/config —
- # git reads it in full; `-c` only OVERRIDES three keys (hooksPath, fsmonitor, attributesFile)
- # and the diff flags cover ext-diff/textconv, which is why a NAMED filter./diff. driver in .git/config
- # is still live and why read_tree_at avoids every content-rendering command. git_safe_env drops
- # the SYSTEM and GLOBAL config (GIT_CONFIG_NOSYSTEM, GIT_CONFIG_GLOBAL=/dev/null) and the
- # inherited environment (HOME, PATH, GIT_TERMINAL_PROMPT)
-from codeverse3d.addons.dataset.captions import caption_sample # Δ (ws, record, model_id, *, model=None, out_dir=None) -> Captions;
- # out_dir → side-car <out_dir>/<slug>.json, run untouched
-from codeverse3d.addons.gallery.index import build_index, default_roots # THE local gallery (page: build_static, server: serve, GalleryApp)
- # build_index(roots) -> GalleryIndex (sections of RunEntry; never raises per run)
- # build_static(roots, out_html, *, embed=False) -> (path, n, index)
- # render_static(index, *, embed=…, extra_html="") — eval/bench/report.py's page
- # GalleryApp(roots, reload=False).route(path, query) -> Response (pure, testable)
- # serve(roots, *, host=None, port=8765, reload=False)
-from codeverse3d.addons.gallery.urls import safe_join # (root, rel) -> Path inside root, else PathError
-from codeverse3d.addons.gallery.urls import content_type # .glb→model/gltf-binary, .py/.js/.frag→text/plain; charset=utf-8
-3dcodeverse make [--no-pick]|resume [--no-pick]|pick|status|show|render|judge|tools|mcp
- |cost {<slug>,show,cache,prices,estimate}
- |flywheel {export,pairs,refine,caption}|gallery {serve,build}
- |skills {list,show,validate,report}|doctor # alias: 3dcode; batteries: eval/ (python -m bench.run_bench)
-```
-
-## Events and records
-`EventLog.emit(event, **data)` writes `{"t", "event", ...}` (**Δ** key is `event`). A function whose `events=` is
-optional normalises it once with `events = proc.NULL_EVENTS if events is None else events` (never `events or …`).
-Event names: `run.start`, `stage.start/done`, `plan.done`, `workspace.materialized`,
-`round.start`, `generate.done`, `build.done`, `gates.done`, `judge.done`,
-`round.done`, `refine.planned`, `asset.judged`, `assets.done`,
-`zones.done`, `assemble.done`, `round.no_change`, `candidates.start`,
-`candidate.start/done/failed/retry/selected`, `resume.reconciled` (rounds, dropped, `restored_last_round`; Δ 2026-09-22 no
-`state_was_stale`: run_state.json keeps no copy of the round journal to go stale),
-`budget.exceeded`,
-`finalise.rebuild`, `stop` (reason, rounds), `run.done` (status, rounds, last_score) / `run.failed`;
-after the run: `pick.pairwise`, `pick.packaged` (addons.select).
-Cost events: `judge.skipped` (reason), `generate.turn_cap` (label, max_turns, turns, cost_usd);
-`run.done` carries the run's `cost_usd` (the ledger's) and `minutes`. Δ 2026-09-22: `cost.round` is
-gone — no reader, and its per-round {stage → $} restated the ledger (`summarise(rows)` by round and stage).
-Δ 2026-09-22: `best.updated`, `strategy.switch`, `round.refine_from_best`, `pairwise.done` and
-`budget.overrun` are gone, and so is `RoundRecord.pairwise` (the in-run tie-break note; an old
-rNN.json that carries one still loads, the key ignored). `PairwiseNote` lives in `addons.select`.
-`RunRecord` (record.json): spec, plan, workspace, status, rounds[RoundRecord{…, usage, duration_s, steps}],
-total_usage, environment, steps (run-level StepTime rows; `minutes` = the property over all of them),
-prompt_hashes{contract, generate, refine, …} (Δ D107: no cookbook key), error, extra{stop_reason,
-rubric, budget{elapsed_min, max_minutes} (the clock), aborted_rounds?, candidates? (the
-rounds/candidates.json payload), captions?}. `total_usage` is the sum of telemetry/cost.jsonl at
-list price — every billed row once, aborted rounds, retried sessions and billed-but-discarded round-trips
-included; what a pick buys (a pairwise verdict) joins it when `select.package` re-packages the run.
-Selection is stored separately; `RunRecord` carries no `best_round` field. Round outputs
-are read from `artifacts/rNN/`, and minutes come from `StepTime` rows. Historical status,
-manifest and timing migration is unsupported. A completed `status` names its stop reason:
-max_rounds | budget | agent_quota | no_change | no_refine_tasks | judge_unavailable | failed.
diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.md
index 3760ca89..b656663b 100644
--- a/harness/docs/RUNBOOK.md
+++ b/harness/docs/RUNBOOK.md
@@ -1,29 +1,23 @@
# Runbook — operating the harness
-Everything here was exercised on this machine (WSL2, RTX 5090, Blender 5.2.2 LTS (since 2026-10-14; was 5.0.1),
-node 24, gemini-cli 0.53 (removed in D103), claude 2.1, codex 0.147+, agy 1.1) on 2026-08-23;
-the agy rows re-checked on agy 1.3.4, 2026-10-13, and the three CLI backends re-run live on
-agy 1.4.12 / claude 2.1.317 / codex 0.166.0 on 2026-11-03 (D115). Paths
-are relative to the harness root (`harness/` in the checkout) unless absolute. The CLI is
-`3dcodeverse` with short alias `3dcode` (used below).
+Paths are relative to the harness root (`harness/` in the checkout) unless absolute. The CLI is
+`3dcodeverse` with short alias `3dcode` (used below). Installing: `docs/INSTALL.md`.
## 1. Install and check
```bash
pip install -e harness # once, from the checkout root; entry points 3dcodeverse and 3dcode
cd harness/runtime_js && npm install # [email protected], puppeteer (chrome cached)
-3dcode doctor # python deps (incl. python-fcl, moderngl), blender, node/three/puppeteer, chrome WebGL, keys, CLIs, git, mcp
+3dcode doctor # python deps, blender, node/three/puppeteer, chrome WebGL, keys, CLIs, git, mcp
3dcode doctor --live # + one tiny Gemini call ("pong", ~$0.00001)
python -m pytest tests -q # offline suite; live tests are opt-in (blender/node/GL run when the binaries exist)
python -m pytest tests -q -m "not live and not blender and not node" # pure-python subset
python -m pytest tests -q -m live # OPT-IN: real API calls
```
-### Keys and settings
-Gemini keys, the other providers' keys, the settings files, every `C3D_*` override, how
-Blender is found and how the GPU path is chosen are `docs/INSTALL.md` §8, §6 and §7 (their
-one home); each setting's default and description is its `Settings` field in
-`codeverse3d/config.py`.
+Gemini keys, the other providers' keys, the settings files, every `C3D_*` override, how Blender
+is found and how the GPU path is chosen: `docs/INSTALL.md` §8, §6 and §7; each setting's default
+and description is its `Settings` field in `codeverse3d/config.py`.
## 2. Running each track
@@ -34,98 +28,84 @@ one home); each setting's default and description is its `Settings` field in
3dcode make "a classic park bench" --track static_object --language threejs --generator agy:gemini-4-argon
# articulated object — bpy links + URDF
3dcode make "a bedside cabinet with one hinged door and one drawer" --track articulated_object --language urdf_blender
-# scene — multi-file three.js + GLSL (+ optional bpy GLB assets chosen by the planner)
+# scene — multi-file three.js + GLSL (+ optional bpy GLB assets chosen by the planner), or bpy on Blender
3dcode make "a small japanese garden at dusk with a koi pond" --track scene --language scene_threejs --rounds 2 --max-minutes 60
+3dcode make "a small japanese garden at dusk with a koi pond" --track scene --language scene_blender --rounds 2 --max-minutes 90
# graphics — animated shader / raw OpenGL program
3dcode make "neon cyberpunk rain on a window with bokeh city lights" --track graphics --language glsl_shader
3dcode make "instanced pastel cubes with bloom" --track graphics --language opengl_python
```
-Useful flags (`3dcode make --help`): `--generator`, `--planner`, `--judge`
-(backend ids, §3), `--image <png>` (repeatable; reference images → `ReferenceJudge` +
-silhouette gate + IoU refine tasks), `--rounds N` (refine rounds after the baseline — a
-run does exactly N, each built on the one before it, unless the clock or a hard failure
-stops it; there is no pass / plateau / regression stop since 2026-09-22),
-`--candidates N` (best-of-N baseline: N parallel candidates in `<ws>/_cand/`,
-quick-judged, the highest quick score kept (fewer gate errors on a tie); multiplies baseline
-cost ≈ N; default from `settings.default_candidates`; object and graphics tracks only —
-a scene writes its baseline in its stages, so `--candidates N>1` is refused there), `--no-pick` (package nothing: no `deliverable/`, no `selection.json` —
-`3dcode pick` later), `--max-minutes`, `--dim height=0.45`, `--must`,
-`--must-not`, `--style`, `--tag`, `--seed` (a label: it re-keys the plan,
-nothing else is seeded by it), `--slug`, `--runs-dir`, `--force`,
-`--no-run` (workspace + spec.json only),
-`--variant NAME` (a per-model prompt/skill overlay — `codeverse3d/prompts/variants/<name>/` +
-`codeverse3d/skills/variants/<name>/`, D105 — frozen on `spec.options.variant` so `resume` and
-`judge` read the same files; default: `C3D_VARIANT`, else `C3D_VARIANTS` keyed by the exact
-generator id — as typed, then by its served model — else the base prompts; an unknown name is
-refused before the run directory exists; the run table prints `variant: argon v1 (<hash>)`).
-`--variant argon_raw` on `--language scene_blender` is RAW mode (D113): no harness bpy library
-ships into the workspace and the model writes every mesh, material, light, world and motion.
-Expected cost/time with gemini-3.8-flash: object tracks ≈ $0.7–0.9 and 12–36 min for
-baseline + 1 refine; best-of-2 single-shot ≈ $0.25 / 8 min; graphics single-shot
-≈ $0.05 / 2 min per judged round; scenes ≈ $2.3 and 30 min before the first judged
-round, then ≈ $0.36 / ~7 min per refine (give scenes `--max-minutes 60`).
+Useful flags (`3dcode make --help`):
+
+* `--generator`, `--planner`, `--judge` — backend ids (§3).
+* `--image <png>` (repeatable) — reference images → `ReferenceJudge` + silhouette gate + IoU
+ refine tasks.
+* `--rounds N` — refine rounds after the baseline. A run does exactly N, each built on the one
+ before it, unless the clock or a hard failure stops it; there is no pass / plateau stop.
+* `--candidates N` — best-of-N baseline: N parallel candidates in `<ws>/_cand/`, quick-judged,
+ the highest quick score kept (fewer gate errors on a tie); multiplies baseline cost ≈ N;
+ object and graphics tracks only (a scene writes its baseline in its stages).
+* `--no-pick` — package nothing (no `deliverable/`, no `selection.json`; `3dcode pick` later).
+* `--max-minutes`, `--dim height=0.45`, `--must`, `--must-not`, `--style`, `--tag`, `--seed` (a
+ label: it re-keys the plan, nothing else is seeded by it), `--slug`, `--runs-dir`, `--force`,
+ `--no-run` (workspace + spec.json only).
+* `--variant NAME` — a per-model prompt/skill overlay (`codeverse3d/prompts/variants/<name>/` +
+ `codeverse3d/skills/variants/<name>/`), frozen on `spec.options.variant` so `resume` and
+ `judge` read the same files; default `C3D_VARIANT`, else `C3D_VARIANTS` keyed by the exact
+ generator id, else the base prompts. `--variant argon_raw` on `--language scene_blender` is
+ RAW mode: no harness bpy library ships and the model writes every line of bpy.
+
+Expected cost/time with gemini-3.8-flash: object tracks ≈ $0.7–0.9 and 12–36 min for baseline +
+1 refine; best-of-2 single-shot ≈ $0.25 / 8 min; graphics single-shot ≈ $0.05 / 2 min per judged
+round; scenes ≈ $2.3 and 30 min before the first judged round, then ≈ $0.36 / ~7 min per refine
+(give scenes `--max-minutes 60`). Actual spend: `3dcode cost <slug>`.
## 3. Backends
| id | what runs | notes |
|---|---|---|
-| `agy:gemini-4-argon` (default) | `agy --dangerously-skip-permissions --print-timeout … --output-format json --add-dir ws --log-file trajectories/<label>_rNN/agy.log --model gemini-api://gemini-4-argon --effort high`, prompt on stdin (no `--print`: `--print -` sends "-") | Gemini-API mode only (Gemini keys required, Gemini models only): pool key, every spatial tool over MCP, priced; see gotchas below. Truncates a prompt past ~175 kB itself |
+| `agy:gemini-4-argon` (default) | `agy --dangerously-skip-permissions --print-timeout … --output-format json --add-dir ws --log-file trajectories/<label>_rNN/agy.log --model gemini-api://gemini-4-argon --effort high`, prompt on stdin | Gemini-API mode only (Gemini keys required, Gemini models only): one pool key per session, every spatial tool over MCP, priced at Gemini list price. Truncates a prompt past ~175 kB itself |
| `single-shot:gemini:gemini-3.8-flash` | one structured-output call → multi-file envelope, no tools | fastest/cheapest; baseline for "raw model" deltas |
-| `claude-code:<model>` | `claude -p --dangerously-skip-permissions --setting-sources project --settings '{"skillOverrides":…}' --mcp-config trajectories/<label>_rNN/mcp.json --strict-mcp-config …`, prompt on stdin, `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1` | local subscription — test lightly; no user setting source, so `~/.claude/settings.json` (effortLevel, hooks, env) does not reach a session |
-| `codex:<model>[@<effort>]` | `codex exec --json -C ws --sandbox workspace-write -c model_reasoning_effort=high -c skills.bundled.enabled=false -c mcp_servers.3dcode.… -`, prompt on stdin | subscription; MCP tools need `default_tools_approval_mode="approve"` (harness passes it); reasoning effort is always stated (`Settings.agents.codex_reasoning_effort`, default `high`; `codex:gpt-5.6-sol@medium` per id, `""` to defer to `~/.codex/config.toml`) |
-| `gemini:* / anthropic:* / openai:*` | ChatModel for planner / judge / captioner / single-shot | Anthropic/OpenAI untested live here |
+| `claude-code:<model>` | `claude -p --dangerously-skip-permissions --setting-sources project --settings '{"skillOverrides":…}' --mcp-config trajectories/<label>_rNN/mcp.json --strict-mcp-config …`, prompt on stdin, `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1` | local subscription; no user setting source, so `~/.claude/settings.json` does not reach a session |
+| `codex:<model>[@<effort>]` | `codex exec --json -C ws --sandbox workspace-write -c model_reasoning_effort=high -c skills.bundled.enabled=false -c mcp_servers.3dcode.… -`, prompt on stdin | local subscription; MCP tools need `default_tools_approval_mode="approve"` (the harness passes it); reasoning effort is always stated (`Settings.agents.codex_reasoning_effort`, default `high`; `codex:gpt-5.6-sol@medium` per id) |
+| `gemini:* / anthropic:* / openai:*` | ChatModel for planner / judge / captioner / single-shot | Anthropic/OpenAI are mock-tested only |
-### agy gotchas (handled by `agents/backends.py`; do not undo — D103)
-* API mode only (owner, 2026-10-13: no subscription sign-in, no Claude models; no keys →
- `available()` is false and the session fails at once). `agy` with no model = `gemini-4-argon`
- (`DEFAULT_AGY_MODEL`). One key
- per session from THE shared pool (`KeyPool.lease_session_key`: no in-flight slot, but a machine-wide
- flock lease under `<cache_dir>/slots/agy_keys/`, so parallel runs put one session per key until every
- key is in one; the shared pool also starts each process's rotation at a random key) as `GEMINI_API_KEY`,
- its outcome reported back (429 → cooldown, 401/403/`API_KEY_INVALID` → dead, 5xx, ok, skip);
- other credential env stripped; KeyPoolExhausted → `exit_reason=budget`, never raised.
+How `agents/backends.py` runs agy (do not undo):
+
+* API mode only: no subscription sign-in, no non-Gemini model; without keys `available()` is
+ false and the session fails at once. `agy` with no model = `gemini-4-argon`. One key per
+ session from the shared pool (`KeyPool.lease_session_key`: a machine-wide flock lease, so
+ parallel runs put one session per key until every key is in one) as `GEMINI_API_KEY`, its
+ outcome reported back (429 → cooldown, 401/403 → dead); other credential env stripped.
* Each session gets a fresh HOME under `<cache_dir>/agy_homes/…` holding
- `.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (without it agy ignores
- the key and asks for a login) and `.gemini/config/mcp_config.json` with the `3dcode` server
- (agy has no per-workspace MCP; the server's `env.HOME` is the real home). The HOME is deleted
- after the session; the tool trace is read from its conversation db first. `PUPPETEER_CACHE_DIR`
- points the agent's shell at the real Chrome cache.
-* argv `--model gemini-api://<bare id> --effort <low|medium|high>`: the id goes to the API
- verbatim (any model the key serves); effort from an agy-style `-low/-medium/-high` suffix, else
- `AgentJob.effort` (a task that explicitly asks — none does today), else `high` (the Gemini API's own
- default; owner, 2026-10-15: argon runs at high on every track, D110). The effort used is on the
- transcript's `invoke` line, in `result.json` and on the session's `cost.jsonl` row. An effort A/B is
- the id suffix: `--generator agy:gemini-4-argon-medium`.
-* Cost: priced at Gemini list price; agy's `output_tokens` already include `thinking_tokens`, so
- output = output − thinking, thoughts = thinking (billed once).
-* `--print-timeout` = `timeout_s` + the watchdog's `HARD_GRACE_S` (5 min) + 1 min, so the watchdog
- decides; agy's own clock stopping a turn (envelope `finished_reason: print_timeout` since 1.4.11 —
- the typed verdict, read first — plus the stderr line `[agy] print timeout after …`, the envelope
- still `SUCCESS` with an empty response) is booked `exit_reason=timeout`; a turn whose verdict is
- `error` (the clock fired while agy was retrying a 503, live 2026-11-03) is booked an error. The
- verdict is on `result.json` as `finished_reason`. At `timeout_s + 1 min` it cut off
- every argon scene asset/env session still working at 8 min (2026-10-13).
-* 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); a transient death goes to the round loop's ONE transport retry,
- which takes a fresh key. There is no single-shot storm fallback (deleted in D103).
-* Workspace files: `AGENTS.md` + `CLAUDE.md` (no `GEMINI.md`: agy reads both it and AGENTS.md)
- and `.antigravityignore`, which hides only noise (renders/judge output, the whole
- `trajectories/`); build/census/measurement JSON stay readable.
-* No cookbook: no language ships one (D106 scene, D107 the rest), so no workspace gets a
- `.3dcode/cookbook.md` or a "## Cookbook" section — the body is the hard rules, the tool cards
- and the language contract; the craft reaches the session as routed skills.
+ `.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (without it agy asks
+ for a login) and `.gemini/config/mcp_config.json` with the `3dcode` server (agy has no
+ per-workspace MCP). The HOME is deleted after the session; the tool trace is read from its
+ conversation db first.
+* `--model gemini-api://<bare id> --effort <low|medium|high>`: the id goes to the API verbatim;
+ effort from an agy-style `-low/-medium/-high` suffix on the generator id, else `high`. An
+ effort A/B is the id suffix: `--generator agy:gemini-4-argon-medium`.
+* Cost: agy's `output_tokens` already include `thinking_tokens`, so output = output − thinking,
+ thoughts = thinking (billed once).
+* `--print-timeout` = `timeout_s` + the watchdog's grace + 1 min, so the watchdog decides; agy's
+ own clock stopping a turn (`finished_reason: print_timeout`) is booked `exit_reason=timeout`.
+* No retry loop in the backend: agy retries its own model calls; a transient death goes to the
+ round loop's ONE transport retry, which takes a fresh key.
+* Workspace files: `AGENTS.md` + `CLAUDE.md` (agy reads both) and `.antigravityignore`, which
+ hides only noise (renders/judge output, `trajectories/`); build/census/measurement JSON stay
+ readable.
* MCP server argv is `[sys.executable, -m, codeverse3d.spatial.mcp_server, --workspace, ws]`;
- server name `3dcode` → tools appear as `mcp__3dcode__<name>` (claude). `3dcode mcp --workspace runs/<slug>` execs the same server;
- `python -m codeverse3d.spatial.mcp_server --workspace ws --list` prints the tools.
+ server name `3dcode` → tools appear as `mcp__3dcode__<name>` (claude). `3dcode mcp
+ --workspace runs/<slug>` execs the same server; `python -m codeverse3d.spatial.mcp_server
+ --workspace ws --list` prints the tools.
## 4. Where outputs land
Everything lands in `runs/<slug>/` — code in `src/` (git, one commit per round), each round's
build in `artifacts/rNN/`, and after a pick `deliverable/` + `selection.json`; the full tree is
-`docs/RUN_LAYOUT.md`. `3dcode status <slug>` prints the stop reason, baseline → picked
-score, the rounds table (the picked round starred, each round's own judge verdict), cost and
-the last events.
+`docs/RUN_LAYOUT.md`. `3dcode status <slug>` prints the stop reason, baseline → picked score,
+the rounds table, cost and the last events.
### Looking at results locally
@@ -134,168 +114,73 @@ the last events.
3dcode gallery serve ../eval/bench/out/static_v2_flash/runs --port 9000 --reload --no-open
3dcode gallery build --out gallery.html [--embed] # one self-contained file (--embed inlines the sheets)
```
-`serve` indexes the run roots (records only — ~85 runs in ~0.15 s) and serves the run
-**directories** too, so every link works: contact sheet, full-size renders, `record.json`,
-`plan.json`/`spec.json`, the `src/` tree (browsable, line-numbered, `raw` = text/plain),
-`object.glb` (orbit viewer on the vendored three.js — no network), articulation sheets,
-`preview.gif`, frames. The page has a live summary strip (n = judged · unjudged ·
-error, mean/median score, total $, wall clock — **recomputed per filter**; no pass rate: a run
-is not passed or failed),
-filters (track / language / tier / backend / verdict / battery + text search over
-prompt+slug) and sort (score / cost / time / name) that never reload, a card ⇄ table
-toggle, light/dark, and a detail page per run (`/run/<battery>/<slug>`) with every round,
-the picked round's judge verdict + issues + improvement plan, the measurement table, the
-full render set, the cost breakdown and the code.
-Filters live in the query string, so a view can be curled or bookmarked:
-`curl -s 'http://127.0.0.1:8765/?track=graphics&tier=A&sort=cost'`.
-`--reload` re-scans on every page load, which is what you want while a bench is writing:
-a run with no `record.json` yet shows as a *pending* card and a half-written one as
-*broken*, never as a crash. The server binds `127.0.0.1` and refuses any other address
-unless you type `--host` yourself; it never serves a path outside the declared roots.
+`serve` indexes the run roots and serves the run **directories** too, so every link works:
+contact sheet, full-size renders, `record.json`, `plan.json`/`spec.json`, the `src/` tree,
+`object.glb` (orbit viewer on the vendored three.js — no network), articulation sheets,
+`preview.gif`, frames. The page has a live summary strip (recomputed per filter), filters
+(track / language / tier / backend / verdict / battery + text search) and sort that never
+reload, a card ⇄ table toggle, light/dark, and a detail page per run (`/run/<battery>/<slug>`)
+with every round, the picked round's verdict, the measurement table, the full render set, the
+cost breakdown and the code. Filters live in the query string, so a view can be curled or
+bookmarked. `--reload` re-scans on every page load (a run with no `record.json` yet shows as
+*pending*, a half-written one as *broken*). The server binds `127.0.0.1` unless you pass
+`--host` and never serves a path outside the declared roots.
## 5. Resume, re-render, re-judge, export
```bash
3dcode resume <slug> [--candidates N] [--no-pick]
- # continues from run_state + stages/*.json (input-hash cached) and from the
- # LAST round (a run recorded before 2026-09-22 that restored its best round
- # is put back on its last). A max_rounds run resumes only with a raised
- # --rounds, a budget run with any raised cap; an agent_quota, judge_unavailable
- # (its last round is re-judged) or failed run resumes as is; the other stops
- # are finished. The budget
- # SNAPSHOT is restored: the active minutes already spent still count, so a
- # raised --max-minutes grants only the difference (downtime never counts), and
- # a run whose clock is already spent is refused until one is (--force too: it
- # keeps the clock);
- # the money is the ledger's, and the step log (the run's minutes) carries on.
- # Once rounds exist a recorded stage never runs again: one whose key drifted (a
- # code change to what it hashes) serves its recorded result (`stage.frozen`); only
- # `resume --force` regenerates a stage under them: it ALWAYS archives the round
- # journal + record.json to rounds/pre_force/ (spec changed or not) and the run
- # starts again at round 0, no stage frozen
+ # continues from run_state + stages/*.json and from the LAST round. A
+ # max_rounds run resumes only with a raised --rounds, a budget run with any
+ # raised cap; an agent_quota, judge_unavailable or failed run resumes as is.
+ # The budget SNAPSHOT is restored: active minutes already spent still count,
+ # so a raised --max-minutes grants only the difference. Once rounds exist a
+ # recorded stage never runs again; `resume --force` regenerates the stages:
+ # it archives the round journal + record.json to rounds/pre_force/ and the
+ # run starts again at round 0
3dcode pick <slug> [--by score|pairwise] [--round N] [--judge MODEL]
- # hand over a round: deliverable/ + selection.json (addons/select). score =
- # highest effective score, ties → fewer gate errors → the earlier round;
- # pairwise = the pairwise judge between the top two when within 0.03 (one
- # paid verdict per pair, cached); --round N = that round.
- # `make`/`resume` run `pick --by score` for you
+ # hand over a round: deliverable/ + selection.json. score = highest
+ # effective score, ties → fewer gate errors → the earlier round; pairwise =
+ # the pairwise judge between the top two when within 0.03; --round N = that
+ # round. `make`/`resume` run `pick --by score` for you
3dcode render <slug> [--mode shaded|wire|normals|clay|silhouette] [--out dir]
3dcode judge <slug> [--round N] [--rubric static_object] [--model gemini:gemini-3.1-pro-preview] [--n 3] [--thinking off|low|medium|high]
# re-judges a round's recorded renders → artifacts/judge/rNN_cli.json
3dcode tools list [--cards] · 3dcode tools measure --workspace runs/<slug> · 3dcode tools gl_frames --workspace … --json '{"times":[0,1,2.5]}'
- # panel says ok | FAIL (the verdict) | error (the tool could not run);
- # exit 1 on either non-ok state — `scene_probe` included since 2026-09-02
- # (COST.md §30), where a failing scene gate used to exit 0
+ # panel says ok | FAIL (the verdict) | error (the tool could not run); exit 1 on either
3dcode flywheel export runs/ dataset/ [--min-score 0.7] [--only-passed] [--pack] [--include-unbuilt]
[--captions-dir caps/] [--drop-duplicates]
3dcode flywheel pairs runs/ pairs.jsonl [--min-delta 0.05]
3dcode flywheel refine runs/ refine.jsonl [--with-code]
- # one row per round the harness asked to change; the row
- # schema is codeverse3d/addons/dataset/refine.RefineTransition and
- # INTERFACES has the call signatures. Training formats live
- # in finetune/llamafactory/, not here.
+ # one row per round the harness asked to change (addons/dataset/refine.RefineTransition);
+ # training formats live in finetune/llamafactory/, not here
3dcode flywheel caption <slug> [--model …] [--out caps/] # --out = side-car mode, run untouched
python -m codeverse3d.addons.calibration runs/<slug> [runs/<slug2> …] --model gemini:gemini-3.1-pro-preview --n 3 --out out/
# re-judges recorded rounds; writes calibration_<model>.md/.json (never touches runs/)
```
-**Do not run the offline suite while a battery is running.** The suite runs thousands of tests
-on 24 cores under xdist; a battery holds Blender, a browser pool and several agent sessions.
-Twice on 2026-09-04/05 that produced 11 and 21 spurious failures that vanished on a clean
-re-run (`tests/scene_runtime/lib/*` first, since those hold the renderer longest). A red
-suite during a battery is **not evidence until it reproduces on a quiet machine** — re-run
-it there before pushing, and if the same tests are red again, it is real. The mechanism is
-the one the next paragraph describes: `tests/scene_runtime/lib/*` reach the battery's
-browser daemon through a shared `C3D_CACHE_DIR`, so giving the suite its own cache dir may
-let the two coexist.
-
-The same holds for a box loaded by OTHER work. On 2026-09-05, with 12 `proseg` processes
-holding 528 GB, swap full and all eight GPUs at ~100 %, the offline suite failed 12, then
-44, then 17 tests in three runs at `-n 12 / 6 / 4`, every one of them a browser test
-reporting `Session closed` or `Target closed`; `tests/scene_runtime` alone at `-n 4` with
-its own cache dir passed 787/787. Check `uptime` and `free -g` before believing a red
-browser test. One test is flaky by construction under CPU contention and is NOT to be
-"fixed" by weakening it: `test_studio_render_is_reproducible_and_stamps_the_rig_version`
-compares two renders byte for byte, and SwiftShader is not bit-reproducible when the box
-is busy — it failed 2 runs in 3 on an unmodified tree at load 129. A second one behaves
-the same way: `test_example_scene_passes_frame_gate_and_judge_subset` asserts that a
-frame's content / ground / sky coverage fractions sum to 1 +- 0.02, and at `-n 4` under
-load ~100 it fails on `content 0.644 + ground 0.000 + sky 0.549 = 1.193`. An interleaved
-A/B — six runs each, alternating so both arms see the same load — gave **5/6 failures on
-the unmodified tree and 4/6 with the branch's changes**, i.e. the box, not the code. What
-produces a ground fraction of exactly zero on a scene that has a ground is an open
-question; it needs an idle machine to look at, not a guess. A third is a plain wall-clock
-assertion: `test_cabinet_door_end_to_end_then_broken` requires the URDF build to finish in under 30 s
-and measured 38 970 ms at load ~100 with `ok=True` — the build succeeded, the box was
-busy. All three are the same story, and none of them is to be "fixed" by loosening what
-it asserts.
-
-**Two arms at once still want separate `C3D_CACHE_DIR`, though the browser no longer
-depends on it.** Until 2026-09-05 the daemon advertised its endpoint at
-`CACHE_DIR/browser_<backend>.json`, a newer daemon superseded an older one, and two
-worktrees sharing a cache ended up on ONE browser: the arm that did not launch it
-rendered through a server rooted in the other tree, its GLB was outside that root, and
-`render_glb` returned "produced no result" — on one side only, looking like random
-flakiness (2026-09-04). The endpoint, its lock and its failure file now carry a digest of
-the `runtime_js` that spawned the daemon, so two trees keep separate browsers inside one
-cache dir and neither can retire the other's. Give each arm its own cache dir anyway: the
-render cache separates with it, which an A/B wants.
-
-Also halve each arm's `--parallel`: two arms at 3 workers is six concurrent renders, and a
-round with no renders skips the judge, so the loop stops at `judge_unavailable` and the
-cell is finished with no score (`run_bench` will not re-run it: the row exists). Redo the
-scoreless cells afterwards — delete the row from `results.jsonl` and the run directory,
-then `python -m bench.run_bench <battery> --id <prompt>`.
-
-A refine session that dies on the VENDOR's usage limit ("You've hit your usage limit … try again at
-Sep 14th", `RESOURCE_EXHAUSTED`, `insufficient_quota`) stops the run at `agent_quota`: every round
-so far is kept and picked from as usual, the record says the agent's budget ended, not the code's
-improvement (cmp8, 2026-09-09, filed three such runs as `plateau` before this), and `3dcode resume`
-continues it once the limit resets.
-**A cell can also lose its renders to the box rather than to itself.** When the machine
-runs out of memory Chrome reaps the render tab and the driver reports
-`Attempted to use detached Frame '<id>'`: the scene built, every gate ran, and the judge
-was skipped for want of pixels — three of six cells of `scenes_v1` on 2026-09-05, $6.75 of
-generation already paid for. The scene drivers now retry once on a browser of their own
-(`spatial/render_scene.run_scene_script`), and `eval/bench/scene_stats.py` reports such rounds
-in a `lost to the box` column instead of counting them as gate failures. A battery whose
-report shows that column non-zero has to be re-run for those cells before it is read as a
-statement about the generator.
-
-**Anything launched with `3dcode` from a worktree runs the MAIN checkout's code.** `3dcode`
-is a console script, so `sys.path[0]` is the venv's `bin`, never the cwd, and `import
-codeverse3d` finds the editable install. `--out` IS relative to the cwd, so the OUTPUT lands
-in the worktree while the CODE that produced it is the main tree's — an arm that looks like it
-is testing your branch and is testing `main` (measured 2026-09-05: the first `scenes_v1`
-battery, launched with `3dcode bench run` from `local/worktrees/integrate`, ran entirely on the
-main checkout). Batteries no longer have this problem: `python -m bench.run_bench` (the
-launcher since 2026-09-22) bootstraps `sys.path` to its own tree's `harness/` like every bench
-script (`eval/tests/test_worktree_import.py`). For `3dcode make` from a worktree, export
-`PYTHONPATH=<worktree>/harness` before the command, and have an arm script REFUSE TO RUN when
-`codeverse3d.__file__` and `runtime_js_dir()` are not the tree you meant —
-`local/scripts/run_scene_fixed.sh` is the pattern, and it also asserts that the specific fixes
-the arm exists to measure are present.
-
-**A new worktree needs `runtime_js/node_modules` before it can run a battery.** Without it
-`render_glb` dies on every round, the judge is skipped for want of renders, and the cells
-came back `status=plateau` (today: `judge_unavailable`) with `score=None` — an arm that reads as healthy and measures
-nothing (2026-09-04, the mimic-off arm). `npm ci` in `runtime_js/`, or COPY the
-directory from a worktree that has it (the `package.json` is the same file). The row now (a symlink gave two 404s on every render of one worktree on 2026-09-07 — `serve.cjs` refuses a real path outside its root — while another probe served through one; copy and be sure)
-says `no verdict in any of N round(s)` when this happens.
-
-A run that crashed outside its own handling leaves `record.json` with `status=failed`;
-`3dcode resume` retries from the last completed stage/round (cached plan/skeleton/scene
-stages are reused — this also recovers from Gemini 503 storms). Ctrl-C and `kill <pid>` (SIGTERM)
-are safe: `make` / `resume` kill every agent / build process group the run has open — worker
-threads' included — refuse new ones, record the stop, and end within `proc.STOP_GRACE_S` (30 s) even
-if a worker is inside a long model call. Before 2026-10-13 a SIGTERM left the agy session running
-and billing.
+A run that crashed outside its own handling leaves `record.json` with `status=failed`; `3dcode
+resume` retries from the last completed stage/round (cached plan/skeleton/scene stages are
+reused — this also recovers from a provider outage). A refine session that dies on the
+VENDOR's usage limit stops the run at `agent_quota`: every round so far is kept and picked from,
+and `3dcode resume` continues it once the limit resets. Ctrl-C and `kill <pid>` (SIGTERM) are
+safe: `make` / `resume` kill every agent / build process group the run has open, record the
+stop, and end within `proc.STOP_GRACE_S` (30 s). Kill by PID, never by pattern: a
+`pkill -f "3dcode make"` takes every other run on the box with it.
+
+Two things to keep apart on one machine: run the offline test suite and a battery at different
+times (both hold Blender, a browser pool and most cores; a red browser test under load is not
+evidence until it reproduces on a quiet box), and give two concurrent batteries separate
+`C3D_CACHE_DIR`s and half the `--parallel` each. A worktree needs its own
+`runtime_js/node_modules` (copy, do not symlink: `serve.cjs` refuses a real path outside its
+root) and `PYTHONPATH=<worktree>/harness` before `3dcode make`, because the console script
+imports the editable install, not the cwd.
## 6. Benchmarks
```bash
-cd ../eval # the battery launcher is the evaluation's (`3dcode bench` until 2026-09-22)
+cd ../eval # the battery launcher is the evaluation's
python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator single-shot:gemini:gemini-3.8-flash \
--judge gemini:gemini-3.1-pro-preview --rounds 2 --parallel 4 [--tier easy] [--id furn_easy_stool] [--limit 6] [--out bench/out/x]
python -m bench.report bench/out/static_objects_v1 # report.md + self-contained report.html (gallery)
@@ -303,153 +188,70 @@ cd ../harness
python ../eval/bench/compare_backends.py --prompts ../eval/bench/prompts/compare_v1.yaml \
--arms harness:agy:gemini-4-argon,oneshot:claude-code --judge gemini:gemini-3.1-pro-preview --out ../eval/bench/out/compare_v1
```
-Results stream to `results.jsonl` (resumable). The batteries, the protocol and judge
-calibration: `eval/docs/EVAL.md` (§2 lists the batteries).
-
-`compare_backends` **preflights every model it needs** (one ~20 s probe each) and
-refuses to start when one is not serving — a dead provider does not fail fast on its
-own, it lets each cell burn its full retry budget first. `--wait-for-provider 60`
-parks until it recovers instead; `--no-preflight` skips the check. Cells that a
-provider outage kills anyway are recorded `infra_failed`, excluded from every rate,
-and re-run with `--redo-status infra_failed` (see `eval/docs/EVAL.md` §7).
-
-### 6.v Templates are read at render time — a new required variable breaks live workers like a moved name
-
-Measured 2026-08-26 13:45: the fewer-turns landing added `{{ turn_discipline }}` to four static
-templates; the four h2h drivers started 50 minutes earlier still ran the old python (no such
-context key) but rendered the NEW template from disk → `UndefinedError: 'turn_discipline' is
-undefined`, four prompts recorded `error` at 0 min. Rule: every new template variable is
-guarded `{% if name is defined and name %}` for at least one wave, and the "Landing source
-changes while a wave is running" rule covers `codeverse3d/prompts/**` as well as moved names.
-### 6.u `run_bench --redo-status` starts the redo fresh (since c828637)
-
-Before it, a redo resumed the old workspace — old `spec.json` (the old `max_minutes`) and the
-old clock — so a `budget` row redone with `--max-minutes 120` was over budget before its first
-round (clock_q4, lighthouse_1: `budget`, 0 rounds, "60.3 / 76.7 min elapsed"). Now the old
-tree is archived as `runs/<id>.attempt<N>` and the prompt runs from scratch with the new
-options, the way `ab_plan` has done since the skills wave.
-
-It is also the ONLY way: `run_bench --no-resume` was deleted 2026-08-30. It dropped the
-recorded rows and then resumed the workspace anyway — `resume = ws.exists()` never read the
-flag — so a "fresh" rerun carried the old spec, rounds, spend and clock and appended a second
-results row for the same tree. `compare_backends --no-resume` kept its flag (it is documented
-and has three readers) and now archives the harness cell's `run/` before re-running it.
-
-### 6.w One driver per out dir — a second `run_bench` re-runs what the first is still running
-
-Measured 2026-08-26 (refs_v1_graphics): a redo driver (`--redo-status budget`) started while the
-original driver was still working the same battery resumed a prompt the first driver had in
-flight, re-ran its last round in the same workspace and rewrote `rounds/r02.json` (0.600 →
-0.944 for the same sheet: judge/acceptance variance, not a new picture) and appended a second
-`results.jsonl` row. `run_battery` decides what to run from `results.jsonl`, and a prompt with no
-row yet is fair game to both. Rule: never start a second `python -m bench.run_bench` on an out dir
-with a live driver; wait for the driver to exit (exact pid, `kill -0`), then redo once with
-`--redo-status infra_failed,error,budget --max-minutes 120`. `run_bench` grew `--max-minutes`
-the same day so the storm budget no longer needs `ab_plan`.
-
-### 6.x Size `--max-minutes` to the weather
-
-`--max-minutes 60` is the right ceiling on a healthy provider. Under a 503 storm every model
-call waits through the retry budget first, an agent session spends its wall clock on 15–23
-turns, and a hard prompt burns the whole hour without one judged round — measured 2026-08-26 on
-`fancy_v1`: the first six pairs ended `budget` with `judge.done = 0`. When
-`codeverse3d.models.health.probe()` shows the generator below the 0.75 bar, launch (or redo) with
-`--max-minutes 120 --wait-for-provider 60`, and redo the storm's rows rather than reading them:
-`--redo-status error,infra_failed,budget` (add `build_failed` only when a harness defect, not the
-model, produced the zero — check `cell.json`'s `error`). The rows' `minutes` stay comparable across
-weather: they leave the provider's errors out (docs/COST.md §31); the ceiling does not.
+Results stream to `results.jsonl` (resumable). The batteries, the protocol and judge
+calibration: `eval/docs/EVAL.md`. `compare_backends` preflights every model it needs and
+refuses to start when one is not serving (`--wait-for-provider 60` parks until it recovers,
+`--no-preflight` skips the check); cells a provider outage kills are recorded `infra_failed`,
+excluded from every rate, and re-run with `--redo-status infra_failed`. `run_bench
+--redo-status` starts the redo fresh (the old tree is archived as `runs/<id>.attempt<N>`). Never
+start a second `run_bench` on an out dir with a live driver: both would run the same prompt.
+Under a provider storm, launch with `--max-minutes 120 --wait-for-provider 60` and redo the
+storm's rows (`--redo-status error,infra_failed,budget`) rather than reading them.
## 7. Extending (plugin paths)
-* **New language**: enum in `contracts/common.py::Language` (+ `TRACK_LANGUAGES`,
- `ENTRY_FILE`, `LANGUAGE_LABEL`), frame in `conventions.LANGUAGE_FRAME`;
- `languages/<lang>/__init__.py` (one merged module per language) implementing
- `LanguageRuntime` — its file layout included: subclass `languages/base.RuntimeLayout`
- (entry + `extra_files`, and `part_file` for a one-file-per-part language) or answer
- `expected_files(plan)` / `files_for(plan, target)` yourself, as the scene runtime does; the
- tracks never restate it. A python-executed build wrapper goes beside the others in
+* **New language**: enum in `contracts/common.py::Language` (+ `TRACK_LANGUAGES`, `ENTRY_FILE`,
+ `LANGUAGE_LABEL`), frame in `conventions.LANGUAGE_FRAME`; `languages/<lang>/__init__.py`
+ implementing `LanguageRuntime` — its file layout included: subclass
+ `languages/base.RuntimeLayout` (entry + `extra_files`, and `part_file` for a one-file-per-part
+ language) or answer `expected_files(plan)` / `files_for(plan, target)` yourself; the tracks
+ never restate it. A python-executed build wrapper goes beside the others in
`languages/wrappers/` (import `_wrapper_common`; run it with `_common.run_wrapper_build`, or
- read its report with `_common.compose_build_result`, which publishes the final `build.json`); branch in
- `languages/base.py::get_runtime`; `prompts/<lang>/{system,contract}.md` (found by
- `prompts/catalog.language_prompt`; no cookbook — the prompts state requirements, never
- templates (D106 / D107): no code block over ~12 lines, numbers only where a gate or the judge
- measures them, and contract.md carries ONE executable interface example that
- `tests/prompts/test_snippets_run.py` runs through the real runtime).
-* **Changing what a model is shown** (a prompt file or template variable, a contract, a skill,
- a rubric's text, a tool description, anything a session or a judge reads):
- `tests/prompts/test_manifest.py` pins every payload of offline scenarios across the four tracks
- and seven languages — agent sessions, chat calls (planner, single-shot), each judge's input and
- the request the real `VlmJudge` builds from it, the materialised workspace files, the routed
- skills, the MCP tool lists — and every stage's cache key. A refactor leaves it byte-identical;
- a change a model is meant to see re-blesses it in the same commit, saying why:
- `python -m tests.prompts.manifest --bless` (`--dump DIR` writes every payload, to `diff -r` two
- trees). What it cannot drive is listed in `tests/prompts/manifest.py`. A new prompt file must
- render through the loader (`tests/prompts/test_files.py`); a new language or track adds its
- scenario to `SCENARIOS`.
-* **A per-model variant** (D105): `codeverse3d/prompts/variants/<name>/variant.toml` (`[variant]`
- name = the directory name, version, generators, description; optional `[knobs]` — `skills_max`,
- `skills_only`, `scene_lib` (D113) — applied as defaults, a user-stated field wins) beside the prompt files that
- shadow the base ones by relative path (a template there may `include` a base file), and
- `codeverse3d/skills/variants/<name>/` for bundles that shadow base bundles by name, their
- `_claims/`, and `routes.toml` (`[[boost]]` skill + delta, `[[disable]]` rule, `[[route]]` extra
- typed rows with fresh ids; parsed with `tomllib`, a typing error is logged and the base table
- routes). Nothing else changes: `prompts.load_text` / `render` / `catalog.language_text` and
- `skills.all_skills` resolve through the active variant, `BaseTrack.run` activates the spec's
- frozen name (else the process switch), the record carries `extra.variant` {name, version, hash}
- + `prompt_hashes.variant`, and `plan_stage_key` names the variant only when one is set. An
- overlay starts EMPTY (the shipped `argon` is) so its first iteration measures the base; the
- manifest gets one scenario per variant (`scene.scene_threejs.agent.variant_argon`). Selection is
- explicit — `--variant`, `C3D_VARIANT`, `C3D_VARIANTS` — never a pattern over the model id.
-* **New spatial tool**: pydantic args + `@tool("name", Args, "…", tracks=(…),
- languages=(…), cost_hint=…)` in `spatial/tools.py`; available to tracks, MCP and prompt cards at once.
- Update `tests/spatial_tools` EXPECTED_TOOLS.
-* **New rubric**: `judges/rubrics/<name>.yaml` with `pass_threshold`,
- `criteria[{id, weight, floor, title, description, anchors, kind}]`,
- `caps[{id, cap, when: gate|acceptance|console|missing_views, gate, severity, kinds}]`,
- `defects[{id, text, penalty, cap}]`. Tracks pick rubrics in `tracks/*.py`;
- `3dcode judge` maps track → rubric in `cli/_judge.py::rubric_for`.
-* **New backend**: ChatModel → `models/<provider>.py` + registry + prices;
- CodingAgent → `agents/backends.py` using `cli_common` + registry + `materialize.py`.
-* **New track**: subclass `tracks/lifecycle.py::BaseTrack` (its pre-round graph `stages`, a tuple of
- `StageNode`s — the default is skeleton → materialize, and a new track adds its line to
- `docs/ARCHITECTURE.md` §7.1; hooks: `make_pipeline`, `baseline_tasks`, `refine_tasks`; `system_prompt`
- defaults to `language_system_prompt(ctx.language, tools=not ctx.single_shot)` and
- `refine_file_for_target` to the runtime's `files_for` — override only for
- role-specific prompts), a `RoundPipeline`,
- plan model in `contracts/plan.py`, `.j2` prompts, the planner's per-track rows in
- `tracks/planner.py` (template, example, temperature, acceptance), branch in
- `tracks/__init__.py` (`get_track` forwards `**options` to constructors).
- `tracks/graphics.py` is the template for a track with no GLB.
+ read its report with `_common.compose_build_result`); branch in `languages/base.py::get_runtime`;
+ `prompts/<lang>/{system,contract}.md` (found by `prompts/catalog.language_prompt`; no cookbook
+ — the prompts state requirements, never templates: no code block over ~12 lines, numbers only
+ where a gate or the judge measures them, and contract.md carries ONE executable interface
+ example that `tests/prompts/test_snippets_run.py` runs through the real runtime).
+* **Changing what a model is shown** (a prompt file or template variable, a contract, a skill, a
+ rubric's text, a tool description, anything a session or a judge reads):
+ `tests/prompts/test_manifest.py` pins every payload of offline scenarios across the four
+ tracks and every language — agent sessions, chat calls, each judge's input, the materialised
+ workspace files, the routed skills, the MCP tool lists — and every stage's cache key. A
+ refactor leaves it byte-identical; a change a model is meant to see re-blesses it in the same
+ commit, saying why: `python -m tests.prompts.manifest --bless` (`--dump DIR` writes every
+ payload, to `diff -r` two trees). A new prompt file must render through the loader
+ (`tests/prompts/test_files.py`); a new language or track adds its scenario to `SCENARIOS`.
+ Every new template variable is guarded `{% if name is defined and name %}` for at least one
+ wave: templates are read at render time, so a live worker on old python renders the new file.
+* **A per-model variant**: `codeverse3d/prompts/variants/<name>/variant.toml` (`[variant]` name =
+ the directory name, version, generators, description; optional `[knobs]` — `skills_max`,
+ `skills_only`, `scene_lib` — applied as defaults, a user-stated field wins) beside the prompt
+ files that shadow the base ones by relative path (a template there may `include` a base
+ file), and `codeverse3d/skills/variants/<name>/` for bundles that shadow base bundles by name,
+ their `_claims/`, and `routes.toml` (`[[boost]]` skill + delta, `[[disable]]` rule, `[[route]]`
+ extra typed rows with fresh ids). Nothing else changes: `prompts.load_text` / `render` /
+ `catalog.language_text` and `skills.all_skills` resolve through the active variant, the record
+ carries `extra.variant` {name, version, hash} + `prompt_hashes.variant`. An overlay starts
+ EMPTY (the shipped `argon` is) so its first iteration measures the base; the manifest gets one
+ scenario per variant. Selection is explicit — `--variant`, `C3D_VARIANT`, `C3D_VARIANTS` —
+ never a pattern over the model id.
+* **New spatial tool**: pydantic args + `@tool("name", Args, "…", tracks=(…), languages=(…),
+ cost_hint=…)` in `spatial/tools.py`; available to tracks, MCP and prompt cards at once. Update
+ `tests/spatial_tools` EXPECTED_TOOLS.
+* **New rubric**: `judges/rubrics/<name>.yaml` with `pass_threshold`, `criteria[{id, weight,
+ floor, title, description, anchors, kind}]`, `caps[{id, cap, when:
+ gate|acceptance|console|missing_views, gate, severity, kinds}]`, `defects[{id, text, penalty,
+ cap}]`. Tracks pick rubrics in `tracks/*.py`; `3dcode judge` maps track → rubric in
+ `cli/_judge.py::rubric_for`.
+* **New backend**: ChatModel → `models/<provider>.py` + registry + prices; CodingAgent →
+ `agents/backends.py` using `cli_common` + registry + `materialize.py`.
+* **New track**: subclass `tracks/lifecycle.py::BaseTrack` (its pre-round graph `stages`, a
+ tuple of `StageNode`s — the default is skeleton → materialize, and a new track adds its line to
+ `docs/ARCHITECTURE.md` §7.1; hooks: `make_pipeline`, `baseline_tasks`, `refine_tasks`;
+ `system_prompt` defaults to `language_system_prompt(ctx.language, tools=not ctx.single_shot)`
+ and `refine_file_for_target` to the runtime's `files_for`), a `RoundPipeline`, plan model in
+ `contracts/plan.py`, `.j2` prompts, the planner's per-track rows in `tracks/planner.py`,
+ branch in `tracks/__init__.py`. `tracks/graphics.py` is the template for a track with no GLB.
* **New bench battery**: `eval/bench/prompts/<name>.yaml` with `name, track, language,
prompts[{id, tier, category, prompt, must_have, dimensions_m}]`.
-
-
-## Landing source changes while a wave is running
-
-Workers (`3dcode make`, `ab_plan.py cell`) are long-lived python processes that import
-`codeverse3d/` **lazily**: a module already in `sys.modules` stays as it was at spawn time, a
-module first touched later comes from the tree as it is *then*. Two measured failures on
-2026-08-26:
-
-* a patch script that edited one file and aborted on the next left a two-minute window in which
- `static_object.py` imported a name `prompting.py` did not have yet — a driver died on it;
-* a clean, fully tested refactor (`proc.read_json_or_none` replacing eight copies) landed on
- main at 02:47 while cells spawned at 01:56 were still generating; at eval time they lazily
- imported a rewritten module which asked their *old, cached* `proc` for the new name —
- `ImportError`, 75 minutes of generation per cell lost, recorded `status=error`.
-
-Rules:
-
-1. Multi-file patches validate every anchor first and write only after all pass.
-2. **Do not land cross-module refactors on main under a live wave** — moved symbols, new shared
- helpers, renamed imports. Keep them on worktree branches and cherry-pick between waves.
- Additive changes and dead-code deletions are safe; a moved name is not.
-3. After landing anything, check every driver's `results.jsonl` for `ImportError` rows and redo
- them from a **fresh** driver with `--redo-status error` (the old driver's own modules are
- stale too).
-4. You do not need to count harness processes to protect the provider: the in-flight slots are
- machine-wide (`docs/COST.md` §23; `3dcode doctor` prints how many are busy). If you list
- processes anyway, never with `pgrep | grep` (it counts its own shell — measured: 3 phantoms
- on an idle box); kill by PID, never by pattern (13 unrelated runs died to one
- `pkill -f "3dcode make"`).
diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.md
index 15b01685..a60e6493 100644
--- a/harness/docs/SKILLS.md
+++ b/harness/docs/SKILLS.md
@@ -4,178 +4,104 @@ A **skill** is a task-scoped rule sheet the harness attaches to a coding session
from the track, the language, the round kind, the plan and **the previous round's gate
findings**. Nobody writes `skills: [...]`.
-It is not a recipe library. No language ships a cookbook (D106 for the scene track, D107 for the
-rest; owner, 2026-10-15): interface and language facts live in `contract.md` / `system.md` (one
-executable example each), and a skill is a sheet of measured requirements with a few SHORT
-optional practices — real API names, numbers only where a gate or the judge measures them, no
-code block over ~12 lines. The 60 iteration-0 argon scenes were the inlined chapters executed
-verbatim; that is what a chapter buys.
+It is not a recipe library. No language ships a cookbook: interface and language facts live in
+`contract.md` / `system.md` (one executable example each), and a skill is a sheet of measured
+requirements with a few SHORT optional practices — real API names, numbers only where a gate or
+the judge measures them, no code block over ~12 lines.
-`SKILL.md` is an open standard ([agentskills.io](https://agentskills.io/specification), Dec 2025),
-so the format is not ours to bend — and it is why the bundles reach a session only through its
-vendor's native skill loader: claude-code, codex and agy discover them themselves (§7). The one
-backend that needed harness-side injection, the in-process `api-agent`, read 0 of 5 routed
-bundles and was deleted 2026-08-28.
+`SKILL.md` is an open standard ([agentskills.io](https://agentskills.io/specification)), so the
+format is not ours to bend — and it is why the bundles reach a session only through its vendor's
+native skill loader: claude-code, codex and agy discover them themselves.
-`C3D_SKILLS` is **on by default since 2026-09-22** (D81); `C3D_SKILLS=0` is the off switch and an
-A/B's no-skills arm. Knobs: `C3D_SKILLS_MAX` (5 bundles a session), `C3D_SKILLS_UNVERIFIED`
-(the six `inherited-unverified` bundles, on), `C3D_SKILLS_ONLY` (restrict the library before
-routing), `C3D_SKILLS_DIR` (another library).
+`C3D_SKILLS` is **on by default**; `C3D_SKILLS=0` is the off switch and an A/B's no-skills arm.
+Knobs: `C3D_SKILLS_MAX` (5 bundles a session), `C3D_SKILLS_UNVERIFIED` (the
+`inherited-unverified` bundles, on), `C3D_SKILLS_ONLY` (restrict the library before routing),
+`C3D_SKILLS_DIR` (another library).
----
-
-## 0. How the library is managed
+## 1. How the library is managed
**One library, one policy, thin adapters.** The bundles under `codeverse3d/skills/<name>/` are
plain `SKILL.md` directories that know nothing about any backend — `cp -r` one into
`~/.claude/skills/` and it works without the harness. `registry.py` picks the set from typed
inputs. The one thing that differs between coding agents is the discovery root, in one file,
-`skills/prompting.py` (`_BACKEND_ROOTS`, read by `skill_path`; `tests/skills/test_delivery.py`
-fails if per-backend knowledge leaks anywhere else):
-
-| backend | discovery root |
-|---|---|
-| `claude-code` | `.claude/skills` |
-| `codex`, `agy` | `.agents/skills` |
-
-Read out of the shipped binaries (2026-09-22) and re-run live on 2026-11-03 (§7):
-
-| CLI | roots (workspace · user) | what must hold | what the model is shown | activation, as its own record logs it |
-|---|---|---|---|---|
-| `claude-code` 2.1.317 | `.claude/skills` · `~/.claude/skills` (+ synced skills, plugins) | `Skill` in `--allowedTools`; never `--disable-slash-commands` ("Disable all skills") | a name + description list; the stream-json `init` event's `skills` | `Skill {"skill": name}`, then `Read` — or a shell `cat` — of `references/` |
-| `codex` 0.166.0 | `.agents/skills` of the working root · `$CODEX_HOME/skills` (+ `.system`) | nothing: listed from an untrusted `/tmp` workspace too (`codex debug prompt-input`) | a `## Skills` section with an aliased path `r1/<name>/SKILL.md` | a shell `sed`/`cat` of `SKILL.md` (an `exec --json` `command_execution` item) |
-| `agy` 1.4.12 | `.agents/skills` under the repo root · a customization root under `~/.gemini/` | nothing; `--disable-slash-commands` only stops `/name` expansion of the prompt | a skills section of its system prompt, paths included | `read_file` of `SKILL.md` (`view_file` before 1.4) — a step in its conversation database |
-
-(gemini-cli discovered them too, until its backend went in D103.)
-
-The harness writes the bundles under the discovery root and hands the agent no second index (the
-loader's own would list them twice) and no tool; the body file gets one MANDATORY sentence.
-
-**A session sees nothing but the routed bundles** (2026-09-22). Every CLI lists skills of its
-own; each is switched off with the CLI's documented knob (`agents/backends.py`), checked at zero
-cost against the real binaries with a local fake API:
-
-| CLI | listed besides the routed bundles | switch | left |
-|---|---|---|---|
-| `claude-code` | 26: bundled (`update-config`, `code-review`, `loop`, …) and account-synced (`deep-research`, `anthropic-skills:*`, …) | `--setting-sources project` + `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1` + `--settings {"skillOverrides": {"design": "off", "doctor": "off"}}` | nothing — and the owner's `~/.claude/settings.json` (effortLevel, hooks, env) no longer reaches a session |
-| `codex` | 5 `.system` (imagegen, openai-docs, plugin-creator, skill-creator, skill-installer) | `-c skills.bundled.enabled=false` | any user root (`~/.codex/skills`, `~/.agents/skills`): no switch; none here |
-| `agy` | 5 built-ins (agy-customizations, antigravity-guide, generative_ui, migrate-workflows, permissioned-github) | none per session | all 5 |
-
-**Why only native loaders.** Measured 2026-08-25, same library, workspace and task: codex,
-claude-code and agy each read 5 of 5 routed bundles unprompted; `api-agent` read 0 of 5 while
-making 52 `read_file` calls — the bundles sat in hidden directories its `list_files` skipped, and
-the index was prose in a 2.3 kB system prompt. Prose is not an affordance.
-
-## 1. The model: progressive disclosure, and why it is also the measurement
-
-| tier | what the agent sees | when | our cost |
-|---|---|---|---|
-| 1 · index | `name` + `description`, listed by the CLI's own loader | every turn | 41 tokens (our one mandate sentence) |
-| 2 · body | the whole `SKILL.md` | on activation | 851–2,498 tokens, once |
-| 3 · depth | `references/*.md` | when the agent chooses to go deeper | as read |
-
-The read probe (`skills/telemetry.probe_reads`) reads the CLI's own record first (§4): a bundle
-is *surfaced* when a call activated it or named its `SKILL.md`, *deep* when a call named a file
-under its `references/` — `SkillsUsage.evidence == "transcript"`. The atime probe is the
-fallback for a session that left no trace: `materialize_skills` writes every file with
-`atime == mtime` on an ext4 `relatime` root, so the first read afterwards bumps `atime`
-(`SKILL.md` → surfaced, `references/*.md` → deep; a bundle with no `references/` reports
-`deep_measurable: false` rather than scoring 0).
+`skills/prompting.py` (`_BACKEND_ROOTS`; `tests/skills/test_delivery.py` fails if per-backend
+knowledge leaks anywhere else):
-**Why atime can only be a fallback** — measured 2026-08-25, both reproduced:
-
-1. `Workspace.changed_files` runs `git add -A -N` + `git diff --numstat` after every session,
- and git reads each untracked file to diff it — every bundle flips to "read" with no agent
- involved (`test_git_diff_alone_trips_the_control`).
-2. Every CLI opened `SKILL.md` **and** `references/` of a bundle whose description did not match
- the task, under "do not read any files, do not activate any skill" (§7).
+| backend | discovery root | how the CLI shows and activates a bundle |
+|---|---|---|
+| `claude-code` | `.claude/skills` | a name + description list (the stream-json `init` event's `skills`); `Skill {"skill": name}`, then `Read` of `references/` |
+| `codex` | `.agents/skills` | a `## Skills` section of the prompt; a shell `sed`/`cat` of `SKILL.md` |
+| `agy` | `.agents/skills` | a skills section of its system prompt; `read_file` of `SKILL.md` |
-So `materialize.write_control` puts one **never-routed, never-indexed** bundle beside the real
-ones. Nothing should open it; when it comes back opened, `SkillsUsage.control_read` is set, the
-session's deep-read rate is **`None`** — not 100 %, not 0 — and `3dcode skills report` says how
-many sessions it dropped. That is the difference between a metric and a number that would have
-read 100 % forever. One job stays with atime under transcript evidence: a reference opened by a
-call the trace cannot parse (claude-code's `cd … && cat` loop, 2026-11-03) counts as deep while
-the control's `references/` are untouched — nothing scanned references/ wholesale (D115).
+The harness writes the bundles under the discovery root and hands the agent no second index
+and no tool; the body file gets one MANDATORY sentence.
----
+**A session sees nothing but the routed bundles.** Every CLI lists skills of its own; each is
+switched off with the CLI's documented knob (`agents/backends.py`): claude-code with
+`--setting-sources project` + `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1` + `--settings
+{"skillOverrides": …}` (so the user's `~/.claude/settings.json` does not reach a session
+either), codex with `-c skills.bundled.enabled=false` (a user root such as `~/.codex/skills` has
+no switch), agy not at all (its 5 built-ins are always listed).
## 2. The library
-**Twenty bundles** (2026-11-03). `lines` is `SKILL.md` as shipped, `tokens` the body; the caps
-are 350 body lines and 2,500 tokens.
-
-| skill | track | language | evidence | lines | tokens | routes |
-|---|---|---|---|---|---|---|
-| `c3d-part-contact` | object tracks | any | measured | 138 | 1,728 | R1, R2 |
-| `c3d-bbox-contract` | object + scene | any | measured | 90 | 1,108 | R3, R4 |
-| `c3d-repeats-and-mirrors` | object tracks | any | measured | 130 | 1,545 | R6, R7 |
-| `c3d-blender-forms` | any | blender, urdf_blender | measured | 128 | 2,195 | R8, R9 |
-| `c3d-urdf-joints` | articulated_object | urdf_blender | measured | 171 | 2,172 | R12, R13 |
-| `c3d-scene-composition` | scene | scene_threejs | mixed | 151 | 2,150 | R14, R15, R34 |
-| `c3d-scene-lighting` | scene | scene_threejs | mixed | 130 | 1,748 | R16, R17 |
-| `c3d-scene-motion` | scene | scene_threejs | mixed | 200 | 2,473 | R18, R19 |
-| `c3d-threejs-shader-traps` | scene (+ static on a preflight finding) | threejs both | mixed | 128 | 1,722 | R20, R21 |
-| `c3d-glsl-craft` | graphics | glsl_shader | mixed | 124 | 1,613 | R22, R24-glsl |
-| `c3d-opengl-pipeline` | graphics | opengl_python | mixed | 121 | 1,696 | R23, R24-opengl |
-| `c3d-cadquery-forms` | any | cadquery | inherited-unverified | 107 | 1,731 | R10 |
-| `c3d-threejs-forms` | static_object | threejs | inherited-unverified | 143 | 2,151 | R11 |
-| `c3d-scene-atmosphere` | scene | scene_threejs | inherited-unverified | 86 | 1,061 | R25 |
-| `c3d-scene-water` | scene | scene_threejs | inherited-unverified | 83 | 1,045 | R26 |
-| `c3d-scene-night` | scene | scene_threejs | inherited-unverified | 78 | 851 | R27 |
-| `c3d-scene-materials` | scene | scene_threejs | inherited-unverified | 117 | 1,484 | R28 |
-| `c3d-bpy-scene-placement` | scene | scene_blender | mixed | 148 | 2,498 | R29, R30 |
-| `c3d-bpy-scene-lighting` | scene | scene_blender | mixed | 139 | 2,356 | R31, R32 |
-| `c3d-bpy-scene-materials` | scene | scene_blender | mixed | 128 | 2,075 | R33 |
+Twenty bundles; the caps are 350 body lines and 2,500 tokens. `evidence` is provenance — where
+the prose came from — not a measured effect.
-All twenty route by default (the `c3d-bpy-scene-*` three since 2026-10-14, D105), capped at 5 a
-session. None has a measured effect: they route because the owner made skills part of the
-product and every backend loads them natively, not because an A/B promoted them (§6). To measure
-a subset, `C3D_SKILLS_ONLY` restricts the library before routing, against a `C3D_SKILLS=0` arm.
-
-**Retired:** `c3d-form-manifest` (2026-08-25) — opened 2 of 19 times (11 %, CI [3 %, 31 %]), the
-one bundle whose read-rate interval excluded every other's, at ~1,917 tokens a listing. Its route
-id **R5** is never reused: a run record refers to a routing decision by id
-(`tests/skills/test_registry.py::RETIRED_RULES`). The text is in git history.
-
-**Two words kept apart.** `evidence` is provenance — where the prose came from; a `measured`
-bundle can have no measured effect, and five do. Every bundle also declares the ONE
-deterministic quantity it claims to move (`target_metric` / `target_direction` /
-`target_baseline` in its frontmatter and `addons/skill_targets.py`;
+| skill | track | language | evidence | routes |
+|---|---|---|---|---|
+| `c3d-part-contact` | object tracks | any | measured | R1, R2 |
+| `c3d-bbox-contract` | object + scene | any | measured | R3, R4 |
+| `c3d-repeats-and-mirrors` | object tracks | any | measured | R6, R7 |
+| `c3d-blender-forms` | any | blender, urdf_blender | measured | R8, R9 |
+| `c3d-urdf-joints` | articulated_object | urdf_blender | measured | R12, R13 |
+| `c3d-scene-composition` | scene | scene_threejs | mixed | R14, R15, R34 |
+| `c3d-scene-lighting` | scene | scene_threejs | mixed | R16, R17 |
+| `c3d-scene-motion` | scene | scene_threejs | mixed | R18, R19 |
+| `c3d-threejs-shader-traps` | scene (+ static on a preflight finding) | threejs both | mixed | R20, R21 |
+| `c3d-glsl-craft` | graphics | glsl_shader | mixed | R22, R24-glsl |
+| `c3d-opengl-pipeline` | graphics | opengl_python | mixed | R23, R24-opengl |
+| `c3d-cadquery-forms` | any | cadquery | inherited-unverified | R10 |
+| `c3d-threejs-forms` | static_object | threejs | inherited-unverified | R11 |
+| `c3d-scene-atmosphere` | scene | scene_threejs | inherited-unverified | R25 |
+| `c3d-scene-water` | scene | scene_threejs | inherited-unverified | R26 |
+| `c3d-scene-night` | scene | scene_threejs | inherited-unverified | R27 |
+| `c3d-scene-materials` | scene | scene_threejs | inherited-unverified | R28 |
+| `c3d-bpy-scene-placement` | scene | scene_blender | mixed | R29, R30 |
+| `c3d-bpy-scene-lighting` | scene | scene_blender | mixed | R31, R32 |
+| `c3d-bpy-scene-materials` | scene | scene_blender | mixed | R33 |
+
+All twenty route by default, capped at 5 a session. To measure a subset, `C3D_SKILLS_ONLY`
+restricts the library before routing, against a `C3D_SKILLS=0` arm. Route id **R5** is retired
+and never reused: a run record refers to a routing decision by id
+(`tests/skills/test_registry.py::RETIRED_RULES`).
+
+Every bundle also declares the ONE deterministic quantity it claims to move (`target_metric` /
+`target_direction` / `target_baseline` in its frontmatter and `addons/skill_targets.py`;
`python eval/bench/skill_targets.py eval/bench/out` prints them, per battery or paired across an
-A/B). `cadquery-forms` and `threejs-forms` stay `inherited-unverified` — routed, unranked —
-until their languages reach the 20 graded runs the rule requires (4 and 3 at the last count).
+A/B).
## 3. Routing
-`codeverse3d/skills/registry.py` holds the typed table (34 rows; ids R1–R34, R5 retired, R24
-split by language) and `finding_kind()`, which names a finding `<gate>/<data.kind>` — the kind
-the gate wrote, never its message; `select()` turns `(track, language, kind, plan signals,
-findings)` into a ranked, capped, reasoned set. Four laws, all tested:
+`codeverse3d/skills/registry.py` holds the typed table (ids R1–R34) and `finding_kind()`, which
+names a finding `<gate>/<data.kind>` — the kind the gate wrote, never its message; `select()`
+turns `(track, language, kind, plan signals, findings)` into a ranked, capped, reasoned set.
+Four laws, all tested:
1. **Gate findings outrank everything.** A row answering a finding sits at priority ≥ 90,
standing rows at ≤ 80: a repair round spends its budget on what broke — the input no CLI's
own loader can see, and the reason routing is in code.
2. **The cap is 5** (`C3D_SKILLS_MAX`); it cuts the low-priority tail, never the gate-fired head.
3. **Quiet kinds attach nothing on their own** — `asset`, `asset_fix`, `reference` are short,
- narrow sessions. A gate-fired row still reaches them (R13/R15/R17/R19/R21 are
- kind-agnostic, R2/R4/R7/R9 are not; both halves pinned in `test_router`).
-4. **Unknown input degrades to `[]`, never an exception** — a planner failure must not also
- take out the round's skills.
+ narrow sessions. A gate-fired row still reaches them.
+4. **Unknown input degrades to `[]`, never an exception** — a planner failure must not also take
+ out the round's skills.
-`test_routing_property.py` runs every finding kind the corpus produces from every track ×
-language × round kind over the real library (cap, priority ≥ 90, a reason naming the finding)
-and checks that every signal a route requires is one `plan_signals()` sets. `finding_kind()`
-reads no message text (N52, 2026-09-24: the regex it replaced left seven `scene_frames` kinds
-unrouted and R19 unreachable). Every gate writes a `data.kind` — lints from
-`contracts.artifacts.LintKind`, connectivity `stray_islands` / `no_ground`, motion_direction
-`wrong_direction` / `skipped`, render_console `console_error`, scene_probe `draw_calls` — so R9
-answers `lint/part_not_imported`, not every lint line; a finding from before its gate wrote a
-kind is `<gate>/untyped`, answered only by a family row; INFO findings have no kind (census, not
-defects). A bundle is added with its rows in the same commit — an unroutable bundle pays the
-index and never helps, and a test fails on both halves.
-
----
+Every gate writes a `data.kind` — lints from `contracts.artifacts.LintKind`, connectivity
+`stray_islands` / `no_ground`, motion_direction `wrong_direction` / `skipped`, render_console
+`console_error`, scene_probe `draw_calls` — so R9 answers `lint/part_not_imported`, not every
+lint line; INFO findings have no kind. A bundle is added with its rows in the same commit — an
+unroutable bundle pays the index and never helps, and a test fails on both halves.
## 4. Telemetry
@@ -183,152 +109,31 @@ Per round, `RoundRecord.skills` is a `SkillsUsage`: listed, surfaced, read deep,
`body_tokens_read`, `evidence` and the control's state. Each attached body's hash goes into
`record.prompt_hashes` as `skill:<name>`; per session, `telemetry/skills.jsonl` gets one line.
-**Ground truth: the CLI's own record** (2026-09-22). Each backend writes what its CLI says it
-called into `trajectories/<label>/transcript.jsonl` — one `tool_call` row per call (arguments cut
-to 400 characters a value, the CLI's own failure verdict as `failed`), then one `tool_trace` row
-closing the session (`agents/cli_common.record_tool_calls`):
-
-| backend | source | activation looks like |
-|---|---|---|
-| claude-code | `--output-format stream-json --verbose` (plain `json` carried no tool stream); the `init` event's `skills` list is kept as `skills_index` | `Skill {"skill": name}` |
-| codex | the `exec --json` events it streams (`command_execution`, `mcp_tool_call`, `file_change`) | a `sed`/`cat` of `…/<name>/SKILL.md` |
-| agy | its conversation database, `<HOME>/.gemini/antigravity-cli/conversations/<id>.db`, read before the session's HOME is deleted — a schema-free walk of each step's protobuf for (call id, tool, JSON args) | `read_file` of `…/<name>/SKILL.md` |
-
-`probe_reads` credits only sessions logged after the attach (`SkillsMaterialized.attached_at`)
-and uses the transcript only when **every** such session closed a trace — a partial trace
-under-counts exactly as the blind probe over-counts. Under transcript evidence `control_read`
-means the AGENT opened the control: counted by the report and flagged, never dropped as blind.
+Ground truth is the CLI's own record: each backend writes what its CLI says it called into
+`trajectories/<label>/transcript.jsonl` (claude-code's stream-json, codex's `exec --json`
+events, agy's conversation database read before its HOME is deleted), and
+`skills/telemetry.probe_reads` credits a bundle as *surfaced* when a call activated it or named
+its `SKILL.md`, *deep* when a call named a file under its `references/`. The atime probe is the
+fallback for a session that left no trace, guarded by a never-routed **control** bundle:
+when the control comes back opened (git reads untracked files too), the session's deep-read rate
+is `None`, not a number.
```
3dcode skills report eval/bench/out/<battery> # deep-read rate per skill per backend (--json)
-3dcode skills validate # bundles, overlays, routes
+3dcode skills validate [--strict] # bundles, overlays, routes, claims
```
-Target: ≥ 60 % deep-read, counted only over sessions the control says were measurable. **A skill
-under 20 % over 20 such sessions is merged or deleted** — a library that only grows ends as bloat.
-The read rate is the first readout, before any score: the former `read_cookbook` tool was called
-by 0 of 16 zone sessions although the prompt named five chapters by title.
-
-**Measured 2026-09-22, from the transcripts** — a harness-built static_object/blender workspace,
-four routed bundles + the control, each CLI launched by its own backend, a chair brief that never
-mentions skills:
-
-| CLI · model | index the CLI showed | activated | deep | control | atime probe, same session |
-|---|---|---|---|---|---|
-| claude-code 2.1.280 · sonnet | `init.skills`: the 4 + control (+ 26 of its own) | **4 / 4** (`Skill`) | 0 | untouched | 4/4 deep, control "read" → blind |
-| codex 0.155.1 · gpt-5.6-luna | `## Skills`: the 4 + control (+ 5 `.system`) | **4 / 4** (`sed`) | 0 | untouched | same |
-| agy 1.2.2 · gemini-3.7-flash-medium | its first four calls were the four `SKILL.md` paths | **4 / 4** (`view_file`) | 0 | untouched | same |
+Target: ≥ 60 % deep-read, counted only over sessions the control says were measurable. A skill
+under 20 % over 20 such sessions is merged or deleted — a library that only grows ends as bloat.
+`pytest -m live tests/skills/test_live_discovery.py` proves on the real CLIs that a bundle is
+found and opened through each discovery root.
-Every CLI read every routed body and no reference; the atime probe called every reference "read"
-and the control opened — git, not the agent. The 2026-08-25 atime figures (5 of 5 deep on every
-CLI) are therefore an upper bound. What is not ambiguous is the behavioural trace: codex's
-`src/parts/common.py` came back with `WELD_OVERLAP = 0.001` and "1 mm weld overlap with the seat"
-— `c3d-part-contact`'s number, where the prompt corpus of the day said 2–5 mm.
-
----
-
-## 5. What the tests guarantee
-
-`tests/skills/` is hermetic by default; two `slow` cases build a wheel, the `live` cases drive a
-real CLI.
-
-| file | guarantees |
-|---|---|
-| `test_loader.py` | the spec's field rules, as the loader enforces them |
-| `test_spec_compliance.py` | the same rules re-derived from the raw bytes, plus the reference validator (`pip install skills-ref` → the `agentskills` CLI) agreeing field by field with our loader |
-| `test_library.py` | body budget, no code fence over 12 lines (D107), no restating `conventions.py`, every `_claims` number matches its live constant, no two skills point one claim key at different numbers |
-| `test_freshness.py` | every tool, gate kind, rubric criterion, constant, switch and sibling skill a bundle names still exists; every function it tells the agent to call is defined; no bundle points at a cookbook |
-| `test_router.py` / `test_routing_property.py` | the four routing laws by row; every corpus finding kind from every session |
-| `test_telemetry.py` | the read probe, the control that catches git, the atime complement under the control |
-| `test_packaging.py` | a built wheel contains all 20 `SKILL.md`, their `references/`, every `_claims` file |
-| `test_live_discovery.py` | §7 — a real CLI finds and opens a bundle |
-
-Two contradiction checks answer different questions: **value-level**, library-wide — two skills
-may not point one claim key at different numbers, compared on the pre-scale value ("1 cm" and
-"0.01" metres are both right); **text-level**, co-routing only — two skills that can land in one
-session and chose the same units must read the same.
-
----
-
-## 6. Does it help? The A/B
-
-**Default ON since 2026-09-22** (owner's call, D81). The 2026-08-25 verdict had been OFF, for
-one reason that is gone — `api-agent`, then the bench's generator, read 0 of 5 bundles with
-ground truth (52 `read_file` calls, none on a skill path) and was deleted 2026-08-28 — and one
-that is now the A/B's job: every CLI backend activates 4 of 4 routed bundles unprompted (§4),
-and an *effect* cannot be shown at n = 8 on this rig at all (below). What ON costs: the
-41-token mandate sentence plus the bodies the CLI activates — all of them, up to the cap of five
-at 851–2,498 tokens each. An A/B names its no-skills arm explicitly:
-`eval/bench/ab_plan.py --variant-env C3D_SKILLS=0` (ab_plan's control is the driver's env minus
-the variant's keys, so the OFF arm must be the variant; its delta reads OFF − ON).
-
-**The rig** (2026-08-25): `ab_plan.py`, arms differing in `C3D_SKILLS` only, `static_objects_v2`,
-`--rounds 1`, paired, judge `gemini:gemini-3.1-pro-preview` at `n_samples 2`; the eight prompts
-are the ones `eval/bench/out/plan_loop/C0` used for its A/A. The switch is generation-side (the
-planner runs in the `plan` stage before anything is attached), so plan-once-write-both is valid
-for it (`eval/docs/EVAL.md` §8.1).
-
-**The noise floor, measured first** — C0, two identical arms, the same eight prompts:
-
-| | |
-|---|---|
-| paired prompts scored | 6 of 8 (2 `infra_failed`) |
-| mean delta | **+0.043** from nothing; paired sd 0.202, SE 0.082, 2 SE band **±0.165** |
-| sign test | 2 up / 3 down, p = 1.000 |
-| worst "regression" | `mech_hard_pitcher_pump` **−0.206** |
-| prompts to resolve ±0.02 | ~408 |
-
-The shipping bar the wave was given — mean delta ≥ 0 and no prompt regressed by more than 0.03 —
-is failed by the A/A itself, so at n = 8 it tests the instrument, not the change. C0's worst
-pair planned 1 part and 10 parts for the same pitcher pump: the dominant variance term is the
-**planner**, and the deterministic readouts inherit it directly — on the same A/A,
-`eval/bench/ab_gate_rates.py` saw penetrating pairs go **1 → 17** between identical arms
-(mean +5.67 pairs, +2.80 mm worst depth): a bigger plan has more parts and more contacts.
-
-**What the A/B measured** (`eval/bench/out/ab_skills`): one paired prompt scored out of eight in
-a 503 storm, delta **+0.002** (0.937 → 0.939), `inconclusive` — and the variant arm had not read
-the bundles (the 0 of 5 above). Its first attempt was **void** with no symptom: `spawn_cell`
-started each child as a file path, `ab_plan` imported `codeverse3d._compat` above its `sys.path`
-bootstrap, and both arms ran the main tree with no `skills` package at all; fixed with a
-bootstrap-first import, a guard that refuses a foreign `codeverse3d`, and
-`eval/tests/test_worktree_import.py`.
-
-**Next, in order:** pin the plan (removes the dominant term from both readouts and costs one
-planner call less per pair); re-run on a post-D107 tree (the corpus no longer argues with
-`c3d-part-contact` about weld overlap) with gate counts as the primary readout, as hit rates (§9).
-
----
-
-## 7. Native loading — proven, not argued
-
-`pytest -m live tests/skills/test_live_discovery.py`: a probe bundle is materialised into a
-scratch workspace, the CLI gets a task matching its description, and the assertion is the read
-probe plus a magic word that only lives in `references/`.
-
-| CLI | first proven | re-run 2026-11-03 | discovery root | surfaced | deep |
-|---|---|---|---|---|---|
-| claude-code | 2.1.245 | 2.1.317 | `.claude/skills/` | yes | yes — via `cd …/<name> && … cat "$f"` (D115) |
-| codex | 0.149.0 | 0.166.0 | `.agents/skills/` | yes | yes |
-| agy | 1.1.20 | 1.4.12 | `.agents/skills/` | yes | yes |
-
-Re-read from the binaries 2026-09-22 (claude-code 2.1.280, codex 0.155.1, agy 1.2.2) through the
-harness's own launch path: same roots, all activate the routed bundles; agy's
-`--disable-slash-commands`, which the harness passes, only stops `/name` expansion of the prompt.
-Two things this settled that had only been argued: `Skill` was absent from `ALLOWED_TOOLS`
-(claude-code would have denied its own skill tool — added); and the negative control — a bundle whose description does not match, "do not read any
-files, do not activate any skill" — found every CLI opening `SKILL.md` **and** `references/`,
-each only under the root it owns (claude-code both roots): the independent confirmation of the
-root mapping, and the reason `deep` cannot mean "the agent chose to go deeper" on atime alone (§1).
-
----
-
-## 8. How to add a skill
+## 5. How to add a skill
1. `codeverse3d/skills/<name>/SKILL.md` — `name` equals the directory name (lowercase `a-z0-9`,
- single hyphens); `description` (≤ 1024 chars) says WHAT and WHEN — the only text a CLI matches
- on; no `<` or `>` in the frontmatter (the spec's prompt-injection rule); spec keys only at the
- top level, everything of ours under `metadata`, where `evidence` and `verified` (a *quoted*
- ISO date) are required.
+ single hyphens); `description` (≤ 1024 chars) says WHAT and WHEN — the only text a CLI
+ matches on; no `<` or `>` in the frontmatter; spec keys only at the top level, everything of
+ ours under `metadata`, where `evidence` and `verified` (a *quoted* ISO date) are required.
2. `codeverse3d/skills/<name>/references/*.md` — required, one level: without it the bundle can
never score on the read metric.
3. `codeverse3d/skills/_claims/<name>.toml` — one row per number the body quotes from live code,
@@ -344,50 +149,18 @@ root mapping, and the reason `deep` cannot mean "the agent chose to go deeper" o
```
A row may also pin a sentence in a bundle file (`file = "references/x.md"`), a JS constant
(`js = "runtime_js/lib/backdrop.mjs:GROUND_SPAN_M"`), a sequence (`sep`, `last_sep`) and the
- line it must stand on (`context = "WARN below"`). The prompt corpus pins its numbers the same
- way in `codeverse3d/prompts/_claims.toml` (`check_prompt_claims`, run by
- `3dcode skills validate`).
+ line it must stand on (`context = "WARN below"`). The prompt corpus pins its numbers the
+ same way in `codeverse3d/prompts/_claims.toml` (`check_prompt_claims`, run by `3dcode skills
+ validate`).
4. Its rows in `ROUTES` (`codeverse3d/skills/registry.py`), in the same commit.
-5. A `Target` row in `codeverse3d/addons/skill_targets.py` and the matching `target_*` frontmatter
- keys — the ONE deterministic quantity the bundle claims to move, its 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`.
+5. A `Target` row in `codeverse3d/addons/skill_targets.py` and the matching `target_*`
+ frontmatter keys — the ONE deterministic quantity the bundle claims to move, its direction,
+ and its baseline; if no deterministic instrument can see the claim, say so with
+ `measurable=False` and a `caveat`.
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
-frame, unit or naming rule (`conventions.py` owns those); every corpus percentage carries its
-battery, its n and its date.
-
----
-
-## 9. Known open
-
-* **The mean-count readout is the wrong statistic.** Target metrics are spiky (38–83 % of runs
- at 0); `P(run has ≥ 1 contract finding)` is 63 %, and halving *that* needs ~24 pairs where
- halving the mean needs ~449. Converting the readout to a hit rate is the cheapest change that
- makes an effect A/B affordable. Not done.
-* **Pinning the plan does not collapse the gate-metric noise.** Verified in production (one
- planner call per pair, both arms cache-HIT): `contract_findings` against `n_parts` gives
- R² = 0.103, and a pinned A/A pair scored 0.450 vs 0.654. The spread is generation noise at a
- fixed plan size; do not budget an A/B on pinning buying power.
-* **`codex` can drop a round from the denominator** — `skills.attached` with no `skills.read`
- and no `skills.jsonl` row, so an attached round can vanish from `3dcode skills report`.
-* **Read rate confounds with routed-set size.** 1-skill sessions (glsl, opengl) read their
- bundle 4/4; 5-skill object sessions averaged ~55 %. A wording A/B must hold the set size fixed
- or it measures the cap.
-* **`c3d-part-contact`'s A/B predates D107.** The corpus taught 2–5 mm of overlap, at or above
- `PENETRATION_WARN_M`, until D107 put every prompt on the gate's band (gap ≤ 2 mm, overlap
- ≤ 2 mm) — the single most likely reason the bundle failed to move its number. Re-run on a
- post-D107 tree; never pool with before.
-* **Runs before 2026-09-22 carry no `shader_preflight` gate** (it rides `BuildResult.gates`
- since then, so R21 fires): a readout across that date must not mix the two.
-* **Corpus percentages are checked for provenance, not recomputed.** A body's "47 graded
- blender runs" is a slice; enforced: a claim may not exceed what `eval/bench/out` holds,
- `measured` needs n ≥ 20, every rate names its battery / n / date.
-* **`cadquery` and `threejs` bundles are unranked** until each language reaches 20 graded runs
- (4 and 3 at the last count; `C3D_SKILLS_UNVERIFIED=0` drops them).
-* **Router precision is not reported** — how often a skill was read whose defect class never
- fired in that run; the number that decides whether the cap of 5 is too generous.
-* **`scene_frames/content_*` has no classified kind**, so frame coverage — half of what
- `c3d-scene-composition` teaches — neither routes nor counts; adding a kind is an effect claim
- and needs its own evidence.
+Body rules: ≤ 350 lines and ≤ 2,500 tokens; no code fence over 12 lines; never restate a frame,
+unit or naming rule (`conventions.py` owns those); every corpus percentage carries its battery,
+its n and its date. `tests/skills/` enforces all of it: the spec's field rules, the body budget,
+every `_claims` number against its live constant, every tool / gate kind / rubric criterion /
+constant a bundle names still existing, the four routing laws, and the read probe.
diff --git a/harness/tests/core/test_interfaces_names.py b/harness/tests/core/test_interfaces_names.py
index aff73ef7..9f71ac36 100644
--- a/harness/tests/core/test_interfaces_names.py
+++ b/harness/tests/core/test_interfaces_names.py
@@ -1,4 +1,4 @@
-"""docs/INTERFACES.md names only things that exist.
+"""docs/INTERFACES.md (a local-only note; skipped when absent) names only things that exist.
Checked: in ```python fences, ``from codeverse3d.<m> import …`` / ``import codeverse3d.<m>`` and a
line starting ``X.y(`` whose ``X`` was imported or is a subpackage; in prose, a backticked dotted
@@ -14,6 +14,8 @@ import re
import types
from pathlib import Path
+import pytest
+
import codeverse3d
HARNESS = Path(__file__).resolve().parents[2]
@@ -82,6 +84,8 @@ def resolves(dotted: str) -> bool:
def test_every_name_interfaces_cites_resolves():
+ if not INTERFACES.is_file():
+ pytest.skip("docs/INTERFACES.md is a local-only note (not distributed)")
names = cited_names(INTERFACES.read_text(encoding="utf-8"))
assert len(names) > 150, "the parser stopped finding INTERFACES' names"
assert [n for n in names if not resolves(n)] == [], "docs/INTERFACES.md cites names the code no longer has"