Beyond Semantic Organization: Memory as Execution State Management for Long-Horizon Agents

Yaoqi Chen, Haibin Lai, Yuru Feng, Chuyu Han, Qianxi Zhang, Baotong Lu, Menghao Li, Xinjiang Wang, Zhirui Wang, Shusen Xu, Zengzhong Li, Zewen Jin, Hao Wu, Cheng Li, Qi ChenarXiv 2026

TL;DR

Current LLM agents struggle with long-horizon tasks because their memory systems rely on semantic similarity, which often fragments the decision chain and mixes valid steps with errors. MAGE (Memory as Agent-Guided Exploration) reframes memory as a hierarchical execution-state tree, allowing agents to maintain a coherent "active path" of reasoning while isolating errors and reducing token costs by over 50%.

What Problem Does This Paper Address?

Building agents that can handle hundreds of interdependent steps—like planning a complex multi-person trip or navigating a web shop with strict compatibility rules—is a major challenge. Standard memory systems typically use Retrieval-Augmented Generation (RAG) to pull "relevant" facts from a history pool based on semantic similarity.

The authors argue this approach is fundamentally flawed for execution-heavy tasks. Semantic retrieval causes state fragmentation, where the agent loses the specific sequence of decisions that led to the current state. It also suffers from error contamination, where the agent accidentally retrieves traces from failed attempts and treats them as valid progress. As shown in Figure 2, these failures lead agents to make nonsensical choices because they literally cannot "remember" the coherent thread of their own actions.

Figure 2: Case study of baseline failures in MemoryArena shopping tasks (He et al., 2026). In this task, each purchase must satisfy constraints induced by previously bought products. Cases (a)–(c) show state fragmentation: HippoRAG (Gutiérrez et al., 2025) retrieves only Product 2 information, while MemoryOS (Kang et al., 2025) retrieves Product 4 exploration traces but not the final purchased item; both miss that Product 4 contains gold and choose an incompatible unicorn-themed option. In contrast, MAGE preserves the execution state and selects the compatible wedding option. Case (d) shows error contamination, where SimpleMem (Liu et al., 2026) retrieves mixed evidence from correct and incorrect trajectories and buys a berry-flavored item that violates the current vegetable-related avoidance rule.

Methods

The researchers introduce MAGE, which shifts memory from a passive archive to an active execution-state manager. Instead of a flat list of facts, MAGE organizes history into a two-layer hierarchical tree:

  • Bottom Layer: Stores raw, fine-grained action-observation traces.
  • Top Layer: Stores compressed summaries of completed subgoals.

The agent’s "working memory" is always derived from the active root-to-current path in this tree. This ensures that the context is always a logically consistent sequence of events. To manage this tree, MAGE uses four core operations:

  1. Grow: Appends new interactions to the bottom layer.
  2. Compress: Summarizes completed subgoals to keep the context window manageable.
  3. Maintain: Uses an LLM "judge" to validate summaries at subgoal boundaries, catching errors before they propagate.
  4. Revise: If an error is detected, MAGE backtracks to the last valid boundary and starts a new branch, effectively "quarantining" the failed attempt.
Overview of the MAGE hierarchical execution-state tree and its operations.

Datasets

MAGE was evaluated on MemoryArena, a benchmark specifically designed for interdependent long-horizon tasks. It covers four distinct domains:

  • Bundled Web Shopping: Buying a set of compatible products within a budget.
  • Group Travel Planning: Coordinating multi-day itineraries for multiple travelers.
  • Progressive Web Search: Answering complex queries through sequential sub-queries.
  • Formal Reasoning: Solving math and physics problems through step-by-step derivations.

Unlike static Q&A benchmarks, MemoryArena requires agents to operate in a continuous loop where every action changes the environment state.

Key Insights and Ideas

  • Memory is a State, Not a Library: The most important insight is that for agents, memory shouldn't be about "finding similar facts." It should be about "reconstructing the current state." By forcing the agent to follow a tree path, MAGE guarantees state integrity.
  • Branching for Error Recovery: Much like Git branches, MAGE allows agents to explore, fail, and then return to a "known good" state. This structural isolation prevents the agent from being confused by its own past mistakes.
  • Efficiency through Structure: Because MAGE manages the tree deterministically and only calls auxiliary LLMs at subgoal boundaries, it avoids the heavy token overhead of continuous RAG retrieval and embedding calls.

Key Results

MAGE achieves a rare "win-win" in AI research: significantly higher performance at a much lower cost.

  • Task Success: MAGE improved the average Task Success Rate (SR) by 7.8 to 20.4 percentage points over state-of-the-art baselines like HippoRAG and MemoryOS.
  • Token Efficiency: It reduced token consumption by 55.1% compared to the "Long Context" approach (which simply keeps everything in the window).
  • Context Management: As shown in Figure 4, while long-context approaches grow linearly and eventually crash, MAGE successfully bounds context growth through its compression mechanism without losing critical dependencies.
Figure 1: Paradigm comparison on long-horizon agent tasks (MemoryArena). Long-context approach achieves strong task performance but with high token cost, whereas baselines reduce context at the risk of losing state dependencies and underperforming. By managing memory as an execution-state tree, MAGE reaches the ideal upper-left region with the highest task performance and fewer tokens than long-context.

Limitations and Future Work

While MAGE is highly effective, the authors note a few areas for improvement:

  • LLM Judge Dependency: The Maintain operation relies on a backbone LLM to validate subgoals. If the judge is too lenient or too strict, it can affect the reliability of the tree.
  • Fixed Hierarchy: The current system uses a two-layer hierarchy. Future work could explore multi-layer trees for even more complex, multi-scale tasks.
  • Dynamic Compression: Currently, compression happens at fixed subgoal boundaries or length thresholds. More adaptive compression strategies could further optimize the balance between detail and context length.

Summary updated

BibTeX
@misc{chen2026beyond,
  author = {Yaoqi Chen and Haibin Lai and Yuru Feng and Chuyu Han and Qianxi Zhang and Baotong Lu and Menghao Li and Xinjiang Wang and Zhirui Wang and Shusen Xu and Zengzhong Li and Zewen Jin and Hao Wu and Cheng Li and Qi Chen},
  title = {{Beyond Semantic Organization: Memory as Execution State Management for Long-Horizon Agents}},
  year = {2026},
  eprint = {2606.06090},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.06090},
}
Figure