ConceptsBitemporal model

Bitemporal model

A memory carries two time axes:

  • validFrom / validTo: valid time, the period in which the statement holds in the world.
  • createdAt / updatedAt: system time, when Mnemosyne learned it.

A row is current when validTo is null and historical when it has a validTo. Both stay in the database.

Nine of the ten kinds carry validFrom and validTo, and so do relations and hyperedges. Events are the exception: they are an append-only log and are never closed.

Why two axes

Larkspur Robotics ships firmware to its warehouse robots every two weeks. At 10:00 the agent stores that line 3 runs firmware 4.1. At 14:00 it learns that line 3 was upgraded to 4.2 at 11:00. With a single time axis you have to pick:

  • Delete the 4.1 row, and lose history.
  • Overwrite the row with 4.2, and no longer know what was believed at 12:00.

With two axes the agent writes the new fact with validFrom set to 11:00 and closes the old one:

fact_a: { statement: "Line 3 runs firmware 4.1",
          validFrom: 10:00, validTo: 14:00, createdAt: 10:00 }
fact_b: { statement: "Line 3 runs firmware 4.2",
          validFrom: 11:00, validTo: null,  createdAt: 14:00 }

Closing a fact sets validTo to the moment it is closed. On POST /remember, validFrom applies to facts and cannot be in the future. validUntil is accepted and ignored: a fact stays valid until it is forgotten or superseded.

Because a close uses the moment of the close, the two intervals overlap from 11:00 to 14:00, and GET /facts?asOf= for 12:00 returns both rows. createdAt tells them apart: at 12:00 the system had learned only the 4.1 row.

Writing and closing

# Write a fact that became true earlier today
curl -X POST http://localhost:3939/remember \
  -H "Authorization: Bearer mns_live_..." \
  -H "Content-Type: application/json" \
  -d '{"statement": "Line 3 runs firmware 4.2", "validFrom": "2026-11-18T11:00:00Z"}'
 
# Close a fact: sets valid_to = now and keeps the row
curl -X DELETE "http://localhost:3939/facts/FACT_ID?reason=superseded" \
  -H "Authorization: Bearer mns_live_..."
 
# Bring a closed fact back into recall
curl -X POST http://localhost:3939/facts/FACT_ID/restore \
  -H "Authorization: Bearer mns_live_..."
  • DELETE /facts/{id} answers 204. A second delete of the same fact answers 404.
  • DELETE /forget/{kind}/{id} closes a memory of any kind.
  • DELETE /facts/{id}/hard removes the row for good and needs the memory:hard_delete scope.
  • Editing a fact with PATCH /facts/{id} keeps the id and bumps its revision. The previous revision is copied to mnemo_fact_revision in the same transaction.
  • The MCP tool memory_update corrects a fact by closing the current row and creating a new one with the corrected statement.

Reading the past

List endpoints return open rows by default. To read a past state, pass a timestamp:

curl "http://localhost:3939/facts?asOf=2026-11-18T12:00:00Z" \
  -H "Authorization: Bearer mns_live_..."

This returns the facts whose [validFrom, validTo) interval contained that instant, whatever their status is today: a fact closed since comes back too. A timestamp in the future answers 400.

QuestionHow to ask
What holds now?GET /facts
What held at instant T?GET /facts?asOf=T
What would recall have found at T?POST /recall with "asOf": "T"
What did the graph look like at T?GET /graph?asOf=T, GET /graph/traverse?asOf=T
Which strategies applied at T?GET /strategies?validAt=T
When did the system learn something?createdAt on each row, or GET /timeline

Recall at a past instant

asOf on POST /recall, and on the memory_recall tool, ranks what memory held at that instant instead of what it holds now. A row counts when validFrom <= asOf < validTo, whatever happened to it since, so a fact that was superseded later comes back with status: "superseded".

curl -X POST http://localhost:3939/recall \
  -H "Authorization: Bearer mns_live_..." \
  -H "Content-Type: application/json" \
  -d '{"query": "Which firmware does line 3 run?", "asOf": "2026-11-18T12:00:00Z"}'
  • Only the cold tier answers. The hot tier, the pointer tier and the cache know only the present.
  • Reading the past is not use: it writes no recall log and changes no worth, activation, hot tier or co-activation.
  • An instant in the future answers 400 asof_in_future.
  • With includeGraph: true, the relations on each hit are the ones valid at that instant.

Implementation notes

  • Validity is indexed with a GiST index over tstzrange(valid_from, valid_to) on facts, decisions and relations.
  • A partial unique index allows one active fact per (workspace_id, topic_key). A second write with the same topicKey updates that fact in place.
  • “Current” means an open interval as well as an active status: a row whose validity has ended is history even if its status still says active.

Stable in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API can still change within 3.x.