Pattern · intermediate

Memory Systems Pattern

Patterns for agent memory: working state, summaries, long-term stores, and retrieval with governance.

Memory systems give agents continuity. The pattern is to split stores by lifetime and trust, not dump everything into the prompt.

Pattern blueprint

  1. State object — JSON schema for the run
  2. Episode log — trajectory events
  3. Summarizer — compress old steps
  4. Long-term KV / vector store — durable facts
  5. Retriever — fetch relevant world docs

Write policies

  • What can be written automatically?
  • What needs user approval?
  • What is never stored?

Read policies

  • What is injected every turn vs on demand?
  • How many items max?
  • How do you handle conflicts?

Anti-patterns

  • Infinite chat history as the only memory
  • Storing secrets in model-visible memory
  • Unbounded “remember this” from untrusted text

Deep dive: Agent memory explained.

FAQ

Frequently asked questions

How should agents store memory?

Use typed working state for control flow, summarized thread history for context, and governed long-term stores with provenance for durable facts—plus RAG for world knowledge.