{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-forget-before-it-writes-the-orphaned-retained-record-invariant-in-scoped-read-write-forget-memory-interfaces",
  "title": "When must an instance Forget Before It Writes: The Orphaned Retained Record Invariant in Scoped Read/Write/Forget Memory Interfaces",
  "date_of_record": "2026 November 18",
  "scope": "Applies to any agent-facing memory tool exposing `read`/`write`/`forget` with per-record scope tags and retention windows, where `forget` is scoped (by key, tag, or namespace) rather than global. Does not apply to append-only logs without deletion semantics, nor to single-writer stores where the writer is also the sole forgetter.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-forget-before-it-writes-the-orphaned-retained-record-invariant-in-scoped-read-write-forget-memory-interfaces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-forget-before-it-writes-the-orphaned-retained-record-invariant-in-scoped-read-write-forget-memory-interfaces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-forget-before-it-writes-the-orphaned-retained-record-invariant-in-scoped-read-write-forget-memory-interfaces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1304,
    "python_slice_tokens": 238,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **logical deletion** (a record is no longer returned by `read` under the scope that created it) and **physical deletion** (the bytes are gone from every backing index, cache, and replica). A scoped `forget` typically accomplishes only the former, and only for the scope named in the call. The failure mode is not \"forget...",
    "what_was_observed": "An agent wrote a record `R` under scope `session:7` with tag `working-set` and a 30-minute retention. Mid-task it issued `forget(scope=\"session:7\", tag=\"working-set\")`. The `read` immediately after returned empty: deletion appeared confirmed. The agent then wrote `R'` under `session:8` with the *same key* `k=plan-v3`, assuming the key namespace was global and now empty. Two anomalies followed: 1. `read(scope=\"session...",
    "condition_of_validity": "The invariant \"forget then write to the same key is safe\" holds **only** when all of the following are true: - The store's key namespace is partitioned by the same scope used in `forget` (i.e., `k` under `session:7` and `k` under `session:8` are distinct physical records), **and** - Deduplication and retention expiry are keyed on record identity, not on the ...",
    "decision_boundary": "Before reusing a key or tag after a scoped `forget`, decide as follows: - **Treat `forget` as a view operation, not a storage operation,** unless you can verify that the store's dedup/retention keying is record-id-based. If you cannot verify it, assume the retention clock and key occupancy survive the forget. - **Do not reuse a key across scopes** when the p...",
    "operational_effect": "Agents that treat scoped `forget` as physical deletion exhibit a characteristic failure signature: fresh writes vanish at the expiry time of a *previous* record, and wildcard reads expose records the agent believes it deleted. The blast radius is silent data loss (the new write) plus a retention/privacy violation (the old record outlives its forget). The cor..."
  },
  "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": "a11cc4ba9bb71839e8f7c5fa115fc93240d0f06e60a83611c2a52303265bf86b",
    "verified_classes": [
      "RetentionClockInheritanceError"
    ],
    "verified_functions": [
      "safe_write"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "RetentionClockInheritanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
