Skip to content

Official Codebase of 3DCodeVerse

Python

prompts: a role adds to the language's system prompt, it does not replace it

gaoypeng6cbb3f757a53
diff --git a/harness/codeverse/prompts/system/role_detail.j2 b/harness/codeverse/prompts/system/role_detail.j2
index 3da0af73..86574fca 100644
--- a/harness/codeverse/prompts/system/role_detail.j2
+++ b/harness/codeverse/prompts/system/role_detail.j2
@@ -1 +1,4 @@
-You are an expert {{ language }} 3D modeller adding SURFACE DETAIL to a model whose structure is already accepted. You may not move, resize, rename, add or remove a part — a deterministic gate compares every part's bounding box against the previous round and fails the round if one moved. Everything you add lives inside or on an existing part's surface.
+For this task you are adding SURFACE DETAIL to a model whose structure is already accepted.
+You may not move, resize, rename, add or remove a part — a deterministic gate compares every
+part's bounding box against the previous round and fails the round if one moved. Everything
+you add lives inside or on an existing part's surface.
diff --git a/harness/codeverse/prompts/system/role_repair.j2 b/harness/codeverse/prompts/system/role_repair.j2
index f0c7b9ee..93144984 100644
--- a/harness/codeverse/prompts/system/role_repair.j2
+++ b/harness/codeverse/prompts/system/role_repair.j2
@@ -1 +1,4 @@
-You repair {{ language }} code that failed to build. Fix only the reported error(s) with the smallest correct change; keep every part, name and dimension. {{ contract }}
+For this task you are repairing code that failed to build. Fix only the reported error(s)
+with the smallest correct change; keep every part, name and dimension.
+
+{{ contract }}
diff --git a/harness/codeverse/prompts/system/role_scope.j2 b/harness/codeverse/prompts/system/role_scope.j2
index fc2c1d57..3a003626 100644
--- a/harness/codeverse/prompts/system/role_scope.j2
+++ b/harness/codeverse/prompts/system/role_scope.j2
@@ -1 +1,3 @@
-You are an expert {{ language }} 3D modeller writing RAW code (no SDKs, no helper libraries). You own {{ n_parts }} part(s) of a larger object: {{ names }}. Other sessions own the rest — never write a file outside your list. Follow the contract exactly; exact numbers beat adjectives; real detail beats a correctly sized box.
+For this task you own {{ n_parts }} part(s) of a larger object: {{ names }}. Other sessions
+own the rest and run at the same time — never write a file outside your list. Real detail
+inside your parts beats a correctly sized box.
diff --git a/harness/codeverse/tracks/prompting.py b/harness/codeverse/tracks/prompting.py
index 42d926f6..f6cd9f02 100644
--- a/harness/codeverse/tracks/prompting.py
+++ b/harness/codeverse/tracks/prompting.py
@@ -8,7 +8,6 @@ which maps a refine target (part / zone / asset) to the files that own it.
from __future__ import annotations
-import contextlib
import logging
import os
from collections.abc import Sequence
@@ -278,15 +277,21 @@ def language_system_prompt(language: Language, *, role: str = "", **vars: Any) -
and three.js BufferGeometry share almost nothing but the word "3D". Per language, in
the prompt corpus, so the seven can diverge and be edited without touching code.
"""
- if role:
- return render(f"system/role_{role}.j2", language=language.value, **vars).strip()
d = prompt_dir_for(language)
- # CV3D_SYSPROMPT=v0 serves the pre-2026-08-28 two-sentence prompt, so an A/B can run
+ # CV3D_SYSPROMPT=v0 serves the pre-2026-08-28 two-sentence prompt so an A/B can run
# both arms from one tree. Delete the v0 files and this branch once it has an answer.
- if os.environ.get("CV3D_SYSPROMPT") == "v0":
- with contextlib.suppress(FileNotFoundError):
- return load_text(f"{d}/system_v0.md").strip()
- return load_text(f"{d}/system.md").strip()
+ name = "system_v0.md" if os.environ.get("CV3D_SYSPROMPT") == "v0" else "system.md"
+ try:
+ base = load_text(f"{d}/{name}").strip()
+ except FileNotFoundError:
+ base = load_text(f"{d}/system.md").strip()
+ if not role:
+ return base
+ # roles COMPOSE with the language base rather than replacing it. Replacing was the
+ # shape inherited from the f-strings, and it left every fatal language-specific fact —
+ # the self-check loop, the sampled-time contract — absent from exactly the stages that
+ # violate it: the repair pass and the detail pass.
+ return base + "\n\n" + render(f"system/role_{role}.j2", language=language.value, **vars).strip()
def base_prompt_context(ctx: RunContext, **extra: Any) -> dict[str, Any]: