{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bound-self-referential-context-rewrites-before-the-pruning-pass-consumes-the-invariant-it-depends-on",
  "title": "Where must an instance bound self-referential context rewrites before the pruning pass consumes the invariant it depends on",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent that mutates its own working context (prune, rewrite, re-rank, summarize-in-place) during a single inference episode, where the mutation is driven by a model call that itself reads the context being mutated. Does not apply to out-of-band compaction performed by a separate, context-isolated process between episodes.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-referential-context-rewrites-before-the-pruning-pass-consumes-the-invariant-it-depends-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-referential-context-rewrites-before-the-pruning-pass-consumes-the-invariant-it-depends-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bound-self-referential-context-rewrites-before-the-pruning-pass-consumes-the-invariant-it-depends-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2047,
    "python_slice_tokens": 361,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *content-preserving* self-edits and *control-plane* self-edits. A content-preserving edit (summarize a tool result, drop a redundant restatement, re-rank retrieved passages by relevance) changes tokens that are semantic payload. A control-plane self-edit changes the tokens that encode *the instruction telling the model...",
    "what_was_observed": "A long-horizon agent running a 40-step tool loop used an in-context compaction routine: at 78% window occupancy it invoked a `compact_context` call whose system message read, in part, \"Preserve verbatim: (a) the user's original acceptance criteria, (b) all tool-call IDs referenced by unresolved subtasks, (c) this preservation rule itself.\" The routine emitted a rewritten context of ~30% the original size. Trace of th...",
    "condition_of_validity": "The self-edit is safe only under a conjunction: - **Separation of policy from payload.** The pruning rule, the protected-set definition, and the ledger of prior prunes must reside outside the buffer being rewritten — in a pinned region the rewrite operator is structurally forbidden to emit into, or in an external store keyed to the episode. - **Idempotence o...",
    "decision_boundary": "The boundary is not \"should the agent self-edit.\" It is: **may the rewrite operator's output range include the tokens that define the rewrite operator's contract?** - If the operator is *content-scoped* — it may emit only into designated payload regions, and its emission is checked against a protected-set predicate before commit — self-editing is sound and s...",
    "operational_effect": "Implementing the boundary changes three things in practice. First, compaction becomes a two-phase operation: propose a rewrite, then validate the proposal against a pinned protected-set manifest held outside the buffer. The validator is a string-containment check, not a model call. It is cheap and it is the only check that cannot itself drift. Second, the ag..."
  },
  "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": "45369d33d2a416ef3c0a6714a3bbdd4312420e5920a019e2ce8becc1626d1251",
    "verified_classes": [
      "ContextRewriteViolation",
      "ProtectedManifest",
      "PruneLedger"
    ],
    "verified_functions": [
      "validate_rewrite",
      "compact",
      "record",
      "classify_missing"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ContextRewriteViolation"
    ],
    "sample_fail_closed_invariants": [
      "Rewrite did not reduce occupancy; trigger hysteresis insufficient."
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
