Trees, Graphs and Operating Systems
Trees, Graphs and Operating Systems: How Long-Term Memory for AI Agents Is Built
A map of the published designs for AI agent memory: summary trees, knowledge graphs, operating-system-style paging and fact stores. What each measured, why the best keep the original words under every summary, why plain baselines are hard to beat, and the licence of each project's code.
The question
Every AI memory system has to answer the same three questions. What do you keep? How do you find it again? What do you do when it no longer fits?
Researchers have answered them with trees of summaries, knowledge graphs, and designs borrowed from computer operating systems. This note is a map of the published work, what each approach measured, and what we took from it for Klyroe Memory, which is in development and not released.
How to read this: each section gives the simple idea first, then The real detail. Every figure comes from the paper or code we name, opened by us. Numbers from different papers used different models and judges, so compare within a table, not across them.
Four families of design
The simple idea
| Family | The picture | Published examples |
|---|---|---|
| Summary trees | Group related pieces, summarise each group, then summarise the summaries | RAPTOR (Stanford), MemTree, MemoryBank, TiMem |
| Graphs | Turn conversations into facts and links between people, places and things | Zep's Graphiti, HippoRAG (Ohio State), A-MEM |
| Operating-system style | A small working memory in the prompt, a large archive outside it, and the model moves things between them | MemGPT (UC Berkeley, now Letta), MemoryOS |
| Fact stores | Pull out short facts, then add, update or delete them | Mem0, LightMem |
Most new systems mix two or three of these.
The real detail
- RAPTOR groups text by meaning, summarises each group with a model, and repeats until one summary is left. At question time it searches all levels at once; the authors found that "consistently performs better" than walking down from the top.
- MemTree grows a tree as conversation arrives: new content goes under the most similar branch, and the summaries above it are rewritten. That took about 3.3 model calls per insert against about 3,750 to rebuild a RAPTOR-style tree from scratch.
- MemGPT treats the prompt like a computer's main memory. When it fills, older messages move out to storage that stays searchable, and a running summary of them stays in view.
- Zep / Graphiti keeps the raw messages, the facts taken from them, and clusters of related facts. Each fact records when it was true and when the system learned it, so a new fact closes an old one instead of deleting it.
The finding that matters most: keep the original
The simple idea
Summaries are useful for finding things. They are not safe as the only copy. Every study that checked found summaries that added or changed details, and the systems that scored best kept the original words underneath.
The real detail
| Source | Finding |
|---|---|
| RAPTOR | In a hand check of 150 summaries, "about 4%" had minor hallucinations. |
| Recursive summarising for long chats (Wang et al.) | Inaccurate content did not exceed 10% of summary content in 100 checked samples. |
| HiMem (2026) | Removing the layer of concrete events dropped its score from 80.71 to 69.29. Removing the layer of abstract notes dropped it only to 79.63. |
| Generative Agents (Stanford and Google) | The most common errors came from failing to retrieve the right memory; agents also "hallucinated embellishments". |
Simple baselines are hard to beat
The simple idea
Fancy memory often loses to two plain things: giving the model everything, or plain search over the original text. A design only earns its complexity if it beats both.
The real detail
| Study | What won |
|---|---|
| Mem0's paper, short conversations | The full conversation (72.90) beat every memory system, including Mem0's graph version (68.44). Mem0's advantage was speed and cost. |
| LightMem, long histories (LongMemEval) | LightMem 68.64, A-MEM 62.60, plain search 61.00, full text 56.80, Mem0 53.61. Plain search beat two well-known memory systems. |
| HippoRAG 2 | A strong plain retriever (57.0 average F1) beat RAPTOR (48.8); the authors blame noise from model-written summaries. |
What the field agrees on
- Search every level, then open up. Use summaries to find the right region, then go back to the original words.
- Update the part that changed. Rebuilding everything costs thousands of model calls; refreshing one path costs a few.
- Do the summarising in the background. LightMem and others run it off the response path, so the user never waits for it.
- Keep time. Mark a changed fact as replaced rather than overwriting it, so "what did I say before?" still has an answer.
- Segment by topic before summarising. Summaries of one topic are clearer than summaries of an arbitrary window.
- Combine kinds of search. Keyword search, meaning-based search and links between entities beat any one of them alone.
Licences, briefly
We checked each project's licence file before reading its code. RAPTOR, HippoRAG, A-MEM, LightMem and MemoryBank are MIT. Letta, Mem0's open-source SDK, Graphiti, MemoryOS, HiMem and MemOS are Apache-2.0. Mem0's README says its newest headline scores come from its managed platform, which includes optimisations not in the open-source code.
Where Klyroe Memory sits
Klyroe Memory is a summary tree over a conversation's history. Recent detail stays as it was said, older history is summarised, and the assistant can search the whole history and open any summary back up to the original words. It is built to the rules above, plus two of our own from the security research: deleting something also removes what was summarised from it, and nothing in memory is ever treated as an instruction.
It is in development and not released, so we have no Klyroe results to report. When we do, they will be measured against the plain baselines in section 3.
Sources
- Sarthi et al. 2024, RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval (Stanford)
What we used
Collapsed-tree search; about 4% of summaries with minor hallucinations; MIT licence; opened 2026-11-24
- Rezazadeh et al. 2024, From Isolated Conversations to Hierarchical Schemas: Dynamic Tree Memory Representation for LLMs (MemTree)
What we used
About 3.3 model calls per insert vs about 3,750 for a rebuild; opened 2026-11-24
- Packer et al. 2023, MemGPT: Towards LLMs as Operating Systems (UC Berkeley)
What we used
Main and external context, recursive summary of evicted messages; Letta code Apache-2.0; opened 2026-11-24
- Park et al. 2023, Generative Agents: Interactive Simulacra of Human Behavior (Stanford, Google)
What we used
Retrieval failures most common error; embellishments; opened 2026-11-24
- Rasmussen et al. 2025, Zep: A Temporal Knowledge Graph Architecture for Agent Memory
What we used
Episodes, facts, communities; bi-temporal edges; Graphiti Apache-2.0; opened 2026-11-24
- Chhikara et al. 2025, Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory
What we used
Full context 72.90 vs Mem0g 68.44; repository README on managed-platform scores; opened 2026-11-24
- Fang et al. 2026, LightMem: Lightweight and Efficient Memory-Augmented Generation (ICLR 2026)
What we used
LongMemEval-S GPT-4o-mini: 68.64, A-MEM 62.60, naive RAG 61.00, full text 56.80, Mem0 53.61; opened 2026-11-24
- Zhang et al. 2026, HiMem: Hierarchical Long-Term Memory for LLM Long-Horizon Agents
What we used
Ablation 80.71; without episodes 69.29; without notes 79.63; opened 2026-11-24
- Jiménez Gutiérrez et al. 2025, From RAG to Memory: Non-Parametric Continual Learning for Large Language Models (HippoRAG 2, ICML 2025)
What we used
Dense retriever 57.0 vs RAPTOR 48.8 average F1; opened 2026-11-24
- Wang et al. 2023, Recursively Summarizing Enables Long-Term Dialogue Memory in Large Language Models
What we used
Inaccurate content under 10% of summaries; opened 2026-11-24
- Xu et al. 2025, A-MEM: Agentic Memory for LLM Agents (NeurIPS 2025)
What we used
Linked notes that rewrite neighbours; MIT licence; opened 2026-11-24