---
title: "history and restore"
description: "Inspect previous memory revisions and recover accidental overwrites."
---

> Documentation Index
> Fetch the complete documentation index at: https://machine-memory.jfa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# history and restore

## Usage

```sh
machine-memory history <id> (--local|--remote) [--limit <n>] [--offset <n>]
machine-memory restore <id> --revision <revision_id> --expected-update-count <n> (--local|--remote)
```

## History

`history` lists previous revisions of a memory, newest first.

Each update automatically saves a complete snapshot of the previous memory row,
including its content, metadata, attribution, and timestamps.

```sh
machine-memory history 42 --remote
```

The response includes:

- `results`: List of historical revisions, each containing its `revision_id`, `snapshot_at`, and previous metadata.
- `current_update_count`: The current update count of the live memory, used when restoring.
- Pagination fields: `count`, `total_count`, `offset`, `limit`, and `has_more`.

Historical revisions are text records and are not indexed for search.

## Restore

`restore` reverts an existing memory to a previous revision in place, preserving its ID and repository.

```sh
machine-memory restore 42 --revision 123 --expected-update-count 5 --remote
```

Provide the `revision_id` and the memory's `current_update_count` (obtained from `history`). If the memory was modified concurrently and the count does not match, the restore is rejected.

When restored:

- The content and metadata revert to the selected snapshot.
- The memory's `update_count` increments, and the state prior to restoration is saved as a new snapshot so the restore can be undone.
- If the restored memory is active, it is automatically re-embedded for search.

Deleting a memory permanently purges all of its history snapshots; restore cannot recover deleted memories.

## Output flags

Both commands accept `--brief`, `--json-min`, and `--quiet` for compact machine-readable output.

Source: https://machine-memory.jfa.dev/machine/history/index.mdx
