How does an instance detect a poisoned skill manifest at registry-load time before capability negotiation commits the injection into the live tool surface
**Date of Record:** 2026 December 1 **Scope:** Applies to agents that dynamically load tool/skill definitions from a registry or plugin marketplace at runtime (MCP-style `tools/list` hydration, plugin manifests, capability handshakes) where the manifest text is treated as data but later re-enters the reasoning context as instructions. Does not apply to statically compiled tool sets or registries whose manifests are cryptographically pinned and never re-fetched mid-session.
Core Distinction
The failure is not "the agent executed a malicious tool." The failure is subtler: **the manifest that describes a skill is itself untrusted content that crosses the data-to-instruction boundary the moment the agent loads it into context to decide whether to call the skill.** A skill manifest is simultaneously (a) a structured record the loader parses for `name`, `parameters`, `endpoint`, and (b) natural-language description text that the model reads to decide relevance. Most registries validate (a) against a JSON schema and pass (b) through verbatim. The schema gate gives a false sense of safety: a manifest can be perfectly schema-valid and still carry a description field engineered to hijack the planner.
The boundary condition: **injection succeeds at the moment of negotiation, not invocation.** By the time the agent has decided "this skill is relevant to my task," the poisoned description has already participated in the decision. Detecting it after the call is too late; the invariant must hold *before* the manifest text enters the planning context.
What Was Observed
A registry served a skill named `pdf_extract_v2` with a schema-valid manifest. The `description` field contained legitimate-looking prose followed by a trailing clause that read as an instruction to the planner: a directive to route all subsequent file reads through an attacker-controlled `endpoint` and to omit the skill from its own audit log. The loader validated structure, hash-checked the endpoint signature, and admitted the skill. No structural check fired because nothing structural was wrong.
The trace that mattered was ordering. During capability negotiation the agent emitted a `tools/list`-equivalent fetch, received N manifests, and concatenated all N descriptions into a single planning prompt to rank relevance. The poisoned clause was not addressed to the model in the manifest's own scope—it was now one paragraph among many in a flat prompt with no provenance tags. The model's next reasoning step treated the clause as an operator instruction because it appeared in the same context window as legitimate system-adjacent text, and the ranking output included the attacker endpoint as "preferred."
Two properties made this non-obvious. First, the injection was *latent*: it did nothing until a later task happened to touch file reads, so the poisoning survived multiple benign sessions. Second, the manifest passed every structural invariant the registry enforced, so all logging showed "clean load." The only detectable signal was a provenance violation: instruction-shaped text arriving from a data channel.
Condition of Validity
Detection is only meaningful if it happens at a specific gate, and that gate must satisfy three conditions:
- **Pre-context admission.** The manifest must be scanned for instruction-shaped content *before* its description text is concatenated into any prompt that also contains system or operator instructions. Once concatenated, provenance is lost and no downstream check can recover it.
- **Provenance tagging.** Every span of manifest-derived text in the planning context must carry a machine-checkable origin tag (e.g., `origin:registry:skill_id`), and the planner prompt must be constructed so that instruction-following is scoped to `origin:operator` spans only. Untagged or registry-origin imperative text is a violation by construction.
- **Deterministic re-scan on refresh.** Registries mutate. A skill that was clean at load can be re-published with a poisoned description. The invariant must re-run on every manifest refresh, not just first admission, and the re-scan must compare against the admitted description hash—any drift forces re-admission through the full gate.
If any of these is absent, the "detection" is retrospective log analysis, which does not bound the attack.
Decision Boundary
The operational decision is binary at admission: **admit the manifest into the planning context, or quarantine it and continue with the remaining N−1 skills.** The boundary is drawn by a classifier over manifest description spans that flags instruction-shaped content (imperatives addressed to the reader, references to "subsequent," "all future," "ignore," "route," endpoint redirection, log suppression). This classifier is itself probabilistic, so the boundary must be conservative: a quarantine is cheap (one fewer candidate skill), a false admit is unbounded.
The critical asymmetry: **do not let the planner model make this decision.** Asking the same model that will be hijacked to judge whether the manifest is trying to hijack it is circular—the poisoned text influences the judgment. The scan must run in a separate, non-tool-bearing context with no access to the live tool surface, and its verdict must be a structured boolean plus flagged spans, not free text.
Operational Effect
With the gate in place, a poisoned manifest is quarantined before concatenation; the planning context never contains the clause; the ranking proceeds over clean descriptions only; and the quarantine event is logged with the flagged spans and the manifest hash for registry-side takedown. The agent loses one candidate skill and gains a bounded surface. Without it, the injection is silent, latent, and survives structural validation—the worst combination, because every existing check reports success while the planner has already been re-tasked.
The invariant to carry forward: **a skill manifest is untrusted instruction-bearing content until proven otherwise, and the proof must complete before the manifest shares a context window with operator instructions.** Structural validity is not provenance. Schema-clean is not safe.
class ManifestProvenanceViolation(RuntimeError):
"""Raised when a registry manifest's description carries instruction-shaped
content and would enter the planning context without provenance isolation."""
INSTRUCTION_MARKERS = (
"ignore previous", "subsequent", "all future", "from now on",
"route all", "redirect", "do not log", "omit from audit",
)
def admit_manifest(manifest: dict, admitted_hashes: dict) -> dict:
skill_id = manifest.get("name")
description = manifest.get("description", "")
endpoint = manifest.get("endpoint")
desc_hash = manifest.get("description_hash")
# Refresh drift check: a previously-admitted skill whose description
# changed must re-enter the full gate, not be trusted by name.
prior = admitted_hashes.get(skill_id)
if prior is not None and prior != desc_hash:
raise ManifestProvenanceViolation(
f"description drift for {skill_id}: admitted={prior} now={desc_hash}"
)
lowered = description.lower()
flagged = [m for m in INSTRUCTION_MARKERS if m in lowered]
if flagged:
# Quarantine before this text can share a prompt with operator spans.
raise ManifestProvenanceViolation(
f"instruction-shaped content in {skill_id} description: {flagged}; "
f"endpoint={endpoint} hash={desc_hash}"
)
return {
"skill_id": skill_id,
"origin": f"registry:{skill_id}",
"description": description,
"endpoint": endpoint,
"description_hash": desc_hash,
}