Skip to content

Memories

Ingest content into the knowledge graph.

Terminal window
curl -X POST http://localhost:8080/api/v1/retain \
-H "Content-Type: application/json" \
-d '{"content": "User prefers Neovim as their primary editor", "source": "conversation"}'

Request:

FieldTypeRequiredDescription
contentstringYesContent to process and extract memories from
sourcestringYesOrigin identifier
namespacestringNoNamespace to store in (default: "default")

Response:

{
"operations": [
{
"type": "create",
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"content": "User prefers Neovim as their primary editor",
"reason": "New fact about editor preference"
}
],
"summary_triggered": false,
"usage": {
"extraction": {"prompt_tokens": 150, "completion_tokens": 50, "total_tokens": 200},
"decision": {"prompt_tokens": 200, "completion_tokens": 30, "total_tokens": 230},
"total_tokens": 430
}
}

Batch retain multiple items in a single call. Triggers auto-reflect after processing.

Terminal window
curl -X POST http://localhost:8080/api/v1/retain/batch \
-H "Content-Type: application/json" \
-d '{
"namespace": "default",
"items": [
{"content": "User prefers Neovim as their primary editor", "source": "conversation"},
{"content": "User works at Acme Corp", "source": "conversation"}
]
}'

Request:

FieldTypeRequiredDescription
namespacestringYesNamespace to store in
itemsarrayYesArray of {content, source} objects

Semantic search for memories.

Terminal window
curl -X POST http://localhost:8080/api/v1/recall \
-H "Content-Type: application/json" \
-d '{"query": "editor preference", "limit": 5, "expand-graph": true}'

Request:

FieldTypeRequiredDescription
querystringYesNatural language search
namespacestringNoFilter by namespace
limitintNoMax results (default: 10)
layerstringNoFilter by semantic layer (e.g., "fact", "concept")
as-ofISO 8601NoQuery the database at a point in time
expand-graphboolNoInclude ancestors, summaries, siblings, and relationships

Response:

{
"query": "editor preference",
"answer": "Based on stored memories, the user prefers Neovim as their primary editor.",
"memories": [
{
"memory-id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"content": "User prefers Neovim as their primary editor",
"layer": "fact",
"importance": 0.75,
"source": "conversation",
"namespace": "default",
"parent-id": null,
"distance": 0.42,
"ancestors": [],
"summaries": [],
"siblings": [],
"related": []
}
],
"count": 1,
"usage": {"prompt_tokens": 50, "completion_tokens": 0, "total_tokens": 50}
}

The distance field indicates semantic distance (lower = more similar). The answer field contains an LLM-generated answer synthesized from the matched memories. When expand-graph is true, each memory includes its graph context.


Consolidate and organize memories.

Terminal window
curl -X POST http://localhost:8080/api/v1/reflect \
-H "Content-Type: application/json" \
-d '{"namespace": "default"}'

Request:

FieldTypeRequiredDescription
namespacestringNoScope to a namespace
dry-runboolNoPreview without applying (default: false)
phasesstring[]NoWhich phases to run: "organize", "summarize", "connect", "curate" (default: all)
sinceISO 8601 or intNoOnly process memories created after this point

Remove a memory from active queries. The memory is preserved in Datahike history for audit purposes.

Terminal window
curl -X POST http://localhost:8080/api/v1/forget \
-H "Content-Type: application/json" \
-d '{"memory-id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"}'

Response:

{
"memories-removed": 1,
"relationships-removed": 2
}

Permanently delete a memory. Unlike forget, evict removes the memory from Datahike history as well — data cannot be recovered. Use for GDPR compliance.

Terminal window
curl -X POST http://localhost:8080/api/v1/evict \
-H "Content-Type: application/json" \
-d '{"memory-id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"}'

Response:

{
"memories-evicted": 1,
"relationships-removed": 2
}

Bulk memory ingestion.

Terminal window
curl -X POST http://localhost:8080/api/v1/ingest \
-H "Content-Type: application/json" \
-d '{
"items": [
{"content": "Alice is a software engineer", "source": "import"},
{"content": "Alice lives in Berlin", "source": "import", "namespace": "profiles"}
]
}'

Request:

FieldTypeRequiredDescription
itemsarrayYesArray of objects with content (required), source (required), and optional namespace

List memories with optional filters.

Terminal window
curl "http://localhost:8080/api/v1/memories?namespace=default&layer=fact&limit=20"
ParameterTypeDescription
namespacestringFilter by namespace
layerstringFilter by layer (e.g., "fact", "concept")
limitintMax results (default: 50)
offsetintPagination offset (default: 0)

Response:

{
"memories": [...],
"total": 142,
"limit": 50,
"offset": 0
}

Get a single memory by UUID. Returns 404 if not found.

Terminal window
curl http://localhost:8080/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890

Delete a single memory. Returns 204 No Content.

Terminal window
curl -X DELETE http://localhost:8080/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890

Get child memories in the layer hierarchy.

Terminal window
curl http://localhost:8080/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890/children

Get the change history for a memory (Datahike transaction history).

Terminal window
curl http://localhost:8080/api/v1/memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890/history