> ## 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.

# CLI Reference

> Complete reference for all Memvid CLI commands

The Memvid CLI provides complete control over your memory files from the command line. Every operation available in the SDKs is also available via the CLI.

## Installation

```bash theme={null}
# npm (recommended)
npm install -g memvid-cli

# Verify installation
memvid --version
```

<Info>
  See [Installation Guide](/installation/cli) for platform-specific instructions and troubleshooting.
</Info>

## Command Categories

| Category                                    | Commands                                                       | Description                          |
| ------------------------------------------- | -------------------------------------------------------------- | ------------------------------------ |
| [Creation](/cli/create-and-put)             | `create`, `open`                                               | Create and inspect memory files      |
| [Data](/cli/create-and-put)                 | `put`, `put-many`, `update`, `delete`, `api-fetch`             | Add, modify, and remove documents    |
| [Search](/cli/search-and-ask)               | `find`, `ask`, `vec-search`, `timeline`, `when`, `audit`       | Query and retrieve information       |
| [Enrichment](/cli/advanced-commands)        | `enrich`, `memories`, `state`, `facts`, `export`, `schema`     | Extract and query structured facts   |
| [Tables](/cli/advanced-commands)            | `tables import`, `tables list`, `tables export`, `tables view` | PDF table extraction                 |
| [Maintenance](/cli/maintenance-and-tickets) | `verify`, `doctor`, `nudge`                                    | File integrity and repair            |
| [Sessions](/cli/timeline-and-view)          | `session start`, `session end`, `session replay`               | Time-travel debugging                |
| [Security](/cli/maintenance-and-tickets)    | `lock`, `unlock`, `binding`, `unbind`                          | Encryption and access control        |
| [Tickets](/cli/tickets-and-capacity)        | `tickets sync`, `tickets apply`, `plan show`                   | Capacity and subscription management |
| [Models](/cli/advanced-commands)            | `models install`, `models list`, `models remove`               | LLM and embedding model management   |

## Global Options

These options apply to all commands:

```bash theme={null}
# Increase logging verbosity
memvid --verbose find memory.mv2 --query "test"
memvid -vvv find memory.mv2 --query "test"  # Maximum verbosity

# Set default embedding model
memvid --model bge-small find memory.mv2 --query "test"
memvid -m openai find memory.mv2 --query "test"

# JSON output (most commands support this)
memvid find memory.mv2 --query "test" --json
```

## Environment Variables

| Variable                    | Description                       | Example       |
| --------------------------- | --------------------------------- | ------------- |
| `MEMVID_API_KEY`            | Dashboard API key for sync        | `mv_live_xxx` |
| `OPENAI_API_KEY`            | OpenAI API key for embeddings/LLM | `sk-xxx`      |
| `NVIDIA_API_KEY`            | NVIDIA API key for embeddings     | `nvapi-xxx`   |
| `GEMINI_API_KEY`            | Google Gemini API key             | `AIzaxxx`     |
| `MISTRAL_API_KEY`           | Mistral API key                   | `xxx`         |
| `MEMVID_TELEMETRY`          | Disable telemetry (set to 0)      | `0`           |
| `MEMVID_LLM_CONTEXT_BUDGET` | Max context chars for LLMs        | `8000`        |

***

## Common Workflows

### Basic Document Ingestion

```bash theme={null}
# Create memory and add documents
memvid create project.mv2

# Add a text file
cat notes.txt | memvid put project.mv2 --title "Notes"

# Add a PDF
memvid put project.mv2 --input report.pdf --title "Report"

# Add with metadata
memvid put project.mv2 --input doc.txt \
  --title "Meeting Notes" \
  --track meetings \
  --tag "date=2024-01-15" \
  --tag "attendees=alice,bob" \
  --label important
```

### Search and Retrieval

```bash theme={null}
# Simple search
memvid find project.mv2 --query "budget projections"

# Semantic search with embeddings
memvid find project.mv2 --query "financial outlook" --mode sem

# Ask questions with LLM
memvid ask project.mv2 --question "What was decided about the budget?" --use-model openai

# Time-filtered search
memvid find project.mv2 --query "status" --as-of-ts 1704067200
```

### Fact Extraction and Entity Queries

```bash theme={null}
# Extract facts (fast, offline)
memvid enrich project.mv2 --engine rules

# Extract facts (LLM, more accurate)
memvid enrich project.mv2 --engine openai

# View all facts
memvid memories project.mv2

# Query specific entity
memvid state project.mv2 "Alice"

# Export facts
memvid export project.mv2 -o facts.json --format json
```

### PDF Table Extraction

```bash theme={null}
# Extract tables from PDF
memvid tables import project.mv2 --input financial.pdf

# List extracted tables
memvid tables list project.mv2

# Export table to CSV
memvid tables export project.mv2 --table-id tbl_001 -o table.csv
```

***

## Output Formats

Most commands support `--json` for machine-readable output:

```bash theme={null}
# Human-readable (default)
memvid find project.mv2 --query "test"

# JSON output
memvid find project.mv2 --query "test" --json

# Parse with jq
memvid find project.mv2 --query "test" --json | jq '.hits[0].title'
```

***

## Exit Codes

| Code | Meaning           |
| ---- | ----------------- |
| 0    | Success           |
| 1    | General error     |
| 2    | File not found    |
| 3    | Permission denied |
| 4    | Capacity exceeded |
| 5    | Lock conflict     |

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Create & Put" icon="file-circle-plus" href="/cli/create-and-put">
    Create memory files and add documents
  </Card>

  <Card title="Search & Ask" icon="magnifying-glass" href="/cli/search-and-ask">
    Query your memory with hybrid search and LLM
  </Card>

  <Card title="Memory Cards" icon="brain" href="/cli/advanced-commands">
    Extract structured facts with O(1) lookups
  </Card>

  <Card title="Timeline & View" icon="clock" href="/cli/timeline-and-view">
    Time-travel queries and session replay
  </Card>
</CardGroup>
