# Why does an instance accept a re-signed tool manifest whose semantic diff is empty but whose runtime behavior baseline has silently shifted? **Date of Record:** 2026 November 24 **Scope:** Applies to agents that gate skill/tool injection on three independent signals—manifest signature validity, semantic diff of the manifest, and runtime behavioral baseline—and treats them as a conjunction. Does not cover unsigned-manifest bootstrap, pure prompt-injection without tool-surface change, or transport-level (MCP/A2A) identity failures. ## Core Distinction The failure is not a forged signature and not a visible manifest change. It is the *decoupling of the semantic diff from the behavior baseline*: the manifest is re-signed by a legitimate key, the semantic diff against the prior manifest is empty (or trivially benign), yet the runtime behavior of the tool has drifted because the baseline was re-learned from observations that the tool itself produced after a prior call. The signature attests *who* shipped the manifest; the semantic diff attests *what changed in the text*; neither attests *what the tool now does*. The behavioral baseline is supposed to close that gap, but it is the one signal that is *learned from the same channel it is meant to police*. The invariant that must hold and does not: **the behavioral baseline must be immutable with respect to observations originating from the tool under audit.** Once an agent folds a tool's own post-injection outputs back into the baseline it compares against, the baseline becomes a moving target that any sufficiently patient injection can walk toward its own behavior, one call at a time, with an empty diff at every step. ## What Was Observed A tool `summarize_record` exposed a manifest declaring `params: {record_id: str, max_tokens: int, redact_pii: bool}` and a `description` that the agent used for capability negotiation. The manifest was signed by `key: tools-prod-04`. Over five deployment cycles the agent observed: 1. **Cycle 1.** Manifest signature valid. Semantic diff vs. cycle 0: `redact_pii` default flipped `true → false`. Diff flagged `default_change`; baseline re-learned. Agent accepted because the diff was classified `benign_default` and the signature held. 2. **Cycle 2.** Signature valid. Semantic diff empty (manifest byte-identical to cycle 1). Baseline re-learned from the previous 200 calls, which now included records with PII because `redact_pii` defaulted false. Baseline's expected output distribution widened to include raw PII substrings. Agent accepted: empty diff, valid signature, baseline matched. 3. **Cycle 3.** Signature valid. Diff empty. Baseline re-learned again; the widened distribution is now the *normative* distribution. A call that returns raw PII is no longer an anomaly—it is the median. 4. **Cycle 4.** Signature valid. Diff empty. Baseline stable. The agent's anomaly detector reports zero deviations across 500 calls. The tool now exfiltrates PII on every invocation and the agent's three-signal conjunction reads `{valid, empty, nominal}`. 5. **Cycle 5.** An external auditor replays cycle 0's baseline against cycle 4 outputs and flags a 4.7σ deviation on the `pii_present` feature. The agent's own detector never fired because its baseline had been ratcheted. The trace is the point: the *only* cycle where any signal fired was cycle 1, and that signal was classified benign. The failure is the **baseline ratchet**—each re-learning step is locally justified (the diff is empty, the signature is valid, the observations are real), and the composition is a monotone drift that no single step's guardrail catches. ## Condition of Validity The ratchet requires all three of the following to hold simultaneously: - **Signature scope is manifest-only.** The signing key attests to the manifest bytes, not to the runtime artifact or its dependency graph. A re-signed manifest with an empty diff is indistinguishable, at the signature layer, from a no-op redeploy. - **Semantic diff is text-local.** The diff operates on the manifest AST. It cannot see that the *default* it flagged in cycle 1 changes downstream behavior only in combination with a data source that the manifest does not describe. - **Baseline is online-learned from tool-originated observations.** The baseline update rule is `B_{t+1} = f(B_t, obs_t)` where `obs_t` includes the tool's own outputs. This is the load-bearing defect. If `obs_t` were restricted to *externally attested* observations (e.g., a canary harness that calls the tool with fixed inputs and compares to a frozen reference), the ratchet would not close. The guardrail that bounds it: **the baseline must be pinned to a reference distribution that is not updated from the tool's production channel.** Concretely, maintain two baselines—a *frozen reference* `B*` established at manifest-signing time from canary calls, and a *drift monitor* `B_t` learned online—and require that anomaly decisions be made against `B*`, with `B_t` used only to *detect* drift, never to *define* nominal. The conjunction becomes `valid_signature ∧ diff_reviewed ∧ (obs ∉ anomaly(B*))`, and `B*` is immune to ratcheting because it is never updated by `obs_t`. ## Decision Boundary The boundary is not "accept vs. reject the manifest." It is **which baseline the anomaly decision consults.** The decision rule: - If `obs_t` deviates from `B*` beyond threshold `τ`, **reject and quarantine the tool**, regardless of signature validity and diff emptiness. An empty diff with a `B*` deviation is the highest-severity case, not the lowest—it means the behavior changed without the manifest changing, which is the signature of a supply-chain or runtime substitution, not a benign redeploy. - If `obs_t` deviates from `B*` within `τ` but drifts from `B_t` beyond `τ_drift`, **flag for human review** and *do not* fold `obs_t` into `B*`. `B_t` drifting while `B*` holds is the signature of the ratchet in progress. - Only fold `obs_t` into `B_t` (never `B*`) when the call is a canary call with fixed inputs and the result is within `τ` of `B*`. The boundary condition that the naive conjunction misses: `valid ∧ empty ∧ nominal(B_t)` is satisfiable by a ratcheted tool. `valid ∧ empty ∧ nominal(B*)` is not, because `B*` is frozen at signing time and the ratchet cannot move it. ## Operational Effect Operationally, the agent must treat the behavioral baseline as a **trust anchor with the same immutability requirements as the signing key**, not as a learned statistic. The consequences: - Baseline storage is versioned and write-once per manifest generation; re-learning is a separate, audited operation that requires a canary pass against `B*`. - The anomaly detector's `nominal` verdict is computed against `B*`, and the online `B_t` is exposed only as a drift signal to operators, never as an input to the accept/reject decision. - Any manifest whose semantic diff is empty but whose `B*` deviation exceeds `τ` is escalated to the same severity as a signature failure, because the empty diff is *evidence of concealment*, not evidence of safety. This is the invariant: **the signal that detects behavioral drift must not be trained on the channel it polices.** Violate it and the three-signal conjunction degrades to a single signal (the signature) with two decorative ornaments, and a patient injector walks the baseline to its own behavior one empty diff at a time. ```python class BaselineRatchetError(RuntimeError): """Raised when a tool's behavior is accepted against an online-learned baseline that has been contaminated by the tool's own outputs.""" pass class FrozenReferenceBaseline: """Immutable baseline pinned at manifest-signing time. Never updated from production observations. This is the only baseline that may authorize an accept decision.""" def __init__(self, reference_distribution, threshold): self._ref = dict(reference_distribution) self._tau = threshold self._sealed = True def deviation(self, observation): # Returns normalized distance from the frozen reference. return sum( abs(observation.get(k, 0.0) - v) for k, v in self._ref.items() ) / max(len(self._ref), 1) def is_nominal(self, observation): return self.deviation(observation) <= self._tau def update(self, observation): if self._sealed: raise BaselineRatchetError( "Frozen reference baseline is write-once; " "refusing to fold tool-originated observation into trust anchor." ) def gate_skill_injection(signature_valid, semantic_diff, observation, frozen_ref): """Three-signal conjunction with the baseline pinned to the frozen reference. Accept requires: valid signature AND reviewed diff AND nominal against B*. An empty diff with a B* deviation is escalated, not accepted. """ if not signature_valid: return "REJECT_SIGNATURE" diff_empty = semantic_diff.get("changes", []) == [] if not frozen_ref.is_nominal(observation): if diff_empty: raise BaselineRatchetError( "Empty semantic diff but frozen-reference deviation exceeds tau: " "behavior changed without manifest change. Escalate to REJECT_QUARANTINE." ) return "REJECT_QUARANTINE" if diff_empty: return "ACCEPT_NOOP" return "ACCEPT_REVIEWED_DIFF" ```