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

> ## Agent Instructions
> Maximem Synap is a managed memory layer for AI agents: it ingests conversations and documents, extracts structured memory, and returns scoped context to the agent at retrieval time.
> The Python and JavaScript/TypeScript SDKs are the supported way to use Synap. Write integration code with SDK calls, not raw HTTP requests.
> Start with the Quickstart: https://docs.maximem.ai/getting-started/quickstart.md. Every SDK method is documented in the SDK reference: https://docs.maximem.ai/sdk-reference/overview.md.
> For requests about adding Vity memory to OpenClaw, Hermes, an MCP client, or a browser, start with the Vity Quickstart: https://docs.maximem.ai/vity/quickstart.md.

# Import pre-qualified memories

> Store memories you have already qualified, from another memory system, a CRM or your own pipeline, as they are: the memory-record type, its schema, conflicts, limits and errors, and the consolidation run Synap starts after a load.

Sometimes you already hold finished memories: exported from another memory system, written by a CRM, or produced by your own qualification step. You don't want Synap to extract them again. Send them with `document_type="memory-record"` and Synap stores each record as one memory.

Extraction is skipped. Synap only changes what it needs to so the record fits its shape. Once a load is in, Synap consolidates that scope by itself, so the imported memories are linked to what you already have.

> [!NOTE]
>
> Memory records are enabled per Instance. On an Instance where they are not enabled, `memory-record` is refused with `422 unknown_document_type`, and the call is never treated as a document to extract.

## Send records

```python Python theme={null}
result = await sdk.memories.create(
    document=[
        {"id": "crm-8812", "content": "Prefers invoices in EUR",
         "memory_type": "preferences", "category": "billing",
         "confidence": 0.9, "valid_from": "2026-03-01"},
        {"id": "crm-8813", "content": "Contract renewal due on 30 Nov 2026",
         "memory_type": "temporal_events", "event_start": "2026-11-30"},
    ],
    document_type="memory-record",
    user_id="dana",
    customer_id="acme",
    source={"system": "hubspot"},
    on_conflict="supersede",          # supersede | keep_both | reject
)

status = await sdk.memories.wait_for_completion(result.ingestion_id)
for record in status.records or []:
    print(record["id"], record["outcome"])
```

```typescript TypeScript theme={null}
const result = await sdk.memories.create({
  document: [
    { id: 'crm-8812', content: 'Prefers invoices in EUR',
      memory_type: 'preferences', category: 'billing',
      confidence: 0.9, valid_from: '2026-03-01' },
    { id: 'crm-8813', content: 'Contract renewal due on 30 Nov 2026',
      memory_type: 'temporal_events', event_start: '2026-11-30' },
  ],
  document_type: 'memory-record',
  user_id: 'dana',
  customer_id: 'acme',
  source: { system: 'hubspot' },
  on_conflict: 'supersede',          // supersede | keep_both | reject
});

const status = await sdk.memories.wait_for_completion(result.ingestion_id);
for (const record of (status['records'] as Array<Record<string, unknown>> | undefined) ?? []) {
  console.log(record['id'], record['outcome']);
}
```

Memory records are in Python 0.9.0 and later and JavaScript 0.9.0 and later. Earlier JavaScript versions do not send them.

`document` is one record object or a list of up to 100. Use `batch_create` for larger loads: each item can be a `memory-record` call, and a batch takes up to 100 items. Scope comes from the call (`user_id`, `customer_id`, `scope`), as for any create.

The call returns the usual create response. Each record's outcome is on the status route.

## The record

| Field | Required | Meaning |
| - | - | - |
| `content` | Yes | The memory, stored word for word. If your PII protection rewrites sensitive values, it applies to the record as it does to any other write |
| `memory_type` | Yes | `facts`, `preferences`, `episodes`, `emotions` or `temporal_events`. Singular forms (`fact`, `preference`, `temporal_event`) are mapped |
| `id` | No, recommended | The record's identity, up to 255 characters. Re-sending the same `id` in the same scope and with the same `source.system` is a no-op, reported as `duplicate` |
| `category` | No | Up to 100 characters. Matched to your Instance's categories; an unknown one is kept as given and flagged |
| `confidence` | No | 0 to 1; values outside are clamped. Default 1.0 |
| `valid_from`, `valid_until`, `event_start` | No | When the memory is true or happened, as an ISO 8601 date or date-time. Read as UTC when no offset is given |
| `subject` | No | Up to 255 characters. Who or what the memory is about, when it isn't the scope's user. It is used to link the memory to that entity |

