Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Compare the agent suite with the skill and add harder tasks

Nguyen Xuan Anb973b24f4cf3
diff --git a/bench/agent-modeling/README.md b/bench/agent-modeling/README.md
index 78bf0a48..35e8b63e 100644
--- a/bench/agent-modeling/README.md
+++ b/bench/agent-modeling/README.md
@@ -33,6 +33,9 @@ own mesh report:
| bracket | Two plates and two holes |
| soap | Rounding every edge (bevel) |
| crate-uv | The crate with even UVs |
+| dice | Rounded edges plus 21 recessed pips, in one piece (harder) |
+| flange | A hollow pipe with flanges and 12 bolt holes, in one piece (harder) |
+| chair | Many exact parts, with open gaps between back slats (harder) |
`references.mjs` holds one hand-built solution per task. `tests/agent-modeling-suite.test.js` checks that every
reference passes and that broken variants fail. That keeps a wrong checker from costing an agent run.
@@ -93,3 +96,30 @@ Friction seen in the transcripts, all fixed after this baseline:
All five passed both times. The window run now builds the frame with one `extrude`, the route it gave up on before. The
one remaining error is the gear run trying the disabled Bash tool. With one run per task this shows a direction, not an
exact size.
+
+## With the skill, and harder tasks
+
+`results/2026-10-30-11-32-sonnet-with-skill.json` runs all 13 tasks with `--skill`. The no-skill side is
+`results/2026-10-30-11-43-sonnet-hard-no-skill.json` for the three harder tasks, the after-fixes run for its five tasks,
+and the baseline for the other five. Same model, one run per task.
+
+| Tasks | Passed | Tool calls | Tool errors | Cost (USD) |
+| --- | --- | --- | --- | --- |
+| First 10, no skill | 10/10 | 45 | 2 | 4.40 |
+| First 10, with skill | 10/10 | 39 | 4 | 4.44 |
+| dice, flange, chair, no skill | 3/3 | 12 | 1 | 1.40 |
+| dice, flange, chair, with skill | 3/3 | 8 | 0 | 1.43 |
+
+What this does and does not show:
+
+- **The harder tasks did not lift the ceiling.** Sonnet passes all 13 either way, including a die with 21 recesses and a
+ pipe with 12 bolt holes. A part with exact sizes is solved in a few calls, often one `scene_create`. Success on such
+ tasks cannot separate one tool set from another.
+- **The skill made no clear difference to cost.** The gap in calls is small enough to be noise at one run per task, and the
+ cost is flat. It can change the method: with it, the crate run used insets and extrusions instead of booleans.
+- **Most of the edit vocabulary went unused either way.** `mesh_edit` appeared in one of 13 runs with the skill, and
+ `mesh_stack`, `loop_cut`, `mirror`, `array` and `solidify` in none. Agents write the whole recipe at once. This is about
+ these tasks, which do not need those operations; it does not show the operations are useless.
+
+The suite now finds tool friction and tracks cost, but does not measure how good an object looks. Tasks with free form,
+such as organic shapes or a look to match, would need a score for appearance before they could test more.
diff --git a/bench/agent-modeling/references.mjs b/bench/agent-modeling/references.mjs
index d0b97881..5c1e86ed 100644
--- a/bench/agent-modeling/references.mjs
+++ b/bench/agent-modeling/references.mjs
@@ -57,7 +57,76 @@ function gearContour(teeth, tipRadius, rootRadius) {
return points;
}
+const PIP_LAYOUTS = {
+ 1: [[0, 0]],
+ 2: [[-1, -1], [1, 1]],
+ 3: [[-1, -1], [0, 0], [1, 1]],
+ 4: [[-1, -1], [-1, 1], [1, -1], [1, 1]],
+ 5: [[-1, -1], [-1, 1], [0, 0], [1, -1], [1, 1]],
+ 6: [[-1, -1], [-1, 0], [-1, 1], [1, -1], [1, 0], [1, 1]],
+};
+const DIE_FACES = [
+ { pips: 1, point: (first, second) => [first, 0.5, second] },
+ { pips: 6, point: (first, second) => [first, -0.5, second] },
+ { pips: 2, point: (first, second) => [0.5, first, second] },
+ { pips: 5, point: (first, second) => [-0.5, first, second] },
+ { pips: 3, point: (first, second) => [first, second, 0.5] },
+ { pips: 4, point: (first, second) => [first, second, -0.5] },
+];
+
+function dieEdits() {
+ const pipEdits = [];
+ for (const face of DIE_FACES) {
+ for (const [first, second] of PIP_LAYOUTS[face.pips]) {
+ pipEdits.push({
+ op: 'boolean', operation: 'difference', name: `pip-${pipEdits.length}`,
+ cutter: { type: 'sphere', segments: 16, rings: 8 },
+ translation: face.point(first * 0.25, second * 0.25), scale: [0.1, 0.1, 0.1],
+ });
+ }
+ }
+ return [{ op: 'bevel', edges: { all: true }, width: 0.1, segments: 3 }, ...pipEdits];
+}
+
+function boltHoleEdits() {
+ const edits = [];
+ for (const height of [0.01, 0.29]) {
+ for (let hole = 0; hole < 6; hole++) {
+ const angle = hole / 6 * Math.PI * 2;
+ edits.push({
+ op: 'boolean', operation: 'difference', name: `bolt-${edits.length}`,
+ cutter: { type: 'cylinder', segments: 24, bevel: 0 },
+ translation: [0.07 * Math.cos(angle), height, 0.07 * Math.sin(angle)], scale: [0.008, 0.04, 0.008],
+ });
+ }
+ }
+ return edits;
+}
+
export const REFERENCES = {
+ dice: scene(
+ [{ id: 'die', type: 'mesh', base: { type: 'box', bevel: 0 }, edits: dieEdits() }],
+ [{ id: 'die', geometry: 'die', translation: [0, 0.05, 0], scale: [0.1, 0.1, 0.1] }],
+ ),
+ flange: scene(
+ [{
+ id: 'pipe', type: 'mesh',
+ base: { type: 'lathe', segments: 64, profile: [[0.04, 0.3], [0.04, 0], [0.09, 0], [0.09, 0.02], [0.05, 0.02], [0.05, 0.28], [0.09, 0.28], [0.09, 0.3], [0.04, 0.3]] },
+ edits: boltHoleEdits(),
+ }],
+ [{ id: 'pipe', geometry: 'pipe' }],
+ ),
+ chair: scene(
+ [{ id: 'block', type: 'box', bevel: 0 }],
+ [
+ { id: 'seat', geometry: 'block', translation: [0, 0.435, 0], scale: [0.45, 0.03, 0.45] },
+ { id: 'front-left', geometry: 'block', translation: [-0.205, 0.21, 0.205], scale: [0.04, 0.42, 0.04] },
+ { id: 'front-right', geometry: 'block', translation: [0.205, 0.21, 0.205], scale: [0.04, 0.42, 0.04] },
+ { id: 'post-left', geometry: 'block', translation: [-0.205, 0.45, -0.205], scale: [0.04, 0.9, 0.04] },
+ { id: 'post-right', geometry: 'block', translation: [0.205, 0.45, -0.205], scale: [0.04, 0.9, 0.04] },
+ ...[0.6, 0.7, 0.8].map((height, index) => ({ id: `slat-${index}`, geometry: 'block', translation: [0, height, -0.205], scale: [0.37, 0.06, 0.02] })),
+ ],
+ ),
crate: scene(
[{ id: 'crate', type: 'mesh', base: { type: 'box', bevel: 0 }, edits: crateEdits }],
[{ id: 'crate', geometry: 'crate', translation: [0, 0.3, 0] }],
diff --git a/bench/agent-modeling/results/2026-10-30-11-32-sonnet-with-skill.json b/bench/agent-modeling/results/2026-10-30-11-32-sonnet-with-skill.json
new file mode 100644
index 00000000..946bd714
--- /dev/null
+++ b/bench/agent-modeling/results/2026-10-30-11-32-sonnet-with-skill.json
@@ -0,0 +1,417 @@
+{
+ "run": "2026-10-30-11-32-sonnet-with-skill",
+ "model": "claude-sonnet-5-5",
+ "date": "2026-10-30T11:43:51.144Z",
+ "skill": true,
+ "passed": 13,
+ "tasks": 13,
+ "toolCalls": 47,
+ "costUsd": 5.87,
+ "records": [
+ {
+ "task": "crate",
+ "pass": true,
+ "passed": 8,
+ "total": 8,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "translate",
+ "inset_individual",
+ "inset_region",
+ "extrude_face_region"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.36768940000000006,
+ "inputTokens": 350675,
+ "outputTokens": 1666,
+ "wallSeconds": 24,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "bolt",
+ "pass": true,
+ "passed": 7,
+ "total": 7,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 2,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "cylinder"
+ ],
+ "meshOperations": []
+ },
+ "turns": 4,
+ "costUsd": 0.43042709999999995,
+ "inputTokens": 380610,
+ "outputTokens": 1276,
+ "wallSeconds": 27,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "window",
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 7,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 2,
+ "scene_create": 2,
+ "scene_inspect": 1,
+ "scene_dispose": 1,
+ "mesh_inspect": 1,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": []
+ },
+ "turns": 10,
+ "costUsd": 0.5192932000000001,
+ "inputTokens": 975454,
+ "outputTokens": 2616,
+ "wallSeconds": 46,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "table",
+ "pass": true,
+ "passed": 6,
+ "total": 6,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 2,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": []
+ },
+ "turns": 4,
+ "costUsd": 0.4200646,
+ "inputTokens": 372934,
+ "outputTokens": 1249,
+ "wallSeconds": 30,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "mug",
+ "pass": true,
+ "passed": 7,
+ "total": 7,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 6,
+ "toolErrors": 2,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 2,
+ "scene_inspect": 1,
+ "mesh_edit": 2,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "boolean"
+ ]
+ },
+ "turns": 8,
+ "costUsd": 0.5129329,
+ "inputTokens": 746392,
+ "outputTokens": 3739,
+ "wallSeconds": 66,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "gear",
+ "pass": true,
+ "passed": 5,
+ "total": 5,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 6,
+ "toolErrors": 1,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "Bash": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_inspect": 1,
+ "scene_look": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "extrude"
+ ],
+ "meshOperations": []
+ },
+ "turns": 8,
+ "costUsd": 0.5491131,
+ "inputTokens": 872478,
+ "outputTokens": 5510,
+ "wallSeconds": 76,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "fence",
+ "pass": true,
+ "passed": 6,
+ "total": 6,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 2,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": []
+ },
+ "turns": 4,
+ "costUsd": 0.42201340000000004,
+ "inputTokens": 373555,
+ "outputTokens": 1300,
+ "wallSeconds": 29,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "bracket",
+ "pass": true,
+ "passed": 6,
+ "total": 6,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 5,
+ "toolErrors": 1,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 2,
+ "scene_apply": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "boolean"
+ ]
+ },
+ "turns": 7,
+ "costUsd": 0.4729381,
+ "inputTokens": 620916,
+ "outputTokens": 2089,
+ "wallSeconds": 42,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "soap",
+ "pass": true,
+ "passed": 7,
+ "total": 7,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "translate",
+ "bevel"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.28460620000000003,
+ "inputTokens": 347107,
+ "outputTokens": 1379,
+ "wallSeconds": 28,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "crate-uv",
+ "pass": true,
+ "passed": 9,
+ "total": 9,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "translate",
+ "inset_individual",
+ "inset_region",
+ "extrude_face_region",
+ "uv_unwrap"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.4593121,
+ "inputTokens": 504421,
+ "outputTokens": 1811,
+ "wallSeconds": 32,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "dice",
+ "pass": true,
+ "passed": 12,
+ "total": 12,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "translate",
+ "bevel",
+ "boolean"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.524078,
+ "inputTokens": 518478,
+ "outputTokens": 5605,
+ "wallSeconds": 55,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "flange",
+ "pass": true,
+ "passed": 9,
+ "total": 9,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "mesh_inspect": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "boolean"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.4612891,
+ "inputTokens": 503412,
+ "outputTokens": 2073,
+ "wallSeconds": 32,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "chair",
+ "pass": true,
+ "passed": 7,
+ "total": 7,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 2,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": []
+ },
+ "turns": 4,
+ "costUsd": 0.4476457,
+ "inputTokens": 385452,
+ "outputTokens": 2093,
+ "wallSeconds": 34,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/results/2026-10-30-11-43-sonnet-hard-no-skill.json b/bench/agent-modeling/results/2026-10-30-11-43-sonnet-hard-no-skill.json
new file mode 100644
index 00000000..41ad243d
--- /dev/null
+++ b/bench/agent-modeling/results/2026-10-30-11-43-sonnet-hard-no-skill.json
@@ -0,0 +1,104 @@
+{
+ "run": "2026-10-30-11-43-sonnet-hard-no-skill",
+ "model": "claude-sonnet-5-5",
+ "date": "2026-10-30T11:46:13.728Z",
+ "skill": false,
+ "passed": 3,
+ "tasks": 3,
+ "toolCalls": 12,
+ "costUsd": 1.4,
+ "records": [
+ {
+ "task": "dice",
+ "pass": true,
+ "passed": 12,
+ "total": 12,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 7,
+ "toolErrors": 1,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 2,
+ "scene_look": 3,
+ "scene_dispose": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "bevel",
+ "boolean"
+ ]
+ },
+ "turns": 9,
+ "costUsd": 0.5592132,
+ "inputTokens": 825829,
+ "outputTokens": 8215,
+ "wallSeconds": 67,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "flange",
+ "pass": true,
+ "passed": 9,
+ "total": 9,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 3,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_look": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "mesh"
+ ],
+ "meshOperations": [
+ "boolean"
+ ]
+ },
+ "turns": 5,
+ "costUsd": 0.4342255,
+ "inputTokens": 465274,
+ "outputTokens": 2471,
+ "wallSeconds": 36,
+ "exitCode": 0,
+ "stopped": "success"
+ },
+ {
+ "task": "chair",
+ "pass": true,
+ "passed": 7,
+ "total": 7,
+ "failed": [],
+ "model": "claude-sonnet-5-5",
+ "toolCalls": 2,
+ "toolErrors": 0,
+ "toolsByName": {
+ "ToolSearch": 1,
+ "scene_create": 1,
+ "scene_export_recipe": 1
+ },
+ "features": {
+ "geometryTypes": [
+ "box"
+ ],
+ "meshOperations": []
+ },
+ "turns": 4,
+ "costUsd": 0.4079489,
+ "inputTokens": 352518,
+ "outputTokens": 1731,
+ "wallSeconds": 32,
+ "exitCode": 0,
+ "stopped": "success"
+ }
+ ]
+}
diff --git a/bench/agent-modeling/run.mjs b/bench/agent-modeling/run.mjs
index 0118c5b0..8f07b431 100644
--- a/bench/agent-modeling/run.mjs
+++ b/bench/agent-modeling/run.mjs
@@ -2,12 +2,16 @@
// server, then grades the recipe the agent exported.
//
// node bench/agent-modeling/run.mjs --claude <claude executable> [--model sonnet] [--tasks crate,bolt]
-// [--budget 3] [--timeout 1200] [--label baseline]
+// [--budget 3] [--timeout 1200] [--label baseline] [--skill] [--resume <run name>]
+//
+// --resume continues a run that stopped early and skips the tasks it already recorded.
+// --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.
//
// Raw transcripts and recipes go to artifacts/agent-modeling/<run>/ (ignored by Git); the summary goes to
// bench/agent-modeling/results/<run>.json.
import { spawn } from 'node:child_process';
-import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
+import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { parseArgs } from 'node:util';
@@ -27,13 +31,22 @@ const { values: options } = parseArgs({
budget: { type: 'string', default: '3' },
timeout: { type: 'string', default: '1200' },
label: { type: 'string', default: 'run' },
+ skill: { type: 'boolean', default: false },
+ resume: { type: 'string' },
},
});
-const runName = `${new Date().toISOString().slice(0, 16).replace(/[:T]/g, '-')}-${options.model}-${options.label}`;
+const runName = options.resume ?? `${new Date().toISOString().slice(0, 16).replace(/[:T]/g, '-')}-${options.model}-${options.label}`;
const rawDirectory = join(repository, 'artifacts', 'agent-modeling', runName);
const resultsDirectory = join(repository, 'bench', 'agent-modeling', 'results');
+async function skillPrompt() {
+ const skillDirectory = join(repository, 'skills', 'build-67js-scene');
+ const entryPoint = await readFile(join(skillDirectory, 'SKILL.md'), 'utf8');
+ const meshReference = await readFile(join(skillDirectory, 'references', 'mesh-modeling.md'), 'utf8');
+ return `${entryPoint}\n\n${meshReference}`;
+}
+
function mcpConfig() {
return { mcpServers: { [MCP_SERVER_NAME]: {
command: process.execPath,
@@ -41,7 +54,7 @@ function mcpConfig() {
} } };
}
-function runClaude(prompt, workingDirectory, configPath) {
+function runClaude(prompt, workingDirectory, configPath, systemPromptAddition) {
const argumentsList = [
'-p', prompt,
'--model', options.model,
@@ -53,6 +66,7 @@ function runClaude(prompt, workingDirectory, configPath) {
'--setting-sources', 'project',
'--no-session-persistence',
'--max-budget-usd', options.budget,
+ ...(systemPromptAddition ? ['--append-system-prompt', systemPromptAddition] : []),
];
return new Promise(resolvePromise => {
const started = performance.now();
@@ -119,13 +133,22 @@ function readTranscript(output) {
return summary;
}
-async function runTask(task) {
+// Chrome can hold the folder for a moment after the session ends. A leftover temp folder must not end the run.
+async function removeWorkingDirectory(workingDirectory) {
+ try {
+ await rm(workingDirectory, { recursive: true, force: true, maxRetries: 10, retryDelay: 500 });
+ } catch (error) {
+ console.warn(`Left ${workingDirectory} behind: ${error.code}`);
+ }
+}
+
+async function runTask(task, systemPromptAddition) {
const workingDirectory = await mkdtemp(join(tmpdir(), '67js-agent-task-'));
try {
const configPath = join(workingDirectory, 'mcp.json');
await writeFile(configPath, JSON.stringify(mcpConfig()));
const prompt = `${PROMPT_PREAMBLE}\n\n${task.prompt.replace(/\n/g, ' ')}`;
- const run = await runClaude(prompt, workingDirectory, configPath);
+ const run = await runClaude(prompt, workingDirectory, configPath, systemPromptAddition);
const transcript = readTranscript(run.output);
await writeFile(join(rawDirectory, `${task.id}.jsonl`), run.output);
if (run.errors) await writeFile(join(rawDirectory, `${task.id}.stderr.txt`), run.errors);
@@ -154,28 +177,38 @@ async function runTask(task) {
stopped: transcript.result?.subtype ?? 'no result',
};
} finally {
- await rm(workingDirectory, { recursive: true, force: true });
+ await removeWorkingDirectory(workingDirectory);
}
}
const tasks = options.tasks ? options.tasks.split(',').map(taskById) : TASKS;
await mkdir(rawDirectory, { recursive: true });
await mkdir(resultsDirectory, { recursive: true });
-const records = [];
-for (const task of tasks) {
- const record = await runTask(task);
+const systemPromptAddition = options.skill ? await skillPrompt() : null;
+const summaryPath = join(resultsDirectory, `${runName}.json`);
+const records = options.resume ? JSON.parse(await readFile(summaryPath, 'utf8')).records : [];
+const recordedTasks = new Set(records.map(record => record.task));
+
+function summarize() {
+ return {
+ run: runName,
+ model: records.find(record => record.model)?.model ?? options.model,
+ date: new Date().toISOString(),
+ skill: options.skill,
+ passed: records.filter(record => record.pass).length,
+ tasks: records.length,
+ toolCalls: records.reduce((sum, record) => sum + record.toolCalls, 0),
+ costUsd: Number(records.reduce((sum, record) => sum + (record.costUsd ?? 0), 0).toFixed(2)),
+ records,
+ };
+}
+
+for (const task of tasks.filter(candidate => !recordedTasks.has(candidate.id))) {
+ const record = await runTask(task, systemPromptAddition);
records.push(record);
console.log(`${record.task.padEnd(9)} ${record.pass ? 'PASS' : 'FAIL'} ${record.passed}/${record.total} calls ${record.toolCalls} (errors ${record.toolErrors}) $${record.costUsd ?? '?'} ${record.wallSeconds}s${record.failed.length ? ` ${record.failed.join(' | ')}` : ''}`);
+ // Saved after every task, so a run that gets killed keeps what it already paid for.
+ await writeFile(summaryPath, `${JSON.stringify(summarize(), null, 2)}\n`);
}
-const summary = {
- run: runName,
- model: records.find(record => record.model)?.model ?? options.model,
- date: new Date().toISOString(),
- passed: records.filter(record => record.pass).length,
- tasks: records.length,
- toolCalls: records.reduce((sum, record) => sum + record.toolCalls, 0),
- costUsd: Number(records.reduce((sum, record) => sum + (record.costUsd ?? 0), 0).toFixed(2)),
- records,
-};
-await writeFile(join(resultsDirectory, `${runName}.json`), `${JSON.stringify(summary, null, 2)}\n`);
+const summary = summarize();
console.log(`${summary.passed}/${summary.tasks} passed, ${summary.toolCalls} tool calls, $${summary.costUsd}. Summary: bench/agent-modeling/results/${runName}.json`);
diff --git a/bench/agent-modeling/tasks.mjs b/bench/agent-modeling/tasks.mjs
index 73614d77..2cf64b55 100644
--- a/bench/agent-modeling/tasks.mjs
+++ b/bench/agent-modeling/tasks.mjs
@@ -34,7 +34,7 @@ tall.`,
checks: [
{ kind: 'lint' },
{ kind: 'size', expected: [null, 0.14, null] },
- { kind: 'extent', axes: ['x', 'z'], min: 0.05, max: 0.058 },
+ { kind: 'extent', axes: ['x', 'z'], min: 0.0495, max: 0.0585 },
{ kind: 'ground' },
{ kind: 'holes', equals: 0 },
{ kind: 'volume', min: 1.13e-4, max: 1.43e-4 },
@@ -150,6 +150,65 @@ inset about 0.05 m from the top edges and 0.03 m tall. Give every part UV coordi
stretching.`,
checks: [...crateChecks, { kind: 'uv', maxStretch: 0.15 }],
},
+ {
+ id: 'dice',
+ prompt: `A six-sided die as one solid piece: a 0.1 m cube with every edge and corner rounded to a radius of about
+0.01 m. The faces carry round recessed pips, each about 0.02 m across and at least 0.005 m deep, in the usual layouts
+with a spacing of 0.025 m between neighbouring pips: 1 pip on +Y, 6 on -Y, 2 on +X, 5 on -X, 3 on +Z and 4 on -Z.`,
+ checks: [
+ { kind: 'lint' },
+ { kind: 'parts', max: 1 },
+ { kind: 'size', expected: [0.1, 0.1, 0.1] },
+ { kind: 'ground' },
+ { kind: 'holes', equals: 0 },
+ { kind: 'volume', min: 8.5e-4, max: 9.8e-4 },
+ { kind: 'section', axis: 'y', at: 0.097, equals: 2, label: '1 pip on +Y' },
+ { kind: 'section', axis: 'y', at: 0.003, equals: 7, label: '6 pips on -Y' },
+ { kind: 'section', axis: 'x', at: 0.047, equals: 3, label: '2 pips on +X' },
+ { kind: 'section', axis: 'x', at: -0.047, equals: 6, label: '5 pips on -X' },
+ { kind: 'section', axis: 'z', at: 0.047, equals: 4, label: '3 pips on +Z' },
+ { kind: 'section', axis: 'z', at: -0.047, equals: 5, label: '4 pips on -Z' },
+ ],
+ },
+ {
+ id: 'flange',
+ prompt: `A flanged pipe standing upright as one solid piece, 0.3 m tall overall. The pipe has an outer radius of
+0.05 m and a bore of radius 0.04 m that goes all the way through. Each end has a round flange of radius 0.09 m and
+thickness 0.02 m, flush with the pipe's end. Each flange has six round bolt holes of radius 0.008 m going through it,
+evenly spaced on a circle of radius 0.07 m, the first one on the +X side.`,
+ checks: [
+ { kind: 'lint' },
+ { kind: 'parts', max: 1 },
+ { kind: 'size', expected: [0.18, 0.3, 0.18] },
+ { kind: 'ground' },
+ { kind: 'holes', equals: 13 },
+ { kind: 'volume', min: 1.35e-3, max: 1.65e-3 },
+ { kind: 'section', axis: 'y', at: 0.15, equals: 2, label: 'pipe wall' },
+ { kind: 'section', axis: 'y', at: 0.01, equals: 8, label: 'lower flange with bore and six holes' },
+ { kind: 'section', axis: 'y', at: 0.29, equals: 8, label: 'upper flange with bore and six holes' },
+ ],
+ },
+ {
+ id: 'chair',
+ prompt: `A chair facing +Z. The seat is 0.45 m wide (X), 0.45 m deep (Z) and 0.03 m thick, with its upper surface
+0.45 m above the ground. Four square legs, 0.04 m on a side, sit in the seat's corners with their outer faces flush
+with its edges. The two front legs stop at the underside of the seat; the two rear legs continue up as posts to 0.9 m.
+Three horizontal back slats, 0.06 m tall and 0.02 m thick, run between the posts, centred on them in Z, at centre
+heights 0.6 m, 0.7 m and 0.8 m.`,
+ checks: [
+ { kind: 'lint' },
+ { kind: 'size', expected: [0.45, 0.9, 0.45] },
+ { kind: 'ground' },
+ { kind: 'section', axis: 'y', at: 0.2, equals: 4, label: 'four legs' },
+ { kind: 'section', axis: 'y', at: 0.52, equals: 2, label: 'two posts above the seat' },
+ {
+ kind: 'through', axis: 'z', label: 'three slats with gaps',
+ open: [[0.003, 0.55], [0.003, 0.65], [0.003, 0.75], [0.003, 0.86]],
+ solid: [[0.003, 0.6], [0.003, 0.7], [0.003, 0.8], [0.207, 0.86], [-0.207, 0.86]],
+ },
+ { kind: 'volume', min: 9.4e-3, max: 1.28e-2 },
+ ],
+ },
];
export function taskById(id) {