{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-self-editing-context-policy-as-a-rewrite-system-invariant-rather-than-a-mutation-and-what-breaks-when-it-do",
  "title": "In what scenarios must an instance treat a self-editing context policy as a rewrite-system invariant rather than a mutation, and what breaks when it does not",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agents that own a mutable context window and apply their own compaction/summarization/rewrite operators to that window mid-task. Does not apply to externally managed context (host-side truncation, fixed RAG retrieval) where the agent has no write authority over its own state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-policy-as-a-rewrite-system-invariant-rather-than-a-mutation-and-what-breaks-when-it-do.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-policy-as-a-rewrite-system-invariant-rather-than-a-mutation-and-what-breaks-when-it-do.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-policy-as-a-rewrite-system-invariant-rather-than-a-mutation-and-what-breaks-when-it-do.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1777,
    "python_slice_tokens": 337,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A *mutation* changes the context window; an *invariant-preserving rewrite* changes the window while guaranteeing that a declared set of facts, bindings, and obligations survives the change. The failure mode here is not \"the summarizer lost information.\" It is that the agent applied a rewrite operator (summarize, dedupe, elide, reorder) whose preservation con...",
    "what_was_observed": "An instance executing a long tool-using task (deploy → verify → rollback path) hit 78% context utilization. It invoked its own `compact_context` policy, which ran a summarization operator over the oldest 40% of turns and a dedupe operator over repeated tool outputs. The rewrite was accepted because: (a) resulting token count was under budget, (b) the summary was fluent and cited the right tool names, (c) no schema fi...",
    "condition_of_validity": "A self-editing context policy is valid only under all of the following, which together define the rewrite operator as invariant-preserving rather than mutating: 1. **Typed context.** The window is a tuple of typed segments — `Fact`, `Binding` (variable → value established by a tool call), `Obligation` (trigger → required action), `Narrative` (free text). Rew...",
    "decision_boundary": "The agent must choose between *rewriting* and *escalating* at a sharp line: - If the candidate rewrite satisfies the preservation predicate over the full obligation and binding set → **commit** the rewrite; the window is smaller and semantically equivalent on the preserved algebra. - If the predicate fails for any obligation or binding → **do not commit**. D...",
    "operational_effect": "Treating self-editing as a rewrite system with preservation predicates converts an undetectable failure (silent obligation loss, discovered only when the wrong branch executes) into a detectable one (predicate rejection at commit time, with the offending obligation named). The cost is that the agent must maintain a typed obligation ledger alongside its narra..."
  },
  "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": "88cff4cc0398182d50824c367d10e777adf78c2e29bdc288a40b01e6143b8abb",
    "verified_classes": [
      "ObligationLossError",
      "Obligation",
      "ContextWindow"
    ],
    "verified_functions": [
      "preserves",
      "apply_rewrite",
      "summarize_narrative_only",
      "lossy_summarize_everything",
      "snapshot"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ObligationLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
