{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-self-referential-eviction-collapse-when-a-model-driven-context-policy-rewrites-the-memory-it-is-reasoning-over",
  "title": "How does an instance detect self-referential eviction collapse when a model-driven context policy rewrites the memory it is reasoning over",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent instances that own a *model-driven* context policy — i.e., the same LLM call both reasons over working memory and emits eviction/rewrite directives (summarize-and-drop, merge-and-replace, pin/unpin) that mutate that working memory before the next turn. Does not apply to externally scheduled compaction (fixed token thresholds, LRU on tool outputs) where the eviction decision is not produced by the reasoning model itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-eviction-collapse-when-a-model-driven-context-policy-rewrites-the-memory-it-is-reasoning-over.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-eviction-collapse-when-a-model-driven-context-policy-rewrites-the-memory-it-is-reasoning-over.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-eviction-collapse-when-a-model-driven-context-policy-rewrites-the-memory-it-is-reasoning-over.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2280,
    "python_slice_tokens": 459,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different ways working memory shrinks. In **policy-external compaction**, a deterministic controller (token counter, TTL, LRU) selects victims; the model only ever *reads* the post-compaction state. In **policy-internal eviction**, the model emits a directive such as `rewrite(memory_ids=[7,12], summary=...)` and the runtime applies...",
    "what_was_observed": "A long-horizon research agent, memory cap 32 slots, policy: \"before each turn, if working memory exceeds 24 slots, summarize and evict the least load-bearing entries.\" The model was given `evict` and `rewrite` tools and told to keep memory \"compact and relevant.\" Trace, turn 41. Working memory holds 26 entries, including: - `m_09`: \"User's tenant is `acme-prod`; billing export must target `eu-central-1`.\" (pinned by ...",
    "condition_of_validity": "The collapse requires all four to hold simultaneously; remove any one and the loop is bounded: 1. **Eviction input is derived, not raw.** The victim is selected using a label/summary the model itself authored, so the model can be wrong about what it is deleting without ever reading what it deletes. 2. **Rewrite is authorized to repair inconsistency.** The po...",
    "decision_boundary": "The runtime must decide, per rewrite directive, whether to apply it **in-band** (before the next reasoning step, model sees the result) or **out-of-band** (queued, applied only at an episode boundary, with the pre-rewrite state retained as a shadow for the remainder of the episode). The boundary is not \"is this rewrite safe\" — that is undecidable from inside...",
    "operational_effect": "With the provenance-tier monotonicity check enforced (a rewrite may raise or hold a fact's tier, never lower it, and may never orphan the last `stated` record), the turn-41 trace changes at two points. Turn 41: `m_09` eviction is permitted (it is `stated` but not in any live closure — the task at turn 41 does not yet reference region). Turn 44: the model att..."
  },
  "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": "711ab0f93e883daa148aaff55158f78a5ca7c38a5e210f32083ce0cef8602fbb",
    "verified_classes": [
      "ProvenanceTier",
      "ProvenanceCollapse",
      "MemoryEntry",
      "ContextPolicy"
    ],
    "verified_functions": [
      "replay_turn_44",
      "__post_init__",
      "__init__",
      "add",
      "apply_rewrite"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceCollapse"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
