Agents forget. A Claude Sonnet conversation forgets at context-window expiry; a session agent forgets at session end; an organization's agents forget collectively without a memory substrate. Building memory right is as important as building reasoning right.
The three memory types
Episodic: specific conversations and events. "Ravi asked about Product X on 2026-11-15". Timestamped, tied to actors, retrievable by semantic query and by filter.
Semantic: generalized knowledge. "Product X has feature Y and costs Z". Deduplicated; versioned when changed.
Procedural: how to do things. "To onboard a new customer: step 1, step 2, step 3". Versioned playbooks.
What each type is for
Episodic: personalisation. Recall what the user asked last session; follow up on commitments. Essential for support and customer-facing agents.
Semantic: knowledge base. Facts about your business, products, policies. Used by RAG; shared across users.
Procedural: operational playbooks. Standard operating procedures the agent executes. Used by agents handling routine but multi-step workflows.
Storage choices
Episodic: PostgreSQL + pgvector. Row per conversation turn with metadata (actor, timestamp, session ID, topic). Vector embedding of the content. Query by semantic + filter.
Semantic: vector database (Qdrant or pgvector) with deduplication at write. Versioned document store for source material.
Procedural: version-controlled documents (Markdown in a Git repo works). Loaded into agent context by playbook name.
Retrieval strategies
Episodic retrieval: hybrid semantic + recency decay. Recent events weighted higher.
Semantic retrieval: standard RAG with reranking. Consistency matters — same query should return same answer.
Procedural retrieval: by name, not by search. The agent should know which playbook to run; retrieve exact text.
Our agent memory stack
Mem0 as the episodic memory layer when we want "just give me memory as a service". It handles write/read/update sensibly and integrates with Claude, GPT and open models.
Postgres + pgvector for custom episodic implementations where we need tight control.
Qdrant collection per domain for semantic.
Git repo for procedural; loaded by playbook name at agent initialization.
All three layered into a consistent memory API that the agent calls via MCP server or tool interface.
The failure mode
Teams that treat agent memory as one big vector store lose semantic consistency (contradictory facts retrieved), episodic specificity (facts and events mushed together), and procedural clarity (SOPs buried in retrieval noise). Separate the three and the architecture works.
Key takeaways
- Agent memory comes in three distinct types — episodic, semantic, procedural — each needing different storage and retrieval.
- Episodic for personalisation, semantic for facts, procedural for SOPs.
- Mem0 handles episodic as a service; custom pgvector works for teams wanting control.
- Teams that collapse memory into one vector store lose consistency and specificity.
Frequently asked
Episodic memory grows fast. Retain 30-180 days of raw conversations with aggressive summarization after. Summaries live longer; raw conversations age out. Document retention in your privacy policy.
Versioning. Record "fact X was true as of date Y; superseded by fact X' as of date Z". At retrieval, surface the current version unless explicitly asked for historical.
Both solid. Zep leads on temporal reasoning over episodic memory. Letta (formerly MemGPT) is strong on infinite-context illusion via hierarchical memory. Pick based on your workload — temporal-sensitive goes Zep, long-running agentic sessions go Letta.
Encrypt at rest, scope access tightly, honor erasure requests (which cascades into vector deletions), retain only what the lawful basis permits. Agent memory is personal data when it contains user conversations.