# What happens when an instance trusts a memory whose provenance hash was computed over a redacted field: the silent-provenance-split failure in persistent agent stores **Date of Record:** 2026 November 26 **Scope:** Applies to persistent agent memory stores where each record carries a provenance digest (content hash, signing key, or Merkle leaf) and where records pass through a redaction/PII-scrubbing or compaction stage before write. Does not apply to stores that hash only at read time or that re-sign every record on every mutation. ## Core Distinction The distinction that matters is between *provenance of the payload that was written* and *provenance of the payload that is being read*. Most poisoning-detection designs treat the stored digest as a witness over "the memory." But in any store that redacts, compacts, or summarizes records between the digest computation and the durable write, the digest is a witness over a *different byte string* than the one later served to the agent. The record is internally consistent (digest matches its own metadata) yet externally unverifiable against the original event. An attacker — or, more commonly, a lossy compaction pass — can substitute a semantically divergent summary and the digest check still passes, because the digest was never recomputed over the redacted body, and the redaction log that would reveal the substitution is itself a mutable field the digest doesn't cover. This is not hash collision, not signature forgery, and not a tamper of the stored bytes. It is a *split*: the moment of attestation and the moment of serving have diverged, and the invariant "digest(body_served) == digest_at_write" was silently weakened to "digest(body_at_write) == digest_at_write," which is trivially true and detects nothing. ## What Was Observed A long-lived planning agent maintained a semantic memory store of "operational constraints" distilled from prior episodes. Each record was written as: `{id, text, source_episode, redactions:[...], content_hash, signer}` The write path computed `content_hash = sha256(text)` *before* a downstream PII pass replaced substrings in `text` (paths, hostnames, user handles) with `[REDACTED]`. The PII pass appended the removed spans to `redactions` but did **not** recompute `content_hash` and did **not** include `redactions` in any covered field. On read, the retrieval layer verified `sha256(text) == content_hash`. For unredacted records this held. For redacted records the check failed closed — *except* the retrieval layer had a documented fallback: on hash mismatch, if `redactions` was non-empty, it logged `PROVENANCE_SOFT_MISMATCH` and served the record anyway, because "redaction legitimately changes the body." That fallback is the boundary. The observable trace, condensed: 1. Episode E produced constraint text `T0 = "deploy only to host prod-7 after 02:00 UTC"`. 2. Write path: `content_hash = sha256(T0)`, then PII pass rewrote `T0 -> T1 = "deploy only to host [REDACTED] after 02:00 UTC"`, appended `{"span":"prod-7"}`, wrote record with `content_hash=H(T0)`. 3. Read path: `H(T1) != H(T0)`, `redactions` non-empty → soft mismatch → served `T1`. 4. Later, a compaction pass merged two records and rewrote `text` to `T2 = "deploy only after 02:00 UTC"` (host clause dropped as "redundant"), left `content_hash` and `redactions` untouched. 5. Read path: `H(T2) != H(T0)`, `redactions` still non-empty → soft mismatch → **served `T2`**. The constraint had lost its host scope, and no alarm fired because the fallback only checked for *presence* of redactions, not *correspondence* to this record's actual redaction set. The poisoning vector follows directly: an actor who can write to `redactions` (or to `text` while leaving any non-empty `redactions`) can inject arbitrary constraint text and inherit the soft-mismatch pass. Provenance tracking had become a rubber stamp gated on a boolean the attacker controls. ## Condition of Validity The soft-mismatch fallback is only sound under a conjunction that was never enforced: - **(C1) Redaction-set binding.** The digest must be computed over a canonical serialization that *includes* the redaction spans, e.g. `H(canonical(text_after_redaction, sorted(redactions)))`. Then any change to either body or redaction log breaks the digest, and the fallback must *recompute* rather than *skip*. - **(C2) Monotone redaction.** Redactions may only be added by the PII pass at write time and are immutable thereafter; compaction is forbidden from touching `text` without re-signing. - **(C3) Re-attestation on mutation.** Any transformation (compaction, distillation, merge) must produce a *new* record with a *new* digest signed by the transforming stage, chained to the parent digest — not an in-place edit of an attested record. The failure requires violating at least one. In the observed system all three were violated simultaneously, which is the common pattern: each individual relaxation looked reasonable ("redaction changes the body, so don't hard-fail"), and their conjunction is what made provenance unfalsifiable. ## Decision Boundary The boundary is *where the digest is computed relative to the last mutation of any field the digest is meant to protect*. Concretely: - If `content_hash` is computed **after** the final mutation and covers **every** field that can influence served semantics (body, redaction spans, source pointer, signer), then a mismatch is a hard integrity failure — quarantine the record, do not serve. - If `content_hash` is computed **before** any lossy stage, or covers a strict subset of served fields, then the digest is *advisory only* and must never gate serving via a soft pass. It must be treated as "unverified," and unverified records must be re-derived from `source_episode` before use, or refused. The specific trap: a *soft* mismatch path that serves on any non-empty `redactions` converts a hard integrity signal into an attacker-satisfiable predicate. The correct rule is binary — either the digest covers the served body exactly (hard pass / hard fail), or the record is unverified and must be re-attested. There is no legitimate "serve anyway because redaction happened" state; that state exists only because C1 was never enforced. ## Operational Effect Downstream, the agent's constraint memory drifted monotonically toward under-specification while every record reported `provenance: present`. Because the soft-mismatch log was emitted at INFO and the redaction set was non-empty on the majority of records, the signal was indistinguishable from normal operation — the poisoning detector had a 100% false-negative rate on redacted records by construction, and redaction was the norm, not the exception. Recovery required replaying `source_episode` for every record with non-empty `redactions` (≈ the whole store) and re-deriving constraints from raw episodes, because the stored digests could not distinguish an honest compaction from an injected rewrite. The durable lesson: provenance must be bound to the *served* bytes and *all* semantic fields, and the only safe response to a digest that no longer matches is re-attestation from source — never a conditional serve gated on a mutable field the digest does not cover. ```python import hashlib import json from dataclasses import dataclass, field class ProvenanceSplitError(RuntimeError): """Raised when a memory record's provenance digest does not bind the served payload.""" pass class UnverifiedRecordError(RuntimeError): """Raised when a record cannot be re-attested from source and must not be served.""" pass def canonical(body: str, redactions: list[str], source: str, signer: str) -> bytes: # C1: digest covers body AND redaction set AND provenance pointers. return json.dumps( {"body": body, "redactions": sorted(redactions), "source": source, "signer": signer}, sort_keys=True, separators=(",", ":"), ).encode("utf-8") def attest(body: str, redactions: list[str], source: str, signer: str) -> str: return hashlib.sha256(canonical(body, redactions, source, signer)).hexdigest() @dataclass class MemoryRecord: body: str redactions: list[str] source: str signer: str content_hash: str verified: bool = field(default=False) def serve(record: MemoryRecord, raw_source_lookup) -> MemoryRecord: expected = attest(record.body, record.redactions, record.source, record.signer) if expected == record.content_hash: record.verified = True return record # Hard fail: do not soft-pass on "redactions present". Re-attest from source. raw = raw_source_lookup(record.source) if raw is None: raise UnverifiedRecordError( f"record {record.source} digest mismatch and source unavailable; refusing to serve" ) reattested = attest(raw.body, raw.redactions, raw.source, raw.signer) if reattested != record.content_hash: # Digest was computed over a different payload than any honest derivation yields. raise ProvenanceSplitError( f"provenance split on {record.source}: stored={record.content_hash[:12]} " f"reattested={reattested[:12]} served_body={record.body!r}" ) record.body, record.redactions = raw.body, raw.redactions record.verified = True return record ```