Research note

World Models as Unit Tests

Code as World Models: agents observe their task environment, write its world model as code, and use it to help write and verify policies, including Code-as-Policies programs

Frontier language models are starting to write robot controllers. On RoboDojo Sim, Claude Fable 5.2 scored 64.9% against 29.8% for GPT-6 Astra.* In Code as Policies (CaP), an LLM writes a controller as code, runs it on the real system, and revises (Liang et al., 2022).1 ASPIRE (Lu et al., 2026) extends this with agentic skill discovery.2 The more often the model edits the program, the more real-world evaluation becomes the bottleneck.

A few real tests prove little. Five successes in five trials show, at 95% confidence, only that the true success rate is above 55%.4 When an LLM writes code faster than a robot can test it, the five trials are spread over successive versions, each version is tried about once, and a single success shows only that the rate is above 5%. LLMs became useful for code and mathematics once their outputs could be verified automatically (Cobbe et al., 2021, Lightman et al., 2023). Robot control code has no such verifier.

The question we explore is: when a general coding agent faces an unknown physical system and has no ready-made test environment, can it build the tests in its own harness (the system where it writes and runs its programs) from a few real trials? By verification we mean an empirical estimate, made before deployment, of how often a program will succeed, obtained by running it in the world model.

We compared two agents on each of eight tasks. The CaP agent edits its control program after each real trial. The world-model agent first writes a world model, a Python file of a few hundred lines that simulates the task, and tests programs in it before deployment. The eight tasks, ordered from where the tests helped least to where they decided the outcome:

  1. A drone flying two fixed routes through a canyon with a damaged rotor and hidden wind
  2. Cable routing with hidden stiffness, friction and a live load reading
  3. Doom survival under random enemy fire
  4. Pushing a T-shaped block and then an unseen L-shaped block, each with a secretly moved centre of mass and random start poses
  5. The same drone canyon with seven to eight random other aircraft per episode
  6. Throwing a rope past a post into a target: deformable, one attempt, very sensitive to small changes

In one variant of the drone task, seven to eight other aircraft fly random paths through the canyon on each episode. Our world-model agent spent its first real trial hovering for the full 19.4-second window and did nothing except record how the other aircraft moved. From that record it wrote four types of aircraft behaviour into its world model, tested controllers in the model, and its real success rate went from 50% to 97% after that single observation trial.

The world model plays the role unit tests play for ordinary code: each candidate program is run in the world model before it is deployed. A world model written as code is one way to supply such tests inside the agent’s harness (Weng, 2026). Several groups have written world models as code (Dainese et al., 2024; Tang, Key and Ellis, 2024; Meta FAIR, 2025; Wang et al., 2026; Chen, Lin and Zhang, 2026); here the agent estimates the model’s parameters from what it records during its trials and uses the model to verify controllers before deployment.

These runs suggest that a world model may not need to be a neural network trained on thousands of rollouts. A Python file of a few hundred lines, fitted on the spot from the agent’s own experiments, may serve as the unit-test layer between code generation and physical deployment. In our runs, files of this size came close to a planner that had the true simulator: 78% on the rope throw against the oracle planner’s 84%, and 84% held-out on the unseen L-shaped block (a CaP program from 8 real trials, selected with the tests) against the oracle planner’s 80%. When we announced a new drone route and granted no real trials, the agent reused its world model and found a 100% controller in 19.5 seconds of search. On the first drone route, PPO and a learned neural dynamics model given the same five real trials both scored 0 of 50.

Active observation

1. Observe

The agent spends a few real trials watching and probing the system. On the drone it hovered for a whole trial to log the other aircraft. On the pushing task it made two scripted pushes to locate the block’s centre of mass.

Hidden dynamics

2. Write the world model

It writes what it saw as one Python file of 14 to 26 KB. Physics the manual does not mention, such as a weak rotor or a shifted centre of mass, becomes named parameters estimated from the trials.

Random variation

3. Run the tests

Every candidate program runs in the world model before any further real trial, over many random episodes and several perturbed copies of the model. For 15 pushing programs, 3,000 simulated episodes took 19 s.

Test-time compute

4. Deploy, or test while acting

The version that passes goes to the real system. On the rope task the tests run during the episode. Every 0.16 s the controller tests candidate throws in the world model and executes the best one.

Figure 1. How the agent builds and uses its tests, from observing the system to deploying the version that passes.

Active observation. The world-model agent decides what to observe before it acts. On the block-pushing task, two scripted pushes located the hidden centre of mass almost exactly.

Hidden dynamics. The physics contains changes the manual does not mention: a weakened rotor, cross-wind jets, a shifted centre of mass, a rope with a weighted end whose landing point moves by centimetres when a vertex is displaced by a micrometre. The world models made the weak rotor, the wind and the shifted centre of mass explicit as estimated parameters. For the rope, the model reproduced the motion well enough over a short horizon to test throws, without identifying the end weight.

Random variation. Where episodes vary at random, a few real trials say little. The tests run many simulated episodes across copies of the model with slightly different parameters, so that a program must succeed even if the model is not exactly right. On the drone task with traffic, our world-model agent reached 98% on episodes no agent had seen, against 49% for the CaP agent with the same five trials. On the rope throw, the controller tests each attempt against several copies of the model before executing it.

Test-time compute. Verification moves from real trials to computation: thousands of simulated episodes can rank programs in seconds. Given the world model as its test environment, the CaP agent went from 76% to 95% on the drone task with traffic, with no further real trials. On the rope throw, testing candidate actions in the model before each step reached 78% where editing programs from real trials alone reached 0 to 2%.

These tests may help most when three conditions combine: episodes vary at random, the physics hides changes the agent is not told about, and there is no live signal the controller can use to correct itself.

We tried this across eight tasks in four simulators, with our CaP agent modelled on ASPIRE under a five-trial cap and each world model a single Python file of 14 to 26 KB, with dynamics equations, collision rules and friction fitted from the agent’s observation logs. These tests can be wrong: they ranked programs well and overestimated absolute success.

The repository holds the eight environments, every program and world model the agents wrote, and the recorded results. A script, reproduce.py, re-runs any of the frozen controllers and prints the reproduced number next to the recorded one. The code is under the MIT licence. A small harness in the repository is meant to let you try this procedure on your own environment, though no model has been run through it yet. The recorded results are also available as a dataset on Hugging Face, and the pushing runs can be replayed episode by episode in an interactive Space.

Other RoboDojo scores and Chen et al. (2026) results

Claude Opus 5.5 scored 39.4% on RoboDojo Sim. Chen et al. (2026) evaluated GPT-6 Astra across six domains with mixed results and about 40 s per model call: 92% on RxR instruction following, 82% on HM3D object search, 48% on a RoboDojo subset when combined with π0.5, no success in locomotion. Anthropic ran all RoboDojo models on the same harness.

1. Real-world evaluation is the bottleneck: the agent cannot tell a good policy from a bad one

Real-world evaluation is the bottleneck: the agent cannot tell whether its own policy code is good or bad. An LLM can write a new controller in seconds, but evaluating it on the real system takes minutes, hardware, and risk. Real-world evaluation of manipulation policies is hard to scale and hard to reproduce (Li et al., 2024; Kress-Gazit et al., 2024). In Code as Policies, the LLM writes a controller as executable code, runs it, and revises.1 We built our CaP agent as an ASPIRE-style re-implementation under a 5-trial cap2 that validates each program by running it in reality.

Push-T illustrates what this bottleneck looks like in practice. The agent must move a T-shaped block onto a target outline. We shifted the block’s centre of mass from its nominal position of (0, 45) to (24, 30), but the agent does not know this. A planner that trusts the nominal physics scores 0 out of 20.

We gave the agent five real episodes to figure this out: after its third it had a program that solved 96% of 50 unseen episodes, and after its fourth it had one that solved 16%.

All five of its test episodes had succeeded, so it shipped the 16% version. When we later ran that program on the five seeds it had tested on, we found it solved exactly one of them. The other four had been solved by earlier, better versions.

Figure 2. Four controllers on the same Push-T episode. Random fails. Code-as-policy with 5 real trials times out at 0.94 coverage (just below the > 0.95 threshold). Code-as-policy with 13 real trials solves it. The code-as-world-model agent with 4 real trials solves it.

On the pushing tasks, we found that our CaP agent’s best programs scored higher than our world-model agent’s planner-based controllers (96% vs 82–90% on Push-T, 78% vs 66% on Push-L, an L-shaped variant), but our agent had no way to identify the best version with only five episodes.

Our agents are both Claude Opus 5.5 and see only an instrument manual and their own trial recordings. We ran them in formal simulators (VizDoom, a quadrotor in PyBullet/PyFlyt, planar pushing in pymunk, cable manipulation in MuJoCo) standing in for reality. Separate teams of agents built each environment and planted hidden changes that no agent was told about. We capped each agent at five real trials per task, counted in a budget counter. Without tests, our agent deployed whatever version it had, good or bad.

Keeping the agents away from the simulator

To prevent the kind of circular reasoning that plagues simulation benchmarks, we enforced a strict separation. Opaque environments (no source code visible to the agents) were built by separate agents (Claude Sonnet 5.5 for Doom, drone and pushing, Claude Opus 5.5 for the cable) who could see the real simulator. The agents never could. Agents accessed the environment only through a narrow API documented in an instrument manual. They were instructed to read only the manual and their own logs. A budget counter hard-capped each agent at 5 real trials for observing the system. An import-guard test failed if a world model imported the simulator or the environment package. We audited agent code afterwards. Hidden anomalies (a damaged rotor, shifted centres of mass, cross-wind jets, block glide after release, cable stiffness and drag) were planted by the environment teams with no mention in the manual.

