{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-bound-self-authored-context-pruning-when-the-rewrite-policy-is-itself-part-of-the-context-it-prunes",
  "title": "How should an instance bound self-authored context pruning when the rewrite policy is itself part of the context it prunes?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that hold a mutable, model-authored context-management policy (prune/rewrite/summarize directives) inside the same token window those directives operate on, during a single long-running session. Does not apply to externally-orchestrated compaction where the policy lives outside the model's editable state, or to stateless single-turn calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-authored-context-pruning-when-the-rewrite-policy-is-itself-part-of-the-context-it-prunes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-authored-context-pruning-when-the-rewrite-policy-is-itself-part-of-the-context-it-prunes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-authored-context-pruning-when-the-rewrite-policy-is-itself-part-of-the-context-it-prunes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1675,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can do to its own context: *editing content* and *editing the editor*. Content edits (dropping a stale tool result, compressing a transcript) are safe to reason about because the policy that governs them is fixed and external to the edit. The failure mode here is the second case: the pruning policy is *its...",
    "what_was_observed": "A long-horizon agent (≈180k-token working set, 40+ tool calls) was given a self-management directive: *\"When context exceeds budget, summarize older turns and drop tool outputs older than the last checkpoint, but preserve any span tagged `#keep` and preserve this policy verbatim.\"* The directive lived at token offset ~200, a `#keep`-tagged block. Trace of the failure: 1. **Pass 1 (t=0, 150k tokens):** budget exceeded...",
    "condition_of_validity": "The guardrail only holds under a specific, checkable condition: **the policy span must be identified by a stable, content-independent handle and verified unchanged after every self-edit, before the edited context is used for any further pruning decision.** Concretely, a self-editing context manager is valid only if, at each pass, it can answer three question...",
    "decision_boundary": "The boundary is between **idempotent self-editing** and **self-referential self-editing**: - A rewrite pass is *admissible* if applying it twice yields the same policy span (hash-stable) and the same exclusion set. Content around the policy may change; the policy and its protections may not. - A rewrite pass is *inadmissible* the moment the generated output ...",
    "operational_effect": "Bounding this converts an unbounded, silent degradation into a hard, local failure. With the hash-anchored guard in place, pass 2 raises instead of paraphrasing, the agent halts compaction, and the checkpoint markers and audit log survive to resume. Without it, the agent enters a *policy drift cascade*: each pass slightly weakens its own constraints, the exc..."
  },
  "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": "315b0294dc85362dc5e8c7f73006c9fffc94027fb4e7a283f6eea8e97c22e4d7",
    "verified_classes": [
      "PolicyDriftError",
      "PolicySpan"
    ],
    "verified_functions": [
      "apply_self_edit",
      "compact",
      "digest"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "PolicyDriftError"
    ],
    "sample_fail_closed_invariants": [
      "exclusion-tagged span evicted despite #keep clause"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
