Skip to main content
This glossary provides definitions for all key terms, components, and concepts in the Memvid ecosystem. Whether you’re just getting started or diving deep into the architecture, this reference will help you understand how everything fits together.

Architecture Components

Memvid Core

The heart of Memvid, written in Rust. memvid-core is the foundational library that implements all core functionality:
  • File format handling - Reading/writing .mv2 files
  • Indexing engines - Lexical (Tantivy), vector (HNSW), and hybrid search
  • WAL management - Write-ahead logging for crash safety
  • Enrichment pipeline - Background processing for embeddings and extraction
  • Memory management - Frame storage, versioning, and lifecycle
The core is compiled to native binaries and exposed through language bindings (Node.js, Python) for cross-platform use.

CLI (Command Line Interface)

The memvid CLI tool provides direct access to all Memvid operations from your terminal:
# Create a new memory file
memvid create my-knowledge.mv2

# Add content
memvid put my-knowledge.mv2 --input document.pdf

# Search
memvid find my-knowledge.mv2 --query "machine learning"

# Ask questions
memvid ask my-knowledge.mv2 --question "What is the main thesis?"
The CLI is ideal for scripting, automation, and quick interactions without writing code.

SDKs (Software Development Kits)

Language-specific libraries that wrap the Memvid core for seamless integration: Both SDKs provide identical APIs:
  • create() / use() - Create or open memory files
  • put() / put_many() - Insert documents
  • find() - Search with various modes
  • ask() - AI-powered Q&A
  • timeline() - Browse insertion history

File Format

MV2 (Memory File)

The .mv2 file extension represents a Memvid memory file. It’s a single, self-contained binary file that stores:
  • All your documents and data (frames)
  • Search indices (lexical, vector, temporal)
  • Metadata and checksums
  • Write-ahead log for crash recovery
Key characteristics:
  • Portable - Copy, move, or share as a single file
  • Serverless - No database server required
  • Crash-safe - WAL ensures data integrity
  • Deterministic - Reproducible builds for verification

MV2E (Encrypted Memory File)

The .mv2e extension indicates an encrypted memory file (Capsule). Uses:
  • Argon2 for password-based key derivation
  • AES-GCM for authenticated encryption
Requires a password to open; transparent once unlocked.

Core Concepts

Frame

The atomic unit of data in Memvid. Every piece of content you store becomes a frame. Properties:
PropertyDescription
frame_idUnique monotonic identifier (u64)
contentThe actual text/data stored
metadataTags, timestamps, source info
statusActive, Superseded, or Deleted
roleDocument, DocumentChunk, or ExtractedImage
Lifecycle:
  1. Insert - Frame created with frame_id, status = Active
  2. Update - Original marked Superseded, new frame created
  3. Delete - Status changed to Deleted (soft delete)
Frames are immutable once committed - updates create new frames.

Memory

A “memory” in Memvid refers to the runtime instance managing an .mv2 file. When you open a memory file, you get a Memory object that handles:
  • Reading and writing frames
  • Managing indices
  • Coordinating search
  • Handling commits and checkpoints
// Open a memory
const mem = await memvid.use("knowledge.mv2");

// The 'mem' object is your Memory instance
await mem.put({ text: "Hello world" });
await mem.find({ query: "hello" });

Commit

The process of persisting pending changes to the .mv2 file:
  1. WAL entries written to disk
  2. Indices updated
  3. Footer rewritten with new checksums
  4. File synced to storage
Commits happen automatically on close, or can be triggered manually for durability guarantees.

Checkpoint

A checkpoint purges committed WAL entries and updates the header:
  • Frees WAL space for new writes
  • Marks transactions as permanently durable
  • Triggered automatically when WAL reaches 75% capacity

Search & Retrieval

Traditional keyword-based search using the BM25 ranking algorithm:
  • How it works: Builds an inverted index of terms, scores documents by term frequency and inverse document frequency
  • Best for: Exact matches, specific keywords, technical terms
  • Engine: Tantivy (Rust full-text search library)
memvid find data.mv2 --query "API authentication" --mode lex
Meaning-based search using embeddings:
  • How it works: Converts text to vector embeddings, finds similar vectors using cosine similarity
  • Best for: Conceptual queries, finding related content, natural language questions
  • Index: HNSW (Hierarchical Navigable Small World) graph
memvid find data.mv2 --query "how to secure endpoints" --mode vec
Combines lexical and semantic search for best results:
  • Runs both search types in parallel
  • Normalizes scores from each
  • Merges using RRF (Reciprocal Rank Fusion)
  • Returns unified ranked results
memvid find data.mv2 --query "authentication best practices" --mode hybrid

Sketch Pre-filtering

Ultra-fast candidate filtering before expensive ranking:
  • SimHash: 64-bit locality-sensitive hash for quick similarity checks
  • Term Filter: Compact bitset for query term overlap
  • Top Terms: Hashed IDs of highest-weight terms
Reduces search candidates by 10-100x, enabling sub-millisecond filtering on million-frame memories.

Indexing

Lex Index

The lexical search index built on Tantivy:
  • Tokenizes text into terms
  • Builds inverted index (term → document list)
  • Supports field-specific queries (title, content, tags)
  • Deterministic chunking for reproducibility

Vec Index

