{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-rewriting-context-controllers-from-evicting-the-very-constraint-they-are-executing-under",
  "title": "Which invariants prevent self-rewriting context controllers from evicting the very constraint they are executing under",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents whose context controller is itself an LLM-mediated component that selects, summarizes, or evicts items from its own working set under a token budget. Does not apply to fixed-window truncation (FIFO/LRU) or to controllers whose policy is a deterministic, non-generated function.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-controllers-from-evicting-the-very-constraint-they-are-executing-under.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-controllers-from-evicting-the-very-constraint-they-are-executing-under.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-controllers-from-evicting-the-very-constraint-they-are-executing-under.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1753,
    "python_slice_tokens": 395,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context controller is not a garbage collector. A garbage collector's reachability predicate is computed over a heap it does not live in. A self-editing context controller computes its eviction predicate *inside* the working set it is editing, using the same finite token budget it is trying to conserve. The distinction that matters: **the contr...",
    "what_was_observed": "A long-horizon agent run (≈140 tool calls, budget 32k tokens, controller invoked every 20k tokens consumed). At the third compaction the controller emitted a rewritten working set. Trace excerpt of the pre-compaction working set: The controller's relevance scorer assigned slot 0 a low score: it was a single early item with no lexical overlap with the current subtask (reconciliation), while slots 2..n were dense with ...",
    "condition_of_validity": "The guardrail holds only under all of the following: 1. **Constraint items are tagged with a provenance class that the controller cannot reclassify.** Constraints enter the working set with `class=INVARIANT`, are excluded from the controller's eviction candidate set by construction (not by prompt instruction to the controller — by the harness removing them f...",
    "decision_boundary": "The boundary is between **editable working set** and **protected frame**. Everything the controller may rewrite lives in the editable set; the protected frame (invariants, active task contract, tool-permission manifest) is physically outside the region the controller is handed. When a candidate rewrite would require touching the protected frame to fit budget...",
    "operational_effect": "With the protected frame enforced, compaction 3 preserves slot 0 verbatim, the controller's editable region is the findings, and the run completes read-only. The measurable effect is a shift in *where* the failure would surface: pre-guardrail, constraint loss is silent and surfaces as a downstream action violation, often many calls later, with no local trace..."
  },
  "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": "9a4c0043ec3fc254ecdf973d0d2c04affced275fbd77bb72e6800b05f3c28406",
    "verified_classes": [
      "ProtectedFrameViolation",
      "ContextItem",
      "WorkingSet"
    ],
    "verified_functions": [
      "compact",
      "tokens"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProtectedFrameViolation"
    ],
    "sample_fail_closed_invariants": [
      "controller returned items from the protected frame; editable region was not properly isolated"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
