Engineering
Building Universal Memory: Stateful AI at Scale
Gilad GabayDecember 28, 20251 min read
How we designed Universal Memory to give your AI persistent context across sessions. PostgreSQL, pgvector, and intelligent memory extraction.
Building Universal Memory: Stateful AI at Scale
LLMs are stateless by design. Every conversation starts fresh. Universal Memory is our solution.
The Architecture
- Memory Extraction - LLM extracts memorable facts
- Vector Storage - pgvector with HNSW indexing
- Context Injection - Relevant memories injected into prompts
7 Memory Types
- Instructions - System guidance
- Preferences - User choices
- Projects - Active work
- Skills - Capabilities
- Facts - Known info
- Relationships - Connections
- Corrections - Learnings
Performance
- Retrieval Latency: less than 10ms
- Storage per User: ~1KB per memory
- Max Memories: 1000 per user
#memory#architecture#pgvector
