TL;DR
MemScope is a new framework that allows LLM agents to evolve their own memory architectures through surgical, in-place code repairs rather than total rewrites. By giving a specialized "Patch Agent" access to raw execution traces and runtime memory states, the system can pinpoint exactly where a memory logic failure occurred and fix it with a median code change of just 4.4%, leading to state-of-the-art performance on complex benchmarks like GAIA.
What Problem Does This Paper Address?
LLM agents rely on "memory architectures"—the code that decides what to store, how to retrieve it, and how to present it—to handle long-horizon tasks. However, most agents are deployed with fixed memory logic. While recent "self-evolving" agents try to fix this by updating their own code, they typically rely on coarse, outcome-level feedback (like a simple evaluation score).
The authors argue that a low score is a "black box" that doesn't tell you why the agent failed. Did it fail to store the right information? Was the retrieval threshold too high? Or was the retrieved information formatted poorly for the LLM? Without precise failure localization, previous methods often resorted to large-scale rewrites of the entire memory system, which is inefficient and prone to breaking parts of the system that were actually working well.
Methods
MemScope introduces a localized evolution loop that treats memory architecture improvement as a targeted debugging task.
The framework consists of several key components:
- Agent Executor: Performs the actual tasks using the current memory "skill" (a combination of natural language guidance and executable Python code).
- Patch Agent: A tool-using agent that acts as a developer. When a performance drop is detected, it uses a suite of tools to inspect raw execution traces, query the runtime memory bank, and read the current provider code.
- Localized Code Repair: Instead of generating a whole new architecture, the Patch Agent proposes specific "old-to-new" code replacements. This preserves the identity of the memory provider and ensures compatibility with existing stored records.
- Patch History: The system maintains a log of previous attempts, successes, and regressions. This prevents the agent from repeating failed strategies (e.g., if lowering a retrieval threshold previously caused "hallucinations" from irrelevant memories).
Datasets
The authors evaluated MemScope across three diverse settings:
- GAIA: A benchmark for general AI assistants involving multi-step reasoning, web browsing, and tool use.
- xBench (DeepSearch-2505): Focused on complex web research and information synthesis.
- ALFWorld: A text-based environment for sequential household tasks, testing the agent's ability to generalize to unseen embodied environments.
Key Insights and Ideas
- Granularity is King: The biggest "aha moment" is that fine-grained evidence drastically outperforms summary-level feedback. In diagnostic tests, giving the agent access to raw traces and memory state resulted in 86.67% accuracy, compared to only 63.33% when it only received a summary of the failure.
- Surgical Edits are Sufficient: You don't need to reinvent the wheel to improve an agent. The median code change ratio across successful evolutions was only 4.4%. Small tweaks to retrieval thresholds or filtering logic often yielded massive performance jumps.
- Memory vs. Logic Separation: By keeping the runtime memory bank separate from the executable logic, MemScope allows the agent to improve its "thinking process" without losing the "knowledge" it has already gathered during a task.
- Closing the Loop with History: The use of a Patch History allows the agent to perform "meta-learning." It can recognize when a proposed fix is similar to a past failure and adjust its strategy accordingly, which is crucial for avoiding regressions.
Key Results
MemScope demonstrated significant improvements over both fixed-architecture agents and previous self-evolving methods:
- GAIA: Reached 83.64% accuracy using DeepSeek V3.2, outperforming the previous best closed-source framework, Alita (75.15%).
- xBench: Improved the original memory architecture from 49 to 55 correct answers (DeepSeek V3.2) and from 50 to 53 (Kimi K2.7 Code).
- ALFWorld: Success on unseen tasks jumped from 50.75% to 71.64% after the agent evolved its memory logic through experience.
- Efficiency: The "Trace + Memory Inspection" variant not only achieved higher accuracy but also resulted in downstream task execution that used 24.4% fewer steps than the summary-only baseline.
Limitations and Future Work
While MemScope excels at evolving memory, the authors note several areas for expansion:
- Scope of Evolution: Currently, the framework focuses specifically on memory architectures. Future work could apply localized repair to other parts of the agent harness, such as tool-use protocols or execution control logic.
- Backbone Dependency: The success of the Patch Agent is still tied to the reasoning capabilities of the underlying LLM. As models improve, the complexity of the "bugs" MemScope can fix will likely increase.
- Validation Costs: While localized repair is more efficient than full rewrites, the process of diagnosing and validating patches still incurs computational costs that could be further optimized.
Summary updated