# Mem0 to Hindsight Migration: Export, Load, What Changes

> Move Mem0 memories to Hindsight: export with get_all, load with batch retain, the field map, what does not carry over, and the LLM cost of the import.

Source: https://aiagentmemory.org/articles/migrate-mem0-to-hindsight/ · Updated 2026-12-04 · aiagentmemory.org


**There is no official migration tool from Mem0 to Hindsight.** You export your memories from Mem0 with its `get_all` call, then load them into Hindsight with batch retain. Each old memory is read again by an LLM, so the import costs model calls, and the facts Hindsight stores are extracted from your old text, not copied as-is. This page shows the steps, the field mapping, and what does not carry over.

## What is Hindsight?

**Hindsight is an open-source agent memory server from Vectorize, released under the MIT license.** It has three operations: retain (store), recall (search) and reflect (reason over memories). Each bank holds its own memories, so you can keep one bank per user, as Mem0's `user_id` scopes memories per user. Facts and API details here come from Hindsight's retain docs, read 3 December 2026, and the `hindsight-client` package 1.3.1 on PyPI.

## Step 1: Export your memories from Mem0

Mem0's Platform client returns memories with `get_all`. The page is paginated, so loop until there is no `next`. The cookbook examples call it once per user, so run the loop for every `user_id` you have.

```python
from mem0 import MemoryClient

mem0 = MemoryClient(api_key="YOUR_MEM0_API_KEY")

def export_user(user_id):
    page = 1
    while True:
        resp = mem0.get_all(filters={"user_id": user_id}, page=page, page_size=50)
        for memory in resp["results"]:
            yield memory
        if not resp.get("next"):
            break
        page += 1
```

Mem0's response sample has `id`, `memory`, `created_at` and `updated_at` for each memory. The export cookbook filters on metadata that you set when you added the memory, but the response sample does not show metadata. Print one record and check before you rely on it.

Mem0's Platform UI also has a "Memory Exports" screen. Mem0's memory export docs, checked 4 December 2026, do not say how long an export file stays available, so save the file as soon as it is ready if you use that route.

## Step 2: Map the fields

| Mem0 field | Hindsight field | Note |
|---|---|---|
| `memory` (text) | `content` | Only required field in Hindsight. |
| `created_at` | `timestamp` | ISO 8601 in both. Set it, or the import time is used. |
| `id` | `document_id` | Re-sending the same id replaces that document, so re-runs do not duplicate. |
| `user_id` | bank (`bank_id`) | One bank per user keeps the same isolation Mem0 gives per user. |
| metadata | `metadata` | Hindsight stores metadata values as strings, so convert them. |
| (none) | `context` | Optional short label, for example `"mem0 import"`. |

## Step 3: Load into Hindsight with batch retain

Hindsight's docs call batch ingestion "the recommended approach". The method is `retain_batch`, and `hindsight-client` 1.3.1 accepts `bank_id`, `items`, `document_id`, `document_tags`, `retain_async` and `operation_id`. The 50-item chunk size below is our choice. The docs do not set a maximum item count.

```python
from hindsight_client import Hindsight

hs = Hindsight(base_url="http://localhost:8888")  # your Hindsight server

def load_user(user_id):
    batch = []
    for memory in export_user(user_id):
        batch.append({
            "content": memory["memory"],
            "timestamp": memory["created_at"],
            "document_id": memory["id"],
            "context": "mem0 import",
            "metadata": {k: str(v) for k, v in (memory.get("metadata") or {}).items()},
        })
        if len(batch) == 50:
            hs.retain_batch(bank_id=user_id, items=batch)
            batch = []
    if batch:
        hs.retain_batch(bank_id=user_id, items=batch)

load_user("alice")
```

Check the result with `recall` on a few known facts before you switch your agent over. We did not run this script against a live Mem0 account or Hindsight server, so run it on one test user first.

## What does not carry over

- **The stored text.** Retain extracts facts, dates and entities with an LLM. Your memory "Alex prefers vegetarian restaurants" may become a different fact, a linked entity, or part of an observation. Check a sample.
- **Mem0's search scores and ranking.** Hindsight ranks results with its own recall, which runs four strategies in parallel and reranks them. The scores do not match.
- **Mem0's filters.** Mem0 filters by `user_id`, `agent_id`, `run_id` and metadata. In this layout, the bank is the scope. Filter on metadata in recall, or rebuild the filter.
- **Expiry dates.** Mem0 returns `expiration_date` on each memory. The retain item fields in Hindsight's docs have no expiry field, so keep the date in your own code or in metadata.

## What it costs

Retain calls an LLM for every item, so the import is paid work. On Hindsight Cloud, retain is priced at $10.00 per 1M tokens (vectorize.io/pricing, checked 3 December 2026). Self-hosted Hindsight is free under MIT, and you pay your LLM provider for the calls. Estimate the cost from your total memory text before you start.

## When Hindsight is the better home for migrated memory

Hindsight's best-supported lead over Mem0 is long histories. Its BEAM 10M score is 64.1, against 48.6 for Mem0. Both figures are from [Mem0's comparison page](https://mem0.ai/compare/mem0-vs-hindsight), and Hindsight's numbers are Vectorize-run results, so treat them as vendor-reported. Hindsight also ships its graph, temporal recall, consolidation and mental models in the open-source server. Mem0 keeps graph memory on its paid plans.

Hindsight returns more context per retrieval by default than Mem0 does. Set `max_tokens` lower if your agent has a small context budget. For a side-by-side view, read [Mem0 vs Hindsight](/articles/mem0-vs-hindsight/). For the Hindsight side in full, read [Hindsight AI memory](/articles/ai-memory-hindsight/).


## FAQ

### Is there an official tool to migrate from Mem0 to Hindsight?

No. Neither Mem0 nor Hindsight has an official import tool or migration guide between them, as of 3 December 2026. You export your memories from Mem0 with its get_all call, then load them into Hindsight with batch retain.

### Are my Mem0 memories copied into Hindsight as they are?

No. Hindsight's retain step splits each item into chunks, has an LLM extract facts, and stores those facts. Your old memories are read again, so the import costs LLM calls and the stored facts can differ from the original text.

### Can I re-run a Mem0 to Hindsight import without duplicates?

Yes, if you pass the Mem0 memory id as document_id. Sending the same document_id again replaces that document, so a second run does not add copies.

