Stanford CS329A (Ep 11): Agent Memory — MemGPT, Cartridges, CacheBlend, and Long-Horizon Context Architecture
· 12 min read
When developers deploy autonomous AI agents as long-term collaborators or autonomous engineering partners, they inevitably run into three frustrating architectural bottlenecks:
- "The agent forgets critical architectural decisions agreed upon in yesterday's session."
- "Stuffing a 100,000-line enterprise codebase into a million-token context window causes severe attention degradation (the Lost-in-the-Middle phenomenon) and inflates inference bills into thousands of dollars."
- "Combining multi-document retrieval chunks in RAG serving invalidates prefix key-value caches, sending Time-To-First-Token (TTFT) soaring into several seconds."
Human cognition solves this effortlessly. Biological brains possess a severely constrained working memory (holding only about 4 to 7 discrete chunks), yet effortlessly retrieve memories from decades ago and rapidly integrate cross-domain knowledge without retraining or cognitive paralysis.
In this continuation of Part 3: Agent Engineering of Stanford CS329A: Self-Improving AI Agents, we explore Agent Memory Architecture — how modern artificial intelligence grants autonomous systems persistent, hierarchical memory across three distinct abstraction tiers:
- The Software Control Tier (MemGPT, UC Berkeley 2023): OS-inspired hierarchical virtual memory paging.
- The Neural Representation Tier (Cartridges, 2025): Self-Study context distillation compressing massive documents into modular, plug-and-play continuous KV vectors.
- The Systems Infrastructure Tier (CacheBlend, EuroSys 2025): Selective KV cache recomputation restoring cross-attention and slashing RAG latency by 3.3x.
