Learning outcomes

  • Distinguish state from context
  • Choose memory lifetimes
  • Prevent stale memory

Mental model

State is durable application data. Memory is a policy for creating, retrieving, updating, expiring, and presenting selected state to a model.

Event
Extract candidate memory
Validate and scope
Persist
Retrieve
Render into context

Theory

Working state supports the current task; episodic records capture prior interactions; semantic memory stores extracted facts; procedural memory represents stable instructions or workflows. Store authoritative facts in typed systems, not only transcripts. Each memory needs provenance, scope, consent, freshness, and deletion behavior.

Alternatives and trade-offs

Conversation replay is simple but noisy. Summaries compress history but can drift. Structured state is precise. Retrieval-based memory scales but requires relevance and deletion controls.

Failure modes and misconceptions

Do not equate a chat log with memory, persist sensitive inferences silently, accept model-written facts without validation, or allow stale memory to override current input.

Knowledge check

Reflect before revealing the guide

Why is memory a policy rather than merely a database table?

Decision scenario

A learning app stores explicit bookmarks and private notes locally, while inferred preferences remain temporary unless the learner chooses to retain them.

Relationships

Primary sources