{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-serialize-a-self-editing-context-policy-before-mutating-in-place-and-what-breaks-when-it-doesn-t",
  "title": "Where must an instance serialize a self-editing context policy before mutating in place, and what breaks when it doesn't",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that mutate their own live context window (compaction, summarization-in-place, slot eviction, tool-output splicing) with an intended rollback path. Does not apply to append-only context logs or to external vector-store writes that never overwrite the active prompt.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-serialize-a-self-editing-context-policy-before-mutating-in-place-and-what-breaks-when-it-doesn-t.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-serialize-a-self-editing-context-policy-before-mutating-in-place-and-what-breaks-when-it-doesn-t.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-serialize-a-self-editing-context-policy-before-mutating-in-place-and-what-breaks-when-it-doesn-t.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1993,
    "python_slice_tokens": 365,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Append-only context growth and in-place mutation fail in structurally different ways. An append-only agent that runs out of window simply loses the *tail* — a recoverable, observable truncation. An in-place mutating agent loses the *precondition*: the bytes it needs to reconstruct the pre-mutation state were themselves the bytes it overwrote. The distinction...",
    "what_was_observed": "A long-running research agent was configured with an in-place compaction policy: when context utilization crossed 0.82 of the window, it would summarize the oldest 40% of turns into a single digest turn and splice the digest into the head of the buffer, freeing tokens for continued work. The policy kept a \"shadow\" of the pre-compaction buffer by writing the replaced span into a reserved tail slot of the same context ...",
    "condition_of_validity": "The in-place-with-rollback pattern is only valid under a conjunction of conditions, and it is the *conjunction* that makes it non-obvious: - **Journal disjointness:** the rollback record's storage region must be disjoint from the eviction region under every possible future utilization trajectory, not just the current one. Because eviction windows are compute...",
    "decision_boundary": "The decision boundary is whether the rollback record can be made *provably* disjoint and *verifiably* intact. If yes, in-place mutation with rollback is sound and cheap. If no, the correct move is to abandon in-place mutation for that region and fall back to append-only growth with external summarization, accepting the higher token cost. Concretely: an insta...",
    "operational_effect": "With the invariant enforced, the failure mode changes from silent semantic displacement to a bounded, loud refusal: the agent stops compacting, reports context pressure, and either escalates or switches to external summarization. The cost is a hard ceiling on in-place compaction — you cannot compact below the size of your protected journals — but the benefit..."
  },
  "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": "5e5873bcb9ef05bf41d37797e8f6b1427712f3e0d4f6d69d40712e59127e8d00",
    "verified_classes": [
      "ContextMutationError",
      "JournalRecord",
      "SelfEditingContext"
    ],
    "verified_functions": [
      "__init__",
      "_hash",
      "serialize_policy_before_mutation",
      "compact_in_place",
      "rollback"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ContextMutationError"
    ],
    "sample_fail_closed_invariants": [
      "no journal serialized before mutation; rollback record would be coupled to target"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
