CORE GUIDE

PATTERNINTERMEDIATE6 min read

Memory expiry and invalidation

Durable memory should stop influencing decisions when its evidence becomes stale, its scope ends or stronger information supersedes it.

Mental model

Every memory has a validity condition. Expiry can be time-based, event-based or authority-based, and invalidation is as important as writing because stale memory can be more dangerous than no memory.

Why it matters

Persistent assistants can confidently reuse facts that were once correct: a project role changes, a policy expires, a customer preference is reversed or a workflow checkpoint is completed. Without expiry and supersession, old state remains semantically relevant enough to be retrieved and can silently contradict authoritative current data.

01

Attach validity and invalidation triggers to memory classes

For each durable memory type, define what ends its validity: a time horizon, a source update, completion of a workflow, explicit user change or stronger authoritative record. Store update time and provenance, mark superseded records so retrieval excludes them from current state, and periodically test whether high-impact memory classes still resolve to authoritative evidence.

02

Example: temporary project access remembered forever

An assistant stores that a contractor may access a private project during a six-week engagement. If that permission is remembered without expiry, later tasks may incorrectly expose project information. The durable record instead carries an engagement end condition and is invalidated automatically when the access system reports the contractor is no longer active.

Common failure modes

  • Giving all memories infinite lifetime because deletion feels risky.
  • Deleting historical records without separating audit history from effective current state.
  • Using only fixed time-to-live when a source update should invalidate memory immediately.

Engineering heuristics

  • Define expiry and supersession when defining each memory schema.
  • Retrieve only effective current memory while keeping audit history separate when needed.
  • Prefer authoritative event-driven invalidation for high-impact state.

Takeaways

  1. 01Memory needs an end-of-life policy.
  2. 02Stale remembered state can be more harmful than missing context.
  3. 03Expiry, supersession and audit retention are different responsibilities.

Used in

This Concept is reused across these canonical learning paths.

Related concepts from the Knowledge Graph

These relationships come from the canonical graph, not a separate Guide taxonomy.

Memory vs authoritative source-of-truth conflictRELATED