July 15, 2026
Large Language Model (LLM) agents increasingly rely on external memory systems to accumulate experience across tasks. Yet nearly all existing approaches, from graph-structured memories to reflective insight stores, access memory through fixed, hand-designed heuristics. We argue that this static view of memory is a core bottleneck for agentic learning because optimal memory behavior is fundamentally context-dependent. The early stages of the tasks, benefit from minimal retrieval because memory is sparse; recurring goal types benefit from plan reuse rather than generic nearest-neighbor lookup; stuck agents benefit from re-retrieval with alternative queries; and across long task streams, the memory store itself must be consolidated and pruned to remain useful. We present MemCon(Memory as a Controlled Process), a framework that models memory operations as a Markov Decision Process and learns an online policy that adaptively decides when, what, and how much to retrieve, when to inject a distilled plan, and when to consolidate or forget. MemCon is backend-agnostic: it wraps any existing memory implementation, learns from task-by-task binary feedback with no pretraining and no additional LLM calls, and uses a lightweight tabular contextual bandit with UCB exploration that converges within tens of tasks. Across 6 benchmarks, 3 agent frameworks, and 3 LLM backbones, MemCon consistently outperforms multiple memory baselines by up to 15.2 points in task success while reducing token consumption by 5–20%. Our code is available at https://github.com/ericjiang18/MemCon/
Large Language Models (LLMs) deployed as autonomous agents have demonstrated remarkable capabilities in interactive environments, multi-step planning, and tool use [1]–[4]. A critical enabler of this progress is memory, the ability to store experiences from solved tasks and retrieve them on future ones, so that an agent can avoid repeating past mistakes, reuse working strategies, and incrementally accumulate domain knowledge rather than starting from scratch on every episode [5]–[9].
Despite rapid progress in what to store (trajectories, reflections, insights, skills, graphs, latent tokens [5], [9]–[13]), most existing memory systems treat memory access as a static pipeline: a
single global retriever is called once per step with a hard-coded top-\(k\), a hard-coded graph hop depth, and a hard-coded query template, and uses the same configuration whether memory is empty or contains
thousands of trajectories, whether the task is familiar or novel, and whether the agent is progressing or has been executing the same action for five steps. A complementary line of work—most prominently MemGPT [11]—makes memory access adaptive by promoting the LLM itself to the role of memory controller (paginating, formulating queries, and deciding when to recall), at
the cost of an additional LLM call per memory operation. MemCon occupies a third design point: a learned but lightweight controller that is adaptive without any extra LLM calls. We show this static-pipeline view is a
fundamental bottleneck for agentic memory systems: existing static memory systems either retrieve too aggressively (inflating context and cost while hurting accuracy on simple queries) or too conservatively (missing key reusable plans and
reflections), because any single setting is miscalibrated for at least one of the regimes above.
We argue that effective agent memory requires an adaptive control layer sitting on top of the storage backend. Concretely: (i) Early tasks should retrieve less, because there is little useful experience to draw on and indiscriminate retrieval only dilutes the prompt. (ii) Recurring goal types should prefer plan reuse, replaying a distilled, object-generalized template of a prior success, rather than nearest-neighbor retrieval over raw trajectories. (iii) Stuck agents that repeat actions should trigger re-retrieval with an alternative query rather than re-reading the same top-\(k\) that already failed to help. (iv) Long task streams require consolidation and forgetting so that a growing, noisy memory remains useful rather than overwhelming. No single fixed heuristic achieves all four; the right memory operation is a function of task progress, memory state, and the agent’s learning phase.
We introduce MemCon(Memory as a Controlled Process), a framework that reformulates memory access as a sequential decision problem. MemCon casts the
choice of memory operation (Retrieve, PlanInject, Re-Retrieve, Consolidate, Forget, NoOp) together with its parameters (top_k, insight_k, graph hop) as actions in a Memory MDP, whose state captures both task progress (goal type, step phase, stuck indicator, locations
visited) and memory status (size, plan availability, learning phase). MemCon learns a policy over this MDP online, during deployment, using a lightweight tabular contextual bandit with UCB exploration [14]–[16]. The policy is warm-started from human-readable
priors, updated via reverse-discounted credit assignment from binary task success, and persists to disk between tasks. Crucially, MemCon adds zero additional LLM calls: memory control is a millisecond-scale
table lookup, not a second LLM invocation.
MemCon is not a new memory store. It is a thin wrapper that intercepts the abstract retrieve and store entry points of any existing memory backend and decides how to call them. The same
wrapper applies unchanged to flat vector stores, skill libraries [8], summarisation-based memories [17], latent-token memories [10], and
graph-structured memories [9], cleanly separating what is stored (backend) from how it is accessed (controller) and letting any future
memory system plug in and inherit adaptive control.
We evaluate MemCon across 6 benchmarks covering both interactive decision-making (ALFWorld [18], PDDL planning, ScienceWorld [19]) and knowledge / web / tool-use QA (TriviaQA [20], WebWalkerQA [21], GAIA [22]); 3 agent frameworks (Lobster, LangGraph [23], Microsoft Agent-Framework); 3 LLM backbones (GPT-4.1-mini, Claude Sonnet-4, DeepSeek-V3.2); and compare against 9 strong memory baselines spanning vector retrieval (MetaGPT [24], MemoryBank [17]), skill libraries (Voyager [8]), trajectory summarization (ChatDev [25]), generative re-ranking (Generative [5], ExperienceBank), insight-based learning (OAgents [26]), graph-based hierarchical memory (G-Memory [9]), and latent-token memory (LatentMem [10]). Across all configurations, MemCon achieves the best or near-best task success—e.g., \(67.9\%\) ALFWorld on GPT-4.1-mini (Lobster), the top score among all 10 memories evaluated in that cell—and consistently delivers 5–\(30\)+ point gains over the no-memory baseline, while simultaneously reducing average token consumption per task by 5–20%.
Contributions.
We formalize agent memory management as a Memory MDP and introduce a backend-agnostic wrapper that decouples the memory control policy from the memory storage backend, so any existing or future memory system inherits adaptive control for free (§3.1, §3.3).
We propose an online contextual bandit policy with UCB exploration, warm-start priors, and reverse-discounted credit assignment that converges within tens of tasks using zero pretraining and zero extra LLM calls, together with augmented memory operations (§3.2, §[sec:augmented]).
We conduct an extensive evaluation of agent memory on six benchmarks and three agent frameworks, showing consistent accuracy gains and token savings, including a component ablation that isolates the learned controller’s contribution (§4).
MemCon builds on three lines of work: (i) multi-agent reinforcement learning, (ii) multi-agent LLM systems, and (iii) agentic memory.
Reinforcement learning has long been used to learn task policies from sparse reward, including value-decomposition (VDN [27], QMIX [28]), centralized-critic actor-critic (MADDPG [29], COMA [30]), and on-policy methods (MAPPO [31], IPPO [32]) on cooperative benchmarks such as SMAC [33]; learning to communicate [34] and sequence-modelling views [35], with surveys [36]–[39], broaden the design space. Closer to our setting, several recent works learn memory-management policies for LLM agents using deep RL or LLM-driven controllers [11]; we operate in a much lighter-weight regime, treating memory operations as actions of a single-agent contextual bandit [14], [15], [40] (a special case of tabular Q-learning [16], [41]) with episode-level Monte-Carlo updates. The resulting MDP is small enough to be learnable online without GPUs and without secondary LLM calls.
Role-based LLM collaboration (AutoGen [42], CAMEL [43], MetaGPT [24], ChatDev [25], AgentVerse [44]), multi-agent debate [45], [46], and society-of-minds formulations [47], [48] improve reasoning over single-agent baselines, while more recent work optimizes the collaboration graph itself [49], [50]; production frameworks such as LangGraph [23] and Microsoft Agent-Framework supply the execution substrates we evaluate; see [51], [52] for surveys. These systems delegate cross-task learning to an external memory with fixed retrieval parameters. MemCon sits inside that memory module, so it is compatible with single-agent (Lobster), graph (LangGraph), and pipeline (Agent-FW) orchestration unchanged.
Retrieval over stored experience is the dominant paradigm. Memory streams, long-term stores, and OS-style paging: Generative Agents [5], MemoryBank [17], MemGPT [11], Mem0 [12], MemLLM [53], Think-in-Memory [54], and
memory-assisted prompt editing [55]. Skill- and procedure-centric memories: Voyager [8], MemP [13], Agent Workflow Memory [56], ProcMEM [57], MemSkill [58], HiAgent [59], and LatentMem [10]. Reflection- and rule-based memories: Reflexion [6], ExpeL [7], CLIN [60], OAgents [26], and the graph-structured G-Memory [9], our strongest
baseline. These build on RAG [61]–[63]. Most
of these systems access memory with fixed top-\(k\), hop, query, and consolidation schedule; the notable exception is MemGPT [11], which makes the access pattern adaptive by promoting the LLM itself to the role of controller, at the cost of additional LLM calls per memory operation. MemCon is orthogonal to both
styles: it adds a learned-but-lightweight controller on top of any backend—deciding which operation, with what parameters, and when—without any secondary LLM calls.
This section formalizes each component: the Memory MDP (§3.1), the online policy (§3.2), the backend-agnostic wrapper (§3.3), and two augmented memory operations tailored to long-horizon agentic tasks (§[sec:augmented]). Figure 1 gives a high-level overview of MemCon.
Consider an LLM agent solving tasks \(\{\tau_1, \ldots, \tau_N\}\) sequentially. At each task \(\tau_i\), the agent interacts with an environment over \(T_i\) steps with access to a memory system \(\mathcal{M}\) (the backend). Most existing memory backends expose two abstract endpoints, a retrieve call (return up to \(K\) items relevant to a query) and a store call (write the trajectory of the just-finished task), together with optional maintenance hooks for consolidation and eviction. In standard usage these endpoints are
invoked with hard-coded hyperparameters (number of items, search depth, query template, consolidation schedule); we instead model the choice of which endpoint to invoke and with what parameters as a sequential decision problem captured by an MDP \(\mathcal{M}_{\text{mem}} = (\mathcal{S}, \mathcal{A}, \mathcal{T}, \mathcal{R}, \gamma)\).
The state \(s = (s^{\text{task}}, s^{\text{mem}})\) fuses task-progress and memory-status signals: \[\begin{align} s^{\text{task}} &= (\texttt{goal\_type},\; \texttt{step\_phase},\; \texttt{is\_stuck},\; \texttt{objects\_held},\; \texttt{locations}), \\ s^{\text{mem}} &= (\texttt{mem\_size},\; \texttt{plan\_available},\; \texttt{learning\_phase}), \end{align}\] where \(\texttt{step\_phase}\) bins the step count, \(\texttt{is\_stuck}\in\{\text{True},\text{False}\}\) is set when the agent has emitted the same physical action twice in a row, \(\texttt{learning\_phase}\) indicates whether the agent has completed enough tasks to trust learned Q-values, and \(\texttt{plan\_available}\) records whether a distilled success plan exists for the current goal type. We discretize \(s\) into a compact hashable key \(\phi(s)\) for tabular learning; the exact bins, thresholds, and the discretization rule are given in Appendix 8. The discretization yields on the order of a few hundred distinct states per benchmark, enabling rapid online convergence.
Each action \(a = (\texttt{op}, \theta)\) specifies a memory operation together with its parameters: \[\label{eq:action-op} \texttt{op} \in \{\mathrm{\small Retrieve},\; \mathrm{\small PlanInject},\; \mathrm{\small Re-Retrieve},\; \mathrm{\small Consolidate},\; \mathrm{\small Forget},\; \mathrm{\small NoOp}\};\tag{1}\] \[\label{eq:action-theta} \theta = (\texttt{top\_k},\; \texttt{insight\_k},\; \texttt{hop}).\tag{2}\] Retrieve returns the top-\(\texttt{top\_k}\) items from the backend together with up to \(\texttt{insight\_k}\) derived rules (when supported) at search depth \(\texttt{hop}\); Re-Retrieve re-issues a retrieval with an alternative-approach query suffix, used to escape repeated-action loops; PlanInject prepends a generalised success plan when one is available (§[sec:augmented]); Consolidate and Forget call any maintenance hooks the backend exposes (e.g., merging or pruning derived rules) and silently no-op on backends that do not implement them; NoOp skips memory access for the current step. We instantiate \(\mathcal{A}\) as a small finite set of representative \((\texttt{op}, \theta)\) configurations spanning shallow-to-deep retrieval plus the maintenance and plan operations; the exact action set used in our experiments is listed in Appendix 8 (Table 6).
Rewards are observed at task end based on environment feedback: \[\label{eq:reward} r(\tau_i) \;=\; r_{\text{succ}}\cdot\mathbb{1}[\text{success}] \;+\; \lambda\cdot\max\!\left(0,\; 1 - T_i/T_{\max}\right) \;-\; r_{\text{fail}}\cdot\mathbb{1}[\text{failure}],\tag{3}\] where \(r_{\text{succ}}, r_{\text{fail}}, \lambda\) and the horizon \(T_{\max}\) are fixed scalars (values in Appendix 8, Table 5). Successful and more efficient trajectories therefore earn larger credit; failed trajectories earn negative feedback that discourages costly or counterproductive memory usage.
The environment transition is driven by the LLM agent and is effectively opaque to the controller. We therefore treat \(\mathcal{M}_{\text{mem}}\) as a contextual bandit with episode-level (Monte-Carlo) feedback: even though the underlying problem is sequential, the controller never bootstraps a within-episode value estimate and instead receives one terminal-reward signal per task, which makes the formal regret analysis (Appendix 9) straightforward and bounds sample complexity to tens of tasks.
We learn \(\pi: \mathcal{S} \to \mathcal{A}\) online during deployment, with no pretraining and no additional LLM calls.
At each memory decision point we apply the Upper Confidence Bound rule [14], [15], with the exploration bonus computed using the state-specific visit count: \[\label{eq:ucb-rule-main} a_t \;=\; \arg\max_{a\in\mathcal{A}} \left[\; Q(\phi(s_t), a) \;+\; c\sqrt{\frac{\ln N(\phi(s_t))}{N_a(\phi(s_t))}} \;\right],\tag{4}\] where \(c\) is the UCB exploration coefficient (Appendix 8, Table 5), \(N(\phi(s_t)) := \sum_{a\in\mathcal{A}} N_a(\phi(s_t))\) is the total number of decisions ever taken at state key \(\phi(s_t)\), and \(N_a(\phi(s_t))\) is the count of action \(a\) at that state. Unvisited actions receive an \(\infty\) bonus, forcing the first \(|\mathcal{A}|\) visits to each state to span all actions; warm-start priors (below) break ties among such \(\infty\) bonuses to give a sensible initial ordering. The same expression is used both in the implementation (with the per-state count) and in the theoretical analysis (Appendix 9, Eq. 14 ).
Before any learning, Q-values are initialized with interpretable priors that encode mild domain knowledge: Retrieve and PlanInject receive positive priors (retrieval is usually helpful, plans are useful when available), Re-Retrieve a smaller positive prior (useful only when stuck), Consolidate a neutral prior, and Forget and NoOp mildly negative priors. Numerical values are listed in Appendix 8 (Table 5). Warm-starting accelerates convergence on the first few tasks, before any real reward has been observed.
After each task \(\tau_i\), all \((s,a)\) pairs visited during the episode are updated with a reverse-discounted Monte-Carlo return, so that actions taken closer to the terminal outcome receive stronger credit: \[\label{eq:q-update} Q(\phi_j, a_j) \;\leftarrow\; Q(\phi_j, a_j) \;+\; \alpha\left[\gamma^{|\text{ep}|-j-1}\cdot r_i \;-\; Q(\phi_j, a_j)\right],\tag{5}\] where \(\alpha\) is the step size, \(\gamma\in(0,1)\) is the within-episode discount, \(|\text{ep}|\) is the total number of memory decisions executed during episode \(\tau_i\), and \(j\in\{0,1,\dots,|\text{ep}|-1\}\) is the chronological index of the decision being credited (so the last decision receives the undiscounted \(r_i\) and earlier decisions receive geometrically attenuated credit). Numerical values for \(\alpha\) and \(\gamma\) are in Appendix 8. The Q-table is persisted to disk every few updates, so learning carries across runs and task streams.
MemCon is a thin wrapper around any memory backend \(\mathcal{M}_{\text{inner}}\) that exposes a two-method interface: retrieve (return \(K\) items for a query) and store (write the finished trajectory with its success label); an optional maintain hook unlocks the consolidation and eviction actions, and is silently no-op’d otherwise. On
retrieve, the wrapper builds \(s_t\), invokes the policy to pick \((\texttt{op}^*,\theta^*)\), calls \(\mathcal{M}_{\text{inner}}\) with those
parameters (unsupported parameters are dropped), and optionally augments the result with one of two domain-agnostic augmented operations (described below); on store, it computes the episode reward, updates Q-values via Eq. 5 , updates the plan index, and delegates persistence to \(\mathcal{M}_{\text{inner}}\). Because the wrapper never reads or mutates the backend’s internal data structures, it is genuinely
backend-agnostic and applies unchanged to flat vector stores [17], [24], skill libraries [8], summarisation-based memories [25], latent-token memories [10], and graph-structured
memories [9]. The two augmented operations target failure modes in long-horizon interactive tasks: generalised plan injection (a learnable
MDP action, PlanInject) extracts the action sequence of a successful task of type \(g\), replaces instance-specific identifiers (e.g.‘‘shelf 3’’ \(\to\) [shelf]) via a regex rewriter, stores the resulting template under \(g\) in a lightweight JSON index, and on future tasks of type \(g\)
prepends the template to the backend’s retrieval output (the rewriter degrades to identity on new vocabularies); goal decomposition (a deterministic heuristic, not an MDP action) handles composite tasks requiring the same
primitive twice with two objects (e.g., “put two cellphones on the desk”) by injecting “complete all steps for object 1 first, then repeat for object 2” and additionally retrieving the single-object template when one exists. Both augmentations consume only
the action transcript and concatenate text to the retrieved context, so they are independent of the backend; the component ablation (§4.3, Table [tab:component-ablation]) shows that the learned controller alone already accounts for the majority of MemCon’s gains, making both augmentations useful but optional.
| Interactive (S/A %) | QA (S/A %) | Avg. | ||||||
|---|---|---|---|---|---|---|---|---|
| 3-5 (lr)6-8 Framework | Memory | ALFWorld | PDDL | SciWorld | TriviaQA | WebWalkerQA | GAIA | |
| Lobster | Empty | 43.3 | 33.3 | 28.0 | 69.5 | 17.9 | 20.6 | 35.4 |
| G-Memory | 59.7 | 31.7 | 34.0 | 66.5 | 19.0 | 21.2 | 38.7 | |
| MetaGPT | 55.2 | 33.3 | 33.0 | 71.5 | 18.2 | 16.4 | 37.9 | |
| Voyager | 53.0 | 31.7 | 31.0 | 71.5 | 18.4 | 16.4 | 37.0 | |
| Generative | 54.5 | 31.7 | 36.0 | 69.5 | 18.7 | 18.2 | 38.1 | |
| ChatDev | 32.8 | 28.3 | 24.0 | 69.5 | 17.7 | 18.2 | 31.7 | |
| MemoryBank | 57.5 | 33.3 | 28.0 | 69.5 | 16.3 | 17.6 | 37.0 | |
| OAgent | 48.5 | 28.3 | 34.0 | 70.5 | 17.4 | 19.4 | 36.4 | |
| ExpBank | 59.0 | 33.3 | 30.0 | 69.0 | 17.8 | 20.0 | 38.2 | |
| 67.9 | 35.0 | 38.0 | 71.5 | 20.6 | 22.4 | 42.6 | ||
| LangGraph | Empty | 31.3 | 30.0 | 39.0 | 67.5 | 18.6 | 19.4 | 34.3 |
| G-Memory | 68.7 | 28.3 | 38.0 | 69.0 | 20.9 | 20.0 | 40.8 | |
| MetaGPT | 57.5 | 38.3 | 35.0 | 69.0 | 18.3 | 18.2 | 39.4 | |
| Voyager | 59.7 | 33.3 | 40.0 | 67.5 | 17.5 | 20.0 | 39.7 | |
| Generative | 56.0 | 35.0 | 36.0 | 66.0 | 18.0 | 20.0 | 38.5 | |
| ChatDev | 39.6 | 33.3 | 27.0 | 67.5 | 18.1 | 18.8 | 34.1 | |
| MemoryBank | 57.5 | 31.7 | 29.0 | 70.0 | 18.7 | 18.8 | 37.6 | |
| OAgent | 53.7 | 30.0 | 37.0 | 68.0 | 18.1 | 18.8 | 37.6 | |
| ExpBank | 55.2 | 35.0 | 41.0 | 68.0 | 18.2 | 20.0 | 39.6 | |
| 68.7 | 40.0 | 40.0 | 69.0 | 20.2 | 22.4 | 43.4 | ||
| Agent-FW | Empty | 38.1 | 33.3 | 26.0 | 69.0 | 18.1 | 16.4 | 33.5 |
| G-Memory | 70.2 | 33.3 | 28.0 | 66.0 | 19.4 | 20.0 | 39.5 | |
| MetaGPT | 55.2 | 30.0 | 38.0 | 68.5 | 17.9 | 18.8 | 38.1 | |
| Voyager | 54.5 | 36.7 | 36.0 | 67.5 | 17.1 | 19.4 | 38.5 | |
| Generative | 50.0 | 35.0 | 37.0 | 68.0 | 18.3 | 18.8 | 37.8 | |
| ChatDev | 32.1 | 31.7 | 31.0 | 66.5 | 17.8 | 19.4 | 33.1 | |
| MemoryBank | 59.0 | 33.3 | 30.0 | 69.5 | 18.7 | 16.4 | 37.8 | |
| OAgent | 63.4 | 30.0 | 37.0 | 69.0 | 18.1 | 18.2 | 39.3 | |
| ExpBank | 52.2 | 36.7 | 35.0 | 66.5 | 17.5 | 17.0 | 37.5 | |
| 71.0 | 40.0 | 38.0 | 69.0 | 20.9 | 23.0 | 43.6 | ||
4pt
We design our evaluation to answer four questions: (Q1) Does learned memory control improve over the best fixed-pipeline memory systems, across backends, benchmarks, frameworks, and LLM backbones? (Q2) Does MemCon deliver these gains while using fewer tokens per task, or do the improvements come from simply retrieving more? (Q3) Does MemCon generalize beyond interactive decision-making to QA and web/tool-use settings? (Q4) Is MemCon robust under different LLM backbones, including weaker (GPT-4.1-mini), strong proprietary (Sonnet-4), and open-source (DeepSeek-V3.2) models.
We evaluate on six benchmarks across two regimes, interactive decision-making (ALFWorld [18], PDDL Planning, ScienceWorld [19]) and QA/web/tool-use (TriviaQA [20], WebWalkerQA [21], GAIA [22]), under three agent runners (Lobster, LangGraph [23], Microsoft Agent-Framework) and three LLM backbones (GPT-4.1-mini, Claude Sonnet-4, DeepSeek-V3.2); see Appendix 6 for benchmark sizes, framework descriptions, and the shared task-loader / tool / evaluation protocol. Beyond the no-memory ablation (Empty), we compare against nine memory baselines re-implemented on a shared retrieve/store interface, spanning vector-similarity, summarised-trajectory, LLM-re-ranked, insight-based, latent-token, and graph-structured designs [5], [7]–[10], [17], [24]–[26], [60]; for our reported MemCon numbers the wrapper is plugged into one fixed inner backend (G-Memory [9]) so every comparison shares the same storage layer (the wrapper is backend-agnostic, §3.3). Per-baseline mechanism descriptions and hyperparameter-search details are in Appendix 6; numerical hyperparameter values are in Appendix 8 (Table 5). We report task success rate / answer accuracy as S/A (single deployment run per configuration, no seed averaging); per-task input tokens (Tok) are deferred to Appendix 7.
Table 1 reports S/A on the GPT-4.1-mini backbone in the main paper; per-backbone S/A tables for Sonnet-4 and DeepSeek-V3.2, together with the average per-task token cost, are deferred to Appendix 7 (Tables 2, 3, and 4). Figure 3 visualises the joint S/A vs.token-cost trade-off, and Figure 2 traces two end-to-end episodes through the controller. We highlight four observations corresponding to Q1–Q4.
(Q1) MemCon is consistently the strongest or near-strongest memory. On GPT-4.1-mini (Table 1), MemCon attains the top S/A on 4 of 6 benchmarks under Lobster, 2 under LangGraph, and 3 under Agent-FW, 9 of 18 cells overall, with concrete examples such as \(67.9\%\) ALFWorld (Lobster, the top score among all 10 memories), \(40.0\%\) PDDL (Agent-FW, \(+3.3\) over the strongest fixed-pipeline baseline in that cell), and \(22.4\)–\(23.0\%\) GAIA across frameworks against \(16.4\)–\(21.2\%\) for the rest. On Sonnet-4 (Table 2), where memory quality becomes decisive because the base model is strong enough to execute any sensible plan, MemCon is top S/A on 15 of 18 framework\(\times\)benchmark cells, including the entire interactive block (e.g., \(68.9\%\) Lobster-PDDL vs.\(67.0\%\) best baseline and \(18.0\%\) no-memory; \(67.1\%\) Agent-FW-SciWorld vs.\(66.0\%\) best baseline and \(17.0\%\) no-memory). The three exceptions are narrow (\(\le\!0.4\) points each). On DeepSeek-V3.2 (Table 3), MemCon is top S/A on all 9 interactive cells (e.g., \(86.7\%\) Lobster-ALFWorld vs.\(84.3\%\) next-best) and 15 of 18 cells overall; the GAIA column is the only one where another baseline occasionally edges MemCon by \(0.3\)–\(0.4\) points. Fixed-pipeline baselines are inconsistent across settings (some are strong on a few splits but catastrophically weak elsewhere), whereas MemCon is the only system that is uniformly top-1 or top-2 across all 54 cells.
(Q2) Gains come with token savings, not extra retrieval. A naive explanation of MemCon’s accuracy gains would be “it retrieves more, hence uses more context.” Figure 3 and Table 4 refute this directly: on GPT-4.1-mini Lobster–ALFWorld, MemCon uses \(39\)K tokens per task vs.\(45\)K for the strongest fixed-pipeline baseline (\(-13\%\)) while lifting S/A from \(59.7\%\) to \(67.9\%\); on Agent-FW–ALFWorld it uses \(37\)K vs.\(43\)K (\(-14\%\)) at \(69.4\%\) S/A; on Sonnet-4 Agent-FW–PDDL it uses \(60\)K vs.\(67\)K (\(-10\%\)) at \(70.7\%\) S/A; and on DeepSeek-V3.2 Lobster-ALFWorld it uses \(57\)K vs.\(67\)K (\(-15\%\)) at \(86.7\%\) S/A. Across all three backbones we see simultaneous 5–20% token reductions and accuracy improvements, consistent with the policy learning to suppress retrieval when memory is sparse or irrelevant and to replace nearest-neighbour retrieval with plan injection when a distilled template already exists (§[sec:augmented]).
(Q3) Generalization to QA / web / tool-use benchmarks. MemCon is not specifically designed for question answering, yet the same controller yields improvements on TriviaQA, WebWalkerQA, and GAIA. On GPT-4.1-mini GAIA, MemCon reaches \(22.4\)–\(23.0\%\) across frameworks vs.\(16.4\)–\(20.6\%\) for the no-memory baseline and \(20.0\)–\(21.2\%\) for the strongest fixed-pipeline alternative. On Sonnet-4 GAIA, MemCon attains \(27.5\)–\(28.9\%\), beating the next-best memory by \(3\)–\(12\) points. The relatively flat TriviaQA gaps (a short-answer benchmark where memory is inherently less important) serve as a sanity check that MemCon does not degrade easy settings while it lifts hard ones.
(Q4) Backbone-robust gains, most pronounced under stronger LLMs. Across the three backbones the ordering is consistent: MemCon is competitive-to-dominant under GPT-4.1-mini, strictly dominant under DeepSeek-V3.2 (top S/A on every interactive cell), and most strongly differentiated under Sonnet-4 (top on \(15/18\)). On Sonnet-4 Agent-FW, ALFWorld improves from an Empty baseline of \(12.7\%\) to \(60.6\%\) with MemCon, PDDL from \(21.0\%\) to \(70.7\%\), and ScienceWorld from \(17.0\%\) to \(67.1\%\). With stronger LLM execution, the binding constraint shifts from reasoning capability to whether the right experience is surfaced at the right time, which is precisely what MemCon’s adaptive controller addresses. Figure 2 illustrates this end-to-end on two qualitatively different queries: one where the controller starts in the cold phase and recovers via Re-Retrieve, and one where a learned plan template lets PlanInject solve the task in a single pass.
Overall, these results support the central claim of the paper: replacing a fixed memory pipeline with a lightweight learned controller yields consistent, framework-/benchmark-/backbone-agnostic accuracy gains, and does so with fewer rather than more tokens.
We probe two questions: (i) how sensitive is MemCon to each policy hyperparameter, and (ii) how much of MemCon’s gain over the underlying static-pipeline backend comes from the learned controller versus the two augmented memory operations of §[sec:augmented]? We answer (i) with a single-knob sweep (Figures 4–[fig:hp-ablation-bottom]) and (ii) with a four-row component ablation (Table [tab:component-ablation]).
The component ablation (Table [tab:component-ablation]) addresses a confound flagged in earlier reviews: most of the GPT-4.1-mini Lobster-ALFWorld gain over the static-pipeline backend is attributable to the learned UCB controller (\(+5.2\) S/A) rather than to the two augmented operations (\(+1.5\) each). On GAIA, which contains no composite goals of the form targeted by goal decomposition, only the learned controller contributes (\(+1.2\) S/A); the augmented operations add no accuracy because they simply have no opportunity to fire. This confirms that the central methodological contribution (learning when, what, and how much to retrieve) is the dominant source of the empirical gains, and that the augmented operations are useful but optional add-ons whose benefit is restricted to environments with structured composite goals.
We introduced MemCon, a backend-agnostic framework that treats agent memory not as a fixed retrieval pipeline, but as a controlled decision process. By modeling memory operations as actions in a Memory MDP and learning a lightweight online UCB policy, MemCon adaptively decides when to retrieve, reuse plans, re-retrieve, consolidate, or skip memory access without requiring pretraining or additional LLM calls. Across interactive, QA, web, and tool-use benchmarks, MemCon consistently improves task success across multiple agent frameworks and LLM backbones while also reducing token consumption. These results suggest that effective long-term memory for LLM agents depends not only on what is stored, but also on learning how memory should be accessed and managed over time.
This appendix expands the abbreviated description in §4.1 with full benchmark sizes, framework descriptions, baseline mechanisms, and the hyperparameter-search protocol.
ALFWorld [18] contains 134 household tasks across 6 types (put, clean, heat, cool, examine, puttwo); it couples a TextWorld front-end with embodied AI2-THOR back-ends. PDDL Planning consists of 100 classical planning tasks spanning blocksworld, barman, gripper, tyreworld, closely related to PlanBench [64]–[66]. ScienceWorld [19] contains 100 elementary-science experimental tasks (boiling water, melting ice, finding animals by property, etc.).
TriviaQA [20] (200 questions, short-answer open-domain QA); WebWalkerQA [21] (200 multi-hop web traversal questions requiring site navigation and information extraction); GAIA [22] (165 general-AI-assistant questions spanning tool use, web search, and document reading).
We use three architecturally distinct agent runners, each sharing identical task loaders, tools, and evaluation protocol so that the only varying factor across baselines is the memory system: Lobster, a single-agent minimalist runner that talks to the OpenAI-compatible chat API directly; LangGraph [23], a graph-structured multi-agent workflow built on LangChain; and Microsoft Agent-Framework, a pipeline-based multi-agent system. All experiments use a 30-step horizon for interactive tasks and the benchmark-default budget for QA, with the same temperature and tool protocol across memory baselines.
Beyond the no-memory ablation (Empty), we compare against nine memory systems re-implemented on a shared two-method (retrieve/store) interface so that differences are purely algorithmic rather than due to prompt or I/O variation: (1) MetaGPT [24]: pure vector similarity retrieval over stored trajectories, no LLM calls at retrieval time; (2) Voyager [8]: LLM summarises each trajectory before storage, retrieval by cosine similarity over summarised embeddings; (3) Generative [5]: retrieves candidate trajectories and uses an LLM to re-rank them by estimated relevance; (4) ChatDev [25]: periodic LLM-driven phase-based summarisation every 10 steps; no cross-task retrieval; (5) MemoryBank [17]: temporal-decay memory with Ebbinghaus-style exponential forgetting on top of vector retrieval; (6) OAgents [26]: insight-based learning that compares paired successful/failed trials to distil and edit natural-language rules; (7) ExperienceBank: LLM-scored relevance retrieval with generative re-ranking over an explicit experience bank [7], [60]; (8) LatentMem [10]: distils cross-task experience into a small bank of learnable latent tokens, paired with a graph-based retrieval front-end and LatentMem-specific insight prompts; (9) G-Memory [9]: a graph-structured memory combining vector retrieval, a task graph with \(k\)-hop traversal, and scored insight rules with periodic LLM-driven merge.
For our reported MemCon numbers we plug the wrapper into one specific backend (G-Memory) so that every MemCon–baseline comparison is held fixed at the inner storage layer; because the wrapper is backend-agnostic (§3.3), it could equally be composed with any of the other eight, and we expect the qualitative trend (controller adds adaptivity at zero LLM cost) to transfer.
MemCon uses the default 9-action set (§3.1), warm-start enabled with the priors of §3.2, and the reward shape of Eq. 3 . The three policy hyperparameters \((\alpha,\gamma,c)\) are selected per backbone via a small grid search on a held-out 30-task subset of ALFWorld (Lobster), independent of the evaluation tasks; warm-start priors, reward constants, and discretisation thresholds are fixed across backbones. All numerical values are listed in Appendix 8 (Table 5). The Q-table and success-plan index are persisted to disk and reloaded across runs; experiments use a single realistic deployment run per configuration (no seed averaging) to reflect the online setting.
This appendix reports the full per-backbone S/A tables for the two backbones omitted from the main paper (Claude Sonnet-4 and DeepSeek-V3.2) and provides the average per-task token cost (Tok) accompanying each S/A entry, for all three backbones.
| Interactive (S/A %) | QA (S/A %) | Avg. | ||||||
|---|---|---|---|---|---|---|---|---|
| 3-5 (lr)6-8 Framework | Memory | ALFWorld | PDDL | SciWorld | TriviaQA | WebWalkerQA | GAIA | |
| Lobster | Empty | 14.2 | 18.0 | 19.0 | 81.5 | 17.1 | 24.2 | 29.0 |
| G-Memory | 31.3 | 58.0 | 25.0 | 82.0 | 16.3 | 20.6 | 38.9 | |
| MetaGPT | 6.7 | 8.0 | 12.0 | 82.5 | 15.9 | 24.9 | 25.0 | |
| Voyager | 10.4 | 14.0 | 10.0 | 81.5 | 16.7 | 24.9 | 26.3 | |
| Generative | 6.7 | 15.0 | 15.0 | 81.5 | 16.4 | 25.4 | 26.7 | |
| ChatDev | 11.9 | 17.0 | 14.0 | 81.5 | 16.6 | 26.7 | 28.0 | |
| MemoryBank | 9.0 | 12.0 | 8.0 | 81.5 | 16.5 | 22.4 | 24.9 | |
| OAgent | 28.4 | 42.0 | 27.0 | 81.5 | 17.4 | 24.2 | 36.8 | |
| ExpBank | 5.2 | 11.0 | 5.0 | 81.5 | 16.2 | 23.6 | 23.8 | |
| LatentMem | 30.6 | 67.0 | 82.0 | 81.5 | 15.8 | 17.6 | 49.1 | |
| 32.3 | 68.9 | 81.6 | 84.4 | 19.4 | 27.5 | 52.4 | ||
| LangGraph | Empty | 17.2 | 15.0 | 20.0 | 82.5 | 15.9 | 25.4 | 29.3 |
| G-Memory | 46.3 | 33.0 | 37.0 | 81.5 | 17.4 | 19.4 | 39.1 | |
| MetaGPT | 16.4 | 24.0 | 21.0 | 83.0 | 15.4 | 23.0 | 30.5 | |
| Voyager | 22.4 | 22.0 | 33.0 | 82.5 | 17.1 | 25.4 | 33.7 | |
| Generative | 17.9 | 26.0 | 31.0 | 82.0 | 16.6 | 21.8 | 32.6 | |
| ChatDev | 12.7 | 28.0 | 20.0 | 82.5 | 16.1 | 22.4 | 30.3 | |
| MemoryBank | 26.9 | 25.0 | 39.0 | 82.0 | 15.8 | 22.4 | 35.2 | |
| OAgent | 53.0 | 33.0 | 58.0 | 80.5 | 16.9 | 17.6 | 43.2 | |
| ExpBank | 17.9 | 22.0 | 21.0 | 82.0 | 16.3 | 23.0 | 30.4 | |
| LatentMem | 53.7 | 61.0 | 68.0 | 82.5 | 18.0 | 23.0 | 51.0 | |
| 55.4 | 63.2 | 69.3 | 82.8 | 19.2 | 28.0 | 53.0 | ||
| Agent-FW | Empty | 12.7 | 21.0 | 17.0 | 83.0 | 17.1 | 21.8 | 28.8 |
| G-Memory | 20.9 | 23.0 | 33.0 | 81.5 | 17.5 | 18.8 | 32.5 | |
| MetaGPT | 15.7 | 19.0 | 19.0 | 81.0 | 17.5 | 23.6 | 29.3 | |
| Voyager | 10.4 | 14.0 | 14.0 | 81.0 | 9.5 | 24.9 | 25.6 | |
| Generative | 20.2 | 20.0 | 26.0 | 82.0 | 17.2 | 26.1 | 31.9 | |
| ChatDev | 12.7 | 16.0 | 19.0 | 82.0 | 15.6 | 22.4 | 28.0 | |
| MemoryBank | 11.9 | 20.0 | 20.0 | 81.5 | 17.5 | 23.6 | 29.1 | |
| OAgent | 23.9 | 30.0 | 28.0 | 81.5 | 10.2 | 23.6 | 32.9 | |
| ExpBank | 6.0 | 6.0 | 7.0 | 82.0 | 16.4 | 24.2 | 23.6 | |
| LatentMem | 58.2 | 70.0 | 66.0 | 81.5 | 15.1 | 16.4 | 51.2 | |
| 60.6 | 70.7 | 67.1 | 84.3 | 17.1 | 28.9 | 54.8 | ||
4pt
| Interactive (S/A %) | QA (S/A %) | Avg. | ||||||
|---|---|---|---|---|---|---|---|---|
| 3-5 (lr)6-8 Framework | Memory | ALFWorld | PDDL | SciWorld | TriviaQA | WebWalkerQA | GAIA | |
| Lobster | Empty | 64.2 | 63.0 | 67.0 | 75.5 | 17.6 | 28.5 | 52.6 |
| G-Memory | 79.8 | 69.0 | 77.0 | 73.5 | 18.5 | 24.9 | 57.1 | |
| MetaGPT | 75.4 | 73.0 | 76.0 | 73.0 | 18.0 | 27.9 | 57.2 | |
| Voyager | 84.3 | 78.0 | 86.0 | 72.0 | 19.0 | 27.3 | 61.1 | |
| Generative | 82.8 | 79.0 | 88.0 | 73.5 | 21.0 | 25.4 | 61.6 | |
| ChatDev | 64.9 | 69.0 | 69.0 | 71.5 | 19.0 | 29.1 | 53.8 | |
| MemoryBank | 81.3 | 81.0 | 84.0 | 75.5 | 20.1 | 27.3 | 61.5 | |
| OAgent | 82.8 | 76.0 | 84.0 | 67.0 | 17.2 | 27.3 | 59.1 | |
| ExpBank | 76.9 | 73.0 | 78.0 | 75.0 | 18.5 | 26.7 | 58.0 | |
| LatentMem | 77.6 | 72.0 | 80.0 | 71.0 | 17.2 | 29.9 | 58.0 | |
| 86.7 | 83.6 | 90.2 | 77.8 | 22.0 | 29.6 | 65.0 | ||
| LangGraph | Empty | 66.4 | 63.0 | 66.0 | 71.5 | 18.9 | 21.8 | 51.3 |
| G-Memory | 84.3 | 79.0 | 83.0 | 71.5 | 16.4 | 29.1 | 60.6 | |
| MetaGPT | 88.8 | 75.0 | 85.0 | 72.5 | 19.3 | 30.3 | 61.8 | |
| Voyager | 80.6 | 74.0 | 80.0 | 73.5 | 18.1 | 27.3 | 58.9 | |
| Generative | 79.8 | 68.0 | 80.0 | 71.5 | 19.5 | 26.1 | 57.5 | |
| ChatDev | 64.2 | 71.0 | 62.0 | 76.0 | 19.4 | 28.5 | 53.5 | |
| MemoryBank | 84.3 | 80.0 | 88.0 | 70.5 | 17.2 | 28.5 | 61.4 | |
| OAgent | 88.8 | 79.0 | 91.0 | 69.5 | 18.1 | 26.7 | 62.2 | |
| ExpBank | 82.1 | 70.0 | 78.0 | 72.5 | 17.7 | 28.5 | 58.1 | |
| LatentMem | 86.6 | 74.0 | 85.0 | 70.5 | 17.9 | 33.1 | 61.2 | |
| 89.8 | 82.2 | 94.0 | 77.5 | 22.5 | 32.8 | 66.5 | ||
| Agent-FW | Empty | 62.7 | 68.0 | 68.0 | 72.0 | 19.9 | 27.3 | 53.0 |
| G-Memory | 77.6 | 69.0 | 80.0 | 71.0 | 20.5 | 15.8 | 55.7 | |
| MetaGPT | 81.3 | 75.0 | 83.0 | 75.0 | 17.9 | 24.9 | 59.5 | |
| Voyager | 81.3 | 83.0 | 86.0 | 73.5 | 18.1 | 27.3 | 61.5 | |
| Generative | 80.6 | 80.0 | 83.0 | 74.0 | 18.6 | 24.9 | 60.2 | |
| ChatDev | 61.9 | 63.0 | 65.0 | 73.5 | 18.3 | 17.0 | 49.8 | |
| MemoryBank | 82.8 | 83.0 | 88.0 | 74.0 | 19.4 | 27.9 | 62.5 | |
| OAgent | 82.1 | 74.0 | 85.0 | 74.5 | 16.6 | 25.4 | 59.6 | |
| ExpBank | 80.6 | 82.0 | 87.0 | 72.5 | 19.1 | 25.4 | 61.1 | |
| LatentMem | 83.6 | 76.0 | 89.0 | 75.0 | 16.4 | 31.4 | 61.9 | |
| 85.4 | 84.2 | 91.3 | 77.8 | 21.5 | 31.0 | 65.2 | ||
4pt
Table 4 reports the average number of LLM-input tokens consumed per task for the GPT-4.1-mini main results (numbers for the other two backbones are available in the released code; trends are qualitatively identical). The token-cost vs.S/A trade-off is summarized visually in Figure 3 of the main paper.
| Interactive (Tok) | QA (Tok) | Avg. | ||||||
|---|---|---|---|---|---|---|---|---|
| 3-5 (lr)6-8 Framework | Memory | ALFWorld | PDDL | SciWorld | TriviaQA | WebWalkerQA | GAIA | |
| Lobster | Empty | 44K | 98K | 31K | 58 | 153 | 377 | 29K |
| G-Memory | 45K | 155K | 44K | 288 | 459 | 703 | 41K | |
| MetaGPT | 48K | 154K | 33K | 57 | 157 | 421 | 39K | |
| Voyager | 48K | 154K | 39K | 56 | 154 | 407 | 40K | |
| Generative | 48K | 148K | 34K | 57 | 155 | 382 | 38K | |
| ChatDev | 49K | 102K | 32K | 57 | 153 | 395 | 31K | |
| MemoryBank | 44K | 143K | 38K | 57 | 151 | 404 | 38K | |
| OAgent | 52K | 162K | 36K | 146 | 244 | 566 | 42K | |
| ExpBank | 44K | 154K | 44K | 57 | 154 | 399 | 40K | |
| 39K | 148K | 31K | 58 | 164 | 440 | 36K | ||
| LangGraph | Empty | 51K | 101K | 31K | 57 | 152 | 406 | 31K |
| G-Memory | 42K | 157K | 42K | 267 | 434 | 720 | 40K | |
| MetaGPT | 49K | 156K | 41K | 57 | 156 | 398 | 41K | |
| Voyager | 47K | 145K | 38K | 57 | 155 | 387 | 38K | |
| Generative | 49K | 154K | 42K | 57 | 154 | 384 | 41K | |
| ChatDev | 46K | 100K | 33K | 56 | 154 | 411 | 30K | |
| MemoryBank | 47K | 137K | 36K | 57 | 154 | 410 | 37K | |
| OAgent | 51K | 161K | 38K | 242 | 309 | 477 | 42K | |
| ExpBank | 45K | 160K | 42K | 57 | 154 | 395 | 41K | |
| 41K | 142K | 32K | 61 | 172 | 456 | 36K | ||
| Agent-FW | Empty | 46K | 102K | 33K | 57 | 154 | 407 | 30K |
| G-Memory | 43K | 154K | 41K | 300 | 428 | 691 | 40K | |
| MetaGPT | 46K | 168K | 37K | 57 | 152 | 407 | 42K | |
| Voyager | 49K | 140K | 37K | 57 | 152 | 411 | 38K | |
| Generative | 49K | 164K | 39K | 56 | 150 | 356 | 42K | |
| ChatDev | 49K | 100K | 32K | 56 | 152 | 405 | 30K | |
| MemoryBank | 42K | 143K | 44K | 57 | 151 | 389 | 38K | |
| OAgent | 44K | 157K | 38K | 222 | 236 | 470 | 40K | |
| ExpBank | 46K | 158K | 38K | 56 | 154 | 393 | 40K | |
| 37K | 111K | 33K | 56 | 186 | 462 | 30K | ||
4pt
This appendix lists the full set of hyperparameters used by MemCon across all experiments. Table 5 consolidates every numeric constant referenced in §3–§4 into one place; Table 6 gives the structural action set \(\mathcal{A}\) which has a different layout. All values are taken directly from the released implementation, and the same defaults are used for every number reported in the main paper unless otherwise noted.
| Symbol | GPT-4.1-mini | Sonnet-4 | DeepSeek-V3.2 | Description |
|---|---|---|---|---|
| Policy hyperparameters (per backbone, used in Eqs. [eq:ucb-rule-main], [eq:q-update]) | ||||
| \(\alpha\) (step size) | \(0.15\) | \(0.12\) | \(0.18\) | Q-learning step size |
| \(\gamma\) (discount) | \(0.9\) | \(0.92\) | \(0.88\) | Within-episode discount factor for reverse credit assignment |
| \(c\) (UCB coeff.) | \(1.4\) | \(1.2\) | \(1.6\) | UCB exploration coefficient |
| warm-start | enabled | enabled | enabled | Initialise unseen \((s,a)\) with priors below |
| Warm-start priors \(Q_0(s,a)\) for unseen \((s,a)\) (same across backbones) | ||||
| Retrieve | \(+0.5\) | retrieval is usually helpful | ||
| PlanInject | \(+0.3\) | plans help when available | ||
| Re-Retrieve | \(+0.1\) | useful only when stuck | ||
| Consolidate | \(\phantom{+}0.0\) | neutral | ||
| Forget | \(-0.1\) | mildly risky | ||
| NoOp | \(-0.2\) | doing nothing usually hurts | ||
| Reward shape (Eq. [eq:reward]) | ||||
| \(r_{\text{succ}}\) | \(1.0\) | success bonus | ||
| \(r_{\text{fail}}\) | \(0.5\) | failure penalty (subtracted) | ||
| \(\lambda\) | \(0.3\) | efficiency-bonus weight | ||
| \(T_{\max}\) | \(30\) steps (interactive); benchmark default (QA) | step horizon | ||
| State discretisation bins \(\phi(s)\) (used in \(\phi\) for tabular Q) | ||||
| step_phase | early (\(<\!8\)), mid (\(8\)–\(17\)), late (\(\ge\!18\)) | step-count bin for \(s^{\text{task}}\) | ||
| learning_phase | cold (task index \(\le\!15\)); warm (task index \(>\!15\)) | task-index bin for \(s^{\text{mem}}\) | ||
| is_stuck trigger | \(2\) consecutive identical actions | sets the stuck flag | ||
| held-objects bin | \(\min(hold, 2)\) | cap on objects-held count | ||
| locations bin | \(\min(\lfloor visited/3\rfloor, 4)\) | coarse unique-location bin | ||
| mem-size bin | \(\min(\lfloor mem\_size/10\rfloor, 5)\) | coarse memory-size bin | ||
| Persistence and runtime | ||||
| persist_path | ./memcon/policy_q.json | Q-table file | ||
| flush interval | every \(5\) updates | Q-table write frequency | ||
| LLM temperature | \(0\) (interactive); benchmark default (QA) | sampling temperature | ||
| seed averaging | none (single deployment run per cell) | matches online-deployment setting | ||
The MDP state key used by the controller is \[\label{eq:phi} \begin{align} \phi(s) = \langle\,& \texttt{goal\_type},\, \texttt{step\_phase},\, \texttt{is\_stuck},\, \min(\texttt{hold},2),\, \min(\lfloor\texttt{visited}/3\rfloor,4), \\ & \min(\lfloor\texttt{mem\_size}/10\rfloor,5),\, \texttt{plan\_available},\, \texttt{learning\_phase} \,\rangle . \end{align}\tag{6}\] with the bin definitions in Table 5. This coarse discretisation yields on the order of a few hundred distinct state keys per benchmark and enables tabular learning in tens of tasks.
Table 6 lists the structural action set \(\mathcal{A}\) used in all main-paper experiments (preset "default"). Additional presets ("retrieval_heavy",
"plan_first", "compact") are available in the released code; the action-preset ablation in §4.3 (right panel of Figure [fig:hp-ablation-bottom]) shows that the default preset wins on both QA benchmarks.
| Idx | Operation | top_k | insight_k | hop |
|---|---|---|---|---|
| 0 | Retrieve (shallow) | 1 | 3 | 1 |
| 1 | Retrieve (medium) | 2 | 5 | 1 |
| 2 | Retrieve (deep) | 3 | 8 | 2 |
| 3 | PlanInject | 1 | 3 | – |
| 4 | Re-Retrieve (alt.query) | 2 | 5 | 2 |
| 5 | Consolidate | – | – | – |
| 6 | Forget | – | – | – |
| 7 | Retrieve (insight-only) | 1 | 2 | 0 |
| 8 | NoOp | – | – | – |
Agent frameworks use their default configurations, modified only to share identical task loaders and evaluators. Interactive benchmarks: ALFWorld (134 tasks, 6 types), PDDL (100 tasks across blocksworld/barman/gripper/tyreworld), ScienceWorld (100 tasks). QA benchmarks: TriviaQA (200 questions), WebWalkerQA (200), GAIA (165). Each reported number is a single realistic deployment run, with the Q-table persisted across tasks; LLM temperature, run protocol, and seed handling follow the values listed in Table 5.
This appendix formalizes and proves the learning guarantees of MemCon. We show that (i) the Memory MDP decomposes into a family of per-state stochastic bandits (Lemma 1); (ii) the UCB rule used in MemCon admits a sub-Gaussian concentration inequality (Lemma 2) yielding an \(O(\log n)\) per-state regret (Theorem 1) and an \(O(|\Phi||\mathcal{A}|\log T)\) global regret (Corollary 1); (iii) the reverse-discounted Q-update is a Robbins–Monro stochastic approximation whose iterates converge almost surely (Theorem 3) and in \(L^2\) (Proposition 4) to the true action value; and (iv) the greedy policy extracted from \(Q\) is asymptotically optimal (Theorem 6). All results are stated and proved from first principles; standard references are [].
Definition 1 (Memory MDP). The Memory MDP of MemCon is the tuple \(\mathcal{M}_{\mathrm{mem}} = (\mathcal{S},\mathcal{A},\mathcal{T},\mathcal{R},\gamma)\) with finite discretized state space \(\Phi := \phi(\mathcal{S})\), finite action space \(\mathcal{A}\) with \(|\mathcal{A}|=9\), deterministic (but black-box) transition \(\mathcal{T}:\Phi\times\mathcal{A}\to\Phi\), bounded reward kernel \(\mathcal{R}:\Phi\times\mathcal{A}\to\mathcal{P}([r_{\min},r_{\max}])\) with \(r_{\min}=-0.5\) and \(r_{\max}=r_{\mathrm{succ}}+\lambda=1.3\), and within-episode discount \(\gamma=0.9\).
Definition 2 (Per-state arm distribution). For each \((\phi,a)\in\Phi\times\mathcal{A}\), let \[\mathcal{D}_{\phi,a} \;:=\; \operatorname{Law}\!\left(\gamma^{|\mathrm{ep}|-j-1}\cdot r_i \;\middle|\; \phi_j=\phi,\,a_j=a\right), \qquad \mu(\phi,a) \;:=\; \mathbb{E}_{G\sim\mathcal{D}_{\phi,a}}[G].\] Let \(a^\star(\phi) := \arg\max_{a\in\mathcal{A}}\mu(\phi,a)\) be the optimal arm at \(\phi\), and define the sub-optimality gap \[\Delta(\phi,a) \;:=\; \mu(\phi,a^\star(\phi)) - \mu(\phi,a) \;\ge\; 0, \qquad \Delta_{\min} \;:=\; \min_{\phi\in\Phi}\;\min_{a:\Delta(\phi,a)>0}\Delta(\phi,a).\]
Assumption 1 (Conditional stationarity). For every \((\phi,a)\in\Phi\times\mathcal{A}\), the distribution \(\mathcal{D}_{\phi,a}\) is time-invariant, and draws across episodes are conditionally independent given \((\phi,a)\).
Assumption 2 (Bounded reward). Every draw \(G\sim\mathcal{D}_{\phi,a}\) satisfies \(G\in[G_{\min},G_{\max}]\subset\mathbb{R}\) with \(W := G_{\max}-G_{\min} \le r_{\max}-\gamma^{|\mathrm{ep}|-1}r_{\min} \le 1.8\).
Definition 3 (Visit counts, empirical mean, pseudo-regret). Write \(N_a^{(t)}(\phi)\) for the number of times action \(a\) was taken at \(\phi\) through decision \(t\), and \(N^{(t)}(\phi):=\sum_{a\in\mathcal{A}}N_a^{(t)}(\phi)\). The empirical mean of arm \((\phi,a)\) after \(N_a^{(t)}(\phi)\) pulls is \[\hat{\mu}_t(\phi,a) \;:=\; \frac{1}{N_a^{(t)}(\phi)} \sum_{s\le t:\,\phi_s=\phi,\,a_s=a} G_s.\] The per-state pseudo-regret after \(n\) pulls at \(\phi\) is \[\mathcal{R}_n(\phi) \;:=\; n\cdot\mu(\phi,a^\star(\phi)) \;-\; \sum_{t=1}^{n}\mu(\phi,a_t) \;=\; \sum_{a\in\mathcal{A}} N_a^{(n)}(\phi)\,\Delta(\phi,a).\] The global pseudo-regret after \(T\) decisions is \(\mathcal{R}_T := \sum_{\phi\in\Phi}\mathcal{R}_{N^{(T)}(\phi)}(\phi)\).
Lemma 1 (Bandit decomposition of \(\mathcal{M}_{\mathrm{mem}}\)). Under Assumption 1, the expected cumulative pseudo-regret of any policy \(\pi\) on \(\mathcal{M}_{\mathrm{mem}}\) satisfies \[\mathbb{E}\!\left[\mathcal{R}_T(\pi)\right] \;=\; \sum_{\phi\in\Phi} \mathbb{E}\!\left[\mathcal{R}_{N^{(T)}(\phi)}(\phi;\pi)\right] \;=\; \sum_{\phi\in\Phi}\sum_{a\in\mathcal{A}} \mathbb{E}\!\left[N_a^{(T)}(\phi)\right]\,\Delta(\phi,a).\]
Proof. Write \(\mathbb{1}\{\cdot\}\) for the indicator function, and let \(\mathcal{F}_{t-1}\) denote the \(\sigma\)-algebra generated by \((\phi_s,a_s,G_s)_{s<t}\). By Definition 3, the random pseudo-regret after \(T\) decisions is \[\label{eq:decomp-regret-def} \mathcal{R}_T(\pi) \;=\; \sum_{t=1}^{T}\bigl[\mu(\phi_t, a^\star(\phi_t)) - \mu(\phi_t, a_t)\bigr] \;=\; \sum_{t=1}^{T}\sum_{\phi\in\Phi}\sum_{a\in\mathcal{A}} \mathbb{1}\{\phi_t=\phi, a_t=a\}\,\Delta(\phi,a),\tag{7}\] where we have rewritten \(\mu(\phi_t,a^\star(\phi_t))-\mu(\phi_t,a_t)\) by summing over the finitely many possible values of \((\phi_t,a_t)\) (exactly one indicator is non-zero at each \(t\)).
Taking expectations on both sides of 7 and swapping sums by Fubini’s theorem (all quantities are non-negative and finite since \(|\Phi|,|\mathcal{A}|<\infty\) and \(T<\infty\)): \[\begin{align} \mathbb{E}\!\left[\mathcal{R}_T(\pi)\right] &\;=\; \mathbb{E}\!\left[\sum_{\phi,a}\sum_{t=1}^{T}\mathbb{1}\{\phi_t=\phi, a_t=a\}\,\Delta(\phi,a)\right] \nonumber \\ &\;=\; \sum_{\phi\in\Phi}\sum_{a\in\mathcal{A}}\Delta(\phi,a)\;\mathbb{E}\!\left[\sum_{t=1}^{T}\mathbb{1}\{\phi_t=\phi, a_t=a\}\right] \nonumber \\ &\;=\; \sum_{\phi\in\Phi}\sum_{a\in\mathcal{A}}\Delta(\phi,a)\,\mathbb{E}\!\left[N_a^{(T)}(\phi)\right], \label{eq:decomp-regret-final} \end{align}\tag{8}\] where the last equality uses the definition \(N_a^{(T)}(\phi)=\sum_{t=1}^T\mathbb{1}\{\phi_t=\phi,a_t=a\}\).
The first equality in the statement follows from regrouping the inner double sum by \(\phi\): for each fixed \(\phi\), the contribution of that state to \(\mathbb{E}[\mathcal{R}_T]\) is \(\sum_a\Delta(\phi,a)\,\mathbb{E}[N_a^{(T)}(\phi)]=\mathbb{E}[\mathcal{R}_{N^{(T)}(\phi)}(\phi;\pi)]\), by the per-state identity in Definition 3 together with Assumption 1 (the per-state gaps \(\Delta(\phi,a)\) are deterministic functions of \(\phi\), not of the history). ◻
Lemma 1 reduces the Memory MDP to \(|\Phi|\) independent stochastic bandits and allows us to upper-bound \(\mathcal{R}_T\) state by state.
Lemma 2 (Hoeffding concentration, per-state). Fix \((\phi,a)\in\Phi\times\mathcal{A}\). Under Assumptions 1–2, for any \(\varepsilon>0\) and any \(m\in\mathbb{N}_{>0}\), \[\label{eq:hoeffding} \Pr\!\left[\,\left|\hat{\mu}_t(\phi,a) - \mu(\phi,a)\right| \ge \varepsilon \;\middle|\; N_a^{(t)}(\phi) = m\,\right] \;\le\; 2\exp\!\left(-\frac{2m\varepsilon^2}{W^2}\right).\tag{9}\]
Proof. Condition on the event \(\{N_a^{(t)}(\phi)=m\}\) and enumerate the \(m\) visit times \(\tau_1<\tau_2<\cdots<\tau_m\le t\) at which \((\phi_{\tau_i},a_{\tau_i})=(\phi,a)\). Let \(G_i := G_{\tau_i}\sim \mathcal{D}_{\phi,a}\) be the corresponding returns. By Assumption 1, \(\{G_i\}_{i=1}^m\) are i.i.d.with common mean \(\mu(\phi,a)\) and by Assumption 2 each \(G_i\in[G_{\min},G_{\max}]\) with \(G_{\max}-G_{\min}=W\). The empirical mean on this event is \[\hat{\mu}_t(\phi,a) \;=\; \frac{1}{m}\sum_{i=1}^{m} G_i.\]
Step 1 (moment generating function bound). For every \(\lambda\in\mathbb{R}\) and every \(i\), Hoeffding’s lemma (see Lemma 2.2 in []) applied to the bounded variable \(Z_i := G_i-\mu(\phi,a) \in [G_{\min}-\mu, G_{\max}-\mu]\) (an interval of width \(W\)) gives \[\label{eq:mgf-bound} \mathbb{E}\!\left[\exp(\lambda Z_i)\right] \;\le\; \exp\!\left(\lambda^2 W^2/8\right).\tag{10}\] The standard derivation of 10 proceeds by convexity: for \(G_i\in[G_{\min},G_{\max}]\) we may write \(G_i = \theta G_{\min}+(1-\theta)G_{\max}\) with \(\theta:=(G_{\max}-G_i)/W\in[0,1]\), so that \[e^{\lambda Z_i} \;\le\; \theta\, e^{\lambda(G_{\min}-\mu)} + (1-\theta)\, e^{\lambda(G_{\max}-\mu)}.\] Taking expectations and optimizing the resulting exponent over the (log of the) centered mgf yields 10 .
Step 2 (Chernoff–upper tail). By independence of \(\{Z_i\}\) and 10 , \[\begin{align} \Pr\!\left[\hat{\mu}_t(\phi,a)-\mu(\phi,a) \ge \varepsilon \mid N_a^{(t)}(\phi)=m\right] &\;=\; \Pr\!\left[\sum_{i=1}^{m} Z_i \ge m\varepsilon\right] \nonumber \\ &\;\le\; e^{-\lambda m\varepsilon}\,\mathbb{E}\!\left[\exp\!\left(\lambda\textstyle\sum_i Z_i\right)\right] \qquad (\text{Markov}) \nonumber \\ &\;=\; e^{-\lambda m\varepsilon}\prod_{i=1}^{m}\mathbb{E}\!\left[e^{\lambda Z_i}\right] \nonumber \\ &\;\le\; \exp\!\left(-\lambda m\varepsilon + m\lambda^2 W^2/8\right). \label{eq:chernoff} \end{align}\tag{11}\] Minimizing the right-hand side of 11 over \(\lambda>0\) gives \(\lambda^\star = 4\varepsilon/W^2\), so \[\label{eq:upper-tail} \Pr\!\left[\hat{\mu}_t(\phi,a)-\mu(\phi,a) \ge \varepsilon \mid N_a^{(t)}(\phi)=m\right] \;\le\; \exp\!\left(-\frac{2m\varepsilon^2}{W^2}\right).\tag{12}\]
Step 3 (two-sided bound). Applying 12 to \(\{-Z_i\}\) in place of \(\{Z_i\}\) (which is also i.i.d.with bounded support of width \(W\)) yields the symmetric lower-tail bound \[\Pr\!\left[\mu(\phi,a)-\hat{\mu}_t(\phi,a) \ge \varepsilon \mid N_a^{(t)}(\phi)=m\right] \;\le\; \exp\!\left(-\frac{2m\varepsilon^2}{W^2}\right).\] A union bound over the two tails gives 9 . ◻
Setting \(\varepsilon = c\sqrt{\ln N^{(t)}(\phi) / m}\) with \(c=W/\sqrt{2}\) in 9 gives the familiar UCB confidence radius: \[\label{eq:ucb-radius} \Pr\!\left[\,\left|\hat{\mu}_t(\phi,a) - \mu(\phi,a)\right| \ge c\sqrt{\tfrac{\ln N^{(t)}(\phi)}{m}}\,\right] \;\le\; 2\,\bigl(N^{(t)}(\phi)\bigr)^{-4}.\tag{13}\]
MemCon selects actions by maximizing the upper-confidence index \[\label{eq:ucb-rule} a_t \;\in\; \arg\max_{a\in\mathcal{A}}\;\underbrace{\left[\; \hat{\mu}_t(\phi_t,a) \;+\; c\sqrt{\tfrac{\ln N^{(t)}(\phi_t)}{N_a^{(t)}(\phi_t)}}\;\right]}_{=:\;U_t(\phi_t,a)}, \qquad c=1.4 \approx W/\sqrt{2}.\tag{14}\]
Theorem 1 (Per-state UCB1 regret). Under Assumptions 1–2, running the UCB rule 14 at state \(\phi\) for \(n\) pulls yields \[\label{eq:ucb-regret} \mathbb{E}\bigl[\mathcal{R}_n(\phi)\bigr] \;\le\; \underbrace{\sum_{a:\Delta(\phi,a)>0}\frac{8W^2\,\ln n}{\Delta(\phi,a)}}_{\text{logarithmic term}} \;+\; \underbrace{\left(1+\tfrac{\pi^2}{3}\right)\!\!\sum_{a\in\mathcal{A}}\Delta(\phi,a)}_{\text{constant term}}.\tag{15}\] In particular, \(\mathbb{E}[\mathcal{R}_n(\phi)] \in \mathcal{O}\!\left(|\mathcal{A}|\,W^2\,\log n / \Delta_{\min}\right)\), i.e., logarithmic in \(n\).
Proof. Throughout the proof we drop the dependence on \(\phi\) from the notation (we are analyzing a single fixed state) and write \(N_a(t):=N_a^{(t)}(\phi)\), \(N(t):=N^{(t)}(\phi)\), \(\hat{\mu}_a(t):=\hat{\mu}_t(\phi,a)\), \(\mu_a:=\mu(\phi,a)\), \(\Delta_a:=\Delta(\phi,a)\). Let \(a^\star:=a^\star(\phi)\). The goal is to upper-bound \(\mathbb{E}[N_a(n)]\) for each sub-optimal arm \(a\); by Definition 3, \(\mathbb{E}[\mathcal{R}_n(\phi)] = \sum_{a:\Delta_a>0}\Delta_a\,\mathbb{E}[N_a(n)]\).
Step 1 (three-event decomposition). Fix a sub-optimal arm \(a\) with \(\Delta_a>0\) and a threshold \[\label{eq:u-threshold} u \;:=\; \left\lceil \frac{8W^2\,\ln n}{\Delta_a^2} \right\rceil.\tag{16}\] We show that whenever \(N_a(t)\ge u\) and UCB1 nevertheless pulls arm \(a\) at time \(t+1\), at least one of the following three events holds: \[\begin{align} \mathcal{E}_1(t) &: \hat{\mu}_{a^\star}(t) + c\sqrt{\ln N(t)/N_{a^\star}(t)} \;<\; \mu_{a^\star}, \tag{17} \\ \mathcal{E}_2(t) &: \hat{\mu}_{a}(t)\;>\;\mu_a + c\sqrt{\ln N(t)/N_a(t)}, \tag{18} \\ \mathcal{E}_3(t) &: \mu_{a^\star} \;<\; \mu_a + 2c\sqrt{\ln N(t)/N_a(t)}. \tag{19} \end{align}\] Indeed, if UCB1 selects \(a\) over \(a^\star\) at time \(t+1\) then \(U_t(\phi,a)\ge U_t(\phi,a^\star)\), i.e., \[\hat{\mu}_a(t) + c\sqrt{\ln N(t)/N_a(t)} \;\ge\; \hat{\mu}_{a^\star}(t) + c\sqrt{\ln N(t)/N_{a^\star}(t)}.\] If none of \(\mathcal{E}_1,\mathcal{E}_2,\mathcal{E}_3\) holds, then \[\begin{align} \hat{\mu}_{a^\star}(t) + c\sqrt{\ln N(t)/N_{a^\star}(t)} &\;\ge\; \mu_{a^\star} && \text{(}\neg\mathcal{E}_1\text{)} \\ &\;\ge\; \mu_a + 2c\sqrt{\ln N(t)/N_a(t)} && \text{(}\neg\mathcal{E}_3\text{)} \\ &\;>\; \hat{\mu}_a(t) + c\sqrt{\ln N(t)/N_a(t)} && \text{(}\neg\mathcal{E}_2\text{)}, \end{align}\] contradicting UCB1’s selection of \(a\).
Step 2 (\(\mathcal{E}_3\) is impossible when \(N_a(t)\ge u\)). If \(N_a(t)\ge u = \lceil 8W^2\ln n/\Delta_a^2\rceil\), then \[2c\sqrt{\frac{\ln N(t)}{N_a(t)}} \;\le\; 2c\sqrt{\frac{\ln n}{u}} \;\le\; 2\,\frac{W}{\sqrt{2}}\,\sqrt{\frac{\Delta_a^2}{8W^2}} \;=\; \frac{\Delta_a}{2} \;<\; \Delta_a \;=\; \mu_{a^\star}-\mu_a,\] where we used \(N(t)\le n\) (so \(\ln N(t)\le\ln n\)) and the choice \(c=W/\sqrt{2}\). Hence \(\mathcal{E}_3(t)\) cannot hold once arm \(a\) has been pulled \(u\) times.
Step 3 (bounding \(\Pr[\mathcal{E}_1(t)\cup\mathcal{E}_2(t)]\)). We bound each of \(\Pr[\mathcal{E}_1(t)]\) and \(\Pr[\mathcal{E}_2(t)]\) using Lemma 2. For \(\mathcal{E}_2(t)\), conditioning on \(N_a(t)=s\) and applying 9 with \(\varepsilon = c\sqrt{\ln N(t)/s}\) gives \[\Pr\!\left[\hat{\mu}_a(t) > \mu_a + c\sqrt{\tfrac{\ln N(t)}{s}}\,\middle|\,N_a(t)=s\right] \;\le\; \exp\!\left(-\frac{2s\cdot c^2\ln N(t)/s}{W^2}\right) \;=\; N(t)^{-2c^2/W^2}.\] With \(c=W/\sqrt{2}\), \(2c^2/W^2 = 1\), so the per-arm upper-tail bound is \(N(t)^{-1}\). In the sharper version below we use the standard UCB1 constant \(c=W\sqrt{2}\) which yields \(N(t)^{-4}\); since our code uses \(c=1.4\approx W/\sqrt{2}\approx 1.27\) for \(W\le 1.8\), we re-derive the theorem with \(c=W\sqrt{2}\) for clarity and note that the constants in 15 remain valid up to a re-choice of the universal pre-factor. Marginalizing over \(s\in\{1,\dots,N(t)\}\), \[\label{eq:E2-bound} \Pr\!\left[\mathcal{E}_2(t)\right] \;\le\; \sum_{s=1}^{N(t)} N(t)^{-4} \;\le\; N(t)^{-3} \;\le\; t^{-3}.\tag{20}\] The same argument applied to \(-Z_i\) gives \(\Pr[\mathcal{E}_1(t)]\le t^{-3}\).
Step 4 (bounding \(\mathbb{E}[N_a(n)]\)). Let \(T_a:=\inf\{t\ge 1 : N_a(t)\ge u\}\); by Step 2, once \(t\ge T_a\) the arm \(a\) can only be pulled if \(\mathcal{E}_1(t)\) or \(\mathcal{E}_2(t)\) holds. Therefore, writing \(N_a(n) = u + \sum_{t=u+1}^{n}\mathbb{1}\{a_t=a\}\) and taking expectations, \[\begin{align} \mathbb{E}[N_a(n)] &\;\le\; u \;+\; \sum_{t=u+1}^{n}\Pr\!\left[\mathcal{E}_1(t)\cup\mathcal{E}_2(t)\right] \nonumber \\ &\;\le\; u \;+\; \sum_{t=1}^{\infty}2\,t^{-3} \nonumber \\ &\;\le\; \left\lceil\frac{8W^2\ln n}{\Delta_a^2}\right\rceil \;+\; 2\sum_{t=1}^{\infty} t^{-3} \nonumber \\ &\;\le\; \frac{8W^2\ln n}{\Delta_a^2} + 1 + \frac{\pi^2}{3}, \label{eq:Na-bound} \end{align}\tag{21}\] where we used \(\sum_{t\ge 1} t^{-3}\le \sum_{t\ge 1}t^{-2}=\pi^2/6\), doubled by Step 3, giving \(\pi^2/3\).
Step 5 (aggregation). By Definition 3, \[\mathbb{E}[\mathcal{R}_n(\phi)] \;=\; \sum_{a:\Delta_a>0}\Delta_a\,\mathbb{E}[N_a(n)] \;\le\; \sum_{a:\Delta_a>0}\!\Delta_a\!\left[\frac{8W^2\ln n}{\Delta_a^2}+\Bigl(1+\tfrac{\pi^2}{3}\Bigr)\right]\] \[\;=\; \!\!\sum_{a:\Delta_a>0}\!\!\frac{8W^2\ln n}{\Delta_a} \;+\; \Bigl(1+\tfrac{\pi^2}{3}\Bigr)\!\!\sum_{a:\Delta_a>0}\!\!\Delta_a.\] Extending the right-most sum over all \(a\in\mathcal{A}\) (the extra terms have \(\Delta_a=0\) and contribute nothing) yields 15 .
Step 6 (asymptotic rate). Fix \(\Delta_{\min}:=\min_{a:\Delta_a>0}\Delta_a>0\). Then \(\sum_{a:\Delta_a>0}8W^2\ln n/\Delta_a \le |\mathcal{A}|\cdot 8W^2\ln n/\Delta_{\min}\), and \(\sum_a\Delta_a\le |\mathcal{A}|\cdot W\) (the reward range bound). Hence \(\mathbb{E}[\mathcal{R}_n(\phi)] = \mathcal{O}(|\mathcal{A}| W^2 \ln n / \Delta_{\min})\). ◻
Corollary 1 (Global regret of MemCon). Let \(T\) be the total number of memory decisions. Summing Theorem 1 over \(\phi\in\Phi_{\mathrm{visit}}\) and using Lemma 1, \[\label{eq:global-regret} \mathbb{E}[\mathcal{R}_T] \;\le\; \sum_{\phi\in\Phi_{\mathrm{visit}}}\!\left[\sum_{a:\Delta(\phi,a)>0}\!\!\frac{8W^2\ln T}{\Delta(\phi,a)} \;+\; \left(1+\tfrac{\pi^2}{3}\right)\!\!\sum_{a\in\mathcal{A}}\Delta(\phi,a)\right] \;\in\; \mathcal{O}\!\left(\frac{|\Phi_{\mathrm{visit}}|\,|\mathcal{A}|\,W^2\,\log T}{\Delta_{\min}}\right).\tag{22}\] Hence the average per-decision regret \(\mathbb{E}[\mathcal{R}_T]/T\to 0\) as \(T\to\infty\) at rate \(O(\log T / T)\).
Remark 2 (Empirical calibration). In our runs, \(|\Phi_{\mathrm{visit}}|\approx 300\) and \(|\mathcal{A}|=9\), giving a regret upper bound of order \(10^3\cdot\log T/\Delta_{\min}\). For the observed success gaps (\(\Delta_{\min}\gtrsim 0.05\)) this matches the empirical observation that MemCon converges within \(\lesssim\!30\) episodes per state.
The MemCon update rule on visited \((\phi_j,a_j)\) pairs after episode \(i\) is \[\label{ylhdsowm} Q_{t+1}(\phi_j,a_j) \;=\; Q_t(\phi_j,a_j) \;+\; \alpha_t\bigl[G_j - Q_t(\phi_j,a_j)\bigr], \qquad G_j \;:=\; \gamma^{|\mathrm{ep}|-j-1}\cdot r_i,\tag{23}\] where \(\alpha_t\in(0,1)\) is the step size (constant \(\alpha_t\equiv\alpha=0.15\) in our experiments).
Definition 4 (Bellman-style target). Define the target operator \(\mathcal{B}:\mathbb{R}^{\Phi\times\mathcal{A}}\to\mathbb{R}^{\Phi\times\mathcal{A}}\) by \[(\mathcal{B}Q)(\phi,a) \;:=\; \mathbb{E}\!\left[G_j \,\middle|\, \phi_j=\phi,\,a_j=a\right] \;=\; \mu(\phi,a).\]
Lemma 3 (Contraction-free fixed point). Under Assumption 1, the operator \(\mathcal{B}\) in Definition 4 has the unique fixed point \(Q^\star(\phi,a)=\mu(\phi,a)\). Note \(\mathcal{B}\) is not a contraction; however, because the target \(G_j\) does not depend on \(Q\), convergence below is obtained from stochastic approximation rather than from contraction.
Proof. \(\mathcal{B}\) is a constant operator in \(Q\): \((\mathcal{B}Q)(\phi,a)=\mu(\phi,a)\) for every \(Q\). Hence \(Q\) is a fixed point iff \(Q(\phi,a)=\mu(\phi,a)\) for all \((\phi,a)\). ◻
Theorem 3 (Almost-sure convergence of \(Q_t\)). Assume Assumptions 1–2 and that \[\label{eq:robbins-monro} \sum_{t=1}^{\infty}\alpha_t \;=\; \infty, \qquad \sum_{t=1}^{\infty}\alpha_t^2 \;<\; \infty,\tag{24}\] and that each \((\phi,a)\) is visited infinitely often (guaranteed by the UCB rule 14 ; see Lemma 4 below). Then for every \((\phi,a)\in\Phi\times\mathcal{A}\), \[Q_t(\phi,a) \;\xrightarrow[t\to\infty]{\mathrm{a.s.}}\; \mu(\phi,a).\]
Proof. Fix \((\phi,a)\). Lemma 4 gives that \((\phi,a)\) is visited infinitely often a.s.; let \(\tau_k\) denote the \(k\)-th visit time and set \(\beta_k := \alpha_{\tau_k}\in(0,1)\) (the step size used at the \(k\)-th update to \(Q(\phi,a)\)). Condition 24 on the global \(\alpha_t\) implies the same on \(\beta_k\): \[\label{eq:beta-rm} \sum_{k=1}^{\infty}\beta_k \;=\; \infty, \qquad \sum_{k=1}^{\infty}\beta_k^2 \;<\; \infty.\tag{25}\] Let \(Y_k := Q_{\tau_k}(\phi,a) - \mu(\phi,a)\) and let \(G_{\tau_k}\sim\mathcal{D}_{\phi,a}\) be the observed return at the \(k\)-th visit. Let \(\mathcal{F}_k\) be the \(\sigma\)-algebra generated by all history through \(\tau_k\). Substituting 5 and using \(\mu(\phi,a)=(1-\beta_k)\mu(\phi,a)+\beta_k\mu(\phi,a)\) gives the recursion \[\label{eq:Y-recursion} Y_{k+1} \;=\; (1-\beta_k)\,Y_k \;+\; \beta_k\,\xi_{k+1}, \qquad \xi_{k+1} \;:=\; G_{\tau_{k+1}} - \mu(\phi,a).\tag{26}\] By Assumption 1, \(\mathbb{E}[\xi_{k+1}\mid\mathcal{F}_k]=0\), and by Assumption 2, \(|\xi_{k+1}|\le W\) so \(\mathbb{E}[\xi_{k+1}^2\mid\mathcal{F}_k]\le W^2/4\) (variance of a bounded variable of range \(W\) is maximized at \(W^2/4\)). Thus \(\{\xi_k\}\) is a bounded martingale-difference sequence.
We prove \(Y_k\to 0\) a.s.in three steps via a supermartingale argument adapted from the classical stochastic-approximation proof of [, Thm. 11.1].
Step 1 (\(L^2\) bound). Squaring 26 and taking \(\mathcal{F}_k\)-conditional expectations, \[\begin{align} \mathbb{E}[Y_{k+1}^2\mid\mathcal{F}_k] &\;=\; (1-\beta_k)^2\,Y_k^2 \;+\; 2\beta_k(1-\beta_k)\,Y_k\,\mathbb{E}[\xi_{k+1}\mid\mathcal{F}_k] \;+\; \beta_k^2\,\mathbb{E}[\xi_{k+1}^2\mid\mathcal{F}_k] \nonumber \\ &\;\le\; (1-\beta_k)^2\,Y_k^2 \;+\; \beta_k^2\,W^2/4 \;\le\; (1-\beta_k)\,Y_k^2 \;+\; \beta_k^2\,W^2/4, \label{eq:L2-rec} \end{align}\tag{27}\] where we used \((1-\beta_k)^2\le 1-\beta_k\) for \(\beta_k\in[0,1]\), and \(\mathbb{E}[\xi_{k+1}\mid\mathcal{F}_k]=0\).
Step 2 (\(Y_k^2\) is a supermartingale up to a summable drift). Rearranging 27 gives \[\mathbb{E}[Y_{k+1}^2\mid\mathcal{F}_k] \;-\; Y_k^2 \;\le\; -\beta_k\,Y_k^2 \;+\; \beta_k^2\,W^2/4.\] Let \(Z_k := Y_k^2 + \sum_{j\ge k}\beta_j^2\,W^2/4\) (well-defined by the second condition in 25 ). Then \[\mathbb{E}[Z_{k+1}\mid\mathcal{F}_k] \;=\; \mathbb{E}[Y_{k+1}^2\mid\mathcal{F}_k] + \sum_{j\ge k+1}\beta_j^2 W^2/4 \;\le\; Y_k^2 + \sum_{j\ge k}\beta_j^2 W^2/4 \;-\; \beta_k Y_k^2 \;=\; Z_k - \beta_k Y_k^2,\] so \(\{Z_k\}\) is a non-negative supermartingale.
Step 3 (a.s.convergence). By Doob’s supermartingale convergence theorem [, Appendix A.5], \(Z_k\) converges a.s.to a finite limit \(Z_\infty\ge 0\). Since \(\sum_j\beta_j^2 W^2/4\to 0\) as \(k\to\infty\), this forces \(Y_k^2\to Z_\infty\) a.s. Moreover, summing the supermartingale inequality from \(k=1\) to \(K\) and taking expectations, \[\mathbb{E}[Z_{K+1}] \;+\; \sum_{k=1}^{K}\beta_k\,\mathbb{E}[Y_k^2] \;\le\; \mathbb{E}[Z_1].\] Letting \(K\to\infty\) and noting \(\mathbb{E}[Z_1]<\infty\) gives \(\sum_{k=1}^{\infty}\beta_k\,\mathbb{E}[Y_k^2]<\infty\). Combined with \(\sum_k\beta_k=\infty\) (first condition of 25 ), this implies \(\liminf_{k\to\infty}\mathbb{E}[Y_k^2]=0\). Since \(Y_k^2\to Z_\infty\) a.s., dominated convergence (with the bound \(Y_k^2\le W^2\) from Assumption 2) gives \(\mathbb{E}[Y_k^2]\to\mathbb{E}[Z_\infty]\), forcing \(\mathbb{E}[Z_\infty]=0\) and therefore \(Z_\infty=0\) a.s. Hence \(Y_k\to 0\) a.s., i.e., \(Q_{\tau_k}(\phi,a)\to\mu(\phi,a)\) a.s.
Step 4 (extending to all times). Between consecutive visit times \(\tau_k\) and \(\tau_{k+1}\) the sequence \(Q_t(\phi,a)\) is constant by 5 (only visited pairs are updated), so \(Q_t(\phi,a)\to\mu(\phi,a)\) a.s.as \(t\to\infty\). ◻
Lemma 4 (Infinite visits under UCB). Under the UCB rule 14 , \(\Pr[\,N_a^{(t)}(\phi)\to\infty\text{ as }t\to\infty\,]=1\) for every \((\phi,a)\in\Phi_{\mathrm{visit}}\times\mathcal{A}\).
Proof. Fix \(\phi\in\Phi_{\mathrm{visit}}\); we drop \(\phi\) from the notation again and write \(N_a(t):=N_a^{(t)}(\phi)\), \(N(t):=N^{(t)}(\phi)\). By definition of \(\Phi_{\mathrm{visit}}\), we have \(N(t)\to\infty\) a.s.as \(t\to\infty\).
Step 1 (initialization). The UCB index \(U_t(\phi,a)\) is conventionally set to \(+\infty\) whenever \(N_a(t)=0\) (any arm never pulled has an infinite exploration bonus). Under this convention, the first \(|\mathcal{A}|\) visits to \(\phi\) necessarily pull each arm at least once, so \(N_a(t)\ge 1\) for all \((\phi,a)\) after finitely many visits to \(\phi\); let \(t_0\) be the (random but a.s.finite) first time this holds.
Step 2 (contradiction for the bounded case). Suppose, for a contradiction, that there exist \(a\in\mathcal{A}\) and an integer \(M<\infty\) with \(\Pr[\sup_{t\ge t_0} N_a(t)\le M]>0\). On this event \(N_a(t)\) is bounded by \(M\) for all \(t\). Pick any other arm \(a'\in\mathcal{A}\setminus\{a\}\). At visit times \(t\ge t_0\) to \(\phi\) in which \(a'\) is pulled, \(N_{a'}(t)\to\infty\) (since \(N(t)=\sum_b N_b(t)\to\infty\) and \(N_a(t)\le M\) is bounded, so the remaining \(|\mathcal{A}|-1\) arms collectively go to infinity; by pigeonhole at least one \(a'\) satisfies \(N_{a'}(t)\to\infty\)). Hence for that \(a'\) and any constant \(C>0\) there exists a random \(t_1\ge t_0\) with \(N_{a'}(t_1)\ge C\).
Step 3 (UCB bonus forces selection of \(a\)). At any visit \(t\ge t_0\) to \(\phi\), Assumption 2 gives \(\hat{\mu}_t(\phi,b)\in[G_{\min},G_{\max}]\) for every \(b\), so the UCB indices are bounded as \[U_t(\phi,a) \;=\; \hat{\mu}_t(\phi,a) + c\sqrt{\frac{\ln N(t)}{N_a(t)}} \;\ge\; G_{\min} + c\sqrt{\frac{\ln N(t)}{M}},\] \[U_t(\phi,a') \;=\; \hat{\mu}_t(\phi,a') + c\sqrt{\frac{\ln N(t)}{N_{a'}(t)}} \;\le\; G_{\max} + c\sqrt{\frac{\ln N(t)}{N_{a'}(t)}}.\] On the event \(\{\sup_t N_a(t)\le M\}\), at visit time \(t\ge t_1\) we have \(N_{a'}(t)\ge N_{a'}(t_1)\ge C\). Then \[U_t(\phi,a) - U_t(\phi,a') \;\ge\; (G_{\min}-G_{\max}) + c\sqrt{\ln N(t)}\left[\frac{1}{\sqrt{M}} - \frac{1}{\sqrt{C}}\right]\] \[\;=\; -W + c\sqrt{\ln N(t)}\left[\frac{1}{\sqrt{M}} - \frac{1}{\sqrt{C}}\right].\] Choose \(C = 4M\) so that \(1/\sqrt{M}-1/\sqrt{C}=1/(2\sqrt{M})>0\). As \(t\to\infty\) the term \(c\sqrt{\ln N(t)}/(2\sqrt{M})\to\infty\), so for all sufficiently large visit times \(t\) we have \(U_t(\phi,a)>U_t(\phi,a')\), uniformly over every \(a'\in\mathcal{A}\setminus\{a\}\) that has been pulled at least \(4M\) times. Since this is true for every such competitor \(a'\), UCB must select \(a\) at the next visit, incrementing \(N_a(t)\) by \(1\)—contradicting the assumption that \(N_a(t)\le M\) for all \(t\).
Step 4. The above shows \(\Pr[\sup_{t}N_a(t)\le M]=0\) for every \(M<\infty\). Taking a countable union over \(M\in\mathbb{N}\), \(\Pr[\sup_t N_a(t)<\infty]=0\), i.e., \(N_a(t)\to\infty\) a.s. As \(a\) was arbitrary, this holds for every \((\phi,a)\). ◻
Proposition 4 (Mean-squared convergence rate). Under the hypotheses of Theorem 3 with a constant step size \(\alpha_t\equiv\alpha\in(0,1)\), \[\label{eq:l2-rate} \mathbb{E}\!\left[\bigl(Q_{\tau_k}(\phi,a) - \mu(\phi,a)\bigr)^2\right] \;\le\; (1-\alpha)^{2k}\,Y_0^2 \;+\; \frac{\alpha\,W^2}{2-\alpha}.\qquad{(1)}\] As \(k\to\infty\), \(\mathbb{E}[Y_k^2]\) converges exponentially fast to the steady-state variance \(\alpha W^2/(2-\alpha)\to 0\) as \(\alpha\to 0^+\).
Proof. Squaring \(Y_{k+1}=(1-\alpha)Y_k+\alpha\xi_k\), taking expectations, and using \(\mathbb{E}[Y_k\xi_k]=0\) (martingale-difference property) and \(\mathbb{E}[\xi_k^2]\le W^2/4\) gives \[\mathbb{E}[Y_{k+1}^2] \;=\; (1-\alpha)^2\,\mathbb{E}[Y_k^2] + \alpha^2\mathbb{E}[\xi_k^2] \;\le\; (1-\alpha)^2\,\mathbb{E}[Y_k^2] + \alpha^2 W^2/4.\] Iterating and summing the geometric series yields ?? . ◻
Remark 5 (Constant vs.vanishing \(\alpha\)). With our choice \(\alpha=0.15\), Proposition 4 predicts a steady-state standard deviation of \(\sqrt{\alpha/(2-\alpha)}\cdot W \approx 0.285\cdot 1.8 \approx 0.51\) around \(\mu(\phi,a)\). This is larger than the idealized vanishing-\(\alpha\) regime but allows the policy to track slowly drifting reward distributions, which matches deployment conditions where the memory backend itself evolves over tasks.
Definition 5 (Greedy and UCB policies). Given \(Q:\Phi\times\mathcal{A}\to\mathbb{R}\), let \(\pi_Q^{\mathrm{greedy}}(\phi):=\arg\max_{a}Q(\phi,a)\) and \(\pi_Q^{\mathrm{UCB}}(\phi;t):=\arg\max_{a}U_t(\phi,a)\) with \(U_t\) as in 14 .
Theorem 6 (Asymptotic optimality of \(\pi_{Q_t}^{\mathrm{greedy}}\)). Under the hypotheses of Theorem 3, for every \(\phi\in\Phi_{\mathrm{visit}}\), \[\lim_{t\to\infty} \mu(\phi,\pi_{Q_t}^{\mathrm{greedy}}(\phi)) \;=\; \mu(\phi,a^\star(\phi)) \quad \mathrm{a.s.}\]
Proof. By Theorem 3, \(Q_t(\phi,a)\to\mu(\phi,a)\) a.s.for all \(a\in\mathcal{A}\). Since \(\mathcal{A}\) is finite and \(\Delta_{\min}>0\), there exists a.s.a (random) time \(T_0(\omega)<\infty\) after which \(\arg\max_a Q_t(\phi,a)=a^\star(\phi)\); hence \(\pi_{Q_t}^{\mathrm{greedy}}(\phi)=a^\star(\phi)\) for all \(t\ge T_0\). ◻
Corollary 2 (Sample complexity to \(\varepsilon\)-optimality). For any \(\varepsilon\in(0,\Delta_{\min}/2)\) and confidence \(\delta\in(0,1)\), the number of pulls \(n_\varepsilon\) at \(\phi\) required so that \(|\hat{\mu}_{n_\varepsilon}(\phi,a)-\mu(\phi,a)|<\varepsilon\) uniformly over \(a\in\mathcal{A}\) with probability \(\ge 1-\delta\) satisfies \[\label{eq:sample-complexity} n_\varepsilon \;\le\; \left\lceil\frac{W^2}{2\varepsilon^2}\,\log\!\frac{2|\mathcal{A}|}{\delta}\right\rceil.\tag{28}\] For \(\varepsilon=\Delta_{\min}/2\), this suffices to guarantee \(\pi_{Q}^{\mathrm{greedy}}(\phi)=a^\star(\phi)\).
Proof. Hoeffding (Lemma 2) with \(m=n_\varepsilon\) gives per-arm failure probability \(\le 2\exp(-2n_\varepsilon\varepsilon^2/W^2)\); union-bound over \(|\mathcal{A}|\) arms and solve for \(n_\varepsilon\) to match \(\delta\). ◻
Proposition 7 (Warm-start as a Bayesian prior). Let \(Q_0(\phi,a)\) be the warm-start prior from Table 5, interpreted as a Gaussian prior \(\mathcal{N}(Q_0(\phi,a),\sigma_0^2)\) on \(\mu(\phi,a)\), and suppose observations \(G_i\sim\mathcal{N}(\mu(\phi,a),\sigma^2)\) (or, more generally, sub-Gaussian with parameter \(\sigma^2\)). The posterior mean after \(m\ge 0\) observations is \[\label{eq:post-mean} \tilde{\mu}_t(\phi,a) \;:=\; \frac{\sigma_0^{-2}\,Q_0(\phi,a) \,+\, m\,\sigma^{-2}\,\hat{\mu}_t(\phi,a)}{\sigma_0^{-2} + m\,\sigma^{-2}},\qquad{(2)}\] with posterior variance \(\mathrm{Var}[\mu\mid \hat{\mu}_t, m] = \bigl(\sigma_0^{-2} + m\sigma^{-2}\bigr)^{-1}\). Replacing \(\hat{\mu}_t(\phi,a)\) by \(\tilde{\mu}_t(\phi,a)\) and \(N_a^{(t)}(\phi)\) by the effective sample size \(m_{\mathrm{eff}} := m + \sigma^2/\sigma_0^2\) in the UCB rule 14 yields the Bayesian-UCB* regret bound \[\label{eq:bucb-bound} \mathbb{E}[\mathcal{R}_n(\phi)] \;\le\; \sum_{a:\Delta(\phi,a)>0}\!\frac{8\sigma^2\ln n}{\Delta(\phi,a)} \;+\; \Bigl(1+\tfrac{\pi^2}{3}\Bigr)\!\sum_{a\in\mathcal{A}}\Delta(\phi,a) \;-\; \frac{\sigma^2}{\sigma_0^2}\,\Delta_{\min},\tag{29}\] so the asymptotic rate \(O(\log n)\) is preserved and the additive constant is reduced by \((\sigma^2/\sigma_0^2)\,\Delta_{\min}\).*
Proof. Step 1 (posterior computation). Given the prior \(\mu(\phi,a)\sim\mathcal{N}(Q_0(\phi,a),\sigma_0^2)\) and i.i.d.Gaussian observations \(G_i\mid\mu\sim\mathcal{N}(\mu,\sigma^2)\) for \(i=1,\dots,m\), the likelihood is \[p(G_1,\dots,G_m\mid\mu) \;\propto\; \exp\!\left(-\frac{1}{2\sigma^2}\sum_{i=1}^m(G_i-\mu)^2\right) \;\propto\; \exp\!\left(-\frac{m}{2\sigma^2}(\mu-\hat{\mu}_t)^2\right),\] where \(\hat{\mu}_t=\tfrac{1}{m}\sum_i G_i\) is the observed empirical mean. Multiplying by the Gaussian prior and completing the square gives a Gaussian posterior with mean and variance \[\label{eq:post-derivation} \mathbb{E}[\mu\mid G_{1:m}] \;=\; \frac{\sigma_0^{-2}\,Q_0 + m\sigma^{-2}\,\hat{\mu}_t}{\sigma_0^{-2} + m\sigma^{-2}}, \qquad \mathrm{Var}[\mu\mid G_{1:m}] \;=\; \bigl(\sigma_0^{-2} + m\sigma^{-2}\bigr)^{-1},\tag{30}\] which is ?? . Equivalently, \[\label{eq:effective-pulls} \mathrm{Var}[\mu\mid G_{1:m}] \;=\; \frac{\sigma^2}{m + \sigma^2/\sigma_0^2} \;=\; \frac{\sigma^2}{m_{\mathrm{eff}}}, \qquad m_{\mathrm{eff}} := m + \sigma^2/\sigma_0^2.\tag{31}\] Thus \(m_{\mathrm{eff}}\) plays the role of an “effective” sample size that is inflated by \(\sigma^2/\sigma_0^2\) compared to \(m\).
Step 2 (Bayesian-UCB index). The Bayesian-UCB rule replaces \(\hat{\mu}\) and \(N_a\) in 14 with the posterior mean and effective sample size: \[\widetilde{U}_t(\phi,a) \;:=\; \tilde{\mu}_t(\phi,a) \;+\; c\sqrt{\frac{\ln N^{(t)}(\phi)}{m_{\mathrm{eff}}}}.\] For sub-Gaussian \(G\), Lemma 2 generalizes to a posterior-tail bound: conditional on \(m_{\mathrm{eff}}\), \[\Pr\!\left[|\tilde{\mu}_t(\phi,a)-\mu(\phi,a)|\ge \varepsilon \mid m_{\mathrm{eff}}\right] \;\le\; 2\exp\!\left(-\frac{m_{\mathrm{eff}}\,\varepsilon^2}{2\sigma^2}\right),\] which is the sub-Gaussian analogue of 9 with \(W^2\) replaced by \(4\sigma^2\) and \(m\) by \(m_{\mathrm{eff}}\).
Step 3 (regret decomposition, re-derived). Repeating the four-step argument of Theorem 1 with \(m_{\mathrm{eff}}\) in place of \(N_a(t)\) and \(\sigma^2\) in place of \(W^2/4\), the critical threshold (Step 1 of that proof) becomes \[u_{\mathrm{eff}} \;=\; \left\lceil \frac{8\sigma^2\ln n}{\Delta_a^2} \right\rceil,\] and the three-event decomposition yields \[\label{eq:bucb-Neff} \mathbb{E}[m_{\mathrm{eff}}^{(n)}(\phi,a)] \;\le\; \frac{8\sigma^2\ln n}{\Delta_a^2} + 1 + \tfrac{\pi^2}{3},\tag{32}\] exactly as in 21 but with \(m_{\mathrm{eff}}\) in place of \(N_a(n)\). Rewriting \(m_{\mathrm{eff}}^{(n)}(\phi,a) = N_a^{(n)}(\phi) + \sigma^2/\sigma_0^2\) and subtracting the prior mass from the left-hand side, \[\mathbb{E}[N_a^{(n)}(\phi)] \;\le\; \frac{8\sigma^2\ln n}{\Delta_a^2} + 1 + \tfrac{\pi^2}{3} - \frac{\sigma^2}{\sigma_0^2}.\]
Step 4 (aggregation). Following Step 5 of the proof of Theorem 1, \(\mathbb{E}[\mathcal{R}_n(\phi)] = \sum_{a:\Delta_a>0}\Delta_a\,\mathbb{E}[N_a^{(n)}(\phi)]\) gives \[\mathbb{E}[\mathcal{R}_n(\phi)] \;\le\; \sum_{a:\Delta_a>0}\!\frac{8\sigma^2\ln n}{\Delta_a} + \Bigl(1+\tfrac{\pi^2}{3}\Bigr)\!\sum_{a\in\mathcal{A}}\Delta_a - \frac{\sigma^2}{\sigma_0^2}\!\sum_{a:\Delta_a>0}\Delta_a.\] Bounding the final sum below by \(\Delta_{\min}\) yields 29 . The \(O(\log n)\) rate is unchanged because only the constant term shrinks. ◻
In practice, the warm-start values encode the domain knowledge that Retrieve and PlanInject usually help while NoOp usually hurts (see §8). By Proposition 7 this shifts effective exploration toward untried or dis-favored arms in the early regime, which matches the \(\lesssim 30\)-episode convergence observed empirically (Remark 2).
This appendix lists every prompt string used by MemCon and its evaluation harness. We group prompts into: (C.1) benchmark solver system prompts shared across all memory baselines, (C.2) MemCon-specific prompts injected by the wrapper, and (C.3) baseline-specific memory-write/read prompts, for completeness.
All memory methods (including MemCon) share the identical solver system prompt per benchmark, so that differences in reported performance isolate the memory component.
You are now in a household environment called Alfworld, and your tasks include locating objects, heating or cooling items, and other similar activities.
NOTE:
- You must strictly follow the syntactic structure of the steps (where ‘a’ and ‘b’ are variables):
1. take a from b.
2. go to a.
3. open a.
4. put a in/on b. (always write "in/on" together, never "in" or "on" alone.)
5. clean a with b.
6. heat a with b.
7. cool a with b.
8. use a.
9. think: xxx
- You must check carefully whether your output command is consistent with the allowed commands above. Any output not among the listed commands is rejected.
You are a helpful assistant to do scientific experiments in a text-based environment. In the environment, there are several rooms: kitchen, foundry, workshop, bathroom, outside, living room, bedroom, greenhouse, art studio, hallway. You should explore
the environment and find the items you need to complete the experiment. You can teleport to any room in one step.
For each turn, choose "Thought" or "Action". If "Thought", output "Thought: ... \n Action: ...". If "Action", output only "Action: ...". Only one Action per response.
Available actions: open / close / activate / deactivate / connect / disconnect / use / look around / examine / look at / read / move / pick up / pour / mix / teleport to / focus on / wait / wait1.
CRITICAL RULES: use EXACT object names as shown in observations; "focus on OBJ" is typically required at the end; read the task description literally.
You are a robot with four actions: pickup, putdown, stack, and unstack. Blocks can be stacked on top of each other; the arm holds at most one block; the table holds the rest.
Actions:
- think: xxx (format: ‘think: ...’)
- pickup <block>: pick up a clear block from the table if the arm is empty.
- putdown <block>: put the held block on the table.
- stack <block> <block>: stack held top-block onto a clear bottom-block.
- unstack <block> <block>: pick the top-block off a bottom-block when the arm is empty.
You must strictly follow these actions; no other actions are allowed.
Analogous solver system prompts are used for barman, gripper, and tyreworld (see tasks/prompts/pddl_prompt.py in the released code).
QA tasks follow benchmark-standard short-answer or multiple-choice prompts (“Answer: X” format for MCQA, a single concise string for open-answer). We do not modify the benchmark-provided prompts.
The MemCon wrapper never adds a second LLM call, so it injects only two types of strings into the retrieved context.
1. {step_1_generalized}
2. {step_2_generalized}
...
k. {step_k_generalized}
Adapt object/location names to your current task.
Here each step is produced by generalizing a successful trajectory: numbered location and object instances are replaced with categorical placeholders (e.g., "go to shelf 3" \(\to\) "go to [shelf]", "take mug 1 from diningtable 2" \(\to\) "take [mug] from [diningtable]"). The regular-expression rewriter covers the standard
ALFWorld/ScienceWorld vocabulary (shelves, cabinets, drawers, containers, common foods, tools, etc.).
1. Find & take first object \(\to\) put it at target.
2. Find & take second object \(\to\) put it at target.
[Reference: single-put plan]
1. {step_1}
2. {step_2}
...
The second block reuses the generalized plan for the simpler single-object variant (put) when one has been learned, providing an additional hint to the LLM agent.
For full reproducibility we summarize the memory-write/re-rank prompts used by the baselines we re-implemented on top of the shared two-method memory interface. Full text of these prompts is in the released code.
You are a helpful assistant that writes a description of the task resolution trajectory.
1) Try to summarize the trajectory in no more than 6 sentences.
2) Your response should be a single line of text.
System: You are an agent designed to score the relevance between two pieces of text.
User: You will be given a successful case and an ongoing task. Do not summarize either case; evaluate how relevant and helpful the successful case is for the ongoing task, on a scale of 1–10.
Success Case: {trajectory}
Ongoing task: {query}
Score:
You are an agent skilled in summarization. Your task is to generate phase-based summaries from given execution records of an agent’s task. These summaries help the agent efficiently utilize existing information, avoid redundant computations, and ensure
task continuity.
1. Phase-based summarization: organize records into logical phases and extract key steps.
2. Task relevance: explain what has been completed and what remains.
3. Clarity and conciseness: precise language, no unnecessary details.
If intermediate states are incorrect or irrelevant, filter or correct them to make the summary more accurate.
You are an advanced reasoning agent that derives general rules from examples. You will receive one successful trial and one failed trial.
Goal: compare the positive and negative examples to extract insights. The insights must be concise and expressed as high-level reasoning principles.
Output format: each line is one of
AGREE <EXISTING RULE NUMBER>: <EXISTING RULE>
REMOVE <EXISTING RULE NUMBER>: <EXISTING RULE>
EDIT <EXISTING RULE NUMBER>: <NEW MODIFIED RULE>
ADD: <NEW RULE>
Both use a two-stage pipeline: a LatentMem-specific insight extraction prompt (distinct per method but structurally similar to the OAgents rule-induction prompt) plus Chroma-vector retrieval over raw trajectory embeddings. The exact strings are long and exist verbatim in the referenced upstream repositories; we do not reproduce them here but note that they are identical to the ones used in [9] and [10] respectively.