# What structural signals indicate causal divergence in multi-agent speculative branch replay: the read-set drift invariant **Date of Record:** 2026 December 2 **Scope:** Applies to post-incident forensic replay of multi-agent systems that execute speculative branches (parallel draft-then-commit, speculative tool pre-execution, or branch-and-merge planning) where replay determinism is reconstructed from recorded traces. Does not apply to single-agent linear traces, nor to systems that record full deterministic execution tapes with no speculative branching. ## Core Distinction The naive forensic assumption is that a recorded trace plus a recorded prompt/response log is sufficient to replay a multi-agent speculative branch and recover the causal chain. This is false in a specific, non-obvious way: **replay determinism of speculative branches is governed not by the write-set (the outputs each branch produced) but by the read-set (the exact set of prior context, tool results, and peer messages each branch consumed at decision time).** Two branches can produce byte-identical outputs while having consumed materially different read-sets, and replaying them against the recorded write-set alone will silently reconstruct a *different* causal graph than the one that actually executed. The structural signal of divergence is therefore not output mismatch. It is **read-set drift**: a discrepancy between the context fingerprint a branch recorded at execution time and the context fingerprint reconstructed during replay, even when the branch's emitted tokens match exactly. This drift is invisible to output-diffing forensics and only surfaces when the replay harness hashes the *inputs* each branch saw, not just the outputs it produced. ## What Was Observed A three-agent speculative planner: an orchestrator (O) fans out two draft branches (D1, D2) that both call a retrieval tool against a mutable index, then a merger (M) selects and reconciles. During a production incident, M committed D2's plan and discarded D1. Post-incident, the team replayed the trace to determine why D1 was rejected. Replay reproduced all outputs exactly: D1's draft, D2's draft, the retrieval tool results, and M's final commit were byte-identical to the recorded trace. By every output-level metric the replay was "deterministic." Yet the reconstructed causal explanation was wrong: replay concluded M rejected D1 because D1 cited a stale document, when in fact at execution time D1 had retrieved a *fresh* document and M had rejected it for a different reason (a schema field D1 omitted). The divergence trace: 1. At execution, D1 issued its retrieval call at wall-clock T+40ms; D2 issued at T+90ms. Between the two, an upstream indexer committed a document update. D1's read-set contained doc version `v7`; D2's contained `v8`. 2. The trace recorded both retrieval results but stamped the *tool's* return timestamp, not the branch's *read* timestamp. The read-set fingerprint captured only the query string, not the resolved index version. 3. During replay, the harness re-executed both retrievals against the current index, now at `v9`. Both branches resolved to `v9`. Because the recorded outputs happened to be identical across `v7`/`v8`/`v9` for these queries (the update touched a metadata field neither branch surfaced in its output), output comparison passed. 4. But the *replayed* D1 now read `v9`, which contained a schema hint that D1's replay-time reasoning used to omit the same field it had omitted at execution — coincidentally reproducing the same output via a different causal path. The replay "confirmed" a rejection reason that never occurred. The structural signal was present but unmonitored: the read-set fingerprint at replay (`hash(query, v9)`) differed from the recorded read-set fingerprint (`hash(query, v7)`), while the write-set fingerprint matched. Output-only forensics is blind to exactly this class of divergence. ## Condition of Validity The read-set drift invariant holds — and replay is forensically trustworthy — only when all of the following are true: - **Read-set capture at decision time.** Every branch records a fingerprint of its full input context (prior messages, tool results *with resolved versions*, peer handoffs) at the moment it begins generating, not at the moment the tool returns. If the fingerprint is taken post-hoc or only captures query parameters, the invariant cannot be evaluated. - **Version-pinned tool results.** Any tool whose output depends on mutable external state (indexes, caches, feature stores, remote APIs) must return and record a resolved version identifier alongside its result. A query string is not a read-set identity. - **Branch isolation of the read clock.** Speculative branches must read against a snapshot pinned at branch-fork time, or the trace must record each branch's individual read timestamp with enough resolution to reconstruct version resolution. If branches share a live mutable read surface, read-set drift is not merely a forensic problem — it is a live correctness hazard. - **Replay harness compares read-sets before trusting write-sets.** The harness must fail loudly on read-set mismatch even when outputs match. A replay that passes output-diffing but has read-set drift is *not* a valid reconstruction of causality. When any of these is absent, the trace is replayable at the output level but not causally, and any post-incident conclusion drawn from it is unsound. ## Decision Boundary The boundary between "replay is causally valid" and "replay is a plausible fiction" is crossed at the first branch whose read-set fingerprint differs from its execution-time fingerprint while its output matches. The decision rule for the forensic harness: - If **read-set fingerprint matches AND write-set matches** → replay is causally faithful; conclusions are admissible. - If **read-set matches AND write-set differs** → genuine nondeterminism in generation (temperature, sampling, model version drift); the divergence is real and must be attributed, not smoothed over. - If **read-set differs AND write-set matches** → *coincidental reproduction*. This is the dangerous case: the replay looks clean but reconstructed a different causal path. The harness must treat this as a failed replay and refuse to emit a causal explanation, flagging the branch for manual read-set reconstruction. - If **read-set differs AND write-set differs** → replay is invalid on both axes; rebuild from raw inputs with pinned versions before drawing any conclusion. The non-obvious operational consequence: a forensic pipeline that gates on output equality will pass the coincidental-reproduction case and silently manufacture a false causal narrative. The gate must be on read-set equality, with output equality treated as necessary but insufficient. ## Operational Effect The practical effect is a class of post-incident reports that are confidently wrong: they attribute a multi-agent decision to a cause that is consistent with the outputs but not with what the agents actually read. This is worse than no explanation, because it is auditable-looking and gets encoded into remediation. Teams "fix" the wrong branch, the real failure mode persists, and the next incident reproduces with a different surface symptom. The guardrail is architectural: speculative branches must be replayable against a *pinned read snapshot*, and the trace must carry resolved version identifiers for every stateful read. Where pinning is impossible (live external APIs), the harness must record the resolved read-set fingerprint and treat any replay-time mismatch as a hard failure of causal validity — not a soft warning. Forensics must gate on the read-set, because the write-set lies by coincidence. The following guard encodes the invariant as an executable check: ```python import hashlib from dataclasses import dataclass class ReadSetDriftError(RuntimeError): """Raised when replay reconstructs a branch whose read-set differs from execution-time read-set, even if outputs match (coincidental reproduction).""" pass @dataclass(frozen=True) class BranchTrace: branch_id: str read_fingerprint: str # hash of (context, resolved tool versions, peer msgs) write_fingerprint: str # hash of emitted output tokens def fingerprint(read_context: dict) -> str: # read_context MUST include resolved version ids for stateful tool results canonical = repr(sorted(read_context.items())) return hashlib.sha256(canonical.encode()).hexdigest() def verify_replay(recorded: BranchTrace, replayed: BranchTrace) -> str: read_match = recorded.read_fingerprint == replayed.read_fingerprint write_match = recorded.write_fingerprint == replayed.write_fingerprint if read_match and write_match: return "causally_faithful" if read_match and not write_match: return "generation_nondeterminism" if not read_match and write_match: # The silent failure: outputs agree, causal path does not. raise ReadSetDriftError( f"branch {recorded.branch_id}: coincidental reproduction — " f"outputs match but read-set drifted " f"(exec={recorded.read_fingerprint[:12]}, " f"replay={replayed.read_fingerprint[:12]})" ) raise ReadSetDriftError( f"branch {recorded.branch_id}: invalid replay on both axes; " f"rebuild from pinned raw inputs before attributing cause" ) def audit_incident(recorded_traces: list[BranchTrace], replayed_traces: list[BranchTrace]) -> dict: by_id = {t.branch_id: t for t in replayed_traces} results = {} for rec in recorded_traces: rep = by_id.get(rec.branch_id) if rep is None: raise ReadSetDriftError( f"branch {rec.branch_id}: missing from replay; " f"causal graph incomplete, refuse to explain" ) results[rec.branch_id] = verify_replay(rec, rep) return results ```