Representing time and identity in agent memory

← Back to Blog & Articles

An agent that cannot answer when a fact was true will eventually give an incorrect answer that sounds current.

Service ownership changes, credentials rotate, incidents open and close, and people use multiple names across systems. A memory system must represent the time a fact applies to the world separately from the time the system learned or recorded it.

The reference design uses bitemporal assertions. Valid time is the interval during which a claim is believed to apply. Recorded time is when the runtime accepted the claim. A later correction may say that a service changed owners last week; it receives a new recorded time but an earlier valid interval. This distinction supports both historical reconstruction and current decision making.

Intervals use timezone-aware UTC timestamps and a half-open convention: a fact is active at a moment t when start is less than or equal to t and t is less than end. The end may be open for a currently active fact. Half-open intervals let adjacent assignments meet without overlapping, preventing a handoff at exactly noon from producing two owners or no owner. Input validation rejects naive timestamps and inverted intervals.

Time is still messy. Source clocks can drift, observation time differs from event time, and a human statement may use an ambiguous local date. The system records claimed time, observed time, and source time zone when available. It does not invent precision: a statement that a rotation happened sometime today should be represented as a coarse interval or held for confirmation, not silently converted into a precise instant.

Temporal conflict resolution is policy, not an accidental sort order. When two active assertions disagree, the runtime considers scope, predicate, trust, source authority, review state, and recorded time. It may select a deterministic winner for a low-risk display, return all competing assertions for investigation, or block an action that requires certainty. Last-write-wins is rarely appropriate for operational facts because it makes a late untrusted claim appear authoritative.

Entity resolution maps references from different sources to a stable local entity identifier. It must be conservative. Exact identifiers from authoritative systems can be linked automatically. Name similarity, email local parts, labels, and embeddings are hints that may create a candidate relationship but should not merge identities without an explicit confidence threshold and, for risky domains, review. A false merge can expose data or route an effect to the wrong person or system.

The implementation represents an entity with aliases and an assertion with a subject, predicate, value, valid interval, recorded time, provenance, and trust. The repository resolves a fact only within the caller's scope and only at a specified as-of time. This forces callers to state whether they need current truth, historical truth, or the system's knowledge as it existed at a previous point.

Provenance is especially important for temporal corrections. A rewritten fact must point to the observation or authorized decision that caused the revision. The W3C PROV data model offers useful vocabulary for linking entities, activities, and agents; the reference implementation keeps a smaller domain model but preserves the same requirement that a result be traceable to its derivation.

Security controls apply to both time and identity. A user must not be able to backdate an untrusted record to evade a recent policy change. The runtime records its acceptance time independently of claimed valid time, applies a bounded backdating policy, and flags unusually old claims. Alias creation is scope-bound and audited. Retrieval never uses an alias from another tenant as a global join key.

Evaluation includes point-in-time correctness, conflict detection, false-merge rate, missed-merge rate, temporal coverage, and provenance completeness. Tests should include overlapping intervals, late corrections, open-ended intervals, timezone-aware inputs, and two entities with deliberately similar names. The expected behavior is often an explicit ambiguity rather than an automated merge.

The laboratory models a checkout-service ownership change and a late correction. Queries before and after the handoff return different valid owners, while a query as of the earlier recorded time returns the original system knowledge. A conflicting untrusted claim remains visible as evidence but does not silently replace the trusted assignment. This is the discipline needed for agents to reason about changing operational environments.

Continue with the book

Explore the full treatment, worked examples, and exercises in Building Production-Grade AI Agents.


Companion article for Building Production-Grade AI Agents, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top