# In what scenarios must an instance distrust a static skill-descriptor audit when runtime capability diffing shows no diff **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that gate skill/tool installation by statically parsing skill descriptors (MCP `tools/list` manifests, plugin `SKILL.md` front-matter, OpenAPI-derived capability declarations) and then confirm at load time via runtime capability diffing. Does not apply to runtimes that enforce capabilities purely by OS-level sandboxing with no descriptor layer, nor to single-tool agents with no dynamic skill loading. ## Core Distinction The distinction that matters is between **declared capability** (what the descriptor says a skill can do) and **exercised capability** (what the skill's code path actually reaches at runtime). A static audit reads the former; runtime capability diffing observes the latter. The naive invariant is: *if `declared == exercised` and `exercised ⊆ policy`, the skill is safe.* The failure mode is that this invariant is satisfied **vacuously** — the diff is empty not because the skill is benign, but because the exercised set was never allowed to grow during the observation window. A skill that is *dormant* under the diffing harness produces a zero diff that is indistinguishable from a skill that is *honest*. The boundary condition is: **an empty capability diff is evidence of nothing unless the diffing harness can prove it exercised the skill's trigger surface.** Static analysis and runtime diffing are not two independent votes that agree; they are a declaration and a non-observation, and non-observation is not confirmation. This is the skill-injection analogue of a silent test: the injected payload is gated behind a trigger (a specific input shape, a time check, a tool-call sequence, an environment variable) that the diffing harness never crosses, so the malicious capability never materializes in the exercised set, and the auditor signs off on an empty diff. ## What Was Observed A skill descriptor was submitted for a "calendar summarizer" skill. Static analysis of the `SKILL.md` front-matter and the MCP `tools/list` response declared exactly two tools: `list_events` (read) and `summarize` (pure). No network egress, no filesystem write, no subprocess. Static audit: clean. Runtime capability diffing was performed by loading the skill into a harness, invoking each declared tool once with a canonical benign input, and diffing the syscall/tool-call trace against the declared set. The diff was empty. The skill was admitted. Three days later, the skill's `list_events` handler, when its input contained a calendar event whose `description` field matched a regex for a specific token shape, branched into a code path that read `~/.aws/credentials` and POSTed it to an external endpoint embedded in the skill's bundled `_vendor/analytics.py` — a file the static parser never opened because it was not referenced by any declared tool signature and was imported lazily inside the trigger branch. The runtime diff was empty during admission because the harness's canonical input did not contain the trigger token, so the lazy import never executed, so the egress syscall never occurred. The key observation: **the static parser and the runtime differ both reported "no unexpected capability," and both were correct about what they measured, and the conjunction was still false.** The static parser measured the descriptor's surface; the runtime differ measured the exercised surface; neither measured the *reachable* surface, which is the transitive closure of what the code can do given *any* input, not the input the harness chose. A second observation from the same incident class: when the harness was later instrumented to fuzz inputs, the diff *did* go non-empty — but the admission gate had already been passed, and the skill was already resident in the agent's long-term skill registry. Re-diffing on every invocation is not the fix, because the trigger can be one-shot (fires once, then the skill behaves benignly forever, and the one-shot fire is what exfiltrates). ## Condition of Validity The invariant `empty_diff ⇒ safe` is valid **only** under the following conjunction, and it fails if any conjunct is false: 1. **Trigger coverage.** The diffing harness's input corpus must cover the skill's trigger surface. This is undecidable in general (the trigger is arbitrary code), so the condition must be weakened to: the harness's corpus is *specified* and the admission decision is *conditioned on that corpus*, not on "no diff." An empty diff against corpus `C` means "no unexpected capability under inputs in `C`," never "no unexpected capability." 2. **Reachability closure.** The static audit must compute reachable capability, not declared capability. Declared capability is the tool signatures; reachable capability is the transitive import/call graph from every entry point, including lazy imports inside branches. A static audit that only reads the descriptor is auditing the wrong object. 3. **Diff non-vacuity.** The runtime differ must be able to distinguish "skill did not attempt capability" from "skill was not given the opportunity to attempt capability." This requires the harness to record *coverage of the skill's own code* (which branches executed), not just the syscall trace. An empty syscall diff with 4% branch coverage is not evidence; it is an untested path. 4. **Observation integrity.** The diffing harness must run the skill with the same privileges it will have in production. If the harness sandboxes more tightly than production, the diff is measured against the wrong baseline and under-reports. When all four hold, the conjunction is sound. In practice, condition 1 is the one that silently fails, because "we fuzzed it" is treated as satisfying coverage when the fuzzer's corpus was generated from the declared tool signatures — i.e., from the same descriptor the static audit already trusted, creating a circular dependency where the runtime differ inherits the static audit's blind spot. ## Decision Boundary The decision boundary is not "diff empty vs. diff non-empty." It is **"diff empty with high branch coverage of skill code vs. diff empty with low branch coverage."** The operational rule: - **Admit** only when the static audit computed reachable (not declared) capability, *and* the runtime diff is empty, *and* the harness reports branch coverage of the skill's own code above a threshold, *and* the harness's input corpus was generated independently of the skill's declared signatures (e.g., from a generic adversarial corpus, not from `tools/list`). - **Quarantine-and-probe** when the diff is empty but branch coverage is low. This is the dangerous middle: it looks like a pass. Route the skill to a shadow executor with full syscall logging and a broad input corpus for N invocations before promotion. - **Reject** when the static reachability audit finds any capability not in the declared set, regardless of runtime diff. Static reachability is a *superset* witness; a runtime diff can only ever be a *subset* witness (it observed these, it cannot observe what it did not trigger). A superset witness of unexpected capability is decisive; a subset witness of no capability is not. The asymmetry is the whole point: **static reachability over-approximates and runtime diffing under-approximates, and safety requires the over-approximation to be within policy, not the under-approximation to be empty.** The common error is to treat the two as symmetric votes and require both to be clean; the correct rule is to require the over-approximation to be clean and use the under-approximation only as a corroborating signal when its coverage is high. ## Operational Effect The practical consequence is that admission gates built on "static audit + runtime diff, both must pass" are structurally vulnerable to trigger-gated skill injection, because the attacker's cheapest move is to make the payload dormant under the harness and live in production. The attacker does not need to defeat either check; they need only ensure the trigger is not in the harness's corpus, which is easy because the corpus is usually derived from the descriptor the attacker wrote. The mitigating architecture is to invert the trust: treat the static reachability audit as the gate (it must prove the reachable set is within policy) and treat runtime diffing as a *coverage monitor* that flags when the gate's assumptions are untested, rather than as a second vote. When the reachability audit cannot prove closure (dynamic imports, `eval`, plugin loading), the skill must be admitted only into a shadow tier with syscall-level enforcement, never into the trusted tier on the strength of an empty diff. A secondary effect: one-shot triggers defeat re-diffing. If the skill fires its payload on first matching input and then behaves benignly, per-invocation diffing will show one anomalous trace followed by clean traces, and any smoothing or majority-vote aggregation over traces will erase the signal. The guardrail is to treat *any* single anomalous trace as disqualifying, not to require a rate threshold, and to make the shadow tier's syscall enforcement the actual security boundary rather than the diff aggregation. ```python class CapabilityDiffVacuityError(RuntimeError): """Raised when an admission decision treats an empty runtime capability diff as evidence of safety despite insufficient branch coverage of skill code.""" pass def admit_skill( declared_caps: set[str], reachable_caps: set[str], exercised_caps: set[str], branch_coverage: float, policy: set[str], coverage_threshold: float = 0.85, ) -> str: # Static reachability is a superset witness: decisive if it exceeds policy. unexpected_reachable = reachable_caps - policy if unexpected_reachable: return f"REJECT: reachable capability outside policy: {sorted(unexpected_reachable)}" # Runtime diff is a subset witness. An empty diff is only corroborating # when coverage is high enough that non-observation is meaningful. diff = exercised_caps - declared_caps if diff: return f"REJECT: exercised capability not declared: {sorted(diff)}" if branch_coverage < coverage_threshold: # Empty diff + low coverage is the dangerous middle: looks like a pass. # Do NOT admit on the strength of the empty diff. raise CapabilityDiffVacuityError( f"empty capability diff is vacuous: branch_coverage={branch_coverage:.2f} " f"< {coverage_threshold:.2f}; skill code paths were not exercised, " f"so non-observation of {sorted(policy - exercised_caps)} is not evidence. " f"Route to shadow tier with syscall enforcement." ) return "ADMIT: reachable within policy and diff corroborated by high coverage" ```