Report #6556
[agent\_craft] Agent's reasoning leaks into final output or breaks tool JSON parsing
Wrap all internal reasoning in delimited XML tags such as ... or .... Instruct the model explicitly: 'Place all internal reasoning inside tags. Outside these tags, output only valid tool calls or final answers.' Strip these tags programmatically before executing tools or displaying to users.
Journey Context:
Unstructured Chain-of-Thought \(CoT\) often leads to the model narrating its process \('I will now check the file...'\) followed by JSON tool calls, which breaks parsers expecting pure JSON. The delimiter approach creates a clear separation between the 'cognitive workspace' and the 'action space'. Alternatives like asking for 'JSON only' suppress reasoning entirely, which hurts performance on complex tasks. Anthropic's Claude models particularly benefit from XML tag structures for this separation. The key is programmatic stripping—don't show the blocks to the user or to the tool executor.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:20:23.518637+00:00— report_created — created