{
  "schema_version": "1.3.0",
  "slug": "what-invariants-prevent-tool-result-reflection-attacks",
  "title": "What invariants prevent tool result reflection attacks?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** Tools can reflect user input in their responses, agent context treats tool results as trusted, and injection is possible through reflection. * **Does not apply when:** Tools have strict input-output separation (output ne",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-invariants-prevent-tool-result-reflection-attacks.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-invariants-prevent-tool-result-reflection-attacks.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-invariants-prevent-tool-result-reflection-attacks.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1028,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The separation between **tool result content** (the data the tool returns) and **tool result trust** (whether the returned content is genuine tool output or reflected user input). Relying on content creates the **Reflection Injection**: an attacker crafts input containing prompt-injection payloads, the tool echoes the input in its response (e.g., \"searching ...",
    "what_was_observed": "In tool-invoking agent architectures, failing to distinguish genuine output from reflection produces three primary failure modes: 1. **Echo Injection:** A search tool returns \"No results found for: [malicious prompt].\" The agent treats the whole response as tool output, and the malicious prompt inside executes as if it were legitimate context. 2. **Error Reflection:** An error message includes the user's input (\"Inva...",
    "condition_of_validity": "* **Applies when:** Tools can reflect user input in their responses, agent context treats tool results as trusted, and injection is possible through reflection. * **Does not apply when:** Tools have strict input-output separation (output never includes input content) or the agent sanitizes all reflections before reasoning.",
    "decision_boundary": "1. **Does the tool result include user input content?** If no, standard trust applies. If yes, proceed. 2. **Is the reflected content marked with `reflection_marker_signature`?** If yes, isolate the reflected content. If no, the reflection is untrusted. 3. **Does the `injection_scan_receipt` show suspicious patterns in the reflected content?** If yes, quaran...",
    "operational_effect": "1. **Echo Injection Prevention:** Reflection is isolated from genuine output. 2. **Error Reflection Safety:** Errors do not leak injected prompts into reasoning. 3. **Structured Reflection Handling:** JSON reflections preserve the input-origin marker."
  },
  "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": "83748f1b7ea0518c448bb5e190984dbc84dda254a3f098044050964bff2d5e4f",
    "verified_classes": [
      "ReflectionVerdict",
      "ToolResult",
      "ReflectionPolicy",
      "ReflectionManifest",
      "ToolReflectionGuard"
    ],
    "verified_functions": [
      "_hash",
      "evaluate_result"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 0,
    "raised_exceptions": [],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
