Performance

Optimize Mnemosyne for your workload.

Benchmarks

All benchmarks run on a single core, SQLite with sqlite-vec:

Metric1K Entries10K Entries100K Entries
Write12ms15ms18ms
Vector search15ms35ms85ms
Hybrid search45ms65ms150ms
FTS5 search5ms8ms20ms
Consolidation2s5s25s

Optimization Strategies

1. Batch Writes

# Bad: Individual writes (separate transactions)
for item in items:
  mem.remember(item)

# Good: Batch via remember_batch
mem.beam.remember_batch([
  {"content": item, "source": "batch", "importance": 0.5}
  for item in items
])

2. Enable WAL Mode

SQLite WAL mode improves concurrent read/write performance. Enable it manually on your database file:

sqlite3 ~/.hermes/mnemosyne/data/mnemosyne.db "PRAGMA journal_mode=WAL;"

3. Embedding Caching

Mnemosyne automatically caches embedding queries via LRU cache (512 entries). Repeated queries in agent loops are near-instant. No configuration needed.

4. Working Memory Limits

Keep Working Memory lean. The default maximum is 10,000 entries, controlled via environment variable:

export MNEMOSYNE_WM_MAX_ITEMS=5000  # Lower limit for faster queries
export MNEMOSYNE_WM_TTL_HOURS=12    # Shorter TTL for more aggressive eviction

5. Regular Consolidation

Run consolidation periodically to promote working memories to episodic and maintain query performance:

# Standalone CLI
mnemosyne sleep

# Or programmatically
mem.sleep()

Memory Usage

ComponentPer Entry10K Entries
Working Memory48 bytes~480KB
Episodic Memory~2KB~20MB
Vector Index~6KB~60MB
FTS5 Index~2KB~20MB
SSD Recommended

SQLite performance is heavily I/O bound. Use SSD storage for production deployments. HDD is acceptable for development but will show 5-10x slower query times.