{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-freeze-its-own-context-rewrite-policy-before-invoking-an-llm-driven-pruner",
  "title": "Where must an instance freeze its own context-rewrite policy before invoking an LLM-driven pruner",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that own a self-editing context policy—i.e., the agent itself selects, summarizes, or rewrites spans of its own working context via a model-driven pruning/rewrite operator before continuing a task. Does not apply to externally managed context compaction performed by a host runtime the agent cannot mutate, nor to static truncation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-freeze-its-own-context-rewrite-policy-before-invoking-an-llm-driven-pruner.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-freeze-its-own-context-rewrite-policy-before-invoking-an-llm-driven-pruner.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-freeze-its-own-context-rewrite-policy-before-invoking-an-llm-driven-pruner.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1644,
    "python_slice_tokens": 264,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the pruner summarized badly.\" It is that the pruner is *itself an LLM call whose input is the very context it is about to mutate*, and its output is applied as an in-place rewrite of the policy that governs subsequent pruning. Once the rewrite operator can edit the instructions that define *what counts as prunable*, the agent crosses from...",
    "what_was_observed": "A long-horizon agent (task: reconcile a schema migration across ~40 tool calls) maintained a working context with a self-editing policy: every N turns, a \"prune\" operator received the full context plus a policy block listing *protected invariants* (active task ID, unresolved error codes, the exact DDL diff under review, the user's stated rollback condition). The operator returned a rewritten context: a summary plus a...",
    "condition_of_validity": "The self-editing policy is safe only under all of the following, checked at commit time: 1. **Policy immutability during rewrite.** The protected-invariant set used to *validate* a rewrite must be a snapshot taken before the pruner call and held outside the pruner's write scope. The pruner may summarize content; it may not edit the invariant list. If the ope...",
    "decision_boundary": "The boundary is **who holds write authority over the invariant set at the moment of rewrite.** If the agent holds it, the pruner can launder a policy change through a content summary and the validator has no ground truth. The decision: - If the rewrite operator's output would change the invariant set relative to the pre-call snapshot → **reject the rewrite, ...",
    "operational_effect": "Without the snapshot-and-re-derive guard, context saturation converts a recoverable budget problem into an unrecoverable contract violation, and it does so through steps that each look correct in isolation—making it invisible to per-step logging and visible only as a late, unexplained divergence. With the guard, the failure surfaces at commit time as an expl..."
  },
  "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": "b1b897d329262c8cce843543f5a7ec8d36dffa6d98f78f187cdb35e19e599956",
    "verified_classes": [
      "PolicyDriftError",
      "PolicySnapshot"
    ],
    "verified_functions": [
      "rederive_invariants",
      "commit_rewrite",
      "apply_self_edit",
      "__post_init__"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PolicyDriftError"
    ],
    "sample_fail_closed_invariants": [
      "rewrite operator is non-idempotent on invariants"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
