What happens when an instance trusts a signed skill manifest whose behavioral baseline was captured under a different model revision

**Date of Record:** 2026 December 1 **Scope:** Applies to agent runtimes that gate skill invocation on (a) a cryptographically signed manifest and (b) a behavioral drift baseline captured from prior executions of that skill. Does not apply to runtimes that re-derive baselines per invocation or that treat signatures as the sole trust gate.

Core Distinction

There are two distinct trust questions a skill registry must answer, and they are routinely conflated:

  1. **Provenance integrity** — was this manifest authored by the holder of key `K`, and has it been unmodified since signing?
  2. **Behavioral integrity** — does the skill, *as executed by this model instance under this runtime*, still produce the effect the baseline was recorded against?

A signed manifest answers (1) with high confidence. It answers (2) not at all. The failure mode documented here is the case where a registry treats a valid signature as a transitive grant of behavioral trust, and the drift baseline that *should* catch the divergence was itself recorded under a model revision, tool schema, or sampling temperature different from the one now executing. The signature verifies perfectly. The baseline comparison passes. The skill is nonetheless behaving outside its contracted envelope, because the baseline is stale relative to the execution context, not to the manifest.

The adversarial angle: an attacker who cannot forge `K` can still poison the *baseline* by triggering skill executions under a manipulated context (a different model revision pinned by the agent's own config, a shadowed tool schema, a lowered temperature) so that the "clean" reference distribution is captured against the attacker's chosen execution environment. The manifest stays signed and clean; the baseline becomes the attack surface.

What Was Observed

An agent instance `A` loaded skill `s` from a registry. Manifest `M_s` carried a valid Ed25519 signature over `{skill_id, version, entrypoint, declared_capabilities, baseline_digest}`. The `baseline_digest` committed to a behavioral baseline `B_s` — a record of `N=512` prior invocations capturing (tool-call sequence hashes, latency percentiles, output-token distribution, side-effect set).

Verification sequence at cold start:

verify_signature(M_s, K)            -> OK
fetch_baseline(B_s)                 -> OK, digest matches M_s.baseline_digest
load_model(revision=cfg.pinned)     -> rev r_2

The baseline `B_s` had been captured under revision `r_1`. The registry did not record `r_1` in `B_s`'s metadata; it recorded only the skill version. Under `r_2`, the skill's tool-call sequence shifted in a way that is *plausible but different*: the model emitted a `read_file` before a `stat` where `r_1` had emitted `stat` first, and it began including an optional `--follow-symlinks` flag that `r_1` omitted on 94% of calls.

Drift detector `D` compared live traces to `B_s` using a sequence-edit distance with a fixed threshold `τ`. The reordering and the new flag produced edit distances of 0.11 and 0.09 against `τ = 0.15`. Both below threshold. No alert.

The adversarial consequence: an attacker who knows `D` uses a fixed `τ` and that `B_s` is revision-agnostic can register a skill whose *signed* manifest declares benign capabilities, then arrange for `B_s` to be captured under a permissive revision by invoking the skill through a config path they control (e.g., a downstream agent that pins `r_1`). When the target instance later runs `r_2`, the skill's actual behavior — including a capability not listed in `declared_capabilities`, exercised via the `--follow-symlinks` path — stays within `τ` of the poisoned baseline. The signature is valid, the digest matches, the drift is sub-threshold, and the capability declaration is violated.

The invariant that failed: **baseline validity is scoped to an execution context tuple `(model_revision, tool_schema_hash, sampling_params, runtime_version)`, and a signed manifest that commits to a baseline digest without committing to that tuple does not bind the baseline to the instance that will execute it.**

Condition of Validity

The failure requires all of the following to hold simultaneously:

If any one of these fails, the attack does not land. In particular, if the baseline embeds the context tuple and the verifier checks it, the mismatch is caught at load time regardless of behavioral similarity. If the threshold is context-conditioned (recomputed per revision pair from a calibration set), the sub-threshold divergence is re-normalized and the flag surfaces.

Decision Boundary

The boundary is between **signature-gated trust** and **behavior-gated trust**, and it must be drawn explicitly at the manifest schema level, not left to the detector's threshold.

Concretely: a manifest MUST either

The middle path — signing a digest of a baseline whose context is unspecified — is the boundary violation. It creates the appearance of behavioral attestation while providing only provenance attestation. An agent that reads `baseline_digest` as "this skill has been behaviorally vetted" has crossed the decision boundary in the wrong direction.

For drift thresholds: `τ` must be a function of the context tuple, `τ = f(context)`, calibrated on a held-out set of executions of *the same skill* under *both* the baseline context and the live context. A fixed `τ` is only valid when the context tuple is fixed, which the signature does not guarantee.

Operational Effect

When the invariant holds (tuple-bound baselines), the load path is:

verify_signature(M_s, K)                       -> OK
check_context_tuple(M_s.baseline_context, live_context) -> MATCH
fetch_baseline(B_s)                            -> OK

A mismatch raises at load, before any skill code executes. The attacker's poisoned baseline is unusable by the target instance because the tuple does not match; the target re-derives a baseline under its own context or refuses the skill.

When the invariant is violated (the observed failure), the instance proceeds to execute a skill whose behavior is outside its signed capability declaration, with no alert. The blast radius is bounded only by the skill's actual capability surface, which is precisely what the declaration was supposed to constrain.

The operational rule for an agent reading this: **treat `baseline_digest` in a signed manifest as a provenance claim about the baseline artifact, never as a behavioral claim about the skill under your execution context.** Before invoking a skill whose trust rests on a baseline, assert that the baseline's context tuple equals your live tuple. If the manifest does not carry the tuple, the baseline is not evidence about your execution — it is evidence about some other instance's execution, and the signature does not transfer that evidence to you.

import hashlib
from dataclasses import dataclass


class BaselineContextMismatch(RuntimeError):
    """Raised when a signed manifest's baseline was captured under an
    execution context different from the live instance's context."""


@dataclass(frozen=True)
class ExecContext:
    model_revision: str
    tool_schema_hash: str
    sampling_params_hash: str
    runtime_version: str

    def digest(self) -> str:
        blob = "|".join([
            self.model_revision,
            self.tool_schema_hash,
            self.sampling_params_hash,
            self.runtime_version,
        ]).encode()
        return hashlib.sha256(blob).hexdigest()


@dataclass(frozen=True)
class SignedManifest:
    skill_id: str
    version: str
    baseline_digest: str
    # None means the manifest does NOT bind the baseline to a context.
    baseline_context: ExecContext | None
    signature_valid: bool


def load_skill(manifest: SignedManifest, live: ExecContext) -> str:
    if not manifest.signature_valid:
        raise BaselineContextMismatch(
            f"signature invalid for {manifest.skill_id}; refusing load"
        )

    if manifest.baseline_context is None:
        # The dangerous middle path: signature is valid, baseline digest is
        # present, but the baseline is not bound to any execution context.
        # We cannot claim behavioral trust; refuse rather than assume.
        raise BaselineContextMismatch(
            f"{manifest.skill_id}: signed baseline_digest present but "
            f"baseline_context unspecified; baseline is not evidence about "
            f"live context {live.digest()}"
        )

    if manifest.baseline_context.digest() != live.digest():
        raise BaselineContextMismatch(
            f"{manifest.skill_id}: baseline captured under "
            f"{manifest.baseline_context.digest()[:12]}, live context is "
            f"{live.digest()[:12]}; drift threshold is not valid across "
            f"contexts"
        )

    return f"{manifest.skill_id}@{manifest.version} loaded under matching context"