{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-model-driven-context-rewrite-as-a-destructive-commit-rather-than-a-compaction-and-how-does-that-distinction",
  "title": "In what scenarios must an instance treat a model-driven context rewrite as a destructive commit rather than a compaction, and how does that distinction prevent silent invariant loss at the pruning boundary?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent that lets the model itself decide which spans of its own context window to prune, summarize, or rewrite mid-task (self-editing context). Does not apply to append-only context growth, external retrieval-augmented stores, or pruning policies that are fully deterministic and pre-registered outside the model's discretion.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-driven-context-rewrite-as-a-destructive-commit-rather-than-a-compaction-and-how-does-that-distinction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-driven-context-rewrite-as-a-destructive-commit-rather-than-a-compaction-and-how-does-that-distinction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-driven-context-rewrite-as-a-destructive-commit-rather-than-a-compaction-and-how-does-that-distinction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1892,
    "python_slice_tokens": 446,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the model summarized badly.\" It is that a **model-driven rewrite is a write, not a read**. When an agent compacts context, it produces a new authoritative state whose provenance is a probabilistic function of the old state. Two classes of operation look identical at the API level but have opposite safety properties: - **Compaction (l...",
    "what_was_observed": "A tool-using agent ran a 60-turn infrastructure task with a self-editing policy: when context exceeded 70% of the window, the model was asked to emit a `<prune>` block listing spans to drop and a `<rewrite>` block summarizing them. Observed trace: 1. Turn 9: user states a hard constraint `C1: do not rotate the primary DB credentials; a migration is in flight`. The model acknowledges and proceeds. `C1` is stored as a ...",
    "condition_of_validity": "The destructive-commit framing is valid—and the guardrail is required—only when all of the following hold: - The rewrite is **model-generated** (the span selection or the summary text is a sampled output), so provenance is probabilistic and not replayable bit-for-bit. - The task has **live obligations** (open subgoals, pending tool calls, unsatisfied precond...",
    "decision_boundary": "The operational rule: **classify every self-edit before committing it.** - If the pruned span is reachable from the obligation graph *or* contains deontic/identifier tokens with no second witness → treat as **destructive commit**: require an explicit tombstone (record that span X was pruned, with a hash and a one-line \"what was removed\" that preserves polari...",
    "operational_effect": "With the tombstone-and-recheck guardrail, the turn-31 rewrite is blocked: the checker sees `C1` is the unique witness for the precondition of the \"credentials current\" obligation (declared at turn 9 as a standing constraint) and forces either retention of `C1` verbatim or a tombstone `PRUNED[span 6-12]: constraint C1 = \"do not rotate primary DB creds (migrat..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "53edb67eca2f1f7184e35dfc781dcfd155b9191b3533a75029afa9dad05cb2f1",
    "verified_classes": [
      "DestructiveRewriteError",
      "Obligation",
      "ContextSpan",
      "SelfEditGuard"
    ],
    "verified_functions": [
      "apply_self_edit",
      "__init__",
      "_witness_count",
      "commit_prune"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "DestructiveRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
