# Memvid

> Single-file, serverless memory layer that gives AI agents persistent long-term recall

- Category: Agents & Automation / Agent Memory
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/memvid/memvid
- Website: https://www.memvid.com
- Canonical page: https://ai-tldr.dev/tools/memvid/

## In short

Memvid is a portable memory system for AI agents that packages your data, embeddings, search structure, and metadata into a single file. Instead of standing up a server-based vector database or wiring together a complex RAG pipeline, you read and search directly from that one file. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Rust and licensed Apache-2.0.

## Overview

Memvid is a portable memory system for AI agents that packages your data, embeddings, search structure, and metadata into a single file. Instead of standing up a server-based vector database or wiring together a complex RAG pipeline, you read and search directly from that one file.

The design draws on ideas from video encoding. Memory is stored as an append-only sequence of immutable Smart Frames that each hold content along with a timestamp, checksum, and basic metadata. Because writes only ever append, existing data is never overwritten, which makes the file crash-safe and lets you inspect or replay how knowledge changed over time.

Memvid is model-agnostic and works fully offline, so the same memory file can travel with an agent across sessions and machines. The core engine is written in Rust, and there are official CLI, Node.js, and Python packages for using it from other languages.

## What it does

- Stores data, embeddings, search index, and metadata in one portable file, with no separate database or server to run
- Append-only Smart Frames keep every write immutable and checksummed, giving crash safety and a rewindable timeline of memory
- Full-text BM25 search (via the `lex` feature) and vector similarity search with HNSW and local ONNX embeddings (via the `vec` feature)
- Optional feature flags for CLIP image search, Whisper audio transcription, PDF text extraction, natural-language date parsing, and encrypted capsules
- Time-travel debugging to rewind, replay, or branch any past memory state
- Available as a Rust crate plus official CLI, Node.js, and Python SDKs

## Getting started

Memvid's core engine is a Rust crate (memvid-core), and there are matching packages for the CLI, Node.js, and Python. The quickest way to try it is to add the crate to a Rust project, or install one of the SDKs for your language.

1. Install for your language

   Pick the package that matches your stack. The CLI and Node.js SDK install via npm, the Python SDK via pip, and the Rust core via cargo.

```bash
npm install -g memvid-cli
npm install @memvid/sdk
pip install memvid-sdk
cargo add memvid-core
```

2. Add the Rust crate with the features you need

   If you are working in Rust, add memvid-core to your Cargo.toml. Memvid uses feature flags, so enable the ones you need such as full-text search, vector search, or natural-language date parsing.

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

3. Create a memory file, add data, and search

   Create a new .mv2 memory file, put documents into it with optional title, URI, and tags, commit the change, then run a search and read back the hits.

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

fn main() -> memvid_core::Result<()> {
    let mut mem = Memvid::create("knowledge.mv2")?;

    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()?;

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

4. Build from source (optional)

   To build the project yourself, clone the repository and compile it. Use the release profile for an optimized build, and pass the features you want.

```bash
git clone https://github.com/memvid/memvid.git
cd memvid
cargo build --release --features "lex,vec,temporal_track"
```

## When to use it

- Giving long-running AI agents persistent, long-term memory they can carry across sessions and machines
- Building offline-first AI systems that need fast local recall without a hosted vector database
- Packaging an enterprise knowledge base or personal knowledge assistant into a single portable, shareable file
- Auditing and debugging AI workflows by rewinding, replaying, or branching past memory states
