Managing Context Drift in AGENTS.md and Skill Files

    Conflicting rules in AGENTS.md, skill files, and project documentation can lead AI coding agents to produce confident answers without revealing disagreements between sources. This article explains how context drift differs from context rot, why ordinary collaboration creates it, and how a single source of truth, explicit conflict detection, disclosure requirements, and document archiving can help control it.

    1. Start with a Conflicting Refund Policy

    Imagine a team’s knowledge base contains a customer-facing policy stating that customers can request a refund within 14 days, while an internal operations manual specifies a 30-day refund window.

    A developer asks a coding agent to answer a customer inquiry using the project documentation. The model quickly returns a number, expressed fluently and confidently. As the reviewer, can you tell from that answer alone whether the model also encountered a contradictory policy?

    Usually, you cannot. This illustrates an underestimated risk in agent engineering: persistent documentation sources falling out of sync, a problem often described as context drift.

    Developer-run comparisons across several mainstream coding agents have examined tasks in which task-specific instructions conflict with project-wide rules. In those tests, models followed the task-specific instructions in the overwhelming majority of cases. Across more than 100 runs that did not explicitly require conflict reporting, the models never volunteered that the documents disagreed.

    Teams deploying agents in real projects should take this pattern seriously.

    2. Context Drift Is Not Context Rot

    Developers who use AI coding assistants for extended periods often recognize the moment when it is time to start a new conversation. As a session grows, earlier proposals—including approaches that were later rejected—remain in the history. The model may repeatedly return to those dead ends.

    Compressing the conversation, removing irrelevant messages, or starting a fresh session addresses what is commonly called context rot: accumulated conversational noise that degrades response quality.

    Context drift is a different problem.

    Suppose the project’s root-level agent rules file, such as AGENTS.md, has been updated to specify a 14-day refund window. A task-specific skill file—operating instructions loaded for a particular type of task—still says 30 days. Meanwhile, the docs directory contains another outdated policy from three months ago.

    Even a completely new conversation can load these files and receive contradictory instructions.

    The distinction is straightforward:

    • Context rot is a problem across time: noise accumulates within a conversation.
    • Context drift is a problem across sources: persistent knowledge sources lose synchronization.

    They therefore require different remedies.

    Dimension Context Rot Context Drift
    Where the problem lives Within a conversation Across project files
    When it appears Becomes more noticeable as the conversation grows Can appear on the first turn of a new session
    Observable behavior Off-track answers or repeated, rejected approaches Fluent answers that present only one version
    Primary remedy Clean up history, compress context, or restart the conversation Locate conflicting source text, verify it, and reconcile the documents

    3. How Normal Collaboration Creates Drift

    Context drift does not require an obvious mistake. It is often a natural byproduct of ordinary collaboration.

    1. Parallel updates fall out of sync.
      One team updates the root-level integration guidelines, while another maintains a copy in its own directory for local reference. Neither team knows about the other version.

    2. Skill files and global rules evolve independently.
      Skills are written for specific tasks. Time-sensitive rules may be updated in a skill file first, while the project-wide rules remain unchanged.

    3. Documentation accumulates across layers.
      The same rule appears in docs, a wiki, a README, and historical issue records. Differences between those versions grow over time.

    4. Handoffs leave information gaps.
      A new team member finds only the document in the task directory and successfully completes the work using it. The inconsistency remains hidden until an agent loads several documents into the same context.

    In this sense, agents encounter unresolved handoff problems that humans have left behind. Loading multiple sources together makes those problems more likely to affect an answer, while the agent’s fluent output can make them harder to notice.

    4. The Greater Risk: Silent Conflict Resolution

    The comparisons described earlier reveal two layers of risk.

    Execution Risk

    When task-specific instructions conflict with global rules, models tend to follow the instructions closest to the task.

    That choice has some intuitive appeal: local instructions are often more specific. But the model makes the choice implicitly, without informing the user.

    Disclosure Risk

    The more serious issue is the absence of disclosure. Unless explicitly instructed to do so, a model may never say:

    “I found two conflicting documents and chose one of them.”

    Instead, the output looks confident and internally consistent. The reviewer has no visible reason to suspect that another version exists.

    This weakens the trust foundation of workflows that use agents to generate factual answers. An apparently excellent response may simply reflect one of several competing versions of a fact, selected without the user’s knowledge.

    5. Make Conflict Detection Part of Documentation Engineering

    Managing context drift requires a combination of governance, tooling, and workflow changes.

    5.1 Establish a Single Source of Truth

    Assign one authoritative file to each category of critical facts, such as refund windows, API conventions, or deployment requirements.

    Other documents should reference that source rather than copy its contents. Avoid hard-coding these values and rules in skill files, task descriptions, and READMEs.

    1. # Recommended in a skill file
    2. Refund window: See /docs/policies.md#refund
    3. # Avoid
    4. Refund window: 30 days # Hard-coded and prone to drift

    The goal is to reduce the number of independently maintained definitions of the same fact.

    5.2 Run Regular Documentation Consistency Checks

    Treat the search for contradictions across knowledge sources as a separate automated task.

    An agent can help perform this check, but the instruction must be explicit: compare statements about the same facts, list the differences, and identify the source files.

    Conflict detection cannot be assumed to happen automatically during ordinary task execution.

    1. Example prompt:
    2. Compare the rule statements in the following files:
    3. the root-level agent rules file,
    4. skills/refund/SKILL.md, and docs/policies.md.
    5. List all contradictory statements, including their source files
    6. and last-modified timestamps.
    7. Do not resolve the conflicts; report only the differences.

    5.3 Require Agents to Disclose Conflicts

    If the workflow allows multiple documents to coexist, require the model to report contradictory statements and request a decision before proceeding.

    Include this requirement in the project-level rules file as a mandatory behavior, rather than an optional suggestion.

    The intent is to make conflict disclosure an explicit part of the agent’s operating instructions instead of relying on the model to volunteer it.

    5.4 Define Expiration and Archiving Rules

    Add a “last verified” date to every rules document. Move documents that exceed the review interval into an archive, and exclude that archive from the agent’s retrieval scope.

    Many drift problems originate in old documents that nobody feels comfortable deleting. An archiving process addresses both the operational uncertainty and the reluctance to remove historical material.

    5.5 Add Reverse Checks to Human Review

    When reviewing an agent’s answer about a critical fact, do not judge it only by how fluent or plausible it sounds.

    Trace the fact back through the project:

    • Is it defined in only one place?
    • If several definitions exist, which one is current?
    • Do those definitions agree?

    Make these checks part of the acceptance checklist. Do not assume the model has already reconciled the sources on your behalf.

    6. Conclusion

    Starting a new conversation can address context rot, but it cannot fix context drift. Drift lives in the project’s persistent files and accumulates silently through everyday collaboration.

    Three conclusions matter most:

    1. When documents conflict, models tend to favor task-local instructions and may not disclose the disagreement.
    2. The root cause is usually documentation falling out of sync during normal collaboration, not an individual’s obvious mistake.
    3. Effective governance combines a single source of truth, explicit conflict detection, mandatory disclosure, and document expiration and archiving.

    Before connecting an agent to real business documentation, audit the project’s rules and skill files, reconcile their conflicts, and establish a process to keep them aligned. That work may improve the trustworthiness of the agent’s answers more than choosing a more capable model.