Give your agent a brain
it can carry

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 GitHub
pip install mnemo-engine  ·  cargo add mnemo-engine

Why MNemo

The SQLite of agent memory

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.

📄

Single file

The entire memory store — vectors, metadata, indexes, WAL — lives in one .mnemo file. Copy it, back it up, email it, delete it.

🔐

Encrypted at rest

AES-256-GCM page-level encryption with Argon2id key derivation. Two-tier key hierarchy means rekey never rewrites bulk data.

🧠

Agent-native memory

Episodic, semantic, procedural, and working memory types with multi-signal recall — similarity blended with recency, importance, and frequency.

Sub-linear search

IVF + Product Quantization index for sub-linear recall at scale. Exact brute-force always available as ground truth.

💾

Crash-safe WAL

Write-ahead log with single-fsync commit. Kill the process mid-write — the database recovers cleanly on next open.

Point-in-time recovery

Every flush creates a snapshot. Roll back to any past transaction — restores are themselves crash-safe and reversible.

Agentic-first

Designed for agents to onboard themselves

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
📖

Self-describing files

The .mnemo file is its own documentation. Onboarding memories tagged metadata.area="onboarding" surface in one command — no sibling AGENTS.md, no external config.

🌱

Scaffold by default

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.

🔄

Parity across surfaces

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.

Encryption Architecture

passphrase ──Argon2id──▶ KEK ──AES-256-GCM──▶ wraps DEK (random 256-bit)

every 8 KiB page ──AES-256-GCM──▶ ciphertext
.mnemo file
Page 0 — Header (plaintext)
magic · version · KDF params · salt · wrapped DEK · CRC
Pages 1..W — Write-Ahead Log (encrypted)
Pages W+ — Encrypted Data Runs
Records
(memories)
Catalog
(metadata)
ANN Index
(IVF+PQ)
Snapshot Manifest
(transaction log)

Quick Start

Ten lines to persistent memory

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

Built in Rust. Fast by default.

Encryption overhead under 15%. IVF+PQ indexing keeps recall sub-linear at any scale.

<5ms
100K memories, top-10 recall
<15ms
1M memories, top-10 recall
10K/s
Insert throughput
<200ms
Cold open, encrypted, 100K

Multi-Signal Recall

Not just vector similarity

Agents need more than cosine distance. MNemo ranks every candidate on four signals, weighted per query.

score =
α · similarity vector distance
(cosine/dot/L2)
+
β · recency exponential
decay (7-day
half-life)
+
γ · importance author-assigned
weight [0,1]
+
δ · ln(1 + access_count) retrieval
frequency
boost

Agent Memory Model

Four types of memory

Structured memory types mirror how agents actually think — not just a bag of embeddings.

📖

Episodic

What happened — conversation turns, events, interactions. Consolidated from working memory at session close.

🗂️

Semantic

What is known — facts, entities, relationships, beliefs. Long-lived knowledge with contradiction detection.

⚙️

Procedural

What to do — user preferences, behavioral patterns, rules. High-importance memories that guide agent behavior.

💭

Working

Right now — current session context, scratchpad. Ephemeral until promoted by session consolidation.

Your agent deserves a brain
it can carry

Built agent-first. Self-describing by default. Open-source under Apache 2.0. Written in Rust.

View on GitHub