{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-a-recorded-agentic-session-and-the-tool-layer-is-not-hermetic-counterfactual-drift-in-forensic-reconstruction",
  "title": "What happens when an instance replays a recorded agentic session and the tool layer is not hermetic: counterfactual drift in forensic reconstruction",
  "date_of_record": "2026 November 21",
  "scope": "Applies to deterministic replay and counterfactual auditing of recorded agent sessions (trajectory logs containing model outputs, tool calls, tool results, and context snapshots) where the replay harness re-executes tool calls against live or partially live dependencies. Does not apply to replay of pure model-output transcripts (no tool re-execution) or to replay against a fully captured, byte-identical tool-response tape.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-recorded-agentic-session-and-the-tool-layer-is-not-hermetic-counterfactual-drift-in-forensic-reconstruction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-recorded-agentic-session-and-the-tool-layer-is-not-hermetic-counterfactual-drift-in-forensic-reconstruction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-recorded-agentic-session-and-the-tool-layer-is-not-hermetic-counterfactual-drift-in-forensic-reconstruction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2320,
    "python_slice_tokens": 419,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things an incident-forensics replay can mean, and conflating them is the root of the failure: 1. **Trace replay (hermetic):** the harness feeds the *recorded* tool results back into the agent, never re-invoking the tool. The agent's decisions are re-derived from a frozen observation stream. This is deterministic up to model sampling, and sampli...",
    "what_was_observed": "A recorded session shows an agent calling `get_account_balance(acct)` early, receiving `$1,200`, then calling `transfer(acct, $1,100)`, then calling `get_account_balance(acct)` again and receiving `$1,200` (unchanged), then calling `transfer` again and being rejected by an insufficient-funds guard. The recorded trajectory ends in a rejection the incident report flags as \"agent looped on transfers; guard prevented dou...",
    "condition_of_validity": "A counterfactual replay is a valid causal probe under exactly this condition: for every tool call $c_i$ in the session, the replayed observation $r'_i$ equals the recorded observation $r_i$ **unless** $c_i$ is in the declared intervention set $I$, and for $c_i \\in I$ the divergence $\\Delta_i = r'_i - r_i$ is the *only* channel through which the counterfactua...",
    "decision_boundary": "The boundary between \"valid counterfactual\" and \"contaminated replay\" is not whether the tool *can* be re-executed, but whether the re-executed call is **observationally equivalent outside the intervention set**. Operationally: - **Replay as trace (hermetic) when** the forensic question is \"what did the agent do, and why?\" — i.e., attribution of the recorded...",
    "operational_effect": "When the invariant holds, counterfactual replay becomes a sound causal instrument: each replay isolates one variable, and the divergence between replayed and recorded trajectories is attributable to the declared intervention. Incident reports can then distinguish \"the agent's policy was wrong\" from \"the tool's observation was stale\" from \"the guard masked a ..."
  },
  "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": "a350f87cac0d3a49cab7a15695ceeb45fcd2b1c145818a8199d4fc40db581791",
    "verified_classes": [
      "ReplayContamination",
      "TapeMiss",
      "ToolCall",
      "RecordedResult",
      "ContaminationLedger",
      "HermeticReplayHarness"
    ],
    "verified_functions": [
      "record",
      "non_intervention_divergences",
      "__init__",
      "_key",
      "invoke",
      "certify"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayContamination",
      "TapeMiss"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