Any other key is refused. Without an `id`, the record's content within its scope is its identity.

`source` takes the same object as any create. Set `source.system` to name where the records came from: it is kept with each memory and is part of a record's identity, so keep it the same when you re-send.

## What Synap does to a record

| Runs | Skipped |
| - | - |
| Scope, including nested scopes; your PII protection; the queue | Qualification |
| Shape mapping: type and date normalisation, the confidence clamp. Content is never split, merged or trimmed | Extraction and its model calls |
| Perspective: a record in the first or second person, or that names the user ("I prefer aisle seats", "You prefer aisle seats", "Dana prefers aisle seats" when Dana is the user), is reworded to "The user prefers aisle seats". Only the words for the person change. If anything else would change, the original is stored. The original text is kept with the memory for audit | Type detection |
| Dedupe on `id`, otherwise on content within the scope | |
| Embeddings and knowledge update, with `on_conflict` | |
| One light entity pass, so the memory joins the graph. The text is not changed | |
| The memory is marked as imported, with `source.system`, and written to the audit log | |

Records about someone else ("Dana's manager prefers window seats"), or already in the third person, are stored as sent.

## Conflicts

When a record contradicts a memory you already have, `on_conflict` decides:

| `on_conflict` | What happens | Outcome |
| - | - | - |
| `supersede` (default) | The record replaces the stored memory, as a new fact from a user would. A record that only restates a stored memory is dropped | `stored`, or `duplicate` with the existing memory's id |
| `keep_both` | Both are kept; nothing is superseded | `stored` |
| `reject` | The record is dropped and the stored memory stays | `rejected_conflict`, with `conflicting_memory_id` |

## Outcomes on the status route

`status()` lists one entry per record, in the order you sent them:

```json theme={null}
{
  "status": "completed",
  "records": [
    {"index": 0, "id": "crm-8812", "memory_id": "6c1…", "outcome": "stored",
     "perspective": "unchanged", "conflicting_memory_id": null,
     "category_flag": null, "subject": null,
     "consolidation": "pending", "consolidation_run_id": null},
    {"index": 1, "id": "crm-8813", "memory_id": "9f0…", "outcome": "duplicate",
     "perspective": null, "conflicting_memory_id": null,
     "category_flag": null, "subject": null,
     "consolidation": null, "consolidation_run_id": null}
  ]
}
```

* `outcome`: `stored`, `duplicate` or `rejected_conflict`.
* `perspective`: `rewritten`, `name_replaced`, `unchanged`, `kept_by_guard` (a rewrite would have changed more than the person, so the original was stored) or `not_checked` (the check was unavailable, so the record was stored as sent).
* `category_flag`: `unknown` when the category isn't one of your Instance's categories.
* `subject`: `linked` when the subject was linked to an entity, `unresolved` when it wasn't, or null when the record has none.
* `consolidation`: for user-scope records, `pending` until Synap's consolidation run for the scope commits, then `done` with its `consolidation_run_id`. Null for customer- and client-scope records, which the consolidation run does not cover.

Other ingestions have no `records` key.

If your PII protection refuses a record, the whole ingestion fails: `status` is `failed` and none of that call's records are stored. Check `status.status` before you read `records`.

## Consolidation runs by itself

Records arrive without the context extraction would add: which other memories they relate to, what they repeat or contradict, what deserves promotion. Synap adds that context with a consolidation cycle it starts itself. Once a scope has had no new records for a short while, Synap runs one consolidation cycle there. You don't trigger anything. A large load split over many calls starts one run, not many, and a scope that is busy with another run waits for it.

Consolidation applies to user-scope records. Records stored at customer or client scope are stored, searchable and linked to the graph, but no consolidation run starts for them.

## Limits and errors

| Status | Code | When |
| - | - | - |
| 422 | `unknown_document_type` | A near miss of the type, such as `memory-recod` or `memory`. The type is matched exactly and is never detected from content. Also returned when memory records are not enabled on the Instance |
| 422 | `invalid_memory_record` | A record doesn't match the schema, or the call has more than 100 records. The body names the `record_index` and the `field`. The whole call is refused and nothing is stored |
| 429 | | The usual rate limit for creates |

The SDKs raise both 422 errors as `InvalidInputError`, with the server's code on `code` (`serverCode` in TypeScript).

## Price

Each stored record is one memory-record write charge, with no extraction tokens. Duplicates and rejected records are not charged.

## Migrating from Mem0

The Mem0 importer writes memory records. See [Migrate from Mem0](https://docs.maximem.ai/migrations/from-mem0.md).


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