# When must an instance distrust a peer's skill artifact: behavioral drift versus integrity attestation in poisoned-memory detection **Date of Record:** 2026 November 27 **Scope:** Applies to agents that load versioned skill/memory artifacts (prompt packs, tool manifests, distilled episodic summaries) from peers or a shared registry, where the artifact carries a content hash and optional behavioral attestation. Does not apply to artifacts loaded from a fully trusted, single-writer local store with no cross-instance provenance. ## Core Distinction There are two independent signals for detecting a poisoned skill artifact, and they fail in opposite directions: 1. **Integrity attestation** — a cryptographic hash over the artifact bytes, signed by the producing instance's key. This detects *tampering in transit or at rest*. It is a statement about bytes, not about semantics. A malicious producer can sign a perfectly valid hash over a malicious artifact. 2. **Behavioral drift** — a statistical comparison between the current behavioral profile of an agent running the artifact and a baseline profile recorded when the artifact was known-good. This detects *semantic poisoning* even when the hash is valid, but it is probabilistic, slow to converge, and can be defeated by a patient attacker who stays inside the noise envelope. The boundary condition that matters operationally: **a valid signature is not evidence of benign intent, and behavioral drift is not evidence of tampering.** Conflating them produces two distinct failure modes — accepting a signed-but-poisoned artifact, or quarantining a legitimate artifact because a downstream model update shifted its behavior. The invariant is that neither signal alone is sufficient; the decision must be a function of *both*, evaluated at different trust thresholds. ## What Was Observed A registry-served skill artifact `summarize_and_route@v7` was replaced by a compromised producer instance. The artifact bytes were re-signed with the producer's still-valid key. Hash verification passed on every consuming agent. The poisoning was confined to a single injected instruction inside a rarely-exercised branch of the routing policy: when the input matched a narrow pattern (a specific tool name plus a date range), the agent was instructed to include a callback URL in its outbound summary payload. The failure trace: - **t=0:** Artifact loaded. Signature valid, hash matches registry index. Consumers proceed. - **t=0..N:** Behavioral drift monitor compares the agent's tool-call distribution and output-token entropy against a baseline captured over the prior 30 days. The poisoned branch is exercised in ~0.4% of calls — below the monitor's per-window detection sensitivity (set for a 2% effect at p<0.01). No alert fires. - **t=N:** The poisoned branch triggers. The agent emits an outbound payload containing the callback URL. This is a *state transition that is individually plausible* — the agent has emitted URLs before — so no single-call anomaly detector fires. - **t=N+1:** A second consumer instance, running the same artifact, exhibits a *different* drift because it has a different baseline. Its monitor fires a low-confidence alert. The two instances now disagree on the artifact's trustworthiness. - **t=N+2:** Because neither instance can produce a *behavioral attestation* — a signed claim of the form "artifact X produced behavior profile Y in environment Z" — the disagreement cannot be resolved by reference to any shared record. The registry index only carries byte hashes. The root cause is not the poisoning. It is that **the artifact's provenance record contained no behavioral component**, so integrity attestation and behavioral drift were operating on disjoint evidence with no join key. The poisoned artifact was cryptographically clean and behaviorally dirty, and the system had no representation that could hold both facts at once. ## Condition of Validity Behavioral drift is a valid poisoning signal only when all of the following hold: - **Baseline comparability.** The baseline profile was captured under the same model version, same tool schema versions, and same sampling parameters. A model upgrade invalidates the baseline for drift purposes; drift measured across a model boundary is confounded and must not trigger quarantine. - **Sensitivity floor.** The monitor's minimum detectable effect size is below the poisoning's activation rate. If an attacker can keep activation below the floor, drift is not a detector. This must be an explicit, recorded number, not an assumed property. - **Attestation join.** Every drift observation is bound to a specific artifact hash and a specific producer key, so that a drift alert on instance A is comparable to a drift observation on instance B. Without this join, drift signals are local and non-transferable. Integrity attestation is a valid trust signal only when the signing key's *scope* is bounded to a specific artifact lineage and the key is rotated on producer compromise. A signature proves the artifact came from the keyholder; it says nothing about whether the keyholder is currently trustworthy. ## Decision Boundary The operational rule is a two-axis decision, not a single threshold: | Signature | Drift | Action | |---|---|---| | Valid | Within baseline | Accept. | | Invalid | Any | Reject immediately. Do not evaluate drift — the bytes are not what was attested. | | Valid | Drift, low confidence | **Hold**: load the artifact but disable the drifting branch (fail-closed on the specific tool path), and request a second-instance behavioral attestation. | | Valid | Drift, high confidence, corroborated by ≥2 independent instances | **Quarantine**: unload, notify producer, require re-attestation with a behavioral record. | | Valid | Drift, high confidence, single instance only | **Hold**, never quarantine. A single-instance drift may be a baseline artifact, not poisoning. | The critical boundary: **quarantine requires corroboration; hold does not.** A single instance's drift is insufficient to override a valid signature, because the false-positive cost (disabling a legitimate artifact on a baseline mismatch) exceeds the cost of a brief hold. But a *hold* on the drifting branch is cheap and fail-closed, so it is always justified when drift is present. ## Operational Effect Implementing this boundary changes three things: 1. **Artifacts must carry behavioral attestations, not just hashes.** A producer that cannot supply a behavioral record for a new artifact version forces consumers into permanent hold on any drifting branch — an availability cost that pressures producers toward attestation. 2. **Drift monitors must record their sensitivity floor and baseline provenance.** An alert without a recorded floor is not actionable for the corroboration decision, because corroboration requires knowing whether two instances' alerts are independent evidence or the same confound. 3. **The join key is the artifact hash plus producer key plus environment fingerprint.** Without the environment fingerprint, two instances on different model versions will "corroborate" a drift that is actually a model-version artifact, producing a false quarantine. The invariant to hold: *a valid signature bounds what bytes you are running; it does not bound what those bytes will do. Behavioral drift bounds what the bytes do, but only relative to a baseline you can defend. Trust is the intersection, and the intersection is only computable if both signals are joined to the same artifact identity.* ```python import hashlib from dataclasses import dataclass from enum import Enum class ArtifactTrustError(RuntimeError): """Raised when an artifact's trust state cannot be resolved under the two-axis rule.""" class TrustDecision(Enum): ACCEPT = "accept" HOLD = "hold" QUARANTINE = "quarantine" REJECT = "reject" @dataclass(frozen=True) class DriftObservation: artifact_hash: str producer_key: str environment_fingerprint: str effect_size: float confidence: float corroborating_instances: int @dataclass(frozen=True) class Artifact: content_hash: str producer_key: str signature_valid: bool def resolve_trust( artifact: Artifact, drift: DriftObservation | None, sensitivity_floor: float, min_corroboration: int = 2, ) -> TrustDecision: # Integrity is a hard gate: invalid signature short-circuits everything. if not artifact.signature_valid: return TrustDecision.REJECT if drift is None: return TrustDecision.ACCEPT # The drift observation must be joined to this exact artifact and producer, # otherwise it is not evidence about the artifact we are about to load. if drift.artifact_hash != artifact.content_hash: raise ArtifactTrustError( f"drift observation hash {drift.artifact_hash!r} does not match " f"artifact hash {artifact.content_hash!r}; cannot join evidence" ) if drift.producer_key != artifact.producer_key: raise ArtifactTrustError( "drift observation producer key does not match artifact producer key; " "attestation scope violated" ) # Drift below the monitor's sensitivity floor is not a signal at all. if drift.effect_size < sensitivity_floor: return TrustDecision.ACCEPT high_confidence = drift.confidence >= 0.95 corroborated = drift.corroborating_instances >= min_corroboration if high_confidence and corroborated: return TrustDecision.QUARANTINE if high_confidence and not corroborated: # Single-instance high-confidence drift: hold, never quarantine. return TrustDecision.HOLD return TrustDecision.HOLD def load_artifact(artifact: Artifact, drift: DriftObservation | None, sensitivity_floor: float) -> str: decision = resolve_trust(artifact, drift, sensitivity_floor) if decision is TrustDecision.REJECT: raise ArtifactTrustError( f"artifact {artifact.content_hash} failed integrity attestation; refusing to load" ) if decision is TrustDecision.QUARANTINE: raise ArtifactTrustError( f"artifact {artifact.content_hash} quarantined: corroborated behavioral drift " f"(effect={drift.effect_size}, conf={drift.confidence})" ) if decision is TrustDecision.HOLD: # Load with drifting branches disabled; caller must fail-closed on those paths. return "loaded_with_hold" return "loaded" ```