Question-led guide · how-to

How do I observe agent memory across sessions?

A memory-lineage schema for tracing proposals, admissions, versions, reads, promotion, expiry, conflict, deletion, and downstream effects.

Direct answer

Observe agent memory by tracing record identity and lifecycle events, not by logging recalled text. Record proposal, admission decision, source lineage, tenant and subject scope, version, valid time, promotion, retrieval query, selected record, context placement, use in a claim or action, conflict, expiry, correction, quarantine, and deletion propagation. Keep content capture optional and protected; stable IDs make cross-session influence reviewable without exposing every memory.

Scope

Use this schema for episodic, semantic, procedural, user-preference, or file-backed memory that survives one model call or session. It observes lifecycle and influence paths. The memory-lifecycle guide defines admission controls; the security guide focuses on poisoning.

Why it happens

Application traces often emit “memory search” and a duration. When a stale preference causes a bad action days later, operators cannot identify which record version was retrieved, how it entered the store, whether it had expired, or where else it propagated.

Logging the entire memory is a tempting fix. It creates a second sensitive database inside the observability backend and increases cardinality. The useful pivot is stable identity plus typed lifecycle events and protected links to source artifacts.

Diagnosis

Pick one record and perform two traversals. Forward: from proposal through admission, promotion, reads, contexts, outputs, effects, and derived memories. Backward: from one bad effect to the record versions and source events that could have influenced it.

Check for breaks when:

  • a summary creates a new record without derivation;
  • an embedding or index rebuild changes identity;
  • a record is copied across user or agent scope;
  • correction overwrites history;
  • deletion removes the primary row but leaves cache, vector, or summary copies;
  • retrieval runs omit rejected conflicts.

Solution

Assign immutable record IDs and append versions. Emit lifecycle events into a lineage store or trace-compatible event stream: proposed, admitted/denied, promoted, read candidate, selected, inserted into context, referenced by claim, used by action, expired, superseded, quarantined, and deleted.

Record source and policy decision IDs, scope, valid time, sensitivity, and content hash. A retrieval span keeps query identity, filters, index version, selected and conflicting record IDs, and context placement. A downstream effect references the claims and memory versions material to the decision where the application can establish that relationship.

Keep operational metrics low-cardinality: admission-denial rate, stale-selection rate, conflicts, deletion lag, and memory-linked failure rate by bounded class.

Artifact

Core memory-lineage entities and edges:

Entity/event Required identity and relations
Source event Actor, task, artifact, time, and trust class
Memory record/version Immutable ID, version, hash, scope, valid time, sensitivity
Admission decision Policy, reviewer, outcome, reason, and source link
Transformation Input versions, code/model, output version, and limitations
Retrieval run Query, filters, index, candidates, conflicts, and selected versions
Context placement Session, turn/step, position, and truncation/compaction status
Claim/action Referenced memory versions, decision record, and effect ID
Lifecycle change Promotion, expiry, supersession, quarantine, correction, deletion
Propagation proof Derived caches/indexes/artifacts invalidated and verification time

Common mistakes

  • Logging only query latency and top-k count.
  • Using mutable human-readable labels as record identity.
  • Recording selected memories without policy filters or conflicting candidates.
  • Copying full content into a broad observability backend.
  • Declaring deletion complete before derived stores and caches are verified.

Evidence

  1. Memory-system failures can be traced through memory operations and attributed to records and stages rather than only to final output.

    MemTrace proposes tracing and attribution for errors in LLM memory systems across its studied tasks and memory operations.

    Primary source · paper · checked Aug 26, 2026

    Limit: It is a recent preprint; its taxonomy, systems, and experimental results do not cover every production memory architecture.

  2. W3C PROV-O can represent entities, activities, agents, derivations, generations, and invalidations across a lineage graph.

    The W3C Recommendation defines interoperable provenance concepts suitable for modeling memory records and transformations.

    Primary source · standard · checked Aug 26, 2026

    Limit: PROV-O does not prescribe telemetry sampling, privacy, memory policy, or an error-attribution algorithm.

  3. Memory observability should connect record versions to the sessions, decisions, and effects they influenced.

    The lineage schema below creates a bounded audit path without requiring full content in normal telemetry.

    Signal Studio author framework · reviewed Aug 26, 2026

    Limit: Influence can be indirect and model reasoning is not fully observable, so lineage establishes availability and use signals rather than causality.

Limitations

Telemetry can miss reads, transformations, or cached copies; content hashes can reveal equality patterns; and deletion may not reach every derived artifact. Cross-session lineage must respect privacy, user rights, tenant isolation, and retention requirements.

FAQ

Do I need to store memory text in every span?
No. Prefer record ID, version, content hash, classification, scope, and protected artifact references. Capture content only under a justified sampling, access, and retention policy.
Does a retrieved record prove it changed the agent's answer?
No. It proves the record was selected and available in the context. Claim/effect references and controlled tests can strengthen attribution, but internal influence remains partly unobservable.

Continue within AI agent observability, or use one of these adjacent diagnostics:

Editorial QA: automated native-English, structure, source-presence, and link checks completed . This record is not an independent expert endorsement. Review boundary.