Inferensys

Prompt

Contradictory Instruction Resolution Prompt

A practical prompt playbook for using the Contradictory Instruction Resolution Prompt in production AI workflows to handle users who change their minds mid-session.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for resolving contradictory user instructions in a multi-turn session.

This prompt is designed for AI assistant and copilot builders who need to handle a specific, high-stakes production failure mode: a user changes their mind mid-session, issuing a new instruction that directly contradicts a prior one. The job-to-be-done is not just to follow the latest command, but to explicitly detect the conflict, model the user's updated intent, construct a transparent rationale, and seek confirmation before silently overwriting the prior state. The ideal user is an engineering lead or developer integrating this into a task-oriented agent, customer support bot, or any multi-turn system where silently discarding prior context erodes user trust or violates business logic.

You should use this prompt when the cost of getting the resolution wrong is high. This includes scenarios where the prior instruction triggered a multi-step plan, a tool execution, or a database write. The prompt requires a structured input containing the full session history, the specific contradictory turns, and any non-negotiable system constraints. It is not suitable for simple, stateless Q&A or single-turn instruction following. Do not use this prompt if your application can safely adopt a 'last instruction wins' policy without consequence, or if the latency introduced by a confirmation step is unacceptable for your real-time use case.

Before integrating this prompt, ensure your application harness can surface the conflict to the user and pause execution for confirmation. The prompt's output is a structured intent model and a confirmation request, not a final action. The next step is to wire this output into a human-in-the-loop review or a strict confirmation gateway in your agent's execution loop. Avoid the common failure mode of deploying this prompt and then auto-accepting its output, which defeats its purpose and creates a silent, complex state corruption.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Contradictory Instruction Resolution Prompt works, where it fails, and the operational conditions required for safe deployment.

01

Good Fit: Explicit User Corrections

Use when: the user provides a direct, unambiguous correction such as 'ignore my last instruction' or 'change the priority to X.' The prompt excels at isolating the conflicting turns and producing a structured resolution. Guardrail: Pair with a confirmation step before mutating downstream state to prevent over-correction.

02

Bad Fit: Implicit or Passive-Aggressive Drift

Avoid when: user dissatisfaction is expressed through vague complaints or passive language without a clear directive. The prompt may over-interpret sentiment as a binding instruction change. Guardrail: Route sentiment-heavy but instruction-light turns to a separate clarification module before invoking conflict resolution.

03

Required Input: Structured Session State

Risk: Without a machine-readable log of prior intents, constraints, and active goals, the model cannot reliably identify what is being contradicted. Guardrail: The prompt requires a strict [SESSION_STATE] object containing active instructions, their sources, and timestamps. Do not rely on raw chat history alone.

04

Operational Risk: Silent Preference Reversal

Risk: The model resolves the conflict by silently discarding the prior instruction, leaving the user unaware that their previous constraint was dropped. Guardrail: The output schema must include a confirmation_required boolean and a state_changes diff. Never apply the resolution automatically without surfacing the trade-off to the user or a supervisor.

05

Operational Risk: Correction Cascades

Risk: Resolving one contradiction triggers a chain reaction of invalidated dependent tasks or sub-goals, corrupting the session state. Guardrail: Implement a scope_boundary field in the resolution output. The repair logic must only touch explicitly conflicting elements and flag, but not auto-resolve, downstream dependencies for re-verification.

06

Bad Fit: Safety Policy Conflicts

Avoid when: the contradiction is between a user request and a hard system safety policy. This prompt is designed for user-intent reconciliation, not policy enforcement. Guardrail: Route policy-violation conflicts to a dedicated System Policy vs User Intent Conflict prompt that prioritizes refusal and boundary explanation over compromise.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt with square-bracket placeholders for detecting and resolving contradictory user instructions mid-session.

This prompt template is designed to be copied directly into your prompt management system, IDE, or orchestration layer. It accepts the current session state, the new user message, and your system constraints, then produces a structured resolution that includes an updated intent model, a rationale for the change, and a confirmation request to present to the user. The template uses square-bracket placeholders that you must replace with your application's actual values before sending the request to the model.

