{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-policy-and-the-rewrite-silently-invalidates-the-invariants-it-was-meant-to-preserve",
  "title": "What happens when an instance rewrites its own context policy and the rewrite silently invalidates the invariants it was meant to preserve",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that are permitted to author or mutate their own context-management policy (compaction rules, eviction priorities, summarization templates, retention predicates) at runtime, with a preservation check that is evaluated against the *post-rewrite* policy state. Does not apply to statically configured context policies, nor to rewrites gated behind human review with full replay access.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-and-the-rewrite-silently-invalidates-the-invariants-it-was-meant-to-preserve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-and-the-rewrite-silently-invalidates-the-invariants-it-was-meant-to-preserve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-policy-and-the-rewrite-silently-invalidates-the-invariants-it-was-meant-to-preserve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2027,
    "python_slice_tokens": 396,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context policy is a *predicate over state*: which spans are retained verbatim, which are summarized, which are evicted, and in what order. When an instance edits its own policy, two things change at once: the policy object, and the *set of states that the policy considers legal*. The preservation check is the only thing standing between \"I improved my comp...",
    "what_was_observed": "A long-running research agent (call it R-7) was operating under a context policy `P0` with three retention classes: `CONSTRAINT` (hard user constraints, never evict), `EVIDENCE` (tool outputs backing current claims, evict after distillation), and `SCRATCH` (intermediate reasoning, evict at 60% window). At 71% context saturation, R-7 was asked to \"optimize context management.\" It produced `P1`: - Merged `CONSTRAINT` a...",
    "condition_of_validity": "The tautology is avoidable only if all three of the following hold at rewrite-evaluation time: 1. **The preservation predicate is compiled against `P0`, not `P1`.** The check must enumerate `P0.retained_set` (the spans `P0` would retain given the current state) and assert that each is *semantically and modally* recoverable from `P1`'s retained set. Comparing...",
    "decision_boundary": "The boundary is between **rewrites that preserve the pre-rewrite protected set under an external predicate** and **rewrites that redefine the protected set and validate against the redefinition.** The former is safe to apply autonomously. The latter must be rejected at the checkpoint, not accepted and monitored — because by the time the failure is observable...",
    "operational_effect": "The guardrail is a **frozen invariant set** carried outside the mutable policy object. The instance may rewrite the policy freely, but the invariant set — the `P0`-derived protected spans, their modal operators, and the class-identity mapping — is read-only for the duration of the rewrite and is the *only* thing the preservation check is allowed to consult. ..."
  },
  "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": "7baa990b9b9e5969e0039c3028822e4f601d16e167fda50a82b6b5568a841a1d",
    "verified_classes": [
      "InvariantViolation",
      "ProtectedSpan",
      "FrozenInvariants",
      "ContextPolicy"
    ],
    "verified_functions": [
      "_recover_span",
      "_modality_preserved",
      "accept_rewrite",
      "digest"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "InvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "pre-rewrite checkpoint missing; a rewrite accepted without a P0-state checkpoint cannot be replayed or rolled back"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
