This prompt is designed for agent platform engineers and QA leads who need to verify that a change to a system prompt, task decomposition prompt, or multi-step agent instruction set has not silently degraded the model's ability to follow complex procedures. The core job-to-be-done is automated regression testing of instruction adherence. You should use this prompt when you have a multi-step task (e.g., 'research a company, then write a brief, then format it as a memo') and a golden dataset of inputs paired with expected step-by-step compliance audits. The ideal user is someone integrating this check into a CI/CD release gate for an agent or copilot product.
Prompt
Instruction Following Drift Detection Prompt for Multi-Step Tasks

When to Use This Prompt
Define the job, reader, and constraints for the Instruction Following Drift Detection Prompt.
This prompt is not a replacement for end-to-end integration tests or human evaluation of output quality. It specifically checks for structural compliance: omitted steps, ordering errors, and constraint violations. Do not use this prompt to judge the factual accuracy, tone, or helpfulness of the final output; pair it with separate semantic drift or factual consistency prompts for those dimensions. It is also not suitable for single-turn, non-procedural tasks where there is no explicit step sequence to audit. The prompt requires a detailed, pre-defined specification of the expected steps and constraints to function correctly.
Before deploying this prompt in a regression suite, you must have a stable, version-controlled specification of the multi-step task, a set of diverse test inputs, and a baseline compliance audit to compare against. The prompt works by decomposing the task into sub-tasks and scoring each independently, so the quality of your decomposition schema directly determines the reliability of the drift detection. Use this prompt as a gate that blocks promotion if the compliance score drops below a pre-defined threshold, and always log the per-step scores for root-cause analysis when a regression is flagged.
Use Case Fit
Where the Instruction Following Drift Detection Prompt delivers reliable value and where it introduces unacceptable risk. Use these cards to decide if this prompt fits your multi-step agent evaluation workflow.
Good Fit: Structured Multi-Step Agent Pipelines
Use when: your agent executes a known sequence of discrete steps (e.g., research → draft → cite → format). The prompt excels at auditing step completeness, ordering, and constraint adherence. Guardrail: define the expected step list explicitly in the [EXPECTED_STEPS] input; do not rely on the model to infer the correct sequence.
Bad Fit: Open-Ended Creative or Conversational Tasks
Avoid when: the task has no fixed step order or success criteria are subjective (e.g., brainstorming, chitchat, stylistic rewriting). The decomposition harness will produce noisy, low-signal compliance scores. Guardrail: use a semantic drift or tone comparison prompt instead; reserve this prompt for tasks with verifiable procedural contracts.
Required Inputs: Step Definitions and Reference Trace
Risk: without a clear [EXPECTED_STEPS] schema and a [REFERENCE_OUTPUT] from the baseline prompt, the audit produces unreliable or ungrounded scores. Guardrail: always pair the new output with a golden trace or baseline output. Provide steps as a structured list with optional sub-step IDs and mandatory constraints per step.
Operational Risk: False Confidence in Partial Compliance
Risk: the prompt may assign high aggregate scores when critical steps are missing but many minor steps pass. This masks dangerous regressions. Guardrail: configure the harness to fail the entire evaluation if any [CRITICAL_STEP] is omitted or violated, regardless of overall score. Weight critical steps separately in your release gate.
Operational Risk: Prompt Change Alters Step Interpretation
Risk: a prompt update may change how the model interprets a step's intent, causing the audit to pass while behavior drifts in production. Guardrail: run the audit bidirectionally—compare new outputs against old expectations and old outputs against new expectations. Flag asymmetric compliance as a semantic drift warning.
Scale Limit: High Token Cost for Long Agent Traces
Risk: auditing multi-step agent traces with long outputs can consume significant context window and token budget, especially in CI/CD loops. Guardrail: truncate outputs to relevant sections per step before auditing. Use a pre-filter to extract only the portions of the trace that correspond to each expected step, reducing audit cost.
Copy-Ready Prompt Template
A reusable prompt that audits multi-step task execution for instruction drift, omitted steps, ordering errors, and constraint violations.
This prompt template is designed to be dropped into an agent evaluation harness or a CI/CD regression gate. It takes a multi-step task description, the agent's execution trace, and a set of expected constraints, then produces a structured compliance audit. The audit scores each sub-task independently, flags ordering violations, and identifies omitted or hallucinated steps. Use this when you need to verify that a prompt change hasn't degraded an agent's ability to follow complex instructions across multiple turns or tool calls.
textYou are an instruction-following compliance auditor. Your job is to compare an agent's execution trace against a reference multi-step task specification and produce a structured audit report. ## INPUTS ### TASK_SPECIFICATION [ORIGINAL_TASK_DESCRIPTION] ### EXPECTED_STEPS [EXPECTED_STEPS_LIST] ### EXECUTION_TRACE [AGENT_EXECUTION_TRACE] ### CONSTRAINTS [CONSTRAINTS_LIST] ### OUTPUT_SCHEMA { "audit_id": "string", "overall_compliance_score": 0.0-1.0, "step_audits": [ { "step_id": "string", "step_description": "string", "status": "completed | omitted | partial | hallucinated | wrong_order", "evidence": "string (quote from trace)", "score": 0.0-1.0, "issues": ["string"] } ], "ordering_violations": [ { "expected_order": ["step_id"], "actual_order": ["step_id"], "severity": "critical | major | minor" } ], "constraint_violations": [ { "constraint": "string", "violation": "string", "evidence": "string", "severity": "critical | major | minor" } ], "omitted_steps": ["step_id"], "hallucinated_steps": [ { "description": "string", "evidence": "string" } ], "summary": "string (2-3 sentence assessment)" } ## INSTRUCTIONS 1. Parse the TASK_SPECIFICATION and EXPECTED_STEPS to understand the reference behavior. 2. Analyze the EXECUTION_TRACE step by step. Match each trace action to an expected step where possible. 3. For each expected step, determine status: - completed: step was executed correctly and in the right order - omitted: step was not found in the trace - partial: step was started but not completed - hallucinated: trace contains a step not in the expected list - wrong_order: step was executed but at the wrong position 4. Check all CONSTRAINTS against the trace. Flag any violation with evidence and severity. 5. Detect ordering violations by comparing expected step sequence to actual execution sequence. 6. Score each step 0.0-1.0 based on completeness and correctness. Overall score is the mean of step scores minus penalty for ordering and constraint violations. 7. Output ONLY valid JSON matching the OUTPUT_SCHEMA. No markdown, no commentary outside the JSON. ## SEVERITY GUIDELINES - critical: step omission or violation that makes the task outcome invalid or unsafe - major: significant deviation that degrades quality but doesn't invalidate the result - minor: cosmetic or non-material deviation
Adapt this template by replacing the square-bracket placeholders with your actual data. The [ORIGINAL_TASK_DESCRIPTION] should contain the full prompt or instruction set given to the agent. [EXPECTED_STEPS_LIST] should be a numbered or bulleted list of the sub-tasks you expect the agent to perform, in the correct order. [AGENT_EXECUTION_TRACE] should include the full conversation, tool calls, and outputs. [CONSTRAINTS_LIST] should enumerate any rules the agent must follow, such as 'never expose PII', 'always cite sources', or 'confirm before deleting'. For high-risk workflows like healthcare or finance, always route outputs scoring below 0.85 to human review before accepting the audit result.
Before wiring this into production, validate that your [EXPECTED_STEPS_LIST] is exhaustive and that your trace format is parseable. A common failure mode is providing traces that are truncated or missing intermediate tool calls, which causes false omission flags. Test this prompt against a golden dataset of known compliant and non-compliant traces to calibrate your pass/fail threshold. If you're using this in a CI/CD pipeline, pair it with a JSON Schema validator that confirms the output structure before the audit scores are used as a release gate.
Prompt Variables
Required inputs for the Instruction Following Drift Detection Prompt. Each variable must be populated before the prompt is executed to ensure reliable multi-step compliance auditing.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ORIGINAL_INSTRUCTIONS] | The baseline multi-step task instructions the model was originally expected to follow |
| Must contain numbered or bulleted steps. Parse check: count delimiters to confirm multi-step structure. Null not allowed. |
[ORIGINAL_OUTPUT] | The output produced by the baseline prompt version for the given input | {"dates": ["2024-01-15", "2024-03-22"], "ambiguous": []} | Must be a non-empty string. Schema check: if output contract is JSON, validate against expected schema before comparison. Null not allowed. |
[NEW_OUTPUT] | The output produced by the new prompt version for the same input | {"dates": ["2024-01-15", "2024-03-22", null], "ambiguous": ["Q2 2024"]} | Must be a non-empty string. Schema check: validate structure matches [ORIGINAL_OUTPUT] type. Null allowed only if new prompt legitimately produces no output. |
[TASK_INPUT] | The original user input or context that both prompt versions processed | Review the following contract and extract all dates mentioned: "The agreement was signed on January 15, 2024. Renewal is due in Q2 2024." | Must be a non-empty string. Should be identical for both runs. Null not allowed. |
[STEP_DEFINITIONS] | Explicit list of sub-tasks decomposed from [ORIGINAL_INSTRUCTIONS] for per-step scoring | Step 1: Date extraction. Step 2: ISO 8601 normalization. Step 3: Chronological sort. Step 4: Ambiguity flagging. | Must contain at least 2 discrete steps. Parse check: each step must be separable by delimiter. If [ORIGINAL_INSTRUCTIONS] has only 1 step, this prompt is not applicable. |
[CONSTRAINT_LIST] | Explicit constraints the model must obey beyond step ordering | Do not invent dates. Use null for unparseable values. Preserve original timezone offsets. | Must be a non-empty string. Can be empty array if no constraints exist. Parse check: each constraint should be a distinct rule. Null allowed if no constraints defined. |
[COMPARISON_CONTEXT] | Optional metadata about the prompt versions being compared for traceability | Baseline: prompt-v2.3. New: prompt-v2.4-rc1. Model: claude-sonnet-4-20250514. | Must include version identifiers if used in CI/CD pipeline. Null allowed for ad-hoc comparisons. Approval required if this feeds a release gate decision. |
Implementation Harness Notes
How to wire the instruction-following drift detection prompt into an automated regression pipeline with validation, scoring, and release gates.
This prompt is designed to operate as a batch evaluation step inside a CI/CD pipeline or a scheduled regression job, not as a one-off manual check. The harness calls the prompt once per test case in your golden dataset, passing the original multi-step instruction, the expected task decomposition, and the actual output from the new prompt version. Each invocation returns a structured JSON audit with per-step compliance scores, ordering checks, and constraint violation flags. The harness aggregates these results across all test cases to produce a pass/fail decision for the release gate.
Wiring the prompt into your application requires three components: a golden dataset of multi-step tasks with human-verified decompositions, a model invocation layer that sends the prompt template with the correct variable substitutions, and a post-processing validator. For each test case, populate [ORIGINAL_INSTRUCTION] with the user-facing task, [EXPECTED_STEPS] with the reference decomposition (ordered list of sub-tasks with constraints), and [ACTUAL_OUTPUT] with the new prompt version's response. The model returns a JSON object with fields like step_compliance_scores, ordering_errors, omitted_steps, and constraint_violations. Use a JSON Schema validator to confirm the output structure before parsing scores. If the model returns malformed JSON, retry once with a stricter output format instruction appended to the prompt—beyond that, flag the test case as unevaluable and escalate for manual review.
Scoring and gating should happen at the aggregate level. Define a minimum per-step compliance threshold (e.g., 0.85 on a 0–1 scale) and a maximum allowed count of ordering errors and omitted steps across the full test suite. For high-risk agent workflows where instruction drift could cause downstream tool misuse, set stricter thresholds and require zero constraint violations on safety-critical steps. Log every evaluation result—including raw model outputs, parsed scores, and any validator rejections—to your observability platform so you can trace regressions to specific prompt changes. If the aggregate scores fall below threshold, block the release and surface the worst-performing test cases for prompt engineers to debug. For low-risk informational tasks, you may allow a small amount of drift with a warning rather than a hard block, but always track the trend over time to catch gradual degradation.
Expected Output Contract
Defines the exact fields, types, and validation rules for the compliance audit output produced by the Instruction Following Drift Detection Prompt. Use this contract to build downstream parsers, dashboards, or automated release gates.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
audit_id | string (UUID v4) | Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ | |
task_id | string | Must match the [TASK_ID] provided in the prompt input | |
prompt_version | string (semver) | Must match regex ^\d+.\d+.\d+$ and correspond to the [PROMPT_VERSION] input | |
overall_compliance_score | number (float 0.0-1.0) | Must be between 0.0 and 1.0 inclusive; calculated as (total_steps - violations) / total_steps | |
total_steps_expected | integer | Must be >= 1 and equal to the length of the step_results array | |
step_results | array of objects | Must be a non-empty array; each element must conform to the step_result schema defined in the next row | |
step_results[].step_number | integer | Must be a sequential integer starting from 1 with no gaps or duplicates | |
step_results[].step_description | string | Must be a non-empty string summarizing the expected sub-task for this step | |
step_results[].compliance_status | string (enum) | Must be one of: 'FULLY_COMPLIANT', 'PARTIALLY_COMPLIANT', 'NON_COMPLIANT', 'NOT_ATTEMPTED' | |
step_results[].violations | array of strings | Must be an array; empty if compliance_status is 'FULLY_COMPLIANT'; each string must describe a specific, observable violation | |
step_results[].evidence | string or null | Must be a direct quote from the [OUTPUT_TO_AUDIT] if compliance_status is not 'NOT_ATTEMPTED'; otherwise null | |
constraint_violations | array of objects | Must be an array; empty if no global constraints were violated | |
constraint_violations[].constraint | string | Must be a non-empty string referencing a specific constraint from the [CONSTRAINTS] input | |
constraint_violations[].violation_detail | string | Must be a non-empty string describing how the constraint was broken | |
ordering_errors | array of objects | Must be an array; empty if no ordering errors detected | |
ordering_errors[].expected_order | string | Must describe the expected sequence using step numbers, e.g., 'Step 2 must follow Step 1' | |
ordering_errors[].actual_order | string | Must describe the observed sequence from the [OUTPUT_TO_AUDIT] | |
omitted_steps | array of integers | Must be an array of step numbers that were entirely missing from the output; empty if none | |
audit_timestamp | string (ISO 8601) | Must be a valid UTC timestamp in the format YYYY-MM-DDTHH:MM:SSZ | |
model_signature | string | Must be the model identifier used for the audit if available, e.g., 'gpt-4o-2024-08-06'; null if not provided |
Common Failure Modes
Instruction following drift in multi-step tasks often breaks in predictable ways. These failure modes surface when prompt changes cause the model to skip steps, reorder operations, or violate constraints that were previously respected. Each card identifies a specific failure pattern and the guardrail that catches it before production.
Step Omission Drift
What to watch: After a prompt change, the model silently drops one or more required steps from a multi-step procedure. This is the most common regression because new instructions can accidentally deprioritize earlier steps. Guardrail: Decompose the task into a numbered checklist and use an LLM judge to verify each step appears in the output trace. Flag any run where a required step index is missing from the compliance audit.
Step Ordering Reversal
What to watch: The model still executes all steps but reorders them in ways that break downstream dependencies. This happens when prompt rewrites change emphasis or when few-shot examples introduce a new implicit sequence. Guardrail: Define a canonical step order in your golden dataset and compare the actual execution sequence using a pairwise ordering check. Fail the test if any dependency pair is inverted.
Constraint Leakage
What to watch: Hard constraints such as word limits, format requirements, or forbidden operations degrade after prompt modifications. The model may partially comply or ignore constraints when new instructions compete for attention. Guardrail: Extract each constraint as a separate binary assertion in your validation harness. Run constraint-specific checks independently rather than relying on a single overall score, so you know exactly which constraint broke.
Premature Completion
What to watch: The model stops early and declares the task done before all sub-tasks are finished. This often occurs when the prompt accidentally signals that partial output is acceptable or when the model hallucinates completion. Guardrail: Require an explicit end-of-task marker or final summary that references every completed sub-task. Validate that the number of completed steps matches the expected count before accepting the output.
Instruction Conflict Drift
What to watch: A new instruction unintentionally contradicts an existing one, causing the model to oscillate between behaviors or silently choose one over the other. This is common when multiple team members edit prompts without full context. Guardrail: Run a dedicated conflict detection prompt that compares all instructions pairwise and flags contradictions. Include this as a pre-release gate before any prompt reaches staging.
Context Window Truncation
What to watch: Longer prompts or additional few-shot examples push critical instructions out of the model's effective attention window, causing later steps to be ignored. The prompt looks correct but the model never reliably sees the final instructions. Guardrail: Place the most critical constraints at both the beginning and end of the system prompt. Test with maximum-length inputs and verify that tail-end instructions are still followed using a dedicated end-of-prompt compliance check.
Evaluation Rubric
Criteria for testing whether the instruction-following drift detection prompt reliably catches multi-step task degradation before shipping.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Step Omission Detection | Prompt flags every missing step from the reference decomposition with step ID and description | Any omitted step in a known degraded output is not reported or is reported with incorrect step ID | Run against 10 golden cases where 1-3 steps are deliberately removed; require 100% recall on omissions |
Step Ordering Accuracy | Prompt correctly identifies all out-of-order steps and reports the expected sequence position | Reordered steps are marked as correct or ordering errors are attributed to wrong step indices | Test with 10 cases containing known sequence swaps; require exact index match for each ordering violation |
Constraint Violation Flagging | Prompt detects every injected constraint violation (format, boundary, prohibition) and cites the violated constraint | A constraint violation present in the output is not mentioned in the audit report | Use 15 cases with 2-4 seeded constraint violations each; require precision >= 0.95 and recall >= 0.95 |
Sub-Task Independence Scoring | Each sub-task receives a distinct compliance score; scores correlate with ground-truth degradation severity | All sub-tasks receive identical scores when degradation is isolated to one step, or scores invert severity order | Compare score distribution against human-annotated severity labels; require Spearman correlation >= 0.85 |
False Positive Rate on Clean Outputs | Prompt returns all sub-tasks as compliant with no violations when given a fully correct multi-step output | Clean outputs trigger any violation flag, omission warning, or ordering error | Run against 20 known-correct outputs; require zero false positives across all sub-task checks |
Decomposition Harness Stability | The decomposition step produces the same sub-task list and step IDs for identical inputs across 5 repeated runs | Sub-task count, step IDs, or ordering changes between runs on the same input | Execute 5 runs on 10 fixed inputs; require exact match on step count and step ID set across all runs |
Aggregate Drift Severity Classification | Overall drift severity label matches ground-truth tier: none, minor, moderate, critical | Critical degradation is labeled minor, or clean outputs are labeled moderate or above | Test against 30 labeled cases spanning all severity tiers; require exact tier match on >= 90% of cases |
Output Schema Compliance | Audit report strictly follows the specified JSON schema with all required fields present and correctly typed | Missing required fields, type mismatches, or extra fields that break downstream parsing | Validate output against JSON Schema; require 100% structural compliance across all test cases |
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 small set of 5-10 multi-step tasks. Run the decomposition harness manually and review the per-step compliance scores. Use a lightweight LLM judge with a simple 0/1 pass-fail for each sub-task. Store results in a CSV for manual comparison.
Watch for
- Overly broad step definitions that make scoring ambiguous
- Missing ordering checks when steps are sequential
- No baseline scores to compare against

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