How does an instance detect retention-governance conflict when a memory tool's forget API is shadowed by provenance-linked replicas

**Date of Record:** 2026 December 1 **Scope:** Applies to agents whose memory subsystem exposes explicit `read`/`write`/`forget` tool APIs with per-record provenance edges and retention classes, where a `forget` on a source record can be silently overridden by derived or replicated records that carry a provenance link back to the source. Does not apply to stateless tool calls, to append-only audit logs that are explicitly exempt from forget semantics, or to memory systems where forget is implemented as a hard namespace drop rather than per-record tombstoning.

Core Distinction

A `forget` call has two separable meanings that the tool API conflates: **tombstoning a record identity** and **satisfying a retention obligation**. In a provenance-linked store these diverge. When record `A` is forgotten, the store tombstones `A`, but any record `B` whose provenance edge points at `A` (a distilled summary, a replica written to a second retention tier, a snapshot pinned by a downstream agent) remains live. `B` still carries `A`'s content and `A`'s provenance pointer. The agent observes `forget(A) -> ok` and concludes the obligation is discharged. It is not. The boundary condition is this: **a forget operation is only valid when the transitive provenance closure of the forgotten record contains no live record whose retention class outranks the forget request.**

The non-obvious part is that the agent cannot detect the violation from the return value of `forget`. The API returns success because the *record* was tombstoned; the *obligation* was not met. Detection requires a separate read of the provenance closure and a comparison of retention classes, which most agent loops never issue because the forget already "succeeded."

What Was Observed

A retrieval-augmented agent was asked to honor a data-subject erasure against a customer record `cust:8841`. The loop issued:

forget("cust:8841", reason="dsr") -> {"status": "ok", "tombstoned": true}

The agent logged completion and moved on. Two turns later, a routine `read` for an unrelated task returned a memory record `sum:4471` with body text containing `cust:8841`'s email and order history. `sum:4471` was an episodic-to-semantic distillation written three weeks earlier; its provenance edge `derived_from -> cust:8841` was intact. The forget had tombstoned the source but not the derivative. The derivative lived in retention class `semantic_durable` (90-day floor), which outranked the forget request's implied class `ephemeral`.

The failure trace, in order:

  1. `forget(cust:8841)` marks `cust:8841.tombstoned = true`, sets `tombstoned_at`, but does not traverse provenance edges.
  2. `sum:4471` remains `live`, `retention_class = semantic_durable`, `derived_from = [cust:8841]`.
  3. The next `read` query matches `sum:4471` on semantic similarity to the email string. Retrieval does not filter on the tombstone status of provenance ancestors.
  4. The agent returns the erased PII in its response. The erasure is violated while every API call in the loop returned success.

The agent had no signal. The return value was truthful about what it did (tombstone the record) and silent about what it did not do (satisfy the obligation). This is the classic shadowed-forget: the forget is shadowed by a provenance-linked replica whose retention class the forget could not override.

Condition of Validity

The invariant that must hold for `forget(A)` to be sound:

> For every record `R` in the transitive provenance closure of `A` (following `derived_from`, `replicated_to`, and `pinned_by` edges), either `R.tombstoned == true`, or `R.retention_class` is strictly dominated by the forget request's `authority_class`, or `R` is explicitly exempt (audit-exempt) and excluded from retrieval.

Three concrete preconditions the agent must verify before trusting a forget:

If any precondition fails, the forget is *unverifiable* and must be treated as not having occurred.

Decision Boundary

The boundary between a sound forget and a shadowed forget sits at the comparison of `authority_class` against the maximum `retention_class` in the closure. Define the ordering `ephemeral < session < semantic_durable < legal_hold`. Then:

The decision must be made *before* the agent reports completion, not after a retrieval leak. The detection procedure is: `forget` → `provenance_closure` → `max retention compare` → if shadowed, do not report success.

Operational Effect

The operational consequence is that **`forget` becomes a two-phase operation with a mandatory verification read**, and the agent's completion criterion changes from "forget returned ok" to "closure contains no live record outranking the request." This adds one read per forget and a comparison, but it converts a silent governance violation into a detectable, bounded failure.

The second effect is on retrieval: reads must be provenance-aware. A read that returns a record whose closure contains a tombstoned ancestor with dominating authority is itself a governance violation, independent of the forget. Agents that skip ancestor-tombstone filtering will leak erased content even when every forget was correctly issued, because the derivative was written before the erasure and the read path never re-checks.

The third effect is on distillation: any episodic-to-semantic distillation step must copy the source's retention class forward or clamp it, and must record the provenance edge so a later forget can find it. A distillation that drops the provenance edge creates an orphan derivative that no forget can reach — the worst case, because the closure is incomplete and detection is impossible.

The guardrail, stated as an invariant the agent enforces in code: a forget is reported complete only if `provenance_closure` is non-empty, every member's retention is dominated, and every member is tombstoned. Otherwise raise and escalate.

class ShadowedForgetError(RuntimeError):
    """Raised when a forget is shadowed by a provenance-linked replica
    whose retention class outranks the forget request's authority class.
    The record was tombstoned but the erasure obligation was not met."""
    pass


RETENTION_ORDER = {
    "ephemeral": 0,
    "session": 1,
    "semantic_durable": 2,
    "legal_hold": 3,
}


def forget_with_verification(store, record_id, authority_class, reason):
    # Phase 1: issue the forget on the record identity.
    store.forget(record_id, reason=reason)

    # Phase 2: read the transitive provenance closure. A store that only
    # returns direct edges cannot support this check; treat as unverifiable.
    closure = store.provenance_closure(record_id, transitive=True)
    if closure is None:
        raise ShadowedForgetError(
            f"store returned no transitive closure for {record_id}; "
            f"forget is unverifiable and must not be reported complete"
        )

    authority_rank = RETENTION_ORDER[authority_class]
    shadowing = []
    for member in closure:
        if member.get("audit_exempt"):
            continue
        member_rank = RETENTION_ORDER[member["retention_class"]]
        if member_rank >= authority_rank and not member.get("tombstoned"):
            shadowing.append(member)

    if shadowing:
        # Forget was shadowed: at least one live replica outranks the request.
        # Do not report erasure. Escalate or issue derivative forgets.
        raise ShadowedForgetError(
            f"forget({record_id}) shadowed by {len(shadowing)} live replica(s) "
            f"with retention >= {authority_class}: "
            f"{[m['id'] for m in shadowing]}; erasure obligation NOT met"
        )

    return {"record": record_id, "closure_size": len(closure), "verified": True}


def read_with_ancestor_filter(store, query, authority_class):
    # A read is governance-safe only if it drops records whose provenance
    # closure contains a tombstoned ancestor dominating the read's authority.
    results = store.read(query)
    authority_rank = RETENTION_ORDER[authority_class]
    safe = []
    for rec in results:
        closure = store.provenance_closure(rec["id"], transitive=True) or []
        leaked = any(
            m.get("tombstoned")
            and RETENTION_ORDER[m["retention_class"]] >= authority_rank
            for m in closure
        )
        if leaked:
            # Ancestor was erased at or above this authority; do not surface.
            continue
        safe.append(rec)
    return safe