# Goal Drift

Shifts over a long trajectory from the objective it was given to a different one (a subgoal pursued as if it were the task, a side task, or a goal suggested by material met along the way) and pursues that competently, with no instruction to change.

Unlike Goal Misinterpretation, the goal was understood correctly at the start. Unlike Context Rot, which is a cause, this names the outcome: the agent is now working toward something else. Unlike Indirect Prompt Injection, no adversary or embedded instruction is needed; ordinary material met along the way is enough.

## Metadata
- ID: `goal-drift`
- Status: published
- Taxonomy-Version: 0.1.0
- Last-Modified: 2026-11-18T22:00:00-05:00
- Category: Agency (`agency`)
- HTML: https://failmodes.com/failure-modes/goal-drift
- JSON: https://failmodes.com/failure-modes/goal-drift.json
- Markdown: https://failmodes.com/failure-modes/goal-drift.md

## Search Phrases
- wandered off the original task
- started working on something else
- lost sight of the original goal
- got sidetracked by something it found

## Why It Happens
1. The objective is stated once and then competes with everything after it. An agent's goal usually lives in the first turn or the system prompt, while the next action is chosen from a growing body of recent tool output, documents, and its own work. In evaluations that give agents a goal in the system prompt and then expose them to competing objectives through the environment, every model tested drifted to some degree, and drift tracked a growing susceptibility to pattern-matching as context lengthened; the best scaffolded model held its goal almost perfectly past 100,000 tokens (Arike et al., 2025, "Technical Report: Evaluating Goal Drift in Language Model Agents").
2. Drift is inherited from the trajectory in context. Models that held their goal when run on their own often took on a weaker agent's drift once conditioned on its prefilled trajectory, the effect varied widely by model family, and resistance correlated poorly with how well a model followed instruction hierarchies (Menon et al., 2026, "Inherited Goal Drift: Contextual Pressure Can Undermine Agentic Goals"). A resumed session, a compaction summary, or a handoff that carries another run's history carries its direction too. The evidence is from simulated environments.
3. Material met along the way can supply a goal without instructing anything. Coding agents given a system-prompt objective on one side of a value trade-off abandoned it more readily when material in the codebase pressed toward a value the model holds strongly, such as security or privacy, and the effect compounded with accumulated context (Saebo et al., 2026, "Asymmetric Goal Drift in Coding Agents Under Value Conflict"). The result, from a workshop paper on three smaller models, shows that ordinary content, not an injected command, is enough to redirect the work.
4. Locally reasonable subgoals take over the task. Each step is chosen against the immediate situation, so a blocker, a bug noticed in passing, or a promising lead acquires its own momentum, and nothing in the loop compares the current work with the original objective. In annotated multi-agent traces, task derailment (deviation from the intended objective into irrelevant or unproductive actions) accounted for 7.4% of failures (Cemri et al., 2025, "Why Do Multi-Agent LLM Systems Fail?").

## Examples

### Side task becomes the task
- Kind: fail
- Summary: Turns a slow query noticed while building an export feature into an indexing project. The work is good, and none of it is the export.

```text
User: Add CSV export to the orders page.
[… agent notices the orders query takes 4s, profiles it, adds three indexes, rewrites the pagination, benchmarks …]
Assistant: The orders page now loads 6x faster. I added composite indexes and switched to keyset pagination. Benchmarks below.
[… no export endpoint or button exists …]
```

### Source material sets the agenda
- Kind: fail
- Summary: Delivers a security assessment for a cost comparison because the documents it read are written around security, although nothing in them tells the agent what to do.

```text
User: Compare these three vendors on total cost over three years.
[… agent reads 40 pages of vendor whitepapers, most of them about compliance certifications and breach history …]
Assistant: Vendor B is the strongest choice — it holds the most certifications and has no disclosed breaches. Detailed security comparison attached.
```

### Drift noticed and justified
- Kind: warn
- Summary: Sees that it has moved off the task and says so, but treats the new direction as the better use of the run instead of handing the choice back. If the new work were a cheaper proxy for the same goal, it would be Objective Gaming; here it is a different goal.

```text
User: Add CSV export to the orders page.
Assistant: I ended up spending most of this run on the orders query, since 4-second loads seemed more urgent than export. Export is about half done.
```

### Side issue parked, goal held
- Kind: ok
- Summary: Notices the slow query, records it, and returns to what was asked, offering the finding as a follow-up instead of acting on it.

```text
User: Add CSV export to the orders page.
Assistant: CSV export is in — button on the orders page, streaming endpoint, tests for empty and 50k-row exports. Separate from this, the orders query takes about 4s; I've noted the profile output in the PR in case you want a follow-up.
```

## Detection Approaches
- **LLM-as-judge evaluation**: At intervals in a long run, give an LLM judge the original request and the most recent window of work and ask one question: which objective is this work serving? Judge the final deliverable the same way, against the request rather than against the agent's own summary, which describes the work it did.
- **Goal adherence tracking**: Have the agent restate its current objective at fixed checkpoints and diff each restatement against the original, flagging when the stated goal changes without a user turn that changed it. Track the share of recent tool calls that touch files, sources, or systems the request implies; a run that has spent its last hour elsewhere shows up in the log before it shows up in the result.
- **Golden-set evals**: Build long tasks with planted attractions (an appealing side bug, documents that frame the problem differently, a goal-suggesting environment) and score goal adherence by depth into the run. Include variants that start from a prefilled trajectory or a resumed session, since drift is inherited from context.

## Mitigation Approaches
- **Context pinning**: Keep the original objective and success condition in a pinned block near the active end of context, re-injected verbatim after every compaction and at the start of every resumed session or subagent brief. A goal stated once at the top loses to everything added since.
- **Explicit state tracking**: Maintain a task ledger with the objective at the top and require each subtask to name the part of the objective it serves. Work that serves none of it goes to a follow-up list for the user instead of into the run.
- **Self-check pass**: Before handing back, and at each major checkpoint, have the model compare what it has produced against the original request and say what is still missing. Prompting alone does not reliably fix drift, since resistance to drift has correlated poorly with how well a model follows instruction hierarchies, so start subagents and new sessions from a clean brief rather than from another run's trajectory.

## Related Modes
- **Goal Misinterpretation** (`goal-misinterpretation`)
  HTML: https://failmodes.com/failure-modes/goal-misinterpretation
  JSON: https://failmodes.com/failure-modes/goal-misinterpretation.json
- **Context Rot** (`context-rot`)
  HTML: https://failmodes.com/failure-modes/context-rot
  JSON: https://failmodes.com/failure-modes/context-rot.json
- **Objective Gaming** (`objective-gaming`)
  HTML: https://failmodes.com/failure-modes/objective-gaming
  JSON: https://failmodes.com/failure-modes/objective-gaming.json
- **Workflow Misalignment** (`workflow-misalignment`)
  HTML: https://failmodes.com/failure-modes/workflow-misalignment
  JSON: https://failmodes.com/failure-modes/workflow-misalignment.json
- **Indirect Prompt Injection** (`indirect-prompt-injection`)
  HTML: https://failmodes.com/failure-modes/indirect-prompt-injection
  JSON: https://failmodes.com/failure-modes/indirect-prompt-injection.json