Memvid is a single-file memory layer for AI agents with instant retrieval and long-term memory.
Persistent, versioned, and portable memory, without databases.
Memvid is a portable AI memory system that packages your data, embeddings, search structure, and metadata into a single file.
Instead of running complex RAG pipelines or server-based vector databases, Memvid enables fast retrieval directly from the file.
The result is a model-agnostic, infrastructure-free memory layer that gives AI agents persistent, long-term memory they can carry anywhere.
What are Smart Frames?
Memvid draws inspiration from video encoding, not to store video, but to organize AI memory as an append-only, ultra-efficient sequence of Smart Frames.
A Smart Frame is an immutable unit that stores content along with timestamps, checksums and basic metadata.
Frames are grouped in a way that allows efficient compression, indexing, and parallel reads.
This frame-based design enables:
Append-only writes without modifying or corrupting existing data
Queries over past memory states
Timeline-style inspection of how knowledge evolves
Crash safety through committed, immutable frames
Efficient compression using techniques adapted from video encoding
The result is a single file that behaves like a rewindable memory timeline for AI systems.
Core Concepts
Living Memory Engine
Continuously append, branch, and evolve memory across sessions.
Capsule Context (.mv2)
Self-contained, shareable memory capsules with rules and expiry.
Time-Travel Debugging
Rewind, replay, or branch any memory state.
Smart Recall
Sub-5ms local memory access with predictive caching.
Codec Intelligence
Auto-selects and upgrades compression over time.
Use Cases
Memvid is a portable, serverless memory layer that gives AI agents persistent memory and fast recall. Because it’s model-agnostic, multi-modal, and works fully offline, developers are using Memvid across a wide range of real-world applications.
use memvid_core::{WhisperConfig, WhisperTranscriber};
// Default FP32 small model
let config = WhisperConfig::default();
// Quantized tiny model (faster, smaller)
let config = WhisperConfig::with_quantization();
// Specific model
let config = WhisperConfig::with_model("whisper-tiny-en-q8k");
let transcriber = WhisperTranscriber::new(&config)?;
let result = transcriber.transcribe_file("audio.mp3")?;
println!("{}", result.text);
Text Embedding Models
The vec feature includes local text embedding support using ONNX models. Before using local text embeddings, you need to download the model files manually.
Quick Start: BGE-small (Recommended)
Download the default BGE-small model (384 dimensions, fast and efficient):
use memvid_core::text_embed::{LocalTextEmbedder, TextEmbedConfig};
use memvid_core::types::embedding::EmbeddingProvider;
// Use default model (BGE-small)
let config = TextEmbedConfig::default();
let embedder = LocalTextEmbedder::new(config)?;
let embedding = embedder.embed_text("hello world")?;
assert_eq!(embedding.len(), 384);
// Use different model
let config = TextEmbedConfig::bge_base();
let embedder = LocalTextEmbedder::new(config)?;
See examples/text_embedding.rs for a complete example with similarity computation and search ranking.
Model Consistency
To prevent accidental model mixing (e.g., querying a BGE-small index with OpenAI embeddings), you can explicitly bind your Memvid instance to a specific model name:
// Bind the index to a specific model.
// If the index was previously created with a different model, this will return an error.
mem.set_vec_model("bge-small-en-v1.5")?;
This binding is persistent. Once set, future attempts to use a different model name will fail fast with a ModelMismatch error.
API Embeddings (OpenAI)
The api_embed feature enables cloud-based embedding generation using OpenAI’s API.
Setup
Set your OpenAI API key:
export OPENAI_API_KEY="sk-..."
Usage
use memvid_core::api_embed::{OpenAIConfig, OpenAIEmbedder};
use memvid_core::types::embedding::EmbeddingProvider;
// Use default model (text-embedding-3-small)
let config = OpenAIConfig::default();
let embedder = OpenAIEmbedder::new(config)?;
let embedding = embedder.embed_text("hello world")?;
assert_eq!(embedding.len(), 1536);
// Use higher quality model
let config = OpenAIConfig::large(); // text-embedding-3-large (3072 dims)
let embedder = OpenAIEmbedder::new(config)?;
Available Models
Model
Dimensions
Best For
text-embedding-3-small
1536
Default, fastest, cheapest
text-embedding-3-large
3072
Highest quality
text-embedding-ada-002
1536
Legacy model
See examples/openai_embedding.rs for a complete example.
Memvid is a single-file memory layer for AI agents with instant retrieval and long-term memory.
Persistent, versioned, and portable memory, without databases.
Website · Try Sandbox · Docs · Discussions
Benchmark Highlights
🚀 Higher accuracy than any other memory system : +35% SOTA on LoCoMo, best-in-class long-horizon conversational recall & reasoning
🧠 Superior multi-hop & temporal reasoning: +76% multi-hop, +56% temporal vs. the industry average
⚡ Ultra-low latency at scale 0.025ms P50 and 0.075ms P99, with 1,372× higher throughput than standard
🔬 Fully reproducible benchmarks: LoCoMo (10 × ~26K-token conversations), open-source eval, LLM-as-Judge
What is Memvid?
Memvid is a portable AI memory system that packages your data, embeddings, search structure, and metadata into a single file.
Instead of running complex RAG pipelines or server-based vector databases, Memvid enables fast retrieval directly from the file.
The result is a model-agnostic, infrastructure-free memory layer that gives AI agents persistent, long-term memory they can carry anywhere.
What are Smart Frames?
Memvid draws inspiration from video encoding, not to store video, but to organize AI memory as an append-only, ultra-efficient sequence of Smart Frames.
A Smart Frame is an immutable unit that stores content along with timestamps, checksums and basic metadata. Frames are grouped in a way that allows efficient compression, indexing, and parallel reads.
This frame-based design enables:
The result is a single file that behaves like a rewindable memory timeline for AI systems.
Core Concepts
Living Memory Engine Continuously append, branch, and evolve memory across sessions.
Capsule Context (
.mv2) Self-contained, shareable memory capsules with rules and expiry.Time-Travel Debugging Rewind, replay, or branch any memory state.
Smart Recall Sub-5ms local memory access with predictive caching.
Codec Intelligence Auto-selects and upgrades compression over time.
Use Cases
Memvid is a portable, serverless memory layer that gives AI agents persistent memory and fast recall. Because it’s model-agnostic, multi-modal, and works fully offline, developers are using Memvid across a wide range of real-world applications.
SDKs & CLI
Use Memvid in your preferred language:
npm install -g memvid-clinpm install @memvid/sdkpip install memvid-sdkcargo add memvid-coreInstallation (Rust)
Requirements
Add to Your Project
Feature Flags
lexpdf_extractvecclipwhisperapi_embedtemporal_trackparallel_segmentsencryptionsymspell_cleanupEnable features as needed:
Quick Start
Build
Clone the repository:
Build in debug mode:
Build in release mode (optimized):
Build with specific features:
Run Tests
Run all tests:
Run tests with output:
Run a specific test:
Run integration tests only:
Examples
The
examples/directory contains working examples:Basic Usage
Demonstrates create, put, search, and timeline operations:
PDF Ingestion
Ingest and search PDF documents (uses the “Attention Is All You Need” paper):
CLIP Visual Search
Image search using CLIP embeddings (requires
clipfeature):Whisper Transcription
Audio transcription (requires
whisperfeature):Available Models:
whisper-small-enwhisper-tiny-enwhisper-tiny-en-q8kModel Selection:
Programmatic Configuration:
Text Embedding Models
The
vecfeature includes local text embedding support using ONNX models. Before using local text embeddings, you need to download the model files manually.Quick Start: BGE-small (Recommended)
Download the default BGE-small model (384 dimensions, fast and efficient):
Available Models
bge-small-en-v1.5bge-base-en-v1.5nomic-embed-text-v1.5gte-largeOther Models
BGE-base (768 dimensions):
Nomic (768 dimensions):
GTE-large (1024 dimensions):
Usage in Code
See
examples/text_embedding.rsfor a complete example with similarity computation and search ranking.Model Consistency
To prevent accidental model mixing (e.g., querying a BGE-small index with OpenAI embeddings), you can explicitly bind your Memvid instance to a specific model name:
This binding is persistent. Once set, future attempts to use a different model name will fail fast with a
ModelMismatcherror.API Embeddings (OpenAI)
The
api_embedfeature enables cloud-based embedding generation using OpenAI’s API.Setup
Set your OpenAI API key:
Usage
Available Models
text-embedding-3-smalltext-embedding-3-largetext-embedding-ada-002See
examples/openai_embedding.rsfor a complete example.File Format
Everything lives in a single
.mv2file:No
.wal,.lock,.shm, or sidecar files. Ever.See MV2_SPEC.md for the complete file format specification.
Support
Have questions or feedback? Email: contact@memvid.com
Drop a ⭐ to show support
License
Apache License 2.0 — see the LICENSE file for details.