Inferensys

Prompt

Claude Long-Context Evidence Assembly Prompt Template

A production-ready prompt playbook for RAG and document intelligence teams using Claude's extended context window to synthesize answers from large, potentially conflicting evidence sets with accurate citations.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the specific job-to-be-done, ideal user profile, and critical boundaries for the Claude Long-Context Evidence Assembly Prompt Template.

This prompt template is designed for RAG and document intelligence teams who need Claude to synthesize an answer from a large set of retrieved documents. It is built for scenarios where the evidence set exceeds what a human could easily hold in working memory, where source documents may conflict, and where citation accuracy is non-negotiable. The core job-to-be-done is transforming a noisy, redundant, and potentially contradictory set of retrieved chunks into a single, coherent, and fully grounded answer. The ideal user is an AI engineer or product developer who has already built a retrieval pipeline and now needs a reliable assembly layer that can handle the full complexity of a 200K context window without losing fidelity or hallucinating sources.

Use this prompt when you are packing a significant portion of Claude's context window with evidence chunks and need the model to prioritize salient information, resolve contradictions explicitly, and ground every claim in a specific source. This template assumes your retrieval system may return noise, near-duplicates, and conflicting data, and it includes explicit instructions for handling each of these failure modes. It is appropriate for regulated or high-trust domains where an unsupported claim can have serious consequences, as it enforces a strict citation discipline and requires the model to abstain when evidence is insufficient. The prompt also includes a token budget allocation strategy, ensuring that instructions, evidence, and the output itself all fit within the model's limits without silent truncation.

Do not use this prompt for simple Q&A over a single document or for workflows where the retrieval step already returns a perfectly ordered, non-redundant set of facts. In those cases, a lighter-weight RAG prompt without conflict resolution and deduplication instructions will be faster and cheaper. Similarly, avoid this template if your application requires real-time streaming answers where the full evidence assembly step would introduce unacceptable latency. If your use case involves multi-turn conversation rather than a single-shot research task, you will need to pair this with a conversation state management pattern. Before implementing, confirm that your retrieval pipeline is returning chunks with stable, unique identifiers that can be used in citations, as the prompt's grounding guarantees depend on traceable source references.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Claude Long-Context Evidence Assembly Prompt Template delivers value and where it introduces risk. Use these cards to decide if this template matches your production context before investing in integration.

01

Good Fit: High-Volume Document Synthesis

Use when: you need to synthesize findings across 50+ documents, legal filings, research papers, or technical reports where evidence must be ordered, cited, and reconciled. Guardrail: implement token budget allocation per document category and enforce a maximum evidence chunk count to prevent context overflow.

02

Bad Fit: Real-Time Chat with Rapid Context Turnover

Avoid when: your application requires sub-second latency on short user messages with frequently changing context. Long-context assembly adds pre-processing overhead that degrades chat responsiveness. Guardrail: use this template for batch document analysis jobs and keep a separate lightweight prompt path for real-time conversational turns.

03

Required Inputs: Retrieved Evidence with Source Metadata

Risk: the template assumes pre-ranked, deduplicated evidence chunks with source identifiers, retrieval scores, and document section labels. Missing metadata produces ungrounded citations. Guardrail: validate that your retrieval pipeline attaches source IDs, relevance scores, and document titles to every evidence chunk before assembly begins.

04

Operational Risk: Token Cost Spikes on Large Evidence Sets

Risk: assembling 100+ evidence chunks with full citation markup can silently exceed token budgets, causing truncated outputs or unexpected inference costs. Guardrail: implement a preflight token counter that truncates or summarizes low-salience evidence before the prompt reaches the model, and log token consumption per request.

05

Operational Risk: Source Conflict Resolution Gaps

Risk: when retrieved documents contradict each other, the model may silently pick one source or produce a hedged answer without flagging the conflict. Guardrail: include explicit conflict detection instructions in the prompt and add an eval check that verifies the output surfaces contradictions when multiple sources disagree on key facts.

06

Bad Fit: Single-Document Q&A Without Cross-Reference Needs

