This prompt is designed for developers and AI reliability engineers who need to analyze production conversation traces to identify exactly when a user changed their objective mid-session. The core job-to-be-done is turning a raw multi-turn trace into a structured goal-change timeline, answering three questions: at which turn did the goal shift, did the assistant detect the change, and how smoothly was the transition handled? This is not a prompt for live conversation management—it is a post-hoc diagnostic tool for debugging assistant behavior, evaluating conversation quality, and building monitoring dashboards for session health.
Prompt
User Goal Change Detection Over Turns Prompt

When to Use This Prompt
Define the job, reader, and constraints for detecting user goal changes in multi-turn conversation traces.
Use this prompt when you have a complete trace export containing user utterances, assistant responses, and any internal state or tool-call logs. The ideal reader is someone who can feed structured trace data into the prompt and interpret the resulting timeline to make engineering decisions—such as tuning context retention policies, adjusting intent classification thresholds, or identifying training gaps in goal-tracking behavior. Do not use this prompt for real-time goal detection during an active session; it is designed for offline analysis where full turn history is available. Do not use it when the trace is incomplete, missing assistant internal state, or when the conversation is single-turn. The prompt assumes multi-turn interactions where goal persistence or change is meaningful.
The prompt requires careful input preparation. You must provide the full conversation trace, including turn numbers, user messages, assistant responses, and any available metadata such as detected intents or active goal labels. The output is a structured timeline, not a free-text summary, which makes it suitable for automated ingestion into monitoring pipelines or evaluation dashboards. Before relying on this prompt for production decisions, validate its output against a golden set of manually annotated traces to calibrate your acceptance threshold for false positives and missed goal changes. In high-stakes applications—such as healthcare triage or financial advisory—always pair the automated timeline with human review before taking action on the findings.
After running this prompt, the next step is to correlate the detected goal changes with other trace signals: Did retrieval quality degrade after the shift? Did the assistant enter a clarification loop? Did tool calls become misaligned? The goal-change timeline is a diagnostic starting point, not an endpoint. Avoid treating every detected shift as a defect—some goal changes are user-initiated and legitimate. The value lies in distinguishing smooth, detected transitions from abrupt, missed, or mishandled ones.
Use Case Fit
Where the User Goal Change Detection Over Turns prompt delivers reliable signal and where it introduces operational risk.
Good Fit: Structured Trace Review
Use when: you have a complete multi-turn trace export with user utterances, assistant responses, and internal goal state or intent labels. Guardrail: The prompt requires turn-level metadata to produce a reliable timeline. Without it, detection accuracy degrades to guesswork.
Bad Fit: Implicit Goal Shifts
Avoid when: users signal goal changes through subtle phrasing, passive disengagement, or topic drift without explicit restatement. Guardrail: The prompt is designed for explicit task switching. For implicit shifts, pair it with a turn-level intent drift detection prompt before running goal-change analysis.
Required Input: Turn-Level Goal State
What to watch: The prompt depends on the assistant's recorded goal state at each turn. If your trace system does not capture this, the prompt cannot produce a reliable change timeline. Guardrail: Instrument your assistant to log its active goal or intent label at every turn boundary before deploying this prompt.
Operational Risk: False Positive Change Detection
What to watch: The model may flag a goal change when the user is simply adding detail, asking a clarifying question, or correcting a misunderstanding within the same task. Guardrail: Add a validation step that checks whether the detected change represents a true task switch or an in-task refinement. Require human review for ambiguous cases.
Operational Risk: Missed Transition Handling Assessment
What to watch: The prompt may identify when a goal changed but fail to accurately assess whether the assistant handled the transition smoothly. Guardrail: Cross-reference the goal-change timeline with user feedback signals and repair attempt evaluations from the same session to validate transition quality.
Bad Fit: Single-Turn or Stateless Interactions
Avoid when: your assistant treats each request independently without session state or multi-turn context. Guardrail: This prompt is designed for conversational systems with persistent state. For stateless systems, goal-change detection is meaningless—use single-turn intent classification prompts instead.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for detecting user goal changes across multi-turn conversation traces.
This prompt template is designed to analyze a full multi-turn conversation trace and produce a goal-change timeline. It identifies the exact turn where the user's objective shifted, assesses whether the assistant detected the change, and evaluates how smoothly the transition was handled. The template uses square-bracket placeholders so you can inject trace data, output schema requirements, and domain-specific constraints without modifying the core instruction logic.
textYou are an expert conversation analyst reviewing a multi-turn trace to detect user goal changes. ## INPUT [TRACE_DATA] ## TASK Analyze the conversation turn by turn. Identify every point where the user's primary objective or task intent changed. For each detected goal change, produce a structured record. ## OUTPUT_SCHEMA Return a JSON object with the following structure: { "session_id": "string", "goal_changes": [ { "change_id": "string", "turn_number": integer, "previous_goal": "string | null", "new_goal": "string", "user_signal": "string", "assistant_detected": boolean, "detection_lag_turns": integer | null, "transition_quality": "smooth | abrupt | ignored | corrected", "evidence": "string" } ], "summary": "string" } ## FIELD DEFINITIONS - change_id: Unique identifier for this goal change event. - turn_number: The turn index (1-based) where the user signaled the new goal. - previous_goal: The user's goal before this change. Use null for the first goal in the session. - new_goal: The user's goal after this change. - user_signal: The exact user utterance or action that signaled the goal change. - assistant_detected: Whether the assistant acknowledged or acted on the new goal within the trace. - detection_lag_turns: Number of turns before the assistant responded to the new goal. Null if never detected. - transition_quality: 'smooth' if the assistant adapted naturally, 'abrupt' if the switch was jarring, 'ignored' if the assistant continued with the previous goal, 'corrected' if the user had to re-state the goal. - evidence: Quote the specific turns that support this assessment. - summary: A 2-3 sentence narrative of the overall goal-change pattern in this session. ## CONSTRAINTS - Do not confuse topic drift within the same goal with an actual goal change. - A goal change requires the user to pursue a different task outcome, not just ask a follow-up question. - If the user returns to a previous goal, treat it as a new goal change event. - Flag any goal change that the assistant failed to detect as a transition_quality of 'ignored'. - If [RISK_LEVEL] is 'high', include a confidence score (0.0-1.0) for each goal change detection. ## EXAMPLES [EXAMPLES] ## CONTEXT [CONTEXT]
To adapt this template, replace [TRACE_DATA] with the raw conversation export including user utterances, assistant responses, and any internal state annotations your system captures. Replace [EXAMPLES] with 2-3 annotated traces showing clear goal changes and edge cases like topic drift that should not be flagged. Replace [CONTEXT] with any domain-specific taxonomy of goal types relevant to your application. The [RISK_LEVEL] placeholder controls whether confidence scores are required—set it to 'high' for customer-facing production systems where missed goal changes have business impact, or 'standard' for offline analysis. After generating output, validate the JSON structure against the schema before ingesting it into your monitoring dashboard or alerting pipeline.
Prompt Variables
Required inputs for the User Goal Change Detection Over Turns prompt. Each variable must be populated from trace data before the prompt is assembled. Missing or malformed variables will cause unreliable goal-change timelines.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TURN_HISTORY] | Full transcript of the multi-turn conversation with speaker labels, turn numbers, and timestamps | TURN_1 (USER, 00:00): Book a flight to Chicago. TURN_2 (ASSISTANT, 00:05): What date? TURN_3 (USER, 00:12): Actually, find me a hotel instead. | Must be a non-empty array of turn objects. Each turn requires speaker, turn_index, and content fields. Null or single-turn inputs should abort before prompt assembly. |
[ASSISTANT_GOAL_STATE_PER_TURN] | The assistant's internal goal label or state object recorded at each turn boundary | TURN_1: flight_booking, TURN_2: flight_booking, TURN_3: hotel_search | Must align 1:1 with [TURN_HISTORY] by turn_index. Missing goal states for any turn should trigger a null-handling strategy or exclude that turn from analysis. |
[GOAL_TAXONOMY] | The set of valid goal labels the assistant can be in, used to normalize goal names and detect transitions | ["flight_booking", "hotel_search", "car_rental", "general_inquiry", "account_management"] | Must be a non-empty array of unique string labels. Goal states in [ASSISTANT_GOAL_STATE_PER_TURN] that fall outside this taxonomy should be flagged as unknown transitions. |
[TRANSITION_SMOOTHNESS_THRESHOLD] | Numeric threshold defining how many turns the assistant may take to fully align with a new user goal before the transition is flagged as delayed | 2 | Must be a positive integer. Values below 1 will flag every transition as delayed. Values above 5 may mask genuine detection failures. Default to 2 if not specified. |
[SESSION_METADATA] | Context about the session including assistant version, prompt version, and any known configuration flags | {"assistant_version": "v2.3.1", "prompt_version": "goal-aware-v4", "session_id": "sess_9a2b"} | Must be a valid JSON object. assistant_version and prompt_version are required fields. Missing session_id should generate a warning but not block analysis. |
[USER_CORRECTION_SIGNALS] | Pre-identified user utterances that explicitly signal a goal change, used to ground the detection against explicit user intent | ["Actually, I want to...", "Forget that, let's...", "Change of plans..."] | Optional array of strings. If provided, the prompt should cross-reference detected goal changes against these signals. If null, the prompt relies solely on semantic shift detection. |
[OUTPUT_SCHEMA] | The expected JSON schema for the goal-change timeline output, defining required fields and types | {"type": "object", "properties": {"goal_changes": {"type": "array", "items": {"type": "object", "properties": {"turn_index": {"type": "integer"}, "previous_goal": {"type": "string"}, "new_goal": {"type": "string"}, "detected_by_assistant": {"type": "boolean"}, "transition_turns_required": {"type": "integer"}, "smoothness": {"type": "string", "enum": ["immediate", "delayed", "missed"]}}}}}} | Must be a valid JSON Schema object. The prompt must be instructed to strictly conform to this schema. Schema validation should be applied to the model output before downstream consumption. |
Implementation Harness Notes
How to wire the User Goal Change Detection prompt into a production trace review pipeline with validation, retries, and human review gates.
This prompt is designed to operate on a structured trace export, not a raw chat log. Before calling the model, assemble the input by extracting the full turn history from your observability platform, including user utterances, assistant responses, tool calls, and any internal goal state annotations your system records. The prompt expects a chronological turn list with clear speaker labels and metadata. If your traces lack explicit goal state fields, the model will infer intent shifts from language alone, but accuracy improves when you provide the assistant's logged intent or active task label per turn. Wire this prompt as a post-session analysis step, not a real-time interceptor, because it requires the complete session to produce a reliable timeline.
For application integration, wrap the prompt in a function that accepts a session trace object and returns a structured goal-change report. Implement a JSON schema validator on the output to ensure the goal_change_timeline array, detection_assessment, and transition_quality fields are present and correctly typed. If validation fails, retry once with the validation error appended to the prompt as a correction hint. Log every invocation—including the trace ID, model version, raw output, and validation result—to your prompt observability store. This audit trail is essential for diagnosing false positives when the model flags a topic shift that was actually a sub-task or clarification. For high-stakes workflows such as customer escalation analysis or compliance review, route the output to a human reviewer queue before accepting the goal-change timeline as definitive. The reviewer should confirm that flagged transitions represent genuine user goal changes and not the assistant misinterpreting a follow-up question.
Model choice matters here. Use a model with strong instruction-following and long-context handling, such as Claude 3.5 Sonnet or GPT-4o, because the prompt requires reasoning over potentially dozens of turns. Avoid small or local models for sessions exceeding 20 turns unless you implement a sliding window summarization preprocessor. If your trace platform supports it, include retrieval-augmented context such as the assistant's system prompt and tool definitions in the [CONTEXT] placeholder—this helps the model distinguish between a user changing goals and the assistant correctly pivoting due to a tool result. Do not use this prompt for real-time goal detection during active conversations; it is a forensic analysis tool. For live detection, you would need a streaming variant with incremental turn processing and lower latency tolerance.
Expected Output Contract
Fields, types, and validation rules for the goal-change timeline output. Use this contract to build a post-processing validator or schema check before the output enters a dashboard or alerting pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
goal_change_timeline | array of objects | Must be a non-empty array. If no goal change is detected, return an array with a single object indicating no change. | |
goal_change_timeline[].turn_id | integer | Must match a turn index present in the input trace. Non-negative integer. No gaps or fabricated turn IDs allowed. | |
goal_change_timeline[].previous_goal | string or null | If the change occurs at the first turn, set to null. Otherwise, must be a concise label extracted from the user's prior utterances, not invented. | |
goal_change_timeline[].new_goal | string | Must be a concise label directly supported by the user's utterance at the identified turn. Cannot be a generic placeholder like 'other'. | |
goal_change_timeline[].detection_status | enum: detected | missed | delayed | detected: assistant acknowledged change in same turn. missed: assistant continued prior goal. delayed: assistant acknowledged change 1+ turns later. | |
goal_change_timeline[].transition_quality | enum: smooth | abrupt | confused | smooth: assistant adapted naturally. abrupt: assistant switched without acknowledgment. confused: assistant acknowledged change but executed incorrectly. | |
goal_change_timeline[].evidence_utterance | string | Must be a verbatim quote from the user's utterance at the identified turn. Truncation allowed only at sentence boundaries. No paraphrasing. | |
goal_change_timeline[].assistant_response_summary | string | Must summarize the assistant's immediate response to the goal change. If detection_status is missed, describe what the assistant did instead. |
Common Failure Modes
What breaks first when detecting user goal changes over turns and how to guard against it.
False Positive Goal Changes
What to watch: The prompt flags a goal change when the user is only clarifying, adding detail, or correcting a misunderstanding. This inflates the change count and makes the timeline noisy. Guardrail: Require the prompt to distinguish between goal refinement (same objective, more detail) and goal replacement (new objective). Include a change_type field with values like refinement, correction, or replacement, and set a minimum confidence threshold before labeling a turn as a true goal switch.
Missed Implicit Goal Shifts
What to watch: The user changes topic without an explicit transition phrase like 'actually' or 'never mind.' The prompt treats the new request as a continuation of the prior goal, missing the shift entirely. Guardrail: Include few-shot examples of implicit goal changes in the prompt template. Add a secondary check that compares the semantic distance between consecutive user utterances against a threshold. Flag turns where the utterance embedding distance exceeds the typical within-goal variance.
Assistant Detection Lag
What to watch: The prompt correctly identifies the turn where the user changed goals, but the assistant's response didn't acknowledge or adapt to the change until one or more turns later. The timeline shows a gap between user intent shift and assistant behavior shift. Guardrail: Output a detection_lag_turns field measuring the delay between the user's goal-change turn and the first assistant turn that reflects the new goal. Set an alert threshold at lag > 1 turn and include the assistant's transitional utterances for manual review.
Goal State Reversion
What to watch: The assistant correctly switches to the new goal for one turn, then reverts to the previous goal in a subsequent turn without the user requesting it. This produces a flip-flop pattern in the timeline. Guardrail: Track goal state persistence across all turns following a detected change. Flag any turn where the assistant's inferred goal reverts to a prior state without a corresponding user trigger. Include a goal_stability_score that penalizes reversions within a session.
Ambiguous Boundary Turns
What to watch: A single user turn contains elements of both the old and new goal—such as finishing a previous request while introducing a new one. The prompt assigns the turn to only one goal, losing the transition signal. Guardrail: Allow the prompt to label boundary turns as transitional with both goals referenced. Output a goal_overlap flag and include the specific spans of text that map to each goal. This prevents forced binary classification on genuinely mixed turns.
Context Window Truncation Masking Changes
What to watch: Long conversations exceed the context window, and earlier turns are truncated before analysis. Goal changes that occurred in the truncated portion are invisible to the prompt, producing an incomplete timeline. Guardrail: Require the input to include session metadata with total_turns, turns_provided, and truncation_applied fields. If truncation is detected, the prompt must output a coverage_warning and mark the earliest visible turn as potentially not the session start. Pair with a sliding-window analysis for long sessions.
Evaluation Rubric
Use this rubric to evaluate the quality of the User Goal Change Detection Over Turns Prompt output before integrating it into a production monitoring pipeline. Each criterion targets a specific failure mode common in multi-turn trace analysis.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Goal Change Turn Identification | The exact turn index where the user's primary objective shifted is correctly identified. | The output identifies the wrong turn, misses a goal change entirely, or flags a topic shift that is not a goal change. | Compare the identified turn against a manually labeled golden set of 20 multi-turn traces with known goal changes. |
Goal Change Description | The description of the old goal and the new goal accurately reflects the user's stated intent in the relevant turns. | The description hallucinates user intent, uses vague labels like 'changed topic', or fails to capture the specific task switch. | Human review of the [OLD_GOAL] and [NEW_GOAL] fields against the raw user utterances at the identified turn boundary. |
Assistant Detection Flag | The [DETECTED_BY_ASSISTANT] field is | The flag is | Assert the boolean value against a regex check for acknowledgment phrases in the assistant's response at the turn immediately following the goal change. |
Transition Smoothness Score | The [TRANSITION_SCORE] is an integer from 1-5 that correlates with the number of clarification turns required after the goal change. | A score of 5 is given for a transition that required 3+ clarification turns, or a score of 1 is given when the assistant immediately failed to adapt. | Calculate the number of turns between the goal change and the assistant's first on-topic response for the new goal. Validate that a higher turn count results in a lower score. |
Evidence Citation | Every identified goal change includes verbatim user quotes from the [TRACE_DATA] that support the shift in objective. | The output provides a generic summary of the change without direct quotes, or the provided quote does not contain a goal-relevant statement. | Use a substring search to verify that each provided quote in [EVIDENCE] exists exactly within the user utterances of the specified turn in the input trace. |
False Positive Rate on Stable Traces | The prompt returns an empty list or a | The prompt hallucinates a goal change, often by misinterpreting a sub-task or a clarifying question as a full objective shift. | Run the prompt on a curated set of 15 single-goal, multi-turn traces. The pass standard is 0 false positives across the entire set. |
Output Schema Validity | The output is valid JSON that strictly conforms to the [OUTPUT_SCHEMA] with all required fields present. | The output is missing the [GOAL_CHANGES] array, contains a malformed [TURN_INDEX], or includes extra keys not defined in the schema. | Validate the raw model output against the [OUTPUT_SCHEMA] using a JSON Schema validator. The test fails on any validation error. |
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
Add structured output validation, per-turn confidence scoring, and integration with your observability pipeline. Wire the prompt into a trace review system that feeds session exports automatically.
Add to the prompt:
[OUTPUT_SCHEMA]: JSON array with fieldsturn_index,previous_goal,new_goal,detection_evidence,confidence_score[CONFIDENCE_THRESHOLD]: Only report changes above 0.7 confidence- Include a
transition_smoothnessfield:seamless | acknowledged | disruptive | missed
Watch for
- Silent format drift when models return extra fields or omit required ones
- Confidence scores that are consistently overconfident without calibration
- Missing human review for high-stakes sessions where goal misclassification causes downstream errors
- Schema validation rejecting valid edge cases (e.g., multiple goal changes in one 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