memvid

Library Listed

Core library for Memvid v2, a crash-safe, deterministic, single-file AI memory.

Downloads
5,276
Dependents
2
Stars
17,386
Forks
1,468
Contributors
23
Commits
261
Latest release
2.0.140 ·

About

From the project README ·

Social Cover (9)

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.

Read the full README

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.

  • Long-Running AI Agents
  • Enterprise Knowledge Bases
  • Offline-First AI Systems
  • Codebase Understanding
  • Customer Support Agents
  • Workflow Automation
  • Sales and Marketing Copilots
  • Personal Knowledge Assistants
  • Medical, Legal, and Financial Agents
  • Auditable and Debuggable AI Workflows
  • Custom Applications

SDKs & CLI

Use Memvid in your preferred language:

PackageInstallLinks
CLInpm install -g memvid-cli
Node.js SDKnpm install @memvid/sdk
Python SDKpip install memvid-sdk
Rustcargo add memvid-core

Installation (Rust)

Requirements
Add to Your Project
[dependencies]
memvid-core = "2.0"
Feature Flags
FeatureDescription
lexFull-text search with BM25 ranking (Tantivy)
pdf_extractPure Rust PDF text extraction
vecVector similarity search (HNSW + local text embeddings via ONNX)
clipCLIP visual embeddings for image search
whisperAudio transcription with Whisper
api_embedCloud API embeddings (OpenAI)
temporal_trackNatural language date parsing ("last Tuesday")
parallel_segmentsMulti-threaded ingestion
encryptionPassword-based encryption capsules (.mv2e)
symspell_cleanupRobust PDF text repair (fixes "emp lo yee" -> "employee")

Enable features as needed:

[dependencies]
memvid-core = { version = "2.0", features = ["lex", "vec", "temporal_track"] }

Quick Start

use memvid_core::{Memvid, PutOptions, SearchRequest};

fn main() -> memvid_core::Result<()> {
    // Create a new memory file
    let mut mem = Memvid::create("knowledge.mv2")?;

    // Add documents with metadata
    let opts = PutOptions::builder()
        .title("Meeting Notes")
        .uri("mv2://meetings/2024-01-15")
        .tag("project", "alpha")
        .build();
    mem.put_bytes_with_options(b"Q4 planning discussion...", opts)?;
    mem.commit()?;

    // Search
    let response = mem.search(SearchRequest {
        query: "planning".into(),
        top_k: 10,
        snippet_chars: 200,
        ..Default::default()
    })?;

    for hit in response.hits {
        println!("{}: {}", hit.title.unwrap_or_default(), hit.text);
    }

    Ok(())
}

Build

Clone the repository:

git clone https://github.com/memvid/memvid.git
cd memvid

Build in debug mode:

cargo build

Build in release mode (optimized):

cargo build --release

Build with specific features:

cargo build --release --features "lex,vec,temporal_track"

Run Tests

Run all tests:

cargo test

Run tests with output:

cargo test -- --nocapture

Run a specific test:

cargo test test_name

Run integration tests only:

cargo test --test lifecycle
cargo test --test search
cargo test --test mutation

Examples

The examples/ directory contains working examples:

Basic Usage

Demonstrates create, put, search, and timeline operations:

cargo run --example basic_usage
PDF Ingestion

Ingest and search PDF documents (uses the "Attention Is All You Need" paper):

cargo run --example pdf_ingestion
CLIP Visual Search

Image search using CLIP embeddings (requires clip feature):

cargo run --example clip_visual_search --features clip
Whisper Transcription

Audio transcription (requires whisper feature):

cargo run --example test_whisper --features whisper -- /path/to/audio.mp3

Available Models:

ModelSizeSpeedUse Case
whisper-small-en244 MBSlowestBest accuracy (default)
whisper-tiny-en75 MBFastBalanced
whisper-tiny-en-q8k19 MBFastestQuick testing, resource-constrained

Model Selection:

# Default (FP32 small, highest accuracy)
cargo run --example test_whisper --features whisper -- audio.mp3

