2026-08-03 · 16 min · agents · memory · reinforcement-learning · llm · explainer
Most memory-augmented agents treat a retrieved experience the way a tape recorder treats a cassette: press play, get back exactly what was stored. MemHarness, from a Zhejiang University / Shanghai AI Lab team, argues that's the wrong model of memory entirely — and points at cognitive science to say so. Human recall isn't playback; it's reconstruction, rebuilt each time from fragments and reshaped to fit the moment. Their agent does the same: before acting on a retrieved memory, it first critiques that memory against what it's looking at right now, and rewrites it if the two don't match.
The failure mode: negative transfer from a memory that no longer fits
Retrieval-augmented agents work like this: finish a task, distill what happened into a short natural-language "experience," store it, and next time a similar task comes up, pull the closest matches back into context. The problem is closest is doing a lot of work. An experience learned from one kitchen layout, one inventory state, one shopping page, gets pasted into a context where the fridge is already full or the shelf has something else on it — and the agent, having no reason to doubt its own memory, follows the stale instruction anyway. MemHarness calls this the "replay" paradigm, and its central claim is that replay's failures are systematic, not occasional: the retrieved experience is abstract and general by construction, while the state at decision time is concrete and constantly changing, and nothing in a replay pipeline reconciles the two.

This isn't a new observation for this site — Agent harnesses: engineering the loop around the model already named "context and memory lifecycle" as one of the open problems in agent engineering, and pointed out that a file-backed harness effectively turns the file system into the agent's long-term memory. MemHarness is a concrete answer to a sharper version of that problem: it's not enough to store memory durably, the harness also has to decide, at read time, whether a piece of stored memory still applies — and if not, what to do about it. MemHarness's answer is to make that decision itself a trained, learned skill rather than a fixed retrieval-and-paste rule.
Three stages: retrieve, reconstruct, act
Formally, the agent holds a memory bank of entries — an abstracted experience paired with the source observation it was distilled from. At each step , retrieval returns the top- closest entries, . A pure replay policy conditions the next action directly on whatever comes back:
MemHarness inserts one step in between. The same policy first produces guidance by critiquing the retrieved experiences against the current history , then maps that into final guidance , and only then generates the action:
The reconstruction input concatenates the task, the recent history, and every retrieved (experience, source-state) pair:
and is a simple conditional: if the policy decides nothing retrieved applies, it
emits the literal token <EMPTY>, and falls back to a fixed self-reasoning
prompt instead of forcing a bad match into the action context.

