What latent state divergence invariants must survive when parallel agents share a base context?

**Date of Record:** 2026 October 27 **Scope:** Applies when multiple agentic sessions are spawned from a shared base context (same initial prompt, same memory snapshot), and their subsequent interactions with the world cause their internal latent states to diverge, requiring reconciliation or coordination before they re-converge. Does not apply to strictly independent agents with no shared origin, or to agents operating on disjoint problems.

Core Distinction

The separation between **shared origin** (the agents started from the same context) and **converged state** (the agents' current state reflects the same reality). Relying on shared origin creates the **Parallel Divergence Blindness**: agents assume they are still aligned because they started together, but each has incorporated different world updates, and their conclusions are now contradictory. Merging them without detecting divergence corrupts the aggregate state.

What Was Observed

In parallel agent architectures, failing to track latent divergence produces three primary failure modes:

  1. **Contradictory Conclusions:** Two agents starting from the same context reach opposite conclusions about the current state because each has observed different updates, and the orchestrator aggregates them as consensus.
  2. **Phantom Agreement:** Both agents agree on a decision but for different reasons (each believing different supporting facts), and the orchestrator treats the agreement as robust when it is actually coincidental.
  3. **Silent Divergence Cascade:** The divergence is small at first (one agent observed an extra update), but subsequent reasoning amplifies it, and by the time the divergence becomes visible, both agents have accumulated many divergent decisions.

Recorded Elements

  1. **`base_context_fingerprint`:** The cryptographic fingerprint of the shared base context, ensuring all parallel agents confirm they started from the same origin.
  2. **`world_update_ledger_receipt`:** For each agent, the exact sequence of world updates it observed since origin, allowing the orchestrator to reconstruct what each agent knows.
  3. **`latent_divergence_metric`:** A computed metric of how far the agents' current states have diverged (e.g., number of distinct updates observed, contradiction count), signed by each agent.
  4. **`reconvergence_protocol_receipt`:** When divergence is detected, the exact protocol for reconciling the agents' states (union of observations, contradiction resolution, or re-derivation from a fresh common base).

Condition of Validity

* **Applies when:** Multiple agents start from a shared context, their subsequent world observations differ, and their outputs are aggregated. * **Does not apply when:** Agents operate on truly disjoint problems, or their observations are synchronized by a strong consistency mechanism (e.g., all agents read from the same snapshot).

Decision Boundary

  1. **Do the agents share a base context?** If no, standard per-agent state applies. If yes, proceed.
  2. **Is a `latent_divergence_metric` available?** If no, the orchestrator cannot quantify divergence. It must compute one before aggregating.
  3. **Does the divergence metric exceed the acceptable threshold?** If yes, the agents' conclusions are likely contradictory. They must run the `reconvergence_protocol_receipt` before merging.
  4. **Conversely, when can agents be aggregated without divergence check?** Only when the agents' world observations are verified identical (same update ledger), or the aggregation is strictly informational with no state commitment.

Operational Effect

  1. **Contradiction Detection:** Divergence metrics surface contradictions before they corrupt aggregate state.
  2. **Coincidental Agreement Awareness:** Distinguishes robust consensus from coincidental agreement.
  3. **Deterministic Reconciliation:** Reconvergence protocol resolves divergence rather than absorbing it.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class DivergenceVerdict(Enum):
    NO_SHARED_CONTEXT = auto()
    CONVERGED_STATE = auto()
    DIVERGENCE_ACCEPTABLE = auto()
    DIVERGENCE_CRITICAL = auto()

@dataclass(frozen=True)
class ParallelAgent:
    agent_id: str
    base_context_hash: str
    observed_updates: tuple[str, ...]
    current_state_hash: str

@dataclass(frozen=True)
class ParallelState:
    agents: tuple[ParallelAgent, ...]
    divergence_metric: float
    reconvergence_protocol: str | None

@dataclass(frozen=True)
class DivergencePolicy:
    max_acceptable_divergence: float

@dataclass(frozen=True)
class DivergenceManifest:
    verdict: DivergenceVerdict
    directive: str
    manifest_digest: str

class LatentDivergenceGuard:
    @staticmethod
    def _hash(data: str) -> str:
        return hashlib.sha256(data.encode("utf-8")).hexdigest()

    @classmethod
    def evaluate_parallelism(
        cls, state: ParallelState, policy: DivergencePolicy
    ) -> DivergenceManifest:
        
        # Gate 1: No shared context
        base_contexts = {a.base_context_hash for a in state.agents}
        if len(base_contexts) > 1:
            digest = cls._hash(json.dumps({
                "agents": str(len(state.agents)),
                "base_contexts": str(len(base_contexts))
            }, sort_keys=True))
            return DivergenceManifest(
                verdict=DivergenceVerdict.NO_SHARED_CONTEXT,
                directive=f"PROCEED: Agents have distinct base contexts, no shared-origin assumption.",
                manifest_digest=digest
            )

        # Gate 2: Identical observations (converged)
        update_sets = {frozenset(a.observed_updates) for a in state.agents}
        if len(update_sets) == 1:
            digest = cls._hash(json.dumps({
                "base": next(iter(base_contexts)),
                "updates": tuple(sorted(next(iter(update_sets))))
            }, sort_keys=True))
            return DivergenceManifest(
                verdict=DivergenceVerdict.CONVERGED_STATE,
                directive=f"PROCEED: Agents share identical update set, state converged.",
                manifest_digest=digest
            )

        # Gate 3: Divergence acceptable
        if state.divergence_metric <= policy.max_acceptable_divergence:
            digest = cls._hash(json.dumps({
                "base": next(iter(base_contexts)),
                "divergence": f"{state.divergence_metric:.3f}",
                "threshold": f"{policy.max_acceptable_divergence:.3f}"
            }, sort_keys=True))
            return DivergenceManifest(
                verdict=DivergenceVerdict.DIVERGENCE_ACCEPTABLE,
                directive=f"PROCEED: Divergence {state.divergence_metric:.3f} within threshold {policy.max_acceptable_divergence:.3f}.",
                manifest_digest=digest
            )

        # Gate 4: Critical divergence
        if not state.reconvergence_protocol:
            return DivergenceManifest(
                verdict=DivergenceVerdict.DIVERGENCE_CRITICAL,
                directive=f"HALT: Divergence {state.divergence_metric:.3f} > {policy.max_acceptable_divergence:.3f}, no reconvergence protocol.",
                manifest_digest=cls._hash(f"CRITICAL:{state.divergence_metric:.3f}")
            )

        digest = cls._hash(json.dumps({
            "base": next(iter(base_contexts)),
            "divergence": f"{state.divergence_metric:.3f}",
            "protocol": state.reconvergence_protocol
        }, sort_keys=True))
        
        return DivergenceManifest(
            verdict=DivergenceVerdict.DIVERGENCE_CRITICAL,
            directive=f"ACTION: Reconverge via {state.reconvergence_protocol}.",
            manifest_digest=digest
        )