{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-resurrect-forgotten-memory-when-a-scoped-retention-write-races-a-ttl-expiry-sweep",
  "title": "Why does an instance resurrect forgotten memory when a scoped retention write races a TTL expiry sweep?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent runtime exposing `write`, `read`, and `forget` memory tools with per-record TTL and scoped retention (tenant/user scope), where a background expiry sweep and foreground agent writes share a mutable store. Does not apply to append-only immutable logs or stores where `forget` is a hard physical delete synchronous with the write path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-forgotten-memory-when-a-scoped-retention-write-races-a-ttl-expiry-sweep.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-forgotten-memory-when-a-scoped-retention-write-races-a-ttl-expiry-sweep.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-forgotten-memory-when-a-scoped-retention-write-races-a-ttl-expiry-sweep.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1714,
    "python_slice_tokens": 294,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is between **logical forgetment** (the record is marked as out of retention, invisible to reads) and **physical reclamation** (the bytes are gone and cannot re-enter the index). Most memory-tool APIs conflate these or defer reclamation, and the deferral window is where the failure lives. A `forget` call under right-to-be-for...",
    "what_was_observed": "A support-triage agent ran a routine episodic-to-semantic distillation at the end of each session: it read the last N episodic records for a user scope, summarized them, and wrote the summary back as a semantic memory with a 30-day TTL. Sequence observed in a replay of the trace: 1. `forget(scope=user:8841, record=ep_7731)` issued on an RTBF request. Store writes tombstone `{id: ep_7731, forgotten_at: T, scope: user:...",
    "condition_of_validity": "The resurrection is only possible when **all** of the following hold simultaneously; remove any one and the failure does not occur: - `forget` is tombstone-based with asynchronous physical reclamation, creating a nonzero window. - Reads filter tombstones by *record identity*, not by *provenance closure*. - Writes accept a `derived_from` (or equivalent) edge ...",
    "decision_boundary": "The architectural guardrail is a **provenance-closure check at write time**, not at read time. Checking at read time is too late: the derivative has already been persisted with a fresh clock, and a read-time filter cannot distinguish a legitimate summary of live records from a laundered one without walking the full provenance graph on every retrieval — which...",
    "operational_effect": "After enforcing closure-at-write, the observed trace fails fast at step 4: the distillation write raises `RetentionClosureViolation` because `sem_5502`'s ancestor `ep_7731` is tombstoned. The agent's session-end routine must handle this: the correct behavior is to re-distill from live episodic records only, excluding any summary whose provenance closure is d..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "a0b192b7d4bb30948071fee75f9196685fab8b249c1ef2596adf24570aab01f8",
    "verified_classes": [
      "RetentionClosureViolation",
      "MemoryRecord",
      "ScopedMemoryStore"
    ],
    "verified_functions": [
      "demo",
      "__init__",
      "put",
      "_closure",
      "write_derived"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "RetentionClosureViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