# Quantized tiny (75% smaller, faster)
MEMVID_WHISPER_MODEL=whisper-tiny-en-q8k cargo run --example test_whisper --features whisper -- audio.mp3

Programmatic Configuration:

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):

mkdir -p ~/.cache/memvid/text-models

# Download ONNX model
curl -L 'https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/onnx/model.onnx' \
  -o ~/.cache/memvid/text-models/bge-small-en-v1.5.onnx

# Download tokenizer
curl -L 'https://huggingface.co/BAAI/bge-small-en-v1.5/resolve/main/tokenizer.json' \
  -o ~/.cache/memvid/text-models/bge-small-en-v1.5_tokenizer.json
Available Models
ModelDimensionsSizeBest For
bge-small-en-v1.5384~120MBDefault, fast
bge-base-en-v1.5768~420MBBetter quality
nomic-embed-text-v1.5768~530MBVersatile tasks
gte-large1024~1.3GBHighest quality
Other Models

BGE-base (768 dimensions):

curl -L 'https://huggingface.co/BAAI/bge-base-en-v1.5/resolve/main/onnx/model.onnx' \
  -o ~/.cache/memvid/text-models/bge-base-en-v1.5.onnx
curl -L 'https://huggingface.co/BAAI/bge-base-en-v1.5/resolve/main/tokenizer.json' \
  -o ~/.cache/memvid/text-models/bge-base-en-v1.5_tokenizer.json

Nomic (768 dimensions):

curl -L 'https://huggingface.co/nomic-ai/nomic-embed-text-v1.5/resolve/main/onnx/model.onnx' \
  -o ~/.cache/memvid/text-models/nomic-embed-text-v1.5.onnx
curl -L 'https://huggingface.co/nomic-ai/nomic-embed-text-v1.5/resolve/main/tokenizer.json' \
  -o ~/.cache/memvid/text-models/nomic-embed-text-v1.5_tokenizer.json

GTE-large (1024 dimensions):

curl -L 'https://huggingface.co/thenlper/gte-large/resolve/main/onnx/model.onnx' \
  -o ~/.cache/memvid/text-models/gte-large.onnx
curl -L 'https://huggingface.co/thenlper/gte-large/resolve/main/tokenizer.json' \
  -o ~/.cache/memvid/text-models/gte-large_tokenizer.json
Usage in Code
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
ModelDimensionsBest For
text-embedding-3-small1536Default, fastest, cheapest
text-embedding-3-large3072Highest quality
text-embedding-ada-0021536Legacy model

See examples/openai_embedding.rs for a complete example.

File Format

Everything lives in a single .mv2 file:

┌────────────────────────────┐
│ Header (4KB)               │  Magic, version, capacity
├────────────────────────────┤
│ Embedded WAL (1-64MB)      │  Crash recovery
├────────────────────────────┤
│ Data Segments              │  Compressed frames
├────────────────────────────┤
│ Lex Index                  │  Tantivy full-text
├────────────────────────────┤
│ Vec Index                  │  HNSW vectors
├────────────────────────────┤
│ Time Index                 │  Chronological ordering
├────────────────────────────┤
│ TOC (Footer)               │  Segment offsets
└────────────────────────────┘

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


Memvid v1 (QR-based memory) is deprecated

If you are referencing QR codes, you are using outdated information.

See: https://docs.memvid.com/memvid-v1-deprecation


License

Apache License 2.0 — see the LICENSE file for details.

Runs on
CUDA, Metal
What shows it
  • CUDA: memvid-core feature cuda, memvid-cli feature cuda
  • Metal: memvid-core feature metal, memvid-cli feature metal
Native code
Required
  • Binds native code: zstd-sys, link-cplusplus (feature llama-cpp), llama_cpp_sys (feature llama-cpp), ort-sys (feature logic_mesh)
Python bindings
No Python binding crate found
License
Apache-2.0

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

memvid beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
memvid This page Listed