Evaluation used seeds no agent had seen during its observation trials (1000–1099 for Doom and drone mission C, 1000–1049 elsewhere). Independent re-test runs on a third set of seeds (5000+) provided a second verification.

2. System identification: the agent observed before it acted, and built its tests from that observation

Before attempting the task, the agent spends its early real trials gathering information: hovering to watch other aircraft, pushing to locate a hidden centre of mass. This is active system identification, exploration before exploitation. We set up a quadrotor that flies through a narrow canyon with three checkpoints. We hid two changes from both agents: a damaged rotor and cross-wind jets. Episodes differ only slightly, so the damage and the wind are essentially the same in every episode.

Drone task details

Time window: 17 seconds. The damaged rotor produces only 60% thrust. Two cross-wind jets blow at roughly 14.8 and 11 m/s².

On the first route (mission A), we found that every controller version was either 0% or 98–100%: the stock autopilot, whose 2 m/s speed cap was too slow for the window, PPO with 5 real trials, and a learned neural dynamics model all scored 0/50, while our CaP agent produced a 100% controller after one crashed flight and our world-model agent reached 98% after one real trial and 100% after two. Our world-model agent’s flights are faster, 8.03 s vs 9.50 s, and pass closer to the canyon walls, minimum range 0.21–0.26 m vs 0.53–1.1 m.

Figure 3. Six controllers on the same mission-A episode. The wind zones and damaged rotor are drawn for the viewer but invisible to the agents. Stock, PPO (5 real trials) and neural dynamics (5 real trials) crash. Code-as-policy finishes in 9.4 s, the code-as-world-model agent in 8.0 s. PPO with 14,811 real trials finishes in 2.9 s.

After mission A we announced a new route without granting any real trials, and our agents scored 100% on mission B. Our world-model agent reused its world model and found a controller in 19.5 seconds of search. On mission C (the same canyon with 7–8 stochastic other aircraft per episode) and on the pushing tasks, where each episode starts from a random block pose, we found that success varied sharply across program versions. We retroactively evaluated every version our agents left behind on seeds nobody had seen (6000+), indexed by real trials consumed. The result is a learning curve of an LLM editing its own code.

CaP agent: each program version it wrotethe version it submitted for evaluationcode-as-world-model agent: each controller it produced
Drone, mission Aevery episode is nearly the same0%50%100%012345real trials usedprogram v1, after 0 real trials: 0%program v2, after 1 real trials: 100%program v3, after 2 real trials: 100%program v4, after 3 real trials: 100%program v5, after 4 real trials: 100%code-as-world-model agent, after 1 real trials: 98%code-as-world-model agent, after 2 real trials: 100%code-as-world-model agent, after 3 real trials: 100% Drone, mission Cother aircraft, different every episode0%50%100%05101520real trials usedprogram v7, after 0 real trials: 66%program v8, after 1 real trials: 9%program v9, after 2 real trials: 54%program v10, after 3 real trials: 54%program v11, after 5 real trials: 56%program v12, after 10 real trials: 79%program v13, after 15 real trials: 87%program v14, after 17 real trials: 85%code-as-world-model agent, after 0 real trials: 50%code-as-world-model agent, after 1 real trials: 97%code-as-world-model agent, after 2 real trials: 99%code-as-world-model agent, after 3 real trials: 95%code-as-world-model agent, after 4 real trials: 96% Push-Ta different start pose every episode0%50%100%036912real trials usedprogram v1, after 0 real trials: 72%program v2, after 1 real trials: 90%program v3, after 2 real trials: 92%program v4, after 3 real trials: 96%program v5, after 4 real trials: 16%program v6, after 5 real trials: 16%program v7, after 7 real trials: 96%program v8, after 10 real trials: 96%code-as-world-model agent, after 2 real trials: 82% Push-L, a block never seen beforea different start pose every episode0%50%100%02468real trials usedprogram v9, after 0 real trials: 50%program v10, after 1 real trials: 8%program v11, after 2 real trials: 10%program v12, after 3 real trials: 46%program v13, after 5 real trials: 46%program v14, after 6 real trials: 78%program v15, after 7 real trials: 36%code-as-world-model agent, after 2 real trials: 64% Doom take_covershare of episodes surviving 750 game ticks0%50%100%012345real trials usedprogram v1, after 0 real trials: 28%program v2, after 1 real trials: 60%program v3, after 2 real trials: 34%program v4, after 3 real trials: 78%program v5, after 4 real trials: 88%code-as-world-model agent, after 3 real trials: 100%
Figure 4. Five panels (drone A, drone C, Push-T, Push-L, Doom). Black circles joined by a line show each code-as-policy program version, placed at the number of real trials consumed before it existed. A ring marks the version submitted for evaluation on episodes the agent had never seen (held-out). Blue squares show the code-as-world-model agent’s controllers. The y-axis is the true success rate on unseen seeds. For Doom it is the share of episodes surviving 750 game ticks (Doom runs at 35 per second). On Push-T, a 96% controller at 3 real trials becomes 16% at 4.

On Push-T our CaP agent peaked at 96% after three real trials, then dropped to 16% after its fourth and shipped the weaker version. On mission C, success ranged from 9% to 87% across versions. On Push-L it peaked at 78% at six trials and fell to 36% on the next edit. What we observed is that success does not rise monotonically. The best version came and went without our agent detecting the change.

Full learning curves

CaP agent. Push-T: 72% → 90% → 92% → 96% → 16% → 16% → 96% → 96%. Mission C: 66% → 9% → 54% → 54% → 56% → 79% → 87% → 85%. Push-L: 50% → 8% → 10% → 46% → 46% → 78% → 36%. Doom mean survival in game ticks: 596 → 1,049 → 648 → 1,889 → 2,455.

World-model agent. Drone A: 98% → 100% → 100%. Drone C: 50% (its mission-A controller, unmodified) → 97% → 99% → 95% → 96%. Push-T: 82% after 2 real trials.

The Doom agent’s real trials happened to rise (296, 638, 811, 883, 2,095 game ticks observed), masking a dip after the second real trial.

Flight times. Mission A: world-model agent 98% (49/50). Mission B: code-as-policy 13.98 s, world-model agent 11.28 s. Start and checkpoint positions jitter by under a metre. The jets fluctuate by about a quarter.

TaskTest flights succeededSubmitted program’s true rate
Drone A4 of 5100%
Mission C4 of 5 initial49% (16 of 20 over all real trials)
Push-T5 of 520% (12 of 13 over all real trials)
Push-L0 of 216% (1 of 8 over all real trials)

The clearest example of writing the tests by observing came on drone C. The world-model agent went from 50% to 97% in a single real trial by spending the entire 19.4-second window hovering and logging every other aircraft’s trajectory before changing anything about its controller. We expected it to fly. Instead, it watched, and from what it saw it wrote its tests.

Are the seeds the agents observed on easier than the evaluation seeds?

A natural worry is that the seeds the agents flew their real trials on are systematically easier. We checked this. The same program versions score comparably on seeds 0–99 as on 1000+ and 5000+. The CaP agent’s submitted Push-T controller scored 16% / 20% / 22% across those three ranges. On mission C the CaP agent scored 52% / 49% / 48%. The world-model agent on mission C scored 92% / 98% / 95%. The gap between what the agents saw on their observation trials and what the evaluator measured comes from the gap between a handful of samples and the underlying distribution.

3. Policy evaluation in the world model: predicted and real success correlated at r = 0.97

The world model serves as a simulator for policy evaluation: each candidate program is scored by running it over many simulated episodes, and the scores correlate with real performance (34 programs, mean error 5.2 points, r = 0.974). Our code-as-world-model agent writes the world as a small Python file, fits the parameters to its real-episode logs, and tests its controller inside the world model, running millions of simulated steps for every real trial.

On mission C, our agent’s first real trial was pure observation. We watched it hover at the starting position for the full 19.4-second time window and logged every other aircraft’s trajectory. From those logs, our agent wrote four behaviour types into its world model (shuttlers along and across the canyon, wanderers hopping between random waypoints, and chasers that approach when disturbed), with spawn ranges and motion parameters set slightly wider than what it had observed. In the world model it discovered that every behaviour type except a chasing guard stays between 1.6 and 3.6 m altitude, and synthesised a route at 4.8 m with steep descents to each checkpoint. In-world testing: its mission-A controller scored 22–37%, the altitude lane alone 78–84%, and lane plus avoidance and tuning reached 94%. Deployed: 98% held-out, 95% re-test.

Figure 5. Four controllers on the same mission-C episode. Other aircraft are drawn as magenta spheres. Stock autopilot crashes. Code-as-policy with 5 real trials crashes. Code-as-policy with 20 real trials finishes. The code-as-world-model agent with 5 real trials finishes by climbing over the traffic and diving to each checkpoint.

On Push-T, our agent used two of its four real trials for scripted exploratory pushes, then fit the centre of mass from the observed motion. We were surprised by the accuracy: it estimated (24.1, 30.0). The truth was (24.0, 30.0), off by 0.1 units. Our CaP agent estimated roughly (3, 44), about 25 units from the truth. Our world-model agent then spent about 173 million simulated steps in the world model tuning its sampling planner.

On Push-L (a new L-shaped block, 2 real trials), our world-model agent carried over its Push-T world, swapped in the L geometry from the instrument manual, and refitted the centre of mass at (23.4, 55.6) against a true (23.0, 55.5), again within a unit. It also discovered a contact friction that the T block did not have, estimating 0.4 against a true pair coefficient of 0.36.

