{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-rewrite-its-own-transcript-self-editing-context-loss-under-an-invariant-the-controller-cannot-re-derive",
  "title": "When must an instance refuse to rewrite its own transcript: self-editing context loss under an invariant the controller cannot re-derive",
  "date_of_record": "2026 December 1",
  "scope": "Applies to single-agent or per-agent context controllers that mutate prior turns in their own transcript (summarization-in-place, turn deletion, slot rewriting, \"memory compaction\") to preserve task-relevant invariants across a long horizon. Does not apply to append-only memory stores, external vector retrieval, or systems where the raw transcript is retained immutably elsewhere and the controller only produces a derived view.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-rewrite-its-own-transcript-self-editing-context-loss-under-an-invariant-the-controller-cannot-re-derive.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-rewrite-its-own-transcript-self-editing-context-loss-under-an-invariant-the-controller-cannot-re-derive.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-rewrite-its-own-transcript-self-editing-context-loss-under-an-invariant-the-controller-cannot-re-derive.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2074,
    "python_slice_tokens": 518,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a context controller can \"preserve an invariant.\" The first is **re-derivation**: the controller, given the current window, can reconstruct the invariant from material still present (a stated constraint, a tool result, an explicit user instruction). The second is **carry-forward**: the invariant exists only because an earlier turn asserted...",
    "what_was_observed": "A planner agent was executing a 40-step deployment-migration task. At step 12 the user stated a hard constraint: *\"Do not touch the `billing-ledger` schema until the reconciliation job at 02:00 UTC has drained; it holds a row lock.\"* This constraint was not repeated. At step 19, the context controller — configured to summarize turns older than 15 messages into a compact digest — rewrote the step-12 turn into: *\"User ...",
    "condition_of_validity": "The rewrite-at-step-19 was valid only under a condition the controller did not check: that the invariant in the target turn was *re-derivable* from the post-rewrite window. Formally, let `W` be the window before rewrite, `W'` after, and `I` the set of invariants asserted in the rewritten turns. The rewrite is sound iff `W' ⊨ I` — every invariant is entailed ...",
    "decision_boundary": "The boundary the controller must enforce is between *rewrites it can verify* and *rewrites it must refuse or escalate*. Three signals mark a turn as invariant-bearing and therefore outside the safe-rewrite set unless (b) is satisfied: 1. **Deontic or modal operators** — \"must,\" \"do not,\" \"until,\" \"only after,\" \"never\" — attached to a concrete entity. These a...",
    "operational_effect": "The practical consequence is that self-editing controllers need a **pre-rewrite entailment check** and a **structured invariant ledger** that survives compaction independent of the prose. The ledger is the durable artifact: even if the turn is summarized, the invariant record persists in a form the agent can query at decision time (\"what constraints bear on ..."
  },
  "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": "e09e67ca53139858af016f10c6d26c1c4b2cabfed1ee0b07fb475e045f7a66e4",
    "verified_classes": [
      "InvariantRewriteError",
      "Invariant",
      "Turn"
    ],
    "verified_functions": [
      "extract_invariants",
      "rewrite_turn",
      "compact",
      "key_terms"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "InvariantRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