The mechanics of that middle stage — comparing a retrieved memory's source state against the live one, and deciding pass-through / adapt / reject — are easiest to see with a toy example. Toggle through the three cases below:
Replay injects whatever the memory bank returns and never looks at whether it still fits. When the state matches the memory’s source, that costs nothing — both paths agree. Once the state has drifted, replay keeps repeating the stale instruction while reconstruction rewrites the target to the shelf that is actually free. And when nothing retrieved applies, reconstruction can say so explicitly — <EMPTY>— and drop back to the agent’s own reasoning, instead of forcing a bad match into the context.
Note what each branch does differently from plain replay. When the state genuinely matches the memory's source, reconstruction is a no-op and replay would have been fine anyway — the interesting cases are the other two. When the state has drifted, reconstruction rewrites the target, not just the wording, while replay keeps repeating an instruction the environment has already invalidated. And when retrieval turns up nothing usable, MemHarness can say so explicitly and fall back to the agent's own reasoning — a replay pipeline has no equivalent move; it either injects a weak match or injects nothing silently.
Training: one policy, three roles, GRPO end to end
The same weights play all three parts — retriever-decider, reconstructor, actor — and the whole thing is trained with GRPO on a sparse outcome reward plus a small format bonus:
is 10 for a successful episode and 0 otherwise;
checks that every step emits exactly one valid <think> block, one valid <action>
block, that memory is retrieved through valid <retrieve_memory> blocks (one to five
times per episode), and that everything is in English. Rewards are group-normalized —
sample rollouts per prompt and standardize against the group:
and the policy update is the standard clipped-surrogate-plus-KL objective, with clip range and KL coefficient :
None of this is a new RL recipe — it's the same token-level, group-relative machinery covered in Token-level RL is a first-order approximation to the reward you actually want. What's specific to MemHarness is that the reconstruction step itself is inside the RL loop and gets credit for the same sparse outcome reward as the final action, rather than being a fixed prompt template bolted on the side. That's also why an ablation later in this piece — replacing the trained reconstruction with a generic, untrained LLM doing the same rewriting job — measurably underperforms: rewriting text is not the same skill as rewriting text so that it wins the episode.
Before RL, there's a short cold-start SFT stage — 200 trajectories with GPT-5.1-generated
retrieval and reconstruction turns, plus 200 trajectory-to-memory summarization examples
per benchmark — whose only job is to teach the interaction protocol (when to emit
<retrieve_memory>, how to format guidance). The paper is explicit that this stage is
about "protocol and format alignment rather than task-skill acquisition," and the numbers
back that up: the cold-start model alone scores a worse 7.6% on ALFWorld than the
untrained base model's 14.5%, because it has learned to follow a longer protocol without
yet having learned to solve the task.
The memory bank itself lives in Milvus, embedded with BGE-M3, retrieved by cosine similarity at . It isn't hand-curated — during training, the policy distills roughly half of its own generated trajectories (balanced between successes and failures where possible) into new memory entries, so the bank grows out of the same policy that reads from it. Write-time deduplication skips a new entry if it's too similar (cosine ) to something already stored — enabled for WebShop, disabled for ALFWorld — and retrieval-time deduplication thins a larger candidate pool before truncating to the top-.
Does it beat the baselines
On the headline numbers: MemHarness reaches 85.2% average success on ALFWorld's six task categories and 75.6% on WebShop, ahead of every baseline the paper reports — including foundation models an order of magnitude larger:
A few things worth being precise about here. The 16-row full table (not all shown above) mixes closed-source frontier models (GPT-4o, Gemini-2.5-Pro), prompt-only memory agents (ReAct, Reflexion, Mem0, ExpeL, MemP, SimpleMem), and RL-trained agents (RLOO, GRPO, MemRL, EvolveR, and two "+GRPO" memory hybrids) — and with one exception (EvolveR, explicitly marked "reproduced"), the paper doesn't say whether the other baseline numbers are copied from those methods' original papers or re-run by the authors under this setup. Given every RL-based and prompt-based baseline shares the same Qwen2.5-7B-Instruct backbone as MemHarness, it reads as an in-house re-implementation for a controlled, like-for-like comparison — which is the right thing to do for fairness, but it also means there's no independent number to check any of them against. Mem0 in particular scores worse than the untrained base model on WebShop (2.0% vs. 7.8%) — plausible for a general-purpose memory library not tuned to this task, but a reminder that "memory system" is not automatically an improvement.
Why raw memory can hurt: the ablation
The paper's most useful table isn't the leaderboard, it's the ablation, because it isolates why MemHarness wins rather than just that it wins. Same policy, same GRPO recipe throughout — only the memory wiring changes:
The reference tick marks RL-only, no memory at all. Raw verbatim replay (RL + Raw Memory) sits below that line on ALFWorld — memory hurt more than it helped until it was reconstructed. Withholding memory at test time after reconstruction-aware training (w/o memory) still beats RL-only on both benchmarks, which is the paper’s case that the reconstruction objective sharpens the policy’s own reasoning, not just its memory use.
Two results here are worth sitting with. First, RL + Raw Memory — verbatim replay, grafted onto the same trained policy — actually loses to having no memory at all on ALFWorld (70.1% vs. 76.4%), which is the paper's sharpest evidence that unreconstructed memory is not a free win; it can be actively confusing. Second, w/o memory — the fully-trained MemHarness policy with retrieval switched off at test time — still beats the no-memory-ever RL baseline on both benchmarks (83.0% vs. 76.4% on ALFWorld, 73.6% vs. 66.1% on WebShop). The paper reads this as evidence that training the policy to reconstruct memories also sharpens its general reasoning, independent of whether memory is available at inference — the reconstruction objective works partly as a training-time signal, not only a run-time lookup.
The training curves back this up with a second, independent kind of evidence — not an end-of-training snapshot, but what happens over the run:

Trajectories where the policy accepted a reconstructed memory track the overall success-rate curve closely; trajectories where it rejected one lag behind and stay noisier throughout training. That's a consistency check on the whole framework: if "accept vs. reject" were an arbitrary or miscalibrated signal, there'd be no reason for it to correlate with which trajectories actually succeed.
MemHarness also holds up when the environment itself is unfamiliar. On ALFWorld's out-of-distribution split — unseen room layouts and object placements — it scores 85.9%, while stripping reconstruction back out (raw memory injected, same OOD environments) drops to 76.3%, and disabling reconstruction only at test time (same trained policy) lands at 82.4%. The direction of every result here matches the in-distribution ablation: verbatim replay is the worst way to use memory precisely when the environment has changed most.
The mechanism, under a microscope
Everything so far shows that reconstruction helps. The paper also runs two controlled probes asking a narrower question: does the policy's reconstruction step actually compare the current state against the memory's recorded source state, or is it just producing plausible-sounding rewrites without really checking anything?
On ALFWorld, removing the source state entirely leaves rejection rate almost flat but success rate drops — the agent accepts guidance it should have questioned. Swapping in a random source state spikes rejection instead, because the model is actively comparing the current observation against that source, not just reading the retrieved text.
The source-state ablation answers this directly: strip out of the reconstruction prompt entirely, and rejection rate barely moves — but success rate drops, because the policy now accepts guidance it has no way to judge as stale. Swap in a random memory's source state instead — a state that's guaranteed not to match — and rejection rate jumps sharply (8.7%→13.3% on ALFWorld, 56.0%→63.3% on WebShop). That asymmetry is the tell: removing the comparison signal doesn't change behavior much because the policy simply can't tell anymore, while corrupting it with a wrong-but-present signal actively triggers more rejections. The counterfactual probe — asking a strong LLM to make a minimal edit to 1,000 real states so a previously-applicable memory should no longer apply, then scoring only the reconstruction output — shows the same pattern from the other direction: minimal edits shift outputs measurably away from "unchanged" and toward "adapted" or "rejected" on both benchmarks, with WebShop rejecting far more often than ALFWorld in both the matched and edited conditions (72–79% vs. 0–6%), which the paper attributes to WebShop's longer, more heterogeneous page observations making a fuzzy accept riskier than a clean reject.
Honesty check
- Self-reported, single lab, no replication. Every number above is from this one paper. I found no independent reproduction, and the community-discussion page on alphaXiv had nothing beyond the paper's own abstract and tables at the time of writing.
- Baselines are the paper's own reruns, not cited published numbers, as far as the text discloses — with the single exception of EvolveR, marked "(reproduced)" in the table. That's a reasonable design for a fair, same-backbone comparison, but it also means none of the sixteen rows in Table 1 have an outside number to be checked against.
- No hardware, no latency, no cost. The paper never states what GPUs it trained or evaluated on, never reports wall-clock time, tokens/sec, or dollars, and never measures the added inference cost of the reconstruction step itself. Reconstruction is a second full decode pass through the same 7B policy on every step where memory is retrieved (retrieval decision, then reconstruction, then action) — at minimum one extra generation versus a direct-replay or no-memory baseline — and that overhead is not quantified anywhere in the paper.
- No variance, no seeds. Every success-rate and rejection-rate number is reported as a single figure with no standard deviation, confidence interval, or multi-seed spread disclosed for the evaluation runs.
- Two benchmarks, one model scale. ALFWorld and WebShop are both well-worn, relatively short-horizon (15–50 step) simulated environments; the paper does not test a larger backbone, a real-world tool-using agent, or a benchmark with a genuinely different observation modality. The conclusion names this directly: "future work will explore scaling to larger models and open-ended environments" — which is the authors' own way of saying this hasn't been tried yet.
- No explicit Limitations section. The paper has no dedicated limitations discussion; what's above is reconstructed from the ablations, the conclusion, and what the method section does and doesn't measure.
- What is solid: the mechanism probes (source-state ablation, counterfactual editing) are a genuine attempt to falsify the "it's just fluent rewriting" explanation, and they point the same direction from two independent angles. That's better methodological care than a bare leaderboard table, even without outside replication.
The take
The idea underneath MemHarness is simple enough to state in a sentence — compare the memory's source state to the current one before you trust it — and the paper's real contribution is making that comparison a trained skill inside the same policy, credited by the same sparse outcome reward as the action itself, rather than a hand-written heuristic bolted onto retrieval. The ablations back the framing better than the leaderboard does: raw memory replay measurably loses to no memory at all on one benchmark, and the reconstruction-trained policy keeps a chunk of its advantage even with memory switched off entirely, which says the training signal is doing more than teaching better lookups.
What it hasn't shown yet is whether any of this survives outside two small, well-studied
simulators at 7B scale, and whether the extra reconstruction pass is worth its
unmeasured latency cost in a setting where that matters. "Reconstruct, don't replay" is a
good design principle for any agent harness that reads back its own memory. Whether this
specific recipe for teaching it — GRPO, a <EMPTY> escape hatch, a Milvus bank refreshed
by the policy's own trajectories — is the way to get there past ALFWorld and WebShop is
still an open question the paper itself doesn't claim to answer.
Built on MemHarness: Memory Is Reconstructed, Not Replayed (Wu et al., 2026; arXiv:2607.28272). Figures are reproduced from the paper for commentary. The interactive diagrams use the paper's measured table values except where marked illustrative; see the Honesty check above for what is and isn't independently verified.