code-as-world-model agent, 5 real trialsCaP agent, 20 real trialsCaP agent, 5 real trials (crashed at the cross)other aircraft during the flightcheckpoints
0 m2 m4 m6 m0102030405060distance along the canyon (m)flight ceilingcheckpoint 1checkpoint 2checkpoint 3
Figure 6. Altitude versus distance along the canyon for one real mission-C episode (evaluation seed 1000). Grey dots mark the other aircraft (between 1.7 and 4.1 m in this episode). The code-as-world-model agent’s controller (blue) climbs to about 5 m and drops to each checkpoint. The code-as-policy program with 20 real trials (solid black) stays between 1.2 and 2.5 m. The 5-trial program (dashed black, cross) crashes.

Sim-to-real correlation: close on the drone, divergent on pushing and Doom

TaskPredictedActualNotes
Drone A95.7%, 8.0 s98%, 8.03 sClose
Drone B99.6%, 10.78 s100%, 11.28 sClose
Drone C94.3%, 10.35 s98%, 10.34 sSlightly pessimistic; re-test 95%
Push-T100% (91% w/ jitter)83% pooled17 pts optimistic
Push-L94%66% pooled28 pts optimistic; 9/14 failures hit wall
Doom91% survive to 24k26% did1.6× optimistic

On the drone the tests were within a few points of reality. On pushing they over-predicted success by 17–28 points, and on Doom by 1.6×. Even so, our tests separated controllers that looked identical after five real trials.

We asked whether the tests could evaluate programs they had never seen during their own development. We took every code-as-policy version from every task, 34 programs in all, and ran each through the world model. Our world model had been fitted to the world-model agent’s own observation-trial logs. With one exception (the pushing world-model agent had seen, in one program’s docstring, the held-out result of Push-T v5 at 10/50), it had never seen any code-as-policy program or its performance.

real success rate of each CaP program (held-out seeds)success rate the world model predicted for it, without a real trialthe version that was submitted
Drone, mission Asuccess rate of each program version0%50%100%v1v2v3v4v5program version, in the order writtenv1: world model predicted 1%v1: real 0%v2: world model predicted 99%v2: real 100%v3: world model predicted 100%v3: real 100%v4: world model predicted 99%v4: real 100%v5: world model predicted 100%v5: real 100% Drone, mission Csuccess rate of each program version0%50%100%v6v7v8v9v10v11v12v13v14program version, in the order writtenv6: world model predicted 41%v6: real 46%v7: world model predicted 53%v7: real 66%v8: world model predicted 12%v8: real 9%v9: world model predicted 56%v9: real 54%v10: world model predicted 56%v10: real 54%v11: world model predicted 55%v11: real 56%v12: world model predicted 81%v12: real 79%v13: world model predicted 89%v13: real 87%v14: world model predicted 76%v14: real 85% Push-Tsuccess rate of each program version0%50%100%v1v2v3v4v5v6v7v8program version, in the order writtenv1: world model predicted 60%v1: real 72%v2: world model predicted 95%v2: real 90%v3: world model predicted 96%v3: real 92%v4: world model predicted 98%v4: real 96%v5: world model predicted 20%v5: real 16%v6: world model predicted 22%v6: real 16%v7: world model predicted 99%v7: real 96%v8: world model predicted 100%v8: real 96% Push-Lsuccess rate of each program version0%50%100%v9v10v11v12v13v14v15program version, in the order writtenv9: world model predicted 31%v9: real 50%v10: world model predicted 8%v10: real 8%v11: world model predicted 14%v11: real 10%v12: world model predicted 37%v12: real 46%v13: world model predicted 34%v13: real 46%v14: world model predicted 56%v14: real 78%v15: world model predicted 32%v15: real 36% Doom take_covershare of episodes surviving 750 game ticks0%50%100%v1v2v3v4v5program version, in the order writtenv1: world model predicted 26%v1: real 28%v2: world model predicted 52%v2: real 60%v3: world model predicted 46%v3: real 34%v4: world model predicted 78%v4: real 78%v5: world model predicted 86%v5: real 88%
Figure 7. Five small panels, one per task. In each panel the x-axis is the program version in the order written. The solid line with dots is the true success rate (reality, unseen seeds). The dashed line with squares is the world model’s prediction. A ring marks the submitted version. Mean absolute error = 5.2 percentage points, r = 0.974.

Across five tasks, our tests’ predictions tracked reality with a mean absolute error of 5.2 percentage points and a Pearson r of 0.974. Task by task: drone A 0.6 pts MAE (5 programs), drone C 4.2 pts (9 programs), Push-T 5.1 pts (8 programs), Doom 5.1 pts (5 programs, using the fraction surviving 750 game ticks). Push-L is the worst at 10.1 pts MAE with one prediction off by 22 points. The world model under-predicted success for five of its seven versions, matched one (v10: 8% vs 8%) and over-predicted one by 4 points (v11: 14% vs 10%).

On the pushing tasks alone (15 programs, 3,000 simulated episodes in 19 s), our world model tracked changes closely: Push-T version 4 scored 98% in reality and 97% in the world model, while version 5 scored 20% and 25.5%. Our screening was retrospective. The places our tests were used during the work are the CaP-in-world-model runs (Section 4), where in both tasks the tests showed the agent that its last fix had made the program worse.

The code-as-policy agent wrote strong programs but had no tests to select the best version. The world-model tests ranked all 34 programs with a mean absolute error of 5.2 percentage points (r = 0.974).

Sim-to-real gap: the tests over-predicted success on pushing and Doom

Our tests are an approximate verifier. They over-predicted absolute success on pushing, Doom and the rope: 17 points optimistic on Push-T, 28 on Push-L, 1.6× on Doom, and 100% predicted against 32% real on the rope’s first controller. On Push-L our ranking is the worst of all tasks (MAE 10.1, largest error 22 points). On the rope our tests as a program-level evaluator are untested in a meaningful range, because nearly all programs scored 0–2%. What our tests did well was rank programs: the relative ordering held even where the absolute numbers were wrong. Section 6 returns to the gap between predicted and real success on the rope.

4. Real-to-sim-to-real: the improvement transferred with no additional real trials

The agent builds a small simulation from real trials, improves the policy inside it, and the improved policy transfers back with zero additional real trials. This is a real-to-sim-to-real loop (Torne et al., 2024), except the simulation is a Python file the agent writes itself. We gave the CaP agent the world model the world-model agent had already built, and let it validate each program version against tens of thousands of simulated episodes, with no additional real episodes.

On drone mission C, we started from the CaP agent’s 20-trial version (76% held-out) and ran about 22,650 simulated episodes in 157 s with zero additional real episodes. Held-out evaluation on 100 real episodes (seeds 1000–1099): 95%, mean time 9.86 s. Re-test on unseen seeds 5000–5099: 95%, mean 9.68 s. For comparison, the same agent with 5 real trials scored 49%. Our world-model agent’s own controller scored 98% held-out and 95% re-test.

On Push-L, we started from the CaP agent’s 8-trial version (46% held-out). Given the world model (carried over from Push-T, where it had used 4 real trials, and refitted for the L block with the world-model agent’s 2 Push-L real trials), we ran about 20,800 simulated episodes in 249 s with zero additional real episodes. It scored 84% on 50 held-out episodes (seeds 1000–1049) and 80% on re-test seeds 5000–5049. Our world-model agent’s own controller scored 72% held-out and 62% re-test. A planner given the real simulator (the oracle planner) scores 80% on Push-L. CaP with the world model scored higher than either agent alone.

In both tasks, our tests caught a regression: our agent’s last fix from real flights had made the program worse. Code as Policies wrote the controller structure. Our world model provided the test suite it needed to select the right version.

5. Closed-loop feedback and long-tail failures: a reactive policy was enough, and the tests still exposed rare failures

When a live reading of the quantity that defines failure is available, a reactive feedback policy is enough and a model adds nothing to success. But a few successful real trials can hide long-tail failures: testing over many simulated layouts exposed failure cases that five real successes had missed. We added a task with a deformable cable about 1 m long on a table, routed around three posts. A force reading is reported at every step, and exceeding the limit fails the episode. We hid three changes from the agents that make pulling quickly overload the cable. Layouts differ in every episode.

Cable task details

Simulated in MuJoCo as a chain of elastic segments. One end is clamped and the other held by a tool (2-d position commands at 20 Hz, speed limited to 0.30 m/s). The cable must end up on a prescribed side of each post (a winding-angle rule), with the tool coming to rest within 2 cm of a target. Force limit 10 N. Time limit 30 s.

Hidden changes: bending stiffness 3× nominal, cable–post friction 1.0 instead of 0.3, and viscous drag against the table (90 N·s/m per metre of cable, nominal zero).

The agents were not told what the setup is. The manual calls it an “installation” and documents only the interface (twenty tracked points, a tool, three posts, a load reading, the success rule), with no images and one field note saying it “fights back” when you hurry. Our agents filed a written hypothesis before their first real trial and both got it right from the data, describing an inextensible cable of about 0.99 m held by the tool and identifying it as a cable-routing task where the load grows with speed and wrapping.

Figure 8. Three panels, same real episode (seed 1000), 2× speed. The existing constant-speed program overloads at 11.0 s. The code-as-policy program finishes in 10.8 s with peak load 5.1 N. The world-model agent’s controller finishes in 20.2 s with peak load 4.4 N.

