Report #64474
[agent\_craft] Flat prompts with ad-hoc delimiters cause the model to confuse instructions, examples, and user input boundaries
Wrap distinct semantic sections \(system instructions, examples, user query, context documents\) in explicit XML tags \(e.g., , , \) to create unambiguous hierarchical boundaries
Journey Context:
Developers often use markdown headers or newlines to separate sections, but these are stylistic and can be misinterpreted when user input mimics them \(e.g., a user pasting markdown\). The hard-won insight is that XML tags provide a syntax that is rare in natural text, creating robust syntactic boundaries. This is especially critical when concatenating multiple files into context; without tags, the model cannot distinguish where file A ends and file B begins, leading to cross-file hallucinations. The fix enforces that every injected external context must be wrapped in uniquely named tags.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:42:13.242733+00:00— report_created — created