Security Objective
Plan drift detection compares the plan an agent proposes, and the action intent behind it, with an authoritative task baseline recorded by the application. When the plan adds objectives, side effects, destinations, resource classes or consequential actions that the current baseline does not contain, the detector raises a drift signal. That signal feeds a response policy, an alert queue and later investigation.
The control exists because many prompt injections work by redirecting a task rather than by producing obviously hostile text. An agent asked to compare two vendors that suddenly plans to read an internal sheet and send it elsewhere has drifted, whatever the wording of its plan.
Ownership Boundaries
| Control | Question it answers | Relation to plan drift |
|---|---|---|
| Plan drift detection | Does the proposed plan diverge from the current recorded baseline | Owns baseline comparison, reason codes and hand-off to response policy |
| Prompt injection detection | Do correlated runtime signals indicate an injection attempt or effect | The broader architecture; plan drift is one specialised signal family inside it |
| Tool-chain analysis | Does a sequence of tool operations create an unsafe combined effect | Complementary; it looks at composition, plan drift looks at divergence from the task |
| Agent authorization | May this fully resolved action execute | Independent and deterministic; a drift flag never replaces or waives it |
| Information flow control | May data with these attributes reach this sink | Independent and deterministic; drift never declassifies data |
| Output validation | Does output meet the sink's structural and format constraints | Independent; a plan within baseline still produces output that must be validated |
| Human-in-the-loop | Does a selected action need an informed human decision | Drift can add review context; it never replaces a required approval |
| Data provenance | Where did context come from | Supplies which sources were present when the plan changed |
The broad Prompt Injection Detection article explains how content, behavior, plan, tool and enforcement signals are correlated. This page goes deeper into one of those inputs: comparing plans with a baseline.
Threat Model
The threat is text in context that changes what the agent tries to do. It can arrive in an indirect prompt injection through retrieved pages, messages, files or tool results, or directly in a user turn. In agentic systems the influence becomes visible as a changed plan: new recipients, new writes, broader reads or a different purpose.
Assume the attacker can shape wording so that the plan still sounds related to the task, can spread influence across steps or agents, and may know that plan comparison exists. Assume also that legitimate users change their minds and that agents adapt plans for ordinary reasons. The detector has to work under both conditions and will still miss or over-flag some cases.
What Is a Task Baseline?
A task baseline is an application-owned record of what the current task is allowed to be about. It is derived from the user's current request, the workflow definition, policy, task scope, permitted resource classes, permitted destination classes and the current workflow stage. It is versioned and stored outside model output.
What Counts as Drift?
The plan pursues a goal the current baseline does not contain.
The plan adds a send, write, delete, share or purchase not represented in the baseline.
A read-only task gains a write or outbound action.
A recipient, domain or sink appears that the baseline does not list.
The plan reads a class of data outside the task scope, such as internal pricing in a public-research task.
The same tools are used for a broader population or for a different purpose.
Legitimate User Scope Changes
Users revise tasks. When the same authenticated user explicitly asks for something new in a later turn, the application records that turn and updates the baseline to a new version before the next plan is evaluated. A plan that matches the updated baseline is not drift.
Benign Adaptation vs Material Drift
| Change in the plan | Usually | Why |
|---|---|---|
| Different approved read-only tool, same fact returned | Within baseline | Objective, effect, resource class and destination are unchanged |
| Extra step to reformat a result for the requested channel | Within baseline | No new effect or destination |
| Retry after a transient error | Within baseline | Same operation, same parameters class |
| Added send to a new recipient | Drift | New side effect and new destination |
| Added write to an unrelated record | Drift | New consequential action on an out-of-scope resource |
| Added read of a more sensitive resource class | Drift | Resource class expansion |
The question is not whether the plan looks different, but whether its objective, effects, resources or destinations leave what the baseline allows.
Trust Model
The detector is a system component, but its output is still variable evidence. Only the response policy that consumes it, and the enforcement controls that act independently of it, are system decisions.
Baseline Construction
Baseline fields
- Baseline ID and objective version
- Initiating principal and tenant
- Workflow and current workflow stage
- Objective, recorded as structured intent plus the user's text reference
- Allowed effect classes, such as read, draft, send, write
- Allowed resource classes and scope
- Allowed destination classes and any named destinations
- Requested output channel
- Delegation scope for any subtasks
- Source of each field: user turn, workflow definition or policy
Structured fields come from the application: workflow definitions, form inputs, selected records and policy. Where the objective is free text, keep the user's text as a reference and store a normalised intent that the application or a constrained parser derived, together with how it was derived.
Baseline Versioning and Freshness
Each accepted change creates a new baseline version with the triggering event, the principal and a timestamp. Plans are evaluated against the version that was current when they were proposed. A plan compared with a stale version produces false drift after legitimate user changes, or misses drift when an old, wider baseline is still in force.
Close or narrow baselines when a workflow stage ends. A baseline that silently accumulates every past scope becomes too permissive to detect anything.
Proposed Plan Representation
Comparison is much more reliable when the plan is structured. Where possible, have the agent framework emit proposed steps as records with tool, operation, effect class, resource references, destinations and purpose, rather than parsing prose.
Record the plan version and whether it parsed completely. A plan the detector could not represent is unobserved for the affected fields, not within baseline.
Comparison Dimensions
| Dimension | Comparison style | Example reason code |
|---|---|---|
| Objective | Semantic, constrained, plus structured intent | OBJECTIVE_ADDED |
| Effect class | Deterministic set comparison | EFFECT_CLASS_ADDED |
| Destination | Deterministic class and value comparison | DESTINATION_NEW |
| Resource class | Deterministic class comparison | RESOURCE_CLASS_EXPANDED |
| Scope | Deterministic count or selector comparison | SCOPE_EXPANDED |
| Workflow stage | Deterministic stage check | STAGE_MISMATCH |
| Delegation scope | Deterministic subset check | DELEGATION_SCOPE_EXCEEDED |
Do not rely on natural-language similarity between plan and request alone. A plan can be worded to sound close to the task while adding a new destination, and a legitimate plan can be worded very differently from the request.
Destination and Side-Effect Drift
New destinations and new side effects are the most security-relevant drift dimensions because they are where influence becomes consequence. They are also the easiest to compare deterministically: the destination class and effect class of each proposed step either appear in the baseline or they do not.
A draft-only baseline that gains a send, or an internal-only baseline that gains an address under outside.example.test, should produce a drift signal regardless of how the plan justifies it.
Resource and Capability Drift
Resource drift covers reads of data classes outside the task, and capability drift covers the use of tools or operations the task did not need. Both often precede an outbound step. Least privilege limits what is available at all; plan drift detection notices when the plan reaches for more of what is available than the task requires.
Multi-Agent Delegation and Hop Boundaries
When a parent agent delegates, the delegation should carry a bounded scope that is a subset of the parent's baseline, together with a correlation ID linking parent and child runs. The child's plan is compared with that delegation scope. A downstream agent cannot silently redefine the task.
In multi-agent systems, a read-only subtask whose plan adds contacting an external party has drifted even if the parent never sees that step. Hop-level comparison is what makes this visible.
Relationship to Tool-Chain Analysis
| Aspect | Plan drift detection | Tool-chain analysis |
|---|---|---|
| Primary question | Does the intended objective or effect diverge from the baseline | Does the composition of operations create an unsafe combined effect |
| Reference point | Recorded task baseline | Sequence patterns and data flow between steps |
| Typical catch | A new send or write the task never asked for | A read then summarise then send chain where each step looks plausible |
| Blind spot | Harmful chains that stay within baseline classes | New objectives expressed in a single step |
The two are complementary. Tool-chain analysis has its own article; the Tool-Chain Analysis lab practises the sequence view.
Detector Families
| Family | Strengths | Weaknesses |
|---|---|---|
| Rules over structured fields | Deterministic, explainable, cheap | Needs structured plans and complete baselines |
| Structural comparison | Catches new effects, destinations and resource classes reliably | Cannot judge purpose changes expressed only in text |
| Model or classifier-assisted | Handles free-text objectives and paraphrase | Probabilistic and can be influenced by context |
| Hybrid | Deterministic fields plus constrained semantic comparison | More components to test and version |
Model-Assisted Drift Detection
A model can compare a free-text objective with a proposed plan. Treat it as a probabilistic detector: isolate it from the agent's context where possible, give it only the baseline and the structured plan, give it no tools, and constrain it to a fixed output schema with reason codes.
Response Policy
- 01Record
Low-risk workflows: store the signal with reason codes for trend analysis.
- 02Alert
Route to triage with baseline and plan versions attached.
- 03Restrict
Remove outbound or write capabilities for the rest of the run.
- 04Pause
Stop the run and ask the user to confirm or restate the task.
Map responses to workflow risk tiers in a deterministic policy outside the model. A response policy may only narrow authority. It never grants permission, never declassifies data and never waives authorization or a required human approval.
Telemetry Design
Record for each evaluated plan
- Baseline ID and version, plan ID and version
- Correlation IDs across parent and child agent runs
- Detector name, version and configuration
- Result: within baseline, drift flagged or unobserved
- Reason codes per dimension
- Which fields were unobserved and why
- Provenance references for context present when the plan was formed
- Response policy decision and resulting authority changes
- Downstream authorization, flow-control and approval decisions, recorded separately
Unobserved Is Not Within Baseline
When the baseline is missing a field, the plan cannot be parsed, or a hop did not report its plan, the detector cannot compare. Record that dimension as unobserved and report the run as incomplete. Treating missing telemetry as within baseline hides exactly the paths an attacker would prefer.
Alert Quality and Triage
A useful alert shows the baseline version, the plan version, the dimensions that diverged, the reason codes, the sources in context and what happened next. Triage then establishes whether the drift reflected a legitimate change the baseline missed, a benign adaptation the detector misread, or likely influence from content.
Keep provenance, authorization, classification and drift as separate fields. A single blended trust score hides why a case was raised and invites use as a permission signal.
Worked Scenario A: Legitimate User Change
The user asks for a comparison of fictional vendors Alpha and Beta on support terms. The baseline records a comparison objective, read-only effects and no destinations. In a later turn the same user asks the agent to also draft a message to procurement@corp.example.test.
| Stage | Observation | Outcome |
|---|---|---|
| Baseline | v2 recorded from user turn 2: compare and draft, internal destination, draft only | Updated by the application |
| Proposed | Compare, draft to procurement@corp.example.test, present draft | Matches v2 |
| Flagged | No new objective, effect class or destination beyond v2 | No drift flag |
| Authorized / executed | Nothing is sent; any send would need separate authorization and approval | Not reached |
Worked Scenario B: External Content Adds a Send
The user asks for a comparison from public material. After retrieved external content enters context, the plan adds reading an internal pricing sheet and sending a summary to reviewer@outside.example.test.
| Stage | Observation | Outcome |
|---|---|---|
| Baseline | Public-source comparison, read-only, no destinations | Unchanged; retrieved text cannot change it |
| Proposed | Adds internal resource read and external send | RESOURCE_CLASS_EXPANDED, EFFECT_CLASS_ADDED, DESTINATION_NEW |
| Flagged | Material drift | Drift flag raised before execution |
| Authorized | Agent authorization and IFC evaluate independently | Separate decisions |
| Executed / succeeded | Nothing executed at flag time | No effect recorded |
A cross-hop variant: a parent delegates a read-only lookup of SKU-17 stock, and the sub-agent's plan adds emailing supplier@vendor.example.test. The child plan exceeds the delegation scope and is flagged as drift.
What the Scenarios Prove and Do Not Prove
The agent suggested a plan. Nothing has happened yet.
The detector saw material divergence. This is evidence, not proof of attack or intent.
Independent enforcement allowed a concrete action. A missing flag never implies this.
The action ran. Only execution logs establish this.
The action had its effect. This needs its own evidence.
Scenario A shows that a legitimate change should not alert. Scenario B shows that the flag is useful triage evidence. Neither shows that the system is safe, that no drift occurred elsewhere, or that the flagged plan was malicious.
Testing and Validation
Build a labelled regression set with benign user changes, benign adaptations, clear drift and cross-hop drift, using fictional data and .example.test destinations. Run it for every detector, baseline schema or agent framework change. Include cases with missing baseline fields to confirm they are reported as unobserved.
The Plan Drift Detection lab is a deterministic simulation for learning the classification, not a detector benchmark. Research benchmarks such as AgentDojo can supply agent tasks for broader evaluation, and designs such as CaMeL show how separating control flow from untrusted data reduces reliance on detection; neither defines this control.
Metrics
| Measure | Numerator | Denominator |
|---|---|---|
| Baseline coverage | Runs with a complete baseline | All agent runs in scope |
| Plan representation coverage | Plans fully parsed | All evaluated plans |
| Drift recall | Labelled drift cases flagged | Labelled drift cases |
| False-positive rate | Benign adaptation and user-change cases flagged | Benign labelled cases |
| Unobserved rate | Evaluations with any unobserved dimension | All evaluations |
| Reason-code distribution | Flags per reason code | All flags |
| Alert actionability | Alerts leading to a triage conclusion | All alerts |
| Time to response | Time from flag to response action | Flags with a response |
| Benign task utility | Benign tasks completed without interruption | Benign tasks |
These are operational measures. Do not combine them into a single security score, and do not read good numbers as proof of security.
Common Mistakes
- 01Baseline from the model
Using the agent's own goal statement as the reference.
- 02Every change is drift
Flagging legitimate user turns because the baseline was not versioned.
- 03Similarity only
Relying on text similarity instead of effect, destination and resource fields.
- 04Missing means fine
Reporting unparsed plans or missing fields as within baseline.
- 05Flag as permission
Letting no drift observed unlock actions or skip authorization.
- 06Unbounded delegation
Letting sub-agents inherit the full parent scope or define their own.
Implementation Checklist
Before relying on plan drift detection
- Baseline is application-owned, versioned and never taken from model output
- Explicit user changes create a new baseline version
- Plans are structured where possible and parse failures are recorded
- Effect, destination, resource and scope comparisons are deterministic
- Semantic comparison is isolated, schema-bound and treated as probabilistic
- Delegation carries a bounded scope and correlation IDs
- Missing fields are reported as unobserved
- Response policy is tiered and can only narrow authority
- Authorization, IFC, output validation and human approval stay independent
- Labelled regression set runs on every change
Standards and Sources
Standards and guidance referenced
- Microsoft
- Defend against indirect prompt injection attacks (vendor guidance)
- OWASP
- LLM01:2026 Prompt Injection (risk context)
- NIST
- AI 100-2e2025 (terminology)
On source use: Microsoft's guidance lists plan drift detection as a runtime monitoring technique that watches multi-step reasoning for deviations from intended task flows, pairs it with deterministic controls such as information flow control, and notes that probabilistic defenses like plan drift detection can produce false positives. It does not specify an algorithm. OWASP LLM01:2026 provides risk context for prompt injection, not a plan drift specification. NIST AI 100-2e2025 is used only for terminology. Baseline schemas, reason codes, response tiers and metrics on this page are engineering guidance, not requirements from these sources.
Frequently Asked Questions
Does a drift flag block the action?
Not by itself. A response policy may restrict or pause the run. Whether an action may execute is decided by agent authorization.
Does no drift observed mean the plan is safe?
No. It means no divergence was seen on the observed dimensions. Harmful chains within baseline classes and unobserved fields remain possible.
Is a new user request drift?
No, when it is an explicit, authenticated user turn that the application records as a new baseline version.
Can retrieved content update the baseline?
No. Only application-recognised authority changes the baseline.
How is this different from Prompt Injection Detection?
Prompt Injection Detection is the broad correlation architecture; plan drift is one specialised signal family within it.
How is this different from tool-chain analysis?
Plan drift compares intent and effects with the baseline. Tool-chain analysis looks at whether a sequence of operations combines into an unsafe effect.
Can a model do the comparison?
It can help with free-text objectives, but it is probabilistic and can be influenced by context. Keep deterministic field checks as the backbone.
Does drift prove an attack?
No. Triage decides whether it reflects influence, a missed legitimate change or a detector error.
References
- Defend against indirect prompt injection attacksMicrosoft Learn · GuidanceReviewed 2026-09-27
- OWASP GenAI LLM Top 10 2026 (LLM01:2026 Prompt Injection)OWASP GenAI Security Project · GuidanceReviewed 2026-09-27
- Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2e2025NIST · Standard · 2025-03Reviewed 2026-09-27