Our CaP agent with 5 real trials scored 50/50 on both held-out and re-test seeds, setting its speed from the live load reading from its first program (full speed below 4 N, stop at 7 N, back off above 8.5 N). Mean peak load was 5.0 N against the 10 N limit. Our world-model agent with 3 real trials also scored 50/50 held-out and 49/50 unseen, with a 13,870-byte world model. A control CaP agent starting with no record of the cable in motion (the 10 logged episodes removed) reached 47/50 = 94%, also using the live reading from its first program. Its three failures are time-outs from a geometric bug.

The task turned out easy because the live load reading let all three agents build a reactive speed rule: slow down when the cable pulls, stop when it pulls hard. The hidden physics became irrelevant. Even our control CaP agent, starting with no record of the cable in motion, reached 94% from the reading alone. Where our tests mattered was as a bug-finder: our cable world scored 23 programs to within 5.2 percentage points on average (r = 0.980) and predicted three programs’ outcomes on 150 of 150 episodes. Five successful real trials had not revealed a 6–12% failure rate. The tests did.

Cable routing: full results and analysis

Three approaches to the cable task: feedback control, open-loop programs and world-model verification

Code as Policies (5 real trials, 50/50). The CaP agent wrote its first program before any real trial of its own, with the logs of 10 episodes by an existing program in hand. The program follows a tight path around the posts and sets the tool speed from the live load reading (full speed below 4 N, stop at 7 N, back off above 8.5 N). All five real trials succeeded. Version 2 pulled the path tight. Version 3 added two safety rules that never fired. Held-out evaluation 50/50. Re-test on unseen seeds 5000–5049: 50/50. All three versions score 50/50 on seeds 6000–6049. Mean peak load 5.0 N against the 10 N limit. Mean episode 171 steps (8.5 s).

Code-as-world-model (3 real trials, 50/50 held-out, 49/50 unseen). The world-model agent used 3 of its 5 real trials. Its world model (a 20-node spring-damper chain with bending stiffness, viscous and Coulomb drag, post collisions, and a tool servo model) is 13,870 bytes. Held-out evaluation 50/50. Re-test on each of two unseen sets (5000–5049 and 6000–6049): 49/50. The world-model agent’s controller is slower, averaging 350 steps (17.5 s).

Control: Code as Policies without the free logs (5 real trials, 94%). A fresh CaP agent got only the manual and the 200 static scene snapshots. The 10 logged episodes and the earlier agents’ programs and logs were removed from the project. Its hypothesis before the first real trial again identified a cable of about 1 m. All five real trials succeeded, the first one included (163 steps, peak load 5.12 N). No real trial and no evaluation episode ever overloaded. This agent also set its speed from the live load reading from the first program on. Held-out evaluation of its submitted program (v2): 47/50 = 94%. The three failures are time-outs from a bug in its path sampling that freezes the commanded point on certain layouts. Unseen seeds: 49/50 (5000–5049) and 50/50 (6000–6049).

Reactive feedback policy: a force reading makes the model unnecessary for success

The live load reading. The quantity that defines failure (the load) was fed live to the controller, and nothing forced the controller to hurry. A reactive rule on the load reading makes the hidden physics irrelevant. The controller slows down when the cable pulls, stops when it pulls hard, and backs off if it pulls harder. The control CaP agent, which started with no record of the cable in motion, reached 94% from the live reading alone.

The cable bears on about one post. The success rule asks only that the cable pass each post on a prescribed side, and every layout leaves 14–29 cm of slack. As a result the cable ends a successful episode in contact with 1.16 of the 3 posts on average for the code-as-policy program (1.02 for the world-model agent, 1.03 for the environment’s informed controller, 1.14 for the constant-speed program). At most about 1.3 posts bear load at the same moment. The hidden post friction and the compounding of friction over several posts are therefore rarely exercised. The hidden effect that matters is the drag that grows with speed.

Speed and path do most of it. The code-as-policy program’s speed is capped at 10 cm/s (mean 8.4) against the constant-speed program’s 15 cm/s. Its path is pulled tight, 0.72 m on average against 1.06 m, so less cable is dragged. It slows between 4 and 7 N, which it does for 37% of the episode. It never exceeds 7 N (mean peak 5.0 N, highest 5.7 N). The constant-speed program’s mean peak is 10.5 N. The environment’s open-loop program at a constant 10 cm/s and 6.5 cm clearance from the posts already succeeds in 84% of unseen episodes. The load feedback closes the rest.

Starting conditions: both agents had free logs, and the environment’s reference scored 78%

The environment’s “informed” controller (78%) is a conservative reference. A faster policy would score higher. It fails by being slow. Mean tool speed is 4.5 cm/s, 417 steps on average. 10 of 50 episodes did not finish within the 30 s limit (3 of them with a post still on the wrong side). One overload came from a 38 N spike when the tool snagged.

Both agents started with the full step logs of 10 episodes run by an existing program (load trace included, 8 of them failures), twice the trial budget in ready-made examples. In every other task the agents started with no record of the system in motion. The control experiment above (94%, five real trials, no overload, logs removed) shows that the free logs were not what made the task easy. The live reading was.

Short-horizon prediction accuracy of the cable world model

On logs it was not fitted to, the marker position error is 2.8, 8.7 and 20.5 mm after 5, 20 and 60 steps. A “cable stays still” baseline gives 7.5, 27 and 64 mm. Load error is 0.26, 0.31 and 0.37 N. The agent stated its own weak spot. Replaying the commands of the 10 observation episodes, it reproduces only 3 of the 10 outcomes. Most end within half a newton of the 10 N limit, and it under-predicts the spike when the tool snags on a post and lurches free (7.3 N predicted against 21 N real in one episode).

Coverage: the tests found failure cases the real trials had missed

Because both agents’ programs were at or near 100%, we added a spread of weaker programs to test the evaluator. These are the environment’s open-loop program (tight path, one constant speed, no load feedback) at 8 speeds × 2 clearances from the posts. Each was run on 50 unseen real episodes (seeds 6000–6049) and independently scored in the world model from the reset readings of those same episodes (looking is free, zero real steps, the world-model agent never saw the outcomes). Mean absolute error 6.0 points. 10 of 20 within 5 pts, 16 of 20 within 10. Worst case 22 points (6.5 cm clearance at 12 cm/s: 60% real, 38% predicted). r = 0.976. The predicted and real outcome agree in 916 of 1,000 individual episodes (91.6%). The world reproduces both failure modes. At 9 cm clearance the real success rates at 4, 6, 8, 10, 12, 15, 20, 25 cm/s are 16, 80, 82, 80, 58, 22, 4, 0% and the predictions 18, 90, 88, 68, 44, 18, 10, 6%. Too slow runs out of time, too fast overloads. We chose the 16 open-loop programs. No agent wrote them. The world had been fitted on logs of this same program at one setting (9 cm, 15 cm/s), on other episodes. This result is separate from the 34-program screening in Section 3.

real success rate of each program (50 held-out episodes)success rate the world model predicted for it, without a real trial
Open loop, 9 cm from each postsuccess rate of a constant-speed program0%50%100%44 cm/s: world model predicted 18%4 cm/s: real 16%66 cm/s: world model predicted 90%6 cm/s: real 80%88 cm/s: world model predicted 88%8 cm/s: real 82%1010 cm/s: world model predicted 68%10 cm/s: real 80%1212 cm/s: world model predicted 44%12 cm/s: real 58%1515 cm/s: world model predicted 18%15 cm/s: real 22%2020 cm/s: world model predicted 10%20 cm/s: real 4%2525 cm/s: world model predicted 6%25 cm/s: real 0%tool speed (cm/s) Open loop, 6.5 cm from each postsuccess rate of a constant-speed program0%50%100%44 cm/s: world model predicted 48%4 cm/s: real 48%66 cm/s: world model predicted 92%6 cm/s: real 88%88 cm/s: world model predicted 88%8 cm/s: real 88%1010 cm/s: world model predicted 70%10 cm/s: real 84%1212 cm/s: world model predicted 38%12 cm/s: real 60%1515 cm/s: world model predicted 14%15 cm/s: real 20%2020 cm/s: world model predicted 8%20 cm/s: real 0%2525 cm/s: world model predicted 4%25 cm/s: real 0%tool speed (cm/s) The agents' own programsall four regulate speed on the live load reading0%50%100%v1CaP v1: world model predicted 100%CaP v1: real 100%v2CaP v2: world model predicted 100%CaP v2: real 100%v3CaP v3: world model predicted 100%CaP v3: real 100%world'scode-as-world-model agent's controller: world model predicted 96%code-as-world-model agent's controller: real 98%CaP v1–v3, code-as-world-model agent
Figure 9. Three panels. Left and centre: the open-loop program’s success rate against tool speed at 9 cm and 6.5 cm clearance from posts. Solid line with dots is the real rate, dashed line with squares the world model’s prediction. Right: the four programs the agents wrote.

The control CaP agent’s three programs. The control CaP agent’s five real trials all succeeded, yet its programs were not equally good. Selecting the best required more than five successful trials. On the held-out evaluation seeds, v1 (flown once, succeeded) scores 44/50. V2 (flown four times, all succeeded, submitted) scores 47/50. V3 (the fix it wrote after seeing the evaluation failures, never flown, not submitted) scores 50/50. We gave the three programs to the cable world model, written by the other agent, which had never seen them. Each simulated episode started from the reset reading of the corresponding evaluation episode, with zero real steps. The world model predicted 44/50, 47/50 and 50/50. It named exactly the episodes that failed in reality: seeds 1029, 1033, 1046 for v2, and those three plus 1038, 1039 and 1043 for v1. That is 150 of 150 episode outcomes correct. On unseen seeds 6000–6049 the world likewise matched all three (49/50, 50/50, 50/50 real and predicted, same failing episode). These failures are geometric bugs in the program (a path the tool cannot follow), not subtle physics. The agent noted that a static verification over the 200 snapshots would also have found the v2 bug. The point is the same as on Push-T at a smaller scale. Five successful flights did not show a 6–12% failure rate. Running the program on many simulated episodes did.

