MemGPT — virtual context as OS memory (Packer et al., 2023)
main context (RAM analog)
fixed-size prompt window, always visible to the model
[core] persona, user, task
named sections pinned inside the prompt
editable via core_memory_{append,replace}
[messages] recent turns
FIFO buffer; oldest turn evicts on cap
evicted turns available via conversation_search
archival memory (disk analog)
unbounded, searchable external store
record: id, text, tags, session, turn
written by archival_memory_insert
retrieved by archival_memory_search(top_k)
pluggable backend
vector (semantic), KV (fact), graph (relation)
Lesson 09 (Mem0) fuses all three
citations (session_id, turn_id) travel with every write
the interrupt pattern — one turn
1. assistant "I need the user's current project"
main context lacks the fact; cannot answer from window alone
2. tool call archival_memory_search("project for ava")
memory tool issued; runtime services it like an OS syscall
3. archival returns record a001
"ava is building a retrieval bot with 12 tools"
4. runtime splices observation into next assistant turn
same shape as any tool observation in the ReAct loop
5. assistant answers citing a001
retrieval traceable back to source record
6. new fact emerges archival_memory_insert
write-back closes the loop for next session
7. periodic consolidation (Letta sleep-time, Lesson 08)
stale records dedupe, contradicted facts invalidate
Letta (2024) extends to three tiers. Mem0 (2025) swaps archival for vector+KV+graph. Pattern survives.