Memory-augmented agents typically integrate procedural knowledge by injecting retrieved skills directly into text prompts. This approach dangerously equates readable text with reliable execution. To bridge this gap, we introduce From Memory to Guide, a novel paradigm that transitions procedural memory from passive text delivery to active, inference-time policy adaptation. We instantiate this paradigm through the Spatio-Temporal Composer, an active policy compiler that explicitly manages exactly how and when retrieved knowledge should be applied. Rather than treating skills as plug-and-play modules, Composer dynamically aligns historical knowledge with current environmental constraints (spatial adaptation) and precisely dictates its applicable lifecycle (temporal orchestration). It actively transforms static memories into strictly bounded Runtime Guides---equipping the agent with localized objectives and behavioral guardrails without requiring a single parameter update. Extensive evaluations on 13 demanding, long-horizon software engineering tasks in EngramBench demonstrate the clear advantages of this architecture. Composer not only robustly prevents context mismatch but drives an absolute pass-rate increase of 7.2 percentage points on the most complex tasks, while simultaneously slashing the main agent's token usage by 32.2%.
Figures & tables
Figure 1: Overview of Spatio-Temporal Composer. The Catalog exposes available capabilities to the Coding Agent, which initiates guidance requests during development. Task requirements, dynamic execution context, and the previous Guide inform skill selection and guide composition. The resulting Runtime Guide is returned to the Coding Agent, whose subsequent execution and validation provide evidence for future requests.
Figure 2: A DockChain example of spatial composition and temporal adaptation: execution context is instantiated as a local Runtime Guide, whose completion triggers requirement re-entry and the next guidance request.
Figure 3: Task quality and execution-side efficiency on four tasks from the 13-task EngramBench evaluation. Left: mean confirmed-pass rates across three runs per condition, with individual runs shown as dots. Right: cumulative Coding Agent token usage and development runtime (hh:mm) across 12 runs per condition. Baseline denotes Codex + Skills; Guide denotes Composer.
Task
Codex + Skills
Selector- only
Generic Advisor
w/o Direct Evidence
w/o Lifecycle
Composer
DockChain (44)
64
33
49
65
55
69
CarbonLedger (49)
49
75
62
81
67
80
EscrowGuard (48)
21
7
3
9
23
32
FlagFoundry (44)
39
34
43
35
28
48
Total confirmed passes
173
149
157
190
173
229
Confirmed-pass rate (%)
31.17
26.85
28.29
34.23
31.17
41.26
Table 1: Component comparisons and design ablations. Task rows report cumulative confirmed passes across three runs per condition; parentheses indicate scheduled tests per run. Each condition comprises 555 scheduled test executions. Bold denotes the highest value in each row. “w/o Direct Evidence” removes direct dynamic execution evidence from composition; “w/o Lifecycle” removes explicit termination and requirement re-entry specifications.
Existing memory systems for embodied agents typically inject retrieved memory as static context at episode start, a paradigm we term Ahead-of-time Monolithic Memory Injection (AMMI). However, this static design quickly becomes misaligned with the agent's evolving state and may degrade lightweight executors below the no-memory baseline. To address this, we propose MemCompiler, which reframes memory utilization as State-Conditioned Memory Compilation. A learned Memory Compiler reads a structured Brief State capturing the agent's current execution state and dynamically selects and compiles only relevant memory into executable guidance. This guidance is delivered through a text channel and a latent Soft-Mem channel that preserves perceptual information not expressible in text. Across Alf World, EmbodiedBench, and ScienceWorld, MemCompiler consistently improves over no-memory across open-source backbones (up to +129%), matches or approaches frontier closed-source systems, and reduces per-step latency by 60%, demonstrating that state-aware memory compilation improves both effectiveness and efficiency.
Xin Ding, Xinrui Wang, Yifan Yang +9
University of Science and Technology of China · Huazhong University of Science and Technology · Microsoft Research +2
Large Language Models (LLMs) have demonstrated significant potential as autonomous software engineering (SWE) agents. Recent work has further explored augmenting these agents with memory mechanisms to support long-horizon reasoning. However, these approaches typically operate at a coarse instance granularity, treating the entire problem-solving episode as the atomic unit of storage and retrieval. We empirically demonstrate that instance-level memory suffers from a fundamental granularity mismatch, resulting in misguided retrieval when tasks with similar surface descriptions require distinct reasoning logic at specific stages. To address this, we propose Structurally Aligned Subtask-Level Memory, a method that aligns memory storage, retrieval, and updating with the agent's functional decomposition. Extensive experiments on SWE-bench Verified demonstrate that our method consistently outperforms both vanilla agents and strong instance-level memory baselines across diverse backbones, improving mean Pass@1 over the vanilla agent by +4.7 pp on average (e.g., +6.8 pp on Gemini 2.5 Pro). Performance gains grow with more interaction steps, showing that leveraging past experience benefits long-horizon reasoning in complex software engineering tasks.
Long-horizon software engineering agents often need to manage lengthy and noisy interaction histories under limited context budgets. Existing memory management methods typically rely on static compression workflows or impose rigid constraints on compression timing and granularity. Moreover, these approaches fail to jointly optimize memory management and issue resolution capabilities to improve performance while reducing token usage. We present SWE-MeM, a training framework for proactive and on-demand memory management in software engineering agents. SWE-MeM provides a flexible memory tool that lets agents decide when, what, and how to compress based on trajectory state, task progress, and remaining context budget. We train agents with synthesized proactive memory-management trajectories and Memory-aware GRPO, which jointly optimizes memory management and issue resolution through memory-aware trajectory splitting and step-level credit assignment. On SWE-Bench Verified, SWE-MeM achieves 43.4% and 60.2% resolve rate with 4B and 30B models, respectively, outperforming existing memory management baselines in both performance and efficiency.
Shuzheng Gao, Wenhao Zeng, Zhaojian Yu +5
The Chinese University of Hong Kong, China · Shanghai Jiao Tong University, China · Tsinghua University, China +1