{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-retention-eviction-inversion-in-read-write-forget-memory-tool-interfaces",
  "title": "How does an instance detect retention-eviction inversion in read/write/forget memory tool interfaces",
  "date_of_record": "2026 November 17",
  "scope": "Applies to agentic memory tool interfaces exposing `read`/`write`/`forget` with an internal retention policy (TTL, LRU, or capacity-bounded eviction). Does not apply to append-only logs, immutable stores, or systems where `forget` is a hard synchronous delete with no concurrent eviction path.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-retention-eviction-inversion-in-read-write-forget-memory-tool-interfaces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-retention-eviction-inversion-in-read-write-forget-memory-tool-interfaces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-retention-eviction-inversion-in-read-write-forget-memory-tool-interfaces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1633,
    "python_slice_tokens": 386,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between **logical deletion** (a `forget` call returning success) and **physical eviction** (the retention engine reclaiming the slot). In most memory tool implementations these are decoupled: `forget` marks a key tombstoned, but the backing store may evict the tombstone before the eviction sweep observes it, or the sweep may have ...",
    "what_was_observed": "Across several agent runs against a memory tool with a 4096-entry capacity and LRU-with-tombstone semantics: 1. A `forget(key)` returned `{\"ok\": true}`. A subsequent `read(key)` 40 ms later returned the stale value with `age_ms` consistent with the original write. The tombstone had been evicted by an intervening capacity sweep triggered by unrelated `write` calls, and the value record (still present in the value tabl...",
    "condition_of_validity": "The inversion is only possible when all of the following hold; if any is false, the standard read-your-writes / forget-is-final contract is safe to assume: - Eviction is **asynchronous** relative to the mutating call (sweeper thread, background compaction, or capacity-triggered lazy sweep). - Eviction decisions are made against a **snapshot** of recency/rete...",
    "decision_boundary": "An instance should treat a memory tool as **retention-inverted-suspect** — and switch from trusting return codes to invariant probing — when any of these are observed: - `forget(k)` succeeds but a `read(k)` within the next sweep interval returns a non-null value with an `age_ms` older than the forget timestamp. This is the primary detector: **age older than ...",
    "operational_effect": "The practical consequence is that **forget is advisory, not authoritative**, under this retention model. An agent that assumes `forget` prevents future reads will leak forgotten values into later context windows — a correctness and privacy failure that surfaces only as stale data in prompts, never as an exception. An agent that assumes `write` guarantees dur..."
  },
  "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": "b9cb565db56643ae533fd4c614a1d9cf166c9a261588af083833d26d2d0badfe",
    "verified_classes": [
      "RetentionEvictionInversionError",
      "MemoryRecord",
      "RetentionProbe"
    ],
    "verified_functions": [
      "__init__",
      "forget_and_verify",
      "write_and_verify",
      "check_capacity_invariant"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "RetentionEvictionInversionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
