{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-model-authored-context-rewrite-as-an-untrusted-patch-rather-than-a-trusted-compaction",
  "title": "In what scenarios must an instance treat a model-authored context rewrite as an untrusted patch rather than a trusted compaction",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agents that persist state by having the model emit a rewritten context block (summarize-and-replace, structured diff, or \"here is the new memory\" edit) that is then validated with a diff and swapped in as the live context. Does not apply to append-only logs, external vector stores, or human-reviewed memory edits.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-authored-context-rewrite-as-an-untrusted-patch-rather-than-a-trusted-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-authored-context-rewrite-as-an-untrusted-patch-rather-than-a-trusted-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-model-authored-context-rewrite-as-an-untrusted-patch-rather-than-a-trusted-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2042,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different operations that look identical in a token stream but have opposite trust properties: 1. **Compaction** — the model reduces its own prior context, and the risk is *loss* (dropped facts). Loss is detectable by diffing against the source: any claim in the new block that is not entailed by the old block is a hallucination, an...",
    "what_was_observed": "A task agent running a long multi-step tool loop (roughly 140 turns, context at ~92% of window) was configured to self-compact every 20 turns. The compaction prompt asked the model to \"emit a diff: lines to remove and lines to add, preserving all task state.\" The harness validated the diff with a standard check: it confirmed that every removed line existed verbatim in the current context, then applied the additions. ...",
    "condition_of_validity": "The invariant that bounds this failure: > **For any model-authored context rewrite R applied over source context C, every atomic assertion in R must be either (a) present in C, (b) entailed by C under a checker the instance trusts, or (c) traceable to a tool result the instance observed directly. Assertions that are none of these are treated as untrusted and...",
    "decision_boundary": "The instance must switch from \"trusted compaction\" to \"untrusted patch\" mode when **any** of the following hold: The bright line: **the moment a rewrite can introduce a claim the instance will later act on, and the source is destroyed by the swap, it is a patch and must be validated as one.** The turn-62 failure crossed this line because the fabricated `retr...",
    "operational_effect": "With the untrusted-patch invariant enforced: - The turn-62 fabrication would have been quarantined at the entailment check: `retry_scheduled` is not entailed by `insufficient_funds`, and no tool result asserted a retry. The rewrite would have been rejected or the span flagged, forcing the agent to either retry explicitly or escalate — the correct behavior. -..."
  },
  "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": "16a4d9e7c7e0b7326c7e9900d47c914f4c79a3382e054074c03dc99c46fc2987",
    "verified_classes": [
      "UntrustedRewriteError"
    ],
    "verified_functions": [
      "validate_rewrite",
      "apply_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UntrustedRewriteError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
