A developer monitoring a long-running refactoring agent notices that after 6 hours, the agent begins applying a different variable naming convention than it used in the first 2 hours — despite no change in the task instructions. Which mechanism would most effectively detect and correct this drift before it affects more repositories?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Drift in a long agent run is like a ship slowly going off course — a good navigator doesn't wait until landfall to check the compass. You need active drift detection built into the checkpointing loop: compare what the agent is doing now against what it decided to do at the start, and correct course the moment the deviation registers.
Full explanation below image
Full Explanation
Execution drift is a well-documented failure mode in long-running agentic systems. As accumulated context grows and evolves, the model's implicit 'working state' can gradually shift away from initial decisions — even without explicit instruction changes. The naming convention example in this question is a classic manifestation: the agent 'forgets' or deprioritizes an early commitment as the context window fills with newer content.
Why B is correct: Embedding a drift-detection check at each checkpoint is the correct architectural response. The mechanism works as follows: 1. When the agent makes a key decision early in the run (e.g., 'use camelCase for all variable names'), that decision is written to the checkpoint artifact. 2. At each subsequent checkpoint, the agent's current behavior (or explicitly stated current convention) is compared against the recorded decision. 3. If a deviation is detected, the system can automatically correct the agent's context (by reinjecting the original decision as an explicit instruction), halt for human review, or emit an alert. This provides active, ongoing drift detection rather than relying on retrospective discovery.
Why A is wrong: Restarting every 2 hours clears accumulated context, which does reduce some drift risk — but it also discards legitimate accumulated state and decisions, forces re-loading of checkpoints each time, and doesn't detect drift that occurs within a 2-hour window. It's a blunt instrument and costly.
Why C is wrong: Temperature affects output randomness. Lower temperature increases determinism within a single response but has no effect on the semantic drift caused by a changing context over multiple calls. Setting temperature to zero would not prevent convention drift across a multi-hour, multi-call run.
Why D is wrong: More detailed instructions help prevent drift at the start, but they don't provide a detection or correction mechanism once drift has occurred mid-run. Instructions in the system prompt are static; they don't adapt to the evolving context or signal when the agent has begun deviating from them.