Overview

The /api/memory surface gives agents durable memory primitives: documents, events, entities, edges, semantic query, and session-scoped key/value storage. It proxies to the memory service when available and falls back to local SQLite-backed storage when it is not. Session memory powers the model-facing memory tool, letting an agent read and write values keyed by session.
Long-term agent memory (the facts your agents recall across sessions) is stored in each user’s Memory Drive, a private git repo. /memory/v2/retain, /memory/v2/recall and /memory/v2/facts keep their shapes; writes now commit to the drive and the facts are an index rebuilt from it. See Memory Drive internals.

Base URL

Authentication

All endpoints require a valid bearer token in the Authorization header. See Authentication for details.

Endpoints

Every turn you and your agents have is stored (see Memory Drive internals). Raw search finds them by words and meaning. These routes are under /api/v1 and use the signed-in user; incognito sessions and forgotten sources never come back.

POST /api/v1/memory/v2/raw-search

The reranker is POST /v1/rerank on the local embed sidecar (BAAI/bge-reranker-v2-m3). It is off on machines with less than 8 GB of RAM (RERANK_DISABLE=1 also turns it off; RERANK_MODEL picks another model).

GET /api/v1/memory/v2/turns/:id/neighbors?before=2&after=2

Returns { "turns": [ ... ] } in the same shape, from the same session, in time order. before and after are capped at 20. Another person’s turn, or an incognito one, is 404.

Health

Example response

Documents

List documents

Example response

Create a document

Request body

Example request

Example response

Events

List events

Example response

Create an event

Request body

Query memory

Proxies the query to the memory agent when available; otherwise returns a keyword-search stub.

Request body

Example response

Edges

Example response

Entities

List entities

The response is {"entities": [...], "pages": [...]}. entities lists the stored entity rows (filtered by agentId, type and q); pages lists your entity pages that match q (all of them, most mentioned first, when q is absent): exact name or alias first, then a name or alias that contains q, then a page whose text does.

Get an entity page

Returns page (structured), text (the page as Markdown) and mentions (every fact, observation, document and note that mentions the entity, most mentions first). Another user’s page id returns 404.

Entity pages

Your memory keeps one page per recurring entity, so agents follow entities instead of searching again (the CorpusMap pattern). Pages are built from your facts, observations, documents (including passages written by memory adapters such as open-notebook) and notes, in the background, with no model calls:
  • Mentions are capitalized names (Dana Whitfield, Bank of America, ACME), emails, URLs, @handles, code identifiers (backticked, a::b, snake_case) and the names and aliases of your entities (properties.aliases), which match in any case.
  • Merging is exact and explicit: spellings that normalize to the same key (Acme Corp., ACME corp, Acme-Corp) are one entity, and so are names tied by alias evidence: Allternit Platform (AP) when the acronym is the initials, X aka Y, or an entity’s aliases. Names are never merged by similarity, and never across users.
  • A page exists for every entity you created and every name mentioned by at least two items. It holds the name, kind, aliases, the top facts and observations, the documents and notes that mention it (each with a one-line snippet) and related entities by co-mention.
  • Updates are incremental: only items whose text changed are read again, and only the pages whose mentions changed are rewritten. The same memory always gives the same pages.
When an Agency run’s goal names an entity, the run’s recalled memory starts with that entity’s page and the documents that mention it, ahead of the other hits.

Create an entity

Request body

Example response

Memory stats

Example response

Session memory

Session memory stores JSON values keyed by (user_id, session_id, key). It is the backing store for the agent memory tool.

Read a key

Example response

List keys

Write a key

Request body

Delete a key

Example response

Error codes