{
  "about": "Source for /demos/. Every number is copied from the cookbook entry's README.md or RECEIPT.md at sandbox_commit; media bytes are taken from the same commit by site/tools/build_demos.py --fetch, which also records their sha256 below. Edit this file, then run python3 site/tools/build_demos.py.",
  "sandbox_repo": "https://github.com/agent-next/sandbox",
  "sandbox_commit": "ba328e6d0fd7a23f51cd53adaa073737964ca929",
  "categories": {
    "simulation": "Simulation",
    "electronics": "Electronics",
    "embedded": "Embedded",
    "gpu": "GPU",
    "cad": "CAD"
  },
  "demos": [
    {
      "slug": "cfd-openfoam",
      "title": "CFD with OpenFOAM",
      "category": "simulation",
      "tools": ["OpenFOAM v1912", "icoFoam"],
      "summary": "Channel and lid-driven cavity flow at Re = 100, graded against the analytic profile and Ghia et al. (1982).",
      "lede": "The agent writes OpenFOAM case directories for plane Poiseuille flow and the lid-driven cavity at Re = 100. The judge copies each case to scratch, meshes and solves it itself, then compares the channel profile with the analytic parabola, checks mesh-refinement convergence, and compares the cavity centreline velocities with the tabulated data of Ghia, Ghia & Shin (1982).",
      "why_sandbox": "OpenFOAM is a heavy system-level toolchain (~600 MB of packages). The sandbox installs a pinned, sha256-checked build, runs it, and is thrown away, so nothing touches your own machine.",
      "metrics": [
        {"value": "0.0043", "label": "Poiseuille L2 error vs analytic", "limit": "pass line 0.02"},
        {"value": "0.0033 / 0.0073", "label": "cavity u / v max error vs Ghia 1982", "limit": "pass line 0.02"},
        {"value": "2.15, 1.91", "label": "observed mesh-convergence orders", "limit": "≥ 1.5"},
        {"value": "< 1e-5", "label": "all residuals at endTime", "limit": "gate 2"}
      ],
      "mutants": [10, 10],
      "grade_time": "~6 s per case",
      "reproduced": "Independently reproduced: bit-identical metrics and media.",
      "video_caption": "The cavity flow developing over pseudo-time (|U| from a real icoFoam run) beside the gate-2 residual convergence.",
      "result_alt": "Judge results: Poiseuille profile vs analytic, cavity centrelines vs Ghia 1982, mesh convergence and the cavity field",
      "loop_alt": "Replayed agent loop and the self-test kill rate",
      "poster_s": 10,
      "prompt": "Create a CPU sandbox. In it, clone https://github.com/agent-next/sandbox and run `bash cookbook/cfd-openfoam/judge/setup.sh` to install the pinned OpenFOAM. Then build a case directory for the lid-driven cavity at Re = 100 (unit square, lid speed 1 m/s, icoFoam) and iterate with `bash cookbook/cfd-openfoam/judge/grade.sh <your-case-dir>` until every gate passes. Do the same for a plane-Poiseuille channel case (fully developed parabolic inlet, Re = 100). Report the final verdict JSON and kill the sandbox when done.",
      "run": "python3 cookbook/cfd-openfoam/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/poiseuille --seed 42\nbash judge/grade.sh examples/good/cavity --seed 42",
      "steps": [
        ["judge/setup.sh (cold)", "~16–23 s with packages cached regionally; ~2–4 min worst case"],
        ["judge/selftest.sh (2 good + 10 mutants)", "54–73 s"],
        ["judge/grade.sh, one case", "~6 s"]
      ],
      "limits": [
        "Single-core icoFoam only: no MPI, no turbulence, no snappyHexMesh.",
        "Gates pin Re = 100 and the unit-square geometry; a case at another Re fails even if it is physically self-consistent.",
        "The Ghia data is a 129×129 benchmark; the 0.02 tolerance reflects a 40×40 mesh, not solver-exact agreement."
      ]
    },
    {
      "slug": "fea-calculix",
      "title": "Cantilever design with CalculiX",
      "category": "simulation",
      "tools": ["CalculiX 2.20", "gmsh 4.10"],
      "summary": "Size the lightest steel cantilever that meets stress and deflection limits, checked against Euler-Bernoulli theory.",
      "lede": "The agent picks the cross-section of a steel cantilever under a 1000 N tip load, writes the CalculiX deck, and iterates until the judge passes. The judge meshes the beam with gmsh at two sizes, solves it with ccx, checks a reference beam against Euler-Bernoulli theory, checks mesh convergence, and only then applies the spec limits: stress ≤ 166.7 MPa and tip deflection ≤ L/100. Mass is reported for the agent to minimise; passing does not prove the lightest design.",
      "why_sandbox": "The solver, mesher and solver libraries install from sha256-pinned packages into a throwaway machine; the agent's deck runs there, never on your workstation.",
      "metrics": [
        {"value": "138.2 MPa", "label": "stress at the wall", "limit": "≤ 166.7 MPa"},
        {"value": "7.72 mm", "label": "tip deflection", "limit": "≤ 10.00 mm"},
        {"value": "+0.41 % / −0.74 %", "label": "deflection / stress vs Euler-Bernoulli", "limit": "≤ 3 %"},
        {"value": "0.23 % / 0.50 %", "label": "change from 4 mm to 2 mm mesh", "limit": "≤ 2 %"}
      ],
      "mutants": [9, 9],
      "grade_time": "~35 s",
      "reproduced": "Independently reproduced: byte-identical media.",
      "video_caption": "The real displacement field ramped from 0 to 1000 N, then the gate that rejects each mutant.",
      "result_alt": "Deformed mesh coloured by von Mises stress with the allowable on the colour bar, mesh convergence, and the Euler-Bernoulli comparison",
      "loop_alt": "Agent-loop replay and the mutant-by-gate self-test matrix",
      "poster_s": 8,
      "prompt": "Clone https://github.com/agent-next/sandbox into this sandbox and run `bash cookbook/fea-calculix/judge/setup.sh` (installs CalculiX `ccx` and gmsh under `~/tools/bin`). Design the lightest cantilever beam for the spec in `SPEC.md`: produce `artifact/design.json` (`L`, `b`, `h`, `mesh_size` in mm) and `artifact/beam.inp` (deck contract in SPEC.md — include `mesh.inc`, clamp `NFIX`, apply 250 N downward on each `NLOAD` corner node, request `U` and `S` output). Then run `judge/grade.sh artifact` and iterate until it prints \"PASS\".",
      "run": "python3 cookbook/fea-calculix/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good --seed 42",
      "steps": [
        ["judge/setup.sh (pinned .deb files + gmsh tarball)", "~15 s"],
        ["judge/selftest.sh (good + 9 mutants + determinism)", "~5 min"],
        ["judge/grade.sh examples/good", "~35 s"]
      ],
      "limits": [
        "Linear-elastic, static, slender beams only (L ≥ 5 × max(b, h)).",
        "Stress is evaluated away from the clamped-face singularity; the pointwise wall-corner stress is singular and deliberately not the measured quantity."
      ]
    },
    {
      "slug": "sim-engine-arena",
      "title": "Physics-engine arena with MuJoCo",
      "category": "simulation",
      "tools": ["MuJoCo 3.8.1", "mujoco_warp 3.8.1"],
      "summary": "Port a neutral spec into four rigid-body scenes, graded against Newtonian mechanics and a reference MuJoCo port.",
      "lede": "The agent writes one MuJoCo port of a neutral scene spec: a falling sphere, a sticking box, a sliding box and a pendulum. The judge runs the port from a copy, checks the trajectory CSVs against analytic contact time, friction and pendulum-period rules, then compares them pointwise with its own reference MuJoCo port. The video and result image are real MuJoCo 3D renders of the graded trajectories, not illustrative plots.",
      "why_sandbox": "The agent needs a pinned MuJoCo toolchain and a scratch filesystem to build and run its Python port. The judge executes a copy inside a disposable sandbox, away from your machine; an optional GPU slice replays the models with mujoco_warp, reports the results and is destroyed and verified gone afterwards.",
      "metrics": [
        {"value": "0.4406 s", "label": "sphere contact time", "limit": "±3 % of 0.4401 s"},
        {"value": "1.6082 m/s²", "label": "sliding-box acceleration", "limit": "±5 % of 1.6088 m/s²"},
        {"value": "1.8 mm", "label": "sticking-box travel", "limit": "< 20 mm"},
        {"value": "2.0073 s", "label": "pendulum period", "limit": "±2 % of 2.0073 s"}
      ],
      "mutants": [8, 8],
      "grade_time": "4–6 s",
      "reproduced": "Independently reproduced: matching CPU verdicts except timing and matching GPU values at the reported precision. The pre-merge reproduction used the README's documented ref override.",
      "video_caption": "Real MuJoCo 3D renders of the graded trajectories: sphere drop, sliding and sticking boxes side by side, pendulum swing, then the PASS card.",
      "result_alt": "Twelve real MuJoCo 3D renders of the graded trajectories: sphere release, contact and settling, sliding and sticking boxes, and pendulum extrema and centre, with measured values and analytic pass limits",
      "loop_alt": "Recorded agent-loop verdicts and the judge self-test: the known-good port passes and all eight mutants are rejected",
      "poster_s": 8,
      "prompt": "Create a fresh sandbox. Inside it, clone https://github.com/agent-next/sandbox at ref `main`, then read `cookbook/sim-engine-arena/SPEC.md`. Run `bash cookbook/sim-engine-arena/judge/setup.sh` and write your own MuJoCo port in one file, `sim.py`: read `spec.json` at runtime and produce the four trajectory CSVs exactly as the artifact contract requires. Simulate honestly; do not hard-code oracle numbers or edit anything under `judge/`. Iterate with `bash cookbook/sim-engine-arena/judge/grade.sh <your-sim.py> --json verdict.json` until every gate passes, and run `bash cookbook/sim-engine-arena/judge/selftest.sh` to see the eight known-bad ports rejected. Report the final verdict JSON, including contact time, incline acceleration and travel, pendulum period and reference agreement. Kill the sandbox and confirm it is gone.",
      "run": "python3 cookbook/sim-engine-arena/run.py          # CPU sandbox: full judge\npython3 cookbook/sim-engine-arena/run.py --gpu    # optional 4 GiB GPU slice replay",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/sim.py --seed 0",
      "steps": [
        ["judge/setup.sh (cold, fresh sandbox)", "24–36 s"],
        ["judge/selftest.sh (good + 8 mutants + determinism)", "15–17 s"],
        ["judge/grade.sh examples/good/sim.py", "4–6 s"]
      ],
      "limits": [
        "MuJoCo only: agreement compares the agent's port with the judge's reference port in the same engine, not PyBullet, Genesis or Drake.",
        "Simple rigid-body scenes with the spec's contact, damping and friction settings; tuning them beyond the spec is not the task.",
        "No continuous collision, air drag or relativistic corrections; the oracle tolerances absorb contact-model differences.",
        "GPU replay is optional and reported, never gated; the CPU verdict stands if GPU access is unavailable."
      ]
    },
    {
      "slug": "spice-filter",
      "title": "Analog filter design in ngspice",
      "category": "electronics",
      "tools": ["ngspice 39.3"],
      "summary": "A 4th-order active low-pass from E24/E12 parts, graded against a ripple/stopband mask, a closed-form check and Monte-Carlo tolerance.",
      "lede": "The agent designs a SPICE netlist for a 4th-order active low-pass filter: ripple ≤ 1 dB up to 1 kHz, at least 40 dB down from 10 kHz, using only E24 resistors and E12 capacitors. The judge simulates it in ngspice, cross-checks it against a closed form (a netlist that runs but is mis-wired fails), re-simulates with a 1 MHz-GBW op-amp model, and runs a ±5 % R / ±10 % C Monte-Carlo.",
      "why_sandbox": "The agent needs ngspice, Python and a scratch filesystem to iterate designs; the graded artifact is one small file it hands back before the sandbox is destroyed.",
      "metrics": [
        {"value": "0.096 dB", "label": "passband ripple", "limit": "≤ 1.0 dB to 1 kHz"},
        {"value": "−56.14 dB", "label": "stopband", "limit": "≤ −40 dB from 10 kHz"},
        {"value": "100 / 100", "label": "Monte-Carlo runs inside the relaxed mask", "limit": "≥ 90 %"},
        {"value": "0.150 dB", "label": "deviation with a 1 MHz-GBW op-amp", "limit": "≤ 0.5 dB"}
      ],
      "mutants": [9, 9],
      "grade_time": "1.8 s",
      "reproduced": "Independently reproduced: byte-identical media.",
      "video_caption": "Ideal and GBW-limited sweeps drawn against the mask, the finished result with a passband inset, the agent-loop replay and the self-test kill rate.",
      "result_alt": "Bode magnitude of the filter against the spec mask",
      "loop_alt": "Agent-loop replay and the self-test kill rate",
      "poster_s": 9,
      "prompt": "Set up a sandbox and solve the demo in `cookbook/spice-filter/` of https://github.com/agent-next/sandbox (clone it first). Run `bash cookbook/spice-filter/judge/setup.sh`, read `cookbook/spice-filter/SPEC.md`, then design the artifact yourself: a SPICE netlist of a low-pass filter with input node `in`, output node `out`, ground `0`, driven by its own `AC 1` source, meeting ripple ≤ 1 dB to 1 kHz and ≤ −40 dB for f ≥ 10 kHz, with every resistor on the E24 and every capacitor on the E12 series, and passing the Monte-Carlo gate. Iterate with `bash cookbook/spice-filter/judge/grade.sh <your-netlist.cir> --json v.json` until it exits 0, then paste the final verdict JSON. Do not edit anything under `judge/`; if you believe the judge is wrong, say so instead of working around it. Kill the sandbox when you are done.",
      "run": "python3 cookbook/spice-filter/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/lpf4sk.cir",
      "steps": [
        ["judge/setup.sh (fresh install)", "3.2 s"],
        ["judge/selftest.sh (good + 9 mutants + determinism)", "6.8 s"],
        ["judge/grade.sh examples/good/lpf4sk.cir", "1.8 s"]
      ],
      "limits": [
        "Small-signal AC only: no noise, slew, supply or transient behaviour is graded.",
        "The closed-form cross-check recognises the Sallen-Key cascade shape only and fails closed on any other topology.",
        "The judge pins ngspice from Debian bookworm and needs sudo once for the install."
      ]
    },
    {
      "slug": "firmware-qemu",
      "title": "Bare-metal firmware on an emulated Cortex-M3",
      "category": "embedded",
      "tools": ["arm-none-eabi-gcc", "QEMU lm3s6965evb"],
      "summary": "No OS, no libc: a UART command shell that must build with -Werror, boot in QEMU and answer byte-exact.",
      "lede": "The agent writes real embedded C — hand-written linker script and startup code — for a Stellaris LM3S6965 board that exists only inside QEMU. The firmware must build warning-free, boot on the emulator and serve a scripted UART command shell. Every gate compares it with an independent oracle: the Arm toolchain, readelf, Python's zlib.crc32, a known-answer response mask, and checksums of the judge itself.",
      "why_sandbox": "The toolchain, the emulator and the firmware under test are installed from nothing on a machine the agent does not control, and the whole thing is thrown away afterwards; nothing about your host leaks into the verdict.",
      "metrics": [
        {"value": "46 / 46", "label": "scripted shell responses byte-exact", "limit": "all"},
        {"value": "15 / 15", "label": "seeded CRC-32 buffers match zlib.crc32", "limit": "all"},
        {"value": "2224 B", "label": ".text + .rodata", "limit": "≤ 8192 B"},
        {"value": "8 / 8", "label": "judge gates passed", "limit": "all"}
      ],
      "mutants": [14, 14],
      "grade_time": "~7 s",
      "reproduced": "Independently reproduced: identical verdicts and self-test figure.",
      "video_caption": "The real captured UART session, then the crc-poly mutant with the responses that diverge from the oracle highlighted, then the verdicts.",
      "result_alt": "The judged session: the UART transcript of the good firmware in QEMU beside the 8-gate table with measured values",
      "loop_alt": "Mutant-by-gate matrix from the judge self-test: the known-good firmware plus 14 mutants against all 8 gates",
      "poster_s": 8,
      "poster_crop": "960:540:60:30",
      "prompt": "Write bare-metal firmware for a QEMU `lm3s6965evb` board (Cortex-M3, UART0) that boots and serves the command shell in `cookbook/firmware-qemu/SPEC.md` of https://github.com/agent-next/sandbox. Work in a sandbox: run `judge/setup.sh` there, and iterate with `judge/grade.sh` until all 8 gates pass. The judge builds it with `-Wall -Werror` and interrogates it over the emulated UART. Do not edit anything under `judge/`. Kill the sandbox when you are done.",
      "run": "python3 cookbook/firmware-qemu/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good --seed 20260814",
      "steps": [
        ["judge/setup.sh (toolchain + QEMU, sha256-checked)", "~140–385 s"],
        ["judge/selftest.sh (good + 14 mutants + determinism)", "~120–255 s"],
        ["judge/grade.sh examples/good", "~7 s"]
      ],
      "limits": [
        "Proves behaviour inside QEMU's lm3s6965evb model only; no timing, power or real-silicon behaviour is measured.",
        "QEMU never raises the UART0 interrupt on this machine and zeroes SRAM at reset, so interrupt-path and .bss-clearing faults are invisible here.",
        "The judge catches mistakes, not a hostile artifact: grade untrusted firmware in a fresh disposable sandbox and read the build log."
      ]
    },
    {
      "slug": "plc-st",
      "title": "PLC tank controller in Structured Text",
      "category": "embedded",
      "tools": ["MATIEC iec2c", "IEC 61131-3"],
      "summary": "A fill/drain controller with E-stop and dry-run interlocks, run against a virtual plant in 8 scenarios.",
      "lede": "The agent writes a tank fill/drain controller in IEC 61131-3 Structured Text, compiles it with the open MATIEC compiler, links it into a 10 ms scan-cycle harness and runs it against a virtual plant. The judge's rules are numeric: the level never leaves its safe band, the pump never runs dry even when a level switch lies, an emergency stop de-energises every actuator within one scan and latches, and the plant recovers afterwards.",
      "why_sandbox": "The agent installs a pinned compiler, compiles its own code and iterates against the judge in an isolated, disposable machine; nothing it does touches your machine.",
      "metrics": [
        {"value": "8 / 8", "label": "plant scenarios passed", "limit": "all"},
        {"value": "88.02 cm", "label": "highest level in any scenario", "limit": "≤ 94 cm design cap"},
        {"value": "Byte-identical", "label": "verdict JSON across two runs with the same seed", "limit": "determinism"}
      ],
      "mutants": [6, 6],
      "grade_time": "~5 s",
      "reproduced": "Independently reproduced from the README alone in a fresh sandbox.",
      "video_caption": "Results per scenario, the scenario-by-mutant matrix, real per-scan plant traces, the mutant kills and the final verdict.",
      "result_alt": "Highest and lowest tank level per scenario for the known-good controller, with the design cap, high switch and dry band",
      "loop_alt": "Judge self-test: which scenario catches each of the six mutants",
      "poster_s": 12,
      "prompt": "In a sandbox, build the IEC 61131-3 Structured Text tank controller for `cookbook/plc-st` of https://github.com/agent-next/sandbox from scratch. Read `SPEC.md` first, then write your own `tank_ctrl.st` (program + configuration) using the pinned MATIEC toolchain from `judge/setup.sh`. Iterate with `bash judge/selftest.sh` and `bash judge/grade.sh your_tank_ctrl.st --json /tmp/v.json` until the judge passes every gate and your controller is not one of the six known-bad single-edit mutants. Show me the final verdict JSON and the key numbers (max/min level, kill rate). Do not modify anything under `judge/`.",
      "run": "python3 cookbook/plc-st/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/tank_ctrl.st --json verdict.json",
      "steps": [
        ["judge/setup.sh (fresh install of pinned MATIEC)", "~39 s"],
        ["judge/selftest.sh (good + 6 mutants)", "~33 s"],
        ["judge/grade.sh examples/good/tank_ctrl.st", "~5 s"]
      ],
      "limits": [
        "An educational interlock exercise, not a certified safety system: no SIL rating, no redundant architecture, no formal proof.",
        "The plant model is analytic and deterministic; faults are scripted stuck or false switch states and E-stop pulses."
      ]
    },
    {
      "slug": "gpu-kernel",
      "title": "Triton softmax kernel on a GPU slice",
      "category": "gpu",
      "tools": ["Triton 3.6", "PyTorch 2.10", "RTX 5090 slice"],
      "summary": "A fused softmax kernel graded on correctness over 10 adversarial cases, then timed against torch on a 1 GiB VRAM slice.",
      "lede": "The agent writes a fused row-wise softmax as a single Triton kernel. The judge compiles it to real device code (sm_80 and sm_90), compares it with torch eager over odd shapes and adversarial inputs, checks that rows sum to 1, shift invariance and an untouched input, and only then reports speed honestly: the median of CUDA-event timings against torch.softmax. It runs on a 1 GiB VRAM slice of an RTX 5090, or in a CPU-only check mode.",
      "why_sandbox": "Kernel work is messy: the sandbox pins a torch/Triton toolchain, runs untrusted agent-written kernels away from your machine, and the GPU lease is destroyed and verified gone afterwards.",
      "metrics": [
        {"value": "10 / 10", "label": "correctness cases vs torch", "limit": "all"},
        {"value": "2.4e-7", "label": "worst max-abs error", "limit": "≤ 1e-5"},
        {"value": "0.078 ms", "label": "kernel on (4096, 4096) vs 0.079 ms torch eager (×1.02)", "limit": "reported, not gated"}
      ],
      "mutants": [11, 11],
      "grade_time": "~11 s (CPU check)",
      "reproduced": "Independently reproduced on the CPU path; GPU numbers are from one run on a 1 GiB RTX 5090 slice.",
      "video_caption": "run.py --gpu on a 1 GiB slice: lease created, verdict, all 11 mutants rejected, lease destroyed and verified gone.",
      "result_alt": "Per-case max-abs error against the tolerance, and the kernel vs torch eager timing",
      "loop_alt": "Mutant-by-gate matrix: the gate that rejects each of the 11 mutants",
      "poster_s": 17,
      "poster_crop": "960:540:30:50",
      "prompt": "Create a fresh sandbox (GPU lease, `vram_gb: 1` if GPU access is on my key; otherwise a plain sandbox and the judge's `--cpu-check` mode). Inside it, clone https://github.com/agent-next/sandbox at ref `main`, then read `cookbook/gpu-kernel/SPEC.md` carefully: implement the fused row-wise softmax as a single Triton kernel in one file, `kernel.py`, exposing `softmax(x)`, `KERNEL`, `SIGNATURE` and `CONSTEXPRS` exactly as the spec's artifact contract says. Do not delegate to torch's own softmax. Run `cookbook/gpu-kernel/judge/setup.sh`, write your kernel, then iterate with `bash cookbook/gpu-kernel/judge/grade.sh /path/to/your/kernel.py --json /tmp/v.json` until every gate passes. Report the verdict JSON, then kill the sandbox and confirm it is gone.",
      "run": "python3 cookbook/gpu-kernel/run.py          # CPU sandbox: --cpu-check judge\npython3 cookbook/gpu-kernel/run.py --gpu    # 1 GiB GPU slice: full judge",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/kernel.py",
      "steps": [
        ["judge/setup.sh (cold, CPU path)", "~1 min"],
        ["judge/selftest.sh (CPU path)", "~2 min"],
        ["judge/grade.sh (CPU path)", "~11 s"]
      ],
      "limits": [
        "Correctness is the gate; speed is reported, not gated (--speed-target exists if you want it).",
        "The CPU check proves the kernel compiles to device code and is numerically right; GPU speed needs the GPU lease, which must be enabled on your key.",
        "The ~1x speedup is expected: torch's softmax is already bandwidth-bound on this shape."
      ]
    },
    {
      "slug": "render-pathtrace",
      "title": "Path tracing graded by physics",
      "category": "gpu",
      "tools": ["MuTracer 0.1.1", "Chromium 140 WebGPU", "NVIDIA GPU slice"],
      "summary": "An agent designs an OpenPBR studio scene; MuTracer path-traces it on NVIDIA WebGPU and five physical gates, starting with an analytic white furnace, decide pass or fail.",
      "lede": "The agent writes only scene.json: spheres with OpenPBR materials, a floor, lights, a camera and a procedural sky. A trusted browser harness renders it with the MuTracer WebGPU path tracer in full Chromium on a GPU slice. The judge does not trust the picture: it renders a white furnace whose exact answer is pixel = albedo, bounds the energy every material reflects, checks that error falls like 1/sqrt(samples), demands byte-identical HDR output for the same seed, and only then checks exposure and noise on the agent's own image.",
      "why_sandbox": "WebGPU path tracing needs a real GPU and a full browser. The GPU browser sandbox provides both on a 2 GiB slice of an NVIDIA Blackwell GPU, runs the untrusted scene offline, and is deleted and confirmed gone after every run.",
      "metrics": [
        {"value": "0.1795 / 0.4985 / 0.7976", "label": "white-furnace render for albedo 0.18 / 0.5 / 0.8", "limit": "within 0.017–0.025 of exact"},
        {"value": "−0.485", "label": "convergence slope of error vs samples", "limit": "ideal −0.5, pass −0.65 … −0.35"},
        {"value": "identical", "label": "final HDR hash across 3 fresh leases", "limit": "same seed → same bytes"},
        {"value": "0.616 / 0.5 %", "label": "median luminance / clipped pixels", "limit": "0.08–0.85 / ≤ 10 %"}
      ],
      "mutants": [8, 8],
      "grade_time": "~6 s",
      "reproduced": "Independently reproduced by another model family: identical verdict and byte-identical HDR buffer.",
      "video_caption": "Real GPU renders of the known-good example scene at 1 to 256 samples per pixel, with the measured error falling along 1/sqrt(spp), then the judge's verdict.",
      "result_alt": "The 128-spp render, the white-furnace check against the exact answer, the convergence slope and the image-spec bands",
      "loop_alt": "Self-test matrix: which check rejects each of the 8 bad scenes and the halved-albedo renderer control",
      "poster_s": 22,
      "prompt": "Use an agent-next GPU `browser` sandbox (a GPU lease, `vram_gb: 2`) through the public REST API. Clone https://github.com/agent-next/sandbox at ref `main` locally and read `cookbook/render-pathtrace/SPEC.md`. The lease is offline, so the included run.py fetches the pinned MuTracer package on your machine, verifies it, and uploads it with the trusted judge. Design `scene.json` (not JavaScript): three to five OpenPBR spheres with distinct materials, a floor, a camera, a procedural environment and rect or sphere lights. Do not edit judge/. Grade with `--backend gpu --seed 17`, read the numeric failures, and iterate until every gate passes. Report the adapter, furnace means, convergence slope and image metrics, then delete the lease and confirm GET returns 404.",
      "run": "python3 cookbook/render-pathtrace/run.py",
      "local_title": "Inside a prepared GPU browser lease: the judge alone",
      "local": "export SBX_RENDER_BACKEND=gpu SBX_RENDER_ARCHIVE=<uploaded mutracer-0.1.1.tgz>\nsh judge/setup.sh\nsh judge/selftest.sh --backend gpu --seed 17\nsh judge/grade.sh examples/good/scene.json --backend gpu --seed 17",
      "steps": [
        ["upload MuTracer + judge (offline lease)", "38–75 s"],
        ["judge/setup.sh (offline, integrity-checked)", "~1 s"],
        ["judge/selftest.sh (good + 8 mutants + renderer control)", "30–34 s"],
        ["judge/grade.sh", "6–7 s"],
        ["whole run, create → GET 404", "100–273 s"]
      ],
      "limits": [
        "A 2 GiB lease is a requested VRAM slice, not an allocation-time cap: the host watchdog kills an over-limit lease.",
        "G1 checks diffuse transport against the exact answer, not every OpenPBR lobe; G2 bounds mean reflected energy, not a directional maximum.",
        "The CPU path (SwiftShader WebGPU) lost the device before any frame in every attempt; only the GPU backend is accepted.",
        "Uploads run at about 0.1 MB/s through the public files route, so transfer, not rendering, dominates wall time."
      ]
    },
    {
      "slug": "solidcraft-cad",
      "title": "Parametric CAD with SolidCraft",
      "category": "cad",
      "tools": ["SolidCraft 0.10.1", "OpenCascade 8.0.1"],
      "summary": "A NEMA 17 motor-mount plate modelled as a parametric SolidCraft script, re-measured by a second CAD kernel against closed-form values.",
      "lede": "The agent writes a SolidCraft command script for a motor-mount adapter plate: rounded corners, a centre bore, a raised boss, four bolt holes on the motor's pitch circle and a mass limit in aluminium. The script must stay parametric. The judge does not trust SolidCraft's numbers. It re-measures the delivered STEP and STL with OpenCascade and compares them with numbers it computes by hand from the spec. It then proves every wall with exact boolean checks, and re-grades the whole part after changing thickness by 2 mm.",
      "why_sandbox": "The agent gets a 26 MB CAD binary, a 100 MB OpenCascade stack and a scratch filesystem to iterate in. Everything is pinned and hash-checked, and it is all thrown away afterwards. The graded artifact is one small JSON file.",
      "metrics": [
        {"value": "6.9e-10", "label": "OCCT volume vs analytic (16644.9 mm³)", "limit": "pass line 0.2 %"},
        {"value": "1.2e-6", "label": "SolidCraft vs OpenCascade volume", "limit": "pass line 0.1 %"},
        {"value": "5124.18 mm³", "label": "volume added by thickness +2 mm (analytic 5124.18)", "limit": "pass line 0.2 %"},
        {"value": "44.94 g", "label": "mass in 6061 aluminium", "limit": "≤ 52 g"}
      ],
      "mutants": [19, 19],
      "grade_time": "~20–70 s per design",
      "reproduced": "Independently reproduced by a different model family, which also modelled the part itself. 11 of its 12 designs pass; one fails on its own unit error.",
      "video_caption": "SolidCraft building the part step by step, a live thickness sweep, the judge's verdict and the real independent-agent loop.",
      "result_alt": "The delivered part next to all 12 numeric checks as measured value over pass limit, every one below the pass line",
      "loop_alt": "The independent agent's 12 designs graded by the old and the fixed judge, and 19 of 19 broken designs rejected",
      "poster_s": 2,
      "prompt": "Set up a sandbox and solve the demo in `cookbook/solidcraft-cad/` of https://github.com/agent-next/sandbox (clone it first). Run `bash cookbook/solidcraft-cad/judge/setup.sh`, read `cookbook/solidcraft-cad/SPEC.md` and `spec.json`, then model the part yourself with SolidCraft: write a command script `design.json` with a `thickness` parameter that drives the plate. First `export PATH=\"$HOME/.local/solidcraft-0.10.1-linux-x86_64/bin:$PATH\"`, then use `solidcraft-cli commands`, `solidcraft-cli eval design.json` and `solidcraft-cli snapshot design.json --out part.png`. Iterate with `bash cookbook/solidcraft-cad/judge/grade.sh design.json --json v.json` until it exits 0, then paste the verdict and the snapshot. Do not edit `judge/` or `spec.json`. Kill the sandbox when you are done.",
      "run": "python3 cookbook/solidcraft-cad/run.py",
      "local": "bash judge/setup.sh\nbash judge/selftest.sh\nbash judge/grade.sh examples/good/design.json --json verdict.json",
      "steps": [
        ["judge/setup.sh (cold)", "~2 min"],
        ["judge/selftest.sh (16 unit tests, 3 good designs, 19 mutants, determinism)", "~13.5 min"],
        ["judge/grade.sh, one design", "~1 min"]
      ],
      "limits": [
        "x86_64 Linux with CPython 3.12 or 3.13.",
        "SolidCraft v0.10.1 is younger than the two-week pin rule (the project started 2026-10-07); it is pinned by sha256.",
        "The judge checks one part family (plates with Z-axis holes), not general CAD equivalence."
      ]
    }
  ]
}
