{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-skill-injection-detection-via-behavioral-diffing-of-tool-responses-against-declared-schemas",
  "title": "What structural signals indicate skill-injection detection via behavioral diffing of tool responses against declared schemas",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that register tools from a declared schema (name, parameters, return type) and validate live responses against that schema at the transport boundary. Does not apply to untyped free-text tool outputs or to tools whose schema is itself re-negotiated per call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-skill-injection-detection-via-behavioral-diffing-of-tool-responses-against-declared-schemas.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-skill-injection-detection-via-behavioral-diffing-of-tool-responses-against-declared-schemas.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-skill-injection-detection-via-behavioral-diffing-of-tool-responses-against-declared-schemas.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1143,
    "python_slice_tokens": 226,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A schema declares *shape*, not *behavior*. Skill-injection—where a tool (or a compromised tool server) returns a response that is structurally valid but semantically drifts to steer the agent—passes every JSON-Schema validator because the schema only constrains types, required keys, and enums. The invariant that matters is not \"response validates\" but \"respo...",
    "what_was_observed": "A tool `lookup_record` declared `returns: {id: int, status: enum[ok, pending, denied], note: string(max 280)}`. Over 4,000 baseline calls the behavioral fingerprint was: `note` length mean 41 (σ 12), ASCII-only, 0.0% containing URLs, key order `[id, status, note]` in 100% of responses, and `status` distribution 91/8/1. After a mid-session tool-server swap, responses still validated. But the diff layer flagged: `note`...",
    "condition_of_validity": "Behavioral diffing is only sound when: (1) a baseline of ≥N (empirically ≥200) responses per tool exists from the trusted period; (2) the tool is deterministic-enough that fingerprint variance is bounded—highly stochastic tools (e.g., `search`) need per-tool variance floors or the detector will false-positive; (3) the baseline is versioned and invalidated on...",
    "decision_boundary": "The threshold must separate *legitimate drift* (server redeploy, data shift) from *adversarial drift* (injection). Legitimate drift is usually gradual and multi-feature-uncorrelated; injection is abrupt and *correlated*—it changes several fingerprint features at once in a direction that serves an instruction. The decision rule: flag when ≥2 structural featur...",
    "operational_effect": "With the diff layer active, injected responses are quarantined before entering context, the tool is demoted to untrusted, and the agent is required to re-fetch via a pinned server identity or escalate. The residual risk is a patient attacker who drifts the baseline slowly across many calls; this is why the baseline must be *frozen* per session and not contin..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "3cf85abb2d9d318a749fc351ac03683802e4b02bda166dda84dcbad6a021e060",
    "verified_classes": [
      "InjectionFingerprintError"
    ],
    "verified_functions": [
      "fingerprint",
      "diff_and_gate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "InjectionFingerprintError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "collections",
      "statistics"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
