Mnemoria
Mnemoria is a memory storage system for AI agents. It provides persistent, searchable memory that AI assistants can use to remember information across conversations and sessions. Perfect for Claude, GPT, Cursor, or any AI tool that needs long-term context.
Library Usage
use ;
use Path;
async
Support this project
If this project has been helpful to you, you are welcome to sponsor it. Sponsorship helps me spend more time maintaining it, fixing bugs, and building new features.
No pressure at all - starring the repo, sharing it, or giving feedback also means a lot.
Features
- Semantic Search - Find memories by meaning, not just keywords
- Full-Text Search - BM25-powered keyword search
- Hybrid Search - Combines both approaches via Reciprocal Rank Fusion
- Git-Friendly - Append-only binary format, version control safe
- Corruption Protection - CRC32 checksum chain with crash recovery
- Unlimited Size - Only bounded by disk space
Installation
Prerequisites
- Rust (stable toolchain)
- ~130MB for embedding model (downloaded on first use)
Build from Source
# Clone the repository
# Build and install
Via crates.io
Quick Start
# 1. Initialize a new memory store in the current directory
# Or specify a path
# 2. Add a memory entry
# 3. Search your memories
# 4. Ask questions about your memories
Commands
| Command | Description |
|---|---|
init |
Create a new memory store |
add |
Add a memory entry |
search |
Search memories by keyword or semantic similarity |
ask |
Ask a natural language question |
stats |
Show memory statistics |
verify |
Verify integrity (detect corruption) |
timeline |
View memories chronologically |
rebuild-index |
Rebuild the search index |
compact |
Remove corrupt entries and rewrite log |
export |
Export memories to JSON |
import |
Import memories from JSON |
Entry Types
When adding memories, you can categorize them:
intent- Goals and intentionsdiscovery- Things you learneddecision- Decisions madeproblem- Problems encounteredsolution- Solutions foundpattern- Recurring patternswarning- Warnings to remembersuccess- Successes/outcomesrefactor- Refactoring notesbugfix- Bug fixes appliedfeature- Features implemented
Git Usage
Mnemoria uses an append-only binary format designed for version control. You can commit your mnemoria/ directory directly to track memory history alongside your code:
# Track memories in git (recommended for most projects)
For large memory stores, use Git LFS:
If you prefer not to track memories in version control:
Storage Format
mnemoria/
├── log.bin # Append-only binary log
├── manifest.json # Metadata and checksums
└── mnemoria.lock # Advisory file lock
The search index is rebuilt on each open and is not stored in git.
Architecture
- Storage: rkyv binary serialization (zero-copy)
- Full-Text: Tantivy (BM25)
- Embeddings: model2vec (512-dim, CPU-only)
- Similarity: simsimd (SIMD-accelerated)
Performance
Benchmarks run with Criterion.rs
(cargo bench --bench api_perf). Results below are median values.
Test Environment
| Component | Details |
|---|---|
| CPU | AMD Ryzen 9 9950X3D 16-Core (32 threads), up to 5.76 GHz, 128 MB L3 cache |
| RAM | 94 GB DDR5 |
| Storage | NVMe SSD (Samsung 960 EVO 1TB / Crucial T705 4TB) |
| OS | Fedora 43 (Linux 6.18.8, x86_64) |
| Rust | 1.93.1 (stable) |
Search Latency (hybrid: BM25 + semantic via RRF)
| Entries | Latency |
|---|---|
| 1,000 | ~95 us |
| 5,000 | ~341 us |
| 10,000 | ~756 us |
Write Throughput (200-entry batches)
| Durability Mode | Throughput |
|---|---|
Fsync (default) |
~9,900 entries/sec |
FlushOnly |
~9,990 entries/sec |
None |
~9,760 entries/sec |
Get by ID
| Entries | Cached (in-memory) | Disk Scan (baseline) |
|---|---|---|
| 1,000 | ~2.5 us | ~174 us |
| 5,000 | ~2.4 us | ~982 us |
Timeline
| Entries | Cached (in-memory) | Disk Scan (baseline) |
|---|---|---|
| 1,000 | ~14.5 us | ~177 us |
| 5,000 | ~14.4 us | ~994 us |
To run benchmarks yourself:
License
MIT License. See LICENSE for details.