Overview
Event-sourced memory treats every memory as an immutable event in a timeline. Rather than updating memories in place, new events are appended. This enables powerful capabilities: temporal queries, full audit trails, memory replay, and the ability to reconstruct state at any point in time.
Core Principles
Immutable Events
Memories are never modified:
Temporal Ordering
Every event has a timestamp:
Event Types
Categorize what happened:
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Event Stream │
│ │
│ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │ E001 │→│ E002 │→│ E003 │→│ E004 │→│ E005 │→│ E006 │→... │
│ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘ │
│ │
└──────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Materialized Views │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Current State │ │ Temporal Index │ │
│ │ (Latest facts) │ │ (By timestamp) │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Entity Index │ │ Topic Index │ │
│ │ (By subject) │ │ (By theme) │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Event Schema
Base Event Structure
Event:
├── event_id: unique identifier
├── timestamp: when it occurred
├── event_type: observation | inference | correction | deletion
├── user_id: whose memory
├── session_id: which conversation
├── content: the actual memory
├── embedding: vector representation
├── metadata:
│ ├── confidence: certainty level
│ ├── source: where learned
│ ├── supersedes: prior event_id (if correction)
│ └── references: related event_ids
Event Examples
**Observation Event:**
{
event_type: "observation",
content: "User prefers morning meetings",
confidence: 0.8,
source: "user_statement"
}
**Correction Event:**
{
event_type: "correction",
content: "User actually prefers afternoon meetings",
supersedes: "event_123",
confidence: 0.95,
source: "explicit_correction"
}
Query Patterns
Current State Query
"What do I know about this user now?"
Point-in-Time Query
"What did I know on January 1st?"
Evolution Query
"How has my understanding of X changed?"
Causation Query
"Why do I believe X?"
Handling Corrections
Soft Supersession
Old memory remains, marked as superseded:
new_event = {
event_type: "correction",
content: "Updated belief",
supersedes: old_event_id
}
Query filters out superseded events by default but can include them when needed.
Hard Deletion
For compliance (GDPR, etc.):
deletion_event = {
event_type: "deletion",
deletes: event_id,
reason: "user_request"
}
Can be logical (marker) or physical (actual removal) depending on requirements.
Benefits
Full Auditability
Temporal Flexibility
Conflict Resolution
Implementation Considerations
Storage Growth
Events accumulate:
Query Performance
Multiple indexes needed:
Consistency
In distributed systems: