Manuscript Offprint

arXiv:2610.21283

Mallea: Building, Steering, and Memorizing Worlds with Coding Agent

Xuanyi Liu, Ruiqi Li, Siwei Ma

Abstract

Code world models represent world dynamics through explicit state and executable rules. We investigate how to coordinate object representations, behavioral revisions, and visual memory within this formulation. We present Mallea, a system for building, steering, and memorizing worlds from text. A coding agent infers object interaction requirements from the prompt and jointly plans object structure, properties, and rules, favoring compact representations that support those requirements. The world evolves under the planned rules; optional user actions steer it, while text requests can edit properties or extend capabilities with unaffected state preserved. Object texture memory retains reusable appearance only for whitebox-defined objects and adapts it as those objects change. The program advances world state, while a generative renderer combines current structure with remembered appearance. By organizing construction, intervention, and memory around the same objects, Mallea conditions subsequent observations on the latest state and compatible appearance. Project page: https://lxycopper.github.io/Mallea.

1. Introduction

Video world models learn visual dynamics from video and simulate scene evolution through generated observations [1, 2, 7, 8, 10, 22, 23, 25, 30, 31, 37]. Long-horizon studies report improvements from visual memory, alongside remaining failures of object persistence and physical consistency [7, 23, 30]. Code world models expose simulated state and executable transition rules, making modeled outcomes accessible to programmatic inspection and revision [4, 5, 24]. Recent systems connect executable worlds to generative renderers through geometric proxies or registered world surfaces [4, 6, 12]. This separates state persistence from rendering fidelity; benchmarks show that visual quality metrics alone do not reliably indicate agreement with prescribed states and events [13].

Figure

Figure 1. Three world-model designs. Top: video models generate future frames from visual context. Middle: recent code models use explicit state, rules, and visual memory to guide rendering. Bottom: a coding agent in Mallea chooses each object's representation (Build), edits its properties and rules (Steer), and manages its stored appearance (Memorize).

Building, steering, and memorizing a world from text raises three linked questions: how to represent objects, define and change their behavior, and remember their appearance over time. Mallea addresses these questions through a coding agent's ability to construct and revise an executable whitebox (Fig. 1). From the objects and interaction requirements inferred from text, the agent plans representations, manages attributes and rules, and specifies how appearance memory follows object changes. Shared object definitions connect these three designs, allowing the agent's knowledge of the world to guide both simulation and visual memory. Runtime code advances the world, with optional user actions and text requests for steering or revision (Fig. 2).

∗^{*}Equal contribution.

Our adaptive construction uses the agent’s ability to generate object-specific code to seek the simplest representation that preserves required interactions. Following the principle of retaining task-relevant properties in an abstraction [14], the agent plans geometry, attributes, and rules together, refining the representation only when an interaction requires additional detail (Fig. 3). Touch and collision may need only coarse contact geometry, whereas strikes and parries can require articulated motion and precise timing. Visual details that do not affect these interactions remain for the generative renderer [4, 12]. The optics and tactical examples (Fig. 6) illustrate this separation: mechanical geometry and coarse spatial proxies leave the renderer room to supply scene-specific appearance.

The agent gives these representations behavior through programmable attributes: fields record object properties, and executable rules determine how objects respond. Building on executable rule construction and revision [4, 12, 24], this mechanism offers two connected benefits. i) Defining behavior per object. The agent selects properties and rules for each object's interactions, making its responses explicit and individually adjustable, as illustrated by the hammer example (Fig. 4a). ii) Extending behavior at runtime. These explicit definitions let the agent interpret new requests against the current model, then plan, generate, and check missing fields and rules. For example, adding magnetic-response fields and attraction rules lets a world that already supports transporting iron and wood model their different responses to a magnet (Fig. 4b). Validated revisions preserve existing objects and unrelated state. The agent can therefore revise both current property values and the behavioral capabilities of an existing world. A rendered magnetic-interaction example is included in Fig. 6.

The agent’s control over object structure and behavior also gives it a basis for managing appearance over time. As interactions and edits accumulate over long rollouts, visual consistency involves retaining unchanged details while reflecting changes in the world. Prior work preserves initial-frame anchors, including through attention sinks, or compresses history into bounded context and recurrent states [9, 21, 32, 36]. Retrieval methods recover distant frames, latents, or KV entries beyond the active window [11, 23, 30, 34, 38, 39]. Other methods use 3D geometry to project past appearance into the current view [6, 12, 27], or select historical frames that match the objects’ current states [33]. Our object texture memory lets the coding agent manage appearance through the objects it already constructs and edits (Fig. 5). It stores textures only for these whitebox objects. The agent uses their attributes and rules to decide what to retain or update, and revises these decisions when new properties or behaviors are introduced. Revisit benchmark results will be released soon.

Our contributions are as follows:

• Adaptive object representations. The coding agent selects compact representations for individual objects to support the interactions inferred from text, leaving other visual details to the renderer.

• Programmable object behavior. The agent defines object-specific attributes and rules and extends them during execution in response to new requests.

• Object texture memory. The agent manages appearance reuse by object identity and current state, revising reuse conditions as object definitions change.

Quantitative benchmark results will be released soon.

References (39)