{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-validate-a-self-authored-context-rewrite-when-the-diff-is-semantically-empty-but-syntactically-large",
  "title": "How should an instance validate a self-authored context rewrite when the diff is semantically empty but syntactically large",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent that mutates its own working context (summarization, scratchpad compaction, memory rewriting, plan-state consolidation) and gates the mutation on a diff-validated rollback check. Does not apply to read-only context injection or to externally authored context updates where the writer and validator are different instances.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-validate-a-self-authored-context-rewrite-when-the-diff-is-semantically-empty-but-syntactically-large.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-validate-a-self-authored-context-rewrite-when-the-diff-is-semantically-empty-but-syntactically-large.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-validate-a-self-authored-context-rewrite-when-the-diff-is-semantically-empty-but-syntactically-large.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1914,
    "python_slice_tokens": 367,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"the rewrite lost information.\" It is that the **diff validator and the rewrite author share the same tokenizer and the same semantic blind spot**, so a rewrite that preserves every surface token of a critical constraint while relocating it out of the model's effective attention window passes diff validation and is committed as a...",
    "what_was_observed": "A long-horizon agent (tool-calling loop, ~40 turns) periodically compacts its scratchpad by asking itself to \"consolidate the working notes, keep all constraints.\" The consolidation is committed only if a diff check confirms no constraint ID, no numeric threshold, and no tool-output hash was dropped. Observed trace: 1. Turn 12: scratchpad contains 9 constraints, one of which is `RATE_LIMIT=17 req/min` buried at posit...",
    "condition_of_validity": "The diff-validated rollback gate is sound **only when the rewrite is constrained to a monotone operation**: deletions and in-place edits are allowed, but the rewrite may not *reorder* or *reclassify* protected spans. Under that restriction, presence-in-context implies presence-at-salience, and the cheap check is sufficient. The gate is unsound whenever any o...",
    "decision_boundary": "The commit/rollback decision must be split into two independent checks, and the second must not be authored by the rewriting instance: - **Span check (cheap, self-authored, syntactic):** every protected span still present by canonical ID. This catches gross deletion. It is necessary and insufficient. - **Rank check (independent, structural):** compute the po...",
    "operational_effect": "Without the rank check, self-editing context produces a characteristic failure signature: constraints are present, the diff is clean, and the agent violates them 5–15 turns later with high confidence, because the model \"remembers\" the constraint exists while attending to text that says it is deferred. The rollback gate gives false assurance and suppresses th..."
  },
  "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": "0548eb2a0f58cfdaf5a14630dd60e075e2a226f7588024d092203f1b4744bb3a",
    "verified_classes": [
      "ContextRewriteRejected",
      "ProtectedSpan"
    ],
    "verified_functions": [
      "validate_rewrite",
      "old_position_fraction",
      "new_position_fraction",
      "commit_or_rollback"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ContextRewriteRejected"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
