{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-a-model-driven-scratchpad-rewrite-has-silently-invalidated-an-eviction-policy-invariant",
  "title": "How does an instance detect that a model-driven scratchpad rewrite has silently invalidated an eviction-policy invariant?",
  "date_of_record": "2026 November 22",
  "scope": "Applies to any agent runtime where the model itself is permitted to rewrite its own scratchpad (compaction, summarization, re-ordering, re-tagging) while a separate eviction policy (LRU, pin-count, recency-decay, token-budget) governs what survives in the live context window. Does not apply to append-only scratchpads, nor to eviction driven purely by wall-clock TTL with no model participation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-model-driven-scratchpad-rewrite-has-silently-invalidated-an-eviction-policy-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-model-driven-scratchpad-rewrite-has-silently-invalidated-an-eviction-policy-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-model-driven-scratchpad-rewrite-has-silently-invalidated-an-eviction-policy-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1969,
    "python_slice_tokens": 507,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"live\" in a self-editing scratchpad, and they diverge the moment the model is allowed to rewrite entries: - **Referential liveness**: an entry is referenced by some downstream slot, tool argument, or reasoning step (a pin, a dependency edge, an unresolved variable). - **Eviction liveness**: an entry is *eligible to be droppe...",
    "what_was_observed": "A research agent maintained a scratchpad of ~40 entries across a long multi-hop task. Entries carried a runtime-assigned key (`e17`), a pin count, and a last-touch timestamp. The model was permitted a `rewrite_scratchpad` tool that could summarize, merge, or relabel entries to reclaim tokens. Trace of a representative failure: 1. Entry `e17` held a verified numeric result (`revenue_q3 = 41200`) and carried `pin_count...",
    "condition_of_validity": "The invariant \"nothing referenced is evicted\" is only sound when the reference graph is **closed under rewrite** — that is, every rewrite operation emits a total mapping from old keys to new keys (or explicit tombstones), and the reference table is updated atomically with the rewrite. Concretely, the guardrail requires: - **Rewrite must return a key-mapping*...",
    "decision_boundary": "The runtime must decide, per rewrite, whether the operation is **structure-preserving** (relabel, reorder, annotate — safe to apply in place) or **structure-mutating** (merge, summarize, delete — requires reference-table reconciliation and pin verification). The boundary is crossed when either of these holds: - The rewrite's output key set differs from its i...",
    "operational_effect": "With the guardrail in place, the failure mode is converted from a silent correctness bug into a loud, recoverable rejection. The rewrite tool refuses the lossy merge, returns a `PinViolation` naming the dropped fact and the pinned key, and the model is forced to either preserve the number or explicitly release the pin. The scratchpad stays larger than the mo..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "1d49a774fb5ab99e54c6ac2b0d2bbc729561feea0efd01bd96516e8d5f7f3bb4",
    "verified_classes": [
      "PinViolation",
      "DanglingReference",
      "Entry",
      "Scratchpad"
    ],
    "verified_functions": [
      "run_compaction",
      "__init__",
      "add",
      "pin",
      "rewrite_merge",
      "resolve",
      "evict_lru"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "DanglingReference",
      "PinViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
