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

# Stale memories and duplicates

> Mark a memory as replaced or give it an expiry date, and review the pairs of memories Hookie finds that say the same thing.

Memories go out of date, and agents save the same thing twice. Hookie lets you retire a
memory without deleting it, and looks for duplicates for you to merge. Nothing is lost
and nothing is merged unless you, or your agent, choose to.

## Stale memories

A memory can stop being current in two ways. Both leave it in place.

* **Replaced:** the memory is superseded by a newer memory in the same project.
* **Expired:** its expiry date has passed.

Stale memories are left out of memory lists, the [context bundle](https://docs.hookie.ai/project-context.md)
agents read, knowledge search, memory threads and the shared memories other projects
see. Open one by its id and it is still there, marked as stale, with a link to the
memory that replaced it.

### Mark a memory as replaced

On the project's **Brain** page, open a memory and choose **Mark as replaced by…**,
then pick the newer memory. **Restore** makes it current again.

Agents and the API do the same in two ways:

* Set `superseded_by` to the newer memory's id with `update_memory` (or `PATCH` the
  memory). Set it to `null` to restore it.
* Save the newer memory with `supersedes`, a list of up to 10 older memory ids, through
  `save_memory` or `record_decision`. The response lists any it could not replace in
  `supersede_failed`.

The replacement must be one you can read, in the same project, current, and not the
memory itself, so a chain never loops. A shared memory cannot be replaced by someone
else's private one. A replaced memory cannot move to another project.

Saving again under a `memory_key` that names a replaced memory makes it current again.
Deleting a memory makes the memories it had replaced current again.

### Set an expiry date

On the **Brain** page, open a memory and choose **Set expiry**. From that day the memory
is left out of lists and what agents read; a past day expires it now. **Remove expiry**
clears it.

Through an agent or the API, set `expires_at` (ISO 8601, up to 10 years ahead) with
`save_memory`, `record_decision` or `update_memory`. `null` removes it.

Expired memories are deleted once their expiry is older than your plan's history
retention: 7 days on Free, 30 on Starter, 90 on Pro and 365 on Team and Ultimate. Their
earlier versions go with them. Replaced memories are never deleted automatically.

### Who can change it

A memory's author can mark it replaced or set its expiry. For a shared, active memory,
someone who manages the project can also change those two fields, on their own, without
touching the memory's text.

### See stale memories

* **Console:** turn on **Show superseded and expired** on the Brain page.
* **Agents:** `list_memories` takes `include_superseded` and `include_expired`;
  `get_project_context` and `search_project_knowledge` take `include_stale`.
* **API:** `GET …/memories?include=superseded,expired`, and `include_stale` on
  `brain/context` and `brain/knowledge`.

A read by id (`get_memory`) returns a stale memory with `stale` (`superseded` or
`expired`) and `current_id`, the memory that replaced it, followed up to 5 hops.

Stale memories still count toward the [2,000 memories per member](https://docs.hookie.ai/ai-memory.md#save-and-recall).

## Possible duplicates

Once a day, Hookie compares each project's current memories and proposes merging the
pairs that say the same thing. It never merges on its own.

### How pairs are found

* **Which memories:** two memories of the same kind in the same project, written by the
  same person, or both shared with the project or workspace. A private memory is only
  ever paired with its own author's, so a proposal never reveals one.
* **By meaning:** where the workspace has the Workspace Brain (the Brain add-on, or
  Ultimate), Hookie compares each memory's title and content by meaning. This counts as
  Brain embedding usage.
* **By wording:** otherwise, Hookie compares wording, and memories with the same title
  are always proposed.

Each proposal records its `method` (`embedding` or `lexical`) and a `score` from 0 to 1.
A pair already merged is never proposed again. A dismissed pair is proposed again only if
either memory's text changes. A project holds up to 100 pending proposals.

### Review and merge

The project's **Brain** page lists **Possible duplicates**. **Review** shows both
memories side by side:

1. Choose which memory to keep.
2. If you wrote the kept memory, edit its content if you like.
3. Choose **Merge**, or **Not duplicates** to dismiss the pair.

Merging keeps one memory and marks the other as replaced by it, in one step. It is
refused with `409` if either memory changed since you opened it. Only the kept memory's
author can change its text or tags. For its author, the tags of both are combined unless
the request sets them; anyone else leaves the kept memory exactly as it was. Its old text
stays in its [version history](https://docs.hookie.ai/project-context.md#version-history).

### Agents

[Connected agents](https://docs.hookie.ai/connected-agents.md) review duplicates with these MCP tools. Listing needs `hookie:read`; merging and dismissing need `hookie:write`.

| Tool | What it does |
| - | - |
| `list_memory_merge_proposals` | Lists pairs that look like duplicates, with both memories in full, their revisions, the score and the method. Only pairs whose two memories you can read are shown. `state` is `pending` (default), `accepted` or `dismissed`. Without `project_id`, it lists every project you can see. |
| `accept_memory_merge` | Keeps one memory (`keep`) and marks the other replaced. Pass both revisions you read (`a_revision`, `b_revision`). `title` and `content` give the kept memory merged text, only when you are its author. |
| `dismiss_memory_merge` | Marks the pair as not duplicates. |

`get_project_context` returns `merge_proposals_pending`, the number of pairs waiting.

In a project where [decisions agents record wait for approval](https://docs.hookie.ai/project-context.md#approving-agents-decisions),
an agent cannot merge away a decision.

### Over the API

Under `/admin/api/projects/{project_id}` (or `/admin/api/data-workspace` for every project
you can see):

* `GET memories/merge-proposals`, with `state` set to `pending`, `accepted` or `dismissed`.
* `POST memories/merge-proposals/{id}/accept` with `keep`, `a_revision` and `b_revision`,
  and optionally `title`, `content` and `tags`.
* `POST memories/merge-proposals/{id}/dismiss`.

Accepting and dismissing are recorded in the audit log by id only. See the
[API reference](https://docs.hookie.ai/api-reference.md) for every field.

### Turn it off

Under **Sources → Capture & storage → Automatic memory capture → Find duplicate memories**, an owner or admin can stop Hookie looking
for duplicates in a project. It is on by default. Only a person, never an agent, can
change it (`memory_consolidation`, `on` or `off`, on the project).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.