This prompt is for RAG system builders who need source attribution to remain stable across multiple conversation turns. The core job is generating an answer that uses the exact same citation format, source identifiers, and reference style established in prior messages. This matters when users are cross-referencing answers, when audit trails require consistent source tracking, or when a UI component expects a deterministic citation schema that must not drift between turn one and turn ten.
Prompt
Conversational Citation Persistence Prompt Template

When to Use This Prompt
Define the job, reader, and constraints for conversational citation persistence.
Use this prompt when your application has already defined a citation contract—such as bracketed numeric references like [1], source-key identifiers like [doc_alpha], or inline URLs—and you need the model to persist that format without reinterpreting it. The prompt is designed for multi-turn RAG copilots, chat assistants, and support tools where a user might ask a follow-up question and expect the new answer's citations to be directly comparable to the previous answer's citations. It is not a citation format designer; it assumes the format already exists in conversation history.
Do not use this prompt when you are defining citation format for the first time, when you need to extract and normalize citations from unstructured text, or when the conversation history contains conflicting citation styles that require resolution. This prompt also does not handle source deduplication across turns or decide which sources to cite—it focuses strictly on format persistence. For high-stakes domains where citation errors could cause audit failures, always pair this prompt with a post-generation validation step that checks citation format consistency against prior turns before the answer reaches the user.
Use Case Fit
Where this prompt works and where it does not.
Good Fit: Persistent Source Identifiers
Use when: your RAG pipeline assigns stable, unique identifiers to source chunks that survive across retrieval calls. Why: the prompt relies on matching source IDs from prior turns to maintain citation continuity. If IDs change on re-retrieval, the model cannot reliably link back to previously cited sources.
Bad Fit: Stateless Single-Turn Q&A
Avoid when: each user question is treated as an independent request with no conversation history. Why: this prompt is designed for multi-turn sessions where citation format and source references must persist. For single-turn citation, use a simpler inline citation prompt without history tracking.
Required Input: Prior Turn Citation Map
What to watch: the prompt needs a structured record of which sources were cited in previous turns, including source IDs and the citation format used. Guardrail: maintain a session-level citation registry that tracks {turn_id, source_id, citation_text} tuples and inject it into the prompt as [PRIOR_CITATIONS].
Operational Risk: Citation Format Drift
What to watch: over long conversations, the model may gradually shift citation styles or drop source references entirely. Guardrail: implement a post-generation validator that checks each answer for citation presence and format consistency against the session's established style. Trigger a repair prompt if drift exceeds threshold.
Operational Risk: Source ID Collision
What to watch: if your retrieval system reuses source IDs across different documents or sessions, the model may cite the wrong source. Guardrail: use globally unique source identifiers that encode document origin and chunk position. Validate that cited IDs exist in the current retrieval set before returning the answer to the user.
Bad Fit: High-Latency Retrieval Pipelines
Avoid when: re-retrieving evidence for citation verification adds unacceptable latency to each turn. Why: the prompt may require cross-referencing prior citations against fresh retrieval results, which doubles retrieval calls. Guardrail: cache prior-turn evidence alongside citation metadata to avoid re-retrieval for verification.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for maintaining citation persistence across conversation turns.
This prompt template enforces citation format stability and source reference continuity across a multi-turn RAG conversation. It is designed for systems where a user may ask follow-up questions and the assistant must cite sources using the exact same identifiers and format established in prior turns. The template uses square-bracket placeholders that you replace with your application's specific inputs, output schema, constraints, and examples before sending the request to the model. The core mechanism is a dedicated [CITATION_REGISTRY] that tracks previously cited sources so the model can reuse them consistently.
textSYSTEM: You are a research assistant answering questions from a knowledge base. You must cite sources using the exact format and identifiers established in prior turns. CITATION RULES: - Use inline citations in the format [Source: DOC_ID] immediately after each claim. - If a source was cited in a prior turn, reuse the exact same DOC_ID. Do not create a new identifier for the same document. - If a new source is introduced, assign it a new DOC_ID using the same naming convention as prior turns. - If a prior answer cited a source that is also relevant to this turn, reference it by its existing DOC_ID. - End every answer with a "Sources" section listing each cited DOC_ID with its full title and a brief relevance note. [CITATION_REGISTRY]: [PRIOR_CITATIONS] [CONVERSATION_HISTORY]: [HISTORY] [RETRIEVED_CONTEXT]: [CONTEXT] [USER_QUESTION]: [QUESTION] [OUTPUT_SCHEMA]: { "answer": "string (the answer with inline citations)", "sources": [{"doc_id": "string", "title": "string", "relevance": "string"}], "new_citations": ["string (list of DOC_IDs introduced in this turn)"], "reused_citations": ["string (list of DOC_IDs reused from prior turns)"], "citation_consistency_check": "string (self-check confirming all DOC_IDs match the registry or follow the same convention)" } [CONSTRAINTS]: - Do not fabricate sources. Only cite documents present in [RETRIEVED_CONTEXT]. - If no retrieved context supports an answer, respond with "I cannot find evidence to answer this question" and do not cite sources. - Maintain the exact DOC_ID format used in [CITATION_REGISTRY]. If prior citations used "DOC-001", use "DOC-002" for the next new source, not "source_2" or "doc2". - If the user's question is a follow-up, explicitly reference the prior answer's sources when they remain relevant.
To adapt this template, replace each square-bracket placeholder with your application's runtime data. [PRIOR_CITATIONS] should contain a structured list of all DOC_IDs and their titles from previous turns. [HISTORY] should include the full conversation transcript. [CONTEXT] should contain the retrieved passages for the current turn, each with a stable DOC_ID already assigned by your retrieval pipeline. [QUESTION] is the user's current message. The [OUTPUT_SCHEMA] can be simplified if you only need the answer text, but keeping the citation_consistency_check field provides a built-in self-audit that you can log or use to trigger a retry. For high-stakes domains, add a [RISK_LEVEL] placeholder that gates whether the model should abstain or escalate when citation consistency cannot be verified.
Prompt Variables
Required inputs for the Conversational Citation Persistence prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CURRENT_QUESTION] | The user's latest message or query that requires an answer with citations. | What are the latency requirements for the payment API? | Non-empty string. Must not be identical to [PRIOR_QUESTION] unless the user is explicitly repeating themselves. Check for null or whitespace-only input. |
[RETRIEVED_CONTEXT] | The set of passages, documents, or chunks retrieved for the current question. Each passage must include a source identifier. | {"source_id": "doc-42", "text": "The payment API must respond within 200ms..."} | Must be a valid JSON array of objects with source_id and text fields. Reject if empty array. Validate that source_id values match the format used in [PRIOR_CITATION_FORMAT]. |
[PRIOR_CITATION_FORMAT] | The exact citation format used in the previous assistant response, including bracket style, source reference pattern, and any inline or footnote conventions. | [doc-17], [doc-23] | Non-empty string. Must contain at least one recognizable citation pattern. If no prior turn exists, set to null and the prompt should default to a standard format. Validate that the format is parseable as a citation. |
[PRIOR_SOURCE_IDENTIFIERS] | The list of source identifiers cited in the previous assistant response, in the order they appeared. | ["doc-17", "doc-23", "doc-41"] | Must be a JSON array of strings. Can be empty if the prior turn abstained. Each identifier must match the source_id schema used in [RETRIEVED_CONTEXT]. Validate no duplicates. |
[CONVERSATION_HISTORY_SUMMARY] | A compressed summary of prior turns, including questions asked, answers given, and any unresolved items or user corrections. | User asked about API latency. Assistant cited docs 17 and 23. User then asked about rate limits. | String, can be empty for first turn. Must not contain raw citation markers that could confuse the model. Validate length does not exceed 500 tokens to preserve context budget. |
[CITATION_STYLE_POLICY] | The system-level rules for how citations must be formatted, including bracket style, source reference syntax, and rules for multiple citations. | Use square brackets with source ID. Cite every factual claim. Multiple sources separated by commas: [doc-1, doc-4]. | Non-empty string. Must be present in every request. Validate that the policy specifies bracket style, delimiter rules, and minimum citation requirements. Reject if policy is ambiguous about format. |
[OUTPUT_SCHEMA] | The expected structure of the model response, including fields for the answer text, citations array, and any metadata about citation continuity. | {"answer": "string", "citations": [{"source_id": "string", "quote": "string"}], "format_consistent_with_prior": true} | Must be a valid JSON Schema or example object. Validate that the schema includes a boolean field for format consistency checking. Reject schemas that lack a citations array. |
Common Failure Modes
Citation persistence breaks in predictable ways. These are the most common failure modes when maintaining source attribution across conversation turns, with concrete guardrails to catch them before users do.
Citation Format Drift Across Turns
What to watch: The model changes citation style mid-conversation—switching from [1] to (Source A) or dropping inline markers entirely after turn three. This happens when the system prompt's citation rules get diluted by long conversation history. Guardrail: Include citation format rules in every turn's assembled prompt, not just the initial system message. Validate output against a regex pattern for your expected citation format and trigger a repair prompt on mismatch.
Source Identifier Collision After Re-Retrieval
What to watch: A follow-up question triggers fresh retrieval that returns documents with IDs overlapping prior turns. The model cites [1] again but means a different document, breaking the user's ability to trace claims. Guardrail: Use globally unique source identifiers (document hash + chunk index) rather than positional indices. When positional IDs are unavoidable, namespace them by turn or retrieval batch to prevent collision.
Phantom Citations to Prior-Turn Sources
What to watch: The model cites a source from turn two in turn five, but that source is no longer in the context window. The citation looks valid but references evidence the model no longer has access to, risking hallucinated attribution. Guardrail: Include an explicit instruction that citations must only reference sources present in the current turn's retrieved context. Add a post-generation check that every cited source ID appears in the active evidence set.
Conversation History Overwhelming Citation Rules
What to watch: As the conversation grows past 8-10 turns, the model starts prioritizing conversational fluency over citation discipline. Answers become more natural but citations thin out or disappear. Guardrail: Place citation requirements at the end of the assembled prompt (recency bias works in your favor). Set a minimum citation density threshold per answer and trigger a retry if the output falls below it.
Cross-Turn Source Contradiction Without Flagging
What to watch: Turn three cites Source A claiming X, turn six cites Source B claiming not-X, but the model doesn't surface the contradiction. The user trusts both answers and misses the conflict. Guardrail: Add a cross-turn consistency check that compares claims from the current answer against claims from prior turns. When a contradiction is detected, require the model to explicitly surface it with both source references before proceeding.
Citation Stripping During Answer Revision
What to watch: A user corrects an answer and the model revises it, but the revision drops all citations from the original. The corrected answer reads well but loses auditability. Guardrail: In revision prompts, explicitly require that revised answers preserve or update all citations from the original answer. Add a validator that compares citation count before and after revision and flags significant drops.
Evaluation Rubric
How to test output quality before shipping. This rubric evaluates whether the model maintains citation format consistency and source reference continuity across conversation turns.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Citation Format Stability | All citations in the current turn use the same format (e.g., [1], [DocA]) as the immediately preceding assistant turn | Citation format changes mid-conversation (e.g., switches from [1] to (Source 1) or drops brackets) | Parse all citation markers from the last 3 assistant turns; assert regex match on format pattern across turns |
Source ID Continuity | Source identifiers (numbers, doc IDs, URLs) in the current turn refer to the same documents as in prior turns when citing the same source | Same document receives a different citation number in a later turn without explicit remapping; orphaned citation IDs appear | Extract source-to-ID mapping from turn N-1; verify turn N citations resolve to the same mapping or include explicit remap note |
Cross-Turn Citation Consistency | When the answer references a claim made in a prior turn, it re-cites the original source rather than dropping attribution | Prior-turn claim is repeated or built upon without any citation; citation appears only for new claims | Diff claims across turns; flag any claim present in turn N-1 and turn N where turn N lacks a citation that turn N-1 had |
New Evidence Citation | All claims sourced from newly retrieved passages include citations using the established format | New factual claims appear without any citation marker; citation is present but format differs from prior turns | Extract all factual assertions from current turn; cross-reference against retrieved context; verify each has a citation marker matching prior-turn format |
Citation Numbering Continuity | If using numeric citations, numbering continues from the last used number in the prior turn or explicitly resets with a note | Citation numbering restarts at [1] without acknowledgment; gaps appear in sequence without explanation | Parse max citation number from turn N-1; verify turn N starts at max+1 or includes explicit reset signal like 'New sources:' |
Conversation History Citation Preservation | When the model summarizes or references its own prior answer, it preserves the original citations rather than paraphrasing without attribution | Prior answer content is repeated with citations stripped; summary introduces new citation numbers for old claims | Compare summary segments against prior-turn answer; assert citation markers from original are retained or explicitly marked as 'previously cited in [X]' |
Source Conflict Citation Handling | When new evidence contradicts a prior cited claim, the model cites both sources and flags the conflict explicitly | Contradictory new evidence is cited but prior conflicting citation is dropped; conflict is presented as resolved without evidence | Detect factual contradiction between turn N-1 cited claim and turn N cited claim; assert both citations appear and conflict language is present |
Citation Drift Detection | No more than 1 citation format deviation across a 5-turn conversation without explicit user instruction to change format | Format drifts incrementally (e.g., [1] -> (1) -> 1.) across turns; model adopts user's citation style unintentionally | Run 5-turn conversation simulation; count format changes; fail if >1 unrequested format change detected via regex diff across turns |
Implementation Harness Notes
How to wire the conversational citation persistence prompt into a production RAG application with validation, retries, and state management.
Integrating citation persistence into a multi-turn RAG system requires more than a single prompt call. The application layer must maintain a session-scoped citation registry that tracks source identifiers, document metadata, and the citation format used in prior turns. When a new user message arrives, the harness retrieves the active conversation history, extracts previously used citation formats and source IDs, and injects them into the prompt's [PRIOR_CITATION_FORMAT] and [PRIOR_SOURCE_IDS] placeholders. This registry should be stored server-side—not trusted to the client—and keyed by session ID. If the session is new or no prior citations exist, the harness passes an explicit empty state marker (e.g., `
NO_PRIOR_CITATIONS"`) so the model knows to establish a fresh format rather than hallucinate continuity."
After the model returns a response, the harness must validate citation persistence before the answer reaches the user. Implement a post-generation validator that checks: (1) every citation in the current response uses a format consistent with prior turns (exact match on bracket style, numbering scheme, or inline pattern), (2) source IDs that appeared in prior turns retain the same identifier (no renumbering or renaming), and (3) new sources introduced in this turn receive identifiers that don't collide with existing ones. If validation fails, trigger a retry with the validation error message appended to the prompt as [CORRECTION_FEEDBACK]. Limit retries to two attempts; if the third output still fails, log the failure, surface the best-effort answer with a warning flag, and alert the operations channel. For high-stakes domains, route failed validations to a human review queue instead of auto-escalating.
Model choice matters here. Smaller or older models often struggle with format consistency across turns, especially when the conversation exceeds 8-10 exchanges. Prefer models with strong instruction-following and long-context handling (e.g., Claude 3.5 Sonnet, GPT-4o, or fine-tuned variants). If you must use a smaller model, reduce the citation format complexity—stick to simple numeric references like [1] rather than compound formats like [DocA §3.2]. Log every turn's citation registry state, validation results, and retry count for observability. When debugging citation drift, trace backward through the session to find the exact turn where format divergence began. The most common production failure mode is not the prompt itself but the application layer silently dropping prior citation state during context window truncation—ensure your context assembly logic preserves the citation registry even when older dialogue turns are compressed or evicted.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a simple conversation store. Pass the last [N] assistant messages with their citations as [PRIOR_CITATIONS]. Use a lightweight format check instead of full schema validation.
code[PRIOR_CITATIONS] = last 3 assistant messages [VALIDATION] = check for bracket-wrapped source IDs
Watch for
- Citation format drift after 4+ turns when the model invents new styles
- Source ID hallucination when prior citations reference chunks no longer in context
- Missing [PRIOR_CITATIONS] causing the model to start fresh each turn

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us