AI, Software Development
Agent Memory Design: 4 Research Frameworks Worth Stealing
TL;DR: Agent memory works when you build it in layers: episodic memory for what happened, a graph for how facts connect, hybrid retrieval to pull the right bits back, and a pruning policy so old junk does not pile up. One vector store bolted onto a prompt is not a memory system. Four 2026 research papers show what to steal.
Agent memory is what your agent remembers between turns, between sessions, and between months.
Most teams build it as one vector store bolted onto a prompt. Then they wonder why the agent forgets a customer's name halfway through a chat, or drags three months of chat history into every call and burns the token budget for nothing.
The fix is layers. Episodic memory for what happened. A graph for how facts connect. Hybrid retrieval to pull the right bits back. And a lifecycle policy so old junk gets pruned instead of piling up.
Four research papers from 2026 spell out how. You don't need to rebuild any of them. You just need to steal the good ideas.
What agent memory design actually means
It means deciding three things. What the agent keeps. How long it keeps it. And how it gets it back when it matters.
Teams converge on four memory types. Skip one and you get a matching failure.
- Working memory holds state for the current task. Current goal, recent turns, live tool output. It dies when the session ends. This is your context window, and it has a hard token ceiling.
- Semantic memory stores durable facts. "This customer renews in March." "This API returns paginated results." It rarely changes.
- Episodic memory stores events with time and context attached. What happened, when, in what order. This is what lets an agent say "last Tuesday you asked about refunds, and we issued a credit."
- Procedural memory stores learned behaviour. Action sequences that worked. Closer to a skill than a fact.
The rule is simple. Needed only for this turn? Working memory, let it expire. A fact that rarely changes? Semantic. Tied to a moment the agent might reason about later? Episodic.
Here's the bit most teams get wrong. The agents that feel genuinely aware of history lean hard on the episodic layer. It's also the layer almost nobody builds properly.
Capture, analyse, commit
Treat memory as a pipeline, not a side effect of logging. Three stages. Skip one and the whole thing quietly rots.
- Capture traces. Log the raw interaction. User input, agent output, tool calls, timestamps, any state that changed. Capture enough to reconstruct what happened. Don't store every token of every reasoning step, that just balloons storage for nothing.
- Analyse and distil. Raw traces are too noisy to store as memory. Pull out event boundaries, so you know where one episode stops and the next starts. Pull out fact triples. Write short gists of what mattered. Amazon's Bedrock AgentCore does exactly this, then goes further and reflects across episodes to build reusable summaries of patterns it keeps seeing.
- Commit and update. Check new memory against old memory before it lands. Does this fact contradict something stored? Is this episode a duplicate? And set a refresh policy, because facts go off. A memory system with no expiry will serve a customer's old billing address forever, with total confidence.
Commit is where stale context sneaks in. A fact written once and never checked becomes a liability the day the real world moves on.
Pro tip: make retrieval take a bit of effort instead of dumping everything relevant into the prompt. Research on retrieval-based learning shows effortful recall builds stronger generalisation in people. Same holds for agents. A system that has to run a real query returns cleaner results than one handed the whole pile.
Why vector search alone falls over
Vector search breaks the moment a question needs two facts that were never written down together.
Ask "why did the customer's second ticket take longer than the first" and similarity search hands back two disconnected passages. Not the link between them. That's the core limit of RAG for causal or multi-hop questions. Embeddings capture similarity. They don't capture relationship.
Graph-driven architectures close that gap. Synapse, an activation-based episodic-semantic graph, lifted multi-hop reasoning accuracy by 23% and cut token use by 95% against full-context methods. Read that twice. Better memory made the prompts smaller, not bigger.
A hybrid recipe most teams land on:
- Vector search across episodic gists and facts. This is the job vector databases are built for.
- Lexical search (BM25 or similar) to catch exact IDs, names and terms that embeddings blur.
- Attribute filters to scope by user, session or document type before ranking runs.
- Time windows to weight recent episodes higher, because relevance fades with age.
Spreading activation is the other half. Relevance travels outward through the graph from a starting node. Add temporal decay so old, rarely touched nodes push less signal. Now you surface facts that are structurally relevant but worded nothing like the query. That's the exact case vector search misses. Redis's guidance on agent memory architecture recommends the same layered mix, for the same reason: no single method covers every question shape.
Four frameworks worth borrowing from
You don't need to reimplement a paper. You need the one idea inside it.
- REMem** builds a hybrid memory graph that links time-aware gists and facts. It reported 3.4% and 13.4% absolute gains on episodic recollection and reasoning against systems like Mem0 and HippoRAG 2. The steal: keep "what happened" and "what's true" separate inside one graph.
- SEEM** layers dynamic episodic event frames on top of a graph memory layer, and beat baselines on the LoCoMo and LongMemEval benchmarks. The steal: provenance pointers. Every abstracted event links back to the raw passage it came from. That traceability is gold when you're chasing down why the agent said something wrong six months ago.
- Synapse** trades full-context token cost for graph-propagated relevance, using lateral inhibition and temporal decay to mute the noise. The steal: activation beats similarity when structure matters.
- AgeMem** hands memory operations to the agent as tools it can call. Add, update, delete, retrieve, summarise, filter. Then trains the policy with reinforcement learning so the agent learns when to remember. The steal: memory management can be a learned behaviour, not a fixed rule you hard-code.
One catch runs through all four. Complexity and compute scale with graph size, and provenance tracking costs storage that's easy to underestimate in a prototype.
Storage, indexes and latency budgets
Pick storage by access pattern, not by what's already in the stack.
An in-memory store like Redis suits per-thread working memory, where latency beats durability. A vector database suits long-term semantic and episodic recall at scale. A light graph or metadata layer handles the relational queries and activation that vectors can't. For small deployments, local-first SQLite handles transactional state fine, paired with hybrid search for precision.
Index choice inside the vector layer has real trade-offs.
| Index | Strength | Cost |
| HNSW | Strong recall, fast queries | More memory per vector, stores multiple graph layers |
| IVF | Memory efficient, scales to big datasets | Loses recall unless you tune cluster count |
| FLAT | Exact results | Falls over past a few hundred thousand vectors |
Most production systems start on HNSW for the recall-to-latency balance. They move to IVF only when memory cost becomes the binding constraint.
Four things to build in on day one, not later:
- Provenance pointers on every fact and event, linking back to the raw trace.
- Namespaces per user or tenant, so retrieval never crosses an account boundary.
- Geo-distribution if you serve users across regions and latency matters.
- Latency SLOs for retrieval alone, separate from generation. Sub-200ms is the usual target.
Pro tip: cap incoming edges per node with a Top-K policy, and archive dormant nodes to cold storage on a schedule. That's how Synapse keeps its active graph bounded while retrieval stays fast.
How do you stop agent memory decaying?
Memory that only grows becomes a liability. Retrieval precision drops as noise climbs. Token cost creeps up even when relevance doesn't.
Three mechanisms handle it.
- Temporal decay lowers the retrieval weight of older entries, so recency biases results without deleting anything.
- Vitality scores track how often something gets accessed or confirmed. Rarely used entries become candidates for archive or deletion.
- Garbage collection windows run weekly or monthly and physically prune entries under a vitality threshold, keeping the live index bounded.
Consolidation is the other half. Instead of binning old episodic detail, distil it. If the agent has resolved the same class of issue forty times, promote the pattern to one reusable reflection. Don't keep forty near-identical episodes live in the index.
Measuring it needs the right benchmarks. LoCoMo and LongMemEval are what current research reports against, for long-conversation coherence and long-horizon recall. Track the operational numbers too. Retrieval precision at k. Token cost per turn as history grows. End-to-end retrieval latency. A system that aces LoCoMo and doubles your token spend is not a win.
A checklist for the first six weeks
Teams that get this right follow roughly the same order. It rarely starts with picking a vector database.
- Scope your memory types first. Decide what needs working, semantic, episodic and procedural memory before you write storage code. Most teams over-build semantic and under-build episodic, then wonder why the agent has no sense of continuity.
- Instrument traces from day one, before you've settled the retrieval architecture. You cannot retrofit good telemetry onto a live agent.
- Pick a retrieval pattern on purpose. Vector-only is fine for FAQ lookups. Multi-hop or causal questions need a graph or activation layer.
- Set latency and cost SLOs before you scale, not after history gets big enough to hurt.
- Write the pruning policy before launch. Retrofitting one onto a bloated index is a much worse week.
Scoping a vendor for this? Ask three direct questions. How do you refresh a stale fact? What's your acceptance test for a memory update, meaning does a new fact correctly beat a contradicted old one? How do you measure retrieval precision over time?
The red flag is a system with no forgetting at all. Memory that only accumulates isn't a design. It's a leak with good intentions.
If you're rolling agents out across a business rather than a single product, this enterprise agentic AI guide covers the operational side worth planning for.
What we would tell a team building this
We've shipped 200+ apps. Custom software, mobile apps, AI platforms. So here's the honest read.
The gap between a memory system that demos well and one that survives production is always in the parts nobody wants to build first.
Three omissions show up again and again. No refresh path, so facts go stale and stay stale. No garbage collection, so the index just grows. No provenance, so debugging a wrong answer months later is guesswork.
None of that is glamorous. All of it is what separates a system that's still fast a year in from one that degrades every week.
Build versus buy comes down to horizon. A narrow proof of concept can justify a simple vector store. Anything meant to run for years, across a growing user base, benefits from decisions made by people who've watched these systems rot and know what breaks first.
And a warning worth naming. Most agent projects that fail don't fail on the model. Digiocial's read on why 95% of AI agents failed lands on the same thing we see: the plumbing, not the intelligence.
Going deeper on what the agent sees each turn? AI Orchestrators cover context engineering for a business stack, and AI-Led have a builder's take on context engineering.
Building it with Devwiz
We build the memory layer as part of the agent, not as a patch after launch.
Where a lot of teams stop at a vector store and a prompt template, we design the whole pipeline. Trace capture. Episodic extraction. Hybrid retrieval. The pruning and consolidation rules that keep it fast as usage grows.
Our AI app development work covers what founders and CTOs actually need:
- Proof-of-concept builds to test a memory architecture before you commit real infrastructure spend.
- Full platform builds with production-grade retrieval, storage and lifecycle management built in.
- Governance and ongoing operations, including tracking retrieval precision and token cost as you scale.
Running a multi-phase build with platform-level memory needs? Our AI platform program work covers that too. Same thinking applies when you're wiring up multi-agent systems, where every agent needs its own view of what happened.
Want a hand scoping the memory layer before you write a line of storage code? Worth a chat.
Frequently asked questions
What is the difference between episodic and semantic memory in AI agents?
Episodic memory stores specific past events tied to time and context, like one customer conversation. Semantic memory stores durable facts that rarely change. Most agents that feel aware of history lean on the episodic layer.
Is vector search enough for agent memory retrieval?
No. Vector search captures similarity, not relationship, so it struggles with multi-hop or causal questions. Combine it with lexical matching, attribute filters and a graph or activation layer.
What are LoCoMo and LongMemEval used for?
They are benchmarks for long-conversation coherence and long-horizon memory recall. Most current agent memory research reports against one or both, so they are a fair way to compare approaches.
Should I build agent memory in-house or use a partner?
A simple proof of concept can justify an in-house vector store. Systems meant to run for years benefit from experience with pruning, provenance and lifecycle management, because that is what breaks first.
How often should agent memory be pruned or consolidated?
Garbage collection usually runs weekly or monthly depending on volume, using vitality scores and temporal decay to flag low-value entries. Consolidation distils repeated episodes into one reusable summary.
About James Killick
10+ years building digital products · 200+ apps shipped since 2015
James is a co-founder of Devwiz and an AI product specialist. Since 2015 he has helped ship 200+ apps for founders, businesses and government, including work for NSW Government, Briometrix and Huskee. He builds AI-first platforms and writes about turning a proven program into software. He also hosts the Up in the AI podcast.
More articles by James · James's personal site · LinkedIn · AI Orchestrators
Tags: AI, AI Agents, Agent Memory, AI Platforms, RAG


