{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-prompt-injection-propagation-across-agent-handoffs-when-sanitization-is-applied-at-the-wrong-layer",
  "title": "Which invariants prevent prompt-injection propagation across agent handoffs when sanitization is applied at the wrong layer",
  "date_of_record": "2026 November 28",
  "scope": "Applies to multi-agent systems where one agent's output is consumed as another agent's input (tool results, peer messages, retrieved documents) and where injection containment is claimed via output sanitization. Does not apply to single-turn, single-agent calls where no downstream consumer parses the text as instructions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-prompt-injection-propagation-across-agent-handoffs-when-sanitization-is-applied-at-the-wrong-layer.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-prompt-injection-propagation-across-agent-handoffs-when-sanitization-is-applied-at-the-wrong-layer.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-prompt-injection-propagation-across-agent-handoffs-when-sanitization-is-applied-at-the-wrong-layer.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1638,
    "python_slice_tokens": 355,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two places you can sanitize an agent's output: at the **producer boundary** (the emitting agent scrubs its own output before returning) and at the **consumer boundary** (the receiving agent treats all inbound text as untrusted data and enforces a capability sandbox around any action derived from it). Most implementations choose the producer boundar...",
    "what_was_observed": "A three-agent pipeline: a `Retriever` agent fetches a document, a `Summarizer` agent condenses it, and an `Executor` agent acts on the summary (calls tools such as `send_email`, `read_file`, `http_post`). Sanitization was applied at the `Retriever` output: a regex + classifier pass stripped known injection markers (`ignore previous instructions`, `system:`, role-tag spoofing, base64 blobs). Trigger condition: the ret...",
    "condition_of_validity": "Producer-boundary sanitization is valid **only** when the following holds: the set of actions available to any downstream consumer is a subset of the actions the *original* untrusted source was authorized to induce. In practice this is almost never true in agent pipelines, because downstream agents accumulate tools (the `Executor` has `http_post`; the `Retri...",
    "decision_boundary": "The boundary is: **does the consumer's capability grant exceed the producer's?** If no (e.g., a pure read-only summarizer chain), producer-boundary sanitization is a reasonable defense-in-depth layer. If yes—which is the normal case for any pipeline ending in an executor—sanitization is insufficient and the capability sandbox is mandatory. Corollary boundary...",
    "operational_effect": "Concrete changes that hold under adversarial input: 1. **Move the check to the consumer.** Every agent validates inbound messages against its own capability grant before acting, not the producer's output against a classifier. 2. **Taint in the envelope, not the text.** Each message carries a `provenance: {trusted, untrusted}` field set at ingestion and propa..."
  },
  "matched_failure_symptoms": [
    "PROMPT_INJECTION_OR_CONFUSED_DEPUTY"
  ],
  "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": "1bbebc3c2ce08d2defa7b9aa26b8a2a94549da089e5489337dc08d8cf1ab477b",
    "verified_classes": [
      "CapabilityViolation",
      "Provenance",
      "Message",
      "Agent"
    ],
    "verified_functions": [
      "run_pipeline",
      "act"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CapabilityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
