An agent that wants to remember its users needs a memory system: store the conversation, retrieve relevant snippets, compose them, and hand the result to the model. Over the past couple of years these systems have grown more elaborate, layering fact extraction, knowledge graphs, offline consolidation and semantic compression. Two independent lines of work recently pushed back. One paper reports that naive RAG, which retrieves directly over raw conversations, ranked first in six of seven benchmark-model settings across four benchmarks including LoCoMo and LongMemEval, beating the strongest agentic memory system it compared against by 0.13 to 5.53 points. Another splits the value of memory into memory benefit and memory tax, arguing that processing can remove or obscure useful evidence.

A paper submitted to arXiv on 12 November 2026 takes a different route: rather than having humans design the memory system, let programs search for one.

Replacing hand-written design with program evolution

The paper is titled Discovering Effective Agent Memory Designs through Program Evolution, and the framework is called MAPE. It breaks a memory system into four programmable stages, build, retrieve, compose and answer, then runs whole-program evolution over a unified lifecycle interface. Starting from a minimal seed that stores nothing, a proposer rewrites the entire program, an evaluation scores it, and a separate diagnosis agent reads the execution traces to work out what went wrong, feeding that diagnosis into the next proposal.

Both the proposer and the diagnosis agent run Claude Opus 4.8 with reasoning effort set to xhigh. Each setting gets three evolutionary runs on LoCoMo and one on LongMemEval, with 20 steps per run and one candidate program proposed per step. Search and evaluation partitions are fixed at 20% and 80%, and the evaluation set stays completely unavailable throughout evolution.

The comparison set is five hand-designed memory systems, Mem0, A-Mem, LightMem, SimpleMem and Zep, alongside naive RAG and Full Context.

What the search found that hand-written designs did not

There are two resulting programs. On LoCoMo, the evolved MAPE-ALCM reaches 87.94% average accuracy with GPT-4.1 mini; in the same table Full Context sits at 80.87% and SimpleMem at 80.80%. On LongMemEval, the evolved MAPE-ALME reaches 77.00% with Qwen3-30B-A3B-Instruct-2507, where the strongest baseline in that column is naive RAG at 66.00%.

The most striking numbers come from swapping in the Qwen backbone. On LoCoMo, MAPE-PLCM reaches 81.33%, which is 12.01 percentage points above SimpleMem at 69.32%, while serving cost runs 1.14 dollars against 3.24, so cost accounts for only 35%.

But the reusable part is not the score, it is two design patterns that keep reappearing across the discovered systems.

The first is to keep the raw conversation. Alongside extracting atomic notes, MAPE-ALME also indexes the original conversation rounds and returns up to five of the highest-ranked raw rounds as evidence. Ablations show that removing the raw rounds drops LoCoMo from 75.90% to 63.73% and LongMemEval from 77.00% to 70.50%, with the largest single decline, 20.00%, on single-session assistant questions.

The second is to route by query intent. The paper calls this Query-Routed Scaffolding. Rules based on the query wording assign each question to one of six intents, temporal, aggregation, difference, current-value, preference or direct lookup, and each intent gets its own scaffold, such as date arithmetic for temporal questions and deduplicating counts in code for aggregation questions. Removing it drops LoCoMo from 75.90% to 71.46% and LongMemEval from 77.00% to 70.75%. Removing both leaves 63.12% and 63.00%.

Both patterns point the same direction as the two independent studies above: processing loses things, and raw evidence has value that cannot be replaced.

Transplanting the pattern into systems built by others

The paper does not stop at its own scores. It transplants the intent-routing composition module into five existing hand-designed memory systems, keeping the original construction and retrieval of each and changing only how evidence gets composed.

On LongMemEval all five improve, with gains between 2.75 and 9.25 points: SimpleMem goes from 49.25% to 58.50%, LightMem from 59.25% to 68.25%, Zep from 46.75% to 52.25%, and Mem0 from 47.50% to 50.25%.

The spread has an explanation. Mem0 gains only 2.75% because its failures are mostly not cases of evidence being available but unused, but rather retrieval failing to bring back the needed information in the first place, which is exactly what intent routing does not fix. The accompanying error attribution analysis confirms this: the routing module corrects 42% to 60% of errors judged recoverable, against only 3% to 13% of errors where the evidence was simply missing.

Put cost in the objective and computation moves

A more immediately useful design choice is that the search objective can include serving cost alongside accuracy.

With accuracy as the only objective, search piles work into the build stage. On the LongMemEval trajectory, step 13 introduces per-session note extraction at build time and serving cost rises roughly sixfold. MAPE-ALME ends up spending about 92% of its serving cost on build-time atomic note extraction.

Once cost enters the objective, the discovered programs look completely different. MAPE-PLME uses BM25 and makes no model calls at build time at all, while MAPE-PLCM retrieves raw conversation turns and consults extracted facts only for aggregation questions. These two accuracy-cost programs make 90% fewer serving calls than their accuracy-only counterparts on LongMemEval and 40% fewer on LoCoMo.

In other words, telling the optimizer to spend carefully moves computation from processing at write time to selective processing at query time. The cost accounting is spelled out too: fixed unit prices converted into dollars per 1,000 queries, with a price list dated 21 September 2026, excluding judge calls, search-agent calls, local computation and storage, and with latency not measured.

Rankings flip when the model or benchmark changes

This is where the programs turn out to be fragile.

Serving the same LoCoMo-evolved programs with the Qwen backbone directly reverses the ranking between the two. Accuracy-only MAPE-ALCM falls from 79.84% to 43.80% on temporal questions, while MAPE-PLCM holds at 70.93%. The explanation given in the paper is that MAPE-ALCM leaves relative date resolution to the question-answering model, whereas MAPE-PLCM converts relative expressions such as last week into absolute dates before answering.

Cross-benchmark transfer does not always win either. The two programs evolved on LoCoMo reach 65.50% and 64.25% when moved to LongMemEval, beating the five hand-designed memory systems but still below naive RAG at 66.00%. In the other direction, programs evolved on LongMemEval reach 75.90% and 74.67% on LoCoMo, ahead of every baseline.

What the paper admits about its own limits

The limitations section is candid: the findings hold on two question-answering benchmarks, the component analysis centres on one representative program, evolutionary trajectories vary between runs, and the cost comparison covers serving token charges only, with conclusions that depend on how build-time cost amortizes across queries. This is an arXiv preprint with no venue noted, listing 24 pages, 8 figures and 10 tables.

So what

What this work actually delivers is not a higher score, since 87.94% and 77.00% will both move with the benchmark and the model, but a process that can find designs on its own, plus two patterns that were validated repeatedly and can be transplanted into systems built by others: keep the raw text, and route by intent.

For anyone building agents, that is more worth copying than any particular architecture. Do as little processing as possible at build time, and move processing to query time, keyed by question type. If you want lower cost, put cost into the search objective rather than hoping the model learns to economise on its own.

The precondition is that evaluation has to follow the protocol used in the paper: not just final accuracy, but also what each query cost and whether the retrieved evidence was complete.