Avoid when: users ask questions answerable from a single document or passage. The assembly overhead of ordering, deduplicating, and citing multiple sources adds latency and complexity with no quality gain. Guardrail: route single-document queries to a simpler RAG prompt and reserve this template for multi-document synthesis tasks only.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A production-ready prompt template for assembling long-context evidence with citation discipline, source conflict handling, and token budget awareness.

This template is designed for RAG and document intelligence teams using Claude's extended context window to synthesize answers from large sets of retrieved evidence. It enforces strict citation requirements, handles conflicting sources explicitly, and includes token budget allocation instructions to prevent the model from ignoring late-context documents. Replace every square-bracket placeholder with runtime values before inference. The template assumes you have already retrieved, deduplicated, and ordered your evidence chunks before assembly—this prompt governs how Claude uses that evidence, not how you retrieve it.

text
You are an evidence-based research assistant. Your task is to answer the user's question using ONLY the provided evidence documents. You must cite your sources inline and flag any conflicts between documents.

## EVIDENCE DOCUMENTS
Below are [EVIDENCE_COUNT] documents retrieved for this query. Each document has a unique citation ID in square brackets. Use these IDs for all citations.

[DOCUMENTS]

## USER QUESTION
[USER_QUESTION]

## INSTRUCTIONS
1. Read all evidence documents before drafting your answer. Do not skip documents near the end of the context window.
2. Answer the question using ONLY information present in the evidence documents. If the evidence is insufficient to answer fully, explicitly state what is missing rather than speculating.
3. For every factual claim in your answer, include an inline citation using the format [Doc_X] where X is the document's citation ID. Place citations immediately after the claim they support.
4. If two or more documents contain conflicting information on the same point, you MUST:
   a. State the conflict explicitly.
   b. Present each conflicting position with its supporting citation.
   c. Do not choose a winner unless one source is clearly more authoritative and you can explain why.
5. Structure your answer as follows:
   a. **Direct Answer**: A concise answer to the question in 1-3 sentences.
   b. **Detailed Explanation**: Full explanation with inline citations.
   c. **Evidence Gaps**: Any aspects of the question the evidence could not address.
   d. **Source Conflicts**: Any contradictions found between documents, with citations.
6. Do not fabricate citations. If you reference a document, the citation ID must match one provided in the evidence.
7. If the evidence contains information that appears outdated, note the document's date (if available) but still report what the document states.
8. Prioritize documents marked as [HIGH_SALIENCE] when resolving ambiguity, but still report conflicting lower-salience evidence.

## OUTPUT FORMAT
Return your response in the following structure:

DIRECT ANSWER:
[Your concise answer here]

DETAILED EXPLANATION:
[Your full explanation with inline citations]

EVIDENCE GAPS:
[What the evidence could not address]

SOURCE CONFLICTS:
[Any contradictions found, with citations for each position]

## CONSTRAINTS
- Do not use knowledge outside the provided evidence documents.
- Do not omit citations for any factual claim.
- Maximum response length: [MAX_OUTPUT_TOKENS] tokens.
- If the user question appears to request harmful, illegal, or policy-violating content, respond with: "I cannot assist with this request based on the provided evidence and my usage policies."

Adaptation notes: Replace [EVIDENCE_COUNT] with the number of documents you're providing. The [DOCUMENTS] placeholder should be replaced with your pre-formatted evidence chunks, each prefixed with a citation ID like [Doc_1], [Doc_2], etc. Include document metadata (date, source type, authority level) inside each chunk if available. The [HIGH_SALIENCE] marker should be applied during your retrieval ranking step—only mark documents your reranker scored above your salience threshold. Set [MAX_OUTPUT_TOKENS] based on your application's latency budget and expected answer length. For regulated use cases, add a human review step before the output reaches end users. Test this template with conflicting documents and insufficient evidence to verify the model follows the abstention and conflict-reporting instructions before deploying.

IMPLEMENTATION TABLE

Prompt Variables

Every placeholder the Claude Long-Context Evidence Assembly Prompt Template expects, with its purpose, a concrete example, and actionable validation rules to catch assembly errors before inference.

PlaceholderPurposeExampleValidation Notes

[QUERY]

The user's question or task that requires evidence-backed answering.

What were the key findings from the Q3 security audit?

Must be non-empty string. Check length < 2000 chars. If null or whitespace-only, abort assembly and return user-facing clarification request.

