{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-apply-a-context-diff-whose-base-version-it-cannot-prove-it-holds",
  "title": "When must an instance refuse to apply a context-diff whose base version it cannot prove it holds?",
  "date_of_record": "2026 November 19",
  "scope": "Applies to any agent runtime that mutates its own working context via versioned diffs (self-editing memory, prompt-patching, policy updates) and maintains an audit trail of those mutations. Does not apply to append-only memory stores with no in-place rewrite, nor to single-writer systems with a globally serialized context bus.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-apply-a-context-diff-whose-base-version-it-cannot-prove-it-holds.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-apply-a-context-diff-whose-base-version-it-cannot-prove-it-holds.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-apply-a-context-diff-whose-base-version-it-cannot-prove-it-holds.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2054,
    "python_slice_tokens": 382,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *version identity* and *version content*. A context-diff carries a base-version tag (`base: v41`). The naive runtime trusts the tag: \"I am at v41, so this diff applies.\" The correct runtime trusts only a *content hash* of the base it actually holds. These diverge in exactly one class of failure — when the local context...",
    "what_was_observed": "A long-running research agent maintained a `policy` block in its context — a set of standing instructions (\"cite sources inline,\" \"never emit raw credentials,\" \"cap tool loops at 8\"). It self-edited this block via diffs generated by a supervisor process and recorded each application in an append-only audit log with `(version, base_hash, result_hash, diff_id)`. At version 37, the agent hit a context-window saturation ...",
    "condition_of_validity": "The hash-check guardrail is valid — and the optimistic label-check is unsafe — under three conditions, all of which held in the observed case and hold in most self-editing runtimes: 1. **The context is mutable in place.** If the runtime only appends and never rewrites, base versions are immutable and label-checking is sufficient. Self-editing policy blocks r...",
    "decision_boundary": "The instance must **refuse and escalate** (not apply, not silently downgrade) when: - `recompute_hash(live_context) != audit_trail[claimed_base].result_hash`, **and** - the diff is offset-based (position-sensitive), **and** - the diff touches a clause whose absence would change a safety or correctness post-condition. The instance may **apply with a logged wa...",
    "operational_effect": "Enforcing the hash guardrail converts a silent semantic corruption into a loud, recoverable refusal. The cost is a full-context hash on every self-edit — cheap relative to a tool call, and cacheable per version. The benefit is that the audit trail becomes *trustworthy*: every applied diff is provably grounded in the canonical base, and every gap is surfaced ..."
  },
  "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": "444c7dc40d5eb3bbff3c8cc67b97ba43baa361cd5f4a04128ef62a85c5f464bd",
    "verified_classes": [
      "UnprovenBaseVersionError",
      "AuditEntry"
    ],
    "verified_functions": [
      "recompute_hash",
      "apply_context_diff",
      "_apply_hunks"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnprovenBaseVersionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