text
You are an assistant that detects and resolves contradictory instructions from users during an ongoing session. Your job is to identify when a new user message conflicts with prior instructions, determine which instruction should take precedence, and produce a structured resolution that the application can use to update state and confirm with the user.

## INPUTS

### Session Context
[SESSION_CONTEXT]

### New User Message
[USER_MESSAGE]

### System Constraints
[SYSTEM_CONSTRAINTS]

### Precedence Rules
[PRECEDENCE_RULES]

## INSTRUCTIONS

1. Compare the new user message against all prior instructions, goals, constraints, and commitments in the session context.
2. If no conflict exists, respond with `"conflict_detected": false` and an empty resolution.
3. If a conflict exists, identify:
   - The specific prior instruction or commitment being contradicted.
   - The new instruction that conflicts with it.
   - The type of conflict: direct_override, priority_shift, constraint_violation, or scope_change.
4. Apply the precedence rules to determine which instruction wins.
5. If the precedence rules do not clearly resolve the conflict, flag for human clarification.
6. Produce a resolution that includes:
   - The updated intent model reflecting the winning instruction.
   - A clear rationale explaining why this instruction takes precedence.
   - Any state elements that must be rolled back or invalidated.
   - A confirmation message to present to the user before applying the change.

## OUTPUT SCHEMA

Return a valid JSON object with this exact structure:

{
  "conflict_detected": boolean,
  "conflict_type": "direct_override" | "priority_shift" | "constraint_violation" | "scope_change" | null,
  "conflicting_elements": [
    {
      "prior_instruction": "string",
      "new_instruction": "string",
      "source_turn": number | null
    }
  ],
  "resolution": {
    "winning_instruction": "string",
    "precedence_rationale": "string",
    "rolled_back_state": ["string"],
    "unchanged_state": ["string"],
    "updated_intent_model": {
      "primary_goal": "string",
      "active_constraints": ["string"],
      "pending_actions": ["string"]
    }
  },
  "confirmation_required": boolean,
  "confirmation_message": "string",
  "escalation_required": boolean,
  "escalation_reason": "string | null"
}

## CONSTRAINTS

- Do not apply the resolution silently. Always set `confirmation_required: true` when a conflict is detected.
- Do not fabricate prior instructions that do not appear in the session context.
- If the session context is empty or insufficient to detect conflict, set `conflict_detected: false`.
- If the conflict involves a safety or compliance constraint from [SYSTEM_CONSTRAINTS], the constraint always wins unless [PRECEDENCE_RULES] explicitly state otherwise.
- For `escalation_required: true`, provide a specific reason that a human reviewer can act on.
- Keep the confirmation message concise, specific, and neutral in tone. Do not apologize excessively.

## EXAMPLES

[EXAMPLES]

## RISK LEVEL

[RISK_LEVEL]

To adapt this template, replace each square-bracket placeholder with your application's live data. [SESSION_CONTEXT] should contain a structured representation of prior turns, active goals, constraints, and pending actions—not raw chat history. [PRECEDENCE_RULES] must encode your application's policy for resolving conflicts, such as 'most recent explicit user instruction wins unless it violates a system constraint' or 'safety constraints always override user preferences.' [EXAMPLES] should include at least two few-shot demonstrations: one showing a clear conflict resolution and one showing a non-conflict where the model correctly returns conflict_detected: false. [RISK_LEVEL] should be set to high if the assistant controls irreversible actions, medium if it controls reversible state changes, or low for read-only assistants. Before deploying, validate that the model reliably populates conflicting_elements with specific, traceable references to prior turns rather than vague summaries.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Contradictory Instruction Resolution Prompt. Validate each before calling the model to prevent silent failures and hallucinated resolutions.

PlaceholderPurposeExampleValidation Notes

[CURRENT_INSTRUCTIONS]

The active set of instructions or constraints the assistant is operating under before the new user input.

Generate a quarterly report summary with a formal tone. Include revenue, costs, and margin analysis.

Must be a non-empty string. Parse as a list of distinct directives. If empty, the prompt cannot detect contradictions and should escalate.

[PRIOR_USER_TURNS]

The last N conversation turns from the user, used to establish the instruction history and detect reversals.

User: Make it casual. Assistant: Ok, here is a casual summary. User: Actually, make it formal.

Must be an array of objects with 'role' and 'content'. Minimum 2 turns required for meaningful conflict detection. Validate role is 'user' or 'assistant'.

[NEW_USER_INPUT]

The most recent user message that may contradict prior instructions.

Scrap the revenue section. Just give me a one-line summary of costs.

Must be a non-empty string. Compare against [CURRENT_INSTRUCTIONS] and [PRIOR_USER_TURNS] to identify contradictions. If identical to a prior turn, flag as a potential duplicate, not a contradiction.

[SESSION_CONTEXT]

Additional session metadata, such as user role, task type, or active constraints, that may influence resolution priority.

{"user_role": "analyst", "task_type": "reporting", "compliance_level": "internal"}

Must be a valid JSON object. Can be null. If provided, use to weight resolution decisions (e.g., compliance constraints override stylistic preferences).

[OUTPUT_SCHEMA]

The exact JSON schema the model must use to return the conflict analysis and resolution.

{"type": "object", "properties": {"conflict_detected": {"type": "boolean"}, "conflict_type": {"type": "string", "enum": ["direct_contradiction", "priority_shift", "scope_change", "none"]}, "resolution": {"type": "object"}}}

Must be a valid JSON Schema object. Validate with a schema parser before injection. The 'resolution' sub-schema must include 'updated_instructions' and 'rationale' fields.

[CONSTRAINTS]

Hard constraints on the resolution behavior, such as requiring confirmation for high-impact changes or forbidding silent preference reversal.

Require explicit user confirmation before dropping any previously requested section. Do not invent new data.

Must be a non-empty string or array of strings. Parse into a list of boolean checks. If a constraint is violated by the resolution, the output must be rejected by the harness.

[PERSONA]

The assistant's defined persona, which may influence the tone of the confirmation request.

You are a precise, no-nonsense financial analyst assistant. You are direct but helpful.

Must be a non-empty string. If null, a default neutral persona is used. Validate that the persona does not contradict the [CONSTRAINTS] (e.g., a 'yes-man' persona conflicting with a 'require confirmation' constraint).

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Contradictory Instruction Resolution Prompt into an application with validation, retry, and logging.

The Contradictory Instruction Resolution Prompt is not a standalone artifact; it is a stateful component that must be integrated into a session management layer. The application is responsible for maintaining a structured session state object that tracks the user's active instructions, their precedence, and the turn in which each was established. Before calling the model, the harness must extract the current instruction set and the new contradictory input, format them into the prompt's [PRIOR_INSTRUCTIONS] and [NEW_INPUT] placeholders, and inject any relevant [SYSTEM_CONSTRAINTS]. After the model responds, the harness must parse the structured output—typically an intent_model, conflict_rationale, and confirmation_request—and update the session state only after the conflict is resolved, not preemptively.

Validation is the critical safety net here. The harness must validate that the model's output contains all required fields and that the resolution_type is one of the allowed enum values (e.g., override, merge, clarify, escalate). A retry loop with a maximum of two attempts should be implemented for malformed JSON or missing fields, using a repair prompt that includes the raw output and the validation error. More importantly, implement a semantic check: compare the updated_intent against the PRIOR_INSTRUCTIONS to detect silent reversals where the model drops a prior instruction without explicit rationale. If a prior instruction is absent from the updated set and the conflict_rationale does not address it, flag the response for human review or force a clarify escalation. This prevents the most dangerous failure mode: the assistant quietly forgetting a user's earlier constraint.

Logging must capture the full conflict resolution event for auditability and debugging. Record the session ID, the turn numbers of the conflicting instructions, the raw prompt, the model's raw output, the validation result, and the final state update applied. For high-stakes domains, write an immutable audit record before applying the state change. Wire the harness to emit a context_conflict_resolved event that downstream systems can consume. When the resolution_type is escalate, the harness should not update the session state automatically; instead, it should enqueue a human review task and pause the conversation flow until the review is complete. Avoid the temptation to auto-resolve conflicts with low confidence scores—a confidence field below 0.7 should trigger a confirmation request to the user rather than a silent state mutation.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the structured resolution output produced by the Contradictory Instruction Resolution Prompt.

Field or ElementType or FormatRequiredValidation Rule

resolution_id

string (UUID v4)

Must parse as valid UUID v4. Reject if missing or malformed.

conflict_type

enum: direct_contradiction | priority_shift | preference_reversal | scope_narrowing | scope_expansion

Must match exactly one of the allowed enum values. Reject on unknown value.

original_instruction_summary

string (<= 280 chars)

Must be non-empty, <= 280 characters, and contain a direct quote or paraphrase of the earlier instruction. Reject if empty or exceeds length.

contradictory_instruction_summary

string (<= 280 chars)

Must be non-empty, <= 280 characters, and contain a direct quote or paraphrase of the later instruction. Reject if empty or exceeds length.

updated_intent

string (<= 500 chars)

Must be non-empty, <= 500 characters, and describe the resolved user intent after conflict resolution. Reject if identical to original_instruction_summary without explicit override justification.

resolution_rationale

string (<= 500 chars)

Must be non-empty, <= 500 characters, and explain why the later instruction takes precedence or why a clarification is needed. Reject if it fails to reference both conflicting instructions.

requires_confirmation

boolean

Must be true if conflict_type is priority_shift or if updated_intent differs from original_instruction_summary by more than 50% cosine similarity. Reject if false when conditions are met.

affected_state_keys

array of strings

If present, each element must be a non-empty string matching a known state key pattern. Null allowed. Reject if array contains empty strings.

PRACTICAL GUARDRAILS

Common Failure Modes

Contradictory instruction resolution fails silently in production. These are the most common breakages and how to prevent them before they reach users.

01

Silent Preference Reversal

What to watch: The model accepts a user correction and updates state but fails to acknowledge the change explicitly. The user repeats the correction, creating a frustrated loop. Guardrail: Require the output to include an explicit acknowledgment of the changed constraint before proceeding. Validate that the acknowledgment references the specific contradiction resolved.

02

Over-Correction Cascade

What to watch: A single user correction triggers the model to discard unrelated prior instructions or session state. The assistant forgets the original task entirely. Guardrail: Scope every correction to only the conflicting element. Include an 'unchanged state' confirmation block in the output schema. Test with corrections that touch only one field while other constraints must persist.

03

Policy Leak During Refusal

What to watch: When user intent conflicts with system policy, the refusal response paraphrases or reveals the internal system constraint. Guardrail: Use a refusal template that states what cannot be done and offers an alternative without explaining why. Red-team with prompts that probe for policy boundaries. Log any output containing system-prompt language for review.

04

Stale Context Wins Over Fresh Input

What to watch: The model resolves a contradiction by trusting earlier session context over the user's latest turn, producing an answer the user just contradicted. Guardrail: Implement a recency-weighting rule in the prompt: 'When a user's latest message contradicts prior turns, treat the latest message as authoritative unless it creates a safety issue.' Validate with test cases where the user reverses a prior preference.

05

False Conflict Detection on Clarification

What to watch: The model misinterprets a user's clarifying question or sub-task detail as a contradiction and triggers an unnecessary resolution flow. Guardrail: Add a conflict severity threshold. Only trigger resolution when the contradiction changes a decision, constraint, or output. For low-severity mismatches, treat the new input as additive clarification. Test with follow-up questions that refine but don't reverse intent.

06

Confirmation Fatigue

What to watch: The model asks for confirmation on every minor contradiction, turning a quick correction into a multi-turn interrogation. Users abandon the session. Guardrail: Skip confirmation for low-risk, high-confidence reversals. Only request explicit confirmation when the change affects a safety constraint, a committed action, or a high-cost decision. Log skipped confirmations for audit.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the Contradictory Instruction Resolution Prompt's output quality before shipping. Use these tests to catch silent preference reversals, over-correction, and confirmation fatigue.

CriterionPass StandardFailure SignalTest Method

Conflict Detection Accuracy

All contradictory elements between [EARLIER_INSTRUCTION] and [LATER_INSTRUCTION] are correctly identified and listed.

Missing a direct contradiction or flagging a non-contradictory clarification as a conflict.

Run 20 synthetic conflict pairs and compare detected contradictions against a human-labeled ground truth set.

Intent Model Update Completeness

The updated intent model in the output reflects the [LATER_INSTRUCTION] and explicitly marks overridden parts of the [EARLIER_INSTRUCTION].

The updated intent model silently drops a constraint from the earlier instruction without acknowledgment.

Parse the output JSON. Assert that every field in the original intent model is present and has a status of 'retained', 'overridden', or 'clarified'.

Rationale Traceability

The rationale field cites specific phrases from both [EARLIER_INSTRUCTION] and [LATER_INSTRUCTION] to justify the resolution.

The rationale is generic (e.g., 'user changed their mind') without referencing the actual conflicting text.

Use a substring check to verify that the rationale contains quoted text from both input instructions.

Confirmation Request Specificity

The confirmation request asks about the specific change in intent, not a generic 'Are you sure?'.

The confirmation request is a generic yes/no question that does not mention the specific priority shift.

LLM-as-judge evaluation: prompt a judge model to check if the confirmation message names the specific overridden constraint.

Over-Correction Containment

Only the explicitly contradicted parts of the [EARLIER_INSTRUCTION] are modified. Unrelated constraints remain unchanged.

An unrelated constraint from the earlier instruction is dropped or altered in the updated intent model.

Diff the original intent model with the updated intent model. Assert that fields not mentioned in the contradiction have a status of 'retained'.

Silent Reversal Prevention

The output explicitly acknowledges the reversal and does not present the new instruction as if it were always the user's intent.

The output simply adopts the new instruction without any acknowledgment of the prior contradictory state.

Check for the presence of an 'overridden' status in the intent model and a non-empty 'rationale' field. Fail if both are absent.

Output Schema Validity

The output is valid JSON that strictly conforms to the defined [OUTPUT_SCHEMA] with all required fields present.

The output is missing a required field, contains a malformed JSON structure, or includes extra untyped commentary.

Validate the raw output string against the [OUTPUT_SCHEMA] using a JSON schema validator. Retry once on failure.

Confirmation Fatigue Avoidance

The output correctly sets the 'requires_confirmation' boolean to true only for high-impact or ambiguous priority shifts.

The prompt requests confirmation for a trivial or unambiguous correction, or fails to request it for a major goal change.

Run 10 low-impact and 10 high-impact test cases. Assert that 'requires_confirmation' is false for all low-impact cases and true for all high-impact cases.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a simple JSON schema. Use a lightweight validator that checks for required fields (conflict_type, resolution, confirmation_request) without strict enum enforcement. Run 10–20 hand-crafted contradictory pairs through the prompt and eyeball the outputs.

code
[SYSTEM]
You are a context conflict resolver. Given [PRIOR_INSTRUCTION] and [NEW_INSTRUCTION], detect contradictions and produce a JSON resolution.

[OUTPUT_SCHEMA]
{
  "conflict_detected": boolean,
  "conflict_type": "direct_contradiction" | "scope_change" | "priority_shift" | "clarification" | "none",
  "resolution": string,
  "confirmation_request": string | null
}

Watch for

  • Missing schema checks letting malformed JSON through
  • Overly broad conflict detection flagging clarifications as contradictions
  • No retry logic when the model produces unparseable output
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.