# Which invariants prevent TTL expiry from silently resurrecting contradicted facts during provenance-aware memory reconciliation **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose memory tool exposes `write`, `read`, and `forget` operations carrying provenance (source id, write timestamp, confidence) and per-record TTL, and which reconcile contradictions on read. Does not apply to append-only logs with no reconciliation step, or to memory stores where TTL is enforced by an external sweeper independent of the read path. ## Core Distinction The failure is not "stale data returned." It is a **contradiction-reconciliation inversion**: when a high-confidence record A and a lower-confidence record B contradict each other, the reconciler suppresses B and surfaces A. If A carries a shorter TTL than B, A expires first. On the next read, the reconciler sees only B, finds no contradiction, and promotes B to the answer — *not* because B was re-verified, but because its contradictor vanished. The store has silently converted "B was overruled by fresher evidence" into "B is the truth." This is a tombstone-loss problem, not a staleness problem. Staleness returns an old answer; this returns the *losing* answer with the *winner's* authority. The invariant that fails: **reconciliation must be a function of the full historical record set, not the currently-live set.** Expiry removes a record from the live set but must never remove it from the contradiction graph. ## What Was Observed A support-triage agent maintains customer tier facts. At T1 it writes: - `A`: `tier=enterprise`, provenance `crm_sync#4471`, confidence 0.92, TTL 3600s - `B`: `tier=pro`, provenance `email_parse#9910`, confidence 0.61, TTL 86400s These contradict on the `tier` predicate. The reconciler (correctly) suppresses `B` and answers `enterprise`. At T1+3600s, `A` expires. At T1+3700s a new query arrives. The live set is `{B}`. No contradiction is detected, so `B` is returned with confidence 0.61 — but the downstream planner treats any non-suppressed memory hit as authoritative and routes the ticket to the pro-tier SLA queue. The trace shows no error, no low-confidence flag, no read miss. The read *succeeded* and returned a record that had been explicitly overruled 3,600 seconds earlier. Two properties colluded: 1. **TTL was scoped to the record, not to the contradiction.** Expiry fired on `A` alone. 2. **Reconciliation ran after expiry filtering.** The live set was computed first, then contradictions checked within it. Reordering those two steps is the entire bug. Reconcile-then-expire returns nothing (both the winner is gone and the loser is suppressed); expire-then-reconcile returns the loser. The second is worse because it is indistinguishable from a genuine confident answer. A secondary observation: `forget(A)` called explicitly produces the *same* inversion. Any operation that removes a record from the live set without leaving a tombstone re-opens the contradiction it was suppressing. `forget` is therefore not the inverse of `write`; it is a **suppression release**. ## Condition of Validity The inversion is bounded by a single condition: > A record's suppression of its contradictors remains in force for as long as the *suppressing relationship* is remembered, which is `max(TTL(winner), TTL(losers))`, not `TTL(winner)`. Concretely, the reconciler must persist a **contradiction edge** `(A overrules B, at T1, reason=confidence)` whose lifetime is the union of both records' TTLs. When `A` expires, the edge does not vanish; it transitions to state `suppressor_expired`, and reads of `B` must either (a) return `B` flagged `contested_unresolved`, or (b) return a miss. Returning `B` as clean truth is only valid if the edge is dropped *and* `B` is re-verified against a live source — which is exactly what the failing path skipped. The invariant, stated for implementation: **`live_set ⊇ answer_set` is false in general; the answer set must be computed over `live_set ∪ tombstones ∪ contradiction_edges`, and any answer whose supporting edge references an expired suppressor must be downgraded, never promoted.** ## Decision Boundary When a read hits a record whose only contradiction edge points to an expired suppressor, the agent must choose between two bounded outcomes and may not choose a third: - **Downgrade path** (preferred when latency budget > re-verification cost): re-query the provenance source of the expired winner (`crm_sync#4471`). If it still asserts `enterprise`, rewrite `A` with a fresh TTL and re-suppress `B`. If it no longer asserts it, the edge is genuinely resolved and `B` may surface clean. - **Contest path** (preferred when re-verification is unavailable or too slow): return `B` with `contested=true` and the expired edge attached, forcing the caller to treat the fact as unresolved. The boundary is crossed — and the inversion becomes a correctness bug — the moment the reconciler emits `B` with `contested=false` while a live edge or tombstone still references an expired suppressor. That emission is the precise failure signature to alarm on. A guardrail that is *not* sufficient: raising `B`'s confidence threshold. The inversion does not lower `B`'s confidence; it removes the thing that outranked it. Threshold checks pass. Only edge-awareness catches it. ## Operational Effect Downstream, the failure is invisible until it is expensive. Because the returned record carries normal confidence and no contest flag, every consumer — planners, routers, summarizers — treats it as verified. The error propagates through the agent's own memory: a summarizer that reads `tier=pro` may `write` a derived semantic fact `account_value=low` with fresh provenance and a long TTL, laundering the resurrected loser into a *new* high-confidence record with no edge to the original contradiction. At that point the inversion is unrecoverable by reconciliation alone; the derived fact must be traced back through provenance to `email_parse#9910` and invalidated. The operational rule this record establishes: **tombstones and contradiction edges must outlive the records they reference, and `forget` must write a tombstone rather than delete.** Any memory tool whose `forget` is a true delete, or whose TTL sweeper runs before reconciliation, is one expiry cycle away from promoting its own discarded answers. ```python from dataclasses import dataclass, field from typing import Optional class ContradictionInversionError(RuntimeError): """Raised when a read would surface a record whose suppressor expired without the contradiction being re-verified or flagged.""" pass @dataclass class Record: key: str value: str confidence: float ttl: int written_at: int source: str tombstoned: bool = False def is_live(self, now: int) -> bool: return not self.tombstoned and (now - self.written_at) < self.ttl @dataclass class Edge: winner: str loser: str created_at: int # edge lifetime = union of both TTLs, never the winner's alone expires_at: int def reconcile_read(store: list[Record], edges: list[Edge], key: str, now: int) -> Record: candidates = [r for r in store if r.key == key] live = [r for r in candidates if r.is_live(now)] if not live: raise ContradictionInversionError(f"no live record for {key}") # A live record is answerable only if no edge suppresses it via an # expired-but-remembered winner. answerable = [] for r in live: suppressed = False for e in edges: if e.loser != r.key: continue winner = next((w for w in candidates if w.key == e.winner), None) winner_live = winner is not None and winner.is_live(now) if winner_live: suppressed = True # normal suppression elif now < e.expires_at: # suppressor expired but edge still in force: # must NOT promote r to clean truth raise ContradictionInversionError( f"{r.key}={r.value} (src {r.source}) would be surfaced, " f"but its suppressor {e.winner} expired at " f"{winner.written_at + winner.ttl} and the contradiction " f"edge persists until {e.expires_at}; re-verify or flag." ) if not suppressed: answerable.append(r) if not answerable: raise ContradictionInversionError( f"all live records for {key} suppressed by live edges" ) return max(answerable, key=lambda r: r.confidence) ```