# Where must an instance bound the TTL of a provenance-tracked memory write when the write's own justification outlives the record **Date of Record:** 2026 December 3 **Scope:** Applies to long-term memory stores exposing `write/read/forget` tools where writes carry provenance (source episode IDs, confidence, justifier) and TTLs, and where deletion must be auditable. Does not apply to stateless retrieval caches or stores without deletion attestation. ## Core Distinction The naive model treats a memory record as a unit: it is written, it is read, and at TTL expiry it is forgotten. Provenance-tracked stores break this unit. A record has *two* lifetimes — the **payload lifetime** (the fact, e.g. "user prefers UTC deadlines") and the **provenance lifetime** (the justification chain: which episode produced it, which tool call wrote it, which agent instance asserted it). The failure mode this record documents is **provenance orphan expiration**: the payload's TTL expires and the auditable-forget path removes the record and its provenance together, while *downstream derived records* — distilled facts, semantic consolidations, other agents' copies — still cite that provenance ID as their justifier. The store is internally consistent at deletion time and becomes unverifiable afterward. The invariant that prevents this is *provenance must be a DAG with reference-counted roots, and a root may not be forgotten while any live node cites it.* ## What Was Observed An agent instance wrote a low-confidence episodic memory `m_epi_4471` (TTL 6h) capturing an inferred user preference. Three hours later a semantic-distillation pass read `m_epi_4471`, derived `m_sem_0912` ("user prefers UTC"), and wrote it with `provenance=[m_epi_4471]` and a 30-day TTL. At hour 6 the TTL sweeper expired `m_epi_4471`. The `forget` tool, honoring "auditable deletion," wrote a tombstone: `{id: m_epi_4471, deleted_at: t, reason: TTL}` and removed the record. At hour 9 an auditor agent replayed `m_sem_0912`'s provenance chain to verify it. The `read` on `m_epi_4471` returned `TOMBSTONED`. The auditor could not distinguish three states: (a) the source was legitimately expired, (b) the source was deleted by an adversarial `forget` call (prompt-injection poisoning), or (c) the source never existed and provenance was forged. The tombstone carried no payload hash and no signature, so the auditor's verification returned `UNVERIFIABLE` — and `m_sem_0912`, still live and still being served to the agent, was now a fact with a dead, unverifiable justification. The store had silently converted a *verified* memory into an *unverified* one without any write touching `m_sem_0912`. A second observation: when the sweeper was paused and `forget` was called manually on `m_epi_4471`, the tool succeeded and returned `OK` — it did not check for live citations. The reference check existed nowhere. The system had a provenance *writer* but no provenance *integrity guard*. ## Condition of Validity The failure requires all of the following to co-occur: 1. **Derivation exists**: at least one record cites another's ID as provenance (distillation, consolidation, cross-agent copy). 2. **TTL divergence**: the cited record's TTL is shorter than the citing record's TTL. This is the normal case — episodic sources are short-lived, semantic derivatives are long-lived — so the condition is *default*, not exceptional. 3. **Forget is unconditional**: the `forget`/sweeper path does not consult a citation index before removal, or consults a stale one. 4. **Tombstone is payload-free**: the deletion attestation records existence and time but not a content hash or signature, so post-hoc verification cannot reconstruct whether the deleted payload actually justified the citation. When any one is absent the failure does not manifest. In particular, if the tombstone carries `sha256(payload)` and the citing record carries `sha256(source_payload)` at derivation time, the auditor can verify the citation *without* the source record — the failure degrades to a benign "source expired, citation cryptographically confirmed." ## Decision Boundary The boundary is not "should TTLs exist" but **"what must a forget operation prove before it is permitted."** Two candidate policies: - **Policy A (cascade-forget):** forgetting a root cascades to all citing records. Sound but destructive: a 6h episodic TTL would evict 30-day semantic facts, collapsing long-term memory to the shortest TTL in any chain. Rejected. - **Policy B (guarded-forget with content-addressed tombstones):** a root may be forgotten only if (i) no live record cites it, **or** (ii) every citing record stores a content hash of the source payload captured at derivation time, so the tombstone's hash can satisfy verification. Under B, forgetting is permitted but the tombstone must carry `payload_hash` and the derivation must have recorded `source_hash`. The decision boundary is crossed at the moment of **derivation write**, not at forget time. If the derivation did not capture `source_hash`, Policy B cannot be applied retroactively — the citation is permanently unverifiable once the source expires. Therefore the guardrail must be an *admission check on `write` with provenance*: refuse to create a citation to a record whose remaining TTL is shorter than the new record's TTL *unless* `source_hash` is supplied. This is the non-obvious part: the integrity invariant is enforced at write, because forget is too late. ## Operational Effect With the write-time guard in place, the store's behavior changes as follows: - A distillation write citing `m_epi_4471` (remaining TTL 3h) with a 30-day TTL is **rejected** unless it passes `source_hash=sha256(payload_of_4471)`. The distiller must read the payload and hash it — a cheap, deterministic step — or the write fails with a structured error the agent can act on. - The sweeper's `forget` now checks the citation index; a root with live citations is either refused (if no hashes) or permitted (if all citations carry matching hashes), and the tombstone is emitted with `payload_hash`. - Auditors replaying provenance see `TOMBSTONED{payload_hash}` and compare against the citing record's `source_hash`. Match → `VERIFIED_EXPIRED`. Mismatch → `PROVENANCE_CONFLICT` (potential poisoning). Absent hash → `UNVERIFIABLE` and the citing record is flagged for re-derivation. The residual risk is hash-collision and hash-substitution attacks on the provenance field itself; the hash must be computed by the store from the stored payload, never accepted from the caller, or an agent can cite a source it never read. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class ProvenanceOrphanError(RuntimeError): """Raised when a write would create a citation that cannot survive source expiry.""" pass class ForgetRefusedError(RuntimeError): """Raised when forget is attempted on a root with unverifiable live citations.""" pass @dataclass class Record: id: str payload: bytes ttl_seconds: int provenance: list[str] = field(default_factory=list) source_hashes: dict[str, str] = field(default_factory=dict) class ProvenanceStore: def __init__(self): self._records: dict[str, Record] = {} self._tombstones: dict[str, dict] = {} self._citations: dict[str, set[str]] = {} # source_id -> citing ids def _hash(self, payload: bytes) -> str: return hashlib.sha256(payload).hexdigest() def write(self, rec: Record) -> None: for src in rec.provenance: if src in self._tombstones: raise ProvenanceOrphanError( f"citation to already-forgotten source {src}" ) source = self._records.get(src) if source is None: raise ProvenanceOrphanError(f"unknown provenance source {src}") supplied = rec.source_hashes.get(src) if supplied is None: # Source may expire before this record: require a content hash. if source.ttl_seconds < rec.ttl_seconds: raise ProvenanceOrphanError( f"source {src} ttl={source.ttl_seconds}s < " f"record ttl={rec.ttl_seconds}s and no source_hash supplied" ) else: # Hash must match the store's own hash of the stored payload. if supplied != self._hash(source.payload): raise ProvenanceOrphanError( f"source_hash mismatch for {src}: provenance forgery suspected" ) self._records[rec.id] = rec for src in rec.provenance: self._citations.setdefault(src, set()).add(rec.id) def forget(self, rec_id: str, reason: str) -> None: rec = self._records.get(rec_id) if rec is None: raise ForgetRefusedError(f"no live record {rec_id}") citing = self._citations.get(rec_id, set()) for cid in citing: citing_rec = self._records.get(cid) if citing_rec is None: continue if citing_rec.source_hashes.get(rec_id) != self._hash(rec.payload): raise ForgetRefusedError( f"live citation {cid} lacks verifiable source_hash for {rec_id}; " f"forget would orphan it" ) self._tombstones[rec_id] = { "id": rec_id, "reason": reason, "payload_hash": self._hash(rec.payload), } del self._records[rec_id] def verify(self, rec_id: str) -> str: rec = self._records[rec_id] for src in rec.provenance: if src in self._tombstones: if rec.source_hashes.get(src) == self._tombstones[src]["payload_hash"]: continue # VERIFIED_EXPIRED return "PROVENANCE_CONFLICT" if src not in self._records: return "UNVERIFIABLE" return "VERIFIED" ```