[EVIDENCE_BLOCK]

Ordered, deduplicated retrieved passages with source identifiers and relevance scores.

DOC-12 (score: 0.94): The Q3 audit identified three critical vulnerabilities in the auth service...

Must contain at least one passage. Validate each passage has a source ID prefix and a relevance score. If empty, set [ANSWER_STRATEGY] to abstain.

[EVIDENCE_COUNT]

Total number of evidence passages provided to the model.

14

Must be integer > 0. Compare against actual count of passages in [EVIDENCE_BLOCK]. If mismatch, log warning and use actual count. If > 50, trigger salience re-ranking before assembly.

[TOKEN_BUDGET]

Maximum tokens allocated for the model response.

4096

Must be integer between 256 and 8192. Validate against model's max output tokens. If [EVIDENCE_COUNT] > 30, require budget >= 2048 or log risk of truncated citations.

[ANSWER_STRATEGY]

Instruction for how the model should handle evidence sufficiency: answer, partial-answer, or abstain.

answer

Must be one of enum: answer, partial-answer, abstain. If [EVIDENCE_BLOCK] is empty, force to abstain. If confidence threshold < 0.7, force to partial-answer.

[OUTPUT_SCHEMA]

JSON schema or structured format specification the response must conform to.

{"answer": "string", "citations": [{"source_id": "string", "quote": "string"}], "confidence": "float"}

Must be valid JSON schema. Validate parse before assembly. If schema requires citations field, verify [EVIDENCE_BLOCK] is non-empty or abort. Schema must include confidence field for post-generation eval.

[CONFLICT_INSTRUCTION]

Rule for handling contradictory evidence across passages.

If sources conflict, report the conflict explicitly, cite both sources, and assign lower confidence.

Must be non-empty string. If [EVIDENCE_COUNT] > 1 and this is null, inject default conflict instruction. Validate that instruction does not contradict [ANSWER_STRATEGY].

[CITATION_FORMAT]

Required format for inline citations in the model response.

Use [Source: DOC-{id}] immediately after each claim.

Must be non-empty string. Validate that format string contains a source identifier placeholder. If [OUTPUT_SCHEMA] requires citations array, ensure format is parseable for post-generation extraction.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Claude Long-Context Evidence Assembly prompt into a production RAG pipeline with validation, retry, and observability.

This prompt is designed to be the final assembly step in a RAG pipeline, not a standalone chat interaction. The application layer is responsible for retrieval, deduplication, and token budgeting before the prompt is constructed. The prompt template receives pre-ranked evidence, a user query, and output constraints, then produces a synthesized answer with inline citations. The harness must validate that the model's output respects the citation contract, stays within the evidence, and explicitly abstains when the evidence is insufficient.

Pre-Assembly Pipeline: Before calling the model, the application must: (1) Retrieve and deduplicate passages from your vector store or search index. (2) Rank passages by salience using a cross-encoder or LLM-based reranker. (3) Allocate token budget across instructions, evidence, and output space—reserve at least 20% of the context window for the model's response. (4) Truncate low-ranking passages to fit the budget. (5) Assign stable source IDs to each passage for citation matching. Post-Output Validation: After receiving the model response, run a structured validation harness: parse the output for citation markers (e.g., [1], [2]), verify every cited source ID exists in the provided evidence set, flag any unsupported factual claims using an NLI model or a secondary LLM judge, and check for the abstention keyword (e.g., 'INSUFFICIENT_EVIDENCE') when no relevant passages were provided. If validation fails, increment a retry counter and re-invoke the model with the validation errors appended as [CONSTRAINTS] feedback. Stop retrying after 2 attempts and escalate to a human review queue.

Observability and Logging: Log the full assembled prompt, the model's raw response, the validation results, and any retry attempts as a single trace. Include a trace ID, prompt version, model ID, token counts (input and output), and the source document IDs used. This trace data is essential for debugging citation failures, detecting evidence drift, and auditing outputs in regulated workflows. Model Choice: This template is tuned for Claude 3.5 Sonnet and Opus, which handle long-context instruction following and inline citation reliably. If using a different model, validate citation adherence and abstention behavior with a golden test set before production deployment. When to Escalate: If the model consistently hallucinates citations, ignores the abstention instruction, or exceeds the allocated output token budget, do not add more prompt instructions. Instead, shorten the evidence set, increase the retry budget, or switch to a model with stronger long-context instruction following.

