acceptodds
Under review as a conference paper at ICLR 2027

Memory as Program: Should Agents Run Their Experience Instead of Rereading It?

Abstract

Memory allows LLM agents to carry experience from past interactions into new situations, where earlier successes and failures can inform their decisions. Yet many systems supply retrieved memories as context, leaving their influence on action selection to the model's interpretation. Memory used this way remains advisory, suggesting what to do without explicitly determining action admissibility or candidate values. We introduce **Memory as Program (MemAP)**, a framework that expresses an agent's control policy through executable programs configured by accumulated experience. MemAP exposes memory traces through a programmable symbolic interface, allowing executable programs to compare their decision contexts and use the associated feedback. During execution, these programs retrieve transferable experience, compute return-grounded action values, and enforce admissibility constraints, using novelty to guide exploration when return support is insufficient. Interaction feedback updates MemAP's program state, revising where stored experience applies and how it influences subsequent decisions while leaving program definitions fixed. On WebArena, MemAP achieves 61.9% success with GPT-4o, outperforming the evaluated memory-based baselines in overall success, and reaches 68.7% with GPT-5. Ablations also show that executing the same experience outperforms contextual reuse and that program-state adaptation further improves success. MemAP also better preserves transferable-precedent retrieval as memory grows, achieving twice A-MEM's Hit@5 at the largest tested scale, and reuses fixed source-site memory on held-out real-world websites with higher success and shorter successful trajectories than A-MEM.

Then back it, or bet against it.

Related papers

Open the market on this paper to see 7 more related papers.