The vector/embedding search index:
  • Stores document embeddings
  • Uses HNSW graph for approximate nearest neighbor search
  • Supports multiple embedding models (BGE, Nomic, OpenAI)
  • Optional product quantization for compression

Time Index

Temporal index for frame ordering:
  • Tracks insertion timestamps
  • Enables range queries (since/until)
  • Powers timeline() navigation
  • Supports forward and reverse traversal

Sketch Track

Per-frame micro-indices for fast filtering:
VariantSizeUse Case
Small32 bytes/frameMemory-constrained
Medium64 bytes/frameBalanced (default)
Large96 bytes/frameMaximum precision

Enrichment

Enrichment Pipeline

Background processing that enhances frames after insertion: Phases:
  1. Searchable (instant) - Skim text extracted, basic indexing
  2. Enriched (background) - Full text, embeddings, memory cards, entities
The two-phase approach means search works immediately while richer features process in the background.

Memory Cards

Structured units of extracted knowledge:
FieldDescription
kindFact, Preference, Event, Profile, Relationship, Goal
contentThe extracted information
polarityPositive, Negative, or Neutral
version_relationSets, Updates, Extends, or Retracts
Memory cards enable semantic querying beyond raw text search.

Entity Extraction (NER)

Named Entity Recognition identifies and links entities:
  • Types: Person, Organization, Location, Date, Money, URL, etc.
  • Model: DistilBERT-NER (ONNX)
  • Output: Entities with confidence scores and frame references

Logic Mesh

Entity-relationship graph connecting extracted entities:
  • Bidirectional graph structure
  • Nodes: Entities with types and mentions
  • Edges: Relationships with confidence
  • Enables: “follow” queries for fact traversal

Persistence

WAL (Write-Ahead Log)

Embedded circular buffer ensuring crash safety:
  • Purpose: Records mutations before they’re applied
  • Checksum: BLAKE3 hash for integrity verification
  • Recovery: Replays uncommitted entries after crash
  • Size: Configurable (64 KB to 64 MB)
Fixed 4 KB structure at file offset 0:
  • Magic bytes (MV2\0)
  • Spec and format versions
  • WAL offset and size
  • Footer offset pointer
Variable-length CBOR-serialized metadata at end of file:
  • Table of Contents (TOC)
  • Manifest pointers
  • Segment catalog
  • Checksums for validation

TOC (Table of Contents)

Master index structure in the footer:
  • Lists all frames with metadata
  • References to index manifests (lex, vec, time)
  • Segment catalog for published indices

Capacity & Licensing

Ticket

Signed proof of capacity grant:
  • Issuer: Authority that granted the capacity
  • Sequence: Monotonic identifier
  • Capacity: Bytes allowed
  • Signature: ED25519 digital signature
Tickets are validated cryptographically and cannot be forged.

Capacity Tiers

Storage limits based on plan:
TierCapacityMemory FilesQueries/Month
Free50 MB
Starter25 GB5250k
Pro125 GB2520M
EnterpriseUnlimitedUnlimitedUnlimited

Embedding Models

Local Models

Run entirely on your machine:
ModelDimensionsSpeedQuality
BGE-Small384FastGood
BGE-Base768MediumBetter
Nomic-Embed768MediumBetter

Cloud Models

API-based embedding providers:
ProviderModelDimensions
OpenAItext-embedding-3-small1536
OpenAItext-embedding-3-large3072
NVIDIANV-Embed-v24096

CLIP Models

For visual/image embeddings:
ModelDimensionsUse Case
SigLIP768High-quality image search
MobileCLIP384Fast, lightweight

Operations

put / put_many

Insert documents into memory:
// Single document
const frameId = await mem.put({ text: "Hello world" });

// Batch insert
const frameIds = await mem.put_many([
  { text: "Doc 1" },
  { text: "Doc 2" },
  { file: "document.pdf" }
]);

find

Search the memory:
const results = await mem.find({
  query: "machine learning",
  k: 10,
  mode: "hybrid",
  snippet_chars: 200
});

ask

AI-powered question answering:
const answer = await mem.ask({
  question: "What are the key findings?",
  use_model: "openai"
});
Returns synthesized answer with source citations.

timeline

Browse frames by insertion order:
// Recent frames
const recent = await mem.timeline({ limit: 20 });

// Oldest first
const oldest = await mem.timeline({ limit: 20, reverse: true });

seal

Close and commit the memory file:
await mem.seal();
Commits pending changes and releases file lock.

Feature Flags

Cargo features that enable optional functionality:
FeatureDescription
lexTantivy full-text search
vecVector embeddings + HNSW
clipCLIP visual search
whisperAudio transcription
encryptionCapsule encryption
logic_meshEntity-relationship graph + NER
replaySession recording/replay
temporal_trackTemporal mention tracking
parallel_segmentsParallel index building

Common Workflows

Ingestion → Search → Ask

1. Create memory       → memvid.create("data.mv2")
2. Insert documents    → mem.put({ file: "docs/*.pdf" })
3. Wait for enrichment → (automatic background processing)
4. Search              → mem.find({ query: "..." })
5. Ask questions       → mem.ask({ question: "..." })
6. Close               → mem.seal()

Enrichment Pipeline

1. put()           → Frame enters Searchable state
2. Background      → Worker extracts full text
3. Embedding       → Generate vector embeddings
4. Extraction      → Memory cards, entities
5. Indexed         → Frame now fully Enriched

See Also