Back to Patterns

Quote-Then-Answer Grounding

Prompt Patterns

Summary

Quote-then-answer grounding is a two-stage retrieval-augmented generation pattern. In the first stage, the model extracts verbatim quotes from the provided documents that are relevant to the query. In the second stage, it answers the query using only those quotes as evidence.

How it works

  1. Query understanding -- parse the user question to identify key entities and intents.
  2. Quote extraction -- search the provided documents and extract verbatim passages that address the query.
  3. Evidence assembly -- collect the extracted quotes into a structured evidence block.
  4. Grounded answer -- generate the final answer using only the assembled evidence.

When to use

  • Document Q&A: When answers must be traceable to specific source passages.
  • Policy compliance: When every claim needs to cite a governing policy document.
  • Research tools: When users need to verify claims against source material.

Abstention

When no relevant quotes are found in the provided documents, the model should explicitly state that it cannot find supporting evidence rather than hallucinating an answer. This preserves trust and prevents misinformation.

Build This Pattern

Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to implement this pattern.

Build me a grounded Q&A system using quote-then-answer. Architecture: first stage extracts relevant quotes from provided context, second stage answers using only those quotes. Never allow the answer stage to introduce external knowledge. Error handling: if no relevant quotes found, return a clear abstention message rather than hallucinating. Edge cases: handle partial relevance, conflicting quotes, and context that partially supports multiple answers. Best practices: always cite specific source identifiers. Testing: verify answer is grounded only in cited quotes.