Official Codebase of 3DCodeVerse
Python
skills: the loaderless delivery path goes (no agent kind reaches it); SIGNAL_KEYS covers R26/R27; R3 is object-only
gaoypeng904a9d8455b8
diff --git a/harness/codeverse3d/skills/config.py b/harness/codeverse3d/skills/config.pyindex 7878d6fd..2eac16aa 100644--- a/harness/codeverse3d/skills/config.py+++ b/harness/codeverse3d/skills/config.py@@ -2,7 +2,7 @@WHY not ``Settings``: ``codeverse3d.config.get_settings`` is ``lru_cache``d, so a valueread through it is frozen at first touch and an A/B arm that sets the variable after-import gets the control's behaviour. ``bench/ab_plan.py`` differs its arms only by+import gets the control's behaviour. ``eval/bench/ab_plan.py`` differs its arms only byenvironment, and a wave once printed "keep, mean delta +0.344" for two byte-identicalarms because the switch it flipped was read by nothing at all(``codeverse3d/tracks/plan_features.py``). So: one module, read at call time, registereddiff --git a/harness/codeverse3d/skills/materialize.py b/harness/codeverse3d/skills/materialize.pyindex 190c28d1..58abc005 100644--- a/harness/codeverse3d/skills/materialize.py+++ b/harness/codeverse3d/skills/materialize.py@@ -172,7 +172,6 @@ def attach_skills(track: str,language: str,kind: str,- agent_kind: str,plan: Any | None = None,findings: Any = (),single_shot: bool = False,@@ -235,8 +234,8 @@ def attach_skills(log.warning("skills not materialised into %s: %s", ws_root, e)return outout.paths = [str(p) for p in paths]- out.index_tokens = index_tokens(sel, agent_kind)- write_index(ws_root, index_block(sel, agent_kind))+ out.index_tokens = index_tokens(sel)+ write_index(ws_root, index_block(sel))return outdiff --git a/harness/codeverse3d/skills/prompting.py b/harness/codeverse3d/skills/prompting.pyindex e5427327..b101bad0 100644--- a/harness/codeverse3d/skills/prompting.py+++ b/harness/codeverse3d/skills/prompting.py@@ -3,32 +3,19 @@The library itself is agent-agnostic: plain `agentskills.io` bundles under``codeverse3d/skills/<name>/SKILL.md``, routed by ``registry.py`` from typed inputs. Nothingin it knows what a backend is. What genuinely differs between backends is only-**delivery**, and only in two bits:+**delivery**, and only in one bit: which discovery root does it read?-* does the backend have a NATIVE skill loader (it finds and indexes bundles itself), and-* which discovery root does it read?--Both were read out of the shipped binaries, not assumed: gemini-cli, codex and agy read+Read out of the shipped binaries, not assumed: gemini-cli, codex and agy read``<ws>/.agents/skills/<name>/SKILL.md``; claude-code 2.1 reads ``<ws>/.claude/skills/…``-and has no ``.agents`` skill root at all.--Everything else follows from those two bits, so adding a backend is ONE row here — not a-new module, not a branch in three files. A backend nobody has classified gets the safe-answer (no native loader), which means it is handed the explicit index *and* the-``read_skill`` tool: over-delivering costs tokens, under-delivering costs the skill.--WHY the tool exists at all, measured 2026-08-25: on the same library and workspace, the-three native loaders read **5 of 5** routed bundles unprompted while api-agent read-**0 of 5** — not from unwillingness (it made 52 ``read_file`` calls that session) but-because the bundles sit in hidden directories its ``list_files`` skips, and the index was-prose in a 2.3 kB system prompt rather than an affordance. So a backend without a loader-gets the routed set as a TOOL. That is a general rule about loaderless backends, not a-special case for one of them.+and has no ``.agents`` skill root at all. All four have a NATIVE skill loader (they find+and index the bundles themselves), so none is handed a second index — it would list the+same skills twice. Adding a backend is ONE row here — not a new module, not a branch in+three files. (The loaderless path — an explicit index plus a ``read_skill`` tool — served+the in-process api-agent and went with it: ``agents/registry.KINDS`` accepts only these four.)"""from __future__ import annotations-import refrom collections.abc import Sequencefrom dataclasses import dataclass@@ -49,31 +36,21 @@ class Delivery:root: str"""Discovery root this backend reads (bundles are written to every known root anyway,so one copy is never the only copy — this is the path we NAME to it)."""- native_loader: bool- """True when the backend indexes bundles itself. Such a backend must not be handed a- second index — it would list the same skills twice — and needs no tool."""-- @property- def needs_index(self) -> bool:- """An explicit one-line-per-skill index in the agent body file."""- return not self.native_loader-#: The whole per-backend policy. One row per backend; anything absent is loaderless.+#: The whole per-backend policy. One row per backend; a kind not listed here (a test's+#: fake agent) reads the shared ``.agents`` root._BACKENDS: dict[str, Delivery] = {- "claude-code": Delivery(root=CLAUDE_SKILL_ROOT, native_loader=True),- "codex": Delivery(root=AGENTS_SKILL_ROOT, native_loader=True),- "gemini-cli": Delivery(root=AGENTS_SKILL_ROOT, native_loader=True),- "agy": Delivery(root=AGENTS_SKILL_ROOT, native_loader=True),+ "claude-code": Delivery(root=CLAUDE_SKILL_ROOT),+ "codex": Delivery(root=AGENTS_SKILL_ROOT),+ "gemini-cli": Delivery(root=AGENTS_SKILL_ROOT),+ "agy": Delivery(root=AGENTS_SKILL_ROOT),}-#: the safe answer for a backend nobody has classified yet-_UNKNOWN = Delivery(root=AGENTS_SKILL_ROOT, native_loader=False)-def delivery_for(agent_kind: str) -> Delivery:- """The delivery policy for ``agent_kind``; unknown kinds get the loaderless answer."""- return _BACKENDS.get((agent_kind or "").split(":", 1)[0], _UNKNOWN)+ """The delivery policy for ``agent_kind`` (``codex:gpt-5.6-sol`` is codex)."""+ return _BACKENDS.get((agent_kind or "").split(":", 1)[0]) or Delivery(root=AGENTS_SKILL_ROOT)def known_backends() -> tuple[str, ...]:@@ -81,66 +58,27 @@ def known_backends() -> tuple[str, ...]:# ===================================================================== prompting-#: Per-backend policy lives in ONE place (``_BACKENDS`` above); derived here so nothing-#: else re-derives what a backend needs.-NATIVE_LOADERS = tuple(k for k in known_backends() if delivery_for(k).native_loader)--#: what a NATIVE loader is told. Its own index lists every skill it can see, including any+#: what every backend is told. Its own index lists every skill it can see, including any#: the user installed globally, so "the ones that match" is the right instruction there.MANDATE = ("Skills for this task are installed in this workspace. Any whose description matches ""your task are MANDATORY — activate and read them before writing code.")-#: what an unclassified (loaderless) backend is told. The list under it was chosen by OUR-#: router from the track, the language, the plan and the previous round's gate findings —-#: inviting the agent to filter it again would only lose reads.-MANDATE_ROUTED = ("The skills below were selected for THIS task by the harness, from your track, "- "your language, your plan and the gate findings of the previous round. Reading "- "them is MANDATORY — open each one before writing code.")_HEADING = "## Skills"-#: how much of a description the routed index repeats. Descriptions run to 1024 chars for-#: the CLIs' own matchers; our index is not a matcher — the router already decided — so a-#: line only has to be recognisable enough to know which file to open. Measured on the-#: real library: five full descriptions cost 780 tokens; the first clause costs 401.-INDEX_SUMMARY_CHARS = 200--_SENTENCE_END = re.compile(r"(?<=[.!?])\s+(?=[A-Z`])")---def index_summary(description: str, limit: int = INDEX_SUMMARY_CHARS) -> str:- """The WHAT half of a description, for the one index we write ourselves."""- first = _SENTENCE_END.split(description.strip(), 1)[0].strip()- if len(first) <= limit:- return first- cut = first[:limit].rsplit(" ", 1)[0].rstrip(" ,;:—-")- return cut + " ..."-def skill_path(name: str, *, agent_kind: str = "") -> str:return f"{delivery_for(agent_kind).root}/{name}/SKILL.md"-def index_block(skills: Sequence[Skill | Selection], agent_kind: str) -> str:- """The text appended to the AGENTS.md body for ``agent_kind`` ('' when nothing is added).-- Native-loader backends get the mandate only; an unclassified backend (the safe- assumption for anything unknown) also gets the one-line-per-skill index it cannot- discover itself.- """- items = [s.skill if isinstance(s, Selection) else s for s in skills]- if not items:- return ""- if not delivery_for(agent_kind).needs_index:- return f"{_HEADING}\n\n{MANDATE}\n"- lines = [f"- **{s.name}** — {index_summary(s.description)} "- f"Read `{skill_path(s.name, agent_kind=agent_kind)}` BEFORE writing code."- for s in items]- return f"{_HEADING}\n\n{MANDATE_ROUTED}\n\n" + "\n".join(lines) + "\n"+def index_block(skills: Sequence[Skill | Selection]) -> str:+ """The text appended to the AGENTS.md body ('' when nothing is routed): the mandate+ only — every backend's native loader already indexes the bundles."""+ return f"{_HEADING}\n\n{MANDATE}\n" if skills else ""-def index_tokens(skills: Sequence[Skill | Selection], agent_kind: str) -> int:+def index_tokens(skills: Sequence[Skill | Selection]) -> int:"""What the index costs in message 0 — recorded per round so §5.4 is auditable."""- return text_tokens(index_block(skills, agent_kind))+ return text_tokens(index_block(skills))def repair_pointers(selections: Sequence[Selection], *, agent_kind: str = "",diff --git a/harness/codeverse3d/skills/registry.py b/harness/codeverse3d/skills/registry.pyindex b6b7ff65..f6721054 100644--- a/harness/codeverse3d/skills/registry.py+++ b/harness/codeverse3d/skills/registry.py@@ -171,8 +171,10 @@ ROUTES: tuple[Route, ...] = (Route("R2", "c3d-part-contact", 95, kinds=("repair", "refine", "rebuild"),findings=("connectivity/*", "joint_sweep/*"),why="the previous round's connectivity/joint gate fired"),- Route("R3", "c3d-bbox-contract", 65, tracks=(*OBJECT_TRACKS, "scene"),- kinds=("baseline", "part", "detail", "refine", "rebuild", "zone"),+ # object tracks only: the sheet's proof loop is measure / check_contract / isolate, and a+ # scene session has none of those tools (it was attached to scene zone sessions until 2026-09-22)+ Route("R3", "c3d-bbox-contract", 65, tracks=OBJECT_TRACKS,+ kinds=("baseline", "part", "detail", "refine", "rebuild"),why="this session owns dimensions, and the plan's numbers are the contract"),Route("R4", "c3d-bbox-contract", 95, kinds=("repair", "refine", "rebuild"), findings=("contract/*",),why="the previous round's contract gate fired"),@@ -236,7 +238,7 @@ ROUTES: tuple[Route, ...] = (Route("R24-opengl", "c3d-opengl-pipeline", 90, tracks=("graphics",), languages=("opengl_python",),findings=(GL_MOTION_OR_DETAIL,), why="the frame gate saw no motion or no detail"),# R25-R28 (2026-09-01): the graphics-recipe port from the scene_multifile_graphics- # reference (docs/EVAL.md sceneloop entry). Atmosphere and materials ride every+ # reference (eval/docs/EVAL.md sceneloop entry). Atmosphere and materials ride every# env/baseline build; water and night only when the plan's own words ask for them.Route("R25", "c3d-scene-atmosphere", 70, tracks=("scene",), languages=("scene_threejs",),kinds=("baseline", "env", "refine"),@@ -262,7 +264,7 @@ log = logging.getLogger(__name__)#: plan-derived booleans/ints the table may test. Kept here (not on the Plan contracts)#: because they are a routing concern: adding one must not migrate every stored plan.SIGNAL_KEYS = ("n_parts", "multi_part", "has_instances", "has_symmetry", "has_assemblies",- "has_joints", "joint_types", "has_custom_shader")+ "has_joints", "joint_types", "has_custom_shader", "wants_water", "wants_night")_SHADER_WORDS = ("shader", "glsl", "onbeforecompile", "shadermaterial", "custom material","raymarch", "postprocess", "post-process")diff --git a/harness/codeverse3d/tracks/skills_hook.py b/harness/codeverse3d/tracks/skills_hook.pyindex c0588dff..da0a8750 100644--- a/harness/codeverse3d/tracks/skills_hook.py+++ b/harness/codeverse3d/tracks/skills_hook.py@@ -68,7 +68,6 @@ def attach_for_round(ctx: RunContext, *, index: int, kind: str) -> Any | None:track=ctx.spec.track.value if hasattr(ctx.spec.track, "value") else str(ctx.spec.track),language=ctx.language.value,kind=kind,- agent_kind=ctx.agent_kind,plan=ctx.plan,findings=_previous_findings(ctx, index),single_shot=ctx.single_shot,diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.mdindex 1a9e6b76..f204eb34 100644--- a/harness/docs/SKILLS.md+++ b/harness/docs/SKILLS.md@@ -11,8 +11,8 @@ names the cookbook section to fetch. Two libraries of truth would be worse than`SKILL.md` is an open standard (agentskills.io, Dec 2025), which is why the format below isnot ours to bend: **claude-code, codex, gemini-cli and agy discover these bundlesthemselves** — proven live, see §7. (The in-process `api-agent`, the one backend that-needed harness-side injection, was deleted 2026-08-28; an unclassified backend still-gets the routed index as the safe default.)+needed harness-side injection, was deleted 2026-08-28, and its routed index and+`read_skill` tool with it.)Everything is behind `C3D_SKILLS`. **It ships OFF**, because `api-agent` read 0 of 5routed bundles in the measured A/B while the three subscription CLIs read all five.@@ -27,37 +27,22 @@ are plain [agentskills.io](https://agentskills.io/specification) `SKILL.md` direknow nothing about any backend — anyone can `cp -r codeverse3d/skills/<name> ~/.claude/skills/`and use them without this harness at all. `router.py` picks the set from typed inputs.-Everything that genuinely differs between coding agents is **two bits**, and they live in-one file, `skills/delivery.py`:+Everything that genuinely differs between coding agents is **one bit**, and it lives in+one file, `skills/prompting.py`:-| backend | native loader? | discovery root |-|---|---|---|-| `claude-code` | yes | `.claude/skills` |-| `codex`, `gemini-cli`, `agy` | yes | `.agents/skills` |-| *anything unclassified* | **no** (safe default) | `.agents/skills` |+| backend | discovery root |+|---|---|+| `claude-code` | `.claude/skills` |+| `codex`, `gemini-cli`, `agy` | `.agents/skills` |-Both bits were read out of the shipped binaries, not assumed. Everything else is derived:-a backend with its own loader must **not** be handed a second index (it would list the same-skills twice) and needs no tool; a backend without one gets the explicit index **and** the-`read_skill` tool. Over-delivering costs tokens; under-delivering costs the skill, so an-unknown backend gets the loaderless treatment.+It was read out of the shipped binaries, not assumed. All four have a native loader, so+none is handed a second index (it would list the same skills twice): the body file gets one+MANDATORY sentence.**Adding a backend is one row in that table.** A test (`tests/skills/test_delivery.py`)fails if per-backend knowledge leaks back out into the other modules, and another checksthat `prompting.py` agrees with the policy rather than re-deriving it.-### Why loaderless backends get a tool--Measured 2026-08-25, same library, same workspace, same task: `codex`, `claude-code` and-`agy` each read **5 of 5** routed bundles unprompted through their own loaders.-`api-agent` read **0 of 5** — not from unwillingness (it made **52 `read_file` calls** that-session, and called `read_cookbook` twice), but because the bundles sit in hidden-directories its `list_files` deliberately skips, and the index was prose in a 2.3 kB system-prompt competing with the contract and the rules. Prose is not an affordance. So the-routed set became a tool, `read_skill`, whose spec carries the names and one-line summaries-where a model actually reads its options — and which records what was opened, giving the-read rate ground truth instead of a probe.-## 1. The model: progressive disclosure, and why it is also the measurement@@ -65,7 +50,7 @@ The spec's three tiers, and what each costs us per turn:| tier | what the agent sees | when | our cost ||---|---|---|---|-| 1 · index | `name` + one clause of `description` | every turn | 41 tokens (native CLIs) / 356 worst case (api-agent) |+| 1 · index | `name` + `description`, listed by the CLI's own loader | every turn | 41 tokens (our one mandate sentence) || 2 · body | the whole `SKILL.md` | on activation | 1,081–2,223 tokens, once || 3 · depth | `references/*.md` | when the agent chooses to go deeper | as read |@@ -175,9 +160,9 @@ Four laws, all tested:take out the round's skills.`test_routing_property.py` runs all of that over the real library and the whole input-space: every track × language × round kind × 64 plan-signal combinations (5,376 sessions-per track), every gate finding kind the corpus produces, and 2,000 seeded random walks-including junk tracks and languages.+space: every track × language × round kind × 256 plan-signal combinations × both+`allow_unverified` settings (43,008 sessions per track), every gate finding kind the+corpus produces, and 2,000 seeded random walks including junk tracks and languages.`finding_kind()` classifies **wider** than it routes — 113 distinct WARN/ERROR messageshapes mined from `eval/bench/out`, with a 43-row golden fixture@@ -256,7 +241,6 @@ the `live` cases drive a real CLI.| `test_library.py` | body budget, no 20-line code fences, no restating `conventions.py`, every `_claims` number still matches its live constant, **no two skills point one claim key at different numbers** || `test_freshness.py` | every tool, gate kind, rubric criterion, constant, switch, sibling skill and cookbook section a bundle names still exists || `test_router.py` / `test_routing_property.py` | the four routing laws, by row and over the whole input space |-| `test_budget.py` | the index cost, re-measured against the shipped descriptions || `test_telemetry.py` | the read probe, **including the control that catches git reading the tree** || `test_packaging.py` | **a built wheel contains all 13 `SKILL.md`, all 13 `references/`, all 9 `_claims`** || `test_live_discovery.py` | §7 — a real CLI actually finds and opens a bundle |diff --git a/harness/tests/skills/test_budget.py b/harness/tests/skills/test_budget.pydeleted file mode 100644index 89f05e11..00000000--- a/harness/tests/skills/test_budget.py+++ /dev/null@@ -1,60 +0,0 @@-"""What the library costs, measured against the SHIPPED bundles and capped.--WHY a file of its own, and why it uses the real library: ``test_materialize_prompting``-prices a synthetic fixture whose descriptions are one line long. The real ones use the-spec's 1024-char allowance, because a description is the only text a CLI matches on —-and quoting all fourteen of them cost 780 tokens for a five-skill session, against a-300-token design budget, until the index started quoting the first clause instead.-A cost regression is invisible in a fixture and expensive in production, so the numbers-below are re-measured over every session the router can produce.--docs/COST.md §4: 39.3% of the agent bill is spent from turn 20 onwards and 19 of 33 long-sessions ended `budget`. Everything here is per turn, not per session.-"""--from __future__ import annotations--import itertools--import pytest--from codeverse3d.skills import all_skills, bundle_dirs, select, skills_dir-from codeverse3d.skills.prompting import index_block, index_tokens--pytestmark = pytest.mark.skipif(not bundle_dirs(), reason=f"no bundles in {skills_dir()} yet")--LIBRARY = all_skills()--#: the routed index (an unclassified, loaderless backend) is the only index we write-API_INDEX_TOKENS_MAX = 400-API_INDEX_BYTES_MAX = 2048--TRACKS = ("static_object", "articulated_object", "scene", "graphics")-LANGUAGES = ("blender", "cadquery", "threejs", "urdf_blender", "scene_threejs",- "glsl_shader", "opengl_python")-KINDS = ("baseline", "part", "detail", "refine", "rebuild", "repair", "env", "zone", "compose")-#: one of everything, so the cap is always the binding constraint-LOUD_SIGNALS = {"multi_part": True, "has_instances": True, "has_symmetry": True,- "has_joints": True, "has_custom_shader": True, "has_assemblies": True, "n_parts": 9}-ALL_FINDINGS = ["connectivity/interpenetration", "contract/part_bbox", "contract/instance_bbox",- "joint_sweep/link_overlap", "motion_direction/wrong_axis", "scene_frames/dark_or_flat",- "gl_frames/motion_or_detail", "lint/part_not_imported", "shader/compile_or_binding",- "scene_frames/camera_placement"]---def _every_session():- for track, language, kind in itertools.product(TRACKS, LANGUAGES, KINDS):- for findings in ((), ALL_FINDINGS):- for unverified in (False, True):- yield track, language, kind, [- s.skill for s in select(track, language, kind, signals=LOUD_SIGNALS,- findings=findings, library=LIBRARY, max_skills=5,- allow_unverified=unverified)]---def test_the_api_agent_index_stays_inside_its_budget_with_the_whole_library_installed():- worst = max(_every_session(), key=lambda row: index_tokens(row[3], "api-agent"))- tokens = index_tokens(worst[3], "api-agent")- assert tokens <= API_INDEX_TOKENS_MAX, f"{worst[:3]} costs {tokens} tokens of message 0"- assert len(index_block(worst[3], "unknown-backend").encode()) <= API_INDEX_BYTES_MAX-diff --git a/harness/tests/skills/test_delivery.py b/harness/tests/skills/test_delivery.pyindex 7b71e649..da68366b 100644--- a/harness/tests/skills/test_delivery.py+++ b/harness/tests/skills/test_delivery.py@@ -2,8 +2,8 @@The owner's requirement: every coding agent shares ONE skill set, extending to a newbackend must be minimal, and the organisation has to hold up. So the whole per-backend-policy is two bits in `skills/delivery.py` — has a native loader, and which discovery root-— and every consumer asks it rather than re-deriving. These tests pin that.+policy is one bit in `skills/prompting.py` — which discovery root — and every consumer+asks it rather than re-deriving. These tests pin that."""from __future__ import annotations@@ -18,25 +18,6 @@ from codeverse3d.skills.prompting import ()-def test_a_native_loader_is_never_handed_a_second_index():- """It lists the bundles itself; ours on top would double-index the same skills."""- for kind in ("claude-code", "codex", "gemini-cli", "agy"):- d = delivery_for(kind)- assert d.native_loader and not d.needs_index, kind---def test_unclassified_backends_get_the_safe_loaderless_policy():- """Measured 2026-08-25: the native loaders read 5 of 5 routed bundles while a- loaderless backend read 0 of 5 from a MANDATORY paragraph, making 52 read_file calls- instead. Prose is not an affordance. Every SHIPPED backend has a native loader- since the in-process one was deleted (2026-08-28), so this is the policy for a- backend nobody has classified."""- for kind in ("some-future-cli", "", "typo-agent"):- d = delivery_for(kind)- assert not d.native_loader and d.needs_index, kind- assert d.root == AGENTS_SKILL_ROOT--def test_a_qualified_kind_resolves_to_its_backend():"""`codex:gpt-5.6-sol` is codex; the model suffix must not fall through to unknown."""assert delivery_for("codex:gpt-5.6-sol") == delivery_for("codex")@@ -45,19 +26,19 @@ def test_a_qualified_kind_resolves_to_its_backend():def test_claude_code_reads_its_own_root_and_nobody_else_does():"""Read out of the shipped binaries, not assumed: claude-code 2.1 has no `.agents`- skill root at all, and the other three have no `.claude` one."""+ skill root at all, and the other three have no `.claude` one; an unlisted kind (a+ test's fake agent) reads the shared one."""assert delivery_for("claude-code").root == CLAUDE_SKILL_ROOT- for kind in ("codex", "gemini-cli", "agy"):+ for kind in ("codex", "gemini-cli", "agy", "some-future-cli", ""):assert delivery_for(kind).root == AGENTS_SKILL_ROOT, kind@pytest.mark.parametrize("kind", known_backends())def test_every_consumer_agrees_with_the_policy(kind):"""`prompting` must not re-derive what `delivery` decides — one source, or they drift."""- from codeverse3d.skills.prompting import NATIVE_LOADERS, skill_path+ from codeverse3d.skills.prompting import skill_pathd = delivery_for(kind)- assert (kind in NATIVE_LOADERS) is d.native_loaderassert skill_path("c3d-x", agent_kind=kind) == f"{d.root}/c3d-x/SKILL.md"diff --git a/harness/tests/skills/test_delivery_reaches_the_session.py b/harness/tests/skills/test_delivery_reaches_the_session.pyindex 66933613..8c6161d4 100644--- a/harness/tests/skills/test_delivery_reaches_the_session.py+++ b/harness/tests/skills/test_delivery_reaches_the_session.py@@ -63,9 +63,9 @@ def test_every_scene_generation_stage_gets_skills_before_its_sessions(scene_run)assert Counter(e.get("kind") for e in attachments) >= Counter({"env": 1, "zone": 1})assert all(sum(e.get("kind") == kind for e in attachments) == 1 for kind in by_kind)assert {"c3d-scene-composition", "c3d-scene-lighting"} <= set(by_kind["env"]["skills"])- assert {"c3d-scene-composition", "c3d-scene-motion", "c3d-bbox-contract"} <= set(- by_kind["zone"]["skills"]- )+ assert {"c3d-scene-composition", "c3d-scene-motion"} <= set(by_kind["zone"]["skills"])+ # R3 is object-only: the bbox sheet's measure / check_contract / isolate loop has no scene tools+ assert "c3d-bbox-contract" not in by_kind["zone"]["skills"]def belongs(kind: str, event: dict) -> bool:label = str(event.get("label", ""))diff --git a/harness/tests/skills/test_live_discovery.py b/harness/tests/skills/test_live_discovery.pyindex 7663d5d0..31d5870b 100644--- a/harness/tests/skills/test_live_discovery.py+++ b/harness/tests/skills/test_live_discovery.py@@ -60,7 +60,7 @@ def test_the_cli_discovers_and_opens_a_materialised_skill(tmp_path: Path, kind:skill = load_skill("c3d-live-probe", lib)materialize_skills(ws, [skill])- write_index(ws, index_block([skill], kind))+ write_index(ws, index_block([skill]))res = agent.run(AgentJob(workspace=str(ws), prompt=PROMPT, spatial_tools=False,max_turns=8, timeout_s=300, label="skills_live"))diff --git a/harness/tests/skills/test_materialize_prompting.py b/harness/tests/skills/test_materialize_prompting.pyindex e6861de1..fdfb2aad 100644--- a/harness/tests/skills/test_materialize_prompting.py+++ b/harness/tests/skills/test_materialize_prompting.py@@ -24,7 +24,6 @@ from codeverse3d.skills.materialize import ()from codeverse3d.skills.prompting import (MANDATE,- NATIVE_LOADERS,index_block,index_tokens,inline_body,@@ -75,7 +74,7 @@ def test_a_never_routed_control_bundle_goes_in_beside_the_real_ones(ws, library)for root in SKILL_ROOTS:d = ws / root / CONTROL_NAMEassert (d / "SKILL.md").is_file() and (d / "references" / "control.md").is_file()- assert CONTROL_NAME not in index_block([library["c3d-part-contact"]], "api-agent")+ assert CONTROL_NAME not in index_block([library["c3d-part-contact"]])from codeverse3d.skills.registry import ROUTED_SKILLSassert CONTROL_NAME not in ROUTED_SKILLS@@ -116,8 +115,7 @@ def test_an_empty_selection_still_sweeps_last_rounds_bundles(ws, library):last round's bundles stayed live in both discovery roots, where the native CLIsdiscover skills by directory (V4b). An empty route is a legal desired set."""materialize_skills(ws, [library["c3d-part-contact"]])- out = attach_skills(ws, track="static_object", language="threejs", kind="generation",- agent_kind="claude-code", library={})+ out = attach_skills(ws, track="static_object", language="threejs", kind="generation", library={})assert out.listed == []for root in SKILL_ROOTS:assert not (ws / root / "c3d-part-contact").exists(), f"stale bundle survived in {root}"@@ -126,35 +124,14 @@ def test_an_empty_selection_still_sweeps_last_rounds_bundles(ws, library):# --------------------------------------------------------------------------- prompt textdef test_native_loader_backends_get_one_sentence_and_no_second_index(library):skills = [library["c3d-part-contact"], library["c3d-bbox-contract"]]- for kind in NATIVE_LOADERS:- text = index_block(skills, kind)- assert MANDATE in text- assert "c3d-part-contact" not in text, f"{kind} would be double-indexed"- assert index_tokens(skills, kind) < 60---def test_api_agent_gets_the_index_it_cannot_discover(library):- """And it is told the set was ROUTED, not offered: our router already filtered it on- inputs the agent cannot see, so "the ones that match your task" would only lose reads."""- from codeverse3d.skills.prompting import MANDATE_ROUTED-- skills = [library["c3d-part-contact"], library["c3d-bbox-contract"]]- text = index_block(skills, "api-agent")- assert MANDATE_ROUTED in text and MANDATE not in text- for s in skills:- assert f"**{s.name}**" in text and f".agents/skills/{s.name}/SKILL.md" in text+ text = index_block(skills)+ assert MANDATE in text+ assert "c3d-part-contact" not in text, "the native loaders would double-index it"+ assert index_tokens(skills) < 60def test_an_empty_route_adds_no_text_at_all(library):- assert index_block([], "api-agent") == "" and index_block([], "codex") == ""---def test_claude_code_is_pointed_at_its_own_root(library):- text = index_block([library["c3d-part-contact"]], "unknown-backend")- assert ".agents/skills/" in text- from codeverse3d.skills.prompting import skill_path-- assert skill_path("c3d-x", agent_kind="claude-code") == ".claude/skills/c3d-x/SKILL.md"+ assert index_block([]) == ""def test_repair_pointers_name_only_the_gate_fired_skills(library):@@ -176,12 +153,12 @@ def test_inline_body_picks_the_highest_priority_body_and_respects_the_cap(librar# --------------------------------------------------------------------------- the sectiondef test_the_index_is_written_into_every_body_file_and_is_replaceable(ws, library):- write_index(ws, index_block([library["c3d-part-contact"]], "api-agent"))+ write_index(ws, "## Skills\n\nc3d-part-contact")for name in BODY_FILES:body = (ws / name).read_text()assert MARK_BEGIN in body and MARK_END in body and "c3d-part-contact" in bodyassert body.startswith("# 3dcode workspace")- write_index(ws, index_block([library["c3d-bbox-contract"]], "api-agent"))+ write_index(ws, "## Skills\n\nc3d-bbox-contract")body = (ws / "AGENTS.md").read_text()assert body.count(MARK_BEGIN) == 1 and "c3d-part-contact" not in body and "c3d-bbox-contract" in bodywrite_index(ws, "")@@ -195,18 +172,17 @@ def test_write_index_ignores_body_files_a_workspace_does_not_have(tmp_path: Path# --------------------------------------------------------------------------- attachdef test_attach_routes_writes_and_reports(ws, library):got = attach_skills(ws, track="static_object", language="blender", kind="baseline",- agent_kind="api-agent", plan=_plan(), library=library, max_skills=5,- allow_unverified=False)+ plan=_plan(), library=library, max_skills=5, allow_unverified=False)assert got.listed and got.paths and got.index_tokens > 0assert set(got.reasons) == set(got.listed)assert all("c3d-" in p for p in got.paths)- assert "c3d-part-contact" in (ws / "AGENTS.md").read_text()+ assert MANDATE in (ws / "AGENTS.md").read_text()assert got.inlined == ""def test_attach_for_a_single_shot_session_inlines_instead_of_writing_files(ws, library):got = attach_skills(ws, track="static_object", language="blender", kind="baseline",- agent_kind="single-shot", plan=_plan(), library=library, single_shot=True,+ plan=_plan(), library=library, single_shot=True,max_skills=5, allow_unverified=False)assert got.inlined and got.paths == [] and got.index_tokens == 0assert MARK_BEGIN not in (ws / "AGENTS.md").read_text()@@ -215,6 +191,6 @@ def test_attach_for_a_single_shot_session_inlines_instead_of_writing_files(ws, ldef test_attach_with_nothing_routed_clears_the_section(ws, library):write_index(ws, "stale")got = attach_skills(ws, track="graphics", language="glsl_shader", kind="asset",- agent_kind="codex", library=library, max_skills=5, allow_unverified=False)+ library=library, max_skills=5, allow_unverified=False)assert got.listed == []assert MARK_BEGIN not in (ws / "AGENTS.md").read_text()diff --git a/harness/tests/skills/test_only_switch.py b/harness/tests/skills/test_only_switch.pyindex 9e6df153..9cbe21f7 100644--- a/harness/tests/skills/test_only_switch.py+++ b/harness/tests/skills/test_only_switch.py@@ -33,7 +33,7 @@ def ws(tmp_path):def _listed(ws, **kw):return attach_skills(ws, track="static_object", language="blender", kind="baseline",- agent_kind="unknown-backend", plan=_Plan(), **kw).listed+ plan=_Plan(), **kw).listeddef test_unset_routes_the_whole_set(ws):diff --git a/harness/tests/skills/test_routing_property.py b/harness/tests/skills/test_routing_property.pyindex 3b93bf1f..8405f339 100644--- a/harness/tests/skills/test_routing_property.py+++ b/harness/tests/skills/test_routing_property.py@@ -44,13 +44,23 @@ def _signal_sets():BASE_INPUTS = [(t, lang, kind) for t in TRACKS for lang in LANGUAGES for kind in KINDS]+def test_every_signal_a_route_requires_is_in_the_input_space():+ """R26/R27 test wants_water / wants_night, which SIGNAL_KEYS (and so FLAGS) once lacked:+ the property tests below never exercised them."""+ for row in ROUTES:+ assert set(row.requires_all) | set(row.requires_any) <= set(SIGNAL_KEYS), row.rule++def test_the_cap_and_the_ordering_hold_over_the_whole_input_space():- expected = len(LANGUAGES) * len(KINDS) * 2 ** len(FLAGS)+ """Both settings of allow_unverified: R25–R28 (and the cadquery / threejs forms) name+ inherited-unverified bundles, which route only with it on."""+ expected = 2 * len(LANGUAGES) * len(KINDS) * 2 ** len(FLAGS)for track in TRACKS:seen = 0- for language, kind in itertools.product(LANGUAGES, KINDS):+ for unverified, language, kind in itertools.product((False, True), LANGUAGES, KINDS):for signals in _signal_sets():- got = select(track, language, kind, signals=signals, library=LIBRARY, max_skills=5)+ got = select(track, language, kind, signals=signals, library=LIBRARY, max_skills=5,+ allow_unverified=unverified)seen += 1assert len(got) <= 5, f"{track}/{language}/{kind} routed {len(got)}"assert len({skill.name for skill in got}) == len(got), "duplicate skill"diff --git a/harness/tests/skills/test_telemetry.py b/harness/tests/skills/test_telemetry.pyindex 33d8a2e6..dc63ebb5 100644--- a/harness/tests/skills/test_telemetry.py+++ b/harness/tests/skills/test_telemetry.py@@ -39,7 +39,7 @@ def _plan(n=3):def _attach(ws, library, **kw):return attach_skills(ws, track="static_object", language="blender", kind="baseline",- agent_kind="unknown-backend", plan=_plan(), library=library,+ plan=_plan(), library=library,max_skills=5, allow_unverified=False, **kw)