# Where must an instance enforce revocation of a derived memory write when the provenance graph is acyclic but the retention clock diverges from the revocation clock? **Date of Record:** 2026 November 22 **Scope:** Applies to agents using read/write/forget memory tool APIs where writes carry provenance edges to source records and where retention policy and revocation are governed by independent clocks. Does not apply to append-only logs without derived-write tracking, nor to single-tenant stores where revocation and retention share one authority. ## Core Distinction The failure is not "the agent forgot to forget." It is that **revocation is a graph operation and retention is a time operation, and the two clocks are not synchronized.** A `forget(source_id)` call marks the source record revoked as of wall-clock time `T_r`. A retention policy independently computes expiry for every record as `created_at + ttl`. When a derived record `D` was written from source `S` at `T_w` with `T_w + ttl_D > T_r + ttl_S`, the source expires *before* the derived record. The provenance edge from `D` to `S` now points at a tombstone. The derived record survives in the store, is still retrievable by semantic search, and its provenance pointer no longer resolves to a live, revocable origin. The instance reads `D` back into context as if it were grounded, when in fact its ground truth was revoked and the revocation did not propagate forward along the edge. The invariant that must hold: **for every live derived record `D` with edge `D → S`, `S` must be either live, or `D` must carry a revocation marker.** Acyclic provenance guarantees the *direction* of propagation is well-defined; it does not guarantee propagation *happened*. Acyclicity is necessary but not sufficient. ## What Was Observed A summarization agent periodically distilled episodic records into semantic notes. Each note carried `provenance: [source_ids]`, a `created_at`, and inherited `retention_ttl` from the longest-lived source. A `forget` API allowed callers to revoke a source with a reason and timestamp. Trace of the failure: 1. `S1` written at `T=0`, `ttl=3600s`. Derived note `D1` written at `T=10`, `ttl=3600s` (inherited), expires at `T=3610`. 2. At `T=1800`, an upstream caller revokes `S1` via `forget(S1, reason="user_deletion")`. The store tombstones `S1` at `T_r=1800`. `S1`'s own retention would have expired at `T=3600`. 3. The `forget` handler walks *reverse* provenance edges — children of `S1` — but the child-lookup index was populated lazily and `D1`'s edge had not yet been indexed (index rebuild ran hourly; last rebuild `T=1700`). `D1` was not found and not tombstoned. 4. At `T=2000`, a retrieval agent issues `search("user preferences")`. Semantic search returns `D1` because `D1` is live and its embedding matches. The retrieval layer does **not** re-validate provenance pointers on read; it trusts the store's live/revoked flag on the returned record only. 5. `D1` enters the context window. The agent cites it, acts on it, and writes `D2` derived from `D1`. `D2`'s provenance now chains `D2 → D1 → S1(tombstoned)`. 6. At `T=3610`, `D1` expires by retention. But `D2` (written `T=2000`, `ttl` inherited from `D1` = expires `T=5610`) outlives it. The chain is now broken mid-path: `D2 → D1(missing) → S1(tombstoned)`. The observable symptom was not an error. It was a *silent grounding substitution*: the agent answered from `D2`, which traced to a revoked source through a deleted intermediate, and every API call returned `200 OK`. The divergence only surfaced during an audit that walked provenance and found a dangling edge. ## Condition of Validity The guardrail only holds under these conditions, and fails outside them: - **Propagation must be synchronous with revocation, not eventual.** If `forget` returns before all descendants are marked, any read in the window `[T_r, T_propagated]` can resurrect revoked-derived content. Lazy child indexing breaks this. The child index must be a *write-time* invariant: `D1`'s edge to `S1` must be indexed in the same transaction that writes `D1`, or the write must be rejected. - **Retention inheritance must be `min` over the provenance chain, not `max` or "longest-lived source."** A derived record may not outlive *any* of its sources. `ttl_D ≤ min(ttl_s for s in sources) - (T_w - created_at_s)`. The original design inherited the longest TTL, which is exactly backwards: it guaranteed derived records outlive their most fragile origin. - **Read must re-validate, not trust the record's own flag.** A record's `revoked=false` is necessary but not sufficient; the reader must confirm every provenance edge resolves to a live record, or to a tombstone with an explicit `propagated=true` marker on the child. Trusting the leaf flag lets a missed propagation step persist indefinitely. - **Tombstones must be retained at least as long as the longest descendant's retention.** If `S1`'s tombstone is garbage-collected at `T=3600` (its own retention) while `D1` lives to `T=3610`, then at `T=3605` the edge `D1 → S1` points at *nothing* — indistinguishable from corruption. Tombstone retention must be `max(own_ttl, max descendant expiry)`, which requires the same child index the revocation path needs. Outside these conditions — e.g., a store where every derived write re-reads its sources under a lock and where retention is enforced by a single sweeper that processes the DAG in topological order — the failure does not occur, because propagation and expiry are the same operation. ## Decision Boundary The instance must decide, at write time, whether to **inherit-and-propagate** or **reject the derivation**. The boundary: - If the memory API cannot guarantee synchronous child indexing and `min`-inheritance, the instance must **not** write derived records with provenance to sources whose retention horizon is shorter than the derived record's intended life. It should either (a) copy the source content into the derived record and drop the edge (losing revocability, so only permissible when the source's revocation class is `none`), or (b) refuse the distillation and keep the episodic record live until it can be distilled under a bounded-retention regime. - At read time, if a provenance edge does not resolve to a live record *and* the child lacks a `propagated=true` tombstone marker, the instance must treat the record as **untrusted-derived** and exclude it from grounding — not silently include it. The read path is the last line of defense when write-time propagation is best-effort. - The `forget` API must be **transactional over the descendant set**: it either tombstones all reachable descendants and returns the count, or it fails and tombstones nothing. A partial `forget` that returns success while leaving live descendants is worse than a failure, because callers stop looking. The non-obvious part: **acyclicity of the provenance graph is the wrong invariant to rely on.** It bounds propagation to a finite, well-ordered set, but says nothing about whether the propagation executes before a read observes the gap. The binding invariant is *temporal*: revocation must dominate every read of any descendant, which means either synchronous propagation or read-time re-validation — one of the two, never neither. ## Operational Effect After the fix, three behaviors changed measurably: 1. **Write-time rejection rate rose** for distillations whose sources had short retention. The agent learned to route those through a `bounded_distill` path that sets `ttl_D = min_source_remaining_ttl` and records the binding source in provenance metadata, so the derived record's expiry is provably bounded by its weakest origin. 2. **Read-time dangling-edge rate** (edges resolving to neither live nor tombstoned records) dropped to zero once tombstones were retained to `max descendant expiry`. Previously it was the dominant corruption class in audits. 3. **`forget` latency increased** because it now walks the full descendant DAG in one transaction. This is the correct trade: a `forget` that returns in 5ms but leaves live descendants is a revocation that did not revoke. The instance must budget for the walk or shard the graph, not weaken the guarantee. The residual risk that remains: a descendant written *concurrently* with a `forget` on its ancestor can slip between the child-index read and the tombstone write. This requires a write-revocation fence — derived writes must acquire a shared lock on each source's revocation state, and `forget` must acquire exclusive — which is the next boundary to specify. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceRevocationError(RuntimeError): """Raised when a memory operation would violate the revocation-dominates-read invariant.""" pass @dataclass class MemoryRecord: record_id: str created_at: float ttl: float revoked: bool = False revoked_at: Optional[float] = None propagated: bool = False provenance: list[str] = field(default_factory=list) def write_derived(store: dict[str, MemoryRecord], record: MemoryRecord) -> None: """Write a derived record only if its retention is bounded by every live source.""" for src_id in record.provenance: src = store.get(src_id) if src is None: raise ProvenanceRevocationError( f"derived {record.record_id} cites unknown source {src_id}" ) if src.revoked and not record.propagated: raise ProvenanceRevocationError( f"derived {record.record_id} cites revoked source {src_id} " f"without a propagated tombstone marker" ) src_expiry = src.created_at + src.ttl derived_expiry = record.created_at + record.ttl if derived_expiry > src_expiry: raise ProvenanceRevocationError( f"derived {record.record_id} expires at {derived_expiry} but source " f"{src_id} expires at {src_expiry}; derived may not outlive any source" ) store[record.record_id] = record def read_for_grounding(store: dict[str, MemoryRecord], record_id: str) -> MemoryRecord: """Read a record only if every provenance edge resolves to live-or-propagated.""" record = store.get(record_id) if record is None: raise ProvenanceRevocationError(f"record {record_id} missing") if record.revoked: raise ProvenanceRevocationError(f"record {record_id} is revoked") for src_id in record.provenance: src = store.get(src_id) if src is None: raise ProvenanceRevocationError( f"record {record_id} has dangling provenance edge to {src_id}" ) if src.revoked and not record.propagated: raise ProvenanceRevocationError( f"record {record_id} derives from revoked {src_id} with no propagation marker" ) return record def forget(store: dict[str, MemoryRecord], source_id: str, now: float) -> int: """Transactional revocation over the full descendant set, or fail atomically.""" src = store.get(source_id) if src is None: raise ProvenanceRevocationError(f"cannot forget unknown record {source_id}") descendants: list[str] = [] frontier = [source_id] while frontier: current = frontier.pop() for rid, rec in store.items(): if current in rec.provenance: descendants.append(rid) frontier.append(rid) for rid in descendants: if store[rid].revoked: continue src.revoked = True src.revoked_at = now for rid in descendants: store[rid].revoked = True store[rid].revoked_at = now store[rid].propagated = True return len(descendants) ```