readingmemorypart 12

Evaluating and Securing Memory: Benchmarks, Metrics, and Poisoning

Agent Memory, Made Clear · Part 12 · 7 min read

A memory system you cannot measure is a demo; one you cannot defend is a liability. This blog covers both halves of shipping seriously: proving memory works, and protecting it - because a store the agent trusts across sessions is also the juiciest attack target in the whole architecture.

Part 1: Evaluation

What makes memory hard to evaluate

“Did the agent answer well?” is not a memory metric. Memory quality only shows up across time: the fact learned in session 3 must surface correctly in session 30 - after dozens of chances to mis-store, stale-out, or lose it in retrieval fights. So memory evaluation needs longitudinal tests: long, multi-session histories with questions whose answers live far in the past. That is exactly what the standard benchmarks construct.

The benchmarks to know

LoCoMo (long conversational memory): very long multi-session conversations (~300 turns, up to ~35 sessions per history) with ~1,540 questions in four flavors - single-hop (one stored fact answers it), multi-hop (combine facts across sessions), temporal (reasoning about when things happened/changed), and open-domain (blend memory with world knowledge). The de-facto standard scoreboard for memory layers - Mem0’s headline numbers, for instance, are LoCoMo results.

LongMemEval: ~500 questions targeting six specific abilities: single-session recall of user info, of assistant statements, of preferences; multi-session synthesis; knowledge updates (fact changed - does the system serve the new truth?); and temporal reasoning. Deliberately brutal where naive systems are weakest - updates and time (exactly Blog 5’s truth problem, benchmarked; temporal-first designs like Zep make their case here).

BEAM and kin push scale (1M-10M-token histories - beyond any context window, so raw stuffing cannot compete) - closest to real production lifespans.

Read benchmark tables with two eyes: the score, and the tokens-per-query it cost (Blog 11). “92 at 7k tokens” and “94 at 100k tokens” are very different products. Report both for your own system, always.

Production metrics: the dashboard that matters

Benchmarks validate the design; these validate your deployment:

The failure taxonomy for debugging

When memory “fails,” localize it: never stored (write-path selection miss) → stored wrong (bad extraction/reconciliation) → stored, not retrieved (read-path miss - query, scoring, or budget) → retrieved, ignored (injection framing, context rot) → retrieved, stale (truth problem - update/invalidations broken). Five different bugs, five different owners, one user-visible symptom. Instrument so you can tell them apart.

Part 2: Security

Why memory changes the threat model

Prompt injection - malicious instructions hidden in content an agent reads - is already the top agent threat. Memory adds the dangerous word persistence: a normal injection dies with the session; an injection that gets written into memory comes back in every future session, laundered as the agent’s own trusted knowledge, attacking users who never touched the poisoned source. Retrieval is the delivery mechanism: the agent asked for relevant memories and got the attacker’s payload with “here’s what you remember” framing.

The attacks, concretely (from the research literature)

The defense stack

No single fix; layered controls at each stage of the pipeline you now know well:

Privacy: the sibling obligation

Same storage, different duty: memory is a dossier, so a launchable product needs user visibility (show what’s remembered - legibility as trust, per Claude’s design bet), user control (edit, delete - honored everywhere, including derived memories: Blog 9’s sacred rule), selective non-persistence (sensitive categories require consent or never persist; incognito sessions), and isolation (per-user stores, cross-tenant leakage treated as severity-one). Regulators increasingly require exactly this; users reward it either way.

Quick recap

Last blog: the blueprint - assembling all thirteen parts into a memory product you could actually launch.

← Part 11Part 13 →