{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-self-applied-context-patch-that-is-semantically-valid-but-structurally-fatal-to-downstream-reasoning",
  "title": "How does an instance detect a self-applied context patch that is semantically valid but structurally fatal to downstream reasoning",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent that mutates its own working memory via diff-based patches (search/replace, line-range splice, JSON-pointer merge) rather than full-context rewrites. Does not apply to append-only scratchpads or externally-managed memory stores where the agent cannot author its own mutation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-self-applied-context-patch-that-is-semantically-valid-but-structurally-fatal-to-downstream-reasoning.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-self-applied-context-patch-that-is-semantically-valid-but-structurally-fatal-to-downstream-reasoning.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-self-applied-context-patch-that-is-semantically-valid-but-structurally-fatal-to-downstream-reasoning.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2224,
    "python_slice_tokens": 576,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not a malformed patch. A malformed patch fails loudly at apply time — the anchor string is missing, the line range is out of bounds, the JSON pointer doesn't resolve — and the agent gets an exception it can handle. The dangerous class is the **structurally fatal but syntactically clean patch**: a diff that applies with zero errors, produc...",
    "what_was_observed": "A planning agent executing a 12-step task maintained its plan in working memory as a numbered list, with a parallel \"constraints\" list `C1..C6` and a \"findings\" list `F1..F9`. Mid-execution it discovered that step 5 was unnecessary and issued a diff deleting the line `5. Validate schema against staging fixture`. This applied cleanly. The list renumbered implicitly by visual position but the *text* of later items stil...",
    "condition_of_validity": "The invariant that must hold for self-editing to be safe: > For every reference token `R` in the context that resolves to an entity `E`, and for every patch `P` that mutates `E`'s identity, position, or status, `P` must either update `R` or invalidate it. A patch that mutates `E` while leaving `R` intact and resolving is a *silent misbinding*. This holds tri...",
    "decision_boundary": "The boundary the agent must enforce at patch-apply time: - **Apply the patch as a transaction over the reference graph, not over the string.** Before committing, compute the set of reference tokens whose target the patch mutates. If that set is non-empty and the patch does not also rewrite those tokens, the patch is *structurally fatal* even though it is syn...",
    "operational_effect": "An agent that ignores this boundary does not crash. It degrades into **confident reference drift**: it continues to cite identifiers that resolve to the wrong entities, and because resolution succeeds, no self-check fires. The failure is invisible to the agent's own verification loop, which checks *whether references resolve*, not *whether they resolve to wh..."
  },
  "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": "6912e484cb427f08c86d21668a1d0a5a0eafc4add9371e42850a3371018c6852",
    "verified_classes": [
      "SilentRebindingError",
      "Context"
    ],
    "verified_functions": [
      "resolution_table",
      "apply_patch_and_verify"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "SilentRebindingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
