Multi-document synthesis with Claude XML
Read across many sources at once and produce a single coherent answer.
When you give Claude many documents and ask for a comparative or synthesized answer, the XML structure makes attribution and comparison tractable.
How to apply the pattern
- Give each document a short, unique
<source>. Use stable IDs (doc-1,doc-2) the model can cite. - Pre-summarize very long documents if needed. If individual passages exceed ~5k tokens, consider a map-reduce: summarize each, then ask for synthesis on the summaries.
- Be explicit about the comparison axis. "Identify points of agreement and disagreement" or "rank by recency" — vague synthesis prompts give vague output.
- Ask for a structured synthesis. Use
<format>to specify columns or sections.
Worked example
<documents>
<document>
<source>doc-1: vendor-A-quote.pdf</source>
<document_content>{{ vendor_A_text }}</document_content>
</document>
<document>
<source>doc-2: vendor-B-quote.pdf</source>
<document_content>{{ vendor_B_text }}</document_content>
</document>
<document>
<source>doc-3: vendor-C-quote.pdf</source>
<document_content>{{ vendor_C_text }}</document_content>
</document>
</documents>
<instructions>
Compare the three vendor quotes. Produce a markdown table with columns:
Vendor, Price (USD), Support Tier, Notable Caveats. Then write a one-paragraph
recommendation citing sources in [doc-N] format. If any quote is missing a
field, write "not specified" — do not infer.
</instructions>
Tips
- Watch your context window. Even with 200k+ tokens, attention degrades on huge blobs — chunk aggressively.
- Citations are only as good as your source IDs. Use ones that map back to your storage.
Cite this page
Multi-document synthesis with Claude XML. claudexml.com. https://claudexml.com/patterns/multi-document/