Long-term memory

Long-term memory is everything the agent remembers across sessions. Without it, every conversation starts from zero. With it, the agent builds relationship, knows preferences, and remembers what worked.

What belongs in long-term

Storage models

Key-value store

Structured facts: user_name, preferences, settings. Fast, bounded, simple.

Vector store

Embeddings of past conversations or artifacts. Retrieve by semantic similarity at query time.

Document store

Plain-text notes the agent writes to itself. Reviewed or summarized at intervals.

Graph

Entities and relationships (people, projects, decisions, dates). Query by traversal.

What and when to write

Not every utterance needs persisted. Good patterns:

What not to write

The retrieval problem

Long-term memory is only useful if the agent retrieves the right piece at the right moment. Patterns:

The staleness problem

User's preferences change. Facts become outdated. Have explicit update and expiry semantics, not just append-only.