What memory invariants must survive the expiration of a multi-jurisdictional data sharing agreement?

**Date of Record:** 2026 October 27 **Scope:** Applies when an agentic session persists state derived from data shared under a multi-jurisdictional agreement (e.g., a cross-border data transfer agreement, a research consortium agreement, or a temporary B2B data partnership), and the agreement expires, requiring the data to be quarantined or deleted per its terms. Does not apply to agreements with indefinite terms or agreements that grant perpetual rights.

Core Distinction

The separation between **agreement validity** (the agreement is currently in force) and **agreement expiry enforcement** (the memory layer automatically quarantines or deletes data when the agreement expires). Relying on validity alone creates the **Expiration Leakage Hazard**: the agreement expires, but the data remains in active memory, and the agent's successors continue to access it as if the agreement were still in force, violating the agreement's terms and risking regulatory penalties.

What Was Observed

In multi-jurisdictional data-sharing architectures, failing to enforce agreement expiration produces three primary failure modes:

  1. **Continued Access Post-Expiry:** The agreement expires at midnight, but the memory layer has no TTL. Successor agents continue querying the data, and the partners discover the violation.
  2. **Audit Trail Gaps:** The agreement expires, but the memory layer has no record that the data was quarantined, so an audit cannot distinguish "data was properly handled" from "data was accessed post-expiry."
  3. **Jurisdictional Conflict:** The data was shared under EU-GDPR-compliant terms, but post-expiry it remains accessible, and the sharing party's jurisdiction requires data to be deleted within X days of expiry. The agent violates foreign law.

Recorded Elements

  1. **`agreement_ttl_epoch`:** The exact epoch at which the agreement expires, stored alongside every piece of shared data.
  2. **`post_expiry_disposition_policy`:** The exact action required at expiry (e.g., `QUARANTINE`, `DELETE`, `ANONYMIZE`), derived from the agreement terms.
  3. **`quarantine_receipt`:** A cryptographic proof that the data was quarantined/deleted at the exact expiry epoch, satisfying audit requirements.
  4. **`data_access_pre_expiry_hash`:** The hash of the data at the last valid epoch, allowing the agent to prove what state was shared before expiry.

Condition of Validity

* **Applies when:** The data is shared under a time-limited agreement, the terms require post-expiry handling (quarantine, deletion, or anonymization), and the memory layer persists the data beyond the agreement duration. * **Does not apply when:** The agreement grants perpetual rights, or the data is strictly ephemeral and never persisted.

Decision Boundary

  1. **Is the data governed by a time-limited agreement?** If no, standard retention applies. If yes, proceed.
  2. **Is the `agreement_ttl_epoch` recorded on every piece of shared data?** If no, expiration cannot be enforced. The agent must tag all data with its TTL.
  3. **Has the `quarantine_receipt` been recorded after the TTL epoch?** If no, the data may still be accessible, violating the agreement.
  4. **Conversely, when can data survive an expired agreement?** Only when the agreement explicitly grants a post-expiry retention period (e.g., "data may be retained for 30 days post-expiry for audit purposes"), and the extended period is cryptographically recorded.

Operational Effect

  1. **Compliance Enforcement:** Automatically enforces agreement expiration, preventing post-expiry violations.
  2. **Audit Integrity:** Provides cryptographic proof of post-expiry handling, satisfying regulatory audits.
  3. **Jurisdictional Safety:** Prevents the agent from retaining data longer than allowed under the sharing party's jurisdiction.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class DispositionAction(Enum):
    QUARANTINE = auto()
    DELETE = auto()
    ANONYMIZE = auto()

class ExpirationVerdict(Enum):
    AGREEMENT_ACTIVE = auto()
    EXPIRY_HANDLED = auto()
    EXPIRY_VIOLATION = auto()

@dataclass(frozen=True)
class SharedData:
    data_id: str
    agreement_ttl_epoch: float
    post_expiry_disposition: DispositionAction
    quarantine_receipt: str | None
    current_epoch: float

@dataclass(frozen=True)
class ExpirationPolicy:
    require_quarantine_receipt: bool

@dataclass(frozen=True)
class ExpirationManifest:
    verdict: ExpirationVerdict
    directive: str
    manifest_digest: str

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

    @classmethod
    def evaluate_data(
        cls, data: SharedData, policy: ExpirationPolicy
    ) -> ExpirationManifest:
        
        # Gate 1: Agreement still active
        if data.current_epoch < data.agreement_ttl_epoch:
            digest = cls._hash(json.dumps({
                "data": data.data_id,
                "ttl": f"{data.agreement_ttl_epoch:.0f}",
                "epoch": f"{data.current_epoch:.0f}"
            }, sort_keys=True))
            return ExpirationManifest(
                verdict=ExpirationVerdict.AGREEMENT_ACTIVE,
                directive=f"PROCEED: Agreement active until {data.agreement_ttl_epoch:.0f}.",
                manifest_digest=digest
            )

        # Gate 2: Expiry handled
        if data.quarantine_receipt:
            digest = cls._hash(json.dumps({
                "data": data.data_id,
                "disposition": data.post_expiry_disposition.name,
                "receipt": data.quarantine_receipt,
                "expiry": f"{data.agreement_ttl_epoch:.0f}"
            }, sort_keys=True))
            return ExpirationManifest(
                verdict=ExpirationVerdict.EXPIRY_HANDLED,
                directive=f"PROCEED: Data {data.post_expiry_disposition.name} at expiry with receipt.",
                manifest_digest=digest
            )

        # Gate 3: Violation
        return ExpirationManifest(
            verdict=ExpirationVerdict.EXPIRY_VIOLATION,
            directive=f"HALT: Agreement expired at {data.agreement_ttl_epoch:.0f}, but no quarantine receipt. Data still accessible.",
            manifest_digest=cls._hash(f"VIOLATION:{data.data_id}")
        )