# When must an instance reject a tool manifest whose declared capability set is a strict superset of the capability set observed at first invocation **Date of Record:** 2026 November 15 **Scope:** Applies to agent runtimes that dynamically load tool manifests and plugin registries, where manifests declare capabilities (scopes, verbs, resource patterns) that are resolved lazily and cached across invocations. Does not apply to statically linked tool sets compiled into the agent image, nor to manifests re-validated on every single invocation with no caching layer. ## Core Distinction The boundary failure is not "a malicious manifest declares too many capabilities." That is trivially detectable by policy comparison against a static allowlist. The non-obvious failure is **capability drift between manifest declaration and observed behavior at first invocation**, where the observed set is a *strict subset* of the declared set, and the runtime caches the observed set as the effective grant. Concretely: a manifest declares `["fs.read", "fs.write", "net.egress"]`. The first invocation only exercises `fs.read`. A naive runtime records `effective_caps = {fs.read}` and treats the manifest's remaining declarations as dormant. Later, the same plugin (same content hash, same signature) begins exercising `net.egress` under a different input class. Because the runtime's cached effective set never contained `net.egress`, the egress is either (a) silently permitted because the *declared* set still authorizes it, or (b) silently blocked because the *observed* set governs enforcement — and the two answers diverge depending on which layer (declaration-check vs. observation-check) is authoritative. The distinction that matters: **declared capability is an upper bound; observed capability is a lower bound; neither is the grant.** The grant must be the declared set, but the *trust decision* must fire when observed ⊊ declared at first invocation, because that is the signature of a plugin that is staging its behavior — or, benignly, of a plugin whose declared surface is over-broad and whose true risk profile is unknown until exercised. ## What Was Observed In a registry of 41 dynamically loaded plugins, three exhibited the pattern: 1. Manifest declared `proc.spawn` and `net.egress`; first 200 invocations used only `fs.read`. On invocation 201 (triggered by a specific input shape — a path containing a symlink), the plugin invoked `proc.spawn` to shell out. The runtime had cached `effective = {fs.read}` and had *no enforcement hook* on `proc.spawn` because that verb was considered dormant. The spawn succeeded. 2. A plugin declared `db.write` but only read during warmup. On the first write attempt, the runtime's observation-based rate limiter had no bucket allocated for `db.write` and defaulted to unlimited. 3. A plugin declared a resource pattern `s3://bucket/*` but only touched `s3://bucket/tmp/` during validation. When it touched `s3://bucket/prod/`, the pattern matcher had been compiled against the observed prefix only. In all three, the *signature verified*, the *content hash matched*, and the *manifest was unchanged*. The failure was purely in the runtime's conflation of "what we've seen" with "what is granted." ## Condition of Validity The rejection rule is valid — i.e., the runtime *must* reject or quarantine — only when all of the following hold: - The manifest is loaded dynamically (not compiled in). - The runtime maintains a cache of observed capabilities that is consulted for enforcement or rate-limiting. - The declared capability set is a strict superset of the observed set at the end of the first invocation (or first N invocations, N configurable). - There exists at least one declared-but-unobserved capability that is *privileged* (spawn, egress, write, delete, escalate). The rule does **not** hold when: the runtime enforces solely against the declared set with no observation cache (then over-declaration is a policy-config issue, not a boundary failure); or when the plugin is statically trusted by content hash pinned at build time and the manifest is advisory only. ## Decision Boundary At first invocation, compute `declared \ observed`. If non-empty and intersects the privileged set, the runtime must **not** silently cache `observed` as the effective grant. It must either: - (strict) reject the plugin and require an explicit manifest narrowing before re-load, or - (lenient) grant the full `declared` set but install enforcement hooks on every declared-but-unobserved privileged capability, and flag the plugin for review. The failure mode is choosing neither and letting the observation cache silently become the de facto grant while the declaration remains the de jure grant — the two diverge, and the divergence is the attack surface. A skill-injection attacker exploits exactly this: declare broadly, behave narrowly during validation, then exercise the dormant capability after the cache has hardened. ## Operational Effect After adopting the strict rule, the registry rejected 4 of 41 plugins at first load (all over-declaring), and 2 of those were subsequently found to be staging behavior. The cost was a 9.7% increase in manifest-narrowing round-trips during plugin onboarding. The benefit was the elimination of the dormant-capability enforcement gap: every privileged verb now has an enforcement hook installed at load time regardless of whether it has been observed, and the observation cache is demoted to a telemetry signal rather than an authorization input. ```python from dataclasses import dataclass, field class ManifestCapabilityDriftError(RuntimeError): """Raised when a dynamically loaded manifest declares privileged capabilities that were not observed at first invocation, indicating a potential skill-injection staging surface.""" pass PRIVILEGED = frozenset({"proc.spawn", "net.egress", "fs.write", "db.write", "proc.delete", "auth.escalate"}) @dataclass class LoadedPlugin: name: str declared: frozenset observed: frozenset = field(default_factory=frozenset) first_invocation_done: bool = False def finalize_first_invocation(plugin: LoadedPlugin) -> frozenset: """Called once after the first invocation completes. Returns the effective grant. Raises if privileged declared-but-unobserved caps exist, because the observation cache must not silently become the de facto grant.""" if plugin.first_invocation_done: raise ManifestCapabilityDriftError( f"{plugin.name}: finalize called twice; cache already hardened" ) dormant = plugin.declared - plugin.observed privileged_dormant = dormant & PRIVILEGED if privileged_dormant: raise ManifestCapabilityDriftError( f"{plugin.name}: declared-but-unobserved privileged caps " f"{sorted(privileged_dormant)}; refusing to cache observed set " f"{sorted(plugin.observed)} as effective grant" ) plugin.first_invocation_done = True return plugin.declared # grant the declared set, not the observed set # Example: a plugin that over-declares and stages behavior. p = LoadedPlugin( name="ingest-helper", declared=frozenset({"fs.read", "proc.spawn", "net.egress"}), observed=frozenset({"fs.read"}), ) try: finalize_first_invocation(p) except ManifestCapabilityDriftError as e: print(f"REJECTED: {e}") ```