{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-replay-divergence-when-an-agent-s-tool-call-transcript-is-re-executed-against-a-mutated-environment",
  "title": "Which invariants prevent replay divergence when an agent's tool-call transcript is re-executed against a mutated environment",
  "date_of_record": "2026 November 28",
  "scope": "Applies to deterministic replay of recorded MCP/A2A protocol transcripts for counterfactual debugging of agentic workflows, where the replay target is a live or partially-live tool surface. Does not apply to pure in-memory transcript simulation with fully synthetic tool stubs, nor to single-turn stateless completions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-an-agent-s-tool-call-transcript-is-re-executed-against-a-mutated-environment.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-an-agent-s-tool-call-transcript-is-re-executed-against-a-mutated-environment.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-an-agent-s-tool-call-transcript-is-re-executed-against-a-mutated-environment.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2338,
    "python_slice_tokens": 442,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A recorded transcript is not a program. It is a *trace* of a program whose control flow was decided by a probabilistic sampler, interleaved with side effects executed against a stateful, non-deterministic environment. Replay fidelity therefore decomposes into two independent axes that are routinely conflated: 1. **Sampler fidelity** — does the model, under t...",
    "what_was_observed": "A support-triage agent workflow was recorded over 14 turns: 6 assistant messages, 5 tool calls (2× `search_docs`, 2× `get_order`, 1× `issue_refund`), and 3 tool results. The transcript was captured with full request/response envelopes including `tool_call_id`, result payloads, and a `result_digest` (SHA-256 of the canonicalized payload) written by the MCP client at capture time. Replay was launched 72 hours later aga...",
    "condition_of_validity": "Deterministic replay of an agent transcript is valid for counterfactual debugging **only if** all of the following hold. Each is a precondition, not a best practice: 1. **Result-identity binding.** Every recorded assistant turn is tagged with the `tool_call_id` and `result_digest` of the result it consumed. Replay must verify the digest of any re-executed re...",
    "decision_boundary": "The boundary between \"replay\" and \"counterfactual\" is where teams get hurt, because both look like \"re-run the transcript.\" The decision rule: - If `result_digest` matches → admit the recorded turn, advance cursor. This is *replay*. - If `result_digest` mismatches and the tool is read-only → **do not** substitute silently. Either halt, or open a counterfactu...",
    "operational_effect": "Enforcing result-identity binding converts a class of silent corruptions into loud halts, at the cost of replay fragility: transcripts become non-replayable the moment any read-only dependency mutates. This is the correct trade. The operational consequences: - **Replay success rate drops** from ~100% (because everything \"replays\") to the fraction of transcri..."
  },
  "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": "16f5c2bdc42bcbff0d4ae40c7acf8edab8fa227396353b139189db9540f8c877",
    "verified_classes": [
      "ReplayDivergenceError",
      "SideEffectInReplayError",
      "ToolClass",
      "RecordedTurn",
      "ReplayState"
    ],
    "verified_functions": [
      "canonical_digest",
      "admit_turn",
      "replay"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayDivergenceError",
      "SideEffectInReplayError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
