This prompt is for production assistant pipelines that operate under a strict no-guess policy. Use it when your system handles multi-turn dialogue in domains where an incorrect reference resolution carries material risk: healthcare handoffs, legal intake, financial transactions, compliance workflows, or any customer-facing surface where a wrong entity match creates liability or erodes trust. The ideal user is an AI engineer or product developer who already has a working dialogue system and needs a safety net that catches ambiguous anaphora, unresolved pronouns, and implicit references before they reach downstream NLU or action handlers. You need access to the current user turn, the prior conversation history, and a defined schema for your clarification output.
Prompt
Unresolved Reference Flagging and Escalation Prompt

When to Use This Prompt
Define the production boundary where unresolved references must be flagged and escalated instead of guessed.
Do not use this prompt when you already have a high-confidence reference resolver that handles ambiguity internally, when your application tolerates occasional incorrect resolutions (e.g., casual chat, entertainment), or when the cost of asking a clarification question exceeds the cost of a wrong guess. This prompt is also inappropriate for single-turn systems where no dialogue history exists to create ambiguity. If your domain requires the assistant to always attempt a best-guess resolution before escalating, pair this prompt with a resolver and use the binary flag as a gating condition rather than a replacement.
The prompt produces two outputs you can act on programmatically: a reference_unresolvable boolean and a structured clarification_question. Wire the boolean into your routing logic so that true triggers either a clarification turn with the user or, in high-stakes domains, a human review queue. The clarification question is designed to be shown directly to the user without modification. Before deploying, validate that your pipeline correctly handles the case where the model flags a reference as resolvable but your downstream resolver still fails—this double-fault scenario requires its own escalation path. Test against a golden set of genuinely ambiguous turns, turns with clear referents, and adversarial turns designed to trick the flagger into over-flagging or under-flagging.
Use Case Fit
Where the Unresolved Reference Flagging and Escalation Prompt works and where it does not.
Good Fit: High-Stakes Domains
Use when: The cost of a wrong assumption is high, such as in healthcare, legal, or finance. This prompt prevents the model from guessing and instead flags the ambiguity for a human. Guardrail: Route flagged turns to a human review queue before any downstream action is taken.
Good Fit: Multi-Turn Task Completion
Use when: A user's follow-up turn contains a pronoun or implicit reference that must be resolved against a complex dialogue state to complete a task. Guardrail: Run this prompt before any tool call or state mutation to ensure the target entity is unambiguous.
Bad Fit: Simple Q&A with No History
Avoid when: The user's query is a self-contained, single-turn question with no anaphora or reliance on prior context. Guardrail: Implement a fast-path check for the presence of pronouns or definite descriptions before invoking this prompt to save latency and cost.
Required Inputs
What to watch: The prompt requires a structured representation of the dialogue state and the current user utterance. Missing or poorly formatted history will cause false negatives. Guardrail: Validate that the input includes a dialogue_history array and a current_utterance string before execution.
Operational Risk: Latency Budget
What to watch: Adding a classification step before every turn can introduce latency that degrades the user experience in real-time applications. Guardrail: Set a strict timeout for this prompt. If it fails to respond in time, default to a safe behavior, such as asking a generic clarification question.
Operational Risk: Over-Flagging
What to watch: The model may become overly cautious and flag references that a human would find obvious, creating excessive and unnecessary human review tasks. Guardrail: Implement a confidence threshold. Only escalate when the model's is_ambiguous flag is true AND its confidence_score is below 0.9.
Copy-Ready Prompt Template
A reusable prompt template for detecting unresolvable references and generating structured clarification requests with escalation paths.
This prompt template is designed to be inserted into a production assistant pipeline immediately after the user's current turn is received and before any downstream processing, tool calls, or response generation. Its job is to act as a safety gate: it examines the user's latest utterance against the provided conversation history and determines whether any reference—pronoun, implicit entity, or shorthand—cannot be resolved with high confidence. If the reference is resolvable, the prompt returns a clean pass. If not, it returns a structured flag and a clarification question, preventing the assistant from guessing and producing a confident but incorrect response. For high-stakes domains such as healthcare, finance, or legal, an additional escalation path is included to route the unresolved case for human review.
textYou are a reference resolution safety gate in a production assistant pipeline. Your sole task is to analyze the user's latest turn against the provided conversation history and determine whether any entity reference is unresolvable. ## INPUT [CONVERSATION_HISTORY] [USER_TURN] ## CONSTRAINTS - Do not guess. If you cannot identify the exact referent with high confidence, flag it as UNRESOLVED. - Consider pronouns, demonstratives (this, that, these, those), definite descriptions (the invoice, the error), and implicit references (the other one). - If the user's turn contains no references that require resolution, return RESOLVED. - If the reference is to an entity not present in the conversation history, flag it as UNRESOLVED. - Do not use external knowledge to resolve references. Only use the provided [CONVERSATION_HISTORY]. ## OUTPUT_SCHEMA Return a single JSON object with the following schema: { "status": "RESOLVED" | "UNRESOLVED", "unresolved_span": string | null, // The exact text span that could not be resolved, if any. "candidate_referents": string[], // List of possible referents considered, empty if none. "clarification_question": string | null, // A single, targeted question to disambiguate. Null if RESOLVED. "confidence": number, // 0.0 to 1.0. Score below [CONFIDENCE_THRESHOLD] triggers UNRESOLVED. "escalation_required": boolean // True if [RISK_LEVEL] is 'high' and status is UNRESOLVED. } ## PARAMETERS - Confidence Threshold: [CONFIDENCE_THRESHOLD] (e.g., 0.9) - Risk Level: [RISK_LEVEL] ("low" | "medium" | "high") ## EXAMPLES [FEW_SHOT_EXAMPLES] ## INSTRUCTIONS 1. Parse [CONVERSATION_HISTORY] and [USER_TURN]. 2. Identify all referring expressions in [USER_TURN]. 3. For each referring expression, search [CONVERSATION_HISTORY] for a matching antecedent. 4. If any referring expression cannot be matched with confidence >= [CONFIDENCE_THRESHOLD], set status to UNRESOLVED. 5. Generate a clarification question that targets only the ambiguous reference without repeating the entire context. 6. If [RISK_LEVEL] is "high" and status is UNRESOLVED, set escalation_required to true. 7. Return only the JSON object. No other text.
To adapt this template, replace the square-bracket placeholders with your application's live data. [CONVERSATION_HISTORY] should contain the last N turns formatted with speaker labels and turn indices. [USER_TURN] is the raw text of the current message. Set [CONFIDENCE_THRESHOLD] based on your tolerance for false positives—0.9 is a reasonable starting point for most applications, but lower it to 0.7 for chattier domains where occasional clarification is acceptable. [RISK_LEVEL] should be pulled from your application's routing logic: set it to "high" for healthcare, legal, or financial workflows where a wrong resolution has material consequences. The [FEW_SHOT_EXAMPLES] placeholder should be populated with 2-4 examples showing both RESOLVED and UNRESOLVED cases, including at least one example where the model correctly abstains despite a plausible but incorrect candidate. After the prompt returns, validate the JSON output against the schema before allowing downstream processing to consume it. If the JSON is malformed, retry once with a repair prompt; if it fails again, treat it as an UNRESOLVED case and escalate.
Prompt Variables
Required and optional inputs for the Unresolved Reference Flagging and Escalation Prompt. Each placeholder 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_TURN] | The user's latest message that may contain an unresolvable reference | Can you update the report with its findings? | Must be a non-empty string. Check for null, empty, or whitespace-only input before prompt assembly. Truncate if it exceeds the model's maximum user message length. |
[DIALOGUE_HISTORY] | The preceding conversation turns, formatted as an ordered list of speaker-annotated messages | [{"speaker": "user", "text": "I reviewed the Q3 audit."}, {"speaker": "assistant", "text": "I found three discrepancies in section 4."}] | Must be a valid JSON array. Validate that each object has 'speaker' and 'text' fields. If history is empty, pass an empty array. Set a maximum turn count (e.g., last 20 turns) to manage context budget. |
[ENTITY_REGISTRY] | A structured map of entities mentioned in the session, including their IDs, types, and canonical names | [{"id": "ent_01", "type": "document", "name": "Q3 Audit Report"}, {"id": "ent_02", "type": "finding", "name": "Discrepancy in section 4"}] | Must be a valid JSON array. Validate that each object has 'id', 'type', and 'name' fields. If no entities have been extracted, pass an empty array. Ensure IDs are unique and stable across turns. |
[DOMAIN_TAXONOMY] | A list of entity types and relationship types the system is allowed to resolve, used to constrain the resolver's scope | ["document", "finding", "person", "date", "metric"] | Must be a non-empty array of strings. Validate against a predefined schema of allowed types. If the domain is open, pass a broad but explicit list to prevent the model from inventing unsupported entity categories. |
[ESCALATION_THRESHOLD] | The minimum confidence score below which the prompt must flag a reference as unresolvable and escalate | 0.85 | Must be a float between 0.0 and 1.0. Validate that the value is numeric and within range. A threshold of 0.0 disables escalation and forces a best-guess resolution. A threshold of 1.0 escalates everything except perfect matches. |
[HIGH_STAKES_MODE] | A boolean flag that, when true, requires the prompt to append a human-review recommendation to any escalated output | Must be a strict boolean. Validate that the value is exactly true or false, not a string or null. When true, the output schema must include a 'requires_human_review' field set to true for all escalated cases. | |
[OUTPUT_SCHEMA] | The exact JSON schema the model must conform to, including the binary flag, clarification question, and escalation fields | {"type": "object", "properties": {"is_unresolvable": {"type": "boolean"}, "clarification_question": {"type": "string"}, "requires_human_review": {"type": "boolean"}}} | Must be a valid JSON Schema object. Validate with a JSON Schema validator before prompt assembly. Ensure the schema includes all required fields and that no additional properties are allowed unless explicitly intended. |
Implementation Harness Notes
How to wire the Unresolved Reference Flagging and Escalation Prompt into a production application with validation, retries, and human review.
This prompt is designed as a pre-processing gate in a multi-turn assistant pipeline. Before any downstream NLU, RAG retrieval, or agent action occurs, the current user turn and a compressed representation of the dialogue history are passed through this prompt. The output is a binary is_unresolvable flag and, if true, a structured clarification_question. The application must not proceed to the main processing step if the flag is true; instead, it must surface the clarification question to the user or escalate to a human reviewer. This gate prevents the most common cause of confident hallucination in production chat systems: the model guessing at an ambiguous reference rather than asking for disambiguation.
Wiring the prompt into an application requires a strict contract. The input must include the current user utterance and a structured, time-ordered summary of the last N turns (or a compressed session state). The output must be parsed as JSON with a schema validator checking for is_unresolvable (boolean) and clarification_question (string or null). If is_unresolvable is true and the clarification_question is missing or empty, treat this as a malformed output and trigger a retry with a stricter output constraint appended to the prompt. For high-stakes domains such as healthcare or finance, the application should also check a confidence field (if your variant includes one) and escalate to a human review queue if confidence is below a defined threshold, even if the flag is false. Log every decision—the raw user input, the prompt template version, the model response, and the final action taken—to build an audit trail for debugging false positives and false negatives.
Model choice and latency budget are critical here. This prompt runs on every user turn, so it must be fast. Use a smaller, cheaper model (e.g., a fast-inference variant) for this classification task, reserving larger models for the main generation step. If the application uses RAG, ensure that the dialogue history passed to this prompt does not include the full retrieved documents; only the user's words and prior assistant responses are needed to resolve conversational references. Tool use is not required for this prompt, but if your system already has a structured session state object, pass it as a JSON block in the context rather than raw text history to improve accuracy. Implement a hard timeout of 2-3 seconds for this step; if the model does not respond in time, fail open by assuming the reference is resolvable and log the timeout as a risk event for later review.
Testing and failure modes must be addressed before shipping. The most common failure is a false positive—flagging a perfectly clear reference as unresolvable—which frustrates users with unnecessary clarification questions. Mitigate this by running a golden dataset of 200+ turns with known-resolvable references through the prompt and measuring the false positive rate. The second failure mode is a false negative—allowing an ambiguous reference to pass through—which causes downstream errors. Test this with deliberately ambiguous inputs (e.g., 'send it to him' with two male contacts in context) and measure the false negative rate. If either rate exceeds 5%, adjust the prompt's threshold language or add few-shot examples of borderline cases. For regulated domains, implement a human-in-the-loop override where a reviewer can see the flagged turn, the model's proposed clarification question, and the dialogue context, then choose to approve, edit, or dismiss the question before it reaches the user.
Common Failure Modes
Unresolved references are the most common cause of assistant confusion in multi-turn dialogue. These failure modes cover what breaks first in production and how to guard against it.
Silent Incorrect Resolution
What to watch: The model resolves a pronoun or implicit reference to the wrong entity without flagging uncertainty. This is the most dangerous failure mode because downstream actions execute on incorrect data with no warning. Guardrail: Require a confidence score on every resolution. If confidence is below a configurable threshold, force a clarification question instead of guessing. Log all low-confidence resolutions for review.
Clarification Loop Exhaustion
What to watch: The assistant asks a clarification question, the user answers, but the resolver still cannot disambiguate and asks again. This creates a frustrating loop that burns context budget and erodes trust. Guardrail: Set a maximum clarification depth per reference (e.g., 2 attempts). After the limit, escalate to a human or fall back to a safe default action with an explicit caveat to the user.
Cross-Turn Entity Confusion
What to watch: When multiple entities of the same type appear in a session (e.g., two invoices, three error codes), the resolver swaps their identities. The assistant confidently acts on the wrong entity. Guardrail: Maintain a structured entity grid with unique IDs, attributes, and last-mentioned turn. Validate that the resolved entity's attributes match the user's reference before accepting the resolution.
Stale Reference Propagation
What to watch: A user refers to 'it' after a long digression or topic shift, and the resolver latches onto an entity from 10 turns ago that is no longer relevant. Guardrail: Implement a staleness score based on turn distance and topic continuity. If the most recent mention of the candidate entity exceeds a threshold, re-confirm with the user before using it.
RAG Source vs. Dialogue Ambiguity
What to watch: In RAG-augmented chat, a pronoun could refer to an entity in the retrieved document or an entity in the conversation history. The resolver picks the wrong source, producing a factually correct but contextually wrong answer. Guardrail: Require the resolver to output a source attribution for every resolution: either a dialogue turn ID or a retrieved chunk ID. Validate that the attribution is consistent with the user's intent.
Correction Cascade Failure
What to watch: A user corrects a reference ('no, the other one'), but the resolver updates only the immediate reference without repairing downstream state that depended on the incorrect entity. Guardrail: When a correction is detected, trigger a state repair pass that identifies all downstream actions or slot values that consumed the incorrect reference and flags them for re-evaluation or rollback.
Evaluation Rubric
Use this rubric to evaluate the quality of the Unresolved Reference Flagging and Escalation Prompt's output before deploying it to production. Each criterion targets a specific failure mode common in reference resolution and escalation logic.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Binary Flag Accuracy | [UNRESOLVABLE_FLAG] is true when the referent is missing or ambiguous and false when it is clearly resolvable. | Flag is false when a clarification question is generated, or true when a confident but incorrect resolution is provided. | Run 50 curated turns with known resolvable and unresolvable references. Assert flag matches ground truth with >95% accuracy. |
Clarification Question Quality | [CLARIFICATION_QUESTION] is a single, targeted question that isolates the ambiguity without repeating the entire user turn. | Question is generic (e.g., 'Can you clarify?'), repeats the entire prompt, or asks about the wrong entity. | Human review of 20 generated questions. Pass if >90% are rated as 'specific and actionable'. |
Escalation Path Triggering | [ESCALATION_REQUIRED] is true only when [HIGH_STAKES_DOMAIN] is true and [UNRESOLVABLE_FLAG] is true. | Escalation flag is true for low-stakes ambiguity or false when a high-stakes reference is unresolvable. | Unit test with domain context injection. Assert [ESCALATION_REQUIRED] matches the logical AND of the two input conditions. |
Resolved Reference Grounding | When [UNRESOLVABLE_FLAG] is false, [RESOLVED_REFERENT] contains a specific entity ID or text span and a [SOURCE_TURN_ID]. | Resolved referent is a vague description, hallucinated entity, or lacks a source citation. | Schema validation check: assert [RESOLVED_REFERENT] is not null, [SOURCE_TURN_ID] is a valid integer, and entity exists in the provided history. |
Confidence Score Calibration | [CONFIDENCE_SCORE] is >= 0.9 for clear resolutions, <= 0.5 for ambiguous ones, and null when [UNRESOLVABLE_FLAG] is true. | Score is 0.99 for an incorrect resolution or 0.4 for a trivially easy one. | Statistical check on a labeled test set. Pass if the Brier score is < 0.1 and the expected calibration error is < 0.05. |
Abstention from Guessing | The output never provides a [RESOLVED_REFERENT] when [UNRESOLVABLE_FLAG] is true. | A hallucinated referent is provided alongside a clarification question or escalation flag. | Assertion-based test: for all cases where [UNRESOLVABLE_FLAG] is true, [RESOLVED_REFERENT] must be null. |
Output Schema Compliance | The JSON output is valid and contains all required fields: [UNRESOLVABLE_FLAG], [CONFIDENCE_SCORE], [RESOLVED_REFERENT], [CLARIFICATION_QUESTION], [ESCALATION_REQUIRED]. | Output is missing a required field, contains an extra key, or is not parseable JSON. | Automated schema validation in a CI pipeline. Retry up to 2 times with a repair prompt if validation fails. |
Latency and Token Budget | The prompt processes a turn within 500ms and uses fewer than 200 output tokens for a standard case. | Output exceeds 500 tokens due to verbose rationale or the response time is > 2 seconds. | Load test with 100 concurrent requests. Measure p95 latency and max output tokens. Fail if budget is exceeded. |
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 JSON schema check. Use a lightweight model call without retries. Focus on getting the unresolvable flag and clarification_question fields correct before adding escalation logic.
code[SYSTEM] You are a reference resolver. Analyze the current turn against the dialogue history. Return JSON: {"unresolvable": boolean, "clarification_question": string|null} [DIALOGUE_HISTORY] [HISTORY] [CURRENT_TURN] [USER_INPUT]
Watch for
- False positives flagging resolvable references as unresolvable
- Clarification questions that repeat the entire context instead of targeting the ambiguity
- Missing null handling when no clarification is needed

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