Skip to content

Official Codebase of 3DCodeVerse

Python

prompts: the harness contract and the language contracts state no harness limits — the numbers stay in code

gaoypengf007531bc315
diff --git a/harness/codeverse3d/prompts/blender/contract.md b/harness/codeverse3d/prompts/blender/contract.md
index be49203b..588ddcb1 100644
--- a/harness/codeverse3d/prompts/blender/contract.md
+++ b/harness/codeverse3d/prompts/blender/contract.md
@@ -28,7 +28,7 @@
object to `bpy.context.scene.collection`. Plan numbers = constants at the top of each part
file; keep each part inside its plan bbox; attached parts overlap 0.5–2 mm (deeper = interpenetration).
-## Allowed imports · forbidden calls · limits
+## Allowed imports · forbidden calls
* Imports: `bpy`, `bmesh`, `mathutils`, `math`, `random`, `itertools`, `functools`, `typing`,
`dataclasses`, and your own `parts.*` modules. Nothing else (no numpy loops over vertices,
no os/sys/subprocess/urllib/socket/pathlib, no `import codeverse3d`).
@@ -36,8 +36,7 @@
`bpy.ops.image.*`, `bpy.ops.screen.*`, `bpy.ops.view3d.*`, `bpy.data.libraries`,
`bpy.app.timers`, `open(`, `exec(`, `eval(`, `__import__`, camera / light creation, `input()`,
network, file writes; never touch `bpy.context.scene.render` / `scene.world` (harness-owned).
-* Limits: hit the prompt's **DETAIL BUDGET** (target/floor/ceiling tris + build seconds, sized from
- this plan), not a flat number. Ceilings: 600 k tris, subdiv ≤ 2, ≤ 12 booleans/object, 300 s.
+* Prefer modifiers (bevel / array / mirror) over dense meshes.
## COMPLETE minimal example A — multi-file (verified with Blender 5.0 headless)
`src/parts/seat.py`
diff --git a/harness/codeverse3d/prompts/cadquery/contract.md b/harness/codeverse3d/prompts/cadquery/contract.md
index 5dfb79ef..ad38abcf 100644
--- a/harness/codeverse3d/prompts/cadquery/contract.md
+++ b/harness/codeverse3d/prompts/cadquery/contract.md
@@ -26,10 +26,10 @@
No `OCP`/`OCC` direct calls, no numpy, no file I/O, no `cq.exporters`, no
`cq.importers`, no `import codeverse3d`.
-## Forbidden / limits
+## Forbidden
* No `show_object`, `exporters.export`, `open(`, `os`, `sys`, `subprocess`, network.
-* ≤ 40 parts; each part a valid solid (`.val().isValid()`), no empty Workplanes; fillets
- < 0.45 × thinnest adjacent wall; feature sizes ≥ 0.5 mm; build < 300 s.
+* Each part a valid solid (`.val().isValid()`), no empty Workplanes; fillets
+ < 0.45 × thinnest adjacent wall; feature sizes ≥ 0.5 mm.
* Do not union parts across plan boundaries (keep one solid per part); small intentional
overlap of **0.5–2 mm** between touching parts is required — that is how they "weld";
deeper than 2 mm and the connectivity gate calls it interpenetration.
diff --git a/harness/codeverse3d/prompts/glsl_shader/contract.md b/harness/codeverse3d/prompts/glsl_shader/contract.md
index d7b19fa0..0faab786 100644
--- a/harness/codeverse3d/prompts/glsl_shader/contract.md
+++ b/harness/codeverse3d/prompts/glsl_shader/contract.md
@@ -46,7 +46,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) { ...; fragColor = vec4(co
A static result caps the score at 0.5; NaN/Inf pixels cap it at 0; all-black / blown-out frames cap at 0.5.
* Guard the maths: `x / max(d, 1e-4)`, `sqrt(max(x, 0.0))`, `normalize()` only of non-zero vectors,
`clamp()` acos/asin inputs, `pow(max(x,0.0), k)`.
-* Keep it real-time: ≤ ~100 raymarch steps, ≤ 8 fbm octaves, no nested 100×100 loops.
+* Keep loop bounds constant and small.
* Feedback (`u_prev`): sample at `uv` (optionally offset / scaled), mix with the new frame, and DECAY it
(`prev * 0.9`) — unbounded accumulation blows out. buffer_a.frag reads its own previous frame as `u_prev`;
shader.frag reads the buffer as `u_buffer_a` and its own previous frame as `u_prev`.
diff --git a/harness/codeverse3d/prompts/opengl_python/contract.md b/harness/codeverse3d/prompts/opengl_python/contract.md
index 984d0e85..0262dc5b 100644
--- a/harness/codeverse3d/prompts/opengl_python/contract.md
+++ b/harness/codeverse3d/prompts/opengl_python/contract.md
@@ -34,7 +34,7 @@ def render(ctx: moderngl.Context, state, t: float, frame: int, fbo: moderngl.Fra
* No `moderngl.create_context()` / `create_standalone_context()` (the harness owns the context), no windows, no
`time.time()` / clocks, no `open()` / file writes / subprocess / network / `os` / `sys`.
* GLSL strings: `#version 330 core`, `in`/`out` qualifiers, `out vec4 fragColor;` (no gl_FragColor / varying).
-* Keep frame cost sane (≤ 1M instances·vertices, ≤ 4 full-screen passes); the harness times out at a few minutes per build.
+* Keep frame cost sane.
## Errors come back as `src/program.py:LINE: <Exception>`. GLSL compile errors show the driver log with line
numbers inside the shader STRING; moderngl raises `KeyError: 'u_name'` when you set a uniform the compiler
diff --git a/harness/codeverse3d/prompts/scene_threejs/contract.md b/harness/codeverse3d/prompts/scene_threejs/contract.md
index c046325e..452fe163 100644
--- a/harness/codeverse3d/prompts/scene_threejs/contract.md
+++ b/harness/codeverse3d/prompts/scene_threejs/contract.md
@@ -18,9 +18,8 @@ or off — write shaders that work either way) and `loaders = { gltf, texture, c
manager }` (GLTFLoader etc.). It awaits `createScene`, validates the return value, then
for each camera renders at t ∈ {0, 1.5} s (calling `update`) and takes probes (tris, draw
calls, console/shader errors, camera-inside-geometry, black/blown frames, content coverage,
-fps). Frame gate (`scene_frames`, ERROR on authored cameras): mean luminance < 0.12 or
-> 35 % near-black pixels = too dark; > 20 % pure white = blown; establishing shot with < 20 %
-content pixels (rest sky/ground) = content too small. Dusk/night = coloured, never black
+fps). Frame gate (`scene_frames`, ERROR on authored cameras): too dark, blown out, or an
+establishing shot that is mostly sky/ground. Dusk/night = coloured, never black
(cookbook: "Dusk / night lighting recipe").
## createScene return value
@@ -54,10 +53,9 @@ bloom: author them at peak 1.5–4, not 20. `--no-post` / `C3D_POST=0` turns it
`Date.now()`/`performance.now()` (use `t`); `requestAnimationFrame`; creating a renderer;
changing renderer settings; environment sniffing (`navigator.userAgent`, headless checks).
-## Budget
-≤ 2 M triangles, ≤ 200 draw calls (InstancedMesh for anything repeated > 5×), ≤ 40
-materials, textures only procedural (DataTexture / CanvasTexture is NOT available), GLB
-assets ≤ 5 MB each, `createScene` resolves in < 15 s, `update` < 4 ms.
+## Efficiency
+InstancedMesh for anything repeated > 5×; textures only procedural (DataTexture /
+CanvasTexture is NOT available); `update` allocates nothing and traverses nothing.
## Naming
Zones are Groups named PascalCase (plan zone names); assets Groups PascalCase; every
diff --git a/harness/codeverse3d/prompts/system/harness_contract.md b/harness/codeverse3d/prompts/system/harness_contract.md
index 0cf04531..3adfbd34 100644
--- a/harness/codeverse3d/prompts/system/harness_contract.md
+++ b/harness/codeverse3d/prompts/system/harness_contract.md
@@ -69,12 +69,11 @@ is not evidence; a render is.
that fails — a loud error is cheaper than a silent wrong model.
* Do not edit `plan.json`, `spec.json` or anything under `artifacts/`.
-## 6. Performance limits
+## 6. Efficient code
-* Static objects ≤ 600 k triangles (aim 20–150 k); scenes ≤ 2 M triangles and ≤ 200
- draw calls (instancing for repeats); URDF ≤ 60 links.
-* Build must finish in < 120 s (bpy / CadQuery) or < 20 s (node). No infinite loops,
- no per-vertex Python loops over > 200 k vertices, no subdivision level > 3.
+* Use instancing / merged geometry for repeats.
+* No infinite loops, no per-vertex Python loops over whole meshes (use modifiers /
+ `foreach_set`).
## 7. Definition of done (all boxes, in order)
diff --git a/harness/codeverse3d/prompts/threejs/contract.md b/harness/codeverse3d/prompts/threejs/contract.md
index 2b759e11..adcd975f 100644
--- a/harness/codeverse3d/prompts/threejs/contract.md
+++ b/harness/codeverse3d/prompts/threejs/contract.md
@@ -37,15 +37,13 @@ import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.j
No CDN URLs, no `three/examples/js/*`, no `three/webgpu`, no `three/tsl`, no npm
packages other than `three`, no `import ... from 'codeverse3d'` / `../runtime_js`.
-## Forbidden / limits
+## Forbidden
* No `document`, `window`, `canvas`, `Image`, `TextureLoader`, `fetch`, `XMLHttpRequest`,
`Math.random()` (use a seeded hash), `Date`, `performance`.
* ShaderMaterial is NOT exported to GLB — use `MeshStandardMaterial` /
`MeshPhysicalMaterial` only. Colours via `new THREE.Color(0xRRGGBB)`; vertex colours
allowed (`geometry.setAttribute('color', …)` + `vertexColors: true`).
-* Triangles: hit the **DETAIL BUDGET in the prompt** (sized from this object's plan); the
- absolute ceiling is 600 k. ≤ 300 meshes (use `InstancedMesh` or merged
- geometries for repeats); module evaluates + builds in < 20 s. `InstancedMesh`
+* Use `InstancedMesh` or merged geometries for repeats. `InstancedMesh`
named `Posts` is exported as a group `Posts` of meshes `Posts_0 … Posts_{n-1}`
(instance matrices and colours baked), so gates and the census see every copy.
diff --git a/harness/codeverse3d/prompts/urdf/contract.md b/harness/codeverse3d/prompts/urdf/contract.md
index 317462bc..65939e27 100644
--- a/harness/codeverse3d/prompts/urdf/contract.md
+++ b/harness/codeverse3d/prompts/urdf/contract.md
@@ -38,7 +38,7 @@ You never export.
`upper = plan.upper − rest` — identical to the plan's numbers when `rest` is 0 (the
skeleton already wrote them). `continuous`: `<limit effort velocity/>` only; `fixed`: none.
* Single-root tree: exactly one link that is no joint's child (the base); every other
- link is the child of exactly one joint; no cycles; ≤ 60 links. Moving parts that carry
+ link is the child of exactly one joint; no cycles. Moving parts that carry
hardware (handle on a door, knob on a drawer) attach with a `fixed` joint to the moving
link, not to the base.
* Clearance: 1–3 mm between a moving part and its housing over the WHOLE range (drawer vs
diff --git a/harness/tests/skills/test_contract_agreement.py b/harness/tests/skills/test_contract_agreement.py
index f4f55b0b..4452d92e 100644
--- a/harness/tests/skills/test_contract_agreement.py
+++ b/harness/tests/skills/test_contract_agreement.py
@@ -82,7 +82,7 @@ def _forbidden_apis(contract: Path) -> set[str]:
text = contract.read_text()
out: set[str] = set()
for line in text.splitlines():
- # ONLY the prohibitive bullets. A "Forbidden / limits" block also carries the
+ # ONLY the prohibitive bullets. A "Forbidden" block also carries the
# allowed alternatives ("use MeshStandardMaterial only"), and treating those as
# forbidden would fail every skill that recommends the right thing.
if not re.match(r"\s*\*?\s*(?:No|Never|Forbidden)\b", line):