Agentic Memory Under Context Constraint

Memory systems for LLM agents are mostly judged on retrieval benchmarks: can the right fact be fetched? I asked a different question: when an agent's context window is too small to hold everything it has read, does the way its memory is represented change whether it finishes the task?

To answer it I built an agent harness where every layer can be swapped from config, then ran controlled experiments that change one thing at a time: the memory.

+62 ptsgraph over vector memory on 3-fact chains, 95% CI [48, 75], pre-registered
905recorded agent runs on Gemini via Vertex AI
93.3 ptsgap between no memory and perfect memory: the task set can detect a difference
567 tests100% coverage, 15 implementations behind conformance suites

Same task, same model, same seed. Only the memory changes.

A real recorded run, replayed step by step. The agent must find the access code for site_000_02. Three facts in 19 documents chain to the answer, mixed in with 16 look-alike distractors:

The context budget is 2,000 tokens, about seven documents. By the time the agent reads doc_18, the first two facts were dropped from its window long ago. It can only answer if its memory brings them back.

step 1

Green chips are the three facts the answer needs. "In window" is what the context still holds after the budget evicts older reads; "memory returned" is what retrieval added back on that step. Data: the run traces, unedited.

Results

Six memory conditions, 30 generated tasks, 2 seeds each, 360 runs at a 2k budget on Gemini 3.5 Flash-Lite. The NoOp (no memory) and Oracle (handed exactly the right facts) conditions bracket what any real memory can do.

Task success on three-fact chains, with 95% confidence intervals

I declared the expected outcome before the paid run: graph beats vector, with a confidence interval excluding zero. It held: +0.62 [0.48, 0.75], paired over tasks with 2,000 cluster-bootstrap resamples. Vector memory returns the root fact because it reads like the goal, but among sixteen near-identical "the access code for X is N" documents it misses the middle link. Graph memory follows entity links from the goal to the chain.

Episodic memory scored zero: with no time range in the query it returns the newest items, which the window still holds anyway. Recency answers "what happened around step 4"; this task needs "what is linked to the thing I was asked about".

A metric that agrees with task success

On the easier two-fact pilot, standard retrieval recall ranked the memories in a way that contradicted their task success. So I introduced dropped-fact recall: of the facts the context window has lost, how many did memory bring back? It is the only one of three definitions consistent with which agents finished.

MemoryTask successStep-averaged recallFinal-step recallDropped-fact recall
vector0.980.970.611.00
graph0.930.070.930.95
episodic0.000.040.060.00

Two-fact pilot, 60 runs per row. Step-averaged recall says graph memory is nearly useless (0.07) while it finishes 93% of tasks.

How it is built

The premise: no single agent configuration is best for every task, so whoever runs the agent should be able to choose each component. That is only worth building if the choice actually matters, which is what the study measures.

PlannerReAct, single-step
Context managertoken-budgeted, full; records every eviction
Memory (varied)vector, episodic, entity-graph, hybrid; NoOp and Oracle as floor and ceiling
Tool runtimesandboxed task documents, mock
Evaluatorchecker against generated ground truth

What I learned, and what is next

These are pilot results: graph versus hybrid is not yet separated at this sample size, and I report that rather than a winner.