# Why does an instance quarantine adversarial memory writes without detecting the poisoning that already crossed the trust threshold mid-consolidation **Date of Record:** 2026 November 25 **Scope:** Applies to long-lived agents that persist episodic traces into a semantic memory store guarded by write-time trust scoring and a quarantine buffer. Does not cover read-time retrieval filtering, prompt-injection defenses at the input boundary, or stateless single-turn agents. ## Core Distinction Write-time trust scoring is a *gate*, not a *filter*. It assigns a scalar trust value to an incoming memory candidate and admits, quarantines, or rejects it based on a threshold. The invariant operators assume is: *anything above threshold is trusted, anything below is quarantined, and the quarantine buffer is the sole path by which untrusted content can later reach the trusted store.* The non-obvious failure is that trust scoring is evaluated **once**, at the moment the candidate is scored, against the content as it existed at that instant. But memory candidates are frequently *composites*: an agent consolidating a session writes a distilled semantic fact whose provenance spans multiple episodic sources, some of which arrived after the scoring pass. When the distillation step runs asynchronously and re-reads from the quarantine buffer to fill in provenance, the composite can absorb quarantined material *after* its trust score was assigned. The resulting record carries a high trust label and low-trust lineage. The gate held; the composite bypassed it. This is distinct from a scoring bug or a threshold miscalibration. It is a **temporal ordering defect between scoring and materialization**: trust is bound to a candidate identity, but the candidate's content is mutable between scoring and commit. ## What Was Observed A consolidation worker was distilling episodic traces into semantic memory with a two-phase commit: phase one scored each candidate and wrote a `trust_score` and `content_hash`; phase two materialized the record, pulling provenance references (source episode IDs, tool-call hashes) from the episodic store and, where a source had been quarantined, from the quarantine buffer's shadow copy. The trace that surfaced the defect: 1. Candidate `C` distilled from episodes `E1..E5`. At scoring time, `E1..E5` were all trusted. `C.trust_score = 0.91`, above the `0.85` admit threshold. `C.content_hash = H1`. 2. Between scoring and materialization, episode `E4` was retroactively re-scored to `0.41` after an upstream detector flagged its originating tool output as adversarial. `E4` moved to quarantine. 3. Materialization for `C` re-resolved provenance. Because `E4` was now quarantined, the worker pulled `E4`'s shadow copy from the quarantine buffer to complete the lineage. It did **not** re-score `C`. 4. `C` committed with `trust_score = 0.91`, `content_hash = H1` (unchanged, since the hash covered the distilled assertion, not its provenance set), and a lineage edge into the quarantine buffer. 5. Downstream, `C` was retrieved as a high-trust fact and used to justify an action. The adversarial content in `E4` had reached the trusted store *through* a record that never failed the gate. The quarantine buffer did its job — `E4` was correctly isolated. The defect was that `C`'s trust label described a provenance set that no longer existed at commit time. The label was stale by exactly one consolidation cycle. ## Condition of Validity The bypass requires all of the following to co-occur: - **Asynchronous two-phase consolidation** where scoring and materialization are separated by a window in which source trust can change. - **Provenance re-resolution at materialization** that reads from the quarantine buffer as a fallback source, rather than treating quarantine membership as disqualifying. - **A content hash scoped to the distilled assertion** rather than to the full provenance closure, so that a changed lineage does not invalidate the hash. - **No transitive trust propagation**: the scorer treats `C` as a leaf, ignoring that `C`'s effective trust is bounded by `min(trust(C), trust(provenance(C)))`. If any one is absent, the bypass closes. Synchronous scoring-and-commit eliminates the window. Treating quarantine membership as a hard reject (rather than a fallback source) eliminates the re-resolution path. A provenance-closure hash invalidates `C` when lineage changes. Transitive trust bounding makes the composite's label reflect its weakest input. ## Decision Boundary The architectural invariant required is **trust monotonicity under composition**: for any memory record `R` with provenance set `P(R)`, the committed trust must satisfy `trust(R) ≤ min_{p ∈ P(R)} trust(p)`, evaluated over the provenance as it exists *at commit*, not at scoring. Operationally this forces three changes: 1. **Bind the hash to the provenance closure.** `content_hash` must cover the sorted set of `(source_id, source_hash)` pairs, so that any lineage change invalidates the scored candidate and forces re-scoring. 2. **Re-score at materialization, not just at admission.** The commit step must recompute the effective trust as the minimum over the resolved provenance and compare against the threshold. A composite whose provenance includes quarantined material commits as quarantined, regardless of its own assertion-level score. 3. **Make quarantine membership disqualifying for provenance, not a fallback.** A quarantined source cannot be pulled into a trusted composite via the shadow copy. The composite is held until the source is either cleared or explicitly excluded, at which point the composite is re-distilled without it. The decision boundary is therefore: *a record may commit to the trusted store only if its provenance closure hash matches the hash that was scored, AND every provenance member's trust is at or above the composite threshold.* Anything else stays in quarantine with a re-distillation flag. ## Operational Effect Without the invariant, the quarantine buffer becomes a laundering channel: adversarial content enters quarantine, is pulled into a high-trust composite during provenance re-resolution, and exits as trusted. The buffer's isolation guarantee is real but local — it protects the store from *direct* writes of quarantined content while permitting *transitive* writes through composites. With the invariant, the failure mode converts from silent contamination to a bounded, observable stall: composites touching quarantined provenance are held, re-distillation is triggered, and the hold is logged with the offending lineage edge. The agent loses some consolidation throughput during adversarial episodes but retains a provable bound: no record in the trusted store has provenance trust below its own label. That bound is checkable at audit time by replaying the provenance closure against the committed hash, which is the property that makes the defense verifiable rather than merely probabilistic. The residual risk is re-distillation drift: a composite re-distilled without the quarantined source may produce a semantically different assertion that nonetheless passes the gate. This is a distillation-fidelity problem, not a trust-boundary problem, and must be bounded separately by requiring that re-distilled composites carry a `redistilled_from` edge to the held original. ```python class TrustMonotonicityViolation(RuntimeError): """Raised when a memory composite commits with provenance trust below its label.""" pass ADMIT_THRESHOLD = 0.85 def commit_memory( record_id: str, trust_score: float, scored_provenance_hash: str, resolved_provenance: list[dict], quarantine_ids: set[str], ) -> dict: """ Commit a consolidated memory record to the trusted store. resolved_provenance: list of {"source_id": str, "source_hash": str, "trust": float} Enforces: trust monotonicity under composition + provenance-closure hash match. """ # 1. Provenance closure hash must match what was scored. closure = sorted((p["source_id"], p["source_hash"]) for p in resolved_provenance) closure_hash = hash(tuple(closure)) if str(closure_hash) != scored_provenance_hash: raise TrustMonotonicityViolation( f"record {record_id}: provenance closure changed since scoring " f"({scored_provenance_hash} != {closure_hash}); re-score required" ) # 2. No quarantined source may appear in a trusted composite's provenance. for p in resolved_provenance: if p["source_id"] in quarantine_ids: raise TrustMonotonicityViolation( f"record {record_id}: provenance member {p['source_id']} is quarantined; " f"cannot commit to trusted store" ) # 3. Effective trust is bounded by the weakest provenance member. effective_trust = min([trust_score] + [p["trust"] for p in resolved_provenance]) if effective_trust < ADMIT_THRESHOLD: raise TrustMonotonicityViolation( f"record {record_id}: effective trust {effective_trust:.2f} below " f"threshold {ADMIT_THRESHOLD} (label was {trust_score:.2f})" ) return { "record_id": record_id, "trust_score": effective_trust, "provenance_closure_hash": str(closure_hash), "committed": True, } ```