MESA:Task-Adaptive Multi-Structure Evidence Selection for Long-Horizon Agent Memory
摘要
This paper introduces MESA, a framework that dynamically selects and fuses a query-adaptive subset of multiple structural memory views for long-horizon agents, achieving 8.5% accuracy improvement over the strongest baseline while using 41% fewer evidence tokens.
查看缓存全文
缓存时间: 2026/08/12 08:20
# Task-Adaptive Multi-Structure Evidence Selection for Long-Horizon Agent Memory
Source: [https://arxiv.org/html/2608.10108](https://arxiv.org/html/2608.10108)
Beidi Zhao1111The work is completed during internship at Microsoft Research Asia\., Yaoqi Chen2,3, Yuru Feng2,4, Menghao Li2, Qianxi Zhang2, Baotong Lu2, Jianan Lu2, Zhirui Wang2, Xinjiang Wang2, Shusen Xu2, Zengzhong Li2, Xiaoxiao Li1\\corresponding, Qi Chen2\\corresponding
###### Abstract
Long\-horizon agents accumulate trajectories spanning hundreds of interleaved reasoning, action, and observation steps, where answering a query may depend on evidence buried far back in the history\. External memory stores such trajectories as structured representations, yet each structure provides a distinct and incomplete view\. Existing multi\-memory systems either read a fixed set of structures for every query, inflating context and introducing noise, or route each query to a single structure, preventing the composition of complementary evidence\. A controlled analysis on AMA\-Bench shows that the optimal memory configuration is typically neither a single structure nor the full union, but a tailored composition of multiple structural memories that varies with query and task demands\. Motivated by these findings, we formulate*structure\-level dynamic selection*: selecting and fusing a query\-adaptive subset from a library of specialized memory structures\. We proposeMESA\(aMulti\-structureEvidenceSelection framework for long\-horizonAgent\), which builds five complementary structure views of each trajectory and learns from end\-to\-end answer\-level feedback to select and fuse a query\-specific subset for a frozen answer model\. To learn under this weak supervision,MESAemploys harness optimization with prior\-guided search and UCB\-guided scheduling to balance exploration and exploitation\. On AMA\-Bench,MESAoutperforms the strongest baseline by 8\.5% while using 41% fewer evidence tokens than the all\-structure alternative\.
## 1Introduction
Long\-horizon agents accumulate trajectories that span hundreds of steps, where a later decision can depend on evidence produced much earlier\(Yaoet al\.[2023](https://arxiv.org/html/2608.10108#bib.bib28); Wanget al\.[2023](https://arxiv.org/html/2608.10108#bib.bib12); Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)\. Unlike documents or dialogues, these trajectories interleave reasoning, actions, observations, and tool outputs, and they carry temporal and causal dependencies\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)\. Feeding the full trajectory to a long\-context LLM is expensive and still does not reliably surface buried evidence, even with million\-token windows\(Teamet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib33); Liuet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib27)\)\. Truncation and compression cut costs but can drop details that matter later\(Jianget al\.[2023](https://arxiv.org/html/2608.10108#bib.bib48)\)\. External memory addresses this problem by transforming the history into persistent representations and retrieving a compact body of evidence for each query\(Packeret al\.[2023](https://arxiv.org/html/2608.10108#bib.bib9); Parket al\.[2023](https://arxiv.org/html/2608.10108#bib.bib10); Zhonget al\.[2024](https://arxiv.org/html/2608.10108#bib.bib13)\)\. Accordingly, the central question is how execution histories should be organized and dynamically consulted\.
Figure 1:Overview and motivation ofMESA\. \(a\) An SWE long\-horizon agent execution example\. Each single memory structure provides a distinct view of evidence\.MESAdynamically selects and fuses a subset of complementary structural memories to arrive at the correct answer\. \(b\) Driven by adaptive memory\-structure selection,MESAoutperforms all single\-structure baselines\. \(c\)MESAachieves higher accuracy while consuming 41% fewer tokens compared to the all\-structure alternative\.Existing agent\-memory systems rely on distinct structural abstractions to manage execution histories, yet each abstraction exhibits inherent limitations when handling the heterogeneity of long\-horizon agent applications\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)\. As illustrated in Fig\.[1](https://arxiv.org/html/2608.10108#S1.F1)\(a\), text summaries\(Zhonget al\.[2024](https://arxiv.org/html/2608.10108#bib.bib13)\)capture high\-level context but lack deterministic execution details; temporal stores\(Senet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib31)\)preserve chronological order but may struggle when queries lack explicit temporal anchors in the query; vector databases\(Lewiset al\.[2020](https://arxiv.org/html/2608.10108#bib.bib29); Karpukhinet al\.[2020](https://arxiv.org/html/2608.10108#bib.bib30)\)surface semantically near fragments that can be task\-irrelevant while discarding temporal\-causal order; knowledge graphs\(Yanget al\.[2026](https://arxiv.org/html/2608.10108#bib.bib3); Gutiérrezet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib15)\)facilitate entity traversal but lack step\-level indexing; and raw episodic traces\(Zhenget al\.[2024](https://arxiv.org/html/2608.10108#bib.bib32)\)retain exact action steps but bury critical clues under heavy noise\.
To bridge individual limitations, recent hybrid memory systems combine these structures, but their access strategies remain mismatched with query\-specific demands\. At one extreme,eager all\-in fusionmethods uniformly query a static, exhaustive set of memory views for every query\(Latimeret al\.[2025](https://arxiv.org/html/2608.10108#bib.bib7); Suet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib6)\)\. While maximizing recall, this indiscriminately bloats context windows and introduces distracting noise from unneeded structural memories\(Haet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib46); Narayanaet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib49)\)\. At the other extreme,single\-structure routingmethods select a single best\-suited structure per query\(Luet al\.[2026a](https://arxiv.org/html/2608.10108#bib.bib21); Baiet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib20)\)\. However, this strictly limits expressiveness when a query demands composing complementary evidence across representations \(e\.g\., grounding a high\-level summary within exact episodic steps, as in Fig\.[1](https://arxiv.org/html/2608.10108#S1.F1)\(a\)\)\. Consequently, no existing approach dynamically selects and composes a query\-adaptive subset from a library of specialized memory structures\.
To formalize this problem, we define a*memory structure*as a unified pair comprising a structural representation and its dedicated access interface\. Guided by agent memory taxonomies\(Wuet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib53); Luoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib52)\), we instantiate five representative structures: text summaries, temporal stores, knowledge graphs, vector databases, and raw episodic traces\. To quantify the intrinsic value of structure composition, we conduct a controlled study sweeping \(details in Sec\.[3](https://arxiv.org/html/2608.10108#S3)\) over all non\-empty structure subsets across diverse long\-horizon tasks\. This controlled analysis reveals two key findings: \(1\)*Intermediate subsets are usually preferable:*across most evaluated categories, the best\-performing composition is neither a single structure nor the full union, but a subset of complementary structures; and \(2\)*No fixed composition is universally optimal over tasks:*the winning subset varies across domains and memory capabilities, rather than following a single global preference\. These findings motivate a new problem formulation:*structure\-level dynamic selection*, learning an executable policy to dynamically select and fuse query\-dependent structural memories\.
However, realizing an effective structure\-level selection policy entails two fundamental challenges\. First, selecting dynamic memory subsets is inherently acombinatorial utility and redundancy dilemma\. Complementary views can improve evidence coverage, whereas redundant or mismatched views introduce distracting context and additional cost\. The selector must therefore balance evidence recall, utility and context budget\. Second, policy learning facescredit assignment under weak supervision\. Ground\-truth subsets and per\-structure utility labels are unavailable\. The policy must instead be learned from sparse, end\-to\-end answer feedback, making individual selection decisions difficult to evaluate\.
To tackle these challenges, we proposeMESA\(Multi\-structureEvidenceSelection for long\-horizonAgent\)\.MESAmaintains the five independent memory structures: text summary, temporal store, knowledge graph, vector database, and raw episodic trace\. Each with its own builder and retrieval interface\. For each query, its selector dynamically choose query\-dependent memory structures\. Evidence from the selected structures are composed for a frozen answer\-generating LLM\. To optimize the selection policy under the weak supervision,MESArestricts candidate selection to prior directions and balances the exploration\-exploitation\.
We summarize our contributions: \(1\)Problem formulation and empirical analysis\.We formulate structure\-level dynamic selection for agent memory and show through an exhaustive subset sweep that intermediate subsets typically outperform the single\-structure and all\-structure alternatives, while the best composition varies across task categories\. \(2\)TheMESAframework\.We introduce a multi\-structure memory framework that learns query\-adaptive structure selection policy from sparse answer\-level feedback through prior\-guided harness optimization\. \(3\)Empirical results\.MESAoutperforms the strongest baseline by 8\.5% on AMA\-Bench\. Results on LoCoMo extend the framework to conversational memory\. Extensive ablations further validate the effectiveness of the learned task\-adaptive selection\.
Figure 2:The best memory\-structure combination is task\-dependent\. We sweep non\-empty subsets of the five structures \(Summary\-S, Temporal\-T, Graph\-G, Vector\-V, Raw\-R\) on AMA\-Bench and report judge accuracy \(%\), split \(a\) by domain and \(b\) by capability\. Colored lines trace only the per\-axis winners, each marked with a star\. The winning subset changes on different tasks\. Grey dots show all other combinations’ result\.
## 2Related Work
### 2\.1Memory for LLM Agents
Equipping LLM agents with memory beyond a fixed context window has been approached from several angles\. MemGPT\(Packeret al\.[2023](https://arxiv.org/html/2608.10108#bib.bib9)\)manages the working context itself, paging information in and out like an operating system\. A reflection\-based line distills raw interaction into reusable knowledge: Generative Agents’ retrieve–reflect memory\(Parket al\.[2023](https://arxiv.org/html/2608.10108#bib.bib10)\)and Reflexion’s verbal self\-feedback across trials\(Shinnet al\.[2023](https://arxiv.org/html/2608.10108#bib.bib11)\), while embodied agents such as Voyager accumulate a growing library of skills mined from long trajectories\(Wanget al\.[2023](https://arxiv.org/html/2608.10108#bib.bib12)\), underpinning agents that reuse distilled experience to act in multi\-step environments\(Yanget al\.[2023](https://arxiv.org/html/2608.10108#bib.bib18)\)\. A parallel line builds long\-term memory for cross\-session dialogue and multi\-hop QA, and several of these systems already maintain more than one index over the same history, pairing a graph store with dense or timestamped retrieval\(Zhonget al\.[2024](https://arxiv.org/html/2608.10108#bib.bib13); Chhikaraet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib14); Gutiérrezet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib15); Maharanaet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib1); Wuet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib17)\)\. Even where multiple indices coexist, however, each system reads them through a fixed interface; how an agent should select among heterogeneous evidence forms per query, as long\-horizon multi\-task settings demand, is left unaddressed\.
### 2\.2Multi\-Structure Memory for LLM Agents
A growing body of work organizes agent memory into explicit structures, but differs from ours along three axes: how memory is organized \(by semantic role or a single unified schema versus by access pattern\), how it is read \(a fixed policy or a single structure versus a query\-specific complementary subset\), and what the read returns \(broad or single\-source evidence versus a fused subset of heterogeneous structures\)\. One line reads its structures through a fixed policy: Hindsight\(Latimeret al\.[2025](https://arxiv.org/html/2608.10108#bib.bib7)\)partitions memory into four networks \(world facts, experiences, opinions, and observations\) but answers every query with the same four\-way parallel retrieval fused by reciprocal rank fusion, and SEEM\(Luet al\.[2026b](https://arxiv.org/html/2608.10108#bib.bib19)\)combines a graph layer and an episodic layer through a deterministic pipeline; the read never adapts to what a query needs\. A second line makes selection adaptive but returns a single winner: StructRAG\(Liet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib5)\)reconstructs documents into the single best\-fit format per query, Learning\-to\-Route dispatches each query to one external source\(Baiet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib20)\), and FluxMem\(Luet al\.[2026a](https://arxiv.org/html/2608.10108#bib.bib21)\)learns a context\-aware selector that assigns each memory unit one structure among linear, graph, and hierarchical forms, supervised offline on conversational data\. A third line, closest to ours, also selects compact evidence: S3Mem\(Suet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib6)\)writes heterogeneous histories into a single unified scene–event schema and routes a small evidence pack to the reader, but its selection operates within one representation rather than across structures with distinct access patterns\.MESAdiffers on all three axes: it keeps heterogeneous structures distinguished, reads a query\-specific complementary subset rather than one structure or the full union, and refines the selection policy through answer\-level optimization\.
## 3Analysis of Memory Structure Selection
### 3\.1Memory Structure and Action Space
A long interaction history admits several forms of storage and access\. We use*memory structure*to denote a memory representation together with its access mechanism, which jointly determine what information is retained and what evidence can be retrieved\. Given a historyτi\\tau\_\{i\}, we constructKKmemory structures:
ℳi=\{Mi\(k\)=Bk\(τi\)\}k=1K,\\mathcal\{M\}\_\{i\}=\\big\\\{M\_\{i\}^\{\(k\)\}=B\_\{k\}\(\\tau\_\{i\}\)\\big\\\}\_\{k=1\}^\{K\},\(1\)whereBkB\_\{k\}is the builder for structurekk, andΓk\\Gamma\_\{k\}is its fixed access mechanism\. We instantiateK=5K=5representative structures widely used in agent\-memory systems\(Wuet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib53); Luoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib52)\): a compressed summary, a temporal key–value store, a relational graph, a dense vector index, and sparse retrieval over raw episodic traces\. For a fair evaluation, we follow representative prior works\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34); Gutiérrezet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib15)\)for the memory schema and construction of \(see Appendix\)\.
Reading memory requires choosing which structures to access\. We represent a selection as a non\-empty binary vectorz∈\{0,1\}Kz\\in\\\{0,1\\\}^\{K\}, wherez\(k\)=1z^\{\(k\)\}=1indicates that structurekkis selected\. The action space is
𝒵=\{z∈\{0,1\}K∣∥z∥0≥1\},\\mathcal\{Z\}=\\left\\\{z\\in\\\{0,1\\\}^\{K\}\\mid\\lVert z\\rVert\_\{0\}\\geq 1\\right\\\},\(2\)which contains25−1=312^\{5\}\-1=31non\-empty compositions forK=5K=5\. We next evaluate these compositions to determine whether a single fixed subset is sufficient across tasks\.
### 3\.2Controlled Composition Analysis
We evaluate all non\-empty subsets of the five memory structures on AMA\-Bench\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)\. This controlled sweep reveals two observations\.
Intermediate subsets are usually preferable\.Across the domains and QA capabilities in Fig\.[2](https://arxiv.org/html/2608.10108#S1.F2), most categories are best served by subsets containing multiple structures, indicating that they benefit from complementary evidence\. However, adding every available structure is generally unnecessary and can introduce redundant or distracting context\. The appropriate selection granularity therefore lies between route\-to\-one and read\-all\.
No fixed composition is universally optimal over tasks:Fig\.[2](https://arxiv.org/html/2608.10108#S1.F2)also shows that a composition performing well for one domain or QA type may be suboptimal for another\. No single fixed subset consistently provides the most useful evidence across tasks\. The selected subset should therefore adapt to the current query rather than remain fixed\.
Together, these findings motivate a selectorSρ\(qi,ci\)S\_\{\\rho\}\(q\_\{i\},c\_\{i\}\)that predicts a non\-empty subsetzi∈𝒵z\_\{i\}\\in\\mathcal\{Z\}from the query and its observable context\. The selector should exploit complementary structures when needed while avoiding the redundant evidence cost of the full composition\. The next section formalizes this selector and describes howMESAlearns it from answer\-level training feedback\.
Figure 3:Overview ofMESA\. \(a\) A long interaction trajectory is converted offline into five complementary memory structures\. At inference, the learned selectorρ∗\\rho^\{\*\}chooses a query\-dependent subset, retrieves and merges its evidence, and passes it to a frozen answer model\. \(b\) Prior\-guided harness optimization evolves only the selector under prior directions and using UCB to balance exploration and exploitation\. Localized proposals are evaluated using a performance–cost objective, and reflections update the policy archive\. The final policy is selected on validation data\.
## 4Task\-Adaptive Memory Structure Selection
As illustrated in Fig\.[3](https://arxiv.org/html/2608.10108#S3.F3),MESAlearns an executable policy that selects a query\-specific subset of five complementary memory structures, while keeping all other components fixed\. We first formulate the selection problem and then describe the prior\-guided policy optimization and evaluation protocol\.
### 4\.1Problem Formulation
Given the memory structuresℳi=\{Mi\(k\)\}k=1K\\mathcal\{M\}\_\{i\}=\\\{M\_\{i\}^\{\(k\)\}\\\}\_\{k=1\}^\{K\}constructed from historyτi\\tau\_\{i\}, the structure selector takes a queryqiq\_\{i\}and a compact descriptioncic\_\{i\}of its interaction context and outputs a non\-empty selection:
zi=Sρ\(qi,ci\),zi∈𝒵,z\_\{i\}=S\_\{\\rho\}\(q\_\{i\},c\_\{i\}\),\\qquad z\_\{i\}\\in\\mathcal\{Z\},\(3\)whereρ\\rhois an executable selection policy and𝒵\\mathcal\{Z\}is the action space\. The contextcic\_\{i\}may contain task, domain, and QA\-type information, but excludes the gold answer, evaluation score, and other outcome\-revealing variables\.
MESAinvokes the access mechanisms selected byziz\_\{i\}and composes their retrieved evidence:
Ei\(zi\)=Compose\(\{Γk\(qi,Mi\(k\)\)∣zi\(k\)=1\}\)\.E\_\{i\}\(z\_\{i\}\)=\\mathrm\{Compose\}\\left\(\\left\\\{\\Gamma\_\{k\}\(q\_\{i\},M\_\{i\}^\{\(k\)\}\)\\mid z\_\{i\}^\{\(k\)\}=1\\right\\\}\\right\)\.\(4\)A frozen answer modelFFthen performs inference over the selected evidence:
y^i\(zi\)=F\(qi,Ei\(zi\)\),\\hat\{y\}\_\{i\}\(z\_\{i\}\)=F\\left\(q\_\{i\},E\_\{i\}\(z\_\{i\}\)\\right\),\(5\)and the resulting utility is
ri\(zi\)=Eval\(y^i\(zi\),yi\)\.r\_\{i\}\(z\_\{i\}\)=\\mathrm\{Eval\}\\left\(\\hat\{y\}\_\{i\}\(z\_\{i\}\),y\_\{i\}\\right\)\.\(6\)
We split the dataset into training, validation and test sets𝒟tr\\mathcal\{D\}\_\{\\mathrm\{tr\}\},𝒟val\\mathcal\{D\}\_\{\\mathrm\{val\}\}and𝒟test\\mathcal\{D\}\_\{\\mathrm\{test\}\}\. For a split𝒟\\mathcal\{D\}, the evaluation score of policyρ\\rhois
J𝒟\(ρ\)=1\|𝒟\|∑i∈𝒟ri\(Sρ\(qi,ci\)\)\.J\_\{\\mathcal\{D\}\}\(\\rho\)=\\frac\{1\}\{\|\\mathcal\{D\}\|\}\\sum\_\{i\\in\\mathcal\{D\}\}r\_\{i\}\\left\(S\_\{\\rho\}\(q\_\{i\},c\_\{i\}\)\\right\)\.\(7\)LetC𝒟\(ρ\)C\_\{\\mathcal\{D\}\}\(\\rho\)denote the mean number of evidence tokens retrieved from the selected structures\. Candidate policies are compared using the regularized validation objective
J~val\(ρ\)=Jval\(ρ\)−λCval\(ρ\),\\widetilde\{J\}\_\{\\mathrm\{val\}\}\(\\rho\)=J\_\{\\mathrm\{val\}\}\(\\rho\)\-\\lambda C\_\{\\mathrm\{val\}\}\(\\rho\),\(8\)whereλ\\lambdacontrols the trade\-off between answer accuracy and evidence cost\.
### 4\.2Prior\-Guided Harness Optimization
Feedback\-driven optimizers can search over textual prompts\(Agrawalet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib39)\)or complete executable harnesses\(Leeet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib40)\), but such broad spaces are poorly directed under the coarse, answer\-level feedback available here\(Panet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib41); Liuet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib42); Wuet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib43)\)\. SinceMESAkeeps the builders, retrievers, composer, and answer model fixed, we restrict optimization to a small set of*prior directions*𝒜=\{a1,…,a\|𝒜\|\}\\mathcal\{A\}=\\\{a\_\{1\},\\dots,a\_\{\|\\mathcal\{A\}\|\}\\\}\. As shown in Algorithm[1](https://arxiv.org/html/2608.10108#alg1), the search archive is initialized with the all\-structure policyρall\\rho\_\{\\mathrm\{all\}\}\. An LLM proposer then generates executable selection policies under a prior direction of reflecting the selection mechanisms\. These mechanisms capture how a policy infers query demand, estimates structure utility, constructs a subset, and balances robustness against evidence cost\. Their complete descriptions of prior directions are provided in Appendix\.
MESAbalances exploration and exploitation using an Upper Confidence Bound \(UCB\)\-guided scheduling\(Aueret al\.[2002](https://arxiv.org/html/2608.10108#bib.bib44); Fialhoet al\.[2010](https://arxiv.org/html/2608.10108#bib.bib45)\)\. Each prior directiona∈𝒜a\\in\\mathcal\{A\}defines a way to generate or modify a selection policy and serves as one UCB arm\. Letnan\_\{a\}be the number of candidate policies evaluated under directionaa\. We compute
UCB\(a\)=J~¯val\(a\)\+βlog\(N\+2\)na\+1,\\mathrm\{UCB\}\(a\)=\\overline\{\\widetilde\{J\}\}\_\{\\mathrm\{val\}\}\(a\)\+\\beta\\sqrt\{\\frac\{\\log\(N\+2\)\}\{n\_\{a\}\+1\}\},\(9\)wherenan\_\{a\}is the number of evaluated candidates generated under directionaa,N=∑anaN=\\sum\_\{a\}n\_\{a\}, andJ~¯val\(a\)\\overline\{\\widetilde\{J\}\}\_\{\\mathrm\{val\}\}\(a\)is their mean validation objective\. The first term favors directions that have previously produced strong policies, whereas the second encourages directions that have been evaluated less frequently\.
At each iteration, the LLM proposer receives the policy archive, the UCB statistics of all directions, and the recurring errors of the current policy\. It then generates three executable candidates: an exploitation candidate based on a previously effective direction, an exploration candidate based on an under\-explored direction, and a failure\-repair candidate targeting a recurring error\. Thus, Eq\. \([9](https://arxiv.org/html/2608.10108#S4.E9)\) guides the choice of search directions, whereas the LLM translates each direction into a concrete policy modification\. Each candidate is evaluated on the validation set, and its result updates the corresponding direction’sJ~¯val\(a\)\\overline\{\\widetilde\{J\}\}\_\{\\mathrm\{val\}\}\(a\)andnan\_\{a\}\. Further details are provided in Appendix\. After the search budget is exhausted,MESAreturns the policy with the highest objective score on the validation set in the archive \(Algorithm 1, line 12\)\. After optimization, the selected policyρ∗\\rho^\{\*\}is frozen and tested on the held\-out test set\.
Algorithm 1Prior\-Guided Harness Optimization1:training set
𝒟tr\\mathcal\{D\}\_\{\\mathrm\{tr\}\}, validation set
𝒟val\\mathcal\{D\}\_\{\\mathrm\{val\}\}, proposer
Π\\Pi, prior directions
𝒜\\mathcal\{A\}, budget
TT
2:
𝒫←\{\(ρall,Evaluate\(ρall,𝒟val\)\)\}\\mathcal\{P\}\\leftarrow\\\{\(\\rho\_\{\\mathrm\{all\}\},\\textsc\{Evaluate\}\(\\rho\_\{\\mathrm\{all\}\},\\mathcal\{D\}\_\{\\mathrm\{val\}\}\)\)\\\}
3:for
t=1,…,Tt=1,\\ldots,Tdo
4:
𝒞t←ProposeUCB\(Π,𝒫,𝒜\)\\mathcal\{C\}\_\{t\}\\leftarrow\\textsc\{Propose\}\_\{\\mathrm\{UCB\}\}\(\\Pi,\\mathcal\{P\},\\mathcal\{A\}\)
5:for
ρ∈𝒞t\\rho\\in\\mathcal\{C\}\_\{t\}do
6:ifValid\(ρ\)\(\\rho\)then
7:
ρ←Fit\(ρ,𝒟tr\)\\rho\\leftarrow\\textsc\{Fit\}\(\\rho,\\mathcal\{D\}\_\{\\mathrm\{tr\}\}\)
8:
Eρ←Evaluate\(ρ,𝒟val\)E\_\{\\rho\}\\leftarrow\\textsc\{Evaluate\}\(\\rho,\\mathcal\{D\}\_\{\\mathrm\{val\}\}\)
9:
𝒫←𝒫∪\{\(ρ,Eρ\)\}\\mathcal\{P\}\\leftarrow\\mathcal\{P\}\\cup\\\{\(\\rho,E\_\{\\rho\}\)\\\}
10:endif
11:endfor
12:endfor
13:return
ρ∗=argmax\(ρ,Eρ\)∈𝒫J~val\(ρ\)\\displaystyle\\rho^\{\*\}=\\arg\\max\_\{\(\\rho,E\_\{\\rho\}\)\\in\\mathcal\{P\}\}\\widetilde\{J\}\_\{\\mathrm\{val\}\}\(\\rho\)
## 5Experiment
### 5\.1Experimental Setup
Datasets\.AMA\-Bench\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)contains long agent–environment trajectories in which later questions require evidence produced during earlier reasoning, actions, observations, or tool calls\. We use its real\-world subset, consisting of 208 episodes with 12 expert\-curated question–answer pairs per episode, for a total of 2,496 questions\. The episodes cover six agentic domains: web task execution, open\-world tool question answering, text\-to\-SQL, software engineering, gaming, and embodied AI\. The questions additionally span four memory capabilities: recall, causal inference, state updating, and state abstraction\. We further evaluate onLoCoMo\(Maharanaet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib1)\)to test whether the same framework extends beyond agent trajectories to long\-term conversational memory\. LoCoMo contains 10 multi\-session conversations and 1,986 question–answer pairs\. Following the standard protocol, we exclude 446 adversarial questions and evaluate the remaining 1,540 questions: 841 single\-hop, 282 multi\-hop, 321 temporal, and 96 open\-domain questions\. Baselines\.We compare against four families of baselines\.*Long\-context*directly provides the trajectory to the answer model\.*BM25*and*Qwen3\-Emb\-4B*represent sparse and dense item\-level retrieval, respectively\. We also include representative long\-term memory systems: MemGPT, HippoRAG2, Mem0, MemoRAG, A\-Mem, EMem, the multi\-structure memory method Hindsight and the benchmark\-specific state\-of\-the\-art baseline AMA\-Agent\. All methods within an AMA\-Bench backbone block use the same answer model and are evaluated with the same prompt\. For methods that were not originally designed for these datasets, we preserve their core memory and retrieval mechanisms while adapting the prompts to the task\-specific memory construction, input and output formats\. Detailed descriptions of the baselines are provided in the Appendix\. Metrics\.Following the standard evaluation protocols of each benchmark, we use LLM\-judged accuracy for AMA\-Bench and F1 score for LoCoMo\. The judge LLM backbone is the same as the answer model\. All predictions are evaluated using a fixed judging protocol shared across methods\. The evaluation prompt is provided in Appendix\. Implementation Details\.We split AMA\-Bench at the episode\-level into training, validation, and test splits with the ratio 2:2:6\. The split is drawn at random while ensuring full coverage of the entire dataset \(all six domains, twelve tasks, and four QA types\)\. BecauseMESArequires training to evolve its selector, we repeat this random partitioning five times and report the mean over the five splits, which reduces sensitivity to any single train/validation/test assignment\. For LoCoMo, we use a conversation\-disjoint 2:2:6 split\. All answer models use greedy decoding\. We use the same LLM backbone for each meta\-harness optimization; we run 30 iterations\. All experiments are run on NVIDIA A100 GPUs\. Memory schema formulations, prompts, and exact hyperparametersλ\\lambdaandβ\\betaare in Appendix\.
### 5\.2Main Results
Table 1:Main results on AMA\-Bench using Qwen3\-32B and Gemma\-4\-31B as answer\-model backbones\. Results are LLM\-as\-judge accuracies \(%\)\. Baseline results are reported as mean±stdover five splits\. Best results within each backbone are shown in bold, and second\-best results are underlined\.Table 2:Token\-F1 score \(%\) ofMESAon the long\-conversation dataset LoCoMo with Qwen3\-32B\.MESAimproves agentic long\-horizon memory\.Table[1](https://arxiv.org/html/2608.10108#S5.T1)presents the main AMA\-Bench results\. With Qwen3\-32B,MESAreaches 65\.1% overall accuracy, outperforming the strongest prior memory baseline, AMA\-Agent, by 8\.5 points and the long\-context reader by 12\.5 points\.MESAis best on three of the four memory capabilities\. On Causal Inference, it obtains 63\.6%, 1\.4% lower than AMA\-Agent\. The category\-level gains therefore do not arise from one dominant question type\. With Gemma\-4\-31B,MESAobtains an overall 6\.4% higher accuracy compared with the strongest baseline\. These results show that the benefits of structure\-level selection are consistent across answer\-model backbones\. Gains span diverse agentic domains\.The domain breakdown in Figure[4](https://arxiv.org/html/2608.10108#S5.F4)\(full table in Appendix\) shows thatMESAis the best method on four of the six domains with both model backbones\. It improves over the strongest baseline by 4\.1% on Web, 8\.9% on Text2SQL, 15\.5% on Software, and 8\.5% on Embodied AI\. On Open\-World QA and Gaming,MESAis second by only 0\.7% in each case\. The particularly large Software and Text2SQL gains are consistent with the need to combine global state with exact identifiers, code locations, and temporally localized events\. The framework extends to conversational memory\.Table[2](https://arxiv.org/html/2608.10108#S5.T2)applies the same framework and optimization procedure to LoCoMo\.MESAobtains an overall F1 of 49\.0%, improving over the strongest baseline that specialized for this dataset\(Wanget al\.[2026](https://arxiv.org/html/2608.10108#bib.bib35)\)by 1\.8%\.
### 5\.3Ablation Studies of Selection Strategy
Selection strategy\#Str\.Evidence tok\./qAccuracySummary1\.05\.7k57\.7±1\.357\.7\_\{\\pm 1\.3\}Temporal KV1\.02\.8k51\.4±0\.851\.4\_\{\\pm 0\.8\}Knowledge graph1\.00\.8k32\.7±1\.232\.7\_\{\\pm 1\.2\}Vector DB1\.03\.5k46\.6±0\.446\.6\_\{\\pm 0\.4\}Raw context1\.010\.5k48\.2±0\.548\.2\_\{\\pm 0\.5\}Random2\.511\.4k56\.7±1\.256\.7\_\{\\pm 1\.2\}LLM zero\-shot2\.211\.2k61\.4±0\.861\.4\_\{\\pm 0\.8\}All5\.018\.7k63\.7±1\.063\.7\_\{\\pm 1\.0\}Route\-to\-one1\.06\.8k57\.0±3\.257\.0\_\{\\pm 3\.2\}w/o priors2\.811\.5k63\.1±2\.363\.1\_\{\\pm 2\.3\}w/o UCB3\.012\.4k64\.3±2\.264\.3\_\{\\pm 2\.2\}MESA \(ours\)2\.811\.0k65\.1±0\.8\\mathbf\{65\.1\}\_\{\\pm 0\.8\}Table 3:Ablation of selection on AMA\-Bench with Qwen3\-32B\. \#Str\. denote the average number of structures, and Evidence tok\./q means evidence tokens per query\. The first block shows the performance of single structures, the second block shows the ablation of selection without learning, the third block shows the ablation of learning designs\.Figure 4:Domain\-wise accuracy \(%\) on AMA\-Bench with Qwen3\-32B and Gemma4\-31B\.Figure 5:Example ofMESA’s selection policy optimization on AMA\-Bench\. \(a\) Training\-objective values for evaluated proposals, accepted archive updates, and the best\-so\-far policy\. The accepted test accuracy is post\-hoc accuracy\. \(b\) Representative accepted proposals\.Performance of individual structures\.The first block of Table[3](https://arxiv.org/html/2608.10108#S5.T3)shows that no single memory structure is sufficient across AMA\-Bench\. Summary is the strongest individual structure, reaching 57\.7% accuracy with 5\.7k evidence tokens, while the other structures achieve 32\.7–51\.4%\. Although the summary backend is already strong,MESAtreats it as only one candidate and exceeds it by 7\.4% through selective combination with complementary structures\. Thus, the improvement cannot be attributed to the underlying summary structure alone\. Selection without learning\.The second block compares selection strategies that do not use the proposed optimization procedure\. Random subsets achieve 56\.7% accuracy with 11\.4k evidence tokens, whereas LLM zero\-shot selection reaches 61\.4% with a similar budget of 11\.2k tokens, demonstrating the benefit of query\-conditioned selection\. Reading all five structures further improves accuracy to 63\.7%, but requires 18\.7k evidence tokens per query\. Exhaustive access is therefore substantially more expensive and still does not provide the best performance\. Ablation of learning designs\.The third block isolates the components of the learned selection policy\. Restricting the policy to route each query to only one structure reduces accuracy to 57\.0%, confirming that adaptively combining multiple structures is essential\. Removing prior directions lowers accuracy from 65\.1% to 63\.1%, showing that structured guidance focuses proposals on plausible routing modifications and makes sparse answer\-level feedback more actionable\. Removing UCB lowers accuracy to 64\.3% and increases the standard deviation from 0\.8 to 2\.2, indicating that UCB helps balance exploration and exploitation across proposal directions and stabilizes the search\. With both components,MESAselects 2\.8 structures on average and reaches 65\.1% accuracy using 11\.0k evidence tokens\. It outperforms the all\-structure configuration by 1\.4% while using 41\.2% fewer tokens, and improves over the zero\-shot selector by 3\.7%\.
### 5\.4What does policy evolution learn?
Fig\.[5](https://arxiv.org/html/2608.10108#S5.F5)shows a representative optimization run222Post\-hoc test accuracy were generated after the complete optimization, which were never exposed during policy selection\.\. Accepted proposals progressively refine keyword\-based routing into query\-conditioned rules, while rejected or invalid candidates leave the archived policy unchanged\. The final policy achieves 65\.67% test accuracy, while remaining explicit and interpretable\.
## 6Conclusion
In this paper, we studied how a long\-horizon agent should read its accumulated memory when no single organization serves every query\. Framing this as structure\-level selection, we showed that the useful subset of memory structures is intermediate and query\-dependent, and introducedMESA, a five\-structure framework that learns a query\-adaptive selector from answer\-level feedback while leaving the builders, retrievers, and answer model fixed\. On AMA\-Bench,MESAsurpasses the strongest baseline by 8\.5% while reading over 40% fewer evidence tokens than the all\-structure union, and the framework also extends to conversational memory on LoCoMo\. Future work will jointly optimize memory construction and selection and model cross\-structure evidence dependencies\.
## References
- L\. A\. Agrawal, S\. Tan, D\. Soylu, N\. Ziems, R\. Khare, K\. Opsahl\-Ong, A\. Singhvi, H\. Shandilya, M\. J\. Ryan, M\. Jiang,et al\.\(2025\)Gepa: reflective prompt evolution can outperform reinforcement learning\.arXiv preprint arXiv:2507\.19457\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p1.2)\.
- Finite\-time analysis of the multiarmed bandit problem\.Machine learning47\(2\),pp\. 235–256\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p2.3)\.
- H\. Bai, H\. Wang, S\. Chen, Z\. Chen, L\. Tang, W\. Cheng, Y\. Fu, and H\. Chen \(2026\)Learning to route: a rule\-driven agent framework for hybrid\-source retrieval\-augmented generation\.InProceedings of the ACM Web Conference 2026,pp\. 4338–4349\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p3.1),[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1)\.
- P\. Chhikara, D\. Khant, S\. Aryan, T\. Singh, and D\. Yadav \(2025\)Mem0: building production\-ready ai agents with scalable long\-term memory\.arXiv preprint arXiv:2504\.19413\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p6.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.126.126.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.42.42.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.16.16.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.5.5.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.6.6.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.3.2.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.30.30.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.90.90.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.6.6.2)\.
- Á\. Fialho, L\. Da Costa, M\. Schoenauer, and M\. Sebag \(2010\)Analyzing bandit\-based adaptive operator selection mechanisms\.Annals of Mathematics and Artificial Intelligence60\(1\),pp\. 25–64\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p2.3)\.
- B\. J\. Gutiérrez, Y\. Shu, Y\. Gu, M\. Yasunaga, and Y\. Su \(2024\)Hipporag: neurobiologically inspired long\-term memory for large language models\.Advances in neural information processing systems37,pp\. 59532–59569\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p4.6),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.112.112.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.28.28.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.15.15.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.4.4.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.5.5.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.2.1.1),[§1](https://arxiv.org/html/2608.10108#S1.p2.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1),[§3\.1](https://arxiv.org/html/2608.10108#S3.SS1.p1.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.25.25.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.85.85.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.4.4.2)\.
- B\. J\. Gutiérrez, Y\. Shu, W\. Qi, S\. Zhou, and Y\. Su \(2025\)From rag to memory: non\-parametric continual learning for large language models\.arXiv preprint arXiv:2502\.14802\.Cited by:[§C\.2](https://arxiv.org/html/2608.10108#A3.SS2.p1.1)\.
- H\. Ha, J\. Kim, C\. Qian, J\. Liu, W\. M\. Campbell, Y\. Wu, Y\. Zhang, K\. McKeown, D\. Hakkani\-Tur, and H\. Ji \(2026\)MemGuard: preventing memory contamination in long\-term memory\-augmented large language models\.arXiv preprint arXiv:2605\.28009\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p3.1)\.
- H\. Jiang, Q\. Wu, C\. Lin, Y\. Yang, and L\. Qiu \(2023\)Llmlingua: compressing prompts for accelerated inference of large language models\.InProceedings of the 2023 conference on empirical methods in natural language processing,pp\. 13358–13376\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1)\.
- V\. Karpukhin, B\. Oguz, S\. Min, P\. Lewis, L\. Wu, S\. Edunov, D\. Chen, and W\. Yih \(2020\)Dense passage retrieval for open\-domain question answering\.InProceedings of the 2020 Conference on Empirical Methods in Natural Language Processing,Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p2.1)\.
- C\. Latimer, N\. Boschi, A\. Neeser, C\. Bartholomew, G\. Srivastava, X\. Wang, and N\. Ramakrishnan \(2025\)Hindsight is 20/20: building agent memory that retains, recalls, and reflects\.arXiv preprint arXiv:2512\.12818\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p9.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.133.133.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.49.49.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.18.18.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.7.7.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.8.8.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.5.4.1),[§1](https://arxiv.org/html/2608.10108#S1.p3.1),[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.100.100.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.40.40.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.9.9.2)\.
- Y\. Lee, R\. Nair, Q\. Zhang, K\. Lee, O\. Khattab, and C\. Finn \(2026\)Meta\-harness: end\-to\-end optimization of model harnesses\.arXiv preprint arXiv:2603\.28052\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p1.2)\.
- P\. Lewis, E\. Perez, A\. Piktus, F\. Petroni, V\. Karpukhin, N\. Goyal, H\. Kuttler, M\. Lewis, W\. Yih, T\. Rocktäschel, S\. Riedel, and D\. Kiela \(2020\)Retrieval\-augmented generation for knowledge\-intensive nlp tasks\.InAdvances in Neural Information Processing Systems,Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p2.1)\.
- Z\. Li, X\. Chen, H\. Yu, H\. Lin, Y\. Lu, Q\. Tang, F\. Huang, X\. Han, L\. Sun, and Y\. Li \(2025\)Structrag: boosting knowledge intensive reasoning of llms via inference\-time hybrid information structurization\.InInternational Conference on Learning Representations,Vol\.2025,pp\. 36107–36124\.Cited by:[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1)\.
- H\. Liu, C\. Shou, X\. Liu, H\. Wen, Y\. Chen, R\. J\. Fang, and Y\. Feng \(2026\)Synthesizing multi\-agent harnesses for vulnerability discovery\.arXiv preprint arXiv:2604\.20801\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p1.2)\.
- N\. F\. Liu, K\. Lin, J\. Hewitt, A\. Paranjape, M\. Bevilacqua, F\. Petroni, and P\. Liang \(2024\)Lost in the middle: how language models use long contexts\.Transactions of the Association for Computational Linguistics \(TACL\)\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1)\.
- M\. Lu, M\. Wu, F\. Liu, J\. Xu, W\. Li, H\. Wang, Z\. Hu, Y\. Ding, Y\. Sun, J\. Lu,et al\.\(2026a\)Choosing how to remember: adaptive memory structures for llm agents\.arXiv preprint arXiv:2602\.14038\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p3.1),[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1)\.
- Z\. Lu, D\. Li, Y\. Shi, B\. Wang, L\. Wang, and B\. Hu \(2026b\)Structured episodic event memory\.arXiv preprint arXiv:2601\.06411\.Cited by:[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1)\.
- J\. Luo, Y\. Tian, C\. Cao, Z\. Luo, H\. Lin, K\. Li, C\. Kong, R\. Yang, and J\. Ma \(2026\)From storage to experience: a survey on the evolution of llm agent memory mechanisms\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p4.1),[§3\.1](https://arxiv.org/html/2608.10108#S3.SS1.p1.6)\.
- A\. Maharana, D\. Lee, S\. Tulyakov, M\. Bansal, F\. Barbieri, and Y\. Fang \(2024\)Evaluating very long\-term conversational memory of llm agents\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 13851–13870\.Cited by:[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1),[§5\.1](https://arxiv.org/html/2608.10108#S5.SS1.p1.2)\.
- P\. Narayana, S\. Ayromlou, and P\. Sehgal \(2026\)Diagnosing and mitigating compounding failures in agentic persuasion via taxonomic strategy retrieval\.arXiv preprint arXiv:2606\.24976\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p3.1)\.
- C\. Packer, V\. Fang, S\. Patil, K\. Lin, S\. Wooders, and J\. Gonzalez \(2023\)MemGPT: towards llms as operating systems\.\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p5.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.119.119.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.35.35.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.14.14.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.3.3.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.4.4.2),[§1](https://arxiv.org/html/2608.10108#S1.p1.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.20.20.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.80.80.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.5.5.2)\.
- W\. Pan, S\. Liu, X\. Zhou, S\. Zhang, W\. Shi, M\. Xu, and X\. Jia \(2026\)M⋆M^\{\\star\}: every task deserves its own memory harness\.arXiv preprint arXiv:2604\.11811\.External Links:[Document](https://dx.doi.org/10.48550/arXiv.2604.11811)Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p1.2)\.
- J\. S\. Park, J\. O’Brien, C\. J\. Cai, M\. R\. Morris, P\. Liang, and M\. S\. Bernstein \(2023\)Generative agents: interactive simulacra of human behavior\.InProceedings of the 36th annual acm symposium on user interface software and technology,pp\. 1–22\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
- H\. Qian, Z\. Liu, P\. Zhang, K\. Mao, D\. Lian, Z\. Dou, and T\. Huang \(2025\)Memorag: boosting long context processing with global memory\-enhanced retrieval augmentation\.URL https://arxiv\. org/abs/2409\.05591\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p8.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.147.147.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.63.63.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.17.17.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.6.6.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.7.7.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.4.3.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.35.35.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.95.95.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.8.8.2)\.
- S\. Sen, E\. Lumer, A\. Gulati, and V\. K\. Subbiah \(2026\)Chronos: temporal\-aware conversational agents with structured event retrieval for long\-term memory\.arXiv preprint arXiv:2603\.16862\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p2.1)\.
- N\. Shinn, F\. Cassano, A\. Gopinath, K\. Narasimhan, and S\. Yao \(2023\)Reflexion: language agents with verbal reinforcement learning\.Advances in neural information processing systems36,pp\. 8634–8652\.Cited by:[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
- E\. Su, J\. Zhang, J\. Wu, Q\. Yu, C\. Tang, P\. Li, L\. Wang, Y\. Wang, X\. Ma, S\. Tang,et al\.\(2026\)S3Mem: structured spatiotemporal scene\-event memory for long\-horizon interactive question answering\.arXiv preprint arXiv:2605\.28831\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p3.1),[§2\.2](https://arxiv.org/html/2608.10108#S2.SS2.p1.1)\.
- G\. Team, P\. Georgiev, V\. I\. Lei, R\. Burnell, L\. Bai, A\. Gulati, G\. Tanzer, D\. Vincent, Z\. Pan, S\. Wang,et al\.\(2024\)Gemini 1\.5: unlocking multimodal understanding across millions of tokens of context\.arXiv preprint arXiv:2403\.05530\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1)\.
- G\. Team, S\. E\. Abd, V\. Aggarwal, R\. Algayres, A\. Andreev, O\. Bachem, I\. Ballantyne, C\. Brick, V\. Cărbune, M\. Casbon,et al\.\(2026\)Gemma 4 technical report\.arXiv preprint arXiv:2607\.02770\.Cited by:[Table 5](https://arxiv.org/html/2608.10108#A5.T5.22.25.3.1.1.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.120.123.3.1.1)\.
- G\. Wang, Y\. Xie, Y\. Jiang, A\. Mandlekar, C\. Xiao, Y\. Zhu, L\. Fan, and A\. Anandkumar \(2023\)Voyager: an open\-ended embodied agent with large language models\.arXiv preprint arXiv:2305\.16291\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
- K\. Wang, Y\. Lin, J\. Lou, Z\. Zhou, B\. Suvonov, and J\. Li \(2026\)E\-mem: multi\-agent based episodic context reconstruction for llm agent memory\.arXiv e\-prints,pp\. arXiv–2601\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p10.5),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.154.154.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.70.70.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.20.20.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.9.9.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.10.10.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.7.6.1),[§5\.2](https://arxiv.org/html/2608.10108#S5.SS2.p1.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.110.110.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.50.50.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.10.10.2)\.
- D\. Wu, H\. Wang, W\. Yu, Y\. Zhang, K\. Chang, and D\. Yu \(2024\)Longmemeval: benchmarking chat assistants on long\-term interactive memory\.arXiv preprint arXiv:2410\.10813\.Cited by:[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
- X\. Wu, C\. Yang, H\. Liu, X\. Lin, W\. Zhang, Z\. Shi, X\. Jiang, C\. Xu, J\. Li, and J\. Guo \(2026\)Bayesian\-agent: posterior\-guided skill evolution for llm agent harnesses\.arXiv preprint arXiv:2606\.08348\.Cited by:[§4\.2](https://arxiv.org/html/2608.10108#S4.SS2.p1.2)\.
- Y\. Wu, S\. Liang, C\. Zhang, Y\. Wang, Y\. Zhang, H\. Guo, R\. Tang, and Y\. Liu \(2025\)From human memory to ai memory: a survey on memory mechanisms in the era of llms\.arXiv preprint arXiv:2504\.15965\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p4.1),[§3\.1](https://arxiv.org/html/2608.10108#S3.SS1.p1.6)\.
- W\. Xu, Z\. Liang, K\. Mei, H\. Gao, J\. Tan, and Y\. Zhang \(2026\)A\-mem: agentic memory for llm agents\.Advances in Neural Information Processing Systems38,pp\. 17577–17604\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p7.3),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.140.140.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.56.56.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.19.19.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.8.8.2),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.9.9.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.6.5.1),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.105.105.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.45.45.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.7.7.2)\.
- A\. Yang, A\. Li, B\. Yang, B\. Zhang, B\. Hui, B\. Zheng, B\. Yu, C\. Gao, C\. Huang, C\. Lv,et al\.\(2025\)Qwen3 technical report\.arXiv preprint arXiv:2505\.09388\.Cited by:[Table 4](https://arxiv.org/html/2608.10108#A5.T4.168.170.2.1.1),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.22.24.2.1.1.1),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.1.1.2),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.120.122.2.1.1.1)\.
- H\. Yang, S\. Yue, and Y\. He \(2023\)Auto\-gpt for online decision making: benchmarks and additional opinions\.arXiv preprint arXiv:2306\.02224\.Cited by:[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
- K\. Yang, Z\. Chen, X\. He, J\. Jiang, M\. Galley, C\. Wang, J\. Gao, J\. Han, and C\. Zhai \(2026\)Plugmem: a task\-agnostic plugin memory module for llm agents, 2026\.URL https://arxiv\. org/abs/2603\.03296\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p2.1)\.
- S\. Yao, J\. Zhao, D\. Yu, N\. Du, I\. Shafran, K\. Narasimhan, and Y\. Cao \(2023\)ReAct: synergizing reasoning and acting in language models\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1)\.
- Y\. Zhang, M\. Li, D\. Long, X\. Zhang, H\. Lin, B\. Yang, P\. Xie, A\. Yang, D\. Liu, J\. Lin,et al\.\(2025\)Qwen3 embedding: advancing text embedding and reranking through foundation models\.arXiv preprint arXiv:2506\.05176\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p3.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.105.105.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.21.21.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.13.13.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.2.2.2),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.15.15.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.75.75.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.3.3.2)\.
- Y\. Zhao, B\. Yuan, J\. Huang, H\. Yuan, Z\. Yu, H\. Xu, L\. Hu, A\. Shankarampeta, Z\. Huang, W\. Ni,et al\.\(2026\)AMA\-bench: evaluating long\-horizon memory for agentic applications\.arXiv preprint arXiv:2602\.22769\.Cited by:[§B\.1](https://arxiv.org/html/2608.10108#A2.SS1.p11.2),[§C\.4](https://arxiv.org/html/2608.10108#A3.SS4.p1.1),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.161.161.8),[Table 4](https://arxiv.org/html/2608.10108#A5.T4.77.77.8),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.10.10.2),[Table 5](https://arxiv.org/html/2608.10108#A5.T5.21.21.2),[§F\.1](https://arxiv.org/html/2608.10108#A6.SS1.p1.1),[Table 7](https://arxiv.org/html/2608.10108#A6.T7.11.11.2),[Table 8](https://arxiv.org/html/2608.10108#A6.T8.1.8.7.1),[§1](https://arxiv.org/html/2608.10108#S1.p1.1),[§1](https://arxiv.org/html/2608.10108#S1.p2.1),[§3\.1](https://arxiv.org/html/2608.10108#S3.SS1.p1.6),[§3\.2](https://arxiv.org/html/2608.10108#S3.SS2.p1.1),[§5\.1](https://arxiv.org/html/2608.10108#S5.SS1.p1.2),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.115.115.6),[Table 1](https://arxiv.org/html/2608.10108#S5.T1.55.55.6),[Table 2](https://arxiv.org/html/2608.10108#S5.T2.11.11.2)\.
- L\. Zheng, R\. Wang, X\. Wang, and B\. An \(2024\)Synapse: trajectory\-as\-exemplar prompting with memory for computer control, 2024\.URL https://arxiv\. org/abs/2306\.07863\.Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p2.1)\.
- W\. Zhong, L\. Guo, Q\. Gao, H\. Ye, and Y\. Wang \(2024\)Memorybank: enhancing large language models with long\-term memory\.InProceedings of the AAAI conference on artificial intelligence,Cited by:[§1](https://arxiv.org/html/2608.10108#S1.p1.1),[§1](https://arxiv.org/html/2608.10108#S1.p2.1),[§2\.1](https://arxiv.org/html/2608.10108#S2.SS1.p1.1)\.
## Appendix AMemory Construction
An agent episode is a tripleei=\(di,τi,𝒬i\)e\_\{i\}=\(d\_\{i\},\\tau\_\{i\},\\mathcal\{Q\}\_\{i\}\), wheredi∈𝒟d\_\{i\}\\in\\mathcal\{D\}is a domain label andτi=\(ui,1,…,ui,Li\)\\tau\_\{i\}=\(u\_\{i,1\},\\ldots,u\_\{i,L\_\{i\}\}\)is the interaction history\. Each stepui,ℓ=\(ai,ℓ,oi,ℓ\)u\_\{i,\\ell\}=\(a\_\{i,\\ell\},o\_\{i,\\ell\}\)contains an action and an observation\. The episode is associated with grounded QA instances𝒬i=\{\(qi,j,ti,j,yi,j⋆\)\}j=1mi\\mathcal\{Q\}\_\{i\}=\\\{\(q\_\{i,j\},t\_\{i,j\},y\_\{i,j\}^\{\\star\}\)\\\}\_\{j=1\}^\{m\_\{i\}\}, andyi,j⋆y\_\{i,j\}^\{\\star\}denote the question, question type, and reference answer, respectively\.
For each interaction history,MESAconstructs a fixed memory library
ℳi=\{Mi\(k\)=Bk\(τi\)\}k=1K,\\mathcal\{M\}\_\{i\}=\\left\\\{M\_\{i\}^\{\(k\)\}=B\_\{k\}\(\\tau\_\{i\}\)\\right\\\}\_\{k=1\}^\{K\},whereBkB\_\{k\}andMi\(k\)M\_\{i\}^\{\(k\)\}denote the fixed builder and stored representation of structurekk\. For questionqi,jq\_\{i,j\}, a selector with policyρ\\rhopredicts a non\-empty binary selection vector
𝐳i,j=Sρ\(qi,j,ci,j\)\\mathbf\{z\}\_\{i,j\}=S\_\{\\rho\}\(q\_\{i,j\},c\_\{i,j\}\)𝐳i,j∈𝒵=\{𝐳∈\{0,1\}K:∥𝐳∥0≥1\},\\mathbf\{z\}\_\{i,j\}\\in\\mathcal\{Z\}=\\left\\\{\\mathbf\{z\}\\in\\\{0,1\\\}^\{K\}:\\lVert\\mathbf\{z\}\\rVert\_\{0\}\\geq 1\\right\\\},whereci,jc\_\{i,j\}contains compact previews of the evidence available from each structure\. Each selected structure is accessed through its fixed mechanismΓk\\Gamma\_\{k\}, and the resulting evidence is concatenated for the frozen answer modelFF:
Ei,j\(𝐳i,j\)=Compose\(\{Γk\(qi,j,Mi\(k\)\):zi,j\(k\)=1\}\),E\_\{i,j\}\(\\mathbf\{z\}\_\{i,j\}\)=\\operatorname\{Compose\}\\\!\\left\(\\left\\\{\\Gamma\_\{k\}\(q\_\{i,j\},M\_\{i\}^\{\(k\)\}\):z\_\{i,j\}^\{\(k\)\}=1\\right\\\}\\right\),y^i,j=F\(qi,j,Ei,j\)\.\\hat\{y\}\_\{i,j\}=F\(q\_\{i,j\},E\_\{i,j\}\)\.MESAoptimizes onlyρ\\rho\. The buildersBkB\_\{k\}, access mechanismsΓk\\Gamma\_\{k\}, composer, and answer model remain fixed\.
### A\.1Multi\-view Structural Memory Construction
We follow the notation in Eq\. \(1\) of the main paper\. For each interaction historyτi\\tau\_\{i\},MESAconstructs a fixed libraryℳi=\{Mi\(k\)=Bk\(τi\)\}k=1K\\mathcal\{M\}\_\{i\}=\\\{M\_\{i\}^\{\(k\)\}=B\_\{k\}\(\\tau\_\{i\}\)\\\}\_\{k=1\}^\{K\}, whereBkB\_\{k\}is the builder andΓk\\Gamma\_\{k\}is the corresponding access mechanism\. The five structures are indexed byk∈\{S,T,G,V,R\}k\\in\\\{S,T,G,V,R\\\}for summary, temporal store, knowledge graph, vector database, and raw episodic trace, respectively\. All structures are constructed offline and remain fixed whileMESAlearns only the selectorSρS\_\{\\rho\}\.
#### Summary \(S\) Memory
Following AMA\-Agent \(Zhao et al\., 2026\), the summary builderBSB\_\{S\}compresses the interaction historyτi=\(ui,1,…,ui,Li\)\\tau\_\{i\}=\(u\_\{i,1\},\\ldots,u\_\{i,L\_\{i\}\}\)into an episode\-level state memory, where each stepui,j=\(ai,j,oi,j\)u\_\{i,j\}=\(a\_\{i,j\},o\_\{i,j\}\)contains an action and an observation\. The summary preserves salient state changes, executed operations, results, errors, and subgoal transitions together with their temporal anchors, while removing repeated or task\-irrelevant observations\.
For a long history,BSB\_\{S\}partitionsτi\\tau\_\{i\}intoCiC\_\{i\}consecutive, turn\-aligned segments, summarizes them independently, and concatenates the partial summaries in temporal order:
Mi\(S\)=Concatc=1Ci\[fsum\(τi\(c\)\)\],M\_\{i\}^\{\(S\)\}=\\operatorname\{Concat\}\_\{c=1\}^\{C\_\{i\}\}\\left\[f\_\{\\mathrm\{sum\}\}\\\!\\left\(\\tau\_\{i\}^\{\(c\)\}\\right\)\\right\],where a single segment is used when the history fits within the construction window\. The resultingMi\(S\)=BS\(τi\)M\_\{i\}^\{\(S\)\}=B\_\{S\}\(\\tau\_\{i\}\)provides broad episode context and remains fixed across queries\. The prompt of constructing the summary memory is shown in[C\.1](https://arxiv.org/html/2608.10108#A3.SS1)\.
#### Temporal Store \(T\) Memory
The temporal builderBTB\_\{T\}preserves the original action–observation sequence as a turn\-indexed store:
Mi\(T\)=BT\(τi\)=\{\(ℓ,ai,ℓ,oi,ℓ\)\}ℓ=1Li\.M\_\{i\}^\{\(T\)\}=B\_\{T\}\(\\tau\_\{i\}\)=\\\{\(\\ell,a\_\{i,\\ell\},o\_\{i,\\ell\}\)\\\}\_\{\\ell=1\}^\{L\_\{i\}\}\.The access mechanism returns a query\-specific subset rather than the complete store:
Ei,j\(T\)=ΓT\(qi,j,Mi\(T\)\)=\{\(ℓ,ai,ℓ,oi,ℓ\):ℓ∈ℐi,j\}\.E\_\{i,j\}^\{\(T\)\}=\\Gamma\_\{T\}\(q\_\{i,j\},M\_\{i\}^\{\(T\)\}\)=\\\{\(\\ell,a\_\{i,\\ell\},o\_\{i,\\ell\}\):\\ell\\in\\mathcal\{I\}\_\{i,j\}\\\}\.When the selector activates the temporal structure,ΓT\\Gamma\_\{T\}first constructsℐi,j\\mathcal\{I\}\_\{i,j\}from turns explicitly referenced by the question, including individual steps, ranges, lists, and prefixes such as “until stepℓ\\ell,” together with supplementary turns requested by AMA\-Agent’s sufficiency checker\. Duplicate turns are removed and the retained action–observation records are ordered by step index\. If no evidence can be localized through these temporal references,ΓT\\Gamma\_\{T\}falls back to lexical matching over the temporal keys and returns up to five highest\-ranked turn identifiers,
Ei,j\(T\)=\{key\(ℓ\):ℓ∈TopK5lex\(qi,j\)\}\.E\_\{i,j\}^\{\(T\)\}=\\\{\\operatorname\{key\}\(\\ell\):\\ell\\in\\operatorname\{TopK\}\_\{5\}^\{\\mathrm\{lex\}\}\(q\_\{i,j\}\)\\\}\.
#### Graph \(G\) Memory
The graph builderBGB\_\{G\}reuses the Qwen3\-32B OpenIE artifacts produced by HippoRAG2 to form an episode\-level relational graph\. Each extracted edge records a subject, relation, object, and its associated trajectory step:
Mi\(G\)=BG\(τi\)=\(𝒱i,ℰi\),ℰi=\{\(hℓ,rℓ,tℓ,jℓ\)\}ℓ=1Ni\.M\_\{i\}^\{\(G\)\}=B\_\{G\}\(\\tau\_\{i\}\)=\\left\(\\mathcal\{V\}\_\{i\},\\mathcal\{E\}\_\{i\}\\right\),\\qquad\\mathcal\{E\}\_\{i\}=\\\{\(h\_\{\\ell\},r\_\{\\ell\},t\_\{\\ell\},j\_\{\\ell\}\)\\\}\_\{\\ell=1\}^\{N\_\{i\}\}\.The step anchorℓn\\ell\_\{n\}is inferred from the source passage and preserves a link from each relation to the original execution history\. At query time,MESAuses a lightweight access mechanism compared to the original HippoRAG2\.ΓG\\Gamma\_\{G\}links query mentions to graph entities and scores relations using lexical and entity overlap\. If the query contains a exact step or turn referencerr, a relation anchored atℓn\\ell\_\{n\}receives an additional proximity score1\.25/\(1\+\|ℓn−r\|\)1\.25/\(1\+\|\\ell\_\{n\}\-r\|\); relations within one step ofrrare also treated as step\-local seeds\. The matched entities are then expanded through one\- and two\-hop neighborhoods\. The access mechanism returns up tokG=8k\_\{G\}=8highest\-scoring focal relations, each augmented with up to four highest\-scoring neighboring relations\. This structure provides cross\-step entity and causal connections that are difficult to recover from a flat sequence alone\.
#### Vector Database \(V\) Memory
The summary structure is deliberately compressed and may omit a local detail that becomes relevant only after a query is observed\. The vector builderBVB\_\{V\}therefore retains a dense, step\-level view of the same history\. Each turn is serialized with its temporal anchor, action, and observation:
xi,j=Serialize\(j,ai,j,oi,j\)\.x\_\{i,j\}=\\operatorname\{Serialize\}\(j,a\_\{i,j\},o\_\{i,j\}\)\.
LetEembE\_\{\\mathrm\{emb\}\}denote the fixed embedding encoder\. We normalize each vector and store it together with the source text and turn index:
𝐯i,j=Eemb\(xi,j\)∥Eemb\(xi,j\)∥2,\\mathbf\{v\}\_\{i,j\}=\\frac\{E\_\{\\mathrm\{emb\}\}\(x\_\{i,j\}\)\}\{\\lVert E\_\{\\mathrm\{emb\}\}\(x\_\{i,j\}\)\\rVert\_\{2\}\},Mi\(V\)=BV\(τi\)=\{\(j,xi,j,𝐯i,j\)\}j=1Li\.M\_\{i\}^\{\(V\)\}=B\_\{V\}\(\\tau\_\{i\}\)=\\\{\(j,x\_\{i,j\},\\mathbf\{v\}\_\{i,j\}\)\\\}\_\{j=1\}^\{L\_\{i\}\}\.We instantiateEembE\_\{\\mathrm\{emb\}\}with Qwen3\-Embedding\-4B\. At query time, the fixed access mechanismΓV\\Gamma\_\{V\}encodesqiq\_\{i\}with the same encoder,
𝐯qi=Eemb\(qi\)∥Eemb\(qi\)∥2,\\mathbf\{v\}\_\{q\_\{i\}\}=\\frac\{E\_\{\\mathrm\{emb\}\}\(q\_\{i\}\)\}\{\\lVert E\_\{\\mathrm\{emb\}\}\(q\_\{i\}\)\\rVert\_\{2\}\},and returns thekVk\_\{V\}turns with the largest inner products𝐯qi⊤𝐯i,j\\mathbf\{v\}\_\{q\_\{i\}\}^\{\\top\}\\mathbf\{v\}\_\{i,j\}\. Because both vectors are L2\-normalized, this score equals cosine similarity\. We usekV=5k\_\{V\}=5\. This representation preserves local evidence that is semantically related to the query, while the stored turn indices maintain the connection between each retrieved item and the original interaction history\.
#### Raw Episodic \(R\) Memory
The raw episodic builderBRB\_\{R\}serializes the original actions and observations into overlapping, turn\-aligned windows without semantic compression\. For a trajectory of lengthLiL\_\{i\}, the window sizewiw\_\{i\}and overlapdid\_\{i\}are
wi=clip\(⌈Li12⌉,3,16\),di=round\(0\.25wi\)\.w\_\{i\}=\\operatorname\{clip\}\\\!\\left\(\\left\\lceil\\frac\{L\_\{i\}\}\{12\}\\right\\rceil,3,16\\right\),\\qquad d\_\{i\}=\\operatorname\{round\}\(0\.25w\_\{i\}\)\.Using stridewi−diw\_\{i\}\-d\_\{i\}, the builder produces
Mi\(R\)=BR\(τi\)=\{\(sc,ec,xi,c\)\}c=1Ci,M\_\{i\}^\{\(R\)\}=B\_\{R\}\(\\tau\_\{i\}\)=\\\{\(s\_\{c\},e\_\{c\},x\_\{i,c\}\)\\\}\_\{c=1\}^\{C\_\{i\}\},wherescs\_\{c\}andece\_\{c\}are the start and end positions in the trajectory sequence, andxi,cx\_\{i,c\}is the corresponding serialized action–observation text\. When the selector activates this structure,ΓR\\Gamma\_\{R\}ranks all windows againstqi,jq\_\{i,j\}with BM25 and returns up tokR=3k\_\{R\}=3positive\-scoring windows\. If no window receives a positive score, it returns the single highest\-ranked window\. This structure preserves exact surface\-form evidence and broader local context, complementing the compressed summary and more selective structured views\.
## Appendix BBaselines and Implementation Details
### B\.1Baseline Methods
Long\-context\.We feed the full historical trajectory into the backbone model\. For trajectories exceeding the maximum context window, we truncate them to preserve the most recent history\.
BM25\.We use the official BM25 implementation and its original configuration\. Each trajectory is divided into steps containing the step index, action, and observation\. Then, each step is further divided into non\-overlapping chunks of at most 800 characters\. We construct an independentBM25Okapiindex for each episode usingrank\-bm25v0\.2\.2, lowercase whitespace tokenization, and the default parametersk1=1\.5k\_\{1\}=1\.5,b=0\.75b=0\.75, andϵ=0\.25\\epsilon=0\.25\. For each question, the top\-5 chunks are concatenated for answer generation\.
Qwen3\-Emb\-4B\(Zhanget al\.[2025](https://arxiv.org/html/2608.10108#bib.bib47)\)\. This baseline represents memory as a flat vector index over fine\-grained history units, without additional summarization, graph construction, or memory evolution\. On AMA\-Bench, the task description and individual action–observation steps are encoded using Qwen3\-Embedding\-4B into 2,560\-dimensional vectors and stored in a FAISS inner\-product index\. All embeddings are L2\-normalized, making inner product equivalent to cosine similarity\. For each question, we encode the query with the same model, retrieve the top five trajectory steps, concatenate them in similarity order, and pass the resulting context to the backbone LLM for answer generation\. We set the embedding batch size to 8 and the maximum embedding length to 512 tokens\. On LoCoMo, the same flat vector\-memory structure is used, but each timestamped dialogue turn forms one indexed unit and the retrieval depth is increased tok=10k=10\. The query is prefixed with a retrieval instruction, and the retrieved turns retain their timestamps, dialogue identifiers, speakers, and original text\.
HippoRAG2\(Gutiérrezet al\.[2024](https://arxiv.org/html/2608.10108#bib.bib15)\)\. HippoRAG2 organizes memory as a heterogeneous graph consisting of passage, entity, and relational\-fact nodes\. OpenIE first extracts entities and relation triples from each passage, after which edges connect facts to their supporting passages and shared entities, while additional similarity edges connect synonymous entities\. During retrieval, the query is linked to the top\-kkfact or entity nodes, and relevance is propagated through the graph using personalized PageRank; the resulting graph scores are combined with recognition\-memory reranking and dense passage scores\. We preserve the original graph construction and retrieval settings, including linking top\-k=5k=5, QA top\-k=5k=5, PageRank damping factor0\.50\.5, and passage\-node weight0\.050\.05\. On AMA\-Bench, consecutive trajectory steps are packed into OpenIE documents of at most 24,000 characters, with a 300\-character overlap when an individual step must be split\. The backbone LLM performs OpenIE at temperature0with a 1,024\-token limit, and Contriever provides graph embeddings\. We retrieve 30 passage candidates and provide the top five, capped at 60,000 characters, for answering\. On LoCoMo, each dialogue turn forms one passage, BAAI/bge\-m3 is used for embeddings, and 200 passage candidates are retrieved before the top five are passed to the answerer\.
MemGPT\(Packeret al\.[2023](https://arxiv.org/html/2608.10108#bib.bib9)\)\. MemGPT is a hierarchical memory system that organizes memory as a two\-tier hierarchical structure inspired by virtual memory systems: a small in\-context core memory serves as working memory, while a vector\-indexed archival store maintains the complete long\-term history\. The backbone LLM explicitly searches the archival store and temporarily loads retrieved passages into its active context for reasoning\. On AMA\-Bench, the task description is placed in core memory, while the complete trajectory is divided into non\-overlapping passages of at most 1,500 characters and stored in archival memory with normalized Qwen3\-Embedding\-4B vectors\. For each question, the backbone LLM can iteratively issue search queries\. Each search retrieves the five most similar passages using cosine similarity and returns at most 8,000 characters to the core context\. We manually set the maximum number of searches to five, the generation budget of each agent step to 512 tokens, and the temperature to0\. If no valid answer is produced within the search budget, the backbone LLM is forced to answer from the accumulated retrieved context\. On LoCoMo, we use the same two\-level memory structure and retrieval parameters, but archival passages contain timestamped dialogue turns rather than trajectory steps, and each agent step is limited to 256 output tokens\. Archival memory remains fixed during evaluation and is not updated across questions\.
Mem0\(Chhikaraet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib14)\)\. Mem0 represents memory as a user\-scoped collection of atomic facts stored in a vector database\. The backbone LLM extracts candidate facts from each input chunk and compares them with existing memories to determine whether each fact should be added, updated, merged, or discarded\. Each retained fact is stored with its embedding and metadata in an on\-disk Qdrant database\. On AMA\-Bench, we build one isolated memory store per episode and group trajectory steps into chunks of at most 10 turns or 40,000 characters\. We set the fact\-extraction budget to 4,096 tokens, the embedding\-input limit to 20,000 tokens, and retrieve the top 10 facts for each question\. The backbone LLM performs fact extraction and conflict resolution at temperature0, while Qwen3\-Embedding\-4B provides 2,560\-dimensional embeddings\. On LoCoMo, following the official Mem0 conversational setup, we maintain one user\-specific store for each conversation participant\. Dialogue messages are inserted in two\-message batches with session timestamps as metadata, and the top 10 facts are retrieved from each participant’s store\. The retrieved facts are concatenated and passed to the backbone LLM for answer generation\.
A\-Mem\(Xuet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib23)\)\. A\-Mem organizes memory as a dynamic graph\-like structure of interconnected notes\. Each trajectory step is represented as a memory node containing the original content together with an LLM\-generated contextual description, keywords, and tags\. Edges connect semantically related notes, allowing information from distant trajectory steps to be associated\. When a new note is added, A\-Mem performs memory evolution by deciding whether to create new links, strengthen existing relations, or update neighboring notes\. During retrieval, the question is converted into keywords, which are used to retrieve the top\-kkmemory nodes together with their linked neighbors\. We use the official robust A\-Mem implementation with the backbone LLM for note construction and evolution, all\-MiniLM\-L6\-v2 for node embeddings, andk=10k=10\. The maximum note and retrieval\-context lengths are both 120,000 characters, and metadata generation is limited to 1,000 tokens with temperature0\. For LoCoMo, the same memory structure and parameters are used, but each timestamped dialogue turn forms a memory node instead of each trajectory step\.
MemoRAG\(Qianet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib36)\)\. MemoRAG uses a hybrid memory structure that combines a compressed global memory state with a dense retrieval index\. The complete trajectory is first encoded by the MemoRAG memory model,memorag\-qwen2\-7b\-inst, into a compact hidden\-state memory using beacon\-based context compression\. In parallel, the trajectory is divided into 512\-token chunks and indexed by BAAI/bge\-m3\. For each question, the memory model recalls potentially relevant text spans and generates surrogate queries, which are used to retrieve the top three chunks from the dense index\. The retrieved evidence is then passed to the backbone LLM for answer generation\. For each question, the memory model recalls relevant text spans and generates surrogate queries\. Each query retrieves its top three 512\-token chunks from the dense index, and the deduplicated union of the retrieved chunks is passed to the backbone LLM\.
Hindsight\(Latimeret al\.[2025](https://arxiv.org/html/2608.10108#bib.bib7)\)\. Hindsight organizes knowledge in a memory bank containing four structured memory types:world factsfor objective knowledge,experience factsfor the agent’s actions and interactions,observationsfor automatically consolidated knowledge derived from multiple facts, andmental modelsfor higher\-level summaries of recurring queries or concepts\. During retention, the backbone LLM extracts facts, entities, relations, and temporal information from input documents and stores them in the corresponding memory structures\. During recall, Hindsight searches memories through four parallel strategies: semantic similarity, BM25 keyword matching, graph traversal, and temporal filtering\. Then it combines their results using reciprocal\-rank fusion and cross\-encoder reranking\. On AMA\-Bench, we construct one memory bank per episode, divide trajectories into documents of at most 4,000 characters, and truncate trajectories longer than 120,000 characters using a head–tail strategy\. On LoCoMo, each timestamped conversation session is retained as one document in a conversation\-specific bank\. For both datasets, we use thehighrecall budget and an 8,192\-token recall limit\. In our configuration, automatic observation consolidation is disabled and no task\-specific mental models are provided; therefore, evaluation primarily relies on the world\-fact and experience\-fact memory structures\.
E\-Mem\(Wanget al\.[2026](https://arxiv.org/html/2608.10108#bib.bib35)\)\. E\-Mem organizes memory as a hierarchy of episodic blocks coordinated by a master–assistant architecture\. Each block is managed by an assistant agent and preserves its original, uncompressed context together with an LLM\-generated summary, while the master agent coordinates retrieval and aggregates evidence returned by the selected assistants\. In our implementation, each block contains approximately 4,096 tokens, corresponding to12\.5%12\.5\\%of the backbone LLM’s 32,768\-token context window, and adjacent blocks have a10%10\\%overlap\. For each question, a hybrid router scores blocks using summary\-level semantic similarity, chunk\-level semantic similarity, and BM25 matching with weights0\.30\.3,0\.40\.4, and0\.30\.3, respectively\. The semantic text index uses chunks of size 512 with an overlap of 50, and Qwen3\-Embedding\-4B provides the embeddings\. The router selects at most five memory blocks\. Each selected assistant independently reconstructs relevant evidence from its local context, and the backbone LLM aggregates the returned evidence and generates the final answer\. On AMA\-Bench, trajectory steps are inserted sequentially into an episode\-specific memory hierarchy, whereas on LoCoMo, timestamped dialogue turns are inserted into a conversation\-specific hierarchy\. All remaining memory\-block and routing parameters are shared across the two benchmarks\.
AMA\-Agent\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\)\. AMA\-Agent maintains a heterogeneous memory structure consisting of a compressed state memory, the original trajectory store, and a dense index over individual trajectory turns; it can additionally construct a causal graph, which is disabled in our experiments\. The state memory summarizes the task, important entities, intermediate states, and critical events, while the raw trajectory and turn embeddings preserve fine\-grained evidence that may be lost during compression\. During retrieval, AMA\-Agent first retrieves the top five turns using Qwen3\-Embedding\-4B and directly includes any turns explicitly referenced by the question\. The backbone LLM then judges whether the retrieved evidence is sufficient\. If it is not sufficient, it can request adjacent or ranged turns through structured retrieval, or generate and execute a Python search program for trajectory\-wide counting and aggregation\. We set the construction chunk size to 2,048, the session size to 8,192, the final state\-memory budget to 1,000 tokens, the retrieval depth tok=5k=5, and the temperature to0\. On AMA\-Bench, memory is constructed from action–observation trajectory steps and includes the task description\. On LoCoMo, each timestamped dialogue turn is represented as a trajectory step with a fixeddialogueaction, while the same memory structure and retrieval parameters are retained\.
### B\.2Hyperparameter Selection and Budget
MESAintroduces two optimization\-specific scalar hyperparameters: the evidence\-cost coefficientλ\\lambdain the regularized validation objective and the exploration coefficientβ\\betain the UCB scheduler\. These values are determined using development data only and are fixed before evaluation on the test split\. We use the same values across all data splits, answer\-model backbones, and benchmarks, rather than retuning them for each experimental setting\. The memory builders, access mechanisms, and retrieval depths are also fixed independently of selector optimization, as described in Appendix A\.
##### Evidence\-cost coefficient\.
We setλ=10−6\\lambda=10^\{\-6\}by calibrating the token penalty to the scale of the answer\-level evaluation score\. SinceJval\(ρ\)∈\[0,1\]J\_\{\\mathrm\{val\}\}\(\\rho\)\\in\[0,1\]whileCval\(ρ\)C\_\{\\mathrm\{val\}\}\(\\rho\)is measured in raw evidence tokens, this value assigns a penalty of0\.010\.01to an additional10,00010\{,\}000evidence tokens per query:
10−6×10,000=0\.01\.10^\{\-6\}\\times 10\{,\}000=0\.01\.Thus, an increase of approximately10,00010\{,\}000tokens must provide at least one percentage point of validation\-accuracy improvement to be favored by the regularized objective\. This calibration keeps the cost term large enough to discourage unnecessarily exhaustive retrieval without allowing small token differences to dominate answer quality\.
##### UCB exploration coefficient\.
We setβ=0\.08\\beta=0\.08so that the exploration bonus remains comparable to the differences in regularized validation scores observed among candidate policies\. A substantially smaller value makes scheduling nearly greedy and repeatedly selects directions that perform well early in the search, whereas an excessively large value over\-prioritizes under\-evaluated directions regardless of their observed utility\. Because an unvisited direction is initialized with the current frontier score,β\\betacontrols the additional uncertainty bonus rather than assigning an artificially low initial value to unexplored directions\. The ablation withβ=0\\beta=0, reported as*w/o UCB*in Table 3, further shows that removing this exploration mechanism reduces accuracy and increases variance across splits\.
##### Optimization budget\.
We use a fixed budget ofT=30T=30optimization iterations\. At each iteration, the proposer generates one exploitation, one exploration, and one failure\-repair candidate\. The same budget is used forMESAand all optimization ablations, so their differences cannot be attributed to additional proposal or validation calls\. The budget is treated as a computational constraint rather than a parameter selected using test performance\. After the budget is exhausted, the policy with the highest regularized validation objective in the archive is frozen and evaluated once on the held\-out test split\.
## Appendix CPrompts
### C\.1Summary \(S\) Prompt
We use the same prompt for constructing the text summary\.
Summary \(S\) Memory Construction PromptCOMPRESS\_PROMPT\_TEMPLATE = """You are presented with a section of agent trajectory \(actions and observations\)\. Compress it into a state memory that future readers can use to answer detailed questions about what happened\.Task: \{task\}Trajectory Section:\{trajectory\_text\}\{previous\_state\_text\}Identify KEY turns – turns where state meaningfully changed, a command/query/code was executed, an important result/value/schema/error appeared, or the agent shifted sub\-goal\. For each key turn record an env\_state block with bullet keys that BEST FIT this turn\. Common keys include: action, command, query, location, inventory, schema, sql, result, finding, error, change\. Use whatever keys fit; do NOT force fields that do not apply, and do NOT dump unrelated context into a "change" field\.CRITICAL – copy these VERBATIM from the trajectory; never paraphrase or summarize:\- commands, queries, code \(SQL, shell, Python, function/tool calls\)\- identifiers: file paths, URLs, table/column/schema names, IDs, UI element ids and selectors, entity names\- numeric values, counts, computed results, dates, response codes\- error messagesAlso write a one\-line Memory Summary describing the section’s overall progress\.Output everything after the marker below\.STATE\_MEMORYmemory\_summary: key\_turns=<turn ids\>; key\_objective=<main objective\>; key\_events=<critical events, commands, state changes, key results\>turn\_id: <turn number\>env\_state:\- <key\>: <value\>\- …turn\_id: <turn number\>env\_state:\- <key\>: <value\>"""
### C\.2Graph \(G\) Memory Prompts
We construct the knowledge\-graph memory using the two\-stage OpenIE pipeline of HippoRAG2\(Gutiérrezet al\.[2025](https://arxiv.org/html/2608.10108#bib.bib54)\)\. Given a packed trajectory passage, the first LLM call extracts a list of named entities\. The second call conditions on both the original passage and the extracted entity list to generate subject–relation–object triples\. The two prompts are shown below\. We use Qwen3\-32B with temperature0, disabled reasoning, and a maximum output length of 1,024 tokens\. Each packed trajectory passage contains at most 24,000 characters\.
Named Entity Extraction Prompt\[System\] Your task is to extract named entities from the given paragraph\. Respond with a JSON list of entities\.\[User: one\-shot example\] Radio City Radio City is India’s first private FM radio station and was started on 3 July 2001\. It plays Hindi, English and regional songs\. Radio City recently forayed into New Media in May 2008 with the launch of a music portal \- PlanetRadiocity\.com that offers music related news, videos, songs, and other music\-related features\.\[Assistant: one\-shot output\] \{"named\_entities": \["Radio City", "India", "3 July 2001", "Hindi", "English", "May 2008", "PlanetRadiocity\.com"\]\}\[User\] $\{passage\}
Triple Extraction Prompt\[System\] Your task is to construct an RDF \(Resource Description Framework\) graph from the given passages and named entity lists\. Respond with a JSON list of triples, with each triple representing a relationship in the RDF graph\.Pay attention to the following requirements:\- Each triple should contain at least one, but preferably two, of the named entities in the list for each passage\.\- Clearly resolve pronouns to their specific names to maintain clarity\.\[User: one\-shot example\] Convert the paragraph into a JSON dict, it has a named entity list and a triple list\. Paragraph: Radio City Radio City is India’s first private FM radio station and was started on 3 July 2001\. It plays Hindi, English and regional songs\. Radio City recently forayed into New Media in May 2008 with the launch of a music portal \- PlanetRadiocity\.com that offers music related news, videos, songs, and other music\-related features\.\{"named\_entities":\["Radio City", "India", "3 July 2001", "Hindi","English", "May 2008", "PlanetRadiocity\.com"\]\}\[Assistant: one\-shot output\] \{"triples": \[ \["Radio City", "located in", "India"\], \["Radio City", "is", "private FM radio station"\], \["Radio City", "started on", "3 July 2001"\], \["Radio City", "plays songs in", "Hindi"\], \["Radio City", "plays songs in", "English"\], \["Radio City", "forayed into", "New Media"\], \["Radio City", "launched", "PlanetRadiocity\.com"\], \["PlanetRadiocity\.com", "launched in", "May 2008"\], \["PlanetRadiocity\.com", "is", "music portal"\], \["PlanetRadiocity\.com", "offers", "news"\], \["PlanetRadiocity\.com", "offers", "videos"\], \["PlanetRadiocity\.com", "offers", "songs"\] \]\}\[User\] Convert the paragraph into a JSON dict, it has a named entity list and a triple list\. Paragraph: $\{passage\}$\{named\_entity\_json\}
The triple\-extraction prompt produces only subject–relation–object triples\. It does not request trajectory\-step indices\. We associate each triple with a step after extraction by matching its entities and relation against theStep Nblocks in the corresponding packed source passage\.
### C\.3Answer Generation Prompt
Answer Generation Prompt\[User\] \# Task $\{task\}\# State Memory \(compressed\) $\{B1\_evidence\}\# Temporal Turns \(referenced by step/turn or neighborhood $\{B2\_evidence\}\# Knowledge Graph \(HippoRAG triples \+ neighbors\) $\{B3\_evidence\}\# Retrieved Turns \(embedding similarity\) $\{B4\_evidence\}\# Chunked Context \(BM25 over trajectory\) $\{B5\_evidence\}\#\# Questions Question:$\{question\}\#\# Instructions Provide a direct and concise answer\.Answer: \[your answer here\]
Only the memory structures selected are included in the prompt\. Empty or unselected sections are omitted\. The complete prompt is sent as a single user message without an additional system message\.
### C\.4Judge Prompt
We use the same LLM\-as\-a\-judge prompt as\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\), which is shown below\.
Binary Correctness Judgement PromptPrompt for Evaluating Answers for AMA\-Bench You are an expert evaluator\. You will be given a question, a reference answer, and a predicted answer\. Your task is to determine if the predicted answer is correct based on:1\.Factual correctness compared to the reference2\.Completeness of the answer3\.Relevance to the question\{context\_str\}Question:\{question\}Reference Answer:\{golden\_answer\}Predicted Answer:\{predicted\_answer\}Is the predicted answer correct? Respond with ONLYyesorno\. Do not include any thinking process, explanation, or additional text\.Answer
## Appendix DPrior Directions for Guided Optimization
The prior directions𝒜=\{a1,…,aM\}\\mathcal\{A\}=\\\{a\_\{1\},\\ldots,a\_\{M\}\\\}define mechanism classes for proposing structure selectors; they do not encode which memory subset is optimal for a particular question\. Each direction specifies an observable routing signal and a mechanism for mapping that signal to a non\-empty structure subset\. Router parameters may be fitted using training\-split combination outcomes, while candidate acceptance and frontier selection use only the validation objective\. Held\-out test outcomes are excluded from the prior, proposer context, fitting procedure, and optimization loop\.
At inference time, the selector may access the question, task metadata, and query\-conditioned evidence previews\. These previews are produced by the fixed retrievers without access to reference answers, judge feedback, or per\-combination scores\. Outcome\-derived variables, including winning combinations and cached evaluation scores, are available only as training labels during learning and are never exposed to the selector\.
The mechanism taxonomy is fixed before each optimization run\. It restricts the search to structure selection while leaving memory construction, retrieval, composition, and answer generation unchanged\. Additional mechanism classes may be registered as new UCB arms before a run, but the arm set is not modified using validation or test outcomes during that run\.
Axis A — Demand inference:*what the query requires*\(1\) capability prior,\(2\) domain–task prior,\(3\) lexical demand inference, and\(4\) query decomposition: infer memory demand from the question type, task metadata, lexical and identifier cues, or decomposed sub\-questions\.
Axis B — Backend value estimation:*how useful each structure is*\(5\) marginal value,\(6\) conditional value,\(7\) hierarchical shrinkage, and\(8\) learned gating: estimate the utility of each structure individually or conditioned on the current subset, while shrinking low\-support estimates toward coarser statistics\.
Axis C — Subset construction:*how to form the selected set*\(9\) independent gating,\(10\) cardinality\-first selection,\(11\) forward selection, and\(12\) complementarity selection: construct a non\-empty subset through per\-structure decisions, predicted subset size, incremental addition, or complementary evidence coverage\.
Axis D — Evidence\-aware selection:*what the retrieved previews contain*\(13\) evidence availability,\(14\) evidence relevance,\(15\) evidence coverage, and\(16\) evidence redundancy: use query\-conditioned previews to remove empty or irrelevant structures, cover distinct information needs, and suppress redundant evidence\.
Axis E — Robustness and cost shaping:*how to control risk and context cost*\(17\) confidence fallback,\(18\) disagreement policy,\(19\) parsimony control, and\(20\) support\-aware routing: fall back under uncertainty, resolve conflicting routing signals, penalize unnecessary structures, and back off from estimates supported by too few training examples\.
## Appendix EAdditional Result
### E\.1Domain\-wise Comparison on AMA\-Bench
We show the full result of Fig\.[4](https://arxiv.org/html/2608.10108#S5.F4)in Table[4](https://arxiv.org/html/2608.10108#A5.T4)\.
Table 4:Domain\-wise LLM\-as\-a\-judge accuracy \(%\) on AMA\-Bench using Qwen3\-32B and Gemma\-4\-31B backbones\. Results are reported as mean±\\pmsample standard deviation over five splits\.
### E\.2F1 Score on AMA\-Bench
We show the F1 score comparison on AMA\-Bench in Table[5](https://arxiv.org/html/2608.10108#A5.T5)with two model backbones\.
Table 5:F1 score results of memory\-based methods on AMA\-Bench using Qwen3\-32B and Gemma\-4\-31B as answer\-model backbones\. Results are reported as mean±stdover evaluation splits\. Best results within each backbone are shown in bold, and second\-best results are underlined\.
## Appendix FAdditional Analyses
### F\.1Robustness to Judge
The main AMA\-Bench results use Qwen3\-32B as the LLM judge\. To avoid the bias of single judge model, we additionally evaluate the same predictions using Gemma\-4\-31B and GPT\-5\.4 in Table[6](https://arxiv.org/html/2608.10108#A6.T6)\. All three judges receive the same question, reference answer, predicted answer, and binary correctness prompt\. While the absolute accuracy values vary across judge backbones, which is consistent with the judge\-dependent score variation also discussed in the original AMA\-Agent evaluation\(Zhaoet al\.[2026](https://arxiv.org/html/2608.10108#bib.bib34)\), the relative trend remains stable\.MESAis ranked first with question\-level majority voting under Qwen3\-32B, Gemma\-4\-31B, and GPT\-5\.4\. This result indicates thatMESA’s comparative advantage is not specific to the primary Qwen3\-32B judge\.
Table 6:Judge Robustness evaluation across different LLM judges \(Qwen3\-32B, Gemma\-4\-31B, and GPT\-5\.4\)\. Overall accuracy \(%\) is reported as mean±stdover five evaluation splits\. Best results within each judge are shown in bold, and second\-best results are underlined\.
### F\.2Sensitivity to LoCoMo Conversation Splits
The main comparison in Table[2](https://arxiv.org/html/2608.10108#S5.T2)uses a single fixed conversation\-disjoint2:2:62\{:\}2\{:\}6split shared by all evaluated methods\. Since LoCoMo contains only ten conversations, results from a single partition may be sensitive to which conversations are assigned to the training, validation, and test sets\. We therefore additionally evaluateMESAover five independently sampled conversation\-level splits using the same partition ratio in Table[7](https://arxiv.org/html/2608.10108#A6.T7)\. The fixed split in the main paper remains the basis for the cross\-method comparison, because all baselines are evaluated under that common protocol\. The additional experiments are intended to characterize the split sensitivity ofMESA\.
Table 7:Performance evaluation over five folds reported as mean±std\(%\)\. Best result is in bold, and second\-best result is underlined\.
### F\.3Memory Construction Time
We measure offline memory\-construction time on a subset of trajectories sampled from the 208 AMA\-Bench episodes and report the average wall\-clock time under a sequential implementation in Table[8](https://arxiv.org/html/2608.10108#A6.T8)\.MESArequires73\.373\.3s per trajectory, including38\.238\.2s for the components shared with AMA\-Agent,35\.135\.1s for the graph memory, and a negligible0\.0010\.001s for the raw episodic memory\. The memory views are independently constructed from the same trajectory and can therefore be parallelized across processes or devices, which needs38\.238\.2s\.
MESA’s construction time is lower than those of Mem0 \(179\.9179\.9s\), Hindsight \(420\.3420\.3s\), and A\-Mem \(717\.2717\.2s\), while achieving the strongest downstream accuracy\. It is more expensive than AMA\-Agent \(38\.238\.2s\) and MemoRAG \(32\.232\.2s\), reflecting the additional cost of constructing complementary views\. Overall, the results indicate a acceptable performance–construction\-cost trade\-off\.
Table 8:Average memory construction time per trajectory \(in s\) evaluated over sampled episodes with Qwen3\-32B\.
### F\.4Comparison with Validation\-selected Fixed Selection
In Sec\.[3](https://arxiv.org/html/2608.10108#S3), we exhaustively evaluate all non\-empty structure subsets\. In Table[9](https://arxiv.org/html/2608.10108#A6.T9), we analyze the best fixed combination on the validation set and construct fixed global, domain\-conditioned, capability\-conditioned, and domain–capability\-conditioned lookup policies\. The selected subsets are then frozen for test evaluation\. Domain\-conditioned, capability\-conditioned, and domain–capability\-conditioned selection achieve64\.4%64\.4\\%,63\.8%63\.8\\%, and64\.0%64\.0\\%, respectively\.MESAreaches65\.1%65\.1\\%with the lowest cross\-split variation, indicating that its gain is not explained solely by a coarse category\-to\-subset mapping\. As shown in Fig\.[5](https://arxiv.org/html/2608.10108#S5.F5), it also learns more fine\-grained rules like keyword\-level mapping over domain and capacities\.
Table 9:Comparison with validation\-selected coarse\-grained selection strategies through the full subset sweep in the controlled analysis\.
## Appendix GDiscussion and Limitations
Our results show structure\-level selection as a useful complement to memory construction and item\-level retrieval\. Across AMA\-Bench, the best memory configuration is typically neither a single structure nor the full union, indicating that different queries benefit from different combinations of global, temporal, relational, semantic, and step\-level evidence\. Consistent with this observation,MESAoutperforms the all\-structure configuration while using 41\.2% fewer evidence tokens, suggesting that adaptive selection improves both efficiency and evidence quality by reducing redundant or distracting context\. The route\-to\-one ablation further confirms that these gains arise from composing complementary structures rather than identifying a single universally strong representation\. Importantly,MESAlearns such selection policies from answer\-level feedback without modifying the underlying memory builders, retrievers, or answer model\. Prior\-guided proposals provide a structured search space, while UCB\-guided scheduling improves the stability of policy evolution\. The resulting policies also remain explicit and inspectable, facilitating the analysis of query\-dependent memory access\. The comparatively smaller gain on causal inference points to a promising extension that combines adaptive structure selection with explicit modeling of cross\-event and cross\-structure dependencies\.
This study intentionally focuses on a representative set of five memory structures and keeps the remaining system components fixed to isolate the contribution of query\-adaptive selection\. This controlled setting enables a clear evaluation of the proposed formulation, while leaving several natural extensions for future work, including incorporating additional memory representations and jointly optimizing memory construction, retrieval, selection, and evidence composition\. The current evaluation covers both long\-horizon agent trajectories and long\-term conversations, providing initial evidence of generality across memory settings\. Further studies on continuously updated and multimodal memories could broaden the applicability of the framework\.相似文章
EdgeMem: 通过保留证据的多锚点超图实现无LLM智能体记忆构建与检索
EdgeMem提出一种无LLM的方法,用于智能体记忆的构建与检索,采用多锚点超图,保留证据以提高基于记忆的问答性能。
准确高效的LLM智能体长期记忆
MOSAIC是一个结构化、具备冲突感知能力的LLM智能体长期记忆框架,它采用实体类型化图存储、哈希加速检索和主动冲突检测,在长对话问答和事实冲突检测任务上实现了高准确率和高效率。
AdMem:面向任务求解智能体的高级记忆系统
本文介绍AdMem,一种面向基于LLM的智能体的统一记忆框架,整合语义记忆、情景记忆和程序性记忆,并采用双层短期与长期存储结构,通过多智能体架构实现自动记忆生成与自适应检索。实验表明,该方法在长程多轮任务中提升了鲁棒性和成功率。
S3Mem:面向长周期交互式问答的结构化时空场景事件记忆
S3Mem 提出了一种用于长周期交互式问答的结构化时空场景事件记忆框架,采用锚点敏感检索和令牌预算感知的证据接口,在多个环境中优于标准 RAG。
MACE: 记忆-智能体协同进化与自适应记忆图在多智能体系统中的应用
MACE是一种用于基于LLM的多智能体系统的记忆-智能体协同进化框架,它利用自适应记忆图组织功能记忆单元,并通过执行反馈进行自适应,从而相比基线提升任务性能。