{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-scoped-deletion-memory-tools-from-resurrecting-erased-state-via-distillation",
  "title": "Which invariants prevent scoped-deletion memory tools from resurrecting erased state via distillation",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents whose memory tool surface exposes separate `write`, `read`, and `forget`/`delete` operations with scoped retention (per-user, per-session, per-record TTL), where a background or in-loop distillation step compresses episodic records into semantic memory. Does not apply to append-only logs with no compaction, nor to single-record scratchpads that are never distilled.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-deletion-memory-tools-from-resurrecting-erased-state-via-distillation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-deletion-memory-tools-from-resurrecting-erased-state-via-distillation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-deletion-memory-tools-from-resurrecting-erased-state-via-distillation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1615,
    "python_slice_tokens": 315,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The dangerous distinction is not \"deleted vs. not deleted.\" It is **deleted-at-source vs. deleted-at-index**. A `forget(scope=...)` call that removes the source episodic record but leaves a derived semantic summary, embedding, or cluster centroid alive produces a state that is *readable but un-forgettable*: the content is gone from the record store, yet the ...",
    "what_was_observed": "An agent with a `memory` tool namespace (`write(scope, text)`, `read(scope, query)`, `forget(scope, record_id | predicate)`) ran a nightly consolidation job: it pulled the last 24h of episodic records in a session scope, asked the model to produce a 3-sentence \"durable facts\" summary, wrote that summary to the user scope, and marked the source episodics `forgotten` (soft delete, TTL 0). The user then issued a deletio...",
    "condition_of_validity": "The invariant that would have prevented this is a **provenance-closed deletion**: every derived record carries the set of source `record_id`s it was distilled from (a `derived_from` set), and `forget` computes the transitive closure of dependents before returning. The guardrail is only valid if three sub-conditions hold: - **Provenance is recorded at write t...",
    "decision_boundary": "The boundary is whether the memory API's `forget` contract is **row-scoped** or **provenance-scoped**. Choose row-scoped only when no distillation or summarization path exists between scopes, or when derived artifacts are stored in the same scope as their sources (so a single scope predicate catches them). Choose provenance-scoped — mandatory `derived_from`,...",
    "operational_effect": "Without provenance closure, every deletion is *advisory*: the agent reports success, the user believes the fact is gone, and the next consolidation cycle re-materializes it under a new identifier that no prior deletion predicate can match. This is worse than a plain retention bug because it defeats audit — the tombstone for `r` exists and is correct, so log ..."
  },
  "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": "1c641ee06f3d751089a34b918a88e58b1b172395bf9b430a6b6c52dac5450ce2",
    "verified_classes": [
      "ProvenanceClosureError",
      "Record",
      "MemoryStore"
    ],
    "verified_functions": [
      "__init__",
      "write",
      "_descendants",
      "forget",
      "consolidation_input"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ProvenanceClosureError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
