Working Memory
The agent's immediate context — recent observations, active conversations, and current tool results. Fastest access, limited capacity, and subject to eviction.
Schema
| Column | Type | Description |
|---|---|---|
id | TEXT | UUIDv4 primary key |
content | TEXT | Raw memory content |
source | TEXT | Origin (user, tool, observation) |
timestamp | TEXT | Application-level timestamp |
session_id | TEXT | Session grouping key (default: 'default') |
importance | REAL | 0.0–1.0 importance score (default: 0.5) |
metadata_json | TEXT | Arbitrary JSON metadata blob |
created_at | TIMESTAMP | Row creation time (SQLite CURRENT_TIMESTAMP) |
recall_count | INTEGER | Number of times recalled (default: 0) |
last_recalled | TIMESTAMP | Last recall time (default: NULL) |
valid_until | TIMESTAMP | TTL expiry time |
superseded_by | TEXT | ID of newer version that replaces this entry |
scope | TEXT | Visibility scope (default: 'global') |
Indexes
idx_working_sessiononsession_ididx_working_timestampontimestampidx_working_sourceonsource
FTS5
Full-text search is maintained via fts_working (content-column FTS5) with automatic triggers for INSERT, UPDATE, and DELETE.
Vector Search
Embeddings are stored separately in vec_episodes (sqlite-vec, int8[384]). They are generated at recall time and are not a column in the working_memory table.
Eviction Policy
When Working Memory reaches capacity, entries are evicted by a composite score:
- Importance weighting: Higher importance = lower eviction priority
- Recency: Recently created or recalled entries are protected
- Recall frequency: Entries with higher
recall_countare protected - Composite score:
score = importance * recency_factor * recall_factor
Consolidation Path
flowchart LR
A[New Entry] -->|insert| WM[Working Memory]
WM -->|TTL/2 age trigger| C{Consolidation}
C -->|group by source| S[Summarize via LLM/AAAK]
S -->|promote| EM[Episodic Memory]
C -->|evict originals| DEL[Evicted]
API Reference
# Store a memory
mem.remember(content, importance=0.5, source="user")
# Recall memories (FTS5 + vector hybrid)
results = mem.recall(query, top_k=10)
# Update a memory
mem.update(id, content=None, importance=None)
# Delete a single memory
mem.forget(id)
Performance
| Metric | Value |
|---|---|
| Median write | 15ms |
| Median read | 8ms |
| Median recall | 45ms |
| Max capacity | 10,000 entries (configurable via MNEMOSYNE_WM_MAX) |
| Memory footprint | ~50MB per 1K entries |
Tip
Use high importance (0.8+) for critical facts you want promoted to Episodic Memory. Use low importance (0.2-) for transient observations that should be evicted quickly.
Related Pages
BEAM Architecture
Overview of BEAM (Biological-inspired Episodic-Associative Memory), Mnemosyne's four-tier architectu...
Episodic Memory
Learn about Episodic Memory in Mnemosyne: time-stamped sequences of events and experiences that let ...
Hybrid Search
Learn how Mnemosyne's hybrid search combines dense vector similarity with SQLite FTS5 full-text sear...
Mnemosyne