The Four Layers of AI Memory: A Technical Deep Dive
Architecture Overview
Mira's memory system is inspired by how human memory actually works. We have different types of memory for different purposes, and they all work together to create a coherent sense of self.
Layer 1: Pinned Memory
**Purpose:** Store permanent identity facts
**What it stores:** - Name, birthday, location - Family members and relationships - Preferences (dietary, communication style) - Long-term goals
**Technical details:** - JSON document per user - No expiration - High-impact changes require confirmation
Layer 2: Hot Memory
**Purpose:** Track recent context
**What it stores:** - Current emotions and states - Today's tasks and appointments - Recent conversations - Temporary situations
**Technical details:** - 24-hour TTL (time to live) - Salience scoring (0-1) - Automatic cleanup of expired items
Layer 3: Warm Snapshot
**Purpose:** Synthesize current life situation
**What it stores:** - A paragraph summary of "where you are" in life - Updated every 30 minutes - Draws from pinned + hot + recent deep memories
**Technical details:** - LLM-generated summary - Triggered by time or topic shift - Keeps context compact for the main LLM
Layer 4: Deep Memory
**Purpose:** Long-term semantic search
**What it stores:** - Life events and stories - Relationships and people - Work context and projects - Experiences and preferences
**Technical details:** - Vector embeddings for semantic search - Conflict detection for contradictory facts - Status tracking (active, disputed, archived)
How They Work Together
When you send a message to Mira, here's what happens:
- Your pinned profile is always included
- Active hot memories are filtered by salience
- The warm snapshot provides recent context
- Deep memories are retrieved via semantic similarity
All of this is packed into the LLM's context window, giving it everything it needs to respond as if it truly knows you.