Skip to content

Official Codebase of 3DCodeVerse

Python

harness: apply the external review — 2 behaviour bugs, hygiene, dead code

gaoypeng98f5a1c85337
diff --git a/harness/README.md b/harness/README.md
index 7cb6e8a8..d05411c3 100644
--- a/harness/README.md
+++ b/harness/README.md
@@ -13,8 +13,7 @@ renders, judges, refines, textures and records every run as data-flywheel materi
* **Spatial tools** (direct, or over the MCP server `3dcv` for the agentic CLIs):
build, measure, render_views/sheet, isolate, cross_section,
check_connectivity, check_contract, compare_silhouette, joint_sweep, shader_probe,
- scene_probe, scene_views, gl_probe, gl_frames, texture_pass, texture_preview,
- read_cookbook.
+ scene_probe, scene_views, gl_probe, gl_frames, texture_pass, texture_preview.
* **Judging:** rubric VLM judge (default `gemini-3.1-pro-preview`) on labelled 2×2
montages with binary defect checklists; code-computed scores, floors and caps from
deterministic gates; pairwise, ranking and reference judges; best-of-N candidates;
diff --git a/harness/bench/_oneshot.py b/harness/bench/_oneshot.py
index feff68e3..f919292f 100644
--- a/harness/bench/_oneshot.py
+++ b/harness/bench/_oneshot.py
@@ -221,15 +221,6 @@ def extract_model_file(text: str) -> str:
return code if code.endswith("\n") else code + "\n"
-def write_model_file(ws: Workspace, text: str) -> Path:
- """Parse the answer and write ``src/model.py`` into the workspace (raises MultiFileParseError)."""
- code = extract_model_file(text)
- dest = ws.root / MODEL_FILE
- dest.parent.mkdir(parents=True, exist_ok=True)
- dest.write_text(code)
- return dest
-
-
def extract_files(text: str, language: Language = Language.BLENDER) -> dict[str, str]:
"""Every file a one-shot answer must contain for ``language`` → ``{path: body}``.
@@ -433,5 +424,4 @@ def get_oneshot_backend(target: str) -> OneShotBackend:
__all__ = ["ApiOneShot", "ClaudeOneShot", "CodexOneShot", "MODEL_FILE", "OneShotBackend", "OneShotResult",
- "extract_model_file", "get_oneshot_backend", "minimal_contract", "oneshot_prompt", "repair_prompt",
- "write_model_file"]
+ "extract_model_file", "get_oneshot_backend", "minimal_contract", "oneshot_prompt", "repair_prompt"]
diff --git a/harness/bench/ab_plan.py b/harness/bench/ab_plan.py
index 1837c96f..e4aaf4fc 100644
--- a/harness/bench/ab_plan.py
+++ b/harness/bench/ab_plan.py
@@ -2,12 +2,12 @@
python bench/ab_plan.py --prompts bench/prompts/static_objects_v2.yaml \\
--variant-env CV3D_PLAN_BRIEF=on --out bench/out/ab_brief \\
- [--generator gemini-cli:gemini-3.6-flash] [--judge gemini:gemini-3.1-pro-preview] \\
- [--rounds 2] [--max-usd 2.5] [--ids a,b] [--wait-for-provider 60] [--redo-status infra_failed]
+ [--generator <backend-id>] [--judge gemini:gemini-3.1-pro-preview] \\
+ [--rounds 2] [--ids a,b] [--wait-for-provider 60] [--redo-status infra_failed]
The only thing that differs between the arms is the ``--variant-env`` block, applied to
the VARIANT arm alone. Everything else is held fixed on both sides: the generator, the
-planner, the in-loop judge, the rounds and dollars, and the fixed judge that produces
+planner, the in-loop judge, the rounds, and the fixed judge that produces
the reported score (``bench/_fixed_eval.py``, ``n_samples`` 2).
Why each arm is a child PROCESS rather than a thread: the switches under test are read
@@ -108,13 +108,16 @@ from bench.compare_backends import ( # noqa: E402
)
from bench.pin_plan import PLAN_JSON, PinError, plan_once, seed_plan # noqa: E402
from bench.run_bench import Battery, BenchPrompt, select_prompts # noqa: E402
+from codeverse.contracts.common import Backends # noqa: E402
from codeverse.proc import exclusive # noqa: E402
from codeverse.tracks.plan_features import pin_plan_blockers # noqa: E402
from codeverse.workspace import Workspace # noqa: E402
log = logging.getLogger(__name__)
-DEFAULT_GENERATOR = "gemini-cli:gemini-3.6-flash"
+#: derived from the canonical default (codeverse/contracts/common.py Backends.generator),
+#: never a literal: a frozen baseline arm must be named at its use site, not hidden here.
+DEFAULT_GENERATOR = Backends().generator
DEFAULT_JUDGE = "gemini:gemini-3.1-pro-preview"
#: the per-child cap. The flat name is a first-class alias of ``CV3D_RATE__MAX_IN_FLIGHT``
#: since 2026-08-24 (``Settings._FLAT_ALIASES``; before that it was read by nothing) and
@@ -566,7 +569,6 @@ def _parser() -> argparse.ArgumentParser:
ap.add_argument("--loop-judge", default=None)
ap.add_argument("--planner", default=None)
ap.add_argument("--rounds", type=int, default=2)
- ap.add_argument("--max-usd", type=float, default=2.5)
ap.add_argument("--max-minutes", type=float, default=45.0)
ap.add_argument("--n-samples", type=int, default=2)
ap.add_argument("--ids", default="")
diff --git a/harness/bench/compare_backends.py b/harness/bench/compare_backends.py
index 065834f7..20692423 100644
--- a/harness/bench/compare_backends.py
+++ b/harness/bench/compare_backends.py
@@ -7,7 +7,7 @@ oneshot:claude-code,oneshot:codex,oneshot:gemini:gemini-3.7-flash \\
Arms
* ``harness:<generator-id>`` — the full static_object track (plan → generate →
- build/repair → gates → render → judge → refine, rounds ≤ 3, ≤ $2.5). Its
+ build/repair → gates → render → judge → refine, rounds ≤ ``--rounds``). Its
in-loop judge is ``--loop-judge`` (default: the settings default, flash); the
loop's own score is NOT the reported score.
* ``oneshot:<x>`` — ONE raw generation (prompt + minimal contract, no tools, no
@@ -510,7 +510,6 @@ def main(argv: Sequence[str] | None = None) -> int:
ap.add_argument("--ids", default="", help="comma-separated prompt ids")
ap.add_argument("--tiers", default="", help="comma-separated tiers (easy,medium,hard)")
ap.add_argument("--rounds", type=int, default=3)
- ap.add_argument("--max-usd", type=float, default=2.5)
ap.add_argument("--max-minutes", type=float, default=45.0, help="wall-clock ceiling for ONE harness run")
ap.add_argument("--loop-judge", default=None, help="harness in-loop judge (default: settings default)")
ap.add_argument("--repair-attempts", type=int, default=2)
diff --git a/harness/codeverse/agents/backends.py b/harness/codeverse/agents/backends.py
index 8f5544b0..e3c875b2 100644
--- a/harness/codeverse/agents/backends.py
+++ b/harness/codeverse/agents/backends.py
@@ -317,7 +317,6 @@ def _compose_prompt(job: AgentJob) -> str:
# ===================================================================== claude_code
-# (merged from codeverse/agents/claude_code.py, 2026-08-28)
#: ``--allowedTools``. "Skill" is claude-code 2.1's model-invoked skill tool: without it
#: the bundles the harness materialises into ``ws/.claude/skills/`` are listed at session
#: start and then DENIED on activation, which reads in the transcript as the model
@@ -469,7 +468,6 @@ class ClaudeCodeAgent(_CliAgent):
# ===================================================================== codex
-# (merged from codeverse/agents/codex.py, 2026-08-28)
STDIN_PROMPT_BYTES = 100_000
_TOOL_ITEMS = ("command_execution", "file_change", "mcp_tool_call", "web_search", "tool_call")
@@ -624,7 +622,6 @@ class CodexAgent(_CliAgent):
# ===================================================================== antigravity
-# (merged from codeverse/agents/antigravity.py, 2026-08-28)
#: reasoning efforts agy exposes for the models that have them
EFFORTS = ("low", "medium", "high")
diff --git a/harness/codeverse/agents/cli_common.py b/harness/codeverse/agents/cli_common.py
index ae6ae691..2362fd7c 100644
--- a/harness/codeverse/agents/cli_common.py
+++ b/harness/codeverse/agents/cli_common.py
@@ -102,7 +102,6 @@ class Trajectory:
# ===================================================================== watchdog
-# (merged from codeverse/agents/watchdog.py, 2026-08-28)
_SKIP_DIRS = {"node_modules", ".git", "__pycache__", ".gemini", ".gemini_home"}
@@ -157,8 +156,6 @@ def _latest_mtime(dirs: Iterable[Path]) -> float:
return latest
-
-
def run_with_watchdog(
cmd: Sequence[str],
*,
@@ -252,7 +249,6 @@ def _reject_control_chars(cmd: Sequence[str], cwd: object) -> None:
# ===================================================================== cli_common
-# (merged from codeverse/agents/cli_common.py, 2026-08-28)
log = logging.getLogger(__name__)
#: argv prompts above this many bytes are written to a file instead.
diff --git a/harness/codeverse/agents/registry.py b/harness/codeverse/agents/registry.py
index 25317592..f784aeac 100644
--- a/harness/codeverse/agents/registry.py
+++ b/harness/codeverse/agents/registry.py
@@ -40,7 +40,6 @@ class CodingAgent(Protocol):
# ===================================================================== registry
-# (merged from codeverse/agents/registry.py, 2026-08-28)
KINDS = ("gemini-cli", "claude-code", "codex", "agy")
diff --git a/harness/codeverse/cli/_common.py b/harness/codeverse/cli/_common.py
index 3d2cfc02..44ba6157 100644
--- a/harness/codeverse/cli/_common.py
+++ b/harness/codeverse/cli/_common.py
@@ -123,7 +123,6 @@ def doctor_table(rows: list[tuple[str, str, str]]) -> Table:
# ===================================================================== _common
-# (merged from codeverse/cli/_common.py, 2026-08-28)
REPO_ROOT = Path(__file__).resolve().parents[2]
diff --git a/harness/codeverse/cli/main.py b/harness/codeverse/cli/main.py
index bae9b6c8..6deb93bb 100644
--- a/harness/codeverse/cli/main.py
+++ b/harness/codeverse/cli/main.py
@@ -46,8 +46,6 @@ from codeverse.contracts.spec import Constraints, ReferenceImage, RunOptions, Sp
# ===================================================================== tools_cmd
-# (merged from codeverse/cli/tools_cmd.py, 2026-08-28 — main's registration block
-# was its only importer)
def tools(
name: Annotated[str, typer.Argument(help="'list' or a tool name")] = "list",
args_json: Annotated[str, typer.Option("--json", help="arguments object as JSON")] = "{}",
@@ -90,8 +88,6 @@ def tools(
# ===================================================================== bench_cmd
-# (merged from codeverse/cli/bench_cmd.py, 2026-08-28 — main's registration block
-# was its only importer)
bench_app = typer.Typer(no_args_is_help=True)
@@ -102,7 +98,8 @@ def run_cmd(
generator: Annotated[str | None, typer.Option("--generator")] = None,
planner: Annotated[str | None, typer.Option("--planner")] = None,
judge: Annotated[str | None, typer.Option("--judge", help="fixed judge model for the whole battery")] = None,
- parallel: Annotated[int, typer.Option("--parallel", min=1)] = 4,
+ parallel: Annotated[int | None, typer.Option(
+ "--parallel", min=1, help="workers (default: BenchOptions.parallel — the measured knee)")] = None,
rounds: Annotated[int, typer.Option("--rounds", min=0)] = 4,
max_minutes: Annotated[float, typer.Option("--max-minutes", help="wall-clock budget per run; size it to the weather "
"(RUNBOOK 7.x: 120 in a 503 storm, else runs burn the hour with no judged round)")] = 60.0,
@@ -119,9 +116,11 @@ def run_cmd(
raise C.CliError(f"battery not found: {battery}")
b = C.import_bench()
run_bench = C.lazy("bench.run_bench")
+ # one source of truth for the worker count: BenchOptions.parallel (the measured knee)
+ par = {"parallel": parallel} if parallel is not None else {}
opts = run_bench.BenchOptions(generator=generator, planner=planner, judge=judge, rounds=rounds, max_minutes=max_minutes,
- parallel=parallel, limit=limit, ids=ids or [], tiers=tiers or [], resume=not no_resume,
- redo_status=[x for x in redo_status.split(",") if x])
+ limit=limit, ids=ids or [], tiers=tiers or [], resume=not no_resume,
+ redo_status=[x for x in redo_status.split(",") if x], **par)
out_dir = out or (C.REPO_ROOT / "bench" / "out" / battery.stem)
console.print(f"battery={battery} out={out_dir} generator={generator or 'default'} judge={judge or 'default'}")
@@ -148,8 +147,6 @@ def report_cmd(out_dir: Annotated[Path, typer.Argument()]) -> None:
# ===================================================================== gallery_cmd
-# (merged from codeverse/cli/gallery_cmd.py, 2026-08-28 — main's registration block
-# was its only importer)
gallery_app = typer.Typer(no_args_is_help=True)
RootsArg = Annotated[list[Path] | None, typer.Argument(
@@ -581,7 +578,7 @@ def _finished_reason(ws, raised: dict) -> str:
f" stop_reason={state.stop_reason!r}" if state.stop_reason else ""
)
if state.status is RunStatus.BUDGET:
- return f"{detail}: raise a cap to continue it (--max-usd / --max-minutes / --rounds)"
+ return f"{detail}: raise a cap to continue it (--max-minutes / --rounds)"
return f"{detail} best_score={state.best_score}"
return ""
@@ -616,7 +613,7 @@ def resume(
) -> None:
"""Resume an interrupted / partial run (or start a `--no-run` one).
- ``--max-usd`` / ``--max-minutes`` / ``--rounds`` rewrite the spec's budget
+ ``--max-minutes`` / ``--rounds`` rewrite the spec's budget
first — the only way to continue a BUDGET-stopped run. A run that already
reached a terminal state is refused unless ``--force``: re-entering it spends
money and overwrites its final state."""
diff --git a/harness/codeverse/contracts/artifacts.py b/harness/codeverse/contracts/artifacts.py
index 8921ffdb..a3f05c0e 100644
--- a/harness/codeverse/contracts/artifacts.py
+++ b/harness/codeverse/contracts/artifacts.py
@@ -134,7 +134,6 @@ class RenderSet(BaseModel):
# ===================================================================== judgment
-# (merged from codeverse/contracts/judgment.py, 2026-08-28)
class JudgeIssue(BaseModel):
target: str = Field(description="part / zone / joint / asset / 'overall'")
kind: Literal[
diff --git a/harness/codeverse/contracts/common.py b/harness/codeverse/contracts/common.py
index d838dd5e..e433c405 100644
--- a/harness/codeverse/contracts/common.py
+++ b/harness/codeverse/contracts/common.py
@@ -138,8 +138,14 @@ class Budget(BaseModel):
A run is bounded by ``max_rounds`` and ``max_minutes``. Cost is accumulated per call
for the ledger and the run record, and never gates anything.
+
+ ``extra="forbid"``: a caller still passing a retired ceiling (``max_usd``) or a typo
+ must raise, not be silently swallowed. Old on-disk specs are migrated in ONE place:
+ ``Spec._strip_retired_budget_keys``.
"""
+ model_config = ConfigDict(extra="forbid")
+
max_rounds: int = Field(default=4, ge=0)
max_minutes: float = Field(default=60.0, ge=0)
max_repair_attempts: int = Field(default=3, ge=0) # per build failure before escalating
diff --git a/harness/codeverse/contracts/run.py b/harness/codeverse/contracts/run.py
index 8b6b409b..e1e7fbee 100644
--- a/harness/codeverse/contracts/run.py
+++ b/harness/codeverse/contracts/run.py
@@ -77,7 +77,6 @@ class SkillsUsage(BaseModel):
# ===================================================================== run
-# (merged from codeverse/contracts/run.py, 2026-08-28)
# --------------------------------------------------------------------------- identity
#: battery-layout path segments that are pure plumbing, never part of a run's identity
RUN_PATH_NOISE = frozenset({"arms", "cells", "runs"})
diff --git a/harness/codeverse/contracts/spec.py b/harness/codeverse/contracts/spec.py
index d5281a3d..ed2c21b3 100644
--- a/harness/codeverse/contracts/spec.py
+++ b/harness/codeverse/contracts/spec.py
@@ -3,6 +3,7 @@
from __future__ import annotations
from datetime import UTC, datetime
+from typing import Any
from pydantic import BaseModel, Field, model_validator
@@ -56,6 +57,20 @@ class Spec(BaseModel):
tags: list[str] = Field(default_factory=list)
created_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
+ @model_validator(mode="before")
+ @classmethod
+ def _strip_retired_budget_keys(cls, data: Any) -> Any:
+ """THE migration point for retired spec fields — nowhere else may tolerate them.
+
+ Runs recorded before 2026-08-28 carry ``budget.max_usd`` (the money ceiling
+ deleted from the harness). ``Budget`` itself is ``extra="forbid"`` so live
+ callers and typos raise — but a spec.json / record.json written back then must
+ keep loading (resume, flywheel), so the retired key is stripped here, before
+ validation."""
+ if isinstance(data, dict) and isinstance(data.get("budget"), dict) and "max_usd" in data["budget"]:
+ data = {**data, "budget": {k: v for k, v in data["budget"].items() if k != "max_usd"}}
+ return data
+
@model_validator(mode="after")
def _language_fits_track(self) -> Spec:
allowed = TRACK_LANGUAGES[self.track]
diff --git a/harness/codeverse/cost/ledger.py b/harness/codeverse/cost/ledger.py
index ddf16ba5..21b39b67 100644
--- a/harness/codeverse/cost/ledger.py
+++ b/harness/codeverse/cost/ledger.py
@@ -170,11 +170,6 @@ def process_ledger_path() -> Path:
return base / "cost" / f"p{os.getpid()}-{stamp}.jsonl"
-def ledger_path(workspace: str | Path) -> Path:
- """The live ledger of a run workspace: ``<ws>/telemetry/cost.jsonl``."""
- return Path(workspace) / TELEMETRY_LEDGER
-
-
def existing_ledger_path(workspace: str | Path) -> Path | None:
"""The ledger file a run actually has — the telemetry one, else the legacy
root file — or ``None``."""
diff --git a/harness/codeverse/cost/profiles.py b/harness/codeverse/cost/profiles.py
index 72e51a12..939762f8 100644
--- a/harness/codeverse/cost/profiles.py
+++ b/harness/codeverse/cost/profiles.py
@@ -143,8 +143,13 @@ PROFILES: dict[str, Profile] = {
max_minutes=90.0,
expected_usd=3.20,
expected_score="best-of-2 lifted the stool baseline 0.563 → 0.612 and the texture pass "
- "0.686 → 0.701; judge σ 0.017 at n=3",
- note="gemini-cli + pro judge n=3 + 4 rounds + best-of-2 + texture pass",
+ "0.686 → 0.701; judge σ 0.017 at n=3 "
+ "— MEASURED ON gemini-cli:gemini-3.6-flash, not on this dial's generator",
+ note="gemini-cli + pro judge n=3 + 4 rounds + best-of-2 + texture pass. The generator "
+ "moved to 3.7-flash on 2026-08-28 and the $3.20 / score expectations above have NOT "
+ "been re-measured on it (same caveat as balanced: docs/COST.md §12 puts the 3.7 CLI "
+ "arm at $0.73/call vs 3.6's $0.52), so expect this dial to cost more and score about "
+ "the same until a battery says otherwise",
),
}
diff --git a/harness/codeverse/flywheel/export.py b/harness/codeverse/flywheel/export.py
index 965eb6d7..cea08929 100644
--- a/harness/codeverse/flywheel/export.py
+++ b/harness/codeverse/flywheel/export.py
@@ -420,7 +420,6 @@ def write_jsonl(rows: list[dict[str, Any]], path: Path, *, commit: bool = True)
# ===================================================================== manifest
-# (merged from codeverse/flywheel/manifest.py, 2026-08-28)
MANIFEST_NAME = "dataset_manifest.json"
diff --git a/harness/codeverse/flywheel/quality.py b/harness/codeverse/flywheel/quality.py
index 1d902d9f..88f565ea 100644
--- a/harness/codeverse/flywheel/quality.py
+++ b/harness/codeverse/flywheel/quality.py
@@ -161,7 +161,6 @@ def near_duplicates(items: Iterable[DedupeItem], *, mesh_threshold: float = 0.9)
# ===================================================================== quality
-# (merged from codeverse/flywheel/quality.py, 2026-08-28)
QualityTier = Literal["A", "B", "C", "D"]
TIER_ORDER: dict[str, int] = {"A": 0, "B": 1, "C": 2, "D": 3}
TIER_C_MIN_SCORE = 0.6
diff --git a/harness/codeverse/gallery/model.py b/harness/codeverse/gallery/model.py
index 2e7761e5..0b358e57 100644
--- a/harness/codeverse/gallery/model.py
+++ b/harness/codeverse/gallery/model.py
@@ -86,7 +86,6 @@ def humanize_view(name: str) -> str:
# ===================================================================== model
-# (merged from codeverse/gallery/model.py, 2026-08-28)
#: how an entry's link should be opened: raw bytes, a directory listing, the code
#: viewer, the GLB viewer, or another gallery page
LinkKind = Literal["file", "dir", "code", "viewer"]
diff --git a/harness/codeverse/gallery/page.py b/harness/codeverse/gallery/page.py
index 55685117..7a09a9c8 100644
--- a/harness/codeverse/gallery/page.py
+++ b/harness/codeverse/gallery/page.py
@@ -186,7 +186,6 @@ def render_index(index: GalleryIndex, urls: UrlMaker, *, title: str = "3dcv gall
# ===================================================================== static_site
-# (merged from codeverse/gallery/static_site.py, 2026-08-28)
def render_static(index: GalleryIndex, *, title: str = "3dcv gallery", embed: bool = False,
thumb_px: int = THUMB_PX, sort: str = "score", view: str = "cards",
extra_html: str = "") -> str:
diff --git a/harness/codeverse/gallery/theme.py b/harness/codeverse/gallery/theme.py
index 534a25e3..f8ae359b 100644
--- a/harness/codeverse/gallery/theme.py
+++ b/harness/codeverse/gallery/theme.py
@@ -394,7 +394,6 @@ def footer(text: str) -> str:
# ===================================================================== scripts
-# (merged from codeverse/gallery/scripts.py, 2026-08-28)
INDEX_JS = r"""
(function(){
var node=document.getElementById('gallery-data');
diff --git a/harness/codeverse/gallery/urls.py b/harness/codeverse/gallery/urls.py
index c9b8bde0..7b99d38c 100644
--- a/harness/codeverse/gallery/urls.py
+++ b/harness/codeverse/gallery/urls.py
@@ -156,7 +156,6 @@ def content_type(path: Path | str) -> str:
# ===================================================================== paths
-# (merged from codeverse/gallery/paths.py, 2026-08-28)
class PathError(ValueError):
"""A requested path is outside the run directory (or is not usable)."""
diff --git a/harness/codeverse/judges/base.py b/harness/codeverse/judges/base.py
index 46cc3d4e..2198af56 100644
--- a/harness/codeverse/judges/base.py
+++ b/harness/codeverse/judges/base.py
@@ -34,7 +34,6 @@ class Judge(Protocol):
# ===================================================================== replay_input
-# (merged from codeverse/judges/replay_input.py, 2026-08-28)
def plan_digest(plan: dict[str, Any]) -> str:
"""A track-agnostic plan summary (parts / joints / zones / assets / cameras) from ``plan.json``."""
bits: list[str] = []
diff --git a/harness/codeverse/judges/prompt_builder.py b/harness/codeverse/judges/prompt_builder.py
index 0e896830..5311a6b0 100644
--- a/harness/codeverse/judges/prompt_builder.py
+++ b/harness/codeverse/judges/prompt_builder.py
@@ -122,7 +122,6 @@ def image_part(path: Path, label: str) -> ImagePart:
# ===================================================================== montage
-# (merged from codeverse/judges/montage.py, 2026-08-28)
MontageKind = Literal["shaded", "geometry", "poses", "pose_sheet", "detail"]
#: modes that show geometry without material/lighting noise
@@ -364,7 +363,6 @@ def describe_montages(montages: list[Montage]) -> str:
# ===================================================================== prompt_builder
-# (merged from codeverse/judges/prompt_builder.py, 2026-08-28)
if TYPE_CHECKING: # pragma: no cover
from codeverse.judges.base import JudgeInput
diff --git a/harness/codeverse/judges/rubrics.py b/harness/codeverse/judges/rubrics.py
index a7d9a720..e19b5113 100644
--- a/harness/codeverse/judges/rubrics.py
+++ b/harness/codeverse/judges/rubrics.py
@@ -234,7 +234,6 @@ def load_rubric(name: str) -> Rubric:
# ===================================================================== output_schema
-# (merged from codeverse/judges/output_schema.py, 2026-08-28)
class JudgeParseError(ValueError):
"""The model's reply could not be turned into a complete JudgeOutput."""
@@ -434,7 +433,6 @@ def parse_judge_output(
# ===================================================================== caps
-# (merged from codeverse/judges/caps.py, 2026-08-28)
_SEV_RANK = {Severity.INFO: 0, Severity.WARN: 1, Severity.ERROR: 2}
@@ -608,7 +606,6 @@ def _rule_evidence(
# ===================================================================== scoring
-# (merged from codeverse/judges/scoring.py, 2026-08-28)
class ScoreBreakdown(BaseModel):
"""Everything the pass/fail decision used (serialised into ``Judgment.raw``)."""
diff --git a/harness/codeverse/judges/vlm_judge.py b/harness/codeverse/judges/vlm_judge.py
index 888c08df..a82837c8 100644
--- a/harness/codeverse/judges/vlm_judge.py
+++ b/harness/codeverse/judges/vlm_judge.py
@@ -240,7 +240,6 @@ class VlmJudge:
# ===================================================================== reference
-# (merged from codeverse/judges/reference.py, 2026-08-28)
SilhouetteFn = Callable[[str, str], dict[str, Any]]
@@ -520,7 +519,6 @@ def _plan_part_names(inp: JudgeInput) -> list[str]:
return seen[:40]
-
LIKENESS_NOTE = (
"REAL-WORLD REFERENCE PHOTOS are attached (labelled REAL-WORLD REFERENCE n/N). They are not a "
"composition to copy; they are what the thing the brief names ACTUALLY looks like. Score "
diff --git a/harness/codeverse/languages/blender/__init__.py b/harness/codeverse/languages/blender/__init__.py
index e570d723..6757ffd4 100644
--- a/harness/codeverse/languages/blender/__init__.py
+++ b/harness/codeverse/languages/blender/__init__.py
@@ -31,7 +31,6 @@ from codeverse.proc import scrub_secrets
from codeverse.workspace import Workspace
# ===================================================================== lint
-# (merged from codeverse/languages/blender/lint.py, 2026-08-28)
GATE = "lint:blender"
ALLOWED_IMPORTS = {
@@ -309,7 +308,6 @@ def lint_blender_file(path: Path, *, target: str = "src/model.py") -> GateReport
# ===================================================================== layout
-# (merged from codeverse/languages/blender/layout.py, 2026-08-28)
ENTRY_REL = ENTRY_FILE[Language.BLENDER] # "src/model.py"
PARTS_DIR = "parts"
PARTS_PKG = "parts"
@@ -436,7 +434,6 @@ def lint_workspace(ws: Workspace) -> GateReport:
# ===================================================================== skeleton
-# (merged from codeverse/languages/blender/skeleton.py, 2026-08-28)
# keyword → (rgb, roughness, metallic) placeholder finishes so the first render is not all-grey
_FINISHES: tuple[tuple[tuple[str, ...], tuple[float, float, float], float, float], ...] = (
(("wood", "oak", "walnut", "pine", "timber", "birch"), (0.55, 0.36, 0.20), 0.55, 0.0),
@@ -700,7 +697,6 @@ def write_blender_skeleton(ws: Workspace, plan: StaticPlan, *, multi_file: bool
# ===================================================================== runtime
-# (merged from codeverse/languages/blender/runtime.py, 2026-08-28)
_PKG_DIR = Path(__file__).resolve().parent
WRAPPER = _PKG_DIR / "wrappers" / "run_bpy.py"
diff --git a/harness/codeverse/languages/cadquery/__init__.py b/harness/codeverse/languages/cadquery/__init__.py
index 18667e94..980f75e1 100644
--- a/harness/codeverse/languages/cadquery/__init__.py
+++ b/harness/codeverse/languages/cadquery/__init__.py
@@ -28,7 +28,6 @@ from codeverse.proc import scrub_secrets
from codeverse.workspace import Workspace
# ===================================================================== lint
-# (merged from codeverse/languages/cadquery/lint.py, 2026-08-28)
GATE = "lint:cadquery"
ALLOWED_IMPORTS = {"cadquery", "cq", "math", "random", "numpy", "np", "itertools", "functools", "collections",
"typing", "dataclasses", "enum", "copy", "statistics", "operator", "__future__"}
@@ -224,7 +223,6 @@ def lint_cadquery_file(path: Path, *, target: str = "src/model.py") -> GateRepor
# ===================================================================== skeleton
-# (merged from codeverse/languages/cadquery/skeleton.py, 2026-08-28)
def _fmt(v: tuple[float, float, float]) -> str:
return "(" + ", ".join(f"{x:.3f}" for x in v) + ")"
@@ -320,7 +318,6 @@ def write_cadquery_skeleton(ws: Workspace, plan: StaticPlan) -> list[Path]:
# ===================================================================== runtime
-# (merged from codeverse/languages/cadquery/runtime.py, 2026-08-28)
_PKG_DIR = Path(__file__).resolve().parent
WRAPPER = _PKG_DIR / "wrappers" / "run_cq.py"
diff --git a/harness/codeverse/languages/glsl_shader/__init__.py b/harness/codeverse/languages/glsl_shader/__init__.py
index 071db05c..2aed803e 100644
--- a/harness/codeverse/languages/glsl_shader/__init__.py
+++ b/harness/codeverse/languages/glsl_shader/__init__.py
@@ -28,7 +28,6 @@ from codeverse.spatial.gl_render import GlHost, GlResult
from codeverse.workspace import Workspace
# ===================================================================== wrap
-# (merged from codeverse/languages/glsl_shader/wrap.py, 2026-08-28)
UNIFORM_NAMES: tuple[str, ...] = ("u_time", "u_resolution", "u_mouse", "u_frame", "u_prev", "u_noise", "u_buffer_a")
HEADER = """#version 330 core
@@ -133,7 +132,6 @@ def first_error(messages: list[GlslMessage]) -> GlslMessage | None:
# ===================================================================== lint
-# (merged from codeverse/languages/glsl_shader/lint.py, 2026-08-28)
GATE = "lint:glsl_shader"
SHADER = "src/shader.frag"
COMMON = "src/common.glsl"
@@ -283,7 +281,6 @@ def lint_text(shader_src: str, common_src: str | None = None, buffer_a_src: str
# ===================================================================== skeleton
-# (merged from codeverse/languages/glsl_shader/skeleton.py, 2026-08-28)
COMMON_GLSL = """// src/common.glsl — helpers pasted above shader.frag by the harness (no #include needed).
// Keep ONLY functions / constants here; no main(), no uniforms, no #version.
#define PI 3.14159265359
@@ -382,7 +379,6 @@ def write_skeleton(ws: Workspace, plan: Plan | None) -> list[Path]:
# ===================================================================== runtime
-# (merged from codeverse/languages/glsl_shader/runtime.py, 2026-08-28)
CONTRACT_FALLBACK = """src/shader.frag — GLSL 330 fragment shader body (NO #version line, NO uniform declarations):
write `void mainImage(out vec4 fragColor, in vec2 fragCoord)` using the harness uniforms u_time, u_resolution,
u_mouse, u_frame, u_prev (previous frame), u_noise (256² noise), u_buffer_a (src/buffer_a.frag output).
diff --git a/harness/codeverse/languages/opengl_python/__init__.py b/harness/codeverse/languages/opengl_python/__init__.py
index 98611a7d..e4516e51 100644
--- a/harness/codeverse/languages/opengl_python/__init__.py
+++ b/harness/codeverse/languages/opengl_python/__init__.py
@@ -31,7 +31,6 @@ from codeverse.spatial.gl_render import GlHost, GlResult
from codeverse.workspace import Workspace
# ===================================================================== lint
-# (merged from codeverse/languages/opengl_python/lint.py, 2026-08-28)
GATE = "lint:opengl_python"
PROGRAM = "src/program.py"
ALLOWED_MODULES: frozenset[str] = frozenset({
@@ -182,7 +181,6 @@ def lint_workspace(ws: Workspace) -> GateReport:
# ===================================================================== skeleton
-# (merged from codeverse/languages/opengl_python/skeleton.py, 2026-08-28)
_TEMPLATE = '''"""src/program.py — {title}
CONTRACT (the harness imports this module in a headless moderngl process):
@@ -338,7 +336,6 @@ def write_skeleton(ws: Workspace, plan: Plan | None) -> list[Path]:
# ===================================================================== runtime
-# (merged from codeverse/languages/opengl_python/runtime.py, 2026-08-28)
CONTRACT_FALLBACK = """src/program.py — raw moderngl program: `def setup(ctx, width, height) -> state` (programs, VAOs, textures,
FBOs; GLSL 330 core inline strings) and `def render(ctx, state, t, frame, fbo)` (draw the frame at time t into the given,
already bound framebuffer; multi-pass via your own FBOs, finish with fbo.use()). No window, no context creation, no clock,
diff --git a/harness/codeverse/languages/scene_threejs/__init__.py b/harness/codeverse/languages/scene_threejs/__init__.py
index 1aad5404..019ef452 100644
--- a/harness/codeverse/languages/scene_threejs/__init__.py
+++ b/harness/codeverse/languages/scene_threejs/__init__.py
@@ -20,7 +20,6 @@ from codeverse.languages._js_lint import ImportKind, ImportVerdict, check_import
from codeverse.workspace import Workspace
# ===================================================================== lint
-# (merged from codeverse/languages/scene_threejs/lint.py, 2026-08-28)
GATE = "lint:scene_threejs"
MAX_LINES = 800
@@ -122,7 +121,6 @@ def lint(ws: Workspace) -> GateReport:
# ===================================================================== skeleton
-# (merged from codeverse/languages/scene_threejs/skeleton.py, 2026-08-28)
STARTER_DIR = Path(__file__).resolve().parent / "starter" / "src"
#: pattern files copied verbatim in plan mode (shown as reusable examples)
PATTERN_FILES = ("shaders/sky.js", "shaders/water.js", "assets/pine_tree.js", "assets/windmill.js")
@@ -313,7 +311,6 @@ def write_skeleton(ws: Workspace, plan: Plan | None = None) -> list[Path]:
# ===================================================================== assemble
-# (merged from codeverse/languages/scene_threejs/assemble.py, 2026-08-28)
PROBE_REL = "src/_c3v_assemble_probe.js"
_PREFIX = "[3dcv-assemble]"
_SUN_RE = re.compile(r"export\s+const\s+SUN_AZIMUTH_DEG\s*=\s*(-?\d+(?:\.\d+)?)")
@@ -603,7 +600,6 @@ def assemble(ws: Workspace, plan: ScenePlan | None = None, *, cameras: str = "de
# ===================================================================== runtime
-# (merged from codeverse/languages/scene_threejs/runtime.py, 2026-08-28)
class SceneThreeJsRuntime(RuntimeDocs):
@@ -659,7 +655,6 @@ class SceneThreeJsRuntime(RuntimeDocs):
return res
-
def _probe_and_preflight(ws: Workspace, *, timeout_s: float) -> tuple[GateReport, GateReport, dict]:
"""One ``probe_scene.mjs --compile`` run → (scene_probe, shader_preflight, census).
diff --git a/harness/codeverse/languages/threejs/__init__.py b/harness/codeverse/languages/threejs/__init__.py
index ca035386..c65f26cf 100644
--- a/harness/codeverse/languages/threejs/__init__.py
+++ b/harness/codeverse/languages/threejs/__init__.py
@@ -24,7 +24,6 @@ from codeverse.spatial.node import NodeError, NodeResult, run_node, runtime_js_d
from codeverse.workspace import Workspace
# ===================================================================== templates
-# (merged from codeverse/languages/threejs/templates.py, 2026-08-28)
PACKAGE_JSON = '{ "type": "module", "private": true }\n'
OBJECT_HEADER = """\
@@ -89,7 +88,6 @@ PLACEHOLDER_COLORS = ("0x9aa5b1", "0xb08968", "0x7f8c8d", "0xc0a080", "0x6c7a89"
# ===================================================================== contract
-# (merged from codeverse/languages/threejs/contract.py, 2026-08-28)
CONTRACT_FALLBACK = """\
# three.js static-object contract (raw ESM, no SDK)
@@ -127,7 +125,6 @@ automatic drop-to-ground / re-centring; off-placement is warned and gated instea
# ===================================================================== lint
-# (merged from codeverse/languages/threejs/lint.py, 2026-08-28)
GATE = "lint:threejs"
_EXPORT_BUILD_RE = re.compile(r"\bexport\s+(?:async\s+)?function\s+(build[A-Za-z0-9_]*)\s*\(")
@@ -302,7 +299,6 @@ def lint_workspace(ws: Workspace) -> GateReport:
# ===================================================================== skeleton
-# (merged from codeverse/languages/threejs/skeleton.py, 2026-08-28)
def part_file(ws: Workspace, part_name: str) -> Path:
"""``src/parts/<snake>.js`` for a plan part name."""
return ws.src / "parts" / f"{to_snake(part_name)}.js"
@@ -366,7 +362,6 @@ def write_skeleton(ws: Workspace, plan: Plan, *, overwrite: bool = False) -> lis
# ===================================================================== runtime
-# (merged from codeverse/languages/threejs/runtime.py, 2026-08-28)
ENTRY = "src/object.js"
GLB_NAME = "object.glb"
CENSUS_NAME = "census.json"
diff --git a/harness/codeverse/languages/urdf/__init__.py b/harness/codeverse/languages/urdf/__init__.py
index 29838fbc..b3d98c2c 100644
--- a/harness/codeverse/languages/urdf/__init__.py
+++ b/harness/codeverse/languages/urdf/__init__.py
@@ -48,7 +48,6 @@ from codeverse.spatial.joints_model import (
from codeverse.workspace import ArtifactStage, Workspace
# ===================================================================== consistency
-# (merged from codeverse/languages/urdf/consistency.py, 2026-08-28)
#: this gate's own name — a bare ``GATE`` here was shadowed by the lint section's
#: ``GATE = "lint:urdf"`` 59 lines below when the package became one module (2026-08-28),
#: so every FK finding went out mislabelled until 2026-08-28.
@@ -101,7 +100,6 @@ def check_fk_consistency(robot: Robot, census_links: dict[str, dict[str, Any]],
# ===================================================================== lint
-# (merged from codeverse/languages/urdf/lint.py, 2026-08-28)
GATE = "lint:urdf"
URDF_REL = "src/robot.urdf"
MODEL_REL = "src/model.py"
@@ -444,7 +442,6 @@ def lint_workspace(ws: Workspace) -> GateReport:
# ===================================================================== skeleton
-# (merged from codeverse/languages/urdf/skeleton.py, 2026-08-28)
DEFAULT_EFFORT = 10.0
DEFAULT_VELOCITY = 1.0
@@ -645,7 +642,6 @@ def write_skeleton(ws: Workspace, plan: ArticulatedPlan) -> list[Path]:
# ===================================================================== runtime
-# (merged from codeverse/languages/urdf/runtime.py, 2026-08-28)
WRAPPER = Path(__file__).resolve().parent / "wrappers" / "run_bpy_links.py"
REST_PENETRATION_MAX_M = 0.005
FK_TOL_M = 0.001
diff --git a/harness/codeverse/models/anthropic.py b/harness/codeverse/models/anthropic.py
index 863ecb8e..96024018 100644
--- a/harness/codeverse/models/anthropic.py
+++ b/harness/codeverse/models/anthropic.py
@@ -239,7 +239,6 @@ def parse_content(content: list[Any]) -> tuple[str, list[ToolCallPart], Any, lis
# ===================================================================== anthropic
-# (merged from codeverse/models/anthropic.py, 2026-08-28)
log = logging.getLogger(__name__)
diff --git a/harness/codeverse/models/gemini.py b/harness/codeverse/models/gemini.py
index 1740d3e3..967162fb 100644
--- a/harness/codeverse/models/gemini.py
+++ b/harness/codeverse/models/gemini.py
@@ -284,7 +284,6 @@ def extract_candidate(
# ===================================================================== gemini
-# (merged from codeverse/models/gemini.py, 2026-08-28)
log = logging.getLogger(__name__)
_RETRY_DELAY_RE = re.compile(r"retryDelay['\"]?\s*:\s*['\"]?(\d+(?:\.\d+)?)s")
@@ -743,7 +742,6 @@ class GeminiModel:
# ===================================================================== gemini_image
-# (merged from codeverse/models/gemini_image.py, 2026-08-28)
DEFAULT_IMAGE_MODEL = "gemini-3.1-flash-image"
FALLBACK_IMAGE_MODEL = "gemini-2.5-flash-image"
diff --git a/harness/codeverse/models/openai.py b/harness/codeverse/models/openai.py
index c5eb8047..7143eefe 100644
--- a/harness/codeverse/models/openai.py
+++ b/harness/codeverse/models/openai.py
@@ -196,7 +196,6 @@ def parse_choice(choice: Any) -> tuple[str, list[ToolCallPart], str]:
# ===================================================================== openai
-# (merged from codeverse/models/openai.py, 2026-08-28)
log = logging.getLogger(__name__)
diff --git a/harness/codeverse/models/retry.py b/harness/codeverse/models/retry.py
index feedd830..90117509 100644
--- a/harness/codeverse/models/retry.py
+++ b/harness/codeverse/models/retry.py
@@ -433,7 +433,6 @@ class KeyPool:
# ===================================================================== storm
-# (merged from codeverse/models/storm.py, 2026-08-28)
class StormGate:
"""Shared 503 back-pressure for one model. See the module docstring."""
@@ -564,7 +563,6 @@ def all_gates() -> list[StormGate]:
# ===================================================================== retry
-# (merged from codeverse/models/retry.py, 2026-08-28)
#: the longest ONE logical call may spend being retried, waits and timeouts included.
#: The storm branch used to be bounded only in ATTEMPTS: 60 storm attempts x (a 300 s
#: read timeout + a <=5 s wait) is **5.1 hours** for a single call, though the docstring
@@ -1062,7 +1060,6 @@ def _discard_loser(
# ===================================================================== tokens
-# (merged from codeverse/models/tokens.py, 2026-08-28)
#: longest edge we assume for an image part whose size we do not measure; the
#: harness caps judge payloads at ``Settings.judge.max_px`` = 1024 (docs/COST.md §3)
DEFAULT_IMAGE_PX = 1024
diff --git a/harness/codeverse/orchestrator.py b/harness/codeverse/orchestrator.py
index b1581b9b..73f7acdc 100644
--- a/harness/codeverse/orchestrator.py
+++ b/harness/codeverse/orchestrator.py
@@ -35,7 +35,6 @@ log = logging.getLogger(__name__)
# ===================================================================== state
-# (merged from codeverse/orchestrator/state.py, 2026-08-28)
class StageState(BaseModel):
"""One completed stage: inputs hash + where its result JSON lives."""
@@ -114,7 +113,6 @@ class StateCorrupt(RuntimeError):
# ===================================================================== runner
-# (merged from codeverse/orchestrator/runner.py, 2026-08-28)
T = TypeVar("T")
@@ -217,7 +215,6 @@ def _revive(data: dict[str, Any], model: type[BaseModel] | None, list_of: type[B
# ===================================================================== refine_tasks
-# (merged from codeverse/orchestrator/refine_tasks.py, 2026-08-28)
class RefineTask(BaseModel):
@@ -443,7 +440,6 @@ def _acceptance_target(item: AcceptanceItem, known: dict[str, str]) -> str:
# ===================================================================== rounds
-# (merged from codeverse/orchestrator/rounds.py, 2026-08-28)
StopReason = Literal["pass", "plateau", "budget", "continue", "max_rounds", "judge_unavailable",
"regression", "diminishing_returns"]
@@ -797,7 +793,6 @@ def _build_failed(r: RoundRecord) -> bool:
# ===================================================================== budget
-# (merged from codeverse/orchestrator/budget.py, 2026-08-28)
#: stage label used when a caller does not say where the money went
OTHER_STAGE = "other"
@@ -971,8 +966,8 @@ class BudgetGuard:
"""Adopt a snapshot: money, calls and buckets keep counting; ``start_time``
stays *now*, so ``elapsed_minutes`` is prior ACTIVE seconds plus this session
— never the downtime in between. The ceilings come from the (possibly raised)
- spec budget, so a raised ``--max-usd`` grants exactly the difference, never a
- fresh full cap."""
+ spec budget, so a raised cap (``--max-minutes`` / ``--rounds``) grants exactly
+ the difference, never a fresh full cap."""
with self._lock:
self.spent = snap.spent.model_copy(deep=True)
self.billed_usd = float(snap.billed_usd)
diff --git a/harness/codeverse/proc.py b/harness/codeverse/proc.py
index 0a380213..827eab21 100644
--- a/harness/codeverse/proc.py
+++ b/harness/codeverse/proc.py
@@ -346,8 +346,6 @@ class ManagedProcess:
self._abandoned = _STILL_HELD if _group_alive(self.proc.pid) else _ABANDONED
-
-
# ------------------------------------------------------------------ env scrubbing
#: COPY of the credential patterns in ``agents/cli_common.is_secret_env`` (its sibling —
#: keep the two in sync; tests/core/test_proc.py pins them together). Duplicated because
@@ -511,7 +509,6 @@ def append_jsonl_line(path: Path | str, rec: Any, lock: threading.Lock) -> None:
# ===================================================================== events
-# (merged from codeverse/events.py, 2026-08-28 — same stdlib-leaf layer as proc)
log = logging.getLogger(__name__)
@@ -537,7 +534,6 @@ class EventLog:
# ===================================================================== runlock
-# (merged from codeverse/runlock.py, 2026-08-28 — same stdlib-leaf layer as proc)
#: directory (beside the run dirs, never inside one) holding the flock files
LOCKS_DIR = ".locks"
@@ -652,7 +648,6 @@ def exclusive(run_root: Path | str, *, what: str = "", action: str = "enter") ->
# ===================================================================== fanout
-# (merged from codeverse/fanout.py, 2026-08-28 — same stdlib-leaf layer as proc)
T = TypeVar("T")
R = TypeVar("R")
diff --git a/harness/codeverse/prompts/blender/cookbook.md b/harness/codeverse/prompts/blender/cookbook.md
index 0d54e911..2e812beb 100644
--- a/harness/codeverse/prompts/blender/cookbook.md
+++ b/harness/codeverse/prompts/blender/cookbook.md
@@ -3,7 +3,8 @@
Every snippet below runs as-is in `blender -b --factory-startup` (they are executed in
order by the harness test suite). Z-up, −Y front, meters, PascalCase object names.
Files: `src/model.py` (entry) + `src/parts/<snake>.py` (one `build_<snake>()` per plan part) —
-see "File layout". Use `read_cookbook(section="<heading>")` to fetch one chapter.
+see "File layout". The harness inlines the relevant chapters into your prompts; the full
+file is at `.3dcv/cookbook.md` in your workspace.
## File layout (multi-file: model.py + parts/<snake>.py)
diff --git a/harness/codeverse/prompts/cadquery/cookbook.md b/harness/codeverse/prompts/cadquery/cookbook.md
index 58fa400c..3224255b 100644
--- a/harness/codeverse/prompts/cadquery/cookbook.md
+++ b/harness/codeverse/prompts/cadquery/cookbook.md
@@ -2,7 +2,8 @@
Every snippet runs as-is (the harness test suite executes them in order with plain
`python3`). Z-up, −Y front, meters, PascalCase part names, `result = cq.Assembly`.
-Use `read_cookbook(section="<heading>")` to fetch one chapter.
+The harness inlines the relevant chapters into your prompts; the full file is at
+`.3dcv/cookbook.md` in your workspace.
## Skeleton
diff --git a/harness/codeverse/prompts/catalog.py b/harness/codeverse/prompts/catalog.py
index 90a89fe0..302d89d9 100644
--- a/harness/codeverse/prompts/catalog.py
+++ b/harness/codeverse/prompts/catalog.py
@@ -20,11 +20,7 @@ A file that tries to be both is the thing this split exists to prevent.
from __future__ import annotations
-from dataclasses import dataclass
-from pathlib import Path
-
from codeverse.contracts.common import Language
-from codeverse.prompts import PROMPTS_DIR, load_text
#: ``Language.URDF_BLENDER`` is ``"urdf_blender"``; its prompts live in ``prompts/urdf/``.
#: THE mapping — importing this is the only supported way to ask.
@@ -34,36 +30,3 @@ PROMPT_DIRS: dict[Language, str] = {Language.URDF_BLENDER: "urdf"}
def prompt_dir_for(language: Language) -> str:
return PROMPT_DIRS.get(language, language.value)
-
-@dataclass(frozen=True)
-class LanguagePrompts:
- """The four per-language pieces, and how each is delivered.
-
- ``system`` and ``contract`` are sent WHOLE in every generating message; ``cookbook``
- is sent whole in the round prompt and also copied to ``<ws>/.3dcv/cookbook.md`` so an
- agent session can re-read it without spending a turn. None of them is truncated —
- delivering a byte prefix of material we wrote for the model was removed 2026-08-28.
- """
-
- language: Language
- dir: str
-
- @property
- def root(self) -> Path:
- return PROMPTS_DIR / self.dir
-
- def system(self, *, variant: str = "") -> str:
- return load_text(f"{self.dir}/system{variant}.md").strip()
-
- def contract(self) -> str:
- return load_text(f"{self.dir}/contract.md")
-
- def cookbook(self) -> str:
- return load_text(f"{self.dir}/cookbook.md")
-
- def cookbook_rel(self) -> str:
- return f"{self.dir}/cookbook.md"
-
-
-def prompts_for(language: Language) -> LanguagePrompts:
- return LanguagePrompts(language=language, dir=prompt_dir_for(language))
diff --git a/harness/codeverse/prompts/scene_threejs/cookbook.md b/harness/codeverse/prompts/scene_threejs/cookbook.md
index 0344325a..3a106beb 100644
--- a/harness/codeverse/prompts/scene_threejs/cookbook.md
+++ b/harness/codeverse/prompts/scene_threejs/cookbook.md
@@ -3,8 +3,8 @@
Every `js` snippet runs as-is in node (the harness test suite concatenates them with
`THREE` and the named addons in scope). Y-up, +Z front, meters. GLSL lives in
`glsl_cookbook.md` — use its `makeShaderMaterial` for every custom shader.
-Use `read_cookbook(section="<heading>")` for one chapter — reading the whole file
-truncates at 6000 characters, so ask for chapters by name.
+The harness inlines the relevant chapters into your prompts; the full file is at
+`.3dcv/cookbook.md` in your workspace.
**The chapters that decide the score.** Scenes on this track lose most of their points to
five repeatable defects, one chapter each:
diff --git a/harness/codeverse/prompts/threejs/cookbook.md b/harness/codeverse/prompts/threejs/cookbook.md
index d0fb4507..ec0b2f82 100644
--- a/harness/codeverse/prompts/threejs/cookbook.md
+++ b/harness/codeverse/prompts/threejs/cookbook.md
@@ -2,7 +2,8 @@
Every `js` snippet runs as-is in node (the harness test suite concatenates them with
`THREE`, `mergeGeometries` and `RoundedBoxGeometry` in scope). Y-up, +Z front, meters,
-PascalCase Group names. Use `read_cookbook(section="<heading>")` for one chapter.
+PascalCase Group names. The harness inlines the relevant chapters into your prompts;
+the full file is at `.3dcv/cookbook.md` in your workspace.
## Module structure (skeleton)
diff --git a/harness/codeverse/prompts/urdf/cookbook.md b/harness/codeverse/prompts/urdf/cookbook.md
index 0ddb018c..6b9e9cd7 100644
--- a/harness/codeverse/prompts/urdf/cookbook.md
+++ b/harness/codeverse/prompts/urdf/cookbook.md
@@ -2,7 +2,8 @@
Every `python` snippet runs as-is in `blender -b --factory-startup`; every `xml` snippet is
valid URDF (the harness test suite checks both). Z-up, −Y front, meters, radians.
-Use `read_cookbook(section="<heading>")` for one chapter.
+The harness inlines the relevant chapters into your prompts; the full file is at
+`.3dcv/cookbook.md` in your workspace.
## The frame recipe (memorise this, it is the whole trick)
diff --git a/harness/codeverse/reference.py b/harness/codeverse/reference.py
index 8c26231f..fcf9bd7e 100644
--- a/harness/codeverse/reference.py
+++ b/harness/codeverse/reference.py
@@ -47,7 +47,6 @@ log = logging.getLogger(__name__)
# ===================================================================== types
-# (merged from codeverse/reference/types.py, 2026-08-28)
#: The note stamped on every synthesized ``ReferenceImage``. It travels into the
#: planner prompt label, the generator's reference note, the judge's image label
#: and ``spec.json`` — so nothing downstream can mistake it for ground truth.
@@ -220,7 +219,6 @@ class ReferenceDiff(BaseModel):
# ===================================================================== spec_text
-# (merged from codeverse/reference/spec_text.py, 2026-08-28)
def brief_text(spec: Spec) -> str:
"""Prompt + the constraints a photograph could show, as one block."""
lines = [spec.prompt.strip()]
@@ -262,7 +260,6 @@ def visual_constraints(spec: Spec) -> str:
# ===================================================================== prompts
-# (merged from codeverse/reference/prompts.py, 2026-08-28)
# --------------------------------------------------------------------------- image prompt writer
IMAGE_PROMPT_SYSTEM = (
"You write prompts for a text-to-image model. You are given a 3D modelling brief. Your job is to "
@@ -385,7 +382,6 @@ Rules:
# ===================================================================== cache
-# (merged from codeverse/reference/cache.py, 2026-08-28)
CACHE_SUBDIR = "references"
@@ -443,7 +439,6 @@ def image_dir(key: str, *, cache_dir: Path | None = None) -> Path:
# ===================================================================== proportions
-# (merged from codeverse/reference/proportions.py, 2026-08-28)
#: relative aspect disagreement above which the picture's proportions are not a target
ASPECT_TOL = 0.25
@@ -524,7 +519,6 @@ def conflict_note(info: dict[str, Any]) -> str:
# ===================================================================== gate
-# (merged from codeverse/reference/gate.py, 2026-08-28)
class GateAnswer(BaseModel):
@@ -613,7 +607,6 @@ def check_plausible(
# ===================================================================== attach
-# (merged from codeverse/reference/attach.py, 2026-08-28)
def has_user_references(spec: Spec) -> bool:
"""True when the user supplied their own reference image(s) (``--image``)."""
return any(not is_synthetic(r) for r in spec.references)
@@ -664,7 +657,6 @@ def attach(spec: Spec, refset: ReferenceSet) -> tuple[Spec, str]:
# ===================================================================== synth
-# (merged from codeverse/reference/synth.py, 2026-08-28)
MAX_VIEWS = len(VIEW_ORDER)
DEFAULT_SIZE = 1024
@@ -818,7 +810,6 @@ def _publish(rs: ReferenceSet, out_dir: Path | None) -> ReferenceSet:
# ===================================================================== mismatch
-# (merged from codeverse/reference/mismatch.py, 2026-08-28)
MAX_MISMATCHES = 6
#: how many mismatches become refine tasks
@@ -918,7 +909,6 @@ def refine_tasks(diff: ReferenceDiff, *, top: int = TOP_TASKS) -> list[Any]:
# ===================================================================== run
-# (merged from codeverse/reference/run.py, 2026-08-28)
ARTIFACT_SUBDIR = "reference"
diff --git a/harness/codeverse/skills/cv3d-blender-forms/SKILL.md b/harness/codeverse/skills/cv3d-blender-forms/SKILL.md
index a65392a6..a714c398 100644
--- a/harness/codeverse/skills/cv3d-blender-forms/SKILL.md
+++ b/harness/codeverse/skills/cv3d-blender-forms/SKILL.md
@@ -46,8 +46,8 @@ start from "what primitive is nearest".
| smooth organic body with sharp seams | SUBSURF plus edge creases | subsurf shrinks the part: measured on Blender 5.0.1 a subsurfed cube loses **16%** of every extent, a 32-segment cylinder 4-6%. The exporter applies it, so the contract gate sees the shrunk size |
| beam between two points | build along one axis, then place from the endpoints | do **not** rotate a cylinder with Euler angles; see `references/form-recipes.md` |
-Code for every row: `read_cookbook(section="Modifiers")`, `"Screw and lathe"`,
-`"Curves"`, `"Deformation"`, `"Boolean detailing"`, `"Parametric repetition"`.
+Code for every row: the cookbook section "Modifiers", and "Screw and lathe",
+"Curves", "Deformation", "Boolean detailing", "Parametric repetition".
## The five traps, with counts
diff --git a/harness/codeverse/skills/cv3d-blender-forms/references/form-recipes.md b/harness/codeverse/skills/cv3d-blender-forms/references/form-recipes.md
index 3af7df11..cd41a48b 100644
--- a/harness/codeverse/skills/cv3d-blender-forms/references/form-recipes.md
+++ b/harness/codeverse/skills/cv3d-blender-forms/references/form-recipes.md
@@ -3,7 +3,7 @@
Companion to `cv3d-blender-forms`. Every snippet was written against the harness's own
runtime (Blender 5.0.1, `blender -b --factory-startup`, no operator context you did not
create yourself) and uses only the allowed imports. Longer copyable code lives in the
-cookbook: `read_cookbook(section="Modifiers")` and friends.
+cookbook section "Modifiers" and friends.
## 1. A beam between two world points (instead of rotating a cylinder)
diff --git a/harness/codeverse/skills/cv3d-scene-composition/SKILL.md b/harness/codeverse/skills/cv3d-scene-composition/SKILL.md
index 645cbdaa..4b25de88 100644
--- a/harness/codeverse/skills/cv3d-scene-composition/SKILL.md
+++ b/harness/codeverse/skills/cv3d-scene-composition/SKILL.md
@@ -111,15 +111,15 @@ fog colour == the sky's horizon colour // or the ground ends AT the s
Solid shapes, never plane billboards, and never hand-tint the ring toward the fog colour —
`scene.fog` already does that by distance, and doing it twice produces the pale cardboard
-the judge grades as a placeholder material. Code: `read_cookbook(section="Horizon: the world
-must not end")` and `read_cookbook(section="Atmosphere: time-of-day triads with numbers")`
+the judge grades as a placeholder material. Code: the cookbook section "Horizon: the world
+must not end" and the cookbook section "Atmosphere: time-of-day triads with numbers"
for the fog row.
## What you have already been given, and what you have not
`env` sessions receive the *Ground that reads real*, *Horizon*, *Atmosphere* and *Dusk /
night lighting* chapters inlined in the prompt. **Zone, compose and refine sessions do
-not** — if you own a zone or the camera list, this skill plus `read_cookbook` is the whole
+not** — if you own a zone or the camera list, this skill plus the cookbook is the whole
of your guidance on the horizon and on camera placement.
## Verify before you finish
diff --git a/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md b/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md
index da74ad99..3252bc6b 100644
--- a/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md
+++ b/harness/codeverse/skills/cv3d-threejs-forms/SKILL.md
@@ -131,6 +131,6 @@ belong to `cv3d-part-contact`.
`references/form_recipes.md` — a runnable snippet per form word, including the
cavity and shell profiles that replace the boolean you do not have.
-Longer code lives in the cookbook — `read_cookbook` with section "Geometry
-toolkit", "Detail (how to look good cheaply)", "Density: visual complexity
+Longer code lives in the cookbook — the cookbook section "Geometry
+toolkit", and "Detail (how to look good cheaply)", "Density: visual complexity
without hand-modelling every screw" or "Raw BufferGeometry and a spoked wheel".
diff --git a/harness/codeverse/skills/model.py b/harness/codeverse/skills/model.py
index 7db64445..e53fcb6a 100644
--- a/harness/codeverse/skills/model.py
+++ b/harness/codeverse/skills/model.py
@@ -118,7 +118,6 @@ class SkillsMaterialized(BaseModel):
# ===================================================================== loader
-# (merged from codeverse/skills/loader.py, 2026-08-28)
log = logging.getLogger(__name__)
SKILL_FILE = "SKILL.md"
diff --git a/harness/codeverse/skills/prompting.py b/harness/codeverse/skills/prompting.py
index c7556d04..f6d8d581 100644
--- a/harness/codeverse/skills/prompting.py
+++ b/harness/codeverse/skills/prompting.py
@@ -81,7 +81,6 @@ def known_backends() -> tuple[str, ...]:
# ===================================================================== prompting
-# (merged from codeverse/skills/prompting.py, 2026-08-28)
#: Per-backend policy lives in ONE place (``skills/delivery.py``); these are re-exported so
#: existing importers keep working and so nothing here re-derives what a backend needs.
NATIVE_LOADERS = tuple(k for k in known_backends() if delivery_for(k).native_loader)
diff --git a/harness/codeverse/skills/registry.py b/harness/codeverse/skills/registry.py
index 5999e33e..78035ef4 100644
--- a/harness/codeverse/skills/registry.py
+++ b/harness/codeverse/skills/registry.py
@@ -242,7 +242,6 @@ ROUTED_SKILLS: tuple[str, ...] = tuple(dict.fromkeys(r.skill for r in ROUTES))
# ===================================================================== router
-# (merged from codeverse/skills/router.py, 2026-08-28)
log = logging.getLogger(__name__)
#: plan-derived booleans/ints the table may test. Kept here (not on the Plan contracts)
diff --git a/harness/codeverse/skills/targets.py b/harness/codeverse/skills/targets.py
index 107a5555..b562e8cc 100644
--- a/harness/codeverse/skills/targets.py
+++ b/harness/codeverse/skills/targets.py
@@ -256,7 +256,6 @@ def gate_kinds_claimed() -> frozenset[str]:
# ===================================================================== claims
-# (merged from codeverse/skills/claims.py, 2026-08-28)
CLAIMS_DIR = "_claims"
diff --git a/harness/codeverse/spatial/tools.py b/harness/codeverse/spatial/tools.py
index 99258781..ec2c131f 100644
--- a/harness/codeverse/spatial/tools.py
+++ b/harness/codeverse/spatial/tools.py
@@ -279,8 +279,6 @@ def cross_section(ctx: ToolContext, args: CrossSectionArgs) -> Observation:
# register the cookbook reader (the other tool modules merged in, 2026-08-28)
# ===================================================================== tools_render
-# (merged from codeverse/spatial/tools_render.py, 2026-08-28 — its one importer was the
-# registration block at the bottom of this file)
_DEFAULT_VIEWS = [v.name for v in OBJECT_VIEWS_QUICK]
_MAX_SIZE = 1024
@@ -381,8 +379,6 @@ def compare_silhouette(ctx: ToolContext, args: CompareSilhouetteArgs) -> Observa
# ===================================================================== tools_scene
-# (merged from codeverse/spatial/tools_scene.py, 2026-08-28 — its one importer was the
-# registration block at the bottom of this file)
def _as_observation(result: Any, root, *, title: str) -> Observation:
"""Normalise whatever a sibling returns (Observation / GateReport / RenderSet / dict / str)."""
if isinstance(result, Observation):
@@ -515,8 +511,6 @@ def check_placement(ctx: ToolContext, args: CheckPlacementArgs) -> Observation:
# ===================================================================== tools_graphics
-# (merged from codeverse/spatial/tools_graphics.py, 2026-08-28 — its one importer was the
-# registration block at the bottom of this file)
GRAPHICS_LANGS = (Language.GLSL_SHADER.value, Language.OPENGL_PYTHON.value)
MAX_FRAMES = 8
@@ -625,8 +619,6 @@ def gl_frames(ctx: ToolContext, args: GlFramesArgs) -> Observation:
# ===================================================================== tools_texture
-# (merged from codeverse/spatial/tools_texture.py, 2026-08-28 — its one importer was the
-# registration block at the bottom of this file)
_OBJECT_TRACKS = (Track.STATIC_OBJECT.value, Track.ARTICULATED_OBJECT.value)
@@ -710,8 +702,6 @@ def texture_preview(ctx: ToolContext, args: TexturePreviewArgs) -> Observation:
# ===================================================================== tools_reference
-# (merged from codeverse/spatial/tools_reference.py, 2026-08-28 — its one importer was the
-# registration block at the bottom of this file)
#: what the agent should compare, in the order that decides whether the object
#: reads as the real thing (identity before polish)
CHECKLIST = (
diff --git a/harness/codeverse/texturing/apply.py b/harness/codeverse/texturing/apply.py
index b0eb548e..4ebefd86 100644
--- a/harness/codeverse/texturing/apply.py
+++ b/harness/codeverse/texturing/apply.py
@@ -154,7 +154,6 @@ def is_flat(img: Image.Image, *, tol: float = 0.01) -> bool:
# ===================================================================== uv
-# (merged from codeverse/texturing/uv.py, 2026-08-28)
#: long/mid extent ratio above which ``auto`` picks a cylinder projection ...
CYLINDER_ASPECT = 2.5
#: ... provided the cross-section is roughly round (mid/min below this); slabs → box
@@ -318,7 +317,6 @@ def unwrap(
# ===================================================================== apply
-# (merged from codeverse/texturing/apply.py, 2026-08-28)
log = logging.getLogger(__name__)
@@ -507,7 +505,6 @@ def textured_summary(glb: Path | str) -> dict[str, int]:
# ===================================================================== normalise
-# (merged from codeverse/texturing/normalise.py, 2026-08-28)
class MaterialChange(BaseModel):
diff --git a/harness/codeverse/texturing/generate.py b/harness/codeverse/texturing/generate.py
index e0816692..021807f3 100644
--- a/harness/codeverse/texturing/generate.py
+++ b/harness/codeverse/texturing/generate.py
@@ -135,7 +135,6 @@ def tile_preview(img: Image.Image, reps: int = 2, size: int = 512) -> Image.Imag
# ===================================================================== generate
-# (merged from codeverse/texturing/generate.py, 2026-08-28)
log = logging.getLogger(__name__)
#: bump when the cached raw image semantics change (prompt composition, model config)
@@ -335,7 +334,6 @@ def generate_textures(
# ===================================================================== gate
-# (merged from codeverse/texturing/gate.py, 2026-08-28)
MIN_OVERALL_DELTA = -0.01
MIN_MATERIALS_DELTA = 0.0
diff --git a/harness/codeverse/texturing/plan.py b/harness/codeverse/texturing/plan.py
index 29b72736..9b3d463e 100644
--- a/harness/codeverse/texturing/plan.py
+++ b/harness/codeverse/texturing/plan.py
@@ -345,7 +345,6 @@ def plan_table(tp: TexturePlan) -> str:
# ===================================================================== scene_pack
-# (merged from codeverse/texturing/scene_pack.py, 2026-08-28)
PACK_TEMPLATE = "texturing/scene_pack.md"
DEFAULT_URL_PREFIX = "/public/textures"
diff --git a/harness/codeverse/tracks/articulated_object.py b/harness/codeverse/tracks/articulated_object.py
index ba79b60f..d9bbbe60 100644
--- a/harness/codeverse/tracks/articulated_object.py
+++ b/harness/codeverse/tracks/articulated_object.py
@@ -160,8 +160,6 @@ def _find_urdf(ws: Workspace) -> Path | None:
# ===================================================================== planned-motion gate
-# (merged from codeverse/tracks/motion.py, 2026-08-28 — its two importers were this file
-# and one lazy Services hook; the byte-identical _find_urdf duplicate died with it)
MOTION_GATE = "motion_direction"
#: phrase → direction key understood by ``spatial.joints.motion_direction_check``.
diff --git a/harness/codeverse/tracks/candidates.py b/harness/codeverse/tracks/candidates.py
index 2a581166..c6ebe7cc 100644
--- a/harness/codeverse/tracks/candidates.py
+++ b/harness/codeverse/tracks/candidates.py
@@ -276,7 +276,6 @@ def adopt_candidate(ctx: RunContext, sub_ws: Workspace) -> None:
shutil.copytree(sub_ws.trajectories, ctx.ws.trajectories, dirs_exist_ok=True)
-
# ----------------------------------------------------------------------------- best round (pairwise tie-break)
def choose_best_round(ctx: RunContext, rounds: list[RoundRecord], selector: BestSelector, new_index: int) -> int | None:
"""Index of the best round after ``rounds[new_index]`` finished.
@@ -324,8 +323,6 @@ __all__ = ["CAND_DIR", "adopt_candidate", "choose_best_round", "make_candidate_c
# ===================================================================== decision logic
-# (merged from codeverse/orchestrator/candidates.py, 2026-08-28 — this file was its
-# only production importer, and two candidates.py in sibling packages was a hazard)
class CandidateRecord(BaseModel):
"""One best-of-N baseline candidate (generated in its own sub-workspace)."""
diff --git a/harness/codeverse/tracks/common.py b/harness/codeverse/tracks/common.py
index 093b261c..48e7bf92 100644
--- a/harness/codeverse/tracks/common.py
+++ b/harness/codeverse/tracks/common.py
@@ -9,7 +9,6 @@ missing; tests subclass it with fakes. Nothing here touches a network.
from __future__ import annotations
import logging
-import os
from collections.abc import Sequence
from dataclasses import dataclass, field
from pathlib import Path
@@ -247,9 +246,7 @@ def cookbook_rel_for(language: Language) -> str:
"""prompts/<dir>/cookbook.md. ``language.value`` is NOT always the directory:
urdf_blender's prompts live in prompts/urdf/, so this returned a path that does not
exist and the articulated agent was told "No cookbook is available in this session"
- while its 24 063-character cookbook sat on disk. A/B'd behind CV3D_URDF_COOKBOOK
- before being made unconditional, because it changes the prompt."""
- if language is Language.URDF_BLENDER and os.environ.get("CV3D_URDF_COOKBOOK", "0") == "0":
- return f"{language.value}/cookbook.md" # arm A: today's behaviour (misses)
+ while its 24 063-character cookbook sat on disk. Unconditional since 2026-08-29
+ (the CV3D_URDF_COOKBOOK A/B switch is gone): every run gets the real cookbook."""
return f"{prompt_dir_for(language)}/cookbook.md"
diff --git a/harness/codeverse/tracks/graphics.py b/harness/codeverse/tracks/graphics.py
index 15ee782a..1be5645b 100644
--- a/harness/codeverse/tracks/graphics.py
+++ b/harness/codeverse/tracks/graphics.py
@@ -60,16 +60,6 @@ log = logging.getLogger(__name__)
# ===================================================================== recipe seeding
-# (merged from codeverse/tracks/graphics_recipes.py, 2026-08-28 — its two importers
-# were this track and graphics_steps. Original module rationale:
-# Seed the cookbook's verified GLSL recipes into the HARNESS-OWNED ``src/recipes.glsl`` BEFORE the session.
-#
-# Measured 2026-08-26 (refs_v2_graphics, aurora brief, gemini-3.7-flash api-agent, shader_v2 judge): the
-# baseline prompt carried the cookbook's "Light phenomena" chapter — five mentions of ``curtain(`` in
-# ``trajectories/baseline_r00/prompt.md`` — and the agent called none of them (``grep -c "curtain("
-# src/shader.frag`` = 0 in both finished runs): round 0 was again a comb of bars (``comb_artefact``, 0.33).
-# Showing flash a recipe is not the same as flash using it, so the recipes go ON DISK.
-# ... see git history of graphics_recipes.py for the full measured writeup.)
#: the harness-owned recipe file (``contracts.common.HARNESS_OWNED_SRC``; ``AgentJob.read_only``)
RECIPES_REL = HARNESS_OWNED_SRC[Language.GLSL_SHADER][0]
#: the agent's helper file — never written by this module, except :func:`trim_skeleton_common`
@@ -291,7 +281,6 @@ def seed_recipes(ctx: RunContext) -> list[str]:
# ===================================================================== planner hooks + prompt context + frames
-# (merged from codeverse/tracks/graphics_steps.py, 2026-08-28 — single production importer)
PLAN_TEMPLATE = "tracks/plan_graphics.j2"
PLAN_TEMPERATURE = 0.5
PLAN_MAX_OUTPUT_TOKENS = 65_536 # the model's declared output ceiling; unused tokens cost nothing
diff --git a/harness/codeverse/tracks/lifecycle.py b/harness/codeverse/tracks/lifecycle.py
index 1ae0706d..021e1347 100644
--- a/harness/codeverse/tracks/lifecycle.py
+++ b/harness/codeverse/tracks/lifecycle.py
@@ -106,11 +106,15 @@ def _reconcile_billed_from_ledger(budget: BudgetGuard, ws: Workspace, events: Ev
from the ledger. Taking the larger of the two makes resume charge for everything
the provider actually billed — silently under-counting is how a resumed run walks
past its ceiling. Attempt rows stay excluded (the winner is already on the logical
- row); a missing or unreadable ledger simply leaves the snapshot alone."""
+ row), and so do subscription-backend rows: their ``cost_usd`` is notional, not money
+ (the same ``bills_usd`` predicate the live path uses — ``BudgetGuard.spend``), so a
+ codex/claude/agy run resumed offline keeps billed at $0. A missing or unreadable
+ ledger simply leaves the snapshot alone."""
try:
+ from codeverse.cost.billing import bills_usd
from codeverse.cost.ledger import load_ledger
- billed = sum(float(r.cost_usd or 0.0) for r in load_ledger(ws.root))
+ billed = sum(float(r.cost_usd or 0.0) for r in load_ledger(ws.root) if bills_usd(r.backend))
except Exception as e: # noqa: BLE001 — accounting repair must never block a resume
log.debug("ledger reconcile skipped: %s", e)
return
@@ -502,7 +506,8 @@ class BaseTrack:
snap = state.extra.get("budget_snapshot")
if snap:
# full guard state: money, calls, buckets AND active minutes keep counting,
- # so a raised --max-usd grants only the difference, never a fresh full cap.
+ # so a raised cap (--max-minutes / --rounds) grants only the difference,
+ # never a fresh full cap.
budget.restore(BudgetSnapshot.model_validate(snap))
else:
spent = state.extra.get("spent_usage") # legacy run dirs (pre-snapshot)
diff --git a/harness/codeverse/tracks/plan_features.py b/harness/codeverse/tracks/plan_features.py
index d9d1377b..8dc49575 100644
--- a/harness/codeverse/tracks/plan_features.py
+++ b/harness/codeverse/tracks/plan_features.py
@@ -80,10 +80,6 @@ LIVE_SWITCHES: dict[str, str] = {
# inter-chunk stall detection, and the IPv4-only transport. Read at call time
# by every gemini request, so a control arm can set either to 0.
"CV3D_STREAM": "codeverse/models/gemini.py",
- #: urdf_blender resolved its cookbook path from language.value ("urdf_blender")
- #: while its prompts live in prompts/urdf/, so the articulated agent got NO
- #: cookbook at all. On = the fixed mapping; A/B before making it unconditional.
- "CV3D_URDF_COOKBOOK": "codeverse/tracks/common.py",
#: v0 = the pre-2026-08-28 two-sentence system prompt; unset = the per-language one.
#: Temporary, for the A/B; remove with the system_v0.md files once it has an answer.
"CV3D_SYSPROMPT": "codeverse/tracks/prompting.py",
diff --git a/harness/codeverse/tracks/planner.py b/harness/codeverse/tracks/planner.py
index c23814e8..9da44384 100644
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@ -43,8 +43,6 @@ log = logging.getLogger(__name__)
# ===================================================================== the brief
-# (merged from codeverse/tracks/brief.py, 2026-08-28 — this module was its only
-# production importer; three files described one hand-off)
#: env switch: ``off``/``0``/``false`` disables brief expansion for the run
BRIEF_ENV = "CV3D_PLAN_BRIEF"
#: tracks the object-shaped brief applies to (graphics/scene get budgets only)
@@ -211,7 +209,6 @@ def brief_block(brief: EngineeringBrief | None) -> str:
# ===================================================================== plan budgets
-# (merged from codeverse/tracks/plan_budget.py, 2026-08-28 — same reason)
#: practical ceiling on TOP-LEVEL plan parts per language. Blender/three.js own one
#: file per part so they scale; cadquery is one file; urdf links cost a joint each and
#: the collision sweep is O(links² × poses), so depth there goes into sub-parts.
@@ -489,7 +486,6 @@ def enrich_plan(plan_obj: Any, brief: EngineeringBrief | None) -> Any:
# ===================================================================== worked examples
-# (merged from codeverse/tracks/plan_examples.py, 2026-08-28 — same reason)
def plan_example(track: Track) -> dict[str, Any]:
"""Compact, valid worked example per track (concrete beats abstract)."""
if track is Track.SCENE:
diff --git a/harness/codeverse/tracks/scene_assets.py b/harness/codeverse/tracks/scene_assets.py
index ec3efb6f..09457351 100644
--- a/harness/codeverse/tracks/scene_assets.py
+++ b/harness/codeverse/tracks/scene_assets.py
@@ -429,7 +429,7 @@ def _read(ws: Workspace, rel: str, limit: int = 30_000) -> str:
# ===================================================================== cheap asset generation
-# (merged from codeverse/tracks/scene_asset_gen.py, 2026-08-28 — single-shot + check +
+# (single-shot + check +
# dedupe were only ever called from this stage and from scene.py)
#: max triangles for ONE asset instance (the scene contract's budget)
ASSET_MAX_TRIS = 15_000
diff --git a/harness/codeverse/tracks/static_object.py b/harness/codeverse/tracks/static_object.py
index 468128c5..32d098c7 100644
--- a/harness/codeverse/tracks/static_object.py
+++ b/harness/codeverse/tracks/static_object.py
@@ -427,7 +427,6 @@ class StaticObjectTrack(BaseTrack):
# ===================================================================== the DETAIL round
-# (merged from codeverse/tracks/detailing.py, 2026-08-28 — this file was its only importer)
# --------------------------------------------------------------------------- detail-round drift gate
DRIFT_GATE = "detail_drift"
@@ -572,8 +571,6 @@ def detail_instructions(last: Any, *, max_lines: int = 8) -> list[str]:
# ===================================================================== reference images
-# (merged from codeverse/tracks/reference.py, 2026-08-28 — this file was its only importer,
-# and nothing else, tests included, ever imported it)
SILHOUETTE_GATE = "reference_silhouette"
IOU_REFINE_THRESHOLD = 0.6
FRONT_VIEW_NAMES: tuple[str, ...] = ("front", "front_right_34", "front_left_34")
diff --git a/harness/docs/report.html b/harness/docs/report.html
index df5657ae..2fc12bad 100644
--- a/harness/docs/report.html
+++ b/harness/docs/report.html
@@ -317,7 +317,7 @@ tr.hl td.arm{font-weight:600}
<tr><td class="arm">resume corrupted<br>finished runs</td><td>No terminal-state guard: resuming a completed run re-billed the plan stage and overwrote <code>passed</code> with <code>planning</code>, leaving it stuck. Separately, an unreadable cached stage bricked resume permanently.</td></tr>
<tr><td class="arm">parquet dropped the<br>complexity columns</td><td>The flywheel's dataset silently shipped without the objective complexity vector — the metrics the whole complexity study depends on.</td></tr>
<tr><td class="arm">one CV3D_JUDGE__* var<br>disabled the profile</td><td>Setting a single judge field discarded the profile's entire judge block.</td></tr>
- <tr><td class="arm">a NUL from the model<br>reached an argv</td><td>A planner wrote <code></code> where it meant <code>×</code> and <code>±</code>. Legal JSON, so it passed the parser, pydantic and <code>plan.json</code> — then killed all four generation tasks of a cell inside <code>subprocess.Popen</code> with an error naming no file, no field and no value.</td></tr>
+ <tr><td class="arm">a NUL from the model<br>reached an argv</td><td>A planner wrote <code>\x00</code> where it meant <code>×</code> and <code>±</code>. Legal JSON, so it passed the parser, pydantic and <code>plan.json</code> — then killed all four generation tasks of a cell inside <code>subprocess.Popen</code> with an error naming no file, no field and no value.</td></tr>
</tbody>
</table></div>
<h4>Smoke matrix</h4>
diff --git a/harness/tests/compare_bench/test_ab_plan.py b/harness/tests/compare_bench/test_ab_plan.py
index e9978077..f811977c 100644
--- a/harness/tests/compare_bench/test_ab_plan.py
+++ b/harness/tests/compare_bench/test_ab_plan.py
@@ -487,3 +487,14 @@ def test_a_pinned_plan_that_dies_in_a_storm_records_the_pair_and_continues(tmp_p
assert {r.arm for r in first} == {CONTROL, VARIANT} and all(r.status == "infra_failed" for r in first)
assert all("pinned plan" in r.error for r in first)
assert [c[0] for c in fake.calls] == [ids[1], ids[1]], "no cell was spent on the dead pair; the next prompt ran"
+
+
+def test_max_usd_flag_was_deleted(capsys):
+ """The money ceiling left the harness on 2026-08-28: the flag must be rejected,
+ not silently parsed into nothing."""
+ with pytest.raises(SystemExit):
+ main(["--help"])
+ assert "--max-usd" not in capsys.readouterr().out
+ with pytest.raises(SystemExit):
+ main(["--prompts", "p.yaml", "--out", "o", "--max-usd", "2.5"])
+ assert "error" in capsys.readouterr().err
diff --git a/harness/tests/compare_bench/test_compare_matrix.py b/harness/tests/compare_bench/test_compare_matrix.py
index c8f02fff..d776c3a9 100644
--- a/harness/tests/compare_bench/test_compare_matrix.py
+++ b/harness/tests/compare_bench/test_compare_matrix.py
@@ -267,3 +267,12 @@ def test_every_cell_and_its_harness_run_open_a_ledger(tmp_path: Path):
oneshot = cells["oneshot:claude-code"]
assert not (oneshot / "run").exists()
assert [r.label for r in load_ledger(oneshot)] == ["judge:static_object_v1:r00:s0"]
+
+
+def test_max_usd_flag_was_deleted(capsys):
+ """The money ceiling left the harness on 2026-08-28: the flag must be rejected,
+ not silently parsed into nothing."""
+ with pytest.raises(SystemExit):
+ main(["--prompts", "x.yaml", "--arms", "harness:gemini-cli:m", "--out", "o",
+ "--max-usd", "2.5"])
+ assert "--max-usd" in capsys.readouterr().err
diff --git a/harness/tests/compare_bench/test_oneshot.py b/harness/tests/compare_bench/test_oneshot.py
index 30d28df7..47f4944b 100644
--- a/harness/tests/compare_bench/test_oneshot.py
+++ b/harness/tests/compare_bench/test_oneshot.py
@@ -21,7 +21,6 @@ from bench._oneshot import ( # noqa: E402
minimal_contract,
oneshot_prompt,
repair_prompt,
- write_model_file,
)
from codeverse.contracts.artifacts import BuildResult, GateReport # noqa: E402
from codeverse.contracts.common import Language, Track # noqa: E402
@@ -65,11 +64,6 @@ def test_extract_model_file_rejects_prose():
extract_model_file("Sorry, I cannot do that.")
-def test_write_model_file(tmp_ws):
- p = write_model_file(tmp_ws, "```python\nimport bpy\n```")
- assert p == tmp_ws.root / MODEL_FILE and p.read_text() == "import bpy\n"
-
-
def test_claude_argv_disables_tools_and_is_single_turn():
argv = ClaudeOneShot("", binary="claude").argv("PROMPT")
assert argv[:3] == ["claude", "-p", "PROMPT"]
diff --git a/harness/tests/core/test_contract_additions.py b/harness/tests/core/test_contract_additions.py
index 5aaefd1c..11827843 100644
--- a/harness/tests/core/test_contract_additions.py
+++ b/harness/tests/core/test_contract_additions.py
@@ -40,21 +40,6 @@ def test_entry_file_and_labels_cover_every_language():
assert code_file(Language.GLSL_SHADER) == "code.frag"
-def test_registries_agree_with_legacy_flywheel_tables():
- """Drift guard while the legacy tables still exist (they adopt these later)."""
- import codeverse.flywheel.sample as sample
-
- legacy_entry = getattr(sample, "ENTRY_BY_LANGUAGE", None)
- if legacy_entry is not None:
- assert legacy_entry == ENTRY_FILE
- legacy_code = getattr(sample, "CODE_FILE_BY_LANGUAGE", None)
- if legacy_code is not None:
- assert legacy_code == {lang: code_file(lang) for lang in Language}
- legacy_label = getattr(sample, "TYPE_LABEL", None)
- if legacy_label is not None:
- assert legacy_label == {t: TRACK_INFO[t].label for t in Track}
-
-
def test_language_frame_covers_every_language():
from codeverse.conventions import LANGUAGE_FRAME, Frame
diff --git a/harness/tests/core/test_contracts.py b/harness/tests/core/test_contracts.py
index 0c96adbe..83d7c734 100644
--- a/harness/tests/core/test_contracts.py
+++ b/harness/tests/core/test_contracts.py
@@ -116,3 +116,26 @@ def test_workspace_git_roundtrip(tmp_ws):
assert c0 != c1
tmp_ws.restore(c0)
assert (tmp_ws.src / "a.py").read_text() == "x = 1\n"
+
+
+def test_budget_forbids_retired_and_unknown_fields():
+ """The money ceiling was deleted 2026-08-28: a stale caller (or a typo) must raise,
+ never be silently swallowed into a default Budget."""
+ with pytest.raises(ValidationError):
+ Budget(max_usd=1.0)
+ with pytest.raises(ValidationError):
+ Budget(max_minuts=5)
+
+
+def test_recorded_spec_with_retired_budget_key_still_loads():
+ """Pre-deletion runs carry budget.max_usd in spec.json / record.json; the ONE
+ migration point (Spec._strip_retired_budget_keys) drops it before validation, so
+ resume and flywheel reads keep working while Budget stays strict."""
+ import json
+
+ data = {"id": "x", "track": "static_object", "language": "blender", "prompt": "p",
+ "budget": {"max_rounds": 2, "max_minutes": 30.0, "max_usd": 2.5}}
+ s = Spec.model_validate(data)
+ assert s.budget.max_rounds == 2 and not hasattr(s.budget, "max_usd")
+ assert Spec.model_validate_json(json.dumps(data)).budget.max_minutes == 30.0
+ assert data["budget"]["max_usd"] == 2.5, "migration must not mutate the caller's dict"
diff --git a/harness/tests/graphics/test_live.py b/harness/tests/graphics/test_live.py
index aa39079c..91267c32 100644
--- a/harness/tests/graphics/test_live.py
+++ b/harness/tests/graphics/test_live.py
@@ -37,7 +37,7 @@ def test_live_plan_generate_build_judge(tmp_path, keys_ok):
spec = Spec(id="live_gfx", track=Track.GRAPHICS, language=Language.GLSL_SHADER,
prompt="a calm animated aurora borealis over snowy mountains with twinkling stars",
- budget=Budget(max_rounds=1, max_usd=0.5), backends=Backends(planner=MODEL, generator=f"single-shot:{MODEL}", judge=MODEL))
+ budget=Budget(max_rounds=1), backends=Backends(planner=MODEL, generator=f"single-shot:{MODEL}", judge=MODEL))
ws = Workspace(tmp_path / "live_gfx").create()
model = get_chat_model(MODEL)
from codeverse.tracks.planner import plan as run_planner
diff --git a/harness/tests/graphics/test_track.py b/harness/tests/graphics/test_track.py
index ec3c2893..1e5e4c27 100644
--- a/harness/tests/graphics/test_track.py
+++ b/harness/tests/graphics/test_track.py
@@ -41,7 +41,7 @@ STATIC_MARK = "STATIC_FRAMES"
def make_spec(language: Language = Language.GLSL_SHADER, *, generator: str = "fake:fake-model", max_rounds: int = 3) -> Spec:
return Spec(id="g1", track=Track.GRAPHICS, language=language, prompt="animated neon rain on a window with bokeh city lights",
constraints=Constraints(must_have=["bokeh lights"]),
- budget=Budget(max_rounds=max_rounds, max_usd=5.0, max_minutes=10, max_repair_attempts=2),
+ budget=Budget(max_rounds=max_rounds, max_minutes=10, max_repair_attempts=2),
backends=Backends(planner="fake:planner", generator=generator, judge="fake:judge"))
diff --git a/harness/tests/orchestrator_tracks/test_resume_reconcile.py b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
index 9bb3fd65..70bd8a73 100644
--- a/harness/tests/orchestrator_tracks/test_resume_reconcile.py
+++ b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
@@ -243,3 +243,25 @@ def test_resume_charges_for_spend_the_snapshot_missed(tmp_path, chair_plan, sett
guard.billed_usd = 5.0 # a snapshot AHEAD of the ledger wins
_reconcile_billed_from_ledger(guard, ws, EventLog(ws.events_path))
assert guard.billed_usd == pytest.approx(5.0), "reconcile never lowers what was already billed"
+
+
+def test_resume_reconcile_keeps_subscription_spend_notional(tmp_path, settings):
+ """A codex/claude/agy ledger row is priced at list rates but bills $0 (bills_usd):
+ resuming a subscription-backend run offline must not flip billed from $0 to the
+ notional sum — reconcile shares the exact predicate the live spend path uses."""
+ from codeverse.cost.ledger import open_run_ledger
+ from codeverse.cost.types import CallCost
+ from codeverse.orchestrator import BudgetGuard
+ from codeverse.tracks.lifecycle import _reconcile_billed_from_ledger
+
+ ws = Workspace(tmp_path / "runs" / "sub")
+ ws.create()
+ led = open_run_ledger(ws.root)
+ led.append(CallCost(run=ws.root.name, backend="codex", model="gpt-5.6-sol", label="generator", cost_usd=7.7))
+ led.append(CallCost(run=ws.root.name, backend="claude-code", model="sonnet", cost_usd=1.1))
+ guard = BudgetGuard(make_spec().budget, run=ws.root.name)
+ _reconcile_billed_from_ledger(guard, ws, EventLog(ws.events_path))
+ assert guard.billed_usd == 0.0, "subscription cost is notional; resume must keep billed at $0"
+ led.append(CallCost(run=ws.root.name, backend="gemini", model="gemini-3.7-flash", cost_usd=0.25))
+ _reconcile_billed_from_ledger(guard, ws, EventLog(ws.events_path))
+ assert guard.billed_usd == pytest.approx(0.25), "the API-billed row still counts in full"
diff --git a/harness/tests/skills/test_freshness.py b/harness/tests/skills/test_freshness.py
index 58727ca0..8421f8f2 100644
--- a/harness/tests/skills/test_freshness.py
+++ b/harness/tests/skills/test_freshness.py
@@ -9,7 +9,7 @@ vocabulary it merely mentions, which is the part an author can forget to declare
The four vocabularies are checked, not guessed at: harness tool names live in the tool
registry, gate kinds in ``skills.registry``, cookbook sections in the language cookbook
-the ``read_cookbook`` tool actually serves, and constants in the source. Anything from a
+the harness inlines into the prompts, and constants in the source. Anything from a
foreign namespace (bpy, GL, GLSL, three.js) is listed in :data:`FOREIGN` with the library
it belongs to — an allowlist an author has to extend deliberately, so the test keeps
meaning something.
@@ -44,7 +44,8 @@ _GATE_SLUG = re.compile(
#: a snake_case token in backticks is CLAIMED to be a name in this harness. Which live
#: vocabulary it belongs to does not matter — that it belongs to one of them does.
_HARNESS_SHAPED = re.compile(r"^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$")
-_COOKBOOK_SECTION = re.compile(r'read_cookbook\(\s*section\s*=\s*"([^"]+)"')
+#: both spellings: the historical tool call and today's prose pointer
+_COOKBOOK_SECTION = re.compile(r'(?:read_cookbook\(\s*section\s*=\s*"|cookbook sections? ")([^"]+)"')
_ENV = re.compile(r"\bCV3D_[A-Z0-9_]+\b")
#: ALL_CAPS tokens that are NOT ours, with the namespace that owns them. Extend
@@ -129,6 +130,7 @@ FOREIGN_CALLS = {
"abs", "max", "min", "mod", "pow", "sin", "cos", "step", "reflect", "refract",
"transform_apply", "primitive_cube_add", "ensure_lookup_table", "hide_set", "update",
"len", "setup", "range", "print", "float", "int",
+ "clean", # cadquery/trimesh mesh op quoted while teaching welding
# illustrative names inside a bundle's own worked example
"left_wheel", "right_wheel",
# batteries whose results are cited as evidence but whose output dir is gitignored
@@ -162,6 +164,49 @@ def test_every_harness_name_a_bundle_quotes_is_still_a_live_name(doc: Path):
f"contract entry point answers to today")
+_DEF_RE = re.compile(r"^\s*(?:def|function)\s+([a-z_][a-z0-9_]*)\s*\(", re.M)
+
+
+def _defined_callables() -> set[str]:
+ """Every function the harness itself defines — python source plus the cookbooks'
+ fenced snippets (a bundle may tell the agent to call ``radial_array`` by name)."""
+ out: set[str] = set()
+ for root, pattern in ((HARNESS / "codeverse", "*.py"), (HARNESS / "codeverse" / "prompts", "*.md")):
+ for p in root.rglob(pattern):
+ if "__pycache__" not in p.parts:
+ out |= set(_DEF_RE.findall(p.read_text(errors="ignore")))
+ return out
+
+
+LIVE_CALLABLES = _defined_callables()
+
+
[email protected]("doc", DOCS, ids=[str(p.relative_to(skills_dir())) for p in DOCS])
+def test_every_call_a_bundle_instructs_is_a_live_tool_or_known_callable(doc: Path):
+ """``read_cookbook(section=...)`` survived its tool's deletion in four bundles.
+
+ A call-shaped instruction in prose must name a live MCP tool (:data:`LIVE_TOOLS`),
+ a callable the harness still defines, a function the bundle's own worked examples
+ define, or a declared-foreign builtin — never a name only the skill remembers.
+ """
+ text = doc.read_text()
+ bundle = next(d for d in BUNDLES if d == doc.parent or d in doc.parents)
+ corpus = "\n".join(q.read_text() for q in sorted(bundle.rglob("*.md")))
+ fences = "\n".join(_FENCE.findall(corpus))
+ called = set()
+ for tok in _INLINE_CODE.findall(_prose(text)):
+ m = re.match(r"^([a-z][a-z0-9_]*)\(", tok.strip())
+ if m:
+ called.add(m.group(1))
+ unknown = sorted(n for n in called
+ if n not in LIVE_TOOLS and n not in FOREIGN_CALLS
+ and n not in LIVE_CALLABLES and f"{n}(" not in fences)
+ assert unknown == [], (
+ f"{doc.name} instructs calling {unknown} — not a live tool, not a harness "
+ f"callable, not one of its own example functions, and not declared in "
+ f"FOREIGN_CALLS")
+
+
@pytest.mark.parametrize("doc", DOCS, ids=[str(p.relative_to(skills_dir())) for p in DOCS])
def test_every_gate_kind_a_bundle_names_is_a_live_kind(doc: Path):
"""A reworded gate that changes a slug must break here, not silently unroute a sheet."""
diff --git a/harness/tests/spatial_tools/test_mcp_server.py b/harness/tests/spatial_tools/test_mcp_server.py
index e5db0a94..b81b81d5 100644
--- a/harness/tests/spatial_tools/test_mcp_server.py
+++ b/harness/tests/spatial_tools/test_mcp_server.py
@@ -62,8 +62,10 @@ def test_stdio_roundtrip(stool_ctx: ToolContext, tmp_path: Path) -> None:
by_name = {t.name: t for t in tools.tools}
assert "measure" in by_name and "check_connectivity" in by_name
assert by_name["render_views"].input_schema["properties"]["views"]["type"] == "array"
- cb = await s.call_tool("read_cookbook", {"section": "export"})
- assert cb.content and cb.content[0].type == "text"
+ conn = await s.call_tool("check_connectivity", {})
+ assert conn.content and conn.content[0].type == "text"
+ assert "connectivity" in conn.content[0].text # the gate's own header
+ assert "Leg_3" in conn.content[0].text # the fixture's floating leg
meas = await s.call_tool("measure", {})
assert not meas.is_error and "Leg ×4" in meas.content[0].text
sec = await s.call_tool("cross_section", {"axis": "y", "at": 0.5})