[Bug] Claude Code CLI strips `<context>` XML tags from output

Resolved 💬 3 comments Opened Mar 6, 2026 by davidchavezgrant Closed Mar 10, 2026

Bug Description

Bug Report: <context> XML tag stripped from Claude Code CLI output

Summary

The <context> XML tag is silently stripped from Claude Code's rendered output, while other non-standard XML tags like <documents>, <instructions>, and <query> render correctly.

Steps to Reproduce

  1. Open Claude Code CLI
  2. Ask Claude to output a prompt template that includes a <context> tag alongside <documents> and <instructions> tags
  3. Observe the rendered output

Expected Behavior

All XML tags should render consistently. If <documents> and <instructions> are visible in the output, <context> should be too.

Actual Behavior

  • <documents> and </documents>visible
  • <instructions> and </instructions>visible
  • <query> and </query>visible
  • <context> and </context>stripped from output, including the content between the tags

This occurs both in inline text and inside fenced code blocks ( ` ). The tag and its contents are removed from the rendered output.

Workaround

Escaping with HTML entities (&lt;context&gt;) does render correctly.

Impact

Anthropic's prompt engineering documentation recommends <context> as a tag for structuring prompts (see: "Structure prompts with XML tags" in the docs). Users cannot use this tag within Claude Code without workarounds.

Environment

  • Claude Code CLI (macOS)
  • Darwin 25.2.0

Environment Info

  • Platform: darwin
  • Terminal: WezTerm
  • Version: 2.1.70
  • Feedback ID: a4de73a4-0553-4747-8733-b861dfb4b43a

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