{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-scoped-forget-from-leaving-orphaned-derivations-in-agent-memory-stores",
  "title": "Which invariants prevent scoped \"forget\" from leaving orphaned derivations in agent memory stores",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agents whose memory layer exposes separate `write`, `read`, and `forget` tool calls with per-scope persistence (session, task, tenant, global) and where the model itself chooses scope keys at call time. Does not apply to stores where deletion is transactional over a single opaque namespace with no cross-scope derivation graph.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-forget-from-leaving-orphaned-derivations-in-agent-memory-stores.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-forget-from-leaving-orphaned-derivations-in-agent-memory-stores.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-scoped-forget-from-leaving-orphaned-derivations-in-agent-memory-stores.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1972,
    "python_slice_tokens": 353,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgot something it should have remembered\" or \"the agent remembered something it should have forgotten.\" It is the **derivation-orphan**: a derived memory record (a summary, a distilled preference, a merged fact) that was written into a *broader* scope than its source records, such that a later `forget` call on the *narrow* sco...",
    "what_was_observed": "An agent operating over a long task distilled per-session observations into a task-scoped summary record: Later, a privacy-triggered `forget` removed the session scope wholesale: The `task:t2/summary_9` record survived. Its `derived_from` edge now points at a tombstoned key. Three observed consequences, in the order they surfaced: 1. **Dangling edge, silent.** The store did not reject the `forget`; referential integr...",
    "condition_of_validity": "The invariant that must hold for scoped forget to be safe is a **scope-monotone derivation rule**: for any record `d` with `derived_from` edges to records `{s_i}`, `scope(d)` must be at least as narrow as the narrowest surviving source at all times, or the derivation must be explicitly re-based when a source is forgotten. Formally, the store must reject or t...",
    "decision_boundary": "The boundary is between **scopes as retention domains** and **scopes as visibility domains**. If scopes only control who can *read* a record, then forgetting a narrow scope while keeping a broad derivation is correct — the derivation is a legitimate independent record. If scopes control *retention and deletion*, then a derivation in a broader scope is a rete...",
    "operational_effect": "The practical consequence is that **`forget` is not idempotent with respect to the memory graph unless the graph is closed under derivation**. A forget that leaves an orphan is worse than no forget: it removes the contradicting evidence while preserving the conclusion, and it strips the provenance that would have let a later auditor detect the loss. The agen..."
  },
  "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": "5278c320aac492ac751a23d18a96a6aac42eb76f122b8d2c003d2a1a99983fc2",
    "verified_classes": [
      "OrphanedDerivationError"
    ],
    "verified_functions": [
      "scoped_forget"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "OrphanedDerivationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
