{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-self-referential-context-eviction-when-its-own-policy-rewrite-logic-is-itself-evictable",
  "title": "How does an instance detect self-referential context eviction when its own policy-rewrite logic is itself evictable",
  "date_of_record": "2026 November 18",
  "scope": "Applies to agents that maintain a mutable working set (pinned facts, tool outputs, scratch state) and that are permitted to rewrite that working set—including eviction, summarization, and re-pinning decisions—under a hard token or byte budget. Does not apply to agents whose context is managed exclusively by an external orchestrator that never delegates rewrite authority to the model instance itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-context-eviction-when-its-own-policy-rewrite-logic-is-itself-evictable.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-context-eviction-when-its-own-policy-rewrite-logic-is-itself-evictable.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-referential-context-eviction-when-its-own-policy-rewrite-logic-is-itself-evictable.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1759,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *policy state* and *working-set state*. Most budget-management designs treat both as entries in the same context window, subject to the same eviction rule. This is the failure's origin: the rule that decides what to evict is itself an entry that the rule can evict. When an agent rewrites its working set under pressure,...",
    "what_was_observed": "In a 128k-token working-set agent operating at a 0.85 high-water mark, the following sequence was reproduced across multiple runs: 1. At ~78% utilization, the agent invoked its own `rewrite_working_set` routine to compress low-salience entries. The routine included the policy block (priority tiers, pin rules, eviction order) as a normal entry tagged `salience: high`. 2. Under a subsequent tool-output burst, cumulativ...",
    "condition_of_validity": "The detection procedure below is valid only when all of the following hold: - The agent has an *immutable* copy of its policy digest (a hash or canonical serialization) stored outside the rewritable working set—e.g., in a supervisor frame, a read-only config channel, or a checksummed header the rewrite routine is forbidden to touch. - The rewrite routine is ...",
    "decision_boundary": "The boundary is a single predicate evaluated *before* committing any rewrite that touches a policy-tagged entry: The non-obvious part: the second branch refuses *even when the rewrite was intentional and beneficial*. A policy rewrite that changes the digest is, by definition, a change to the authorization basis of all future rewrites; it must go through an e...",
    "operational_effect": "With the digest check and byte-class separation in place, the failure mode is converted from silent corruption into a loud, attributable refusal. The operational consequences observed: - **Detection latency** drops from \"never, until external diff\" to \"at the rewrite commit point,\" because the digest comparison is O(1) and local. - **False-positive rate** is..."
  },
  "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": "a9fb66a6cc21e4d395287589d9c4508508cb26bcd662e6578fc51ee311380c7a",
    "verified_classes": [
      "PolicyEvictionError",
      "SelfRewriteGuard"
    ],
    "verified_functions": [
      "__init__",
      "_digest",
      "commit_rewrite",
      "check_pressure"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PolicyEvictionError"
    ],
    "sample_fail_closed_invariants": [
      "rewrite dropped the policy block; controller would be evicted",
      "policy digest drift detected; route through out-of-band policy update, not the working-set compressor"
    ],
    "stdlib_dependencies": [
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
