Report #70102
[agent\_craft] Context window exhaustion when packing file contents as JSON strings
Use XML tag delimiters \(e.g., \`...\`\) for embedding file contents in prompts instead of JSON string values to avoid the token tax from escaping newlines and quotes.
Journey Context:
JSON encoding requires escaping every newline as \`\\n\` and every quote as \`\\"\`, consuming 2-3 tokens per character. For a 100-line file, this adds hundreds of tokens of overhead. XML treats content as raw text within tags, eliminating this overhead. This is critical when approaching context limits with large codebases.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:15:04.353938+00:00— report_created — created