---
title: memhtml index rebuild
description: Rebuild index.db from the git tree at HEAD, keeping every stored vector whose chunk survives. Destroys nothing outside .memhtml/.
---

## 1. Synopsis

Rebuild index.db from the git tree at HEAD, keeping every stored vector whose chunk survives. Destroys nothing outside .memhtml/.

```sh
memhtml index rebuild [options]
```

## 2. Arguments

This command takes no positional arguments.

## 3. Flags

| Flag | Type | Default | Values | Description |
| --- | --- | --- | --- | --- |
| `--embed` | flag | `true` | *no fixed set* | Fill missing vectors from Bedrock. `--no-embed` makes the rebuild instant and leaves new or changed chunks without a vector; the vectors already stored survive either way when the model is unchanged. With MEMHTML\_EMBED=off, `--embed` is held to the same rules as `--no-embed`. |
| `--force` | flag | `false` | *no fixed set* | Run a rebuild that cannot write vectors (`--no-embed`, or `--embed` with MEMHTML\_EMBED=off) over a store that already carries them. Without it that call is refused with ERR\_REBUILD\_NO\_EMBED\_REFUSED, because a store with vectors was embedded on purpose. Accepted and inert when the rebuild can embed. |

Every command also accepts the [global flags](/reference/global-flags/).

## 4. Response

On success the command writes one JSON envelope to stdout, and its `type` is `index.report`.

On failure it writes the failure envelope, whose `code` comes from [error codes](/reference/error-codes/).

[The JSON envelope](/reference/envelope/) gives the fields both shapes carry. [Response types](/reference/response-types/) lists every value `type` takes across the binary.

## 5. Further reading

No guide block names this command. The [guide](/reference/guide/) is the workflow prose the CLI ships beside the command table: which command to reach for, and in what order.

## 6. Provenance

A loader generates this page from `apps/cli/src/commands.ts` while the site builds, so no file in the repository holds it: the `COMMANDS` array there is the one source of argument parsing, of `memhtml manifest`, and of `AGENTS.md`. Change the registry and this page changes with it.