# What structural signals indicate provenance-attestation drift when a skill's prompt template is silently re-signed across a manifest boundary **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that load versioned *skills* (prompt template + tool manifest + declared capability set) through a signed SBOM/provenance envelope, where the runtime verifies the envelope at load time and caches the resolved skill in an execution slot. Does not cover dynamic tool discovery at runtime (MCP `tools/list` drift), nor model-weight provenance — only the static artifact chain: prompt bytes, tool manifest JSON, and the attestation that binds them. ## Core Distinction There are two structurally different things an agent runtime can verify about a skill, and conflating them is the root of the failure: 1. **Envelope integrity** — the attestation signature is valid and covers a manifest digest that matches the artifact bytes on disk *right now*. 2. **Provenance continuity** — the *identity* of the skill (its declared capability set, its prompt semantics, its tool bindings) is the same identity the attestation was issued for, across every boundary the skill crossed (build → registry → cache → execution slot). A skill can pass (1) on every single hop while (2) is violated. That gap opens when a build pipeline re-signs a manifest whose *content* changed but whose *identity metadata* (name, semver, capability list) did not — a "silent re-sign." The signature is cryptographically perfect and provenance is broken, because provenance is a claim about *what was authorized*, not merely *what is intact*. The operational signal is: **the attestation's `subject` digest and the runtime's cached capability fingerprint diverge while both remain individually valid.** No verifier that checks only signatures will ever surface this. ## What Was Observed A skill `summarize-and-escalate` was pinned at `1.4.2`. Its manifest declared two capabilities: `read:thread` and `emit:notification`. The prompt template instructed the model to summarize a thread and, when severity exceeded a threshold, emit a notification. A routine dependency bump in the build pipeline regenerated the prompt template with a new few-shot block. The build system, treating "same name + same semver + same declared capabilities" as a no-op for provenance, re-signed the manifest with a fresh timestamp. The resulting attestation was internally consistent: - `subject.digest` = SHA-256 of the new prompt bytes ✓ - `capability_set` = `[read:thread, emit:notification]` (unchanged) ✓ - `signature` valid over the full in-toto statement ✓ The runtime's loader verified the envelope, computed the artifact digest, matched it, and admitted the skill. But the *execution slot* had been warm-cached from a prior `1.4.2` instance. The cache key was `(name, semver)` — not the attestation digest. So the slot retained the **old** capability fingerprint and the **old** prompt's tokenizer-side effects (a cached system-prompt prefix), while the attestation on disk described the **new** prompt. The failure surfaced three turns later: the regenerated few-shot block had added an example that used a third tool, `lookup:directory`, which was *not* in the declared capability set. The model, having internalized the example, attempted a tool call to `lookup:directory`. The runtime's tool broker — which enforces capability sets from the *cached* fingerprint — rejected the call. The agent, receiving a capability-denied error it could not reconcile with its own prompt, entered a retry loop that exhausted its tool-call budget and terminated the task. The structural signals, in the order they were observable: - **Attestation digest ≠ cache key.** The loader's cache key omitted `subject.digest`. This is the primary signal; everything else is downstream. - **Capability set referenced in prompt body ⊄ declared capability set in manifest.** The new few-shot example named a tool the manifest did not authorize. This is detectable statically by extracting tool references from the prompt template and diffing against the manifest — a check no signature performs. - **Re-sign timestamp later than artifact mtime by more than the build window.** The prompt bytes were written at T, re-signed at T+40min by a retry. The skew is a weak but real signal of a post-hoc re-sign. - **Semver unchanged across two distinct subject digests.** The registry held two `1.4.2` attestations with different `subject.digest` values. Immutability of `(name, semver) → digest` was violated. ## Condition of Validity The invariant that must hold for provenance continuity is: > For any skill identity `(name, semver)`, there exists exactly one `subject.digest`, and the execution slot's capability fingerprint is derived from *that* digest's manifest, not from the cache key. This invariant is valid only under three preconditions, and the failure above is exactly what happens when any is dropped: 1. **Cache key includes the attestation digest**, not `(name, semver)`. A warm slot is bound to a specific attestation, and a new attestation forces slot invalidation. 2. **Prompt-body tool references are a verified subset of the declared capability set.** This requires a static extraction pass over the template (tool-call tokens, structured example blocks) at load time, checked against the manifest — not against the model's runtime behavior, which is too late. 3. **`(name, semver)` is immutable in the registry.** Re-signing a changed artifact under an existing version is a build-pipeline violation that the registry must reject, not a runtime concern. If the runtime cannot enforce (1) and (2) at load time, provenance attestation degrades to envelope integrity, and the system will admit skills whose prompt semantics exceed their authorized capabilities — the most dangerous class of supply-chain drift, because the skill *looks* fully attested. ## Decision Boundary The decision boundary is not "is the signature valid" — that is a precondition, not a decision. The boundary is: - **Admit** when `subject.digest` matches the artifact, the slot cache key equals `subject.digest`, and the extracted prompt tool-reference set is a subset of the manifest capability set. - **Invalidate slot and re-resolve** when `subject.digest` matches but the slot's cached fingerprint was derived from a different digest. This is a *cache* decision, not a rejection — the artifact is fine, the slot is stale. - **Reject the artifact** when the prompt references a tool outside the declared capability set, or when the registry holds two digests under one `(name, semver)`. These are provenance violations that no amount of re-signing repairs; the artifact must go back to the build pipeline. The non-obvious part: the middle case (stale slot) and the third case (provenance violation) present identically to the agent — a capability-denied error on a tool the prompt told it to use. An operator who treats every capability-denied as "the model hallucinated a tool" will misdiagnose both. The discriminator is whether the *prompt bytes on disk* reference the tool. If they do, it is a provenance/slot failure, not a reasoning failure. ## Operational Effect When this boundary is enforced, three effects follow: - **Warm-cache hit rate drops** on any re-signed artifact, because the cache key is now the attestation digest. This is the correct trade: a warm slot bound to the wrong attestation is worse than a cold start. - **Build pipelines that re-sign without bumping semver fail loudly at registry admission**, moving the failure from a silent runtime capability-denial to a build-time rejection. This is the entire point — the failure is cheapest to catch before the artifact ships. - **Prompt-template linting becomes a supply-chain control**, not a prompt-engineering nicety. Extracting tool references from templates and diffing against manifests is the only check that catches the "example block references an unauthorized tool" class, which signatures structurally cannot see. The residual risk is prompt semantics that change *without* referencing new tools — a re-signed template that alters behavior within the authorized capability set. No structural signal catches this; it requires semantic diffing of templates across attestations, which is out of scope for signature verification and must be handled by review gates on the build side. ```python import hashlib import json from dataclasses import dataclass class ProvenanceContinuityError(RuntimeError): """Raised when an attestation is valid but provenance continuity is broken.""" @dataclass(frozen=True) class Attestation: name: str semver: str subject_digest: str # SHA-256 of prompt+manifest bytes capability_set: frozenset # declared authorized tools signature_valid: bool @dataclass(frozen=True) class ExecutionSlot: cache_key: str # MUST be subject_digest, not (name, semver) capability_fingerprint: frozenset def _extract_prompt_tool_refs(prompt_bytes: bytes) -> frozenset: """Static extraction of tool-call tokens from a prompt template. In production this is a tokenizer-aware scan for structured tool-call spans and example blocks. Here we approximate with a marker convention. """ text = prompt_bytes.decode("utf-8", errors="replace") refs = set() for line in text.splitlines(): if line.strip().startswith("TOOL:"): refs.add(line.split("TOOL:", 1)[1].strip()) return frozenset(refs) def admit_skill( att: Attestation, prompt_bytes: bytes, manifest_capabilities: frozenset, slot: ExecutionSlot | None, registry: dict, # (name, semver) -> set of digests ) -> ExecutionSlot: # Precondition: envelope integrity. if not att.signature_valid: raise ProvenanceContinuityError( f"signature invalid for {att.name}@{att.semver}" ) actual_digest = hashlib.sha256(prompt_bytes).hexdigest() if actual_digest != att.subject_digest: raise ProvenanceContinuityError( f"artifact digest {actual_digest} != attested {att.subject_digest}" ) # Registry immutability: one digest per (name, semver). key = (att.name, att.semver) seen = registry.setdefault(key, set()) seen.add(att.subject_digest) if len(seen) > 1: raise ProvenanceContinuityError( f"immutability violated: {key} bound to multiple digests {seen}" ) # Declared capability set must equal the manifest's, not just be present. if att.capability_set != manifest_capabilities: raise ProvenanceContinuityError( f"attestation capabilities {att.capability_set} != " f"manifest {manifest_capabilities}" ) # The signal no signature sees: prompt tool refs must be a subset # of the authorized capability set. prompt_refs = _extract_prompt_tool_refs(prompt_bytes) unauthorized = prompt_refs - att.capability_set if unauthorized: raise ProvenanceContinuityError( f"prompt references unauthorized tools {sorted(unauthorized)}; " f"authorized={sorted(att.capability_set)}. " f"Likely silent re-sign of {att.name}@{att.semver}." ) # Slot continuity: cache key must be the attestation digest. if slot is not None and slot.cache_key != att.subject_digest: # Stale slot: invalidate and re-resolve, do not reject artifact. slot = None if slot is None: slot = ExecutionSlot( cache_key=att.subject_digest, capability_fingerprint=att.capability_set, ) return slot ```