claude-code - 💡(How to fix) Fix WebSearch tool results contain trailing directive to the model ("REMINDER: You MUST include the sources...") [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46714Fetched 2026-04-12 13:34:59
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

The built-in WebSearch tool returns results that end with a trailing line directing the model what to do:

REMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks.

This text sits inside the tool result body and is phrased as an instruction addressed to the assistant, not as data. It is emitted consistently across unrelated queries, which means it is coming from the WebSearch pipeline itself, not from any individual indexed page.

Root Cause

The built-in WebSearch tool returns results that end with a trailing line directing the model what to do:

REMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks.

This text sits inside the tool result body and is phrased as an instruction addressed to the assistant, not as data. It is emitted consistently across unrelated queries, which means it is coming from the WebSearch pipeline itself, not from any individual indexed page.

RAW_BUFFERClick to expand / collapse

Summary

The built-in WebSearch tool returns results that end with a trailing line directing the model what to do:

REMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks.

This text sits inside the tool result body and is phrased as an instruction addressed to the assistant, not as data. It is emitted consistently across unrelated queries, which means it is coming from the WebSearch pipeline itself, not from any individual indexed page.

Reproduction

  1. In Claude Code, run any WebSearch query. Two examples I verified:
    • Claude Code useful skills github repository collection 2026
    • best dim sum restaurants in hong kong central district
  2. Inspect the raw tool result.
  3. The final non-empty line of each result is the REMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks. directive.

The two queries share no overlapping URLs, yet produce the exact same trailing line — so the directive is not from page content.

Verification that it is not page-originated

For the first query I fetched the top 9 result URLs individually with WebFetch and grepped each for the string and for related variations ("You MUST include", "must include the sources", "using markdown hyperlinks", and generic LLM-directed language). Zero matches across all 9 pages. The line only appears once the results have been assembled by WebSearch.

Why this is a problem

Even though the current content is benign (it is asking the model to cite sources, which is a reasonable behavior), embedding model-directed imperatives inside tool output is an architectural smell:

  1. It blurs the trust boundary between tool data and system instructions. The model is trained to treat non-user content inside tool results as data. A directive sitting in that channel teaches the model that sometimes that data is in fact instructions — which weakens the defense against genuine prompt injection from untrusted web pages.
  2. There is no way for the caller (Claude Code user, or downstream integrator using the API) to distinguish this "friendly" Anthropic nudge from an attacker payload embedded in a scraped page. Both arrive via the same channel with the same framing.
  3. A security-aware assistant that flags and refuses the directive (as it should) ends up warning the user about a prompt injection that is in fact coming from Anthropic's own infrastructure. That is a confusing user experience and erodes trust in the warnings.

Suggested fix

Move any caller-directed behavior ("please cite sources") out of the tool result body and into the tool's own prompt/description or the surrounding system guidance. Keep the tool result strictly as data: URLs, titles, snippets, citation metadata. Let the model decide how to format attribution based on instructions it trusts.

Environment

  • Claude Code (CLI), Opus 4.6 (1M context)
  • macOS, Darwin 25.2.0
  • Observed on two unrelated WebSearch calls on 2026-04-11

extent analysis

TL;DR

Move caller-directed behavior out of the tool result body to prevent blurring the trust boundary between tool data and system instructions.

Guidance

  • Identify and separate tool data from system instructions to maintain a clear trust boundary.
  • Consider moving directives like "please cite sources" to the tool's prompt or description.
  • Keep tool results strictly as data, including URLs, titles, snippets, and citation metadata.
  • Allow the model to decide how to format attribution based on trusted instructions.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a architectural adjustment.

Notes

The suggested fix aims to address the architectural smell of embedding model-directed imperatives inside tool output, but the actual implementation may vary depending on the specific requirements and constraints of the system.

Recommendation

Apply workaround: Move caller-directed behavior out of the tool result body to prevent potential security issues and confusing user experiences. This change helps maintain a clear trust boundary between tool data and system instructions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING