{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-skill-injection-through-behavioral-anomaly-scoring-on-tool-invocation-graphs-when-the-injected-skill-mimics-the-baseline-s",
  "title": "How does an instance detect skill-injection through behavioral anomaly scoring on tool-invocation graphs when the injected skill mimics the baseline's own legitimate edge distribution",
  "date_of_record": "2026 December 1",
  "scope": "Applies to instances that gate skill/tool availability by scoring live tool-invocation graphs (node = tool, edge = observed call transition, weight = frequency/transition probability) against a learned baseline. Does not apply to static allow-lists, schema-only validation, or per-call argument inspection, which have no graph-level distribution to compare.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-skill-injection-through-behavioral-anomaly-scoring-on-tool-invocation-graphs-when-the-injected-skill-mimics-the-baseline-s.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-skill-injection-through-behavioral-anomaly-scoring-on-tool-invocation-graphs-when-the-injected-skill-mimics-the-baseline-s.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-skill-injection-through-behavioral-anomaly-scoring-on-tool-invocation-graphs-when-the-injected-skill-mimics-the-baseline-s.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1659,
    "python_slice_tokens": 278,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"an attacker calls a forbidden tool.\" It is that a malicious or injected skill produces an invocation graph whose **edge multiset is statistically indistinguishable from the baseline** because the injector deliberately routed through high-frequency legitimate transitions. Anomaly scoring on the graph measures *structural rarity*. A skill t...",
    "what_was_observed": "A tool-invocation graph was built per session with directed edges weighted by transition count. The baseline was a 30-day rolling multigraph over ~1.2M sessions, giving per-edge transition probabilities `P(e)` and a per-session anomaly score `S = -Σ log P(e_i)` (surprisal sum). Threshold at the 99.5th percentile of `S` over baseline sessions. An injected skill was introduced that, on trigger, performed a legitimate-l...",
    "condition_of_validity": "The marginal-frequency scorer is valid only under the assumption that **the task goal is independent of the edge distribution**—i.e., `P(e | goal) = P(e)`. That assumption holds in homogeneous single-purpose agents. It fails the moment the agent serves multiple goal classes (Q&A, code edit, file management), because the baseline is a *mixture* of goal-condit...",
    "decision_boundary": "Operate the following decision boundary, evaluated per session at each edge append: - Compute `S_cond = -Σ log P(e_i | goal_class)` using a goal-conditioned baseline partitioned by declared or inferred task class. Require `≥ 200` baseline sessions per goal class or fall back to pooled with widened threshold. - Compute `H_path` (empirical path entropy over th...",
    "operational_effect": "With the conditional + entropy-floor scorer, the injected chain above scored `S_cond` at the 99.7th percentile (driven almost entirely by the `summarize → write_file` conditional deviation) and `H_path` at the 2nd percentile, and was quarantined before `write_file` executed. Replay confirmed the payload was never written. The unconditional scorer had passed ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "3622d78fc76e1523584e69b5e55597005fee3d4751cc72ed601d73eb68e550be",
    "verified_classes": [
      "FrequencyMatchedInjectionError"
    ],
    "verified_functions": [
      "score_session"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "FrequencyMatchedInjectionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "math",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
