---
title: "Memory Interchange (MIF & Vault-LD)"
description: "Export and import ZeroMemory memories in portable, standards-aligned formats — MIF (Memory Interchange Format) and Vault-LD. Migrate from Mem0, Zep, or Letta; export to git or Obsidian."
canonical: "https://docs.ainative.studio/docs/zeromemory/interchange"
last-updated: "2026-10-13T21:42:35.442Z"
---

# Memory Interchange (MIF & Vault-LD)

Source: https://docs.ainative.studio/docs/zeromemory/interchange

> Export and import ZeroMemory memories in portable, standards-aligned formats — MIF (Memory Interchange Format) and Vault-LD. Migrate from Mem0, Zep, or Letta; export to git or Obsidian.

# Memory Interchange (MIF & Vault-LD)

Export your agent memory to portable, standards-aligned formats and import it back
— so your memory is **yours**, git-backable, and free of lock-in.

- **MIF** (Memory Interchange Format) — markdown + linked-data (JSON-LD) frontmatter
  projected into a knowledge-graph ontology.
- **Vault-LD** — a git / Obsidian-friendly vault-note dialect over the same model.

Both round-trip losslessly within a conformance level, so you can move memory
**into** ZeroMemory (from Mem0 / Zep / Letta) and **out** (to files you control).

:::tip Want to query the graph, not just export it?
This page covers **single-memory + bulk export/import**. To run **SPARQL** over your
memory, dereference entity IRIs, or export the whole namespace as an RDF graph, see
[Knowledge Graph (SPARQL, RDF & Vault-LD)](./knowledge-graph.mdx).
:::

Base URL: `https://api.ainative.studio/api/v1/public/memory/v2` · `Authorization: Bearer <token>`

## Formats & conformance levels

| Format | `format=` | Media type |
|---|---|---|
| MIF JSON-LD | `mif-json` | `application/ld+json` |
| MIF Markdown | `mif-md` | `text/markdown` |
| Vault-LD | `vault-ld` | `text/markdown` |

**Levels** (`level=1..3`):
- **L1/L2** — id, content, title, conceptType, namespace, created, tags, properties.
- **L3** — adds `relationships`, `temporal` (bi-temporal validity), `provenance`,
  `embedding` (portable `{model, dims, source_text}`), and `summary`.

---

## GET `/{memory_id}/export`

Export a single memory. Owner-scoped (404 if not yours).

```bash
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.ainative.studio/api/v1/public/memory/v2/$MEMORY_ID/export?format=mif-json&level=3"
```

`format=mif-json` returns a MIF JSON-LD document; `mif-md` returns Markdown with
YAML frontmatter; `vault-ld` returns a Vault-LD note.

**Example (MIF JSON-LD, L3):**
```json
{
  "@context": "https://mif.ainative.studio/context/v1",
  "@type": "Memory",
  "@id": "urn:mif:memory:...",
  "mifVersion": "1.0",
  "level": 3,
  "content": "Alice is the CTO of AINative.",
  "conceptType": "semantic",
  "namespace": "project:acme",
  "tags": ["team"],
  "relationships": [{"type": "Supersedes", "target": "urn:mif:memory:..."}],
  "temporal": {"validFrom": "2026-01-01T00:00:00+00:00", "validUntil": null},
  "provenance": {"sourceType": "graph_edge", "trustLevel": 0.9},
  "embedding": {"model": "bge-m3", "dims": 1024, "source_text": "..."}
}
```

## GET /export — bulk export a namespace

Stream every memory in a namespace as **NDJSON** (one JSON line per memory).
Scoped by user **and** namespace — no cross-namespace leakage.

```bash
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.ainative.studio/api/v1/public/memory/v2/export?namespace=project:acme&format=mif-json&level=3"
```

Each line: `{"id": "...", "format": "mif-json", "document": { ... }}`.

## POST /import

Import one or many MIF / Vault-LD documents through the standard `remember()`
write path — so imported memories get embeddings, entity extraction, and the
security scan automatically. **`namespace` is required.**

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  "https://api.ainative.studio/api/v1/public/memory/v2/import" -d '{
    "format": "mif-json",
    "namespace": "project:acme",
    "documents": [ { "@context": "https://mif.ainative.studio/context/v1", "@type": "Memory", "@id": "urn:mif:memory:1", "content": "..." } ]
  }'
```

**Response:** `{"imported": N, "failed": M, "results": [{"ok": true, "memory_id": "...", "source_id": "..."}]}`

| Field | Type | Description |
|---|---|---|
| `format` | string | `mif-json` \| `mif-md` \| `vault-ld` |
| `namespace` | string | **required** — `global` \| `project:<id>` \| `session:<id>` |
| `documents` | array | one or more docs (JSON objects or strings) |

Malformed or injection-bearing documents are rejected/sanitized per-document.

---

## Migrating from Mem0 / Zep / Letta

The pattern is the same for every source: **map the provider's export to MIF
documents, then POST them to `/import`.**

```python
import requests
BASE = "https://api.ainative.studio/api/v1/public/memory/v2"

def mem0_to_mif(rec):  # Mem0: {id, memory, metadata, created_at}
    return {
        "@context": "https://mif.ainative.studio/context/v1",
        "@type": "Memory",
        "@id": f"urn:mif:memory:{rec['id']}",
        "content": rec["memory"],
        "conceptType": "semantic",
        "created": rec.get("created_at"),
        "properties": rec.get("metadata") or {},
    }

docs = [mem0_to_mif(r) for r in your_mem0_records]
requests.post(f"{BASE}/import",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={"format": "mif-json", "namespace": "project:acme", "documents": docs})
```

Full walkthroughs (Mem0, Zep, Letta) and the conformance reference:
- [Interchange developer guide](https://github.com/AINative-Studio/core/blob/main/docs/guides/MEMORY_INTERCHANGE_GUIDE.md)
- [Migration guide](https://github.com/AINative-Studio/core/blob/main/docs/guides/MEMORY_MIGRATION_GUIDE.md)

## Round-trip guarantee

Export → import is **lossless within a conformance level**. Export a memory as MIF,
re-import it into a new namespace, and it recalls identically — so you can trust
your memory is portable, not trapped.
