Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Measure branches on a best-of-three task (part of #67)

Nguyen Xuan An9994747c35a2
diff --git a/bench/agent-modeling/README.md b/bench/agent-modeling/README.md
index cb9e3b66..c0d48fe6 100644
--- a/bench/agent-modeling/README.md
+++ b/bench/agent-modeling/README.md
@@ -215,3 +215,16 @@ The exposure change above was reverted: on the six cold recipes no subject pixel
## Clip layers (2026-10-31)
`robot-walk-wave` asks for a character that walks and waves at once through `motion.layers`. The check `assetWalkAndWave` reloads the exported recipe, plays each layer alone (keeping its own speed, offset and loop) and compares part matrices at two times: the legs must match Walking and move, the right arm must leave Walking, the left arm must keep walking. Cold Sonnet, no skill, `results/2026-10-31-11-40-sonnet-walk-wave-cold-fixed-grader.json`: 1 of 1, 7 tool calls (2 errors), $0.31. A first run, with a check that compared against Walking at speed 1 only, failed on a recipe the agent had correct (it set per-layer speeds); the check was fixed and that recipe grades as a pass. One run is not a rate.
+
+## Best of three, branches on and off (2026-11-01, issue #67)
+
+`best-of-three` starts from a lamp and offers three shade widths (0.1, 0.18, 0.26 m). The agent keeps the one that covers the 0.08 m bulb by 0.03 m a side and fits a 0.2 m shelf; only 0.18 m does. The check on the exported recipe grades size, ground, part count and the shade's centre. The prompt does not mention branches. `run.mjs --branches off` starts the MCP server with `--branches off` (no `branch` field in any schema, no variants advice in the instructions), and each record has `branchCalls`, the calls that passed a branch name.
+
+| Model | Branches | Pass | Calls (3 runs) | Errors | Cost | `branch` calls |
+| --- | --- | --- | --- | --- | --- | --- |
+| Haiku | on | 3/3 | 7, 5, 3 | 1 | $0.17 | 0 |
+| Haiku | off | 3/3 | 6, 4, 7 | 1 | $0.26 | 0 |
+| Sonnet | on | 3/3 | 3, 3, 3 | 0 | $0.96 | 0 |
+| Sonnet | off | 3/3 | 3, 3, 3 | 0 | $0.88 | 0 |
+
+Result: agents ignored branches in all 12 runs. Sonnet wrote the right shade in its first `scene_apply` and exported (3 calls, with or without branches). Haiku varied from 3 to 7 calls either way, with no sign of an effect. Calls did not drop, so the issue's first done condition is not met. The task is too easy to need a comparison: the goal is arithmetic on sizes the prompt states. A task where the right variant can only be told from a render, or where a wrong pick costs a long repair, is the next try. Until then branches have no measured benefit on this suite.
diff --git a/bench/agent-modeling/lamp.mjs b/bench/agent-modeling/lamp.mjs
new file mode 100644
index 00000000..2aa33893
--- /dev/null
+++ b/bench/agent-modeling/lamp.mjs
@@ -0,0 +1,43 @@
+// A lamp with a bulb and a shade. The task offers three shade widths and states a goal that only one of them meets,
+// so the check on the exported recipe tells whether the right variant was kept. How the agent compared them (branches,
+// checkpoints or plain edits) is not graded; the tool calls and the tool names in the transcript show it.
+
+const BULB_SIZE = [0.08, 0.08, 0.08];
+const SHADE_HEIGHT = 0.12;
+const SHADE_BOTTOM_Y = 0.38;
+const STARTING_SHADE_WIDTH = 0.1;
+
+function lampRecipe(shadeWidth) {
+ const parts = [
+ { id: 'base', geometry: 'block', scale: [0.16, 0.02, 0.16], translation: [0, 0.01, 0] },
+ { id: 'stem', geometry: 'block', scale: [0.02, 0.35, 0.02], translation: [0, 0.195, 0] },
+ { id: 'bulb', geometry: 'block', scale: BULB_SIZE, translation: [0, 0.4, 0] },
+ { id: 'shade', geometry: 'block', scale: [shadeWidth, SHADE_HEIGHT, shadeWidth], translation: [0, SHADE_BOTTOM_Y + SHADE_HEIGHT / 2, 0] },
+ ];
+ return {
+ format: '67js.scene', schemaVersion: 1,
+ geometries: [{ id: 'block', type: 'box', bevel: 0 }],
+ materials: [{ id: 'paint', color: [0.8, 0.75, 0.6] }],
+ nodes: parts.map(part => ({ material: 'paint', ...part })),
+ };
+}
+
+/** The lamp as the task starts: a shade 0.1 m wide, too narrow to cover the bulb. */
+export const LAMP_START = lampRecipe(STARTING_SHADE_WIDTH);
+
+/** The right pick: 0.18 m covers the 0.08 m bulb by 0.05 m a side and fits the 0.2 m shelf. */
+export const LAMP_SOLUTION = lampRecipe(0.18);
+
+export const LAMP_PROMPT = `The lamp scene below has a base, a stem, a 0.08 m bulb and a shade. Three shade widths are candidates: 0.1 m (as it is),
+0.18 m and 0.26 m, each square in plan (X and Z) and still 0.12 m tall. Compare the three candidates and keep the one that
+meets both of these goals: the shade covers the bulb with at least 0.03 m to spare on every side when seen from above, and
+the whole lamp fits a shelf that is 0.2 m deep, so it is no wider than 0.2 m. The kept shade stays centred on X = 0 and
+Z = 0 with its underside at 0.38 m. Leave the base, stem and bulb as they are.`;
+
+export const LAMP_CHECKS = [
+ { kind: 'lint' },
+ { kind: 'size', expected: [0.18, 0.5, 0.18] },
+ { kind: 'ground' },
+ { kind: 'parts', min: 4, max: 4 },
+ { kind: 'centreAt', node: 'shade', position: [0, 0.44, 0] },
+];
diff --git a/bench/agent-modeling/references.mjs b/bench/agent-modeling/references.mjs
index 0ceac603..7c3eeb07 100644
--- a/bench/agent-modeling/references.mjs
+++ b/bench/agent-modeling/references.mjs
@@ -7,6 +7,7 @@ const PEBBLE_SIZE = [0.08, 0.03, 0.05];
import { walkerRecipe } from './walker.mjs';
import { KETTLE_RESIZED, KETTLE_RESIZED_PLAIN } from './kettle.mjs';
+import { LAMP_SOLUTION } from './lamp.mjs';
import { DESK_FINAL, DESK_FINAL_PLAIN } from './desk.mjs';
const material = [{ id: 'paint', color: [0.6, 0.55, 0.5] }];
@@ -163,6 +164,7 @@ function robotArmSolver(root, middle, end, target) {
}
export const REFERENCES = {
+ 'best-of-three': LAMP_SOLUTION,
'kettle-resize': KETTLE_RESIZED,
'kettle-resize-plain': KETTLE_RESIZED_PLAIN,
'desk-resize': DESK_FINAL,
diff --git a/bench/agent-modeling/results/2026-11-01-03-25-haiku-best-of-three-branches-on.json b/bench/agent-modeling/results/2026-11-01-03-25-haiku-best-of-three-branches-on.json
new file mode 100644
index 00000000..23d87906
--- /dev/null
+++ b/bench/agent-modeling/results/2026-11-01-03-25-haiku-best-of-three-branches-on.json
@@ -0,0 +1,187 @@
+{
+ "run": "2026-11-01-03-25-haiku-best-of-three-branches-on",
+ "model": "claude-haiku-5-5",
+ "date": "2026-11-01T03:26:57.231Z",
+ "skill": false,
+ "branches": "on",
+ "runsPerTask": 3,
+ "passed": 3,
+ "tasks": 3,
+ "toolCalls": 15,
+ "costUsd": 0.17,
+ "byModel": {
+ "claude-haiku-5-5": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 15,
+ "toolErrors": 1,
+ "inputTokens": 1676912,
+ "outputTokens": 6948,
+ "costUsd": 0.17,
+ "tasks": {
+ "best-of-three": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 15,
+ "toolErrors": 1,
+ "inputTokens": 1676912,
+ "outputTokens": 6948,
+ "costUsd": 0.17
+ }
+ }
+ }
+ },
+ "records": [
+ {
+ "task": "best-of-three",
+ "attempt": 1,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 7,
+ "toolErrors": 1,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_capabilities": 1,
+ "scene_apply": 2,
+ "scene_inspect": 1,
+ "scene_export_recipe": 1,
+ "scene_dispose": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/1/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/1/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/1/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 9,
+ "costUsd": 0.13405773,
+ "inputTokens": 826606,
+ "outputTokens": 2825,
+ "wallSeconds": 30,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 2,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 5,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_capabilities": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1,
+ "scene_dispose": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/2/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/2/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/2/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 7,
+ "costUsd": 0.020072330000000003,
+ "inputTokens": 487331,
+ "outputTokens": 2209,
+ "wallSeconds": 23,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 3,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/3/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/3/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-25-haiku-best-of-three-branches-on/look/3/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.017174770000000002,
+ "inputTokens": 362975,
+ "outputTokens": 1914,
+ "wallSeconds": 23,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/results/2026-11-01-03-26-haiku-best-of-three-branches-off.json b/bench/agent-modeling/results/2026-11-01-03-26-haiku-best-of-three-branches-off.json
new file mode 100644
index 00000000..1644e64e
--- /dev/null
+++ b/bench/agent-modeling/results/2026-11-01-03-26-haiku-best-of-three-branches-off.json
@@ -0,0 +1,188 @@
+{
+ "run": "2026-11-01-03-26-haiku-best-of-three-branches-off",
+ "model": "claude-haiku-5-5",
+ "date": "2026-11-01T03:28:25.536Z",
+ "skill": false,
+ "branches": "off",
+ "runsPerTask": 3,
+ "passed": 3,
+ "tasks": 3,
+ "toolCalls": 17,
+ "costUsd": 0.26,
+ "byModel": {
+ "claude-haiku-5-5": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 17,
+ "toolErrors": 1,
+ "inputTokens": 1828710,
+ "outputTokens": 7617,
+ "costUsd": 0.26,
+ "tasks": {
+ "best-of-three": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 17,
+ "toolErrors": 1,
+ "inputTokens": 1828710,
+ "outputTokens": 7617,
+ "costUsd": 0.26
+ }
+ }
+ }
+ },
+ "records": [
+ {
+ "task": "best-of-three",
+ "attempt": 1,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 6,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_inspect": 2,
+ "scene_apply": 1,
+ "scene_export_recipe": 1,
+ "scene_dispose": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/1/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/1/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/1/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 8,
+ "costUsd": 0.11271308000000001,
+ "inputTokens": 564303,
+ "outputTokens": 2571,
+ "wallSeconds": 25,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 2,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 4,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1,
+ "scene_dispose": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/2/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/2/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/2/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 6,
+ "costUsd": 0.01817491,
+ "inputTokens": 448355,
+ "outputTokens": 2144,
+ "wallSeconds": 22,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 3,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-haiku-5-5",
+ "toolCalls": 7,
+ "toolErrors": 1,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_capabilities": 1,
+ "scene_apply": 2,
+ "scene_inspect": 1,
+ "scene_export_recipe": 1,
+ "scene_dispose": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/3/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/3/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-26-haiku-best-of-three-branches-off/look/3/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 9,
+ "costUsd": 0.13240263,
+ "inputTokens": 816052,
+ "outputTokens": 2902,
+ "wallSeconds": 30,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/results/2026-11-01-03-28-sonnet-best-of-three-branches-on.json b/bench/agent-modeling/results/2026-11-01-03-28-sonnet-best-of-three-branches-on.json
new file mode 100644
index 00000000..1c3d0dee
--- /dev/null
+++ b/bench/agent-modeling/results/2026-11-01-03-28-sonnet-best-of-three-branches-on.json
@@ -0,0 +1,182 @@
+{
+ "run": "2026-11-01-03-28-sonnet-best-of-three-branches-on",
+ "model": "claude-sonnet-5-5",
+ "date": "2026-11-01T03:29:40.868Z",
+ "skill": false,
+ "branches": "on",
+ "runsPerTask": 3,
+ "passed": 3,
+ "tasks": 3,
+ "toolCalls": 9,
+ "costUsd": 0.96,
+ "byModel": {
+ "claude-sonnet-5-5": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 9,
+ "toolErrors": 0,
+ "inputTokens": 1123069,
+ "outputTokens": 3585,
+ "costUsd": 0.96,
+ "tasks": {
+ "best-of-three": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 9,
+ "toolErrors": 0,
+ "inputTokens": 1123069,
+ "outputTokens": 3585,
+ "costUsd": 0.96
+ }
+ }
+ }
+ },
+ "records": [
+ {
+ "task": "best-of-three",
+ "attempt": 1,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/1/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/1/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/1/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.3693396,
+ "inputTokens": 420917,
+ "outputTokens": 1191,
+ "wallSeconds": 23,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 2,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/2/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/2/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/2/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.29449010000000003,
+ "inputTokens": 351163,
+ "outputTokens": 1197,
+ "wallSeconds": 20,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 3,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/3/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/3/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-28-sonnet-best-of-three-branches-on/look/3/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.294188,
+ "inputTokens": 350989,
+ "outputTokens": 1197,
+ "wallSeconds": 22,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/results/2026-11-01-03-29-sonnet-best-of-three-branches-off.json b/bench/agent-modeling/results/2026-11-01-03-29-sonnet-best-of-three-branches-off.json
new file mode 100644
index 00000000..1360b6f0
--- /dev/null
+++ b/bench/agent-modeling/results/2026-11-01-03-29-sonnet-best-of-three-branches-off.json
@@ -0,0 +1,182 @@
+{
+ "run": "2026-11-01-03-29-sonnet-best-of-three-branches-off",
+ "model": "claude-sonnet-5-5",
+ "date": "2026-11-01T03:30:54.646Z",
+ "skill": false,
+ "branches": "off",
+ "runsPerTask": 3,
+ "passed": 3,
+ "tasks": 3,
+ "toolCalls": 9,
+ "costUsd": 0.88,
+ "byModel": {
+ "claude-sonnet-5-5": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 9,
+ "toolErrors": 0,
+ "inputTokens": 1054320,
+ "outputTokens": 3660,
+ "costUsd": 0.88,
+ "tasks": {
+ "best-of-three": {
+ "runs": 3,
+ "passed": 3,
+ "successRate": 1,
+ "toolCalls": 9,
+ "toolErrors": 0,
+ "inputTokens": 1054320,
+ "outputTokens": 3660,
+ "costUsd": 0.88
+ }
+ }
+ }
+ },
+ "records": [
+ {
+ "task": "best-of-three",
+ "attempt": 1,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/1/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/1/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/1/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.29567010000000005,
+ "inputTokens": 351689,
+ "outputTokens": 1245,
+ "wallSeconds": 21,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 2,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/2/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/2/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/2/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.2934764999999999,
+ "inputTokens": 350699,
+ "outputTokens": 1158,
+ "wallSeconds": 20,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "best-of-three",
+ "attempt": 3,
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "branchCalls": 0,
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": [],
+ "motionIk": [],
+ "motionTracks": 0
+ },
+ "look": {
+ "silhouette": {
+ "views": {
+ "front": 1,
+ "side": 1,
+ "three-quarter": 1
+ },
+ "mean": 1
+ },
+ "images": [
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/3/best-of-three-front.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/3/best-of-three-side.png",
+ "artifacts/agent-modeling/2026-11-01-03-29-sonnet-best-of-three-branches-off/look/3/best-of-three-three-quarter.png"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.2958339,
+ "inputTokens": 351932,
+ "outputTokens": 1257,
+ "wallSeconds": 21,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/run.mjs b/bench/agent-modeling/run.mjs
index c7525f9d..d64884c4 100644
--- a/bench/agent-modeling/run.mjs
+++ b/bench/agent-modeling/run.mjs
@@ -2,11 +2,13 @@
// server, then grades the recipe the agent exported.
//
// node bench/agent-modeling/run.mjs --claude <claude executable> [--model sonnet] [--tasks crate,bolt]
-// [--runs 3] [--budget 3] [--timeout 1200] [--label baseline] [--skill] [--resume <run name>]
+// [--runs 3] [--budget 3] [--timeout 1200] [--label baseline] [--skill] [--branches off] [--resume <run name>]
//
// --runs repeats every task that many times, each in a fresh session; the summary reports success rate, tool calls,
// tool errors, tokens and cost for the model and for each task.
// --resume continues a run that stopped early and skips the task attempts it already recorded. Pass the same --runs.
+// --branches off starts the MCP server with --branches off: no branch field in any schema and no mention of variants in
+// the instructions. Records carry branchCalls, the tool calls that passed a branch name, so a run shows whether agents used them.
// --skill puts the build-67js-scene entry point and its mesh reference in the system prompt. That measures what the
// skill's knowledge is worth, not whether an agent would load the skill on its own.
//
@@ -37,6 +39,7 @@ const { values: options } = parseArgs({
timeout: { type: 'string', default: '1200' },
label: { type: 'string', default: 'run' },
skill: { type: 'boolean', default: false },
+ branches: { type: 'string', default: 'on' },
resume: { type: 'string' },
},
});
@@ -55,7 +58,7 @@ async function skillPrompt() {
function mcpConfig(assetDirectory) {
return { mcpServers: { [MCP_SERVER_NAME]: {
command: process.execPath,
- args: [join(repository, 'scripts', 'mcp-server.mjs'), '--backend', 'gpu', '--memory', '192', ...(assetDirectory ? ['--assets', assetDirectory] : [])],
+ args: [join(repository, 'scripts', 'mcp-server.mjs'), '--backend', 'gpu', '--memory', '192', '--branches', options.branches, ...(assetDirectory ? ['--assets', assetDirectory] : [])],
} } };
}
@@ -99,7 +102,7 @@ function textOf(content) {
/** Tool calls, errors, the model, usage and the last exported recipe from a stream-json transcript. */
function readTranscript(output) {
- const summary = { model: null, toolCalls: 0, toolErrors: 0, toolsByName: {}, recipe: null, result: null };
+ const summary = { model: null, toolCalls: 0, toolErrors: 0, toolsByName: {}, branchCalls: 0, recipe: null, result: null };
const exportCalls = new Set();
for (const line of output.split('\n')) {
if (!line.trim().startsWith('{')) continue;
@@ -117,6 +120,7 @@ function readTranscript(output) {
// ToolSearch only loads the MCP tool schemas; it is harness overhead, not modeling work.
if (block.name !== 'ToolSearch') summary.toolCalls++;
summary.toolsByName[name] = (summary.toolsByName[name] ?? 0) + 1;
+ if (block.input?.branch !== undefined || block.input?.shots?.some(shot => shot.branch !== undefined)) summary.branchCalls++;
if (block.name === EXPORT_TOOL) exportCalls.add(block.id);
}
}
@@ -181,6 +185,7 @@ async function runTask(task, attempt, systemPromptAddition) {
toolCalls: transcript.toolCalls,
toolErrors: transcript.toolErrors,
toolsByName: transcript.toolsByName,
+ branchCalls: transcript.branchCalls,
features: transcript.recipe ? recipeFeatures(transcript.recipe) : null,
look: transcript.recipe ? await scoreLookSafely(task.id, transcript.recipe, { imageDirectory: join(rawDirectory, 'look', String(attempt)) }) : null,
turns: transcript.result?.num_turns ?? null,
@@ -196,6 +201,7 @@ async function runTask(task, attempt, systemPromptAddition) {
}
}
+if (!['on', 'off'].includes(options.branches)) throw new RangeError('--branches must be on or off');
const tasks = options.tasks ? options.tasks.split(',').map(taskById) : TASKS;
await mkdir(rawDirectory, { recursive: true });
await mkdir(resultsDirectory, { recursive: true });
@@ -213,6 +219,7 @@ function summarize() {
model: records.find(record => record.model)?.model ?? options.model,
date: new Date().toISOString(),
skill: options.skill,
+ branches: options.branches,
runsPerTask: attempts,
passed: records.filter(record => record.pass).length,
tasks: records.length,
diff --git a/bench/agent-modeling/tasks.mjs b/bench/agent-modeling/tasks.mjs
index e01f7dbb..5de2bad5 100644
--- a/bench/agent-modeling/tasks.mjs
+++ b/bench/agent-modeling/tasks.mjs
@@ -4,6 +4,7 @@
import { REFERENCES } from './references.mjs';
import { KETTLE_START, KETTLE_START_PLAIN } from './kettle.mjs';
import { DESK_START, DESK_START_PLAIN, DESK_CHECKS } from './desk.mjs';
+import { LAMP_START, LAMP_PROMPT, LAMP_CHECKS } from './lamp.mjs';
import { TERRAIN_TASKS } from './terrain.mjs';
export const PROMPT_PREAMBLE = `You are modeling with the 67js MCP tools. Build the object described below as a procedural recipe scene:
@@ -547,6 +548,7 @@ exported recipe is what gets graded.`,
{ kind: 'assetRagdoll', minimumDrop: 1.5, minimumDuration: 3, floorTolerance: 0.3, maximumHeight: 1.6 },
],
},
+ { id: 'best-of-three', startRecipe: LAMP_START, prompt: LAMP_PROMPT, checks: LAMP_CHECKS },
...KETTLE_TASKS,
...DESK_TASKS,
{
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index 2e1c95a2..15b2b7f8 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -647,9 +647,15 @@ function jsonResult(value) {
return { content: [{ type: 'text', text: JSON.stringify(value) }], structuredContent: value };
}
-export function createAgentMcpServer(runtime, { version = packageMetadata.version } = {}) {
+export function createAgentMcpServer(runtime, { version = packageMetadata.version, branches = true } = {}) {
+ // Without branches the schemas carry no branch field and the instructions do not mention variants (a benchmark switch).
+ const branchField = branches ? { branch: branchName.optional().describe('Fork: store the result as this branch (up to 8), leaving the scene unchanged.') } : {};
+ const reviewBranchField = branches ? { branch: branchName.optional().describe('Render this scene_apply branch.') } : {};
+ const restoreBranchField = branches ? { branch: branchName.optional() } : {};
+ const restoreCheckpointId = branches ? checkpointFields.checkpointId.optional() : checkpointFields.checkpointId;
+ const branchInstructions = branches ? ' To try variants, give scene_apply a branch name for each (the scene stays put), compare them in one scene_review with a branch per shot, then keep the best with scene_restore and its branch.' : '';
const server = new McpServer({ name: '67js-scene', version }, {
- instructions: 'Start with scene_capabilities. Create a procedural recipe with scene_create, or select a configured GLB digest from scene_asset_catalog and use scene_create_asset. Inspect stable IDs and save a checkpoint before editing. Apply small batches with the current expectedRevision and check committed, revision and renderSucceeded. A committed edit can have a separate renderError; do not retry it with an old revision. To try variants, give scene_apply a branch name for each (the scene stays put), compare them in one scene_review with a branch per shot, then keep the best with scene_restore and its branch. Pass labels: true to scene_look or scene_review to match part names to the image. Use scene_look to judge the actual image, or scene_review with the current expectedRevision to compare independent camera and motion samples in one grid while preserving the source pose. When jobs are configured, scene_render_submit captures an immutable snapshot. Poll scene_render_status, cancel when needed, and retrieve verified local artifact metadata with scene_render_result after completion. Preview rendering and edits pause during a job; source revision and checkpoints survive. Release outputs with scene_render_release. Export the final recipe and dispose the scene when finished. No arbitrary JavaScript, remote URLs or caller-selected output paths are exposed.',
+ instructions: 'Start with scene_capabilities. Create a procedural recipe with scene_create, or select a configured GLB digest from scene_asset_catalog and use scene_create_asset. Inspect stable IDs and save a checkpoint before editing. Apply small batches with the current expectedRevision and check committed, revision and renderSucceeded. A committed edit can have a separate renderError; do not retry it with an old revision.'+branchInstructions+' Pass labels: true to scene_look or scene_review to match part names to the image. Use scene_look to judge the actual image, or scene_review with the current expectedRevision to compare independent camera and motion samples in one grid while preserving the source pose. When jobs are configured, scene_render_submit captures an immutable snapshot. Poll scene_render_status, cancel when needed, and retrieve verified local artifact metadata with scene_render_result after completion. Preview rendering and edits pause during a job; source revision and checkpoints survive. Release outputs with scene_render_release. Export the final recipe and dispose the scene when finished. No arbitrary JavaScript, remote URLs or caller-selected output paths are exposed.',
});
let closePromise;
server.server.onclose = () => {
@@ -689,7 +695,7 @@ export function createAgentMcpServer(runtime, { version = packageMetadata.versio
register('mesh_inspect', 'Check recipe geometries as polygon meshes: vertex, edge and face counts, triangles/quads/n-gons, connected and closed parts, face tags (top, bottom, side, left, right, front, back), bounds, and lint problems (non-manifold, inconsistent winding, inverted, degenerate, open, loose) with a suggested fix each. Also imported asset parts (mesh-0). Read-only and cached per geometry.', z.strictObject({ ...sessionFields, geometry: identifier.optional().describe('One geometry ID to check, as in mesh_edit.'), geometries: z.array(identifier).min(1).max(16).optional().describe('Geometry IDs to check. Omit both to check the first 16 geometries.') }), readOnly, async ({ geometry: geometryId, geometries, ...rest }) => jsonResult(await runtime.inspectMeshes({ ...rest, ...(geometries || geometryId ? { geometries: [...(geometries ?? []), ...(geometryId ? [geometryId] : [])] } : {}) })));
register('mesh_edit', 'Append edits to a recipe mesh geometry or an imported asset part such as mesh-0 (or replace its edit log), atomically like scene_apply: extrude, inset, delete, flip, translate with falloff, tag, loop cut, bevel, mirror, array, solidify, UV unwrap, set_position and displace with field expressions (math, noise, attributes), booleans with a primitive cutter, sculpt brush strokes and shrinkwrap onto a primitive. Edits that select no faces or break limits fail without changing the scene. Returns the new revision, render status and the mesh report with per-edit results.', z.strictObject({ ...sessionFields, expectedRevision, geometry: identifier.describe('ID of a geometry with type mesh, or an imported part such as mesh-0.'), edits: meshEdits.min(1), replace: z.boolean().optional().describe('Replace the whole edit log instead of appending.') }), edit, async argumentsValue => jsonResult(await runtime.editMesh(argumentsValue)));
register('mesh_stack', 'Set the non-destructive modifier stack of a recipe mesh geometry (ops and fields: scene_capabilities meshModifiers), evaluated after its edits, each prefix cached. apply: n moves the first n nodes into the edit log, as Blender\'s Apply modifier. Atomic like scene_apply. Returns the revision, render status and mesh report.', z.strictObject({ ...sessionFields, expectedRevision, geometry: identifier.describe('ID of a geometry with type mesh.'), stack: meshStack.optional().describe('The whole new stack. Omit to keep the current stack (for example with apply).'), apply: z.number().int().min(0).max(16).optional() }), edit, async argumentsValue => jsonResult(await runtime.setMeshStack(argumentsValue)));
- register('scene_apply', 'Atomically edit transforms, look, camera or materials. Procedural scenes support membership and set-motion authoring. Imported assets support set-root, set-asset-node, set-motion and absolute set-animation sampling. Successful batches increment revision once.', z.strictObject({ ...sessionFields, expectedRevision, operations: z.array(operation).min(1).max(256).describe('Node/material/camera/root/animation commands use flat fields. Motion, look patches and add commands contain nested records. Backend validates each scene mode before publication.'), branch: branchName.optional().describe('Fork: store the result as this branch (up to 8), leaving the scene unchanged.') }), edit, async argumentsValue => jsonResult(await runtime.apply(argumentsValue)));
+ register('scene_apply', 'Atomically edit transforms, look, camera or materials. Procedural scenes support membership and set-motion authoring. Imported assets support set-root, set-asset-node, set-motion and absolute set-animation sampling. Successful batches increment revision once.', z.strictObject({ ...sessionFields, expectedRevision, operations: z.array(operation).min(1).max(256).describe('Node/material/camera/root/animation commands use flat fields. Motion, look patches and add commands contain nested records. Backend validates each scene mode before publication.'), ...branchField }), edit, async argumentsValue => jsonResult(await runtime.apply(argumentsValue)));
register('scene_look', 'Render the active scene as a bounded PNG, optionally with part labels. Optional authored motionTime seeks without changing revision; null restores the authored base pose. Omit to retain the last preview pose.', z.strictObject({ ...sessionFields, motionTime: z.number().min(0).max(3600).nullable().optional(), width: z.number().int().min(64).max(1024).default(768).describe('PNG width in pixels.'), height: z.number().int().min(64).max(1024).default(512).describe('PNG height in pixels.'), labels: labelsFlag }), readOnly, async argumentsValue => {
const { data, mimeType, metadata } = await runtime.look(argumentsValue);
return { content: [{ type: 'image', data, mimeType }, { type: 'text', text: JSON.stringify(metadata) }], structuredContent: metadata };
@@ -701,7 +707,7 @@ export function createAgentMcpServer(runtime, { version = packageMetadata.versio
labels: labelsFlag,
shots: z.array(z.strictObject({
label: z.string().max(48).optional(),
- branch: branchName.optional().describe('Render this scene_apply branch.'),
+ ...reviewBranchField,
camera: z.strictObject(cameraFields).optional(),
animation: z.strictObject({ clip: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER), time: z.number().min(0).max(3600) }).optional(),
motionTime: z.number().min(0).max(3600).nullable().optional(),
@@ -712,7 +718,7 @@ export function createAgentMcpServer(runtime, { version = packageMetadata.versio
return { content: [{ type: 'image', data, mimeType }, { type: 'text', text: JSON.stringify(metadata) }], structuredContent: metadata };
});
register('scene_checkpoint', 'Save a private recipe snapshot. Up to eight checkpoints can be retained per session.', z.strictObject(sessionFields), { ...edit, destructiveHint: false }, async argumentsValue => jsonResult(await runtime.checkpoint(argumentsValue)));
- register('scene_restore', 'Restore a checkpoint atomically using the current revision. The checkpoint remains available and revision increments. With branch instead of checkpointId, keep that branch (one revision) and drop all branches.', z.strictObject({ ...sessionFields, checkpointId: checkpointFields.checkpointId.optional(), branch: branchName.optional(), expectedRevision }), edit, async argumentsValue => jsonResult(await runtime.restore(argumentsValue)));
+ register('scene_restore', 'Restore a checkpoint atomically using the current revision. The checkpoint remains available and revision increments. With branch instead of checkpointId, keep that branch (one revision) and drop all branches.', z.strictObject({ ...sessionFields, checkpointId: restoreCheckpointId, ...restoreBranchField, expectedRevision }), edit, async argumentsValue => jsonResult(await runtime.restore(argumentsValue)));
register('scene_release_checkpoint', 'Release one checkpoint slot. Released or foreign checkpoints fail.', z.strictObject(checkpointFields), edit, async argumentsValue => jsonResult(await runtime.releaseCheckpoint(argumentsValue)));
register('scene_export_recipe', 'Read a detached canonical JSON recipe for reproduction.', z.strictObject(sessionFields), readOnly, async argumentsValue => jsonResult(await runtime.exportRecipe(argumentsValue)));
register('scene_export_glb', 'Write the active scene as a GLB file in the configured jobs folder, under a server-chosen name (the result has the path, byte count and SHA-256). Needs --jobs. Exports the current pose with pattern and imported textures, skins, morph weights and IK as posed; motionTime seeks authored motion first. For an imported asset, clip adds that source clip (translation, rotation, scale and morph weight tracks) on the source skeleton, which needs no animation, node overrides or motion in the scene. At most eight files are kept, oldest removed first; the GLB is at most 32 MiB.', z.strictObject({ ...sessionFields, clip: z.number().int().min(0).max(255).optional().describe('Imported assets only: index of the source clip to write.'), motionTime: z.number().min(0).max(3600).optional().describe('Seek authored motion (and IK) to this time before exporting. Leaves the preview there, like scene_look.'), maxTextureSize: z.number().int().min(1).max(4096).optional().describe('Largest texture side in pixels. Defaults to 2048.') }), edit, async argumentsValue => jsonResult(await runtime.exportGlb(argumentsValue)));
@@ -731,8 +737,8 @@ export async function runMcpCli({ argumentsValue = process.argv.slice(2),
for (let index = 0; index < argumentsValue.length; index += 2) {
const name = argumentsValue[index];
const value = argumentsValue[index + 1];
- if (!['--backend', '--browser', '--memory', '--assets', '--jobs', '--ffmpeg', '--audio'].includes(name) || value === undefined) {
- throw new Error(`Use --backend cpu|gpu, --browser <local executable path>, --memory <32..${MAXIMUM_MEMORY_MIB} MiB>, --assets <absolute GLB directory>, --jobs <absolute private output directory>, --ffmpeg <absolute executable>, and --audio <absolute folder of .wav, .mp3, .ogg or .flac files for video jobs>.`);
+ if (!['--backend', '--browser', '--memory', '--assets', '--jobs', '--ffmpeg', '--audio', '--branches'].includes(name) || value === undefined) {
+ throw new Error(`Use --backend cpu|gpu, --browser <local executable path>, --memory <32..${MAXIMUM_MEMORY_MIB} MiB>, --assets <absolute GLB directory>, --jobs <absolute private output directory>, --ffmpeg <absolute executable>, --audio <absolute folder of .wav, .mp3, .ogg or .flac files for video jobs>, and --branches on|off (default on).`);
}
options[name.slice(2)] = name === '--memory' ? Number(value) : value;
}
@@ -741,7 +747,7 @@ export async function runMcpCli({ argumentsValue = process.argv.slice(2),
}
setPriority(0, constants.priority.PRIORITY_BELOW_NORMAL);
const { createAgentRuntime } = await import('./agent-runtime.mjs');
- const handle = serveStdio(() => createAgentMcpServer(createAgentRuntime({ ...options, previewUrl }), { version }), {
+ const handle = serveStdio(() => createAgentMcpServer(createAgentRuntime({ ...options, previewUrl }), { version, branches: options.branches !== 'off' }), {
transport: new StdioServerTransport(process.stdin, process.stdout, { maxBufferSize: 2 * 1024 * 1024 }),
onerror: error => console.error(`67js MCP error: ${error.message}`),
});
diff --git a/tests/mcp-tools.test.js b/tests/mcp-tools.test.js
index 6d23ea55..b7df556b 100644
--- a/tests/mcp-tools.test.js
+++ b/tests/mcp-tools.test.js
@@ -420,6 +420,26 @@ test('SDK stdio EOF closes the runtime without launching a scene', async () => {
output.destroy();
});
+test('branches off leaves the branch field and the variants advice out of the schemas', async context => {
+ const server = createAgentMcpServer({ async close() {}, activeSessionId() { return null; } }, { branches: false });
+ const client = new Client({ name: '67js-branches-off-test', version: '1' });
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
+ await server.connect(serverTransport);
+ await client.connect(clientTransport);
+ context.after(async () => {
+ await client.close();
+ await server.close();
+ });
+ const { tools } = await client.listTools();
+ for (const toolName of ['scene_apply', 'scene_restore', 'scene_review']) {
+ const tool = tools.find(candidate => candidate.name === toolName);
+ assert.ok(!JSON.stringify(tool.inputSchema).includes('"branch"'), `${toolName} must not offer a branch`);
+ }
+ const restore = tools.find(candidate => candidate.name === 'scene_restore');
+ assert.ok(restore.inputSchema.required.includes('checkpointId'));
+ assert.ok(!client.getInstructions().includes('branch'));
+});
+
test('SDK dynamic batches create resources, reject dangling edits, and restore scene membership', async context => {
const { client, sessionId } = await connect(context);
const call = (name, argumentsValue) => client.callTool({ name, arguments: argumentsValue });