A self-describing, encrypted, single-file database that gives AI agents persistent memory they can carry between devices — and that only the user can unlock.
View on GitHubpip install mnemo-engine
·
cargo add mnemo-engine
Why MNemo
Every other memory solution is cloud-hosted, tied to a heavyweight database, or a raw vector store with no agent-native abstractions. MNemo fills that gap.
The entire memory store — vectors, metadata, indexes, WAL — lives in one .mnemo file. Copy it, back it up, email it, delete it.
AES-256-GCM page-level encryption with Argon2id key derivation. Two-tier key hierarchy means rekey never rewrites bulk data.
Episodic, semantic, procedural, and working memory types with multi-signal recall — similarity blended with recency, importance, and frequency.
IVF + Product Quantization index for sub-linear recall at scale. Exact brute-force always available as ground truth.
Write-ahead log with single-fsync commit. Kill the process mid-write — the database recovers cleanly on next open.
Every flush creates a snapshot. Roll back to any past transaction — restores are themselves crash-safe and reversible.
Agentic-first
Most vector stores treat AI agents as users who follow READMEs. MNemo treats agents as a first-class authoring environment — every .mnemo file introduces itself, every fresh database is self-describing from creation, and every entry point gives an agent the same two-command path to productivity.
$ mnemo about agent.mnemo # agent.mnemo (45 memories · 384-dim · encrypted · 12 snapshots) ## Onboarding briefing ### MANIFEST (importance=1.00) MNEMO MANIFEST — This .mnemo file is the project memory for the Memory Nemo (MNemo) project. Embedder: sentence-transformers/ all-MiniLM-L6-v2 (384-dim, normalized). Default agent_id: cursor-agent. Conventions: area in {onboarding, performance, decision, ...} with a topic key. ### [onboarding/mission] (importance=1.00) PROJECT MISSION: An encrypted single-file Rust agent-memory engine. Ongoing project context lives in the file so new AI sessions stay aligned ... ## Quick start mnemo list agent.mnemo # browse all memories mnemo recall agent.mnemo --query VEC # multi-signal recall mnemo get agent.mnemo <ulid> --verbose # fetch one
The .mnemo file is its own documentation. Onboarding memories tagged metadata.area="onboarding" surface in one command — no sibling AGENTS.md, no external config.
mnemo init auto-inserts a starter manifest so brand-new databases are agent-friendly from creation. The next agent sees the placeholder and knows what to record.
Same about/init pattern in the Rust API, Python binding, and CLI. An agent that learns mnemo on one entry point uses it from any other.
Quick Start
use mnemo::{Mnemo, MnemoConfig, Memory, MemoryType, RecallRequest}; fn main() -> mnemo::Result<()> { let cfg = MnemoConfig { dimensions: 768, ..Default::default() }; let mut db = Mnemo::create("agent.mnemo", "correct horse battery", cfg)?; db.remember( Memory::new("the user prefers dark mode", MemoryType::Semantic, vec![0.1, 0.2, 0.9]) .with_agent("assistant-1") .with_importance(0.8), )?; db.flush()?; // durable + crash-safe for hit in db.recall(&RecallRequest::new(vec![0.1, 0.2, 0.9]).top_k(5))? { println!("{:.3} {}", hit.score, hit.memory.content); } Ok(()) }
import mnemo # Open or create an encrypted memory file db = mnemo.open("agent.mnemo", "passphrase", dimensions=768) # Store a memory with type, importance, and agent scope db.remember( "the user prefers concise answers", "procedural", embedding_model.encode("the user prefers concise answers"), importance=0.8, agent_id="assistant", ) # Multi-signal recall — similarity + recency + importance + frequency for hit in db.recall(query_embedding, top_k=10): print(hit["score"], hit["content"]) db.flush() db.close()
# Passphrase via env (preferred over --passphrase on the CLI) $ export MNEMO_PASSPHRASE=your-secret # Create, load, and index $ mnemo init agent.mnemo --dimensions 768 $ mnemo import agent.mnemo memories.jsonl $ mnemo index agent.mnemo # Explore — browse, fetch by ULID, multi-signal recall $ mnemo info agent.mnemo $ mnemo list agent.mnemo --type semantic --limit 20 $ mnemo get agent.mnemo 01HXYZ... --verbose $ mnemo recall agent.mnemo --query 0.1,0.2,0.9 --top-k 5 # Exact similarity-only search (ground truth) $ mnemo search agent.mnemo --query 0.1,0.2,0.9 --top-k 5 # Re-key without rewriting bulk data $ mnemo rekey agent.mnemo --new-passphrase new-secret
Performance
Encryption overhead under 15%. IVF+PQ indexing keeps recall sub-linear at any scale.
Multi-Signal Recall
Agents need more than cosine distance. MNemo ranks every candidate on four signals, weighted per query.
Agent Memory Model
Structured memory types mirror how agents actually think — not just a bag of embeddings.
What happened — conversation turns, events, interactions. Consolidated from working memory at session close.
What is known — facts, entities, relationships, beliefs. Long-lived knowledge with contradiction detection.
What to do — user preferences, behavioral patterns, rules. High-importance memories that guide agent behavior.
Right now — current session context, scratchpad. Ephemeral until promoted by session consolidation.
Built agent-first. Self-describing by default. Open-source under Apache 2.0. Written in Rust.
View on GitHub