Context EngineeringPersistent state and memoryPrincipal
Why can an expired memory still affect an agent, and how should expiry propagate to summaries?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A temporary emergency-contact instruction expires after 24 hours. Its raw memory row is gone, but a weekly summary still says the customer prefers that number and a paused workflow calls it. Distinguish storage TTL from semantic validity, design derivative invalidation and use-time checks, and handle historical audit retention without reviving the instruction.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
It may have worked exactly as written for the raw row. The failure is that a derived summary copied the fact and lost its scope. A memory system can have raw events, extracted facts, vector chunks and periodic summaries. Expiring one tier does not automatically invalidate every descendant. Research on deployment-time agent memory measures residue after raw-only deletion and discusses derived copies. That study does not prescribe this hypothetical TTL policy, but it demonstrates why deletion fidelity needs to be checked across memory tiers.
I would trace the fact's origin, subject, creation time, expiry, source revision and every derived artifact that included it. Did the summary carry the phrase without “for this incident”? Was it embedded under a new ID? Did a cached prompt include it even after the storage rows were updated? The agent should not be asked to guess the original expiry from compressed prose. A durable memory item needs provenance and validity metadata, and summary generation should preserve a link to the facts it depends on. At read time, materialized summaries should be invalidated, recomputed or filtered if a contributing fact is no longer valid.
There are different expiry semantics. A short-lived operational instruction should stop governing future actions at a precise boundary. A past event may remain in an audit record but not be promoted into current preference. Legal deletion may require removing or redacting derived text as well. Decide which contract applies before choosing a physical purge, tombstone, version gate or lazy rebuild. Test retrieval through every path, including exact lookup, vector search, cached context and a weekly summary, after the TTL fires. A deletion test that only queries the primary table misses the product failure.
Time to live, or TTL, is the storage lifetime configured for a record. Semantic validity says whether the fact may still influence this action. They need compatible contracts even when physical deletion is asynchronous. A read-time expiry check can stop using an instruction immediately under the product’s time rule, while a background process removes its stored copies.
Suppose a summary combines a permanent preference with the temporary emergency number. Give the contributing claims separate IDs and validity metadata. The summary cannot inherit an unlimited lifetime merely because one input is permanent. Either regenerate it when the temporary input expires or represent the input references so the reader omits that claim. Rebuild cached context as well. Deleting a vector row does not edit bytes already copied into a prompt.
Test just before and after the expiry boundary with a controlled clock, then resume an older workflow and a delayed summary writer. Neither may restore the expired instruction as current memory. The audit may still explain why the number was used during the incident under its retention policy. That historical explanation is not permission to call it again.
What if recomputing every summary is expensive? Track dependencies and invalidate only affected artifacts, or keep source-linked fact IDs in a summary and verify them before use. Approximate cleanup may be acceptable for low-risk personalization, but not for an expired contact instruction. The user corrected the agent's memory. Why does the old fact return next week? concerns a corrected memory whose old fact returns. Here no correction was made. The original fact was intentionally temporary, and its derived copy escaped the time boundary.
Related questions
Keep practising context engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux