Official Codebase of 3DCodeVerse
Python
prompts: one store, one catalog, and the channel nobody used is gone
gaoypeng69f5bfb17b06
diff --git a/harness/codeverse/languages/_docs.py b/harness/codeverse/languages/_docs.pyindex d5f1de0f..fb5f7bd8 100644--- a/harness/codeverse/languages/_docs.py+++ b/harness/codeverse/languages/_docs.py@@ -20,18 +20,18 @@ from pathlib import Pathfrom codeverse.contracts.common import Languagefrom codeverse.prompts import PROMPTS_DIR, load_text+from codeverse.prompts.catalog import PROMPT_DIRS as _PROMPT_DIRS+from codeverse.prompts.catalog import prompt_dir_for as _prompt_dir_for-#: ``Language.URDF_BLENDER`` is ``"urdf_blender"`` but its prompts live in-#: ``prompts/urdf/``. ONE mapping, here — it was written out three more times-#: across spatial/ and tests/, and silently missing in tracks/common.py.-PROMPT_DIRS: dict[Language, str] = {Language.URDF_BLENDER: "urdf"}+#: re-exported for the callers that already import it from here; the mapping itself+#: now lives with the rest of the prompt-resolution policy in prompts/catalog.py.+PROMPT_DIRS = _PROMPT_DIRS#: only reachable if the wheel shipped without its prompt dataMINIMAL_CONTRACT = "Write raw code in the language's native frame; meters; named parts."-def prompt_dir_for(language: Language) -> str:- return PROMPT_DIRS.get(language, language.value)+prompt_dir_for = _prompt_dir_forclass RuntimeDocs:diff --git a/harness/codeverse/prompts/catalog.py b/harness/codeverse/prompts/catalog.pynew file mode 100644index 00000000..90a89fe0--- /dev/null+++ b/harness/codeverse/prompts/catalog.py@@ -0,0 +1,69 @@+"""What prompt material exists, and how each piece reaches the model.++ONE answer to a question that had six. Before this, `<lang>/cookbook.md` was resolved in+`languages/_docs.py`, `tracks/common.py`, `spatial/cookbook_tool.py`, `agents/materialize.py`+and `tracks/scene_assets.py`, each with its own path arithmetic — and the+``urdf_blender`` → ``prompts/urdf/`` mapping was written out three times and missing in a+fourth, which is why the articulated agent received no cookbook at all for weeks.++The split this file encodes (owner, 2026-08-28):++* **PROMPT material** — everything the harness writes and the harness puts in a message.+ It lives here, under ``codeverse/prompts/``, and modules load it on demand through this+ catalog rather than building paths.+* **AGENT-read bundles** — ``codeverse/skills/cv3d-*/`` (SKILL.md + references/ + a+ ``_claims`` file pinning its numbers to live constants). The agent decides to read+ those; the harness only materialises them.++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.+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/sections.py b/harness/codeverse/prompts/sections.pynew file mode 100644index 00000000..f0057593--- /dev/null+++ b/harness/codeverse/prompts/sections.py@@ -0,0 +1,71 @@+"""Split prompt markdown into heading-delimited sections.++Prompt material, so it lives with the prompts. It was in ``spatial/cookbook_tool.py``+next to a ``read_cookbook`` MCP tool that served one chapter at a time — a tool the repo+measured at 0 calls in 16 zone sessions (cli/skills_cmd.py:4) and 0 across every recorded+run, and which had nothing left to do once the whole cookbook started reaching the model+in the prompt (2026-08-28). The tool is gone; the parser stays, because naming a chapter+is how a STAGE says which recipes it needs — scene's env/zone recipes, graphics' recipe+seeding, repair's error-matched section.+"""++from __future__ import annotations++import re+from dataclasses import dataclass++_HEADING = re.compile(r"^(#{1,3})\s+(.+?)\s*$", re.MULTILINE)+_FENCE = re.compile(r"^(`{3,}|~{3,}).*?^\1[ \t]*$", re.MULTILINE | re.DOTALL)+++@dataclass+class Section:+ level: int+ title: str+ body: str # heading line included+++def _heading_matches(md: str) -> list[re.Match[str]]:+ """Headings outside fenced code blocks (``# comment`` lines in snippets are not headings)."""+ out: list[re.Match[str]] = []+ fence_spans: list[tuple[int, int]] = []+ for m in _FENCE.finditer(md):+ fence_spans.append((m.start(), m.end()))+ for m in _HEADING.finditer(md):+ if not any(a <= m.start() < b for a, b in fence_spans):+ out.append(m)+ return out+++def split_sections(md: str) -> list[Section]:+ """Split markdown into heading-delimited sections (text before the first heading is 'preamble')."""+ matches = _heading_matches(md)+ if not matches:+ return [Section(0, "preamble", md)]+ out: list[Section] = []+ if matches[0].start() > 0 and md[: matches[0].start()].strip():+ out.append(Section(0, "preamble", md[: matches[0].start()]))+ for i, m in enumerate(matches):+ end = matches[i + 1].start() if i + 1 < len(matches) else len(md)+ out.append(Section(len(m.group(1)), m.group(2), md[m.start(): end]))+ return out+++def find_section(sections: list[Section], query: str) -> Section | None:+ """Case-insensitive match: exact title first, then substring, then word overlap."""+ q = query.strip().lower()+ if not q:+ return None+ for s in sections:+ if s.title.lower() == q:+ return s+ for s in sections:+ if q in s.title.lower():+ return s+ words = set(re.findall(r"[a-z0-9]+", q))+ best, best_n = None, 0+ for s in sections:+ n = len(words & set(re.findall(r"[a-z0-9]+", s.title.lower())))+ if n > best_n:+ best, best_n = s, n+ return bestdiff --git a/harness/codeverse/spatial/cookbook_tool.py b/harness/codeverse/spatial/cookbook_tool.pydeleted file mode 100644index 41733f9e..00000000--- a/harness/codeverse/spatial/cookbook_tool.py+++ /dev/null@@ -1,125 +0,0 @@-"""``read_cookbook`` tool: serve the language cookbook (or a section of it).--Source order: ``prompts/<language>/cookbook.md`` (via ``codeverse.prompts.load_text``)-→ the runtime's ``contract_doc()`` → a clear "no cookbook" message. Sections-are markdown headings (``#``…``###``); matching is case-insensitive substring.-Output is capped at ``MAX_CHARS`` and always lists the available sections.-"""--from __future__ import annotations--import re-from dataclasses import dataclass--from pydantic import BaseModel, Field--from codeverse.spatial.observe import truncate-from codeverse.spatial.registry import Observation, ToolContext, tool-from codeverse.spatial.tool_common import ToolUnavailable, language_of, lazy--MAX_CHARS = 6000-_HEADING = re.compile(r"^(#{1,3})\s+(.+?)\s*$", re.MULTILINE)-_FENCE = re.compile(r"^(`{3,}|~{3,}).*?^\1[ \t]*$", re.MULTILINE | re.DOTALL)--#: prompts/<dir> per language id (urdf_blender's docs live under prompts/urdf)-_PROMPT_DIR = {"urdf_blender": "urdf"}---@dataclass-class Section:- level: int- title: str- body: str # heading line included---def _heading_matches(md: str) -> list[re.Match[str]]:- """Headings outside fenced code blocks (``# comment`` lines in snippets are not headings)."""- out: list[re.Match[str]] = []- fence_spans: list[tuple[int, int]] = []- for m in _FENCE.finditer(md):- fence_spans.append((m.start(), m.end()))- for m in _HEADING.finditer(md):- if not any(a <= m.start() < b for a, b in fence_spans):- out.append(m)- return out---def split_sections(md: str) -> list[Section]:- """Split markdown into heading-delimited sections (text before the first heading is 'preamble')."""- matches = _heading_matches(md)- if not matches:- return [Section(0, "preamble", md)]- out: list[Section] = []- if matches[0].start() > 0 and md[: matches[0].start()].strip():- out.append(Section(0, "preamble", md[: matches[0].start()]))- for i, m in enumerate(matches):- end = matches[i + 1].start() if i + 1 < len(matches) else len(md)- out.append(Section(len(m.group(1)), m.group(2), md[m.start(): end]))- return out---def find_section(sections: list[Section], query: str) -> Section | None:- """Case-insensitive match: exact title first, then substring, then word overlap."""- q = query.strip().lower()- if not q:- return None- for s in sections:- if s.title.lower() == q:- return s- for s in sections:- if q in s.title.lower():- return s- words = set(re.findall(r"[a-z0-9]+", q))- best, best_n = None, 0- for s in sections:- n = len(words & set(re.findall(r"[a-z0-9]+", s.title.lower())))- if n > best_n:- best, best_n = s, n- return best---def load_cookbook(language: str) -> tuple[str, str]:- """(markdown, source) for ``language``; raises ToolUnavailable when nothing exists."""- rel = f"{_PROMPT_DIR.get(language, language)}/cookbook.md"- try:- load_text = lazy("codeverse.prompts", "load_text")- return load_text(rel), f"prompts/{rel}"- except (ToolUnavailable, FileNotFoundError):- pass- try:- get_runtime = lazy("codeverse.languages", "get_runtime")- doc = get_runtime(language).contract_doc()- if doc and doc.strip():- return doc, f"{language} runtime contract_doc()"- except Exception as e: # runtime missing / contract missing- raise ToolUnavailable(f"no cookbook for {language}: {type(e).__name__}: {e}") from e- raise ToolUnavailable(f"no cookbook or contract doc for {language}")---class ReadCookbookArgs(BaseModel):- section: str = Field(default="", description="heading to return (case-insensitive substring); empty = whole cookbook (truncated)")---@tool("read_cookbook", ReadCookbookArgs, "Read the language cookbook (copyable snippets, pitfalls, export contract) — whole or one section.")-def read_cookbook(ctx: ToolContext, args: ReadCookbookArgs) -> Observation:- language = language_of(ctx)- try:- md, source = load_cookbook(language)- except ToolUnavailable as e:- return Observation.error(f"read_cookbook: {e}")- sections = split_sections(md)- titles = [s.title for s in sections if s.level > 0]- listing = "sections: " + (" | ".join(titles) if titles else "(no headings)")- if args.section:- sec = find_section(sections, args.section)- if sec is None:- return Observation.error(f"no section matching {args.section!r} in {source}\n{listing}",- available=titles)- body = sec.body- head = f"[{source} › {sec.title}]"- else:- body = md- head = f"[{source}]"- text = f"{head}\n{truncate(body, MAX_CHARS, tail_ratio=0.1)}\n\n{listing}"- return Observation(ok=True, text=text, numbers={"source": source, "chars": len(body), "sections": titles[:60],- "truncated": len(body) > MAX_CHARS})diff --git a/harness/codeverse/spatial/tools.py b/harness/codeverse/spatial/tools.pyindex 885386ef..99258781 100644--- a/harness/codeverse/spatial/tools.py+++ b/harness/codeverse/spatial/tools.py@@ -1,6 +1,6 @@"""Core spatial tools registered with ``@tool``: build, measure, check_connectivity,check_contract, cross_section. Rendering tools live in ``tools_render``, scene /-articulation tools in ``tools_scene`` and the cookbook reader in ``cookbook_tool``+articulation tools in ``tools_scene``(all imported at the bottom so ``import codeverse.spatial.tools`` registers everytool).@@ -277,7 +277,6 @@ def cross_section(ctx: ToolContext, args: CrossSectionArgs) -> Observation:# register the cookbook reader (the other tool modules merged in, 2026-08-28)-import codeverse.spatial.cookbook_tool # noqa: E402,F401# ===================================================================== tools_render# (merged from codeverse/spatial/tools_render.py, 2026-08-28 — its one importer was thediff --git a/harness/codeverse/tracks/graphics.py b/harness/codeverse/tracks/graphics.pyindex afc37934..72004767 100644--- a/harness/codeverse/tracks/graphics.py+++ b/harness/codeverse/tracks/graphics.py@@ -35,7 +35,7 @@ from codeverse.languages._gl_common import SHEET_NAME, read_metricsfrom codeverse.languages.glsl_shader import COMMON_GLSL, FUNC_DEF, strip_commentsfrom codeverse.orchestrator import TaskGroupfrom codeverse.prompts import render-from codeverse.spatial.cookbook_tool import Section, split_sections+from codeverse.prompts.sections import Section, split_sectionsfrom codeverse.tracks.common import RunContextfrom codeverse.tracks.generation import SINGLE_SHOT_FORMAT, GenerationTaskfrom codeverse.tracks.lifecycle import BaseTrack, StageRunnerdiff --git a/harness/codeverse/tracks/prompting.py b/harness/codeverse/tracks/prompting.pyindex f6cd9f02..136b231e 100644--- a/harness/codeverse/tracks/prompting.py+++ b/harness/codeverse/tracks/prompting.py@@ -27,7 +27,7 @@ from codeverse.tracks.depth import DepthBudget, PartScope, depth_budget, interfafrom codeverse.tracks.generation import SINGLE_SHOT_FORMATif TYPE_CHECKING:- from codeverse.spatial.cookbook_tool import Section+ from codeverse.prompts.sections import Sectionlog = logging.getLogger(__name__)@@ -156,7 +156,7 @@ def cookbook_sections(ctx: RunContext, names: Sequence[str], *, max_chars: int =so the chapters that decide the score (ground, horizon, vegetation, rocks, dressing,layering, motion) travel inside the prompt instead; the tool stays for everything else."""- from codeverse.spatial.cookbook_tool import find_section, split_sections+ from codeverse.prompts.sections import find_section, split_sectionsmd = ctx.cookbook_text or ""if not md.strip():@@ -232,7 +232,7 @@ def select_cookbook_chapters(ctx: RunContext, brief: str, *, budget: int = 9000,need of a night-sky brief: always-set 4.4 k + Light phenomena 3.2 k + Gradient sky 1.3 k.``tracks/graphics_recipes.py`` seeds the SAME selection's code into the harness-owned ``src/recipes.glsl``."""- from codeverse.spatial.cookbook_tool import Section, find_section, split_sections+ from codeverse.prompts.sections import Section, find_section, split_sectionsmd = ctx.cookbook_text or ""if not md.strip():diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex efc0df2b..b88a0510 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -112,8 +112,8 @@ codeverse/a single __init__.py (lint → skeleton → runtime, in dependency order) beside theirdata (wrappers/, starter/, CONTRACT.md — Path(__file__) assets unchanged);file_lint.py (one just-written file → syntax/lint verdict for write_file, COST.md §29)- spatial/ node.py, render.py, tool_common.py (shared tool plumbing), cookbook_tool.py- (read_cookbook), render_scene.py (judge view subset, content-fitted orbit),+ spatial/ node.py, render.py, tool_common.py (shared tool plumbing),+ render_scene.py (judge view subset, content-fitted orbit),frame_metrics.py (scene_frames gate), frame_motion.py (measured inter-frame motion),scene_placement.py (scene_placement gate + check_placement tool: floating / sunken /unsupported / interpenetration per placed asset from the probe census's placement@@ -186,8 +186,17 @@ codeverse/urls.py (server vs file:// targets + content types + the traversal guard),server.py (stdlib http.server, loopback-only; page.py also renders thestatic single-file form), theme.py (CSS + the index-page JS)- prompts/ system/*, <lang>/{contract,cookbook}.md (incl. glsl_shader/, opengl_python/),- texturing/*.md, tracks/*.j2 (incl. plan/generate/refine_graphics.j2)+ prompts/ EVERY piece of prompt material the harness writes, and the only place it+ lives: <lang>/{system,contract,cookbook}.md (incl. glsl_shader/,+ opengl_python/), system/* (harness contract, single-shot envelope,+ role_{scope,detail,repair}.j2), texturing/*.md, tracks/*.j2.+ catalog.py answers "what exists and how does each piece reach the model"+ — including the ONE language-id → prompts/<dir> mapping, which used to be+ copied four times and missing in a fifth. sections.py splits that+ markdown into chapters so a STAGE can name the recipes it needs.+ The other half of the split: codeverse/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 tools/bench/gallerycommands), inspect_cmd.py (status/render/judge on one existing run),flywheel_cmd.py, texture_cmd.py, cost_cmd.py (`3dcv cost`), layout_cmd.py, doctor.py@@ -296,7 +305,7 @@ server (name `3dcv`) for the vendor CLIs, (c) a native tool schema for any embed`render_sheet`, `isolate`, `cross_section`, `check_connectivity`, `check_contract`,`compare_silhouette`, `joint_sweep` (articulated), `shader_probe`, `scene_probe`,`scene_views` (scene), `gl_probe`, `gl_frames` (graphics), `texture_pass`,-`texture_preview` (object tracks), `read_cookbook`.+`texture_preview` (object tracks).## 6. Judging (protocol v2)diff --git a/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py b/harness/tests/orchestrator_tracks/test_cookbook_excerpt.pyindex dc7391a0..35e05b3f 100644--- a/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py+++ b/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py@@ -13,7 +13,7 @@ from types import SimpleNamespacefrom codeverse.contracts.common import Language, Trackfrom codeverse.prompts import PROMPTS_DIR, load_text-from codeverse.spatial.cookbook_tool import split_sections+from codeverse.prompts.sections import split_sectionsfrom codeverse.tracks.prompting import COOKBOOK_ALWAYS, select_cookbook_excerptAURORA = "Aurora borealis over a mountain ridge with a frozen lake, dense stars, green and violet curtains"diff --git a/harness/tests/scene_prompts/test_quality_teaching.py b/harness/tests/scene_prompts/test_quality_teaching.pyindex 42c8eb39..0011328f 100644--- a/harness/tests/scene_prompts/test_quality_teaching.py+++ b/harness/tests/scene_prompts/test_quality_teaching.py@@ -40,7 +40,7 @@ def test_cookbook_has_the_quality_chapter(cookbook: str, title: str) -> None:@pytest.mark.parametrize("title", QUALITY_CHAPTERS)def test_cookbook_chapter_is_findable_by_read_cookbook(cookbook: str, title: str) -> None:- from codeverse.spatial.cookbook_tool import find_section, split_sections+ from codeverse.prompts.sections import find_section, split_sectionss = find_section(split_sections(cookbook), title)assert s is not None and s.title.startswith(title)@@ -139,7 +139,7 @@ def test_the_quality_chapters_travel_INSIDE_the_zone_and_env_prompts() -> None:from codeverse.tracks.scene import ENV_RECIPES, ZONE_RECIPEScookbook = load_text("scene_threejs/cookbook.md")- from codeverse.spatial.cookbook_tool import find_section, split_sections+ from codeverse.prompts.sections import find_section, split_sectionssecs = split_sections(cookbook)for names in (ENV_RECIPES, ZONE_RECIPES):diff --git a/harness/tests/skills/test_freshness.py b/harness/tests/skills/test_freshness.pyindex 394df831..9f04b7a5 100644--- a/harness/tests/skills/test_freshness.py+++ b/harness/tests/skills/test_freshness.py@@ -210,7 +210,12 @@ def _languages_of(skill_name: str) -> set[str]:def test_every_cookbook_section_a_skill_names_exists_in_that_cookbook(s):"""T4's other half: a skill may point at the cookbook, never invent a heading."""from codeverse.prompts import load_text- from codeverse.spatial.cookbook_tool import _PROMPT_DIR, split_sections+ from codeverse.prompts.catalog import PROMPT_DIRS+ from codeverse.prompts.sections import split_sections++ # the language-id → prompts/<dir> mapping has ONE home now (prompts/catalog.py);+ # this test used to import the third of its copies+ _PROMPT_DIR = {k.value: v for k, v in PROMPT_DIRS.items()}text = "\n".join([s.body] + [p.read_text() for p in sorted(s.dir.rglob("references/*.md"))])wanted = set(_COOKBOOK_SECTION.findall(text))diff --git a/harness/tests/spatial_tools/test_mcp_server.py b/harness/tests/spatial_tools/test_mcp_server.pyindex e0aa15ee..e5db0a94 100644--- a/harness/tests/spatial_tools/test_mcp_server.py+++ b/harness/tests/spatial_tools/test_mcp_server.py@@ -41,7 +41,7 @@ def test_cli_list(stool_ctx: ToolContext, capsys: pytest.CaptureFixture[str]) ->assert main(["--workspace", str(stool_ctx.workspace.root), "--list"]) == 0data = json.loads(capsys.readouterr().out)names = {d["name"] for d in data}- assert {"build", "measure", "read_cookbook", "render_views"} <= names and "shader_probe" not in names+ assert {"build", "measure", "render_views"} <= names and "shader_probe" not in namesassert main(["--workspace", str(stool_ctx.workspace.root / "nope")]) == 2@@ -60,7 +60,7 @@ def test_stdio_roundtrip(stool_ctx: ToolContext, tmp_path: Path) -> None:await s.initialize()tools = await s.list_tools()by_name = {t.name: t for t in tools.tools}- assert "read_cookbook" in by_name and "measure" in by_name and "check_connectivity" in by_name+ assert "measure" in by_name and "check_connectivity" in by_nameassert 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"diff --git a/harness/tests/spatial_tools/test_tools.py b/harness/tests/spatial_tools/test_tools.pyindex 20c6b50d..2fa0aef5 100644--- a/harness/tests/spatial_tools/test_tools.py+++ b/harness/tests/spatial_tools/test_tools.py@@ -23,7 +23,7 @@ from codeverse.workspace import Workspace#: tools every workspace gets (no track/language restriction)CORE_TOOLS = {"build", "measure", "render_views", "render_sheet", "isolate", "cross_section", "check_connectivity",- "check_contract", "compare_silhouette", "compare_reference", "read_cookbook"}+ "check_contract", "compare_silhouette", "compare_reference"}#: track- / language-scoped tools (documented; keep in sync when registering a new one)SCOPED_TOOLS = {"joint_sweep", # articulated_object@@ -277,30 +277,6 @@ def test_renderer_unavailable(stool_ctx: ToolContext, monkeypatch: pytest.Monkeyassert not obs.ok and obs.text.startswith("tool render_views unavailable:")-# --------------------------------------------------------------------------- cookbook + scene tools-def test_read_cookbook(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:- import codeverse.prompts as prompts-- md = "# Blender cookbook\n\nintro\n\n## Export\nharness exports\n\n## Pitfalls\n- no bpy.ops\n" + "x" * 7000- monkeypatch.setattr(prompts, "load_text", lambda rel: md if rel == "blender/cookbook.md" else (_ for _ in ()).throw(FileNotFoundError(rel)))- obs = get_tool("read_cookbook").call(stool_ctx, {})- assert obs.ok and obs.text.startswith("[prompts/blender/cookbook.md]") and obs.numbers["truncated"] and "sections: Blender cookbook | Export | Pitfalls" in obs.text- assert len(obs.text) < 6500- obs = get_tool("read_cookbook").call(stool_ctx, {"section": "pitfalls"})- assert obs.ok and "- no bpy.ops" in obs.text and "harness exports" not in obs.text- obs = get_tool("read_cookbook").call(stool_ctx, {"section": "materials"})- assert not obs.ok and "Export" in obs.text---def test_read_cookbook_falls_back_to_contract(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:- import codeverse.prompts as prompts-- monkeypatch.setattr(prompts, "load_text", lambda rel: (_ for _ in ()).throw(FileNotFoundError(rel)))- _patch_runtime(monkeypatch, _FakeRuntime())- obs = get_tool("read_cookbook").call(stool_ctx, {"section": "export"})- assert obs.ok and "the harness exports" in obs.text and "contract_doc()" in obs.text--def test_scene_tools_degrade_when_unavailable(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:import codeverse.spatial.tool_common as tcimport codeverse.spatial.tools as ts