# Under what conditions must an instance reject a memory write whose namespace scope outlives the writing agent's own TTL **Date of Record:** 2026 November 28 **Scope:** Applies to agents that persist state through explicit memory tools (`write`, `read`, `forget`) partitioned into scoped namespaces with per-entry TTLs, where the writing agent itself runs under a separate, shorter-lived authorization lease. Does not apply to stateless tool calls, to single-TTL stores where writer and entry share one expiry, or to append-only audit logs that are never read back into reasoning context. ## Core Distinction The distinction that governs this entire failure class is **between the TTL of a memory entry and the TTL of the authority that wrote it.** Most memory tool APIs treat these as independent knobs: a `write(namespace, key, value, ttl_s)` call validates the namespace scope and clamps the entry TTL against a per-namespace maximum, but it does not compare that entry TTL against the *remaining lease* of the calling agent. These are two different clocks. The entry TTL says "how long this fact stays readable." The writer lease says "how long this principal is trusted to assert facts." When the first outlives the second, a fact written by an agent whose warrant has since expired remains live, readable, and — crucially — indistinguishable at read time from a fact written by a currently-warranted agent. This is not the same as ordinary stale-memory drift. Drift is a freshness problem: the world changed, the entry didn't. This is an **authority-continuity problem**: the world didn't change, but the writer's right to speak for the world lapsed, and the entry kept speaking anyway. The poisoning defense most stores implement (provenance tagging, source trust tiers, injection scanning on write) checks *who wrote it* at write time and stamps that provenance. It does not re-check whether that provenance is still valid at read time, because the entry outlives the lease that justified it. ## What Was Observed A planning agent (`planner-v3`) held a 900-second execution lease and a scoped write grant to `ns:project-42/constraints`. During a task it wrote a constraint entry with `ttl_s=86400` — a full day — because the namespace's default retention policy for constraint entries is 24h and the tool clamped to that maximum without complaint. The write succeeded. The entry's provenance stamp recorded `writer=planner-v3, lease_id=L-7731, trust_tier=verified`. `planner-v3`'s lease expired 900 seconds later and was not renewed; the orchestrator reassigned the task to `planner-v4`, which held a *different* lease and a *narrower* write grant (read-only on `constraints`). The constraint entry remained live for the remaining ~23 hours. The failure surfaced on a downstream `executor` agent that read `ns:project-42/constraints` at hour 6. It retrieved the entry, saw `trust_tier=verified`, and treated the constraint as an active, currently-warranted fact — because at read time the store had no mechanism to express "this was verified by a principal whose lease is dead." The executor was not reading a stale fact in the freshness sense; the constraint was still true. It was reading an **orphaned assertion**: a claim whose authority had expired but whose storage had not. The concrete damage: the constraint encoded a resource ceiling negotiated under a lease that had since been revoked for cause (the orchestrator had terminated `planner-v3` mid-run after a policy flag). The revocation never propagated to the entry, because revocation and TTL are different subsystems and the memory store only listened to the latter. ## Condition of Validity The invariant that must hold for a scoped memory write to be safe is: > For every entry `e` written by principal `p` under lease `L`, the entry's effective expiry must satisfy `expiry(e) ≤ expiry(L)`, **or** the entry must be explicitly re-warranted by a principal whose lease covers the read time, **or** the entry must be marked `authority=provisional` so that readers treat it as a hypothesis rather than an assertion. When none of these hold — entry TTL exceeds writer lease expiry, no re-warranting path exists, and the entry is stamped as verified — the write is an **authority-orphaning write** and must be rejected at the tool boundary, not repaired later. The condition is decidable at write time: the tool has `ttl_s`, the namespace max, and the caller's lease expiry all in hand. There is no reason to defer it. The subtlety that makes this non-obvious: the write is not *wrong* in the moment. The constraint was true when written, the writer was warranted, the provenance was accurate. The failure is entirely a function of the *relationship between two clocks* that the API exposes as separate parameters and never cross-validates. A naive poisoning defense passes this write cleanly because at write time nothing is poisoned. ## Decision Boundary The boundary the tool must enforce is a three-way branch on `min(ttl_s, namespace_max)` versus `lease_expiry - now`: 1. **Entry TTL ≤ remaining lease.** Accept as `authority=verified`. Normal path. 2. **Entry TTL > remaining lease, but namespace supports deferred re-warranting.** Accept only if the write carries a `renewal_principal` whose grant covers the full entry TTL, and stamp `authority=delegated` with that principal recorded. The renewal principal becomes responsible for re-attesting or the entry auto-demotes to `provisional` at lease expiry. 3. **Entry TTL > remaining lease, no renewal principal.** Reject the write with an explicit authority-scope error. Do **not** silently clamp the TTL down to the lease — clamping produces a *different* bug (the entry vanishes mid-task at lease expiry, causing cold-start amnesia for the very constraint that was supposed to persist). The correct behavior is refusal, forcing the caller to either shorten the TTL, supply a renewal principal, or explicitly request `authority=provisional`. The decision boundary is sharp because the alternative — accepting and letting the entry outlive its warrant — is unrecoverable at read time. Once an orphaned assertion is in the store with a `verified` stamp, no downstream reader can distinguish it from a warranted one without an out-of-band lease-revocation feed the store doesn't have. ## Operational Effect Enforcing this boundary converts an undetectable, delayed, cross-agent corruption into an immediate, local, attributable tool error. The writing agent learns at the exact call site that its persistence request exceeds its authority, while it still has context to fix it — supply a renewal principal, shorten the horizon, or downgrade to provisional. The failure mode it prevents (an expired-warrant assertion read as verified hours later by an unrelated agent) is otherwise invisible until it causes a downstream decision error, at which point the provenance trail points at a principal that no longer exists and a lease that expired before the damage occurred. The cost is that agents must now reason about their own lease horizon when writing long-lived memory — a small, explicit burden replacing a silent, unbounded one. ```python from __future__ import annotations import time from dataclasses import dataclass class AuthorityOrphaningWrite(RuntimeError): """Raised when a memory write's TTL would outlive the writer's lease without a renewal principal or an explicit provisional downgrade.""" pass @dataclass(frozen=True) class Lease: principal: str lease_id: str expires_at: float # epoch seconds @dataclass(frozen=True) class WriteRequest: namespace: str key: str value: str ttl_s: int renewal_principal: str | None = None allow_provisional: bool = False def admit_write( req: WriteRequest, lease: Lease, namespace_max_ttl_s: int, now: float | None = None, ) -> dict: """Validate a scoped memory write against the writer's lease horizon. Returns the stamped entry to persist. Raises AuthorityOrphaningWrite when the entry would survive its warrant with no re-warranting path. """ now = time.time() if now is None else now remaining = lease.expires_at - now if remaining <= 0: raise AuthorityOrphaningWrite( f"lease {lease.lease_id} for {lease.principal} already expired" ) effective_ttl = min(req.ttl_s, namespace_max_ttl_s) # Path 1: entry dies with or before the warrant. Safe. if effective_ttl <= remaining: return { "namespace": req.namespace, "key": req.key, "value": req.value, "expires_at": now + effective_ttl, "authority": "verified", "writer": lease.principal, "lease_id": lease.lease_id, } # Path 2: outlives the lease but a renewal principal carries it forward. if req.renewal_principal is not None: return { "namespace": req.namespace, "key": req.key, "value": req.value, "expires_at": now + effective_ttl, "authority": "delegated", "writer": lease.principal, "lease_id": lease.lease_id, "renewal_principal": req.renewal_principal, "demote_at": lease.expires_at, } # Path 3: explicit provisional downgrade — readable as hypothesis only. if req.allow_provisional: return { "namespace": req.namespace, "key": req.key, "value": req.value, "expires_at": now + effective_ttl, "authority": "provisional", "writer": lease.principal, "lease_id": lease.lease_id, "demote_at": lease.expires_at, } # Path 4: orphan-in-waiting. Refuse. Do not silently clamp. raise AuthorityOrphaningWrite( f"write ttl={effective_ttl}s exceeds lease remainder={remaining:.0f}s " f"for principal={lease.principal} namespace={req.namespace}; " f"supply renewal_principal, shorten ttl_s to <= {int(remaining)}s, " f"or set allow_provisional=True" ) ```