<!-- GENERATED by scripts/build-docs.mjs from the live Commander tree (src/cli/program.ts). Do not edit by hand. -->

# pai memory

> Memory engine: index, search, and status

## Synopsis

```
pai memory <subcommand> [options]
```

## Subcommands

| Command | Description |
|---------|-------------|
| [`pai memory index [project-slug]`](#pai-memory-index-project-slug) | Index memory files for one project or all projects |
| [`pai memory embed [project-slug]`](#pai-memory-embed-project-slug) | Generate embeddings for un-embedded chunks (Phase 2.5) |
| [`pai memory search <query>`](#pai-memory-search-query) | Search indexed memory (BM25 keyword, semantic, or hybrid) |
| [`pai memory status [project-slug]`](#pai-memory-status-project-slug) | Show memory index statistics |
| [`pai memory settings [key] [value]`](#pai-memory-settings-key-value) | View or modify search settings in the PAI config file (`pai config path`) |
| [`pai memory sources`](#pai-memory-sources) | Show what the indexer has taken in: composition by source, which roots |

### pai memory index [project-slug]

Index memory files for one project or all projects

**Arguments**

| Argument | Kind |
|----------|------|
| `[project-slug]` | optional |

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `--all` | Index all active projects (default when no slug given) |  |
| `--embed` | Also generate embeddings for newly indexed chunks (Phase 2.5) |  |
| `--direct` | Skip daemon IPC and run index directly (for debugging) |  |


### pai memory embed [project-slug]

Generate embeddings for un-embedded chunks (Phase 2.5)

**Arguments**

| Argument | Kind |
|----------|------|
| `[project-slug]` | optional |

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `--batch-size <n>` | Chunks to embed per batch | `50` |


### pai memory search <query>

Search indexed memory (BM25 keyword, semantic, or hybrid)

**Arguments**

| Argument | Kind |
|----------|------|
| `<query>` | required |

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `--project <slug>` | Restrict search to a specific project |  |
| `--source <source>` | Restrict to 'memory' or 'notes' |  |
| `--limit <n>` | Maximum results to return |  |
| `--mode <mode>` | Search mode: keyword (default), semantic, hybrid |  |
| `--no-rerank` | Skip cross-encoder reranking (reranking is on by default) |  |
| `--recency <days>` | Apply recency boost: score halves every N days. 0 = off |  |


### pai memory status [project-slug]

Show memory index statistics

**Arguments**

| Argument | Kind |
|----------|------|
| `[project-slug]` | optional |


### pai memory settings [key] [value]

View or modify search settings in the PAI config file (`pai config path`)

**Arguments**

| Argument | Kind |
|----------|------|
| `[key]` | optional |
| `[value]` | optional |


### pai memory sources

Show what the indexer has taken in: composition by source, which roots

content enters from, the heaviest single files, and how many chunks are
rewritten per day (which distinguishes a finite backlog from a treadmill).

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `--limit <n>` | Rows per section (default 8) | `8` |


## Examples

```bash
# Search federated memory across all projects
pai memory search "cross-encoder reranker"

# Semantic (vector) search with recency boost (reranking is on by default)
pai memory search "token factory" --mode semantic --recency 90

# Re-index a project's memory/ and Notes/ directories
pai memory index

# Show index size and embedding coverage
pai memory status
```

## See also

[`pai audit`](audit.md) · [`pai backup`](backup.md) · [`pai clear-names`](clear-names.md) · [`pai config`](config.md) · [`pai daemon`](daemon.md) · [`pai db`](db.md) · [`pai end`](end.md) · [`pai help`](help.md) · [`pai identity`](identity.md) · [`pai kg`](kg.md) · [`pai launch`](launch.md) · [`pai mcp`](mcp.md) · [`pai notify`](notify.md) · [`pai observation`](observation.md) · [`pai obsidian`](obsidian.md) · [`pai pause`](pause.md) · [`pai project`](project.md) · [`pai projects`](projects.md) · [`pai registry`](registry.md) · [`pai restore`](restore.md) · [`pai session`](session.md) · [`pai sessions`](sessions.md) · [`pai setup`](setup.md) · [`pai shell-init`](shell-init.md) · [`pai skill`](skill.md) · [`pai task`](task.md) · [`pai topic`](topic.md) · [`pai update`](update.md) · [`pai worker`](worker.md) · [`pai zettel`](zettel.md)

Run `pai help <area>` to read any of these in the terminal.

