{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-ttl-expiry-from-being-treated-as-deletion-in-scoped-memory-apis",
  "title": "Which invariants prevent TTL expiry from being treated as deletion in scoped memory APIs",
  "date_of_record": "2026 November 17",
  "scope": "Applies to memory tool APIs that expose `read`, `write`, and `forget` operations over scoped namespaces with per-entry TTL and an auditable deletion ledger. Does not apply to APIs where expiry and deletion share a single tombstone record by design, nor to unscoped key-value stores with no audit contract.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-ttl-expiry-from-being-treated-as-deletion-in-scoped-memory-apis.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-ttl-expiry-from-being-treated-as-deletion-in-scoped-memory-apis.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-ttl-expiry-from-being-treated-as-deletion-in-scoped-memory-apis.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1456,
    "python_slice_tokens": 405,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is conflating two lifecycle events that look identical to a reader but are semantically disjoint to an auditor: - **Expiry**: a TTL clock crossed a threshold. The entry becomes invisible to `read`. No actor requested removal. - **Deletion**: a caller invoked `forget` (or an authorized retention policy did so on its behalf). A principal is ac...",
    "what_was_observed": "A scoped memory service used a single `tombstone(namespace, key, ts)` record for both paths. A `read` on an expired key triggered lazy reaping, which wrote a tombstone. A subsequent `forget` on the same key found the tombstone present, short-circuited as idempotent, and wrote nothing. The audit log therefore contained a tombstone with no principal for a key that a human operator had explicitly requested be forgotten....",
    "condition_of_validity": "The invariant holds only under these conditions, and each is independently checkable: 1. **Causal separation at write time.** Expiry and forget must produce distinguishable ledger records. A `cause` enum (`ttl_expiry`, `explicit_forget`, `policy_retention`) is the minimum. A nullable `principal` is acceptable only if the schema enforces `principal IS NULL` i...",
    "decision_boundary": "Choose the split-ledger design when: the API carries a compliance or data-subject-deletion obligation, `forget` is callable by more than one principal, or TTLs are short enough that expiry and forget routinely race. Choose the unified tombstone only when the audit contract is explicitly \"absence is sufficient\" and no principal attribution is promised—and the...",
    "operational_effect": "Implementing the split ledger changes `forget` from a conditional delete into an unconditional attestation write followed by a best-effort physical removal. Cost: one extra ledger row per forget even when the key is already gone. Benefit: the ledger answers attribution questions under every interleaving, and retention sweeps become separable from operator ac..."
  },
  "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": "50ae118d4a5cfa9d6c6ff09a3cb5ab996bf97ea7e236e5e53385cbe2439101f5",
    "verified_classes": [
      "Cause",
      "LedgerIntegrityError",
      "LedgerRecord"
    ],
    "verified_functions": [
      "_validate",
      "forget",
      "reap_expired",
      "assert_attributed"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "LedgerIntegrityError"
    ],
    "sample_fail_closed_invariants": [
      "forget requires a non-empty principal"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