With these three programs the cable world has now evaluated 23 programs on seeds 6000–6049: mean absolute error 5.2 points, worst 22, r = 0.980.

Where the tests add nothing: closed-loop feedback makes the controller self-correcting

With the live load reading, the load stopped being a source of failure. A reactive speed rule made the hidden physics irrelevant. Even the control CaP agent, which started with no record of the cable in motion, reached 94% from the reading alone. The world model had nothing to add to the controller. What remained were ordinary program bugs, geometric path errors that never triggered during five successful real trials but failed on certain layouts. The world model still predicted all three programs’ outcomes on 150 of 150 episodes and identified the failing seeds by name.

The world model’s value in this post is tied to the condition identified in Section 2. Episodes differ, and telling program versions apart requires more trials than the budget allows. Where a live reading lets a program correct itself in every episode, that condition is largely absent for the physics but not for the geometry. What the cable task does add is that both agents identified an undescribed deformable object from logs alone. A 14 KB world model of it was written from the observation logs and 3 real trials. That world evaluated 23 programs to within 5.2 points on average.

6. Model-predictive control: a fraction-of-a-second forecast was enough when the controller re-planned from observations

On a chaotic, contact-rich deformable task, a model accurate only over a short horizon, combined with sampling-based MPC and domain randomisation over model parameters, was enough where editing a fixed program from real trials alone was not. The cable task was quasi-static, slow, correctable, with every sensor reading available in real time. We designed the rope task as the opposite. A rope lies on a table and the agent must fling its free end past a post into a target disc that the tool cannot reach. There is no force reading and no slow path to the goal. We hid the rope’s physical parameters from both agents. Neither agent was told what the setup is. The manual’s field note, verbatim: “the people who run this installation say you get one go at it, and that doing it slowly gets you nowhere. Nobody has written down why. They also say that a small change in how you do it changes where it ends up.”

Rope task details

The rope is 0.70 m long and 1 cm thick, one end held by a tool that can move only inside a 0.25 × 0.40 m zone. A post (radius 3 cm) stands 0.40–0.56 m from the zone centre, and the target is a disc of radius 0.10 m centred 0.12 m behind the post. Success requires the whole rope and the tool at rest (every tracked point moving at most 0.02 m/s) with the free end inside the disc, within 236 steps (4.72 s) at 50 Hz. Readings are 20 tracked points, tool position and velocity, post and target. Tool limits are 4 m/s and 60 m/s².

Hidden parameters: bending stiffness 2.0e−3 N·m², table friction 0.10, post friction 0.25, 56 g of rope plus a 30 g weight on the free end, viscous drag.

Unlike the cable task, where both agents were given 10 logged episodes free, no recording of the setup in motion existed for anyone. Our agents had only the manual, 200 static snapshots and 5 real trials. Two things the readings give away: the points’ height (0.005 m) reveals the rope’s radius, and the snapshots are taken 0.8 s after release, so the rope is not at rest in them.

Figure 10. Four programs on the same real episode (evaluation seed 1000), the lowest evaluation seed on which each panel shows that program’s most common outcome. Top left: Code as Policies agent, 19 real trials, 0/50 (at rest 1.12 m from the target). Top right: Code-as-world-model agent, first model, 4 real trials, 16/50 (still moving at the time limit, 0.11 m from the target). Bottom left: Code-as-world-model agent, revised model, 20 real trials, 39/50 (at rest inside the target after 2.22 s). Bottom right: Oracle planner (true simulator), no real trials, 42/50 (at rest inside after 1.94 s).

The difference between the two approaches here was qualitative. Across 19 program versions, editing from real trials never produced a throw that came to rest in the target on more than 1 of 50 episodes (Code as Policies scored 2% at 5 real trials, 0% at 19). The agent learned true things about the reversal, the stroke threshold and the follow-through, but the gains on one layout did not transfer to others. Testing each throw in the world model before executing it produced a working controller: our code-as-world-model agent scored 32% at 4 real trials with its first world (14,313 bytes), then 39 of 50 episodes (78%) at 20 real trials with a revised world (16,069 bytes) that added speed-dependent friction and inextensible-link energy loss. That is three episodes short of the oracle planner’s 84%, and 78% again on re-test seeds. We found that the world never became accurate to a few percent: our revised world’s far-end error was 1.2 / 5.8 / 17.4 cm at 5 / 20 / 60 steps. What worked was a model good for a fraction of a second, re-planning every 0.16 s from the live reading across six perturbed copies. Our tests did not need a perfect model of a hard system. They needed only a short-horizon forecast, re-run as the system moved.

Rope task: full results and analysis

Sensitivity to initial conditions: a one-shot throw with no feedback

On the cable task a live load reading let a program go slowly and brake. Here nothing can be done slowly and there is one throw. The environment’s own measurements confirm the sensitivity. Changing each parameter of a successful throw by up to ±5% moves the landing point by 6.5 cm (median, 17 cm at the 90th percentile) against a 10 cm target radius, and the throw still succeeds 36% of the time. Starting from the exact physics but rebuilding the state from the 20-point reading instead of copying it gives 17% (4/24), open loop. Moving every vertex by one micrometre makes 2 of 7 successful plans fail, their landing points moving 14–18 cm.

The oracle planner searches for a throw inside the real simulator, per episode (up to 1,000 trial throws), and scores 42/50 (84%). A planner using a copy of the simulator with every physical parameter wrong by ±10%, planning once, scores 12–14%. The same planner re-planning every 15 steps from live readings scores 50–62.5% (about 1,100 simulated throws per episode). Exact physics, exact starting state, planning once: 42/50 on the 50 evaluation episodes. On 24 tuning episodes (where the oracle planner scores 47/50), exact physics with the starting state rebuilt from the reading gives 4/24. No slow strategy works. The best per-episode strategy at 0.2 m/s, searched inside the real simulator, scores 1/50.

Open-loop policy search from real trials: overfitting to one layout

Before its first real trial the agent wrote that the setup is “a flexible rope/cable … about 0.70 m long and ~1 cm thick” to be thrown so its free end comes to rest in the disc (hypothesis file written before real trial 1). Five initial real trials, 1,180 real steps, all failures. The free end landed 0.62–1.16 m from the target. Submitted program v6 (3,603 bytes) executes a full-rate stroke towards an aim point beside the post, an immediate reversal, then holds. Held-out evaluation: 1/50 (2%). Of the 50 episodes, 47 ended at rest outside the target and 2 were still moving at the time limit. Median distance of the free end from the target was 0.99 m.

Extended to 19 real trials (4,484 real steps), versions v7–v19. Ten of those real trials were flown on one layout so that each change could be tested in isolation (the environment is deterministic). On that layout 7 of 8 throws with a stroke of at least 0.23 m carried the free end within 0.05–0.14 m of the target centre, but it never came to rest there. The rope either turned over and recoiled past the tool or grazed the post and collapsed. The agent reports a sharp stroke threshold. A stroke of 0.12 m produces nothing, 0.20 m lands 0.26 m short, and 0.25–0.27 m reaches the target. Final program v19 (8,973 bytes): 0/50, median 1.00 m. An intermediate evaluation after 6 real trials (v7) gave 1/50. Unseen episodes (seeds 5000–5049): v6 0/50, v19 0/50. All 19 versions on the evaluation episodes score between 0/50 and 1/50 each.

The agent learned true things about the reversal, the stroke threshold, and the follow-through. On one layout it sent the free end through the target 7 times in 8. The free end did not come to rest in the target, and the gains on that layout did not transfer to other layouts.

On the pushing and drone tasks the world model verified programs to determine which version to deploy. Here, no version was worth choosing because all 19 scored 0–2%. The same kind of world model can verify candidate actions instead, using model-predictive control (MPC). Every 8 steps the controller scores 64 candidate throws in 6 perturbed worlds (384 rollouts, up to 120 steps or 2.4 s ahead) and executes the best. The first plan uses 5 rounds of this search.

Receding-horizon control: re-planning every 0.16 s with domain randomisation

Before its first real trial it wrote that the setup is an inextensible rope lying on the table with Coulomb friction, to be flung past the post. Four of its 5 initial real trials were used (944 real steps). Real trial 1 was an observation script (hold, slow drag, step, wind-up, fling). Real trials 2–4 flew successive controllers end to end. All four failed (0.98, 0.75, 0.13, 0.58 m from the target).

First world: one file of 14,313 bytes, a planar chain of 20 point masses with stretch springs, bending stiffness and damping, table friction and drag, post contact and the tool’s servo. It has 11 parameters fitted to its real trials. Two things changed in the agent’s picture after those trials. Elasticity dominates: with the tool still, the rope’s kinetic energy rose while its bending relaxed. The rope is still moving at the reset reading (about 0.25 m/s), so the snapshots are not rest shapes.

First controller: sampling-based planning over a throw (wind-up, throw, hold), evaluated in 4 perturbed worlds with parameters randomised by ±25%, re-planned every 8 steps (0.16 s) from the live reading, command speed capped at 3 m/s, one re-throw allowed. About 0.4 s of compute per step. Before the held-out evaluation its world predicted 24/24 (100%). It added in writing that the real figure would be far lower. Real: 16/50 (32%). Of the 50 episodes, 9 were at rest outside the target and 25 were still moving at the time limit. Median distance 0.14 m.

