Lineage
Follow an item to everything it became - passages, facts, assertions, lines of what is known - or a fact back to the words it was read from.
POST /v1/memory/lineageLineage answers both ways. Give it an item id or an event id, and it returns what rests on that item. Give it a fact id from search, and it returns the events and passages the fact was read from. It walks the same edges forget deletes along, so what lineage says an item became is what forgetting it would remove. Makes no model call. See Lineage.
Headers
AuthorizationstringBearer tm_…. A read key is enough.
X-Twin-AccountstringThe end user whose memory to read. See End users.
X-Request-IdstringYour id for this request, echoed on the response.
Body
idstringAn item id as you gave it to add, an event id (ev_…), or a fact id as search returns it (th_…#r…). 1
to 512 characters.
Response: of an item or event
ofstringThe id as sent.
eventsstring[]The event ids it names.
passagesobject[]The passages quoting it, each with id and path.
recordsobject[]The facts resting on it, each with id, kind and text.
assertionsobject[]The assertion lines resting on it, each with its path and the assertion's fields.
corestring[]The lines of what is known that were made from those facts.
Response: of a fact
ofstringThe id as sent.
recordobjectThe fact's kind and text.
eventsobject[]The events it was read from, each with id and ledger path.
passagesobject[]The passages holding those events, each with id and path.
Response: unknown id
ofstringThe id as sent.
errorstringno event, item or record by this id in this account.
Errors
400bad requestX-Twin-Account is missing or not a usable id.
401unauthorizedThe bearer is not a key this service issued.
404not foundno memory for end user 'user_42' yet.
422invalidAn empty id.
503unavailableAt capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
curl https://api.twinmemory.dev/v1/memory/lineage \
-H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
-H "X-Twin-Account: user_42" \
-H "Content-Type: application/json" \
-d '{ "id": "msg-001" }'{
"of": "msg-001",
"events": ["ev_620270db0bff9328"],
"passages": [
{
"id": "th_8b5e5d4c8946d815/p_0001",
"path": "passages/memory/messages/th_8b5e5d4c8946d815/p_0001.md"
}
],
"records": [
{ "id": "th_8b5e5d4c8946d815#r028d461216652fe5", "kind": "state", "text": "Alice lives in Lisbon" },
{ "id": "th_8b5e5d4c8946d815#rc052ae969cbe2551", "kind": "state", "text": "Alice works at Acme" }
],
"assertions": [
{
"path": "assertions/alice-chen.jsonl",
"subject": "alice chen",
"attribute": "home_city",
"value": "Lisbon",
"valid_from": "2026-10-01",
"polarity": 1,
"source_turn_ids": ["ev_620270db0bff9328"]
}
],
"core": ["- Alice Chen · home_city: Lisbon [said 2026-10-01]; Berlin [said 2024-06-01]"]
}{
"of": "th_8b5e5d4c8946d815#r028d461216652fe5",
"record": { "kind": "state", "text": "Alice lives in Lisbon" },
"events": [
{
"id": "ev_620270db0bff9328",
"path": "raw/memory/messages/2026-10-01/ev_620270db0bff9328.json"
}
],
"passages": [
{
"id": "th_8b5e5d4c8946d815/p_0001",
"path": "passages/memory/messages/th_8b5e5d4c8946d815/p_0001.md"
}
]
}