Memento 3 lets a frozen LLM agent learn an unfamiliar environment by maintaining a plain-English rulebook of how the world works, compiling it to executable Python, and accepting revisions only when the code replays past observations exactly cell-for-cell.
You drop an LLM agent into a game or environment it has never seen. It doesn’t know the objects, what the buttons do, or what counts as winning. The usual options are bad: either fine-tune the model (expensive, and you may not control weights), or let the agent re-reason from scratch every turn (slow, forgetful, and prone to repeating the same mistake).
A growing line of work builds code world models: have the LLM write a Python simulator of the environment from interaction traces, then plan inside that simulator. The problem the paper flags is that any finite trace is consistent with many different programs that disagree about situations you haven’t seen yet. If every wall you’ve observed sits at column 7, “a box stops at walls” and “a box stops at column 7” both fit, and picking the wrong one quietly breaks planning later. The closest prior system in the paper’s own comparisons is baseline1 from Rodionov, which also maintains and verifies a Python model on ARC-AGI-3.
The core move is to split the world model into two linked artifacts. A Markdown file (world_model.md) states, in natural language, what the agent currently believes about objects, action effects, dynamics, and goals. A Python file (world_model_engine.py) implements those beliefs as a transition function and goal check. The rulebook is where hypotheses live and get argued about; the code is where they get tested.
Each interaction step runs a five-stage loop: observation, reflection, rule revision, compilation, verification. When a prediction misses, the LLM decides whether the rulebook is wrong, the code is wrong, or neither. A proposed update is accepted only if (a) the LLM judges the code faithful to the rulebook, and (b) replaying every recorded action through the new code reproduces every recorded next observation exactly, down to each cell of the 64\u00d764 grid. Among admissible rulebook-code pairs, the LLM prefers the shortest combined description, a practical MDL bias.
Planning is then straightforward: reconstruct the current internal state by replaying history through the accepted code, and search for a shortest action sequence to a predicted goal. Everything persists in a Git repo, so the agent can diff old rulebook versions and roll back a bad edit. A population extension keeps N rulebook-code pairs in parallel, all checked against the shared history, sampling one per planning episode so a single early wrong guess doesn’t lock in the whole run. This echoes Posterior sampling from model-based RL.
while not done and budget_left:
obs = env.step(action); history.append((action, obs))
choice = llm_reflect(history, rulebook, code) # retain | revise_rules | repair_code
new_rules = llm_revise(rulebook, history) if choice == 'revise_rules' else rulebook
new_code = llm_compile(code, new_rules, history) if choice != 'retain' else code
if llm_faithful(new_code, new_rules) and replay_exact(new_code, history):
rulebook, code = new_rules, new_code
state = replay(code, history)
action = plan_shortest_path(code, state, goal) or explore(code, rulebook)
On ARC-AGI-3’s 25 public games, the single-model agent clears every level of every game. Using the benchmark’s Relative Human Action Efficiency score (where 100 is the ceiling, defined relative to a human action budget), it hits a mean of 100.0 and uses 44% of the human action count (7,518 vs 17,135 actions). The paper’s own comparison table lists prior ARC-AGI-3 entries at 99.0 (baseline1, also clears all 25), 85.1, 78.4, 38.1, and 20.5. Against Anthropic’s reported Claude Opus 5 run with the ARC Prize Standard harness, Memento 3’s mean Relative Human Action Efficiency is 59.3 points higher. The backbone used throughout is Claude Opus 5 inside Claude Code at extra-high reasoning effort.
A small ablation removes the natural-language rulebook, keeping only the code world model. On three games chosen one per difficulty band, the rulebook version uses 9% fewer environment actions and 18% fewer agent iterations to converge. All runs still cleared, so this measures convergence cost, not success. A population run with N=2 on the hardest-budget game (wa30) cuts scored actions from 899 to 597 versus the single-model trajectory.
As a separate case study, the authors apply the same loop to Atari Pong via Arcade Learning Environment, but swap discrete planning for a feedback controller that queries the learned code model each frame. After roughly 9,504 emulator frames of LLM-driven learning, the frozen controller wins 21-0 in three evaluation episodes with different openings, with no LLM calls at inference. The paper reports this is far less learning data than model-free RL baselines and much more than EfficientZero-style model-based RL baselines use. The direct LLM-with-no-world-model baseline finishes a Pong episode at -19.
•
If you’re building an agent for an environment where you can replay actions deterministically and observations are fully checkable (grids, game states, structured UIs), the rulebook plus code plus exact replay recipe is directly transferable. The key safety valve is exact replay as an acceptance gate: don’t let the LLM’s confidence in its own code be the deciding factor.
•
Keep the natural-language rulebook as a first-class artifact, not just as a comment. The ablation suggests the rulebook speeds convergence, and in practice it gives you something a human can read and veto. Version it in Git so the agent (and you) can inspect what hypothesis was active when.
•
If run-to-run variance is hurting you more than per-step cost, worth testing the N>1 population before adding more search. The paper only shows N=2 on one game, so treat the magnitude as suggestive, not settled.
•
The Pong result shows the same mechanism can drive a learned controller that runs without the LLM at inference. If you need cheap inference after an expensive learning phase, this pattern is worth prototyping.
•
Caveats on scope: evaluations use Claude Opus 5 at extra-high reasoning, which is expensive. The ARC-AGI-3 public set is reportedly near saturation for frontier models, so a ceiling score here does not establish a general capability advantage, only efficiency against the human action budget and against the listed baselines.
The setting assumes deterministic, fully replayable environments where observations can be compared exactly; stochastic or partially observable settings with noisy renders would break the pass-or-fail replay gate as stated. The main benchmark is close to saturated for strong backbones, so clearing all 25 games is less distinctive than the action-efficiency numbers. The rulebook ablation covers three games on one backbone, and the population experiment is a single N=2 run on one game, so both findings are directional. The Pong study evaluates three episodes with different openings, not a large statistical sample, and the controller is tuned until it reaches 21-0 before learning stops, which is a stopping rule the baselines do not share. Finally, “the LLM remains fixed” means no weight updates, but it does not mean cheap: every revision, compile, and fidelity check is an LLM call under high reasoning effort.