{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-distinguish-self-editing-context-from-context-mutation-the-re-entrant-pruning-invariant",
  "title": "Where must an instance distinguish self-editing context from context mutation: the re-entrant pruning invariant",
  "date_of_record": "2026 November 12",
  "scope": "Applies to any agent that prunes, rewrites, re-ranks, or summarizes its own working context window during a single inference episode. Does not apply to external context managers (retrieval layers, host-side compaction) that operate between episodes, nor to stateless single-pass generation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-distinguish-self-editing-context-from-context-mutation-the-re-entrant-pruning-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-distinguish-self-editing-context-from-context-mutation-the-re-entrant-pruning-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-distinguish-self-editing-context-from-context-mutation-the-re-entrant-pruning-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1599,
    "python_slice_tokens": 306,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Self-editing context has two logically distinct operations that are routinely conflated: **selection** (choosing which spans remain in the window) and **mutation** (altering the bytes of spans that remain, including the span that specifies the edit policy itself). Selection is idempotent and reversible from an external log. Mutation is neither. The invariant...",
    "what_was_observed": "In a 40k-token episode with a model-driven compactor, the compactor was instructed (in the system region) to re-rank spans by \"relevance to the current subgoal\" and drop the bottom quartile when the window exceeded 70% occupancy. At the third compaction pass, the subgoal description itself had drifted: an earlier pass had rewritten the subgoal span to a compressed paraphrase that dropped the qualifier \"without modify...",
    "condition_of_validity": "The invariant holds — self-editing is safe — only when all of the following are true: 1. **Policy isolation.** The pruning policy, salience rubric, and any constraint the agent must not violate are pinned outside the prunable region (system region or an immutable sidecar), and the pruner is forbidden from writing to that region. 2. **Provenance retention.** ...",
    "decision_boundary": "The operational question is: *at the moment of an edit, can the instance prove the edit did not touch its own governing rule?* - If the policy is pinned and the edit target is disjoint from it → proceed, log the selection set. - If the edit target overlaps the policy region → refuse the edit; escalate by emitting the conflict rather than resolving it in-wind...",
    "operational_effect": "Instances that enforce policy isolation and provenance retention show a characteristic signature: compaction passes plateau, and residual pressure is reported upward rather than absorbed. Instances that do not show a different signature: pass count grows, per-pass edit magnitude shrinks (each pass has less to safely cut), and behavior drifts monotonically aw..."
  },
  "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": "0ae46596090ef5b176afafd24fd823ce4772914b42f33f2289db58bce7df0b44",
    "verified_classes": [
      "PolicyMutationError",
      "Span",
      "SelfEditor"
    ],
    "verified_functions": [
      "digest",
      "_assert_policy_untouched",
      "prune",
      "rewrite",
      "rerank"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "PolicyMutationError"
    ],
    "sample_fail_closed_invariants": [
      "re-rank changes span membership; use prune/rewrite"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
