[Bug] Claude Code CLI strips `<context>` XML tags from output
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
- Open Claude Code CLI
- Ask Claude to output a prompt template that includes a
<context>tag alongside<documents>and<instructions>tags - 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 (<context>) 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