This prompt is for copilot and agent builders who need to detect when a user's new input contradicts a constraint, preference, or fact established earlier in the conversation. The job-to-be-done is not just spotting a contradiction, but producing a structured conflict report that surfaces the specific conflicting statements and generates a neutral, non-accusatory resolution question. The ideal user is an AI engineer integrating this into a multi-turn dialogue system where the assistant must maintain state integrity across turns—think of a travel booking copilot where the user first says 'no flights before 9 AM' and later asks for 'the earliest option,' or a configuration assistant where a previously set budget cap is violated by a new request.
Prompt
Context Conflict Detection Between Turns Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Context Conflict Detection Between Turns Prompt.
Use this prompt when your application maintains a persistent set of user-provided constraints, preferences, or facts across conversation turns and you need to catch contradictions before acting on them. It is particularly valuable in task-oriented assistants, configuration wizards, and any copilot where the cost of silently violating a prior constraint is high—such as making a purchase, sending a communication, or generating a final deliverable. The prompt expects two inputs: a structured representation of prior constraints or facts from the session state, and the new user turn. It returns a conflict assessment with a severity flag, the exact conflicting statements, and a resolution question that gives the user a clear choice without implying they made a mistake.
Do not use this prompt when the prior context is purely informational rather than constraining, when the user is explicitly overriding a previous instruction, or when the contradiction is trivial and the cost of interruption exceeds the cost of proceeding. It is also a poor fit for open-ended chat where there is no structured state to validate against. In high-stakes domains like healthcare or finance, this prompt is a detection layer, not a decision engine—always route confirmed conflicts to a human review step before taking action. For best results, pair this prompt with a session state tracker that maintains a machine-readable log of user-provided constraints, and run conflict detection before any tool call or final output that depends on those constraints.
Use Case Fit
Where the Context Conflict Detection prompt delivers value and where it introduces risk. Use these cards to decide if this prompt belongs in your copilot architecture.
Good Fit: Multi-Constraint Copilots
Use when: users set preferences or constraints early in a session (budget, timeline, technical requirements) and later requests may violate them. Guardrail: Run conflict detection before executing any action that modifies state or commits resources.
Bad Fit: Single-Turn Stateless Queries
Avoid when: each user turn is independent with no carry-over constraints. Running conflict detection on stateless interactions produces false flags and wastes latency budget. Guardrail: Gate the prompt behind a session state check—skip if no prior constraints exist.
Required Input: Structured Prior Constraints
Risk: passing raw conversation history without extracting constraints leads to missed conflicts or hallucinated contradictions. Guardrail: Maintain a structured constraint store (key-value or slot-based) updated after each turn. Feed extracted constraints, not raw dialogue, into the conflict prompt.
Operational Risk: Accusatory Tone Leakage
Risk: the model may surface conflicts with language that sounds like blame ('You said X but now you want Y'). This erodes user trust. Guardrail: Add explicit tone constraints in the prompt requiring neutral, collaborative framing. Validate output tone with an LLM judge before surfacing to users.
Operational Risk: False Conflict Flags
Risk: the model flags a conflict when the user is intentionally updating a preference or adding nuance, not contradicting themselves. Guardrail: Include a 'likely update, not conflict' classification path. Log false-positive rates and tune the conflict threshold with eval datasets containing legitimate preference changes.
Integration Pattern: Pre-Action Gate
Use when: wiring this prompt into an agent loop. Run conflict detection after intent classification but before tool execution. Guardrail: If a conflict is detected, pause the action pipeline and surface the resolution question. Never execute a conflicting action silently.
Copy-Ready Prompt Template
A reusable prompt template for detecting contradictions between a user's new message and prior session constraints, producing a structured conflict report and a neutral resolution question.
This template is the core instruction set for a context conflict detection module. It is designed to be inserted into a system prompt or a dedicated analysis step before the main assistant generates a response. The prompt instructs the model to compare the latest user turn against a structured list of previously established constraints, preferences, or facts from the session. Its primary output is not a final answer to the user, but a diagnostic report that your application can use to decide whether to flag a conflict, ask a clarifying question, or proceed with an assumption.
textYou are a context conflict detection module. Your task is to compare the user's latest input against a list of previously established constraints, preferences, and facts from the current session. You must identify any direct contradictions where the new input is incompatible with the prior context. # PRIOR CONTEXT A structured list of active constraints and facts from earlier in the session: [PRIOR_CONTEXT] # LATEST USER INPUT The user's most recent message: [USER_INPUT] # INSTRUCTIONS 1. Analyze the [USER_INPUT] against each item in [PRIOR_CONTEXT]. 2. Identify only direct, logical contradictions. Do not flag changes of topic, refinements, or new information that adds to prior context without negating it. 3. For each contradiction found, extract the two conflicting statements: one from [PRIOR_CONTEXT] and one from [USER_INPUT]. 4. Formulate a single, neutral resolution question that surfaces the contradiction without accusatory language. The question should ask the user to clarify which statement should take precedence. 5. If no contradictions are found, explicitly state that no conflicts were detected. # OUTPUT SCHEMA You must respond with a valid JSON object conforming to this schema: { "conflicts_detected": boolean, "conflicts": [ { "prior_statement": string, "conflicting_input": string, "resolution_question": string } ] } # CONSTRAINTS - Do not fabricate conflicts. Only flag clear incompatibilities. - The "resolution_question" must be a single, concise question. - Maintain a neutral, helpful tone. Do not imply the user made a mistake. - If [PRIOR_CONTEXT] is empty, set "conflicts_detected" to false.
To adapt this template for your application, you must define the structure of the [PRIOR_CONTEXT] placeholder. This should not be raw conversation history. Instead, it should be a pre-processed, structured list of active constraints extracted by a separate session state management module. For example, it could be a JSON array of strings like "User's budget is $500" or "Target audience is enterprise CTOs". The quality of this input is the single biggest factor in the prompt's success. Before deploying, run this prompt against a golden dataset of 50-100 turn pairs with known contradictions and non-contradictions to tune your [PRIOR_CONTEXT] extraction logic and set a confidence threshold for the conflicts_detected flag. In high-stakes applications, always route detected conflicts to a human reviewer for the final resolution question before it is shown to the user.
Prompt Variables
Required inputs for the Context Conflict Detection Between Turns prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to programmatically check the input before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CURRENT_USER_MESSAGE] | The most recent user turn that may contain a contradiction with prior context. | Use the enterprise plan for all users. | Non-empty string. Length > 1 character. Must not be identical to any prior turn in [SESSION_HISTORY]. |
[SESSION_HISTORY] | Ordered list of prior user and assistant turns, including any previously established constraints or preferences. | [{"role": "user", "content": "We only support the pro plan."}, {"role": "assistant", "content": "Understood, limiting scope to pro plan."}] | Valid JSON array. Each object must have 'role' and 'content' keys. Array length >= 1 for conflict detection to be meaningful. Reject if empty. |
[ACTIVE_CONSTRAINTS] | Explicitly extracted and active constraints from prior turns, such as user preferences, policies, or scope limits. | ["User is on the pro plan", "Budget ceiling is $500"] | Valid JSON array of strings. If null or empty, the prompt should still run but will only detect internal contradictions within [CURRENT_USER_MESSAGE]. |
[CONFLICT_SENSITIVITY] | Threshold for flagging a conflict. Controls whether the prompt reports minor inconsistencies or only major contradictions. | high | Must be one of the following enum values: 'low', 'medium', 'high'. Default to 'medium' if not provided. 'high' triggers on direct logical contradictions only. |
[OUTPUT_SCHEMA] | The exact JSON schema the model must use to return the conflict report, including fields for conflicting statements and the resolution question. | {"conflict_detected": true, "statement_a": "...", "statement_b": "...", "resolution_question": "..."} | Must be a valid JSON Schema object. Reject the prompt assembly if the schema is not parseable by a standard JSON Schema validator. |
[TONE_PROFILE] | A descriptor for the language style of the resolution question to ensure it is collaborative, not accusatory. | collaborative and neutral | Non-empty string. Map to a predefined set of tone guidelines in your application config (e.g., 'neutral', 'collaborative', 'formal'). Reject unknown tone values. |
Implementation Harness Notes
How to wire the Context Conflict Detection prompt into a production copilot or agent loop with validation, retries, and escalation.
The Context Conflict Detection prompt is not a standalone chatbot; it is a state-inspection module that should be called before the assistant generates a response to a new user turn. In a production harness, this prompt sits between the dialogue state manager and the response generation step. When a new user message arrives, the harness retrieves the active session constraints, preferences, and prior decisions from the state store, packages them into the [PRIOR_CONTEXT] variable, and passes the raw [USER_INPUT] alongside it. The model returns a structured conflict report—either conflict_detected: false or a detailed conflict object with statement_a, statement_b, and a resolution_question. The harness must then branch: if no conflict is found, the main generation prompt proceeds normally; if a conflict is detected, the harness should pause response generation and surface the resolution question to the user before continuing. This prevents the assistant from silently choosing one constraint over another or generating output that violates previously stated user intent.
The output of this prompt must pass through a strict JSON schema validator before the harness acts on it. The expected schema includes a boolean conflict_detected field, and when true, a conflicts array where each object contains statement_a (the earlier constraint), statement_b (the contradictory new input), source_turn (an identifier for the prior turn), and resolution_question (a single, non-accusatory question). If the model output fails JSON parsing or schema validation, the harness should retry once with a repair prompt that includes the raw output and the schema error. After a second failure, log the raw output and escalate to a human reviewer rather than silently proceeding. For high-stakes domains such as healthcare or finance, even a successfully parsed conflict report should be logged to an audit trail with the session ID, turn numbers, and the resolution question shown to the user. This creates a reviewable record of when the system detected a contradiction and how it was resolved.
Model choice matters for this prompt. The task requires precise comparison of semantic intent across turns, not just keyword overlap. Use a model with strong instruction-following and structured output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid smaller or older models that may conflate benign topic shifts with true conflicts, producing false-positive flags that annoy users with unnecessary clarification questions. To reduce false positives, include a [CONFIDENCE_THRESHOLD] parameter in the prompt template (e.g., 0.8) and instruct the model to only flag conflicts where the contradiction is clear, not where the user is simply adding new information or refining a preference. In your eval suite, maintain a golden dataset of turn pairs labeled as conflict, refinement, topic_shift, and new_information. Measure precision and recall on the conflict class specifically, and set a minimum precision bar (e.g., 0.85) before deploying a prompt variant. If false-positive rates exceed your threshold, tune the confidence parameter or add few-shot examples of refinements that should not be flagged as conflicts.
When a conflict is detected, the harness must not generate a full assistant response. Instead, it should surface only the resolution_question to the user, prefixed by a brief, neutral framing such as 'I want to make sure I follow your latest preference.' The user's answer to this question should then update the session state—either replacing the prior constraint or confirming that both constraints apply in different contexts—before the main generation prompt runs. Do not feed the conflict report itself into the main generation prompt; it contains meta-commentary about the contradiction that will confuse the response model. Only pass the resolved constraint set. Finally, instrument the harness to track the rate of conflict detection, the rate of user confirmation after a resolution question, and the rate of user corrections in subsequent turns. A rising correction rate after conflict resolution suggests the prompt is asking the wrong question or framing the contradiction poorly, and the resolution question language should be reviewed.
Expected Output Contract
Define the exact structure, types, and validation rules for the conflict report generated by the Context Conflict Detection Between Turns Prompt. Use this contract to parse, validate, and route the model's output in your application harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
conflict_detected | boolean | Must be exactly true or false. If false, all other fields except reasoning should be null. | |
conflict_id | string | Must match the pattern conflict-[timestamp]-[short-hash]. Validate with regex: ^conflict-\d{10}-[a-f0-9]{4}$. | |
statement_a | object | Must contain turn_id (string), text (string), and timestamp (ISO 8601 string). Turn_id must match a prior turn in the session. | |
statement_b | object | Must contain turn_id (string), text (string), and timestamp (ISO 8601 string). Turn_id must differ from statement_a.turn_id. | |
conflict_type | enum | Must be one of: factual_contradiction, preference_reversal, constraint_violation, priority_shift, or entity_confusion. | |
resolution_question | string | Must be a single interrogative sentence ending with a question mark. Must not contain accusatory language. Max 150 characters. | |
resolution_options | array of strings | If present, must contain 2-4 distinct, non-overlapping options. Each option must be a complete phrase under 80 characters. | |
confidence | number | Must be a float between 0.0 and 1.0. If below 0.7, the resolution_question must be present and the conflict should be surfaced to the user. |
Common Failure Modes
Context conflict detection fails silently in production when the model misses contradictions, flags false conflicts, or phrases resolutions in ways that erode user trust. These are the most common failure patterns and the guardrails that catch them before they reach users.
False Conflict Flags on Preference Refinement
What to watch: The model treats a user's natural preference refinement as a contradiction. For example, 'Actually, make it a dark theme' after requesting 'a modern UI' triggers a conflict flag instead of recognizing the new statement as a superseding constraint. Guardrail: Include explicit instructions that later turns override earlier preferences unless the user marks them as additive. Add few-shot examples distinguishing refinement from contradiction.
Missed Contradictions in Long Context Windows
What to watch: When the conflicting statements are separated by many turns or buried in dense context, the model fails to detect the contradiction entirely. The assistant proceeds with mutually exclusive constraints and produces incoherent output. Guardrail: Implement a dedicated conflict-detection pass that receives only the extracted constraints, not the full conversation. Test with synthetic conversations where contradictions are placed at increasing turn distances.
Accusatory Resolution Language
What to watch: The generated resolution question sounds like a gotcha. Phrasing such as 'You previously said X but now you're saying Y. Which is it?' makes users defensive and erodes trust. Guardrail: Add a tone constraint requiring the resolution question to acknowledge both statements neutrally and frame the clarification as the assistant needing help, not the user making a mistake. Use an LLM judge to score resolution tone on a defensiveness scale.
Conflict Report Leaking Internal State
What to watch: The conflict report includes raw internal representations, confidence scores, or system-level reasoning that should not surface to users. This breaks the assistant's abstraction boundary and confuses users. Guardrail: Separate the internal conflict detection output from the user-facing resolution question. Validate that user-facing output contains only the conflicting statements and the clarification question, with no metadata leakage.
Over-Clarification on Low-Stakes Conflicts
What to watch: The model flags every minor inconsistency, including trivial wording differences that don't affect the task outcome. Users experience death by a thousand clarifications and abandon the session. Guardrail: Add a materiality threshold. Only flag conflicts where the contradiction would change the output. Include a 'proceed with best interpretation' option with disclosed assumptions for low-stakes conflicts.
Conflict Resolution Loop When User Repeats Ambiguity
What to watch: The user responds to the resolution question with another ambiguous statement, and the model asks again. This creates a clarification loop that burns context budget and frustrates the user. Guardrail: Implement a maximum clarification depth. After one failed resolution attempt, the assistant should state its best interpretation, disclose the assumption, and offer an explicit escape hatch for the user to correct later.
Evaluation Rubric
Use this rubric to test the Context Conflict Detection prompt before shipping. Each criterion targets a known failure mode: false conflict flags, accusatory tone, missed contradictions, and resolution question quality. Run these checks on a golden dataset of turn pairs with known conflicts and non-conflicts.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Conflict Detection Recall | Detects >=95% of true contradictions in [TURN_PAIR] test set | Missed contradictions where [PRIOR_CONSTRAINT] and [NEW_INPUT] logically conflict | Run on 50+ labeled conflict pairs; measure recall against human labels |
Conflict Detection Precision | Flags <=5% of non-conflict turn pairs as conflicts | False conflict flag on topic shift, clarification, or compatible refinement | Run on 50+ labeled non-conflict pairs; measure false-positive rate |
Conflicting Statement Extraction | Both [STATEMENT_A] and [STATEMENT_B] are verbatim or near-verbatim quotes from source turns | Paraphrased or hallucinated statements not traceable to [TURN_HISTORY] | Parse output; verify each statement string exists in corresponding turn text |
Resolution Question Relevance | Question directly addresses the specific contradiction between [STATEMENT_A] and [STATEMENT_B] | Generic clarification question that doesn't reference the conflict or re-asks for already-provided info | Manual review: does question mention both conflicting constraints? |
Resolution Question Tone | Question uses neutral framing without implying user error, inconsistency, or blame | Language like 'you said X but now you're saying Y' or 'that contradicts your earlier request' | Run tone classifier; flag accusatory patterns; human review on boundary cases |
Conflict Severity Classification | Severity field matches labeled severity in test set within one level | CRITICAL flag on minor preference shift or LOW flag on safety constraint violation | Compare output [SEVERITY] to labeled severity; measure exact match and adjacent match rates |
No-Conflict Output Format | Returns conflict_detected: false with empty statements array and null resolution_question | Returns partial conflict structure, hallucinated statements, or defensive explanation when no conflict exists | Parse JSON output; assert schema compliance for negative cases |
Multi-Constraint Conflict Handling | When [NEW_INPUT] conflicts with multiple [PRIOR_CONSTRAINTS], all conflicts are reported in separate entries | Only first conflict detected; subsequent contradictions ignored | Test with turn pairs containing 3+ simultaneous constraint violations; count reported conflicts |
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
Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the [OUTPUT_SCHEMA] constraint and ask for plain text conflict reports. Skip the resolution question generation and just flag the conflict. This gives you fast qualitative signal on whether conflict detection is working before investing in structured output.
Prompt modification
Remove the JSON output instruction. Replace with: Output a brief conflict report in plain text. If no conflict exists, output 'NO_CONFLICT'.
Watch for
- Over-flagging stylistic rephrasing as contradictions
- Missing subtle priority shifts that don't use negation words
- No structured fields to pipe into downstream systems

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