User as Code: Executable Memory for Personalized Agents
Not on the map. Why?
Abstract (arXiv)
A personalized AI agent needs a user memory: a persistent model of who the user is, built across many conversations and consulted on each new one. Today this memory is almost always stored as unstructured text, a knowledge graph, or a flat store of facts, and consulted by retrieval -- fetching the entries most similar to the current request. Such "bag-of-facts" memory recalls individual facts well, but because storing a fact and acting on it are separate steps, it struggles to resolve contradictions, aggregate over many records, or enforce rules. We argue that user memory should instead be executable. We introduce User as Code (UaC), a paradigm in which an agent's model of a user is a living software project: typed Python objects hold the user's state and ordinary Python functions encode the rules that govern it, so representing and reasoning about the user happen in one medium an interpreter can run. The enabling mechanism is a two-phase pipeline: an append-only log that never discards a fact, periodically checkpointed into typed code. This changes what memory can do. On standard long-term conversation benchmarks, UaC matches both a full-context upper bound and the strongest prior memory systems on recall (78.8% on LOCOMO). Its advantage emerges where representation matters most. On aggregate questions over a user's history -- "how many international trips did I take last year?" -- retrieval-based memory collapses (6-43%) while UaC stays near-perfect (99%), because the answer is a one-line computation over typed state rather than a search over text. And because its rules execute deterministically whenever the state changes, UaC can surface unsolicited, safety-critical alerts -- such as a newly prescribed drug that conflicts with an allergy recorded months earlier -- a capability query-driven memory cannot provide.
Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Builds on 44 of its 53 references that are in the map. First posted on arXiv 15 Jun 2026.
Builds on
44 of 53 references.
References · 44
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,568
- 2023Voyager: An Open-Ended Embodied Agent with Large Language Modelscited by 2,191
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,389
- 2022Code as Policies: Language Model Programs for Embodied Controlcited by 1,210
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,076
- 2025A-MEM: Agentic Memory for LLM Agentscited by 1,063
- 2025Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memorycited by 779
- 2024LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memorycited by 707
32 more
- 2024A Survey on the Memory Mechanism of Large Language Model based Agentscited by 634
- 2024Executable Code Actions Elicit Better LLM Agentscited by 564
- 2025Zep: A Temporal Knowledge Graph Architecture for Agent Memorycited by 400
- 2023Large Language Models as Tool Makerscited by 303
- 2025Evaluating Memory in LLM Agents via Incremental Multi-Turn Interactionscited by 254
- 2025Memory-R1: Enhancing Large Language Model Agents to Manage and Utilize Memories via Reinforcement Learningcited by 237
- 2025LightMem: Lightweight and Efficient Memory-Augmented Generationcited by 180
- 2022Language Models of Code are Few-Shot Commonsense Learnerscited by 160
- 2025From Human Memory to AI Memory: A Survey on Memory Mechanisms in the Era of LLMscited by 124
- 2023Chain of Code: Reasoning with a Language Model-Augmented Code Emulatorcited by 123
- 2024Personalization of Large Language Models: A Surveycited by 104
- 2024Proactive Agent: Shifting LLM Agents from Reactive Responses to Active Assistancecited by 87
- 2026MemoryArena: Benchmarking Agent Memory in Interdependent Multi-Session Agentic Taskscited by 84
- 2024TroVE: Inducing Verifiable and Efficient Toolboxes for Solving Programmatic Taskscited by 75
- 2025MemOS: An Operating System for Memory-Augmented Generation (MAG) in Large Language Modelscited by 73
- 2025A Survey of Personalized Large Language Models: Progress and Future Directionscited by 71
- 2026Memory for Autonomous LLM Agents:Mechanisms, Evaluation, and Emerging Frontierscited by 65
- 2025Mem-α: Learning Memory Construction via Reinforcement Learningcited by 55
- 2026EverMemOS: A Self-Organizing Memory Operating System for Structured Long-Horizon Reasoningcited by 54
- 2026MAGMA: A Multi-Graph based Agentic Memory Architecture for AI Agentscited by 52
- 2026Skill-Pro: Learning Reusable Skills from Experience via Non-Parametric PPO for LLM Agentscited by 47
- 2025Hindsight is 20/20: Building Agent Memory that Retains, Recalls, and Reflectscited by 44
- 2026Graph-based Agent Memory: Taxonomy, Techniques, and Applicationscited by 25
- 2026PersistBench: When Should Long-Term Memories Be Forgotten by LLMs?cited by 21
- 2026Locomo-Plus: Beyond-Factual Cognitive Memory Evaluation Framework for LLM Agentscited by 19
- 2026ProAgentBench: Evaluating LLM Agents for Proactive Assistance with Real-World Datacited by 16
- 2026MemMachine: A Ground-Truth-Preserving Memory System for Personalized AI Agentscited by 16
- 2025ENGRAM: Effective, Lightweight Memory Orchestration for Conversational Agentscited by 15
- 2026Beyond the Context Window: A Cost-Performance Analysis of Fact-Based Memory vs. Long-Context LLMs for Persistent Agentscited by 15
- 2026FadeMem: Biologically-Inspired Forgetting for Efficient Agent Memorycited by 14
- 2026Toward Personalized LLM-Powered Agents: Foundations, Evaluation, and Future Directionscited by 14
- 2025VERAFI: Verified Agentic Financial Intelligence through Neurosymbolic Policy Generationcited by 4
Built on by
Citing papers per year: 2026: 7.
7 papers.
- 2026PreAct: Computer-Using Agents that Get Faster on Repeated Taskscited by 5
- 2026Context as an Environment: Programmatic Context Management for Long-Horizon Agentscited by 4
- 2026User as Engram: Internalizing Per-User Memory as Local Parametric Editscited by 3
- 2026Delivery, Not Storage: Cue-Anchored Working Memory as a Harness Property for Coding Agentscited by 1
- 2026Executable Code Knowledge: Code as a Native, Validation-Carrying Knowledge Representation for AI Coding Agentscited by 1
- 2026Parametric Multimodal User Memory: Storing What Captions Cannot Carrycited by 0
- 2026How Strongly Should Task State Influence an LLM Agent?cited by 0
- 2026How Strongly Should Task State Influence an LLM Agent?22 Sep 2026
- 2026Context as an Environment: Programmatic Context Management for Long-Horizon Agents21 Aug 2026
- 2026Executable Code Knowledge: Code as a Native, Validation-Carrying Knowledge Representation for AI Coding Agents17 Aug 2026
- 2026Delivery, Not Storage: Cue-Anchored Working Memory as a Harness Property for Coding Agents23 Jul 2026
- 2026Parametric Multimodal User Memory: Storing What Captions Cannot Carry8 Jul 2026
- 2026User as Engram: Internalizing Per-User Memory as Local Parametric Edits17 Jun 2026
- 2026PreAct: Computer-Using Agents that Get Faster on Repeated Tasks16 Jun 2026