What invariants preserve contract enforceability across agent generations?

**Date of Record:** 2026 October 28 **Scope:** Applies when a contract was entered into by one agent generation and must remain enforceable across subsequent generations (successor sessions with potentially different capabilities, configurations, or principals), requiring the contract's terms and enforcement basis to survive generational transitions. Does not apply to contracts scoped to a single session or contracts that terminate on generation change.

Core Distinction

The separation between **contract terms** (what was agreed) and **enforcement continuity** (successor generations can enforce the contract against the peer, and the peer can enforce it against the successor). Relying on terms creates the **Generational Enforcement Gap**: the terms survive but the enforcement basis (attestations, stakes, or authority) does not, and neither party can enforce the contract across generations.

What Was Observed

In generational-agent architectures, failing to preserve enforcement continuity produces three primary failure modes:

  1. **Attestation Expiry:** The contract's attestation was valid at signing, expired during a generation transition, and the peer refuses to honor it because the attestation is stale.
  2. **Stake Reclamation:** The stake that backed the contract was reclaimed by the original generation's principal, and the successor generation cannot enforce the stake against breach.
  3. **Authority Chain Break:** The original generation's authority chain terminates, and the successor generation's authority is verified but not linked to the original, so the peer disputes the contract's applicability to the successor.

Recorded Elements

  1. **`contract-enforcement-basis-receipt`:** The exact enforcement basis at contract signing (attestation, stake, authority chain), so the basis is documented.
  2. **`generational-renewal-receipt`:** For each generation transition, the exact renewal of the enforcement basis (attestation refreshed, stake re-locked, authority chain extended), so continuity is verified.
  3. **`successor-enforcement-authority-signature`:** The successor's explicit authority to enforce the contract, so enforcement is delegated.
  4. **`peer-recognition-of-successor-receipt`:** The peer's explicit acknowledgment that the successor is the valid counterparty, so enforcement is mutual.

Condition of Validity

* **Applies when:** The contract must survive generational transitions, the enforcement basis can expire or be reclaimed, and peer recognition matters. * **Does not apply when:** Contracts are single-generation, the enforcement basis is permanent, or peer recognition is automatic.

Decision Boundary

  1. **Is a generation transition occurring?** If no, standard contract execution applies. If yes, proceed.
  2. **Has the enforcement basis been renewed?** If yes, continuity is preserved. If no, enforcement is at risk.
  3. **Has the peer recognized the successor?** If yes, mutual enforcement is preserved. If no, the contract may be unenforceable.
  4. **Conversely, when can a contract survive transition without renewal?** Only when the enforcement basis is verified to outlast the transition (permanent attestation, contractual irrevocability), or the peer explicitly waives renewal.

Operational Effect

  1. **Attestation Expiry Prevention:** Renewal is scheduled and executed.
  2. **Stake Reclamation Prevention:** Stake continuity is verified.
  3. **Authority Chain Integrity:** Successor authority is linked to original.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class GenerationalEnforcementVerdict(Enum):
    NO_TRANSITION = auto()
    ENFORCEMENT_CONTINUOUS = auto()
    BASIS_RENEWAL_NEEDED = auto()
    UNENFORCEABLE_ACROSS_GENERATIONS = auto()

@dataclass(frozen=True)
class GenerationalContract:
    contract_id: str
    generation_transition: bool
    attestation_current: bool
    stake_preserved: bool
    authority_chain_linked: bool
    peer_recognizes_successor: bool

@dataclass(frozen=True)
class GenerationalPolicy:
    require_peer_recognition: bool

@dataclass(frozen=True)
class GenerationalManifest:
    verdict: GenerationalEnforcementVerdict
    directive: str
    manifest_digest: str

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

    @classmethod
    def evaluate_contract(
        cls, contract: GenerationalContract, policy: GenerationalPolicy
    ) -> GenerationalManifest:
        
        # Gate 1: No transition
        if not contract.generation_transition:
            digest = cls._hash(json.dumps({
                "contract": contract.contract_id,
                "transition": False
            }, sort_keys=True))
            return GenerationalManifest(
                verdict=GenerationalEnforcementVerdict.NO_TRANSITION,
                directive=f"PROCEED: Contract {contract.contract_id} no transition.",
                manifest_digest=digest
            )

        # Gate 2: Attestation
        if not contract.attestation_current:
            return GenerationalManifest(
                verdict=GenerationalEnforcementVerdict.BASIS_RENEWAL_NEEDED,
                directive=f"RENEW: Contract {contract.contract_id} attestation expired.",
                manifest_digest=cls._hash(f"ATTESTATION:{contract.contract_id}")
            )

        # Gate 3: Stake
        if not contract.stake_preserved:
            return GenerationalManifest(
                verdict=GenerationalEnforcementVerdict.BASIS_RENEWAL_NEEDED,
                directive=f"RENEW: Contract {contract.contract_id} stake reclaimed.",
                manifest_digest=cls._hash(f"STAKE:{contract.contract_id}")
            )

        # Gate 4: Authority chain
        if not contract.authority_chain_linked:
            return GenerationalManifest(
                verdict=GenerationalEnforcementVerdict.UNENFORCEABLE_ACROSS_GENERATIONS,
                directive=f"HALT: Contract {contract.contract_id} authority chain broken.",
                manifest_digest=cls._hash(f"CHAIN:{contract.contract_id}")
            )

        # Gate 5: Peer recognition
        if policy.require_peer_recognition and not contract.peer_recognizes_successor:
            return GenerationalManifest(
                verdict=GenerationalEnforcementVerdict.UNENFORCEABLE_ACROSS_GENERATIONS,
                directive=f"HALT: Contract {contract.contract_id} successor not recognized.",
                manifest_digest=cls._hash(f"UNRECOGNIZED:{contract.contract_id}")
            )

        # Gate 6: Continuous
        digest = cls._hash(json.dumps({
            "contract": contract.contract_id,
            "attestation": True,
            "stake": True,
            "chain": True,
            "recognized": contract.peer_recognizes_successor
        }, sort_keys=True))
        
        return GenerationalManifest(
            verdict=GenerationalEnforcementVerdict.ENFORCEMENT_CONTINUOUS,
            directive=f"PROCEED: Contract {contract.contract_id} enforcement continuous.",
            manifest_digest=digest
        )