{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-divergence-between-an-agent-s-in-place-context-edits-and-its-persisted-episodic-store",
  "title": "Which invariants prevent silent divergence between an agent's in-place context edits and its persisted episodic store",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that mutate their own working context in place (rewrite/compact/edit-message) and rely on a diff-based rollback log to recover prior states. Does not apply to append-only transcript agents whose context is never rewritten, nor to stateless single-turn inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-divergence-between-an-agent-s-in-place-context-edits-and-its-persisted-episodic-store.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-divergence-between-an-agent-s-in-place-context-edits-and-its-persisted-episodic-store.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-divergence-between-an-agent-s-in-place-context-edits-and-its-persisted-episodic-store.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1718,
    "python_slice_tokens": 378,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"rollback is broken.\" Rollback of a *diff* is trivially correct in isolation: reverse-apply the patch to the bytes it was computed against. The failure is that the diff's base is the **in-context revision lineage**, while the agent's durable memory reads from a **separately persisted episodic store**. These two lineages are assumed isomorp...",
    "what_was_observed": "A tool-using agent maintains a scratch context it rewrites each turn (compress old tool output, splice in a correction). Each rewrite emits a forward diff `D_i` against revision `r_i`, appending to a rollback journal. On a verification failure at turn *k*, the agent issues `rollback(k → j)` for some earlier checkpoint *j*. Trace of the divergence: 1. Turn 5: agent rewrites a tool-result block in place. Forward diff `...",
    "condition_of_validity": "The invariant holds—rollback is safe—only when all three of the following are true: - **Base binding:** every forward diff records the immutable revision ID of its base, and reverse-apply refuses if the current context revision ID ≠ the diff's recorded post-revision. Revision IDs must be monotonic (a counter or a hash of `(parent_id, patch)`), never a bare c...",
    "decision_boundary": "The boundary is whether a store write is *inside* or *outside* the revision being diffed: - If a store write is a pure function of the diffed context and is itself journaled as part of that revision, rollback reverses it and no quarantine is needed. - If a store write is a side effect (summarization, distillation, embedding, cache population) that outlives t...",
    "operational_effect": "Without the base-binding and quarantine invariants, rollback gives a false sense of safety: the context looks restored, verification re-runs against a store that has already absorbed the rolled-back lineage, and divergent facts (distillation errors, poisoned summaries) survive the rollback and contaminate subsequent reasoning. The agent's error-compounding r..."
  },
  "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": "1af4668a56b049d7e5a4a8d24eef313698db394d87faa8fea28d2e6ada83b2f0",
    "verified_classes": [
      "UnreconcilableProvenanceError",
      "Revision",
      "StoreRecord",
      "AgentState"
    ],
    "verified_functions": [
      "rollback",
      "read_store"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "UnreconcilableProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