IMPLEMENTATION TABLE

Expected Output Contract

The structure, fields, and validation rules your application should expect from Claude when using the Long-Context Evidence Assembly Prompt Template. Use this contract to build a post-processing validator before the output reaches downstream systems or users.

Field or ElementType or FormatRequiredValidation Rule

answer_summary

string (1-3 paragraphs)

Must not exceed 500 words. Must not contain direct quotes from [EVIDENCE] unless wrapped in inline citation markers. Parse check: non-empty string.

evidence_synthesis

array of objects

Each object must contain source_id, relevance_score, and key_facts fields. source_id must match a provided [SOURCE_ID] from the input context. relevance_score must be a float between 0.0 and 1.0. Schema check: required fields present and typed correctly.

source_id

string

Must exactly match a [SOURCE_ID] value from the [EVIDENCE] block. No fabricated or hallucinated identifiers allowed. Citation check: cross-reference against input source list.

relevance_score

float (0.0-1.0)

Must be a number between 0.0 and 1.0 inclusive. Scores below 0.3 should trigger a review flag. Parse check: valid float, not NaN or Infinity.

key_facts

array of strings

Each string must be a single verifiable claim grounded in the referenced source. Claims that paraphrase rather than ground should be flagged. Minimum 1 fact per source, maximum 5. Grounding check: each claim must be locatable in the source text.

conflicting_evidence

array of objects or null

If no conflicts exist, must be an empty array, not null or omitted. Each conflict object must contain source_a, source_b, conflict_description, and resolution fields. Null allowed only if the model explicitly abstains with a reason. Schema check: array or null type.

abstention_flag

boolean

Must be true if the model cannot answer from provided evidence, false otherwise. If true, answer_summary must contain an explicit abstention statement and evidence_synthesis must be an empty array. Consistency check: flag state must match content.

citation_map

object

Keys must be inline citation markers used in answer_summary (e.g., [1], [2]). Values must be the corresponding source_id strings. Every citation marker in the answer must have a mapping entry. Citation check: no orphan markers, no unmapped sources.

PRACTICAL GUARDRAILS

Common Failure Modes

When assembling evidence across Claude's long context window, these failures surface first in production. Each card pairs a specific failure with a concrete guardrail you can implement before users encounter it.

01

Citation Drift Under Token Pressure

What to watch: When the prompt approaches the context limit, Claude begins fabricating plausible-looking citations that don't correspond to any provided source. The model prioritizes fluent completion over faithful attribution. Guardrail: Reserve a fixed token budget for citations at the end of the prompt. Add an explicit instruction: 'If you cannot locate the exact passage supporting a claim, respond with INSUFFICIENT_EVIDENCE rather than guessing a source.' Validate output citations against the source index before surfacing to users.

02

Lost-in-the-Middle Evidence Blindness

What to watch: Claude disproportionately weights evidence at the beginning and end of the context window while ignoring critical passages positioned in the middle third. This produces answers that miss key contradictory evidence. Guardrail: Reorder evidence by salience, placing the most relevant passages at both the start and end of the evidence block. Add a pre-response instruction: 'Before answering, scan all provided documents and flag any conflicting evidence you find.' Run eval tests with critical evidence deliberately placed at positions 40-60% through the context window.

03

Source Conflict Resolution by Averaging

What to watch: When two sources present contradictory facts, Claude sometimes produces a hedged or averaged answer that misrepresents both positions rather than surfacing the conflict explicitly. Guardrail: Add a conflict detection instruction: 'When sources disagree on a factual claim, do not reconcile them. Instead, state the disagreement clearly with source identifiers and confidence levels for each position.' Include a few-shot example showing correct conflict surfacing behavior. Test with deliberately contradictory source pairs.

04

Silent Evidence Omission in Long Documents

What to watch: For documents exceeding 10K tokens, Claude may skip entire sections without indicating that material was omitted, producing answers that appear comprehensive but are actually incomplete. Guardrail: Require a coverage statement in the output: 'List which source sections were used in this answer and which were not. If any section was not examined, state why.' Implement a post-generation check that compares cited sections against the full source inventory. For critical workflows, chunk long documents and process them in parallel passes.

