Memvid

RAG & Memory 💻 Rust ⚖️ Apache-2.0 🟡 Quiet lately
16.5k stars

Memvid is a portable, single-file memory layer for AI agents that provides persistent, versioned memory with instant retrieval, eliminating the need for databases or complex RAG pipelines. It packages data, embeddings, and metadata into a .mv2 file, enabling fast, model-agnostic recall for developers building AI applications.

✨ Key features

  • Single-file memory storage with no external databases
  • Append-only Smart Frames with timestamps and checksums
  • Time-travel debugging to rewind or branch memory states
  • Sub-5ms local memory access with predictive caching
  • Supports full-text, vector, and temporal search
  • Available in Rust, Node.js, Python, and CLI

🎯 Use cases

  • Long-running AI agents needing persistent memory
  • Enterprise knowledge bases with fast retrieval
  • Offline-first AI systems that work without servers
  • Codebase understanding and search
  • Customer support agents with conversational memory

📦 Installation

🧰 Requirements: Rust 1.85.0+ for Rust SDK; other SDKs available for Node.js, Python, and CLI. Optional API keys for OpenAI embeddings if using the api_embed feature.

Add to Your Project

[dependencies]
memvid-core = "2.0"

Enable features as needed:

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

For CLI: npm install -g memvid-cli For Node.js: npm install @memvid/sdk For Python: pip install memvid-sdk For Rust: cargo add memvid-core

🚀 Usage

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(())
}

⚠️ Good to know

Memvid v1 (QR-based memory) is deprecated; the current version uses .mv2 files. Some features require manual download of ONNX models for local embeddings.

❓ FAQ

What is a Smart Frame?

A Smart Frame is an immutable unit that stores content with timestamps, checksums, and metadata, enabling efficient compression and parallel reads.

How do I enable full-text search?

Enable the 'lex' feature flag in your Cargo.toml to use full-text search with BM25 ranking via Tantivy.

Can I use OpenAI embeddings?

Yes, enable the api_embed feature and set your OPENAI_API_KEY environment variable to use OpenAI's embedding models.

Is there a CLI available?

Yes, install the CLI globally with npm install -g memvid-cli.

📊 Repository

Stars★ 16,488
Forks🍴 1,415
Open issues🐛 34
Last commit🕒 Jul 14, 2026
Created📅 May 2025
Language💻 Rust
License⚖️ Apache-2.0

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.