Paper Breakdowns  /  MemGPT
Paper 37~8 min readBerkeley · 2023
Paper Breakdown

MemGPT,
explained.

Your computer has 16 GB of RAM and runs programs that think they have terabytes — because the operating system quietly pages memory between RAM and disk. MemGPT asked: why not do the same for a language model? Treat the context window as RAM, external storage as disk… and make the model itself the operating system, paging its own memories in and out with function calls.

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

The goldfish problem

In 2023, context windows were 4–8K tokens, and even today every window is finite. The failure it causes is intimate: tell an assistant in January that you're vegetarian, and by March — three hundred messages later — it cheerfully recommends a steakhouse. The fact scrolled out of the window, and out of existence. Naive fixes each fail: bigger windows fill eventually (and degrade as they fill); summarizing everything blurs details; RAG over history retrieves but never updates — the model can look things up, but it can't remember that a fact changed.

What long-lived assistants need isn't a bigger window. It's memory management: deciding what stays instantly visible, what gets archived, what gets revised, and what comes back when relevant.

02

Steal the oldest trick in systems

Operating systems solved exactly this problem sixty years ago. Programs address vast virtual memory; the OS keeps hot pages in small fast RAM, parks cold pages on big slow disk, and swaps on demand. The program never knows. MemGPT maps the hierarchy one-to-one: main context (the window) is RAM; external context (a database) is disk; function calls are the paging mechanism.

The key idea

The radical part isn't the hierarchy — it's the manager. In an OS, dedicated kernel code decides what to page. In MemGPT, the LLM manages its own memory: it decides what's worth saving, what to revise, and what to search for, using its own judgment of relevance.

03

The tiers: what lives where

TierLivesHolds
Core memoryin-window, always visiblethe durable facts: user profile, persona, standing preferences — small and editable
Message bufferin-window, FIFOrecent conversation, evicted as it ages
Recall storageout-of-windowfull message history, searchable
Archival storageout-of-windowarbitrary saved knowledge, documents, notes

The split encodes a theory of importance: identity-level facts deserve permanent residence in the window ("vegetarian" should never need retrieval); everything else earns its way back in through search. Getting that boundary right is most of the art of agent memory to this day.

04

Memory as tools: the model edits itself

All of it runs on ordinary function calling. MemGPT hands the model tools like core_memory_replace, archival_memory_insert, conversation_search — and the system prompt teaches it to be its own librarian.

User: "By the way, I moved from Austin to Berlin last month."
function: core_memory_replace("lives in Austin" → "lives in Berlin")
function: archival_memory_insert("Moved to Berlin, June — misses Texas BBQ")
Assistant: "Big move! How's Berlin treating you?"

Note what happened: the fact wasn't appended, it was revised — the old value is gone from core memory. That's the operation RAG-over-history fundamentally can't do, and it's why MemGPT agents don't recommend steakhouses to vegetarians in March.

05

Interrupts, heartbeats, and memory pressure

The OS analogy runs deeper than storage. MemGPT is event-driven: user messages, timers, and function results all arrive as interrupt-like events that wake the processor (the LLM). A heartbeat mechanism lets the model chain multiple steps — search, then read, then answer — without the user prompting each one.

And when the message buffer nears capacity, the system raises a memory-pressure warning — the model is told, in-band, that eviction is coming, and it responds like a good process: summarizes what matters, writes the durable bits to archival storage, and lets the rest page out. Forgetting becomes a managed operation instead of a silent catastrophe.

06

What the experiments showed

Two benchmark families, both built to punish goldfish memory. In deep-retrieval conversation tests (recall a fact from far outside the window; answer consistently with an evolving persona), MemGPT with a small window beat fixed-context baselines — including ones given far larger windows. In document analysis, it handled question-answering and nested key-value lookups over document sets vastly exceeding the window, paging chunks in as needed — including multi-hop lookups where each retrieved value is the key to the next search.

The pattern across both: managed small memory beat unmanaged big memory. The window size mattered less than what the system did with it.

07

Why it still matters

MemGPT wrote the vocabulary of agent memory. Core vs recall vs archival tiers, memory-exposed-as-tools, summarize-on-pressure, the agent as its own memory manager — that architecture is now visible in nearly every serious agent framework and every "the assistant remembers you" product. The project itself became Letta, a runtime built around persistent self-editing agents.

The deeper legacy is the framing: LLM limitations are systems problems. The model is a processor; intelligence about memory, scheduling and I/O can live in the architecture around it. That lens — the LLM-as-OS-process view — now shapes agent memory design, context engineering, and the whole harness discipline.

Read next

The mechanism it runs on: Toolformer and tool calling. The production blueprint: Design an Agent Memory System. The discipline it seeded: Context Engineering.

Frequently asked

Quick answers

What is MemGPT?

An LLM system borrowing the OS playbook: context window as RAM, external storage as disk, and the model paging information between them via function calls.

What are the memory tiers?

Core memory (always in-window, editable facts), the recent-message buffer, and out-of-window recall + archival storage reachable through search functions.

What is self-editing memory?

Memory operations exposed as tools — the model appends, replaces and archives its own memories, so facts get revised, not just accumulated.

What became of it?

Its architecture became the standard agent-memory pattern, and the project grew into Letta, an agent runtime built on persistent memory.

Finished this one? 0 / 42 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns