> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memvid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Memvid Documentation - Single-file AI Memory for AI Agents

> Complete documentation for Memvid - a single-file memory layer for AI agents with instant retrieval, hybrid search (BM25 + vector), entity extraction, and time-travel debugging. Zero infrastructure, works offline.

# One file. All your AI memory.

Ship a single `.mv2` file that holds your data, indexes, and crash recovery. Copy it, sync it, commit it to git. No servers. No infrastructure. Just one file.

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    npm install -g memvid-cli

    memvid create knowledge.mv2
    echo "Alice works at Anthropic as a Senior Engineer." | memvid put knowledge.mv2
    memvid find knowledge.mv2 --query "who works at AI companies"
    memvid state knowledge.mv2 "Alice"
    # { employer: 'Anthropic', role: 'Senior Engineer' }
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    import { create, use } from '@memvid/sdk';
    import { existsSync } from 'fs';

    // create() for NEW files, use() for EXISTING files
    const mem = existsSync('knowledge.mv2')
      ? await use('basic', 'knowledge.mv2')
      : await create('knowledge.mv2', 'basic');

    await mem.put({ title: 'Team Info', label: 'notes', text: 'Alice works at Anthropic...' });
    const results = await mem.find('who works at AI companies', { k: 5, mode: 'lex' });
    const alice = await mem.state('Alice');
    // { slots: { employer: 'Anthropic', role: 'Senior Engineer' } }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from memvid_sdk import create, use
    import os

    # create() for NEW files, use() for EXISTING files
    path = 'knowledge.mv2'
    mem = use('basic', path) if os.path.exists(path) else create(path)

    mem.put(title='Team', label='info', metadata={}, text='Alice works at Anthropic...')
    results = mem.find('who works at AI companies', k=5, mode='lex')
    alice = mem.state('Alice')
    # {'slots': {'employer': 'Anthropic', 'role': 'Senior Engineer'}}
    ```
  </Tab>
</Tabs>

<Warning>
  **`create() will OVERWRITE existing files!`** Note the different parameter order:

  * `create(path, kind)` — path first, creates NEW file (deletes existing data)
  * `use(kind, path)` — kind first, opens EXISTING file (preserves data)

  Always check if the file exists first. See examples above.
</Warning>

***

## Why Memvid?

<CardGroup cols={2}>
  <Card title="Single File Storage" icon="file">
    Everything in one portable `.mv2` file. No databases, no Docker, no cloud dependencies.
  </Card>

  <Card title="Hybrid Search" icon="magnifying-glass">
    Combines BM25 lexical search with vector similarity. Best of both worlds.
  </Card>

  <Card title="O(1) Entity Lookups" icon="bolt">
    Ask "What's Alice's job?" and get instant answers via Memory Cards (SPO triplets).
  </Card>

  <Card title="Time-Travel Debugging" icon="clock-rotate-left">
    Record sessions, replay with different parameters, debug retrieval quality.
  </Card>
</CardGroup>

***

## Memvid vs Alternatives

| Capability         | Memvid             | Pinecone     | ChromaDB       | Weaviate       |
| ------------------ | ------------------ | ------------ | -------------- | -------------- |
| **Single file**    | `.mv2`             | Cloud only   | SQLite + files | Docker         |
| **Hybrid search**  | BM25 + vectors     | Vectors only | Vectors only   | BM25 + vectors |
| **Entity lookups** | O(1) via SlotIndex | No           | No             | No             |
| **Time-travel**    | Built-in           | No           | No             | No             |
| **Crash safety**   | Embedded WAL       | Cloud        | Manual         | Cloud          |
| **Works Offline**  | Yes                | No           | Limited        | No             |

***

## Quick Start

<CardGroup cols={3}>
  <Card title="CLI" icon="terminal" href="/installation/cli">
    ```bash theme={null}
    npm install -g memvid-cli
    ```
  </Card>

  <Card title="Node.js" icon="js" href="/installation/node">
    ```bash theme={null}
    npm install @memvid/sdk
    ```
  </Card>

  <Card title="Python" icon="python" href="/installation/python">
    ```bash theme={null}
    pip install memvid-sdk
    ```
  </Card>
</CardGroup>

<Info>
  **Ready to build?** Start with the [5-Minute Quickstart](/quickstart/five-minute-guide) for a complete walkthrough.
</Info>

***

## Core Capabilities

### Hybrid Search

Combine keyword matching with semantic understanding:

```bash theme={null}
# Lexical search (fast, exact matching)
memvid find knowledge.mv2 --query "budget" --mode lex

# Semantic search (meaning-based)
memvid find knowledge.mv2 --query "financial outlook" --mode sem

# Hybrid search (combines both - default)
memvid find knowledge.mv2 --query "Q4 projections"
```

### Memory Cards (Entity Extraction)

Extract structured facts and query them instantly:

```bash theme={null}
# Extract facts from documents
memvid enrich knowledge.mv2 --engine rules

# Query entity state (O(1) lookup)
memvid state knowledge.mv2 "Alice"
# employer: Anthropic
# role: Senior Engineer
# location: San Francisco
```

### LLM-Powered Q\&A

Ask natural language questions with sourced answers:

```bash theme={null}
export OPENAI_API_KEY=sk-...
memvid ask knowledge.mv2 --question "What is Alice's role?" --use-model openai
# Answer: Alice is a Senior Engineer at Anthropic in San Francisco.
# Sources: [Meeting Notes, Team Directory]
```

### Time-Travel Debugging

Record and replay sessions to debug retrieval:

```bash theme={null}
memvid session start knowledge.mv2 --name "qa-test"
memvid find knowledge.mv2 --query "test query"
memvid session end knowledge.mv2

# Replay with different parameters
memvid session replay knowledge.mv2 --session abc123 --top-k 10
```

***

## Framework Integrations

Use Memvid with your favorite AI frameworks:

<CardGroup cols={4}>
  <Card title="LangChain" icon="link" href="/frameworks/langchain">
    Vector store adapter
  </Card>

  <Card title="LlamaIndex" icon="fire" href="/frameworks/llamaindex">
    Index and retriever
  </Card>

  <Card title="Vercel AI" icon="triangle" href="/frameworks/vercel-ai">
    RAG pipeline
  </Card>

  <Card title="OpenAI" icon="robot" href="/frameworks/openai">
    Function calling
  </Card>
</CardGroup>

***

## Start Exploring

<CardGroup cols={2}>
  <Card title="5-Minute Quickstart" icon="rocket" href="/quickstart/five-minute-guide">
    Build your first AI memory with search and Q\&A
  </Card>

  <Card title="CLI Reference" icon="terminal" href="/cli/index">
    Complete command reference for all 38+ commands
  </Card>

  <Card title="Node.js SDK" icon="js" href="/node-sdk/overview">
    Full API reference with TypeScript types
  </Card>

  <Card title="Python SDK" icon="python" href="/python-sdk/overview">
    Complete Python API with examples
  </Card>

  <Card title="Core Concepts" icon="lightbulb" href="/concepts/memory-architecture">
    Deep dive into .mv2 format, indexes, and architecture
  </Card>

  <Card title="Embedding Providers" icon="cube" href="/concepts/embedding-models">
    OpenAI, Gemini, Mistral, Cohere, and local models
  </Card>
</CardGroup>
