
What is agent memory? A production architecture for context, memory, and sources
August 24, 2026Engineering

Why agent memory needs event time, validity intervals, and explicit supersession instead of last-write-wins profile fields.
A user says, “I moved to Berlin last month.” One clock says when the move happened. Another says when the system learned about it. If the record keeps only the insertion timestamp, historical questions and current-state retrieval will eventually disagree.
Time-aware memory does not require predicting every date. It requires representing the dates the evidence actually supports and keeping changes visible instead of overwriting them.
valid_from and valid_to.| Field | Question it answers | Example |
|---|---|---|
| Event date | When did the described event happen? | The move happened on July 3 |
| Valid from | When did this fact start being true? | Berlin became the current city on July 3 |
| Valid to | When did this fact stop being true? | Lisbon stopped being current on July 3 |
| Created at | When did the system first store this record? | The user mentioned the move on August 12 |
| History event | When did the system update its understanding? | An operator corrected the date on August 13 |
“Where does the user live?” asks for a fact whose validity interval includes now. “Where did the user live in June?” asks for the interval containing a past date. Both queries may reference the same relationship over different periods.
Current retrieval should normally exclude invalidated records unless the query requests history. Historical retrieval should include the old record, its validity range, and the source or superseding record that changed it.
When Berlin replaces Lisbon, updating one profile field produces the right current value but destroys the reason an earlier answer mentioned Lisbon. A supersession link closes the old interval and points to the new record while leaving both in history.
This supports:
Suppose the user says in August that the move happened in July, then clarifies in September that the lease began in June while the physical move happened in July. The application's domain model must decide which event the memory represents. Updating valid_from may change the world-time interpretation, while immutable system history still records that the correction arrived in September.
This is the core of bi-temporal reasoning: what the system currently believes about the world's timeline and how that belief changed over the system's own timeline.
“I prefer dark mode” and “Use light mode for presentations” may both be valid under different metadata or task scopes. Before superseding, compare subject, predicate, object, scope, conditions, and time. A global overwrite can turn a contextual exception into a false contradiction.
Use deterministic rules for well-typed product state where possible. Model inference may propose a relationship, but the persistence layer should enforce interval and ownership invariants.
Relative phrases require a trustworthy reference time. “Last year” can be normalized only if the source event has a known date and timezone assumptions are controlled. “I used to live in Lisbon” supports a past relationship but may not support exact boundaries.
Safe choices include:
A similarity score cannot decide whether a query asks for now, a past state, or the history of a change. Route temporal intent explicitly:
| Case | Expected behavior |
|---|---|
| Current fact replaces an old fact | Current query returns new; as-of query returns old |
| Correction arrives late | World-time changes; system history remains intact |
| Two facts apply under different conditions | Both remain valid with explicit scope or metadata |
| Source has no reliable date | No invented precision |
| Old fact ranks higher semantically | Validity filtering prevents stale current recall |
| Superseding record is deleted | History and current-state policy remain explicit |
Canonical records expose event_date, valid_from, valid_to, and superseded_by alongside creation time and immutable history. Search supports event-date filters, while state views can project current, as-of, and history answers back to canonical source IDs.
These fields make temporal behavior possible; they do not guarantee that an inference model extracted the right date. Evaluation must inspect the stored record, the retrieved rendering, and the final answer separately.