Skip to slide
Chapter 3 · How Memory Is Built and Retrieved
17 / 40

CHAPTER 03 · How Memory Is Built and Retrieved · 2 / 7

How memories get written: extraction, not raw logging

The "Building Long-Term Memory" article is the clearest on the write phase, and its central point is that you should not store raw conversation. Raw logs are too verbose to retrieve efficiently. Instead, each interaction is distilled before storage, in three different ways for three different memory types.

Structured summarization (for episodic memory). Each interaction is reduced to a structured summary with fields like intent (what was the user trying to do), execution (what actions were taken, which tools used), and outcome (did it succeed, what was the result). This structure is what makes memories searchable later: you can find all past interactions about "email campaigns" without scanning thousands of raw messages.

Preference extraction (for procedural-style memory). Learning preferences works differently. Instead of storing every interaction, the system maintains a living document of learned behaviors. When a user gives feedback, whether explicit ("I prefer shorter responses") or implicit (consistently editing the agent's output a certain way), this document updates. The key insight is that preferences should be regenerated, not just appended: each new interaction is a chance to refine the understanding, not merely add to a growing list. Preferences can be modified or removed, not just accumulated.

Fact extraction (for semantic memory). The system pulls durable facts from conversation, distinguishing them from transient context. "We're a 50-person company" is worth keeping; "I'm having a busy week" is not. Many systems stage extracted facts for review before promoting them to permanent semantic memory, adding a check for accuracy.

← → arrow keys work too