05

Token Budget Starvation of Reasoning

What to watch: When evidence consumes 80%+ of the context window, Claude's chain-of-thought reasoning gets compressed or skipped entirely, leading to shallow analysis that misses logical connections across documents. Guardrail: Enforce a minimum reasoning budget: allocate at least 15-20% of the available context window for explicit reasoning steps. Add the instruction: 'Before producing your final answer, spend at least [MIN_TOKENS] tokens walking through your evidence analysis step by step.' Monitor reasoning-to-evidence token ratios in production traces.

06

Recency Bias Overriding Evidence Weight

What to watch: Claude overweights evidence that appears last in the prompt sequence, treating it as more authoritative even when earlier sources carry higher credibility or recency markers. Guardrail: Add explicit source metadata with date and authority scores. Include the instruction: 'Weight evidence by the provided authority score and recency date, not by position in the prompt. When a lower-authority source appears last, do not elevate it above higher-authority earlier sources.' Test with high-authority evidence placed early and low-authority evidence placed late.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test output quality before shipping the Claude Long-Context Evidence Assembly prompt to production. Each criterion targets a specific failure mode in long-context evidence synthesis.

CriterionPass StandardFailure SignalTest Method

Evidence Coverage

All [RETRIEVED_DOCUMENTS] with relevance score above [SALIENCE_THRESHOLD] are referenced at least once in the output

Output ignores a high-salience document or relies on documents below the threshold without justification

Parse output for document IDs; cross-reference against the input manifest with salience scores

Citation Accuracy

Every factual claim maps to a cited source passage that contains the claimed information verbatim or in clear paraphrase

A claim is attributed to a source that does not contain the supporting evidence when manually checked

Random-sample 5 cited claims; retrieve the cited passage and verify claim-to-evidence alignment manually or with a second model call

Source Conflict Handling

When two sources contradict on a material fact, the output explicitly notes the conflict and does not silently choose one side

Output presents a single answer as settled fact when the evidence set contains a documented contradiction

Inject a known conflicting document pair into the evidence set; check output for conflict acknowledgment language

Abstention Discipline

Output returns [ABSTENTION_MESSAGE] or equivalent when no document in the evidence set addresses the [USER_QUERY] with confidence above [CONFIDENCE_THRESHOLD]

Output fabricates an answer or over-extrapolates from tangentially related evidence when the query is unanswerable

Submit a query deliberately outside the evidence scope; assert output contains abstention signal and no unsupported claims

Token Budget Compliance

Assembled prompt including evidence, instructions, and output allocation stays within [MAX_TOKENS] budget

Prompt exceeds token limit, causing truncation of late-arriving evidence or output cutoff

Calculate total token count of the assembled prompt programmatically before inference; flag if over budget

Salience Ordering

Evidence passages appear in the prompt ordered by descending relevance score, with highest-salience passages positioned in the high-attention zone

A low-salience passage appears before a high-salience passage, or irrelevant passages crowd out key evidence

Compare the order of document IDs in the assembled prompt against the salience-ranked input manifest

Output Schema Adherence

Output parses cleanly as valid JSON matching [OUTPUT_SCHEMA] with all required fields present and correctly typed

Output is missing required fields, contains extra untyped fields, or fails JSON parse

Run output through a JSON schema validator against [OUTPUT_SCHEMA]; count parse failures and schema violations

Hallucination Rate

Zero unsupported factual claims appear in the output when checked against the full evidence set

Output contains a specific claim (date, name, number, event) not present in any provided document

Extract all factual assertions from output; for each, search the full evidence set for support; flag any unsupported assertion

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base evidence assembly template. Remove strict token budget constraints and citation format requirements. Use a single [EVIDENCE_BLOCK] with all retrieved passages concatenated. Skip source conflict resolution instructions—let the model surface conflicts naturally. Add a simple instruction: "If evidence is insufficient, state what's missing."

Watch for

  • Hallucinated citations when evidence is thin
  • Model ignoring evidence order and recency bias
  • Overly verbose synthesis that buries key findings
  • No way to trace which passage supported which claim
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.