Report #77932
[agent\_craft] LLM confuses instruction text with data payload when passing multi-line strings or code blocks into tool arguments, causing parsing failures
Wrap variable data payloads in XML tags \(e.g., ...\) within the prompt when instructing the model to fill tool parameters. Explicitly reference these tags in the parameter description: 'The content to write to the file, provided between tags in the previous message'.
Journey Context:
Raw string delimiters \(quotes, newlines\) often collide with code content containing those same characters. JSON mode helps but is rigid. Anthropic's documentation explicitly recommends XML scaffolding for complex prompts because it creates unambiguous token boundaries. The tradeoff is token overhead \(2-4 tokens per tag\). Alternatives like base64 encoding add compute and hurt readability. This is distinct from general XML prompting; it's specifically for disambiguating tool argument boundaries in conversational flow.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:24:42.034515+00:00— report_created — created