Core library for Memvid v2, a crash-safe, deterministic, single-file AI memory.

5,276 downloads over 30 days 2 17,386 2.0.140 CUDA, Metal Binds native code: zstd-sys, link-cplusplus (feature llama-cpp), llama_cpp_sys (feature llama-cpp), ort-sys (feature logic_mesh) Apache-2.0

Core protocol types and traits for the Agent Client Protocol

Also in Build LLM apps and agents.

941,949 downloads over 30 days 145 245 5.0.0 GPU support unknown No native code found Apache-2.0
rig Featured

An opinionated library for building LLM powered applications.

Also in Build LLM apps and agents.

64,485 downloads over 30 days 234 9,096 0.46.0 GPU support unknown Binds native code: libsqlite3-sys (feature sqlite), ring (feature surrealdb) MIT
rust-mcp-sdk Featured

An asynchronous SDK and framework for building MCP-Servers and MCP-Clients, leveraging the rust-mcp-schema for type safe MCP Schema Objects.

Also in Build LLM apps and agents.

29,764 downloads over 30 days 51 199 2.0.0 GPU support unknown No native code found MIT
korvus Listed Dormant

Korvus is a search SDK that unifies the entire RAG pipeline in a single database query. Built on top of Postgres with bindings for Python, JavaScript, Rust and C.

Python bindings

Also in Text, embeddings and search.

54 downloads over 30 days 0 1,474 1.1.5 GPU support unknown No native code found MIT

Persistent cognitive memory for AI agents and robots — Hebbian learning, knowledge graph, spatial recall. Zenoh/ROS2 native. Single binary, runs offline.

Python bindings

Also in Build LLM apps and agents.

1 downloads over 30 days 0 322 0.2.0 GPU support unknown Binds native code: libmimalloc-sys, librocksdb-sys, lz4-sys, ort-sys, pnet_sys (feature zenoh) Apache-2.0
axp App Listed

An open protocol that gives AI agents a secure, sandboxed place to run code and use tools — with lean context usage. AXP works alongside MCP

Also in Build LLM apps and agents.

Not measured Not applicable 3 Not measured Not measured Not measured Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 2 active dependents and 2 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 17,386 stars, 1,468 forks and 23 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

Check notes

  • the latest release was packaged from a dirty working tree

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 2.0.140 base 700: E = 700 days
  • dormancy: last activity 2026-07-14, 118 days ago, E = 700: active
  • rot: deprecated requirement `bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)`
  • featured: not featured: active_users 2 < 11 and new_adopters 2 < 9 and repository route stars 17386 (needs 4539), forks 1468 (needs 434), contributors 23 (needs 79)
  • listed: listed: no archive, new or featured rule applies
Crates3 crates

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents2crates.io database dumpYes
New dependents (365 days)2crates.io database dumpYes
Peak active dependents2crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 3 months ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-07-14GitHub repositoryYes
Latest release2026-05-27crates.io database dumpYes
First release2025-11-18crates.io database dumpYes
Latest version2.0.140crates.io database dumpYes
Days the oldest outside issue waits for a reply301GitHub repositoryYes
Maintainer replies over 365 days27GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementbincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)crates.io database dumpYes
Distribution32 releases, 5,276 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases32crates.io database dumpYes
Downloads over 30 days5276crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository17,386 stars, 1,468 forks, 23 contributors, 261 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars17386GitHub repositoryYes — one part of the repository route
GitHub forks1468GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account23GitHub contributorsYes — one part of the repository route
Commits on the default branch261GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesCUDA, Metalcrates.io database dumpNo
What shows each backendCUDA: memvid-core feature cuda, memvid-cli feature cuda; Metal: memvid-core feature metal, memvid-cli feature metalcrates.io database dumpNo
Native code, from listed crates and their dependenciesBinds native code: zstd-sys, link-cplusplus (feature llama-cpp), llama_cpp_sys (feature llama-cpp), ort-sys (feature logic_mesh)crates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly2crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.