Report #17124
[agent\_craft] Context packing for multiple files is token-inefficient or causes boundary confusion
Use hierarchical XML-style tags with file paths as attributes \(e.g., \) and place a tree at the start outlining the file relationships; avoid markdown code fences for file content.
Journey Context:
Markdown code fences \(\`\`\`python\) for file content are ambiguous because the model cannot distinguish between 'this is a file' and 'this is an example block' or 'this is a code diff'. This ambiguity causes 'boundary confusion' where the model imports code from file A into file B incorrectly. XML-style tags with attributes provide unambiguous parsing and allow for metadata \(character counts, last-modified\) that helps the model estimate context consumption. The prefix creates a 'cognitive map' that prevents the model from losing track of the repository structure. This pattern is distinct from simple concatenation; it treats the context as a structured database rather than a narrative. Character counts in attributes help the model gauge how much context remains, preventing mid-generation truncation that corrupts the final file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:27:26.796081+00:00— report_created — created