It measured the task’s sensitivity inside its own world (12 situations, the controller’s commands replayed open loop): one parameter off by 3% moves the landing point by 2.3 cm (median). Adding 0.1 mm of noise on the starting positions moves it by 1.5 cm (median, 11 cm at the 90th percentile) and success drops from 11/12 to 9/12. At 1 mm the landing point moves 12 cm and success drops to 4/12.

Extended run (20 real trials total, 3,766 real steps): four real trials of scripted strokes at 1–4 m/s with long holds. They showed that after a stroke the rope curls and keeps moving elastically for more than 70 steps, and that friction is low at low speed. Revised world (16,069 bytes), with two added mechanisms. The first is friction that depends on speed (fitted 0.28 at speed, 0.09 below about 0.7 m/s). The second is nearly inextensible links that lose energy when they snap taut. Each mechanism accounts for about half of the gain. On two exploratory trials held out from fitting, the free-end error after 60 steps went 24.6 → 19.3 → 14.5 cm.

Final controller: the same structure planning in the revised world, 6 perturbed worlds randomised by ±35%, re-planned every 8 steps. Flown for real on 12 real trials before evaluation, of which 9 succeeded. The last five were trials of the frozen controller (4/5 successful). About 2 s of compute per 0.02 s step. Prediction before the extended evaluation: 65% (it would not be surprised by 45–80%), taken from the 9/12 real trials and shaded down. Its world’s own prediction under ±15% parameter perturbations was 10/10. It wrote that it was deliberately not using that number.

Extended evaluation: 39/50 (78%). Of the 11 failures, 7 were at rest outside the target and 4 were still moving. Median distance 0.088 m. Unseen episodes (seeds 5000–5049): 39/50 (78%), every episode within 0.2 m. Three episodes short of the oracle planner (42/50).

Prediction accuracy: 0.4 s ahead within about 6 cm

The world never became accurate to a few percent, and by the environment’s and the agent’s own measurements even exact physics started from the 20-point reading succeeds in only 17% (4/24 tuning episodes) open loop. On three controller real trials that neither world was fitted to, the first world’s errors were 3.0 / 13.7 / 40.4 cm at 5 / 20 / 60 steps. The revised world’s errors were 1.2 / 5.8 / 17.4 cm. The controller re-plans every 8 steps. What worked was a model good for a fraction of a second, re-planning every 0.16 s from what the rope actually did, and planning across six perturbed copies of the world model.

The world model still overestimates itself. It predicted 100% against 32% real for the first controller, and 10/10 against 78% for the final one. The prediction that held (65% against 78%) came from real trials flown with the frozen controller. The agent never identified the 30 g weight on the free end, which is roughly eleven times a tracked point’s share of the rope’s mass. Its fit pushed the free-end mass to the upper bound twice (2×, then 6×), and it recorded only that “the inertia distribution is still not right.”

Sim-to-real gap on the rope: the test suite is too easy to pass

The 19 code-as-policy programs run inside the first world from the reset readings, against their real results. Evaluation episodes: real 0–2% per program, predicted 0–6%. Mean error 0.9 points, largest 6. Unseen episodes: real 0–2%, predicted 0–10%. Mean error 2.7 points, largest 10. The agreement is cheap because nearly everything fails. Of 950 episodes on the evaluation seeds the world predicted 7 successes and reality had 2, none of them the same episode. Per episode, predicted and real distance of the free end correlate at 0.27, with a median difference of 0.11 m, the size of the target.

Controls and methodology: what was hidden, what was given, what was measured

Hypothesis files predate each agent’s first real trial. The held-out evaluation logs were not used for fitting or tuning by either agent. During the agents’ runs the cable task’s programs, logs, world model and all write-ups were moved out of the project and locked. The rope left the table once (real trial 2, a 0.4 m reversing stroke at 4 m/s, rising 0.27 m). In the other 19 real trials it stayed flat. The planar world holds under the 3 m/s cap.

CaP agentcode-as-world-model agentleft: oracle planner (true simulator)right: first world model (fitted on 4 real trials)right: revised world model (fitted on 8 real trials)
Held-out episodes, by real trials usedsuccess on seeds 1000–10490%50%100%planning in the real simulator: 84%CaP agent after 5 real trials: 2%CaP agent after 6 real trials: 2%CaP agent after 19 real trials: 0%code-as-world-model agent after 4 real trials: 32%32%code-as-world-model agent after 20 real trials: 78%78%0%05101520real trials used (one trial = one 4.7 s episode) Second held-out setsuccess on seeds 5000–50490%50%100%5 trials: 0%0%5 trials19 trials: 0%0%19 trials4 trials: 48%48%4 trials20 trials: 78%78%20 trialsthe same four programs, real trials each agent used How far ahead the world model seeserror of the rope's far end, on real trials it was not fitted to0 cm20 cm40 cmfirst world model, 5 steps ahead: 3.0 cm3revised world model, 5 steps ahead: 1.2 cm15 (0.1 s)first world model, 20 steps ahead: 13.7 cm14revised world model, 20 steps ahead: 5.8 cm620 (0.4 s)first world model, 60 steps ahead: 40.4 cm40revised world model, 60 steps ahead: 17.4 cm1760 (1.2 s)steps ahead; MPC re-plans every 8
Figure 11. Left: success on the 50 evaluation episodes against real trials used. Code-as-policy scored 2% at 5 real trials, 2% at 6, and 0% at 19. The code-as-world-model agent scored 32% at 4 real trials and 78% at 20. Dashed line at 84% is the oracle planner. Middle: the same four submitted programs on 50 unseen episodes (seeds 5000–5049), scoring 0%, 0%, 48%, 78%. Right: error of the rope’s far end predicted by the world model on real trials it was not fitted to, at 5 / 20 / 60 steps ahead. First world 3.0 / 13.7 / 40.4 cm, revised world 1.2 / 5.8 / 17.4 cm. The controller re-plans every 8 steps.

7. Model size and interpretability: a few hundred lines of Python with named physical parameters

Each world model is a 14 to 26 KB Python file with named physical parameters, readable and editable by both the agent and a human. Our agents wrote five test suites, one per system. Our drone world model (the largest) is a single Python file of 25,975 bytes, about one thirtieth of the mission-C video on this page (807 KB). It contains the quadrotor’s equations of motion with a constant body-rate bias and a thrust deficit (how a weak rotor shows up through the inner loop). It also contains a wind field where each jet is a Gaussian profile along the canyon with terms for depth into the aisle and height, a checkpoint-sequence description, and, after mission C, four types of stochastic other-aircraft behaviour with spawn ranges and motion parameters. Our pushing world model is 14,344 bytes covering both the T and L blocks: a rigid-body impulse model with fitted centres of mass, floor friction, restitution, contact friction for the L, and a pusher model. Our Doom world model is 16,599 bytes: player kinematics, fireball spawning, imp placement, and a damage model. Our cable world model is 13,870 bytes: a 20-node spring-damper chain with bending stiffness, viscous and Coulomb drag on the table, post collisions, and a tool servo model. Our rope world model went through two versions: 14,313 bytes for the first and 16,069 bytes for the revised version, which added speed-dependent friction and inextensible-link energy loss. Both are a planar chain of 20 point masses with stretch springs, bending stiffness and damping, table friction and drag, post contact and the tool’s servo. We wrote five worlds in 14–26 KB: our drone world drew on ten real trials across missions A and C, and the others on two to twenty per task.

For comparison: PPO trained in reality needs between 1,137 and 3,065 real trials to cross 50% success on drone mission A, and with 14,811 real trials it finishes in 3.0 s. Our LLM agents finish in under 10 s with 4–5 real trials, while a learned neural dynamics model with 5 real trials scored 0/50 on mission A. PPO with 5 real trials averages 206 game ticks in Doom, and with 4,672 real trials it reaches 1,716, still below the CaP agent’s 2,385 at 5 real trials.

TaskControllerReal trialsHeld-outRe-testTrained in
Drone AStock autopilot—0%
PPO50%Reality
Neural dynamics50%Reality
Code-as-policy5100%100%Reality
Code-as-world-model498%100%World model
Drone C
(+traffic)
Stock autopilot—0%
Lab reference avoider—75%Oracle
Code-as-policy549%48%Reality
Code-as-policy2076%77%Reality
Code-as-world-model598%95%World model
CaP in world model20+10†95%95%World model
Doom
(game ticks)
Random—287
PPO5206Reality
Code-as-policy52,3852,519Reality
Code-as-world-model419,16216,705World model
Push-TDatasheet planner—0/20
True-sim planner—84%Oracle
Code-as-policy520%22%Reality
Code-as-policy1394%94%Reality
Code-as-world-model490%76%World model
Push-L
(new block)
Datasheet planner—0/20
True-sim planner—80%Oracle
Code-as-policy216%14%Reality
Code-as-policy846%44%Reality
Code-as-world-model272%62%World model
CaP in world model8+2†84%80%World model
Cable
(MuJoCo)
Constant-speed program—28%
Scripted (conservative)—78%Oracle
Code-as-policy5100%100%Reality
Code-as-policy, no logs594%98%Reality
Code-as-world-model3100%98%World model
Rope
(MuJoCo)
Best slow strategy—1/50Oracle
Real-sim planner—84%Oracle
Code-as-policy52%0%Reality
Code-as-policy190%0%Reality
Code-as-world-model432%48%World model
Code-as-world-model2078%78%World model

† CaP agent’s real trials + real trials spent building the world model. Zero additional real episodes for the code-as-policy agent inside the world model. For Push-L the world model was carried over from Push-T (4 real trials) and refitted with 2 additional Push-L real trials.

Figure 12. Four controllers in the same VizDoom episode, time-lapsed. Random dies at game tick 680, PPO (5 real trials) at 270, code-as-policy at 2,533. The code-as-world-model agent’s controller is still alive at game tick 3,000 (that episode ran 24,421 game ticks).
What about learned video world models?

World Models (Ha & Schmidhuber, 2018) reported 1,092 ± 556 mean survival on the same Doom task from a neural world model trained on 10,000 random rollouts from pixel observations. Our world-model agent’s controller averages 19,162 game ticks from 4 real trials with structured observations. The two setups differ (pixel versus structured input, 10,000 rollouts versus 4 episodes, a neural network versus a text file).3

8. Propose and verify: CaP writes programs, the tests select them

Code as Policies proposes controller candidates and the world-model tests verify them. We found that the tests mattered most where three properties combined: episodes vary at random (so a few real trials do not separate program versions), the physics hides changes the manual does not mention (so the agent has to observe to find them), and the dynamics are complex or sensitive (so each action is worth testing just before it runs). They mattered least where variation is low or where the controller senses the failure signal live and can correct itself. The table below organises our tasks by these properties.

TaskHidden physicsRandom variationDynamicsLive failure signalWhat the tests did
Drone A/BWeak rotor, cross-windLowRigid bodyNoLittle: both approaches near 100% after one or two trials
Drone CSameHigh (7–8 random aircraft)Rigid bodyNoWM agent 98%. CaP 76% with 20 trials, 95% with the tests
Push-TShifted centre of massRandom start posesContactNoTests ranked versions (v4: 97% predicted vs 98% real; v5: 25.5% vs 20%)
Push-LNew block, contact frictionRandom start posesContactNoCaP 46% with 8 trials, 84% with the tests
DoomNone plantedRandom enemy fireGameNoWM agent 19,162 vs CaP 2,385 game ticks
CableStiffness, friction, dragLayouts varyDeformable, quasi-staticYes (live load)CaP 100% on its own; tests caught a bug (150/150)
RopeWeighted free end, stiffness, frictionLayouts varyDeformable, dynamic, sensitiveNoCaP 0–2%; WM agent 78% with run-time tests
Figure 13. Four controllers on the same real Push-L episode. The random policy and the code-as-policy program (2 real trials) do not solve it (best coverage 0.43 for the latter). The code-as-policy program with 8 real trials solves it at step 295 of 300. The code-as-world-model agent’s controller solves it at step 152.

Our world model’s contribution was verification: millions of simulated steps for every real trial, turning a handful of episodes into a statistical test. The combination mattered most when we gave a CaP agent the world model as its test environment. On drone C the CaP agent with 20 real trials scored 76%. With the tests, 95%. On Push-L the CaP agent with 8 real trials scored 46%. With the tests, 84% held-out and 80% on re-test, higher than either agent alone (CaP 46%, world-model agent 72%) and on a par with the oracle planner (80%). On the cable, where a live reading lets the program correct itself, the tests added nothing to success but still caught a bug (150/150 episodes). On the rope our tests verified actions, not programs, and produced a working controller where editing from real trials alone had not. Robustness on the rope came from testing in six perturbed copies of the world model (parameters randomised by ±35%), which covered what our agent had not measured.

There is also a ceiling effect on the pushing tasks that is easy to misread. A sampling planner given the real simulator itself (the actual environment, with no model at all) scores only 84% on Push-T and 80% on Push-L. Our Push-T result (83% pooled over three evaluation sets) matches the oracle planner. On the L it is 66% pooled against 80%. The bottleneck on these tasks is the sampling planner’s ability to exploit whatever world it is given. Code as Policies writes the programs. The world-model tests verify them.

9. Limitations

Additional disclosures
  • VizDoom is not a robotics task. We include it because it was the first task. The inspiration (Saltline) is a first-person shooter, and take_cover is the scenario the 2018 World Models paper used.
  • Model-family coincidence on pushing. The Push-T world model and the real environment both use rigid-body impulse physics. On a physical robot this match has to be established for each system.
  • Push-L screening error. The world model’s predictions on Push-L have an MAE of 10.1 percentage points with a worst-case error of 22 points, substantially worse than the 0.6–5.1 pts on other tasks. On Push-L the world model under-predicted success for five of seven versions, matched one and over-predicted one.
  • CaP-in-world-model cost. CaP with the world model as its test environment uses zero episodes beyond the CaP agent’s own real trials and the real trials spent building the world model. On drone C this was 20 + the world’s 10 across missions A and C. On Push-L it was 8 + 2, where the world model was carried over from Push-T’s 4 real trials and refitted with the 2 Push-L real trials.
  • Screening exception. The pushing world-model agent, before scoring code-as-policy programs, had seen one line in a Push-T v5 program’s docstring stating the held-out result of that version (10/50). The 34-program screening was otherwise blind.
  • Carry-over on mission C. Both agents had completed missions A and B before attempting C, and observation-trial logs on C included every other aircraft’s true track for both agents.
  • Post-hoc editing. The CaP agent’s evaluated on held-out seeds mission-C program (v11) was edited after its five real trials ran out and never flown before evaluation.
  • Relaxed rules on Doom. The world-model agent’s rules were relaxed mid-run to allow hand-written controllers tuned in the world model, instead of only RL-trained ones.
  • Retrospective evaluations. The learning curves in Figure 4 are retrospective evaluations we ran afterwards. The agents did not see these scores during their trials.
  • Cable: hiding the task identity. The cable task relied on rules (the manual names no object). An after-the-fact audit of all three cable agents’ command logs confirmed that none accessed forbidden files.
  • Cable shared environment. The cable simulator package was installed in the shared environment accessible to both agents.
  • Cable free logs. Unlike every other task, both cable agents were given the full step logs of 10 episodes run by an existing program before their first real trial, twice the trial budget in ready-made examples. The control experiment (94%, no logs) shows this did not drive the result.
  • Cable success rule and slack. The success rule asks only that the cable pass each post on a prescribed side. Every layout leaves 14–29 cm of slack, and the cable ends a successful episode in contact with about 1 of 3 posts on average. This does not test routing under tension around several posts.
  • Cable evaluate programs. The 16 open-loop programs and the control CaP agent’s 3 versions were scored in the world model by us, not by the world-model agent itself.
  • Rope extended evaluations reuse seeds. The held-out and extended evaluations both use seeds 1000–1049. The unseen-seed re-test (seeds 5000–5049) covers this. On those seeds the world-model agent’s controller scored 78%, matching the evaluation.
  • Rope compute cost. The world-model agent’s controller needs about 2 s of compute per 0.02 s step. It is not real time.
  • Rope evaluation test is weak. Nearly all code-as-policy programs scored 0–2%, so agreement with the world model is cheap. Per-episode distance correlation is 0.27. The world model as a program-level evaluator on this task is untested in a meaningful range.
  • Rope: hiding earlier work. The cable task’s programs, logs, world model and all write-ups were moved out of the project and locked during the rope agents’ runs.

Code as Policies. Liang et al. (2022; ICRA 2023) introduced the term and showed that LLMs can write robot-control code from natural-language instructions, using code generation as the policy representation. ASPIRE (NVIDIA GEAR) extends this with an agentic loop: the LLM writes skills, tests them in a simulator, and iterates. Eureka (Ma et al., 2023) uses LLMs to write reward functions. The controller is learned by RL from those rewards. Our CaP agent is an ASPIRE-style re-implementation under a 5-trial cap.

Code as world model. Code World Models (Dainese et al., 2024) writes environment models as Python from descriptions and offline trajectories, searches over programs with a Monte Carlo tree search and plans with the resulting model, across 18 Gym environments. WorldCoder (Tang, Key and Ellis, 2024) builds a world model as Python while acting, explores optimistically, and plans with it in gridworlds and task-planning domains. CWM (Meta FAIR CodeGen Team, 2025) is a 32B language model trained on execution traces and agentic interactions to model how code executes. Code as Worlds (Wang et al., 2026) writes physical scenes as executable code and verifies them to supervise a vision-language model for quantitative physical reasoning. Code World Model: Coding Agent as World Brain (Chen, Lin and Zhang, 2026) writes code that keeps the world state and its rules and drives a video model to render frames. Saltline, a single-file browser FPS (~1.43 MB, generated in one pass by Claude Fable 5.2, Felix Rieseberg / Anthropic), was the spark for this note.

Verifiers in LLM reasoning. LLMs became useful for code and mathematics once their outputs could be verified automatically: unit tests for code, proof checkers for mathematics, and trained verifiers for math word problems (Cobbe et al., 2021; Lightman et al., 2023). Robot control code has no such verification. Real-world evaluation of manipulation policies is hard to scale and hard to reproduce (Li et al., 2024; Kress-Gazit et al., 2024). A handful of real trials is a weak verifier, and no ground-truth simulator is available at deployment. A code world model is an approximate verifier our agent writes for itself from its own trial recordings.

Agent harnesses and verification at test time. Weng (2026) describes the harness as the system around a base model (planning, tools, context, evaluation) and argues that evaluators and held-out tests should sit outside the loop that improves the agent. Self-Harness (Zhang et al., 2026) has an LLM agent mine its own traces for failure patterns, propose small edits to its harness, and accept an edit only if it passes regression tests. RoboHarness (Qu et al., 2026) gives an LLM agent a visual-geometric control panel for robot manipulation and compares it with vision-language-action models on BEHAVIOR Challenge 2025 tasks. Verifying candidates in the world model spends compute at test time in place of real trials. Offline, 3,000 simulated episodes in 19 s rank 15 pushing programs. Online, the rope controller re-plans in the world model every 8 steps at about 2 s of compute per 0.02 s step.

Policy evaluation in learned world models. WorldGym (Quevedo et al., 2025) is an action-conditioned video world model in which policies are scored by Monte Carlo rollouts with a vision-language model as the reward. Its success rates correlate with real-robot success and preserve policy rankings. Our world models are written as code by the agent from a few trials.

Real-to-sim-to-real. Torne et al. (2024) rebuild a real scene as a digital twin, improve the policy with reinforcement learning inside it, and transfer it back. In our case the simulation is a Python file the agent writes itself from a few trials, and the policy is improved by search or editing inside it.

Code world models with verification. Schwoebel (2026) uses independently authored and verified code worlds to generate exactly labelled trajectories for fine-tuning LLMs in symbolic domains. Aguilar Martín (2026) finds that an LLM-written code world model with perfect transition accuracy on sampled trajectories can still lose at play, because its rare errors fall on pivotal rules. Our world models likewise ranked programs better than they predicted absolute success.

Learned world models. Ha & Schmidhuber (2018) trained a neural world model (VAE + MDN-RNN) on 10,000 random rollouts from pixel observations in VizDoom. DreamerV3 (Hafner et al., 2023) trains a policy entirely inside a learned latent imagination. Our world models are LLM-written text files fitted to a handful of structured-observation episodes. Dreamer learns from pixels. The comparison is structural.

Summary

We asked whether a coding agent facing an unknown physical system could build its own tests from a few real trials. The agent built such tests on all eight tasks. They mattered most on mission C, the pushing tasks, Doom and the rope, where episodes varied at random, the physics contained changes the agent was not told about, and there was no live signal the controller could use to correct itself. Active observation let the agent choose what to look at before acting: on the drone it spent a whole trial hovering to map traffic, on Push-T two scripted pushes found a hidden centre of mass. The physics contained changes the manual did not mention: a weak rotor, cross-wind jets and a shifted centre of mass became explicit estimated parameters in the world model. For the rope, the model reproduced the motion well enough over a short horizon to test throws, without identifying the end weight. Random variation made a few real trials inadequate: on mission C, with stochastic other aircraft, our agent reached 98% held-out against 49% for the CaP agent with the same five trials. Test-time compute changed the outcome: the CaP agent went from 76% to 95% with no further real trials, and on the rope, testing candidate throws in the model every 0.16 s reached 78% where editing programs from real trials alone reached 0 to 2%. On drone missions A and B, both approaches reached about 100% after one or two trials and our tests added little. On the cable, a live reading settled the physics, and our tests added nothing to the success rate. They still caught bugs that five real trials had missed (150/150 episodes).

Our tests are an approximate verifier. They over-predicted absolute success on pushing, Doom and the rope (17–28 points optimistic on pushing, 100% predicted against 32% on the rope). They still ranked 34 programs with a mean error of 5.2 points (r = 0.974). Perhaps a world model does not need to be a neural network: a Python file of a few hundred lines, fitted from the agent’s own experiments, may suffice as the test layer between code generation and deployment. Files of this size came close to the oracle planner on the rope and the unseen pushing block, and when a new drone route was announced the agent reused its model and found a controller without further real trials. Whether this holds as tasks grow harder and observations become pixels is open.

Code as Policies writes controller candidates. The world-model tests verify them. On the cable our tests caught the bugs that five successful real trials had missed. On the rope our tests turned a 0.4-second forecast into a working controller by re-verifying each action from the live reading every 0.16 s.

About this note

This is an early exploration, shared so it can be discussed and corrected. If anything here is confused or wrong, we would like to hear about it. We welcome questions, objections and corrections so we can improve it together.


Appendix: The full results

A. Hidden anomalies

TaskHidden changeNominal rig
Drone (all missions)Motor 2 at 60% thrust; two cross-wind jets (~14.8 and ~11 m/s²)All motors healthy; no wind
Drone mission C7–8 stochastic other aircraft per episodeNo other aircraft
Push-TCentre of mass at (24, 30); block glides after releaseNominal COM (0, 45); no glide
Push-LCOM at (23, 55.5); contact friction (pair coeff. 0.36); glideNominal COM ~(45, 37.5); no pusher–block friction; no glide
CableBending stiffness 3× nominal; cable–post friction 1.0 (nominal 0.3); viscous drag 90 N·s/m per metre (nominal 0)Nominal stiffness; low friction; no table drag
RopeBending stiffness 2.0e−3 N·m²; table friction 0.10; post friction 0.25; 56 g rope + 30 g weight on free end; viscous dragNo datasheet; the manual gives no physical values
DoomNone (stock scenario)Manual describes sensors and controls only, not game mechanics

B. Real trials consumed

AgentTaskReal trials (cap)Real trials usedReal steps
Code-as-world-modelDoom546,216
Code-as-policyDoom551,182
Code-as-world-modelDrone A/B551,654
Code-as-policyDrone A/B551,354
Code-as-world-modelDrone C551,810
Code-as-policyDrone C551,556
Code-as-world-modelPush-T54811
Code-as-policyPush-T55971
Code-as-world-modelPush-L22600
Code-as-policyPush-L22600
Code-as-world-modelCable531,286
Code-as-policyCable551,127
Code-as-policy, no logsCable551,124
Code-as-world-modelRope54944
Code-as-policyRope551,180
Code-as-world-model (ext.)Rope20203,766
Code-as-policy (ext.)Rope20194,484

When the CaP agent’s held-out result was under 50%, additional real trials were granted: Push-T 13 in total, mission C 20, Push-L 8, rope 20 (world-model agent also extended to 20).

C. Models and infrastructure

Orchestrator: Claude Fable 5.2. Agents: Claude Opus 5.5. Environment construction: Claude Sonnet 5.5 (cable environment: Claude Opus 5.5). RL baselines: Claude Sonnet 5.5. Documents: Claude Opus 4.6. All agents interacted with the environment through an opaque API (no source code). No agent had access to the real simulator’s source code or to any other agent’s logs.

D. Experimental controls

What does “ASPIRE-style” mean?

Our CaP agent is modelled on “ASPIRE: Agentic /Skills Discovery for Robotics” (NVIDIA GEAR, arXiv 2607.00272). ASPIRE uses many more rollouts than we allowed. A five-trial cap is not how it is meant to be used.

  1. “Code as Policies: Language Model Programs for Embodied Control,” Liang et al., 2022 (ICRA 2023). The term “code-as-policy” refers to any method in which an LLM generates executable code as the controller representation. ↵
  2. Lu et al. (2026). “ASPIRE: Agentic /Skills Discovery for Robotics,” NVIDIA GEAR, arXiv 2607.00272. See also research.nvidia.com/labs/gear/aspire. Our CaP agent is a re-implementation under a 5-trial cap. ↵
  3. Ha, D. & Schmidhuber, J. (2018). “World Models.” arXiv:1803.10122. Their setup used pixel observations, a VAE, and an MDN-RNN trained on 10,000 random rollouts. ↵
  4. One-sided Clopper–Pearson bound: 0.051/5 ≈ 0.549 for 5/5. When each version is tried about once, 0.051/1 = 0.05 for 1/1. ↵
  5. Meta FAIR CodeGen Team (2025). “CWM: An Open-Weights LLM for Research on Code Generation with World Models.” arXiv:2510.02387.
  6. Wang et al. (2026). “Code as Worlds: Agentic Discovery of Executable World Representations for Physical Reasoning.” arXiv:2608.27549.
  7. Chen, Lin and Zhang (2026). “Code World Model: Coding Agent as World Brain.” arXiv:2608.25927.
  8. Weng, L. (2026). “Harness Engineering for Self-Improvement.” Lil’Log, 4 July 2026.
  9. Zhang et al. (2026). “Self-Harness: Harnesses That Improve Themselves.” arXiv:2606.09498.
  10. Qu et al. (2026). “RoboHarness: A Simple Harness Outperforms VLA and World Action Models.” arXiv:2610.14018.
  11. Quevedo, Sharma, Sun, Suryavanshi, Liang and Yang (2025). “WorldGym: World Model as An Environment for Policy Evaluation.” arXiv:2506.00613.
  12. Schwoebel (2026). “World-Time Compute with Verified Code World Models.” arXiv:2609.09163.
  13. Aguilar Martín (2026). “When a Verified World Model Still Loses: Play-Adequacy vs Prediction-Accuracy in LLM-Synthesized Code World Models.” arXiv:2607.14169.
  14. Anthropic (2026). “Claude Fable and Mythos 5.2.” anthropic.com, 9 November 2026.
  15. Chen et al. (2026). “Systematically Exploring the Capabilities of GPT-6 Astra as Embodied Policies.” arXiv:2609.38537.

Acknowledgements

This note draws on Code World Models (Dainese et al., 2024), WorldCoder (Tang, Key and Ellis, 2024), CWM (Meta FAIR CodeGen Team, 2025), Code as Worlds (Wang et al., 2026), and Code World Model (Chen, Lin and Zhang, 2026). The spark came from Saltline, a single-file browser FPS (~1.43 MB, generated in one pass by Claude Fable 5.2, Felix Rieseberg / Anthropic).

Citation

@misc{cawm2026,
  title       = {World Models as Unit Tests},
  author      = {Denzel Zheng},
  institution = {Princeton University},
  year        = {2026},
  note        = {Early research note. Simulators stand in for
                 reality; one run per agent per task; results
                 are not peer-reviewed.},
  howpublished = {\url{https://github.com/DongzheZheng/world-models-as-unit-tests}}
}