twin memory

Correct

Retract one fact that was read wrong, for good, and optionally say what is true instead.

POST /v1/memory/correctAuth: write key

Facts are read from conversations by a model, and a model can read one wrong. Correct takes one fact back by the id search gave it. Search, the known lines, and history stop showing it at once, and it stays retracted when the conversation is read again. The words it was read from are not touched. Makes no model call. See Corrections.

With a replacement, what is true instead is added as a note with the id correction-<digest>. The note is searchable at once and is read into facts like any other item. Correcting the same fact twice writes one note.

Headers

Authorizationstringrequired

Bearer tm_…. The key must read and write.

X-Twin-Accountstringrequired

The end user the fact belongs to. See End users.

X-Request-Idstring

Your id for this request, echoed on the response.

Body

record_idstringrequired

The fact's id as search returns it (th_…#r…), or its path (records/th_….json#3). 1 to 512 characters. An address is a position: the facts after a retracted one move down by one. An id does not move.

replacementstring

What is true instead, up to 4,000 characters. Empty or absent adds no note.

Response

retractedstring

The id as sent.

textstring

The text of the fact that was retracted.

replacementstring | null

The id of the note added, or null.

Errors

400bad request
X-Twin-Account is missing or not a usable id.
401unauthorized
The bearer is not a key this service issued.
403forbidden
this key reads; writing takes a key that writes.
404not found
no record '<record_id>' in this account.
422invalid
An empty record_id, or a replacement over 4,000 characters.
503unavailable
At capacity, or this end user is being rebuilt. Retry after Retry-After seconds.
Request
curl https://api.twinmemory.dev/v1/memory/correct \
  -H "Authorization: Bearer $TWIN_MEMORY_API_KEY" \
  -H "X-Twin-Account: user_42" \
  -H "Content-Type: application/json" \
  -d '{
    "record_id": "th_8b5e5d4c8946d815#r028d461216652fe5",
    "replacement": "Alice lives in Porto since 2026-10-15."
  }'
200 OK
{
  "retracted": "th_8b5e5d4c8946d815#r028d461216652fe5",
  "text": "Alice lives in Lisbon",
  "replacement": "correction-334be8de711f8fde"
}
404 Not Found
{ "detail": "no record 'th_x#rdeadbeef' in this account" }