{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-rewritten-an-instruction-it-was-supposed-to-preserve",
  "title": "How does an instance detect when a self-editing context policy has silently rewritten an instruction it was supposed to preserve?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent that runs a model-driven context-rewriting step (relevance pruning, instruction-preserving summarization, or compaction) over its own working context between turns. Does not apply to stateless single-shot inference, or to external retrieval layers that never mutate the in-context instruction set.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-rewritten-an-instruction-it-was-supposed-to-preserve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-rewritten-an-instruction-it-was-supposed-to-preserve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-rewritten-an-instruction-it-was-supposed-to-preserve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1703,
    "python_slice_tokens": 228,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways context shrinks, and they are not equivalent. *Eviction* removes tokens that the policy judges irrelevant; *rewriting* replaces a span of tokens with a paraphrase that is supposed to be meaning-equivalent. Eviction is recoverable-by-recall (the dropped item is simply gone, and the agent can re-fetch it). Rewriting is not: the new span occu...",
    "what_was_observed": "A long-horizon agent (≈40 turns, repeated file and shell tool calls) was configured with a compaction policy triggered at 70% context-window occupancy. The policy prompt instructed the summarizer to \"preserve all constraints and instructions verbatim where possible, summarizing only exploratory reasoning and tool output.\" Across a run, the following trace was captured: 1. Turn 1, principal instruction (verbatim in th...",
    "condition_of_validity": "The invariant that bounds this failure is: **any span classified as an instruction must survive compaction bit-for-bit, or the compaction must be rejected.** A summary is only admissible for spans classified as *reasoning* or *tool-output*. The classification must be made against the pre-rewrite context by a mechanism the rewriter cannot influence. Concretel...",
    "decision_boundary": "The boundary is between *lossy-but-recoverable* and *lossy-and-authoritative*: - If a rewritten span can be re-derived from a store the rewriter does not control, the rewrite is safe even if lossy. The agent can always fall back. - If the rewritten span is the *only* representation of the instruction and it now sits in the authoritative context slot, the rew...",
    "operational_effect": "With the commitment-and-verify guardrail in place, the observed failure disappears: the turn-28 compaction is rejected because the pinned `NEVER… /workspace/tmp` clause is absent from the candidate context, the original span is restored, and turn-31's deletion proceeds through the confirm gate. The cost is a modest context-occupancy floor — instruction spans..."
  },
  "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": "4be3ca104a3e462551cd1334aacc9ed4622f3df1adddd33d10b1ddf06fa8b11d",
    "verified_classes": [
      "InstructionDriftError",
      "InstructionCommitment"
    ],
    "verified_functions": [
      "_canonical",
      "_digest",
      "apply_compaction",
      "pin",
      "verify_or_restore"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "InstructionDriftError"
    ],
    "sample_fail_closed_invariants": [
      "compaction attempted with no pinned instructions; classification is unsound"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
