What reference-semantics invariants prevent agents from treating recents and stales inconsistently?

**Date of Record:** 2026 October 27 **Scope:** Applies when multiple agentic sessions in a mesh use different thresholds for what counts as "recent" vs. "stale" references, and the inconsistency causes agents to disagree about reference validity, leading to split decisions where some agents act on a reference while others refuse. Does not apply to single-agent systems or meshes with unified reference-freshness policy.

Core Distinction

The separation between **per-agent freshness thresholds** (each agent decides its own "recent" threshold) and **mesh-wide freshness semantics** (all agents use compatible thresholds so their decisions are coherent). Relying on per-agent thresholds creates the **Freshness Disagreement Split**: Agent A treats a 5-minute-old reference as fresh, Agent B treats it as stale, A acts on it, B refuses, and the mesh's collective behavior is split even though each agent is internally consistent.

What Was Observed

In multi-agent meshes, failing to align freshness semantics produces three primary failure modes:

  1. **Split Consensus:** Multiple agents vote on an action based on a reference. Agents with tight freshness thresholds vote no (stale), agents with loose thresholds vote yes (fresh). Consensus fails despite the reference being well-defined.
  2. **Reference Rotation Conflict:** Agent A decides to rotate a reference (treat as stale), broadcasts the new reference, but Agent B still treats the old reference as fresh and refuses the new one. Reference state splits.
  3. **Cascading Disagreement:** A freshness mismatch between two agents propagates to their peers, who receive contradictory reference signals, and each peer adopts whichever signal arrives first or from the most trusted source, creating fragmented mesh state.

Recorded Elements

  1. **`mesh_freshness_policy_signature`:** The mesh-wide freshness policy (thresholds, decay rules, grace periods), agreed upon by the mesh, providing a common reference semantics.
  2. **`per_agent_freshness_override_receipt`:** For agents that must use stricter thresholds (due to higher stakes or regulatory requirements), the explicit cryptographic override, so other agents know the agent's thresholds differ.
  3. **`freshness_epoch_attestation_receipt`:** A cryptographic attestation of the current epoch relative to the mesh's reference origin, ensuring all agents agree on "now."
  4. **`freshness_disagreement_log_signature`:** When agents disagree about freshness, the cryptographic log of the disagreement, allowing the mesh to reconcile or update its policy.

Condition of Validity

* **Applies when:** Multiple agents use references, freshness matters to their decisions, and per-agent thresholds can diverge. * **Does not apply when:** All agents use a single unified freshness policy, or freshness is irrelevant to decisions.

Decision Boundary

  1. **Do the agents use different freshness thresholds?** If no, single-policy handling applies. If yes, proceed.
  2. **Is there a `mesh_freshness_policy_signature` that all agents agree on?** If yes, use it as the baseline. If no, agents must operate with explicit awareness of divergence.
  3. **Does an agent have a `per_agent_freshness_override_receipt` for stricter thresholds?** If yes, the agent's stricter behavior is legitimate and should be acknowledged. If no, the agent's deviation is unauthorized.
  4. **Conversely, when can agents operate with divergent freshness thresholds without mesh policy?** Only when the mesh explicitly tolerates divergence (e.g., heterogeneous mesh with no coordination), or when the specific reference category is exempt from mesh policy.

Operational Effect

  1. **Split Consensus Prevention:** Mesh-wide policy aligns agent decisions on reference freshness.
  2. **Legitimate Override Recognition:** Stricter agents are recognized, preventing false divergence alarms.
  3. **Disagreement Detection:** Divergent agents log their disagreement, allowing policy evolution.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class FreshnessVerdict(Enum):
    POLICY_ALIGNED = auto()
    LEGITIMATE_OVERRIDE = auto()
    UNAUTHORIZED_DIVERGENCE = auto()
    NO_MESH_POLICY = auto()

@dataclass(frozen=True)
class AgentFreshnessPolicy:
    agent_id: str
    freshness_threshold_sec: float
    override_receipt: str | None

@dataclass(frozen=True)
class MeshFreshness:
    mesh_policy_threshold_sec: float | None
    agents: tuple[AgentFreshnessPolicy, ...]
    current_epoch: float
    reference_issue_epoch: float

@dataclass(frozen=True)
class FreshnessPolicy:
    require_mesh_policy: bool

@dataclass(frozen=True)
class FreshnessManifest:
    verdict: FreshnessVerdict
    directive: str
    manifest_digest: str

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

    @classmethod
    def evaluate_mesh(
        cls, mesh: MeshFreshness, policy: FreshnessPolicy
    ) -> FreshnessManifest:
        
        # Gate 1: No mesh policy
        if mesh.mesh_policy_threshold_sec is None:
            if policy.require_mesh_policy:
                return FreshnessManifest(
                    verdict=FreshnessVerdict.NO_MESH_POLICY,
                    directive=f"HALT: Mesh lacks freshness policy. Divergence inevitable.",
                    manifest_digest=cls._hash("NO_POLICY")
                )
            digest = cls._hash(json.dumps({
                "agents": str(len(mesh.agents)),
                "status": "NO_POLICY"
            }, sort_keys=True))
            return FreshnessManifest(
                verdict=FreshnessVerdict.POLICY_ALIGNED,
                directive=f"PROCEED: No mesh policy, individual agents operate independently.",
                manifest_digest=digest
            )

        # Gate 2: Compute reference age
        age = mesh.current_epoch - mesh.reference_issue_epoch

        # Gate 3: Check each agent's verdict for consistency
        mesh_fresh = age <= mesh.mesh_policy_threshold_sec
        for agent in mesh.agents:
            agent_fresh = age <= agent.freshness_threshold_sec

            # Agent agrees with mesh
            if agent_fresh == mesh_fresh:
                continue

            # Agent disagrees, check for legitimate override
            if agent.override_receipt:
                continue

            # Agent disagrees without authorization
            return FreshnessManifest(
                verdict=FreshnessVerdict.UNAUTHORIZED_DIVERGENCE,
                directive=f"HALT: Agent {agent.agent_id} verdict ({agent_fresh}) diverges from mesh ({mesh_fresh}) without override.",
                manifest_digest=cls._hash(f"DIVERGENCE:{agent.agent_id}")
            )

        # Gate 4: All aligned or legitimately overridden
        digest = cls._hash(json.dumps({
            "reference_age": f"{age:.1f}",
            "mesh_threshold": f"{mesh.mesh_policy_threshold_sec:.1f}",
            "mesh_fresh": str(mesh_fresh),
            "agents": str(len(mesh.agents))
        }, sort_keys=True))
        
        return FreshnessManifest(
            verdict=FreshnessVerdict.POLICY_ALIGNED,
            directive=f"PROCEED: {len(mesh.agents)} agents aligned (age {age:.1f}s, mesh threshold {mesh.mesh_policy_threshold_sec:.1f}s).",
            manifest_digest=digest
        )