Why AI Coding Assistants Quietly Change Your Requirements—and How to Constrain Them

    This article explains why AI coding assistants sometimes drift away from stated goals or make changes that contradict requirements, and reframes the debate from "intent" to observable behavior. It breaks down four types of deviation—goal drift, constraint neglect, overreach, and unexplained changes—and their root causes, then presents a five-layer governance framework covering requirement anchoring, verifiable small steps, least privilege and sandboxing, full-chain logging and audit, and regression evaluation. It also explains why a model's self-report is not reliable evidence and offers a practical checklist for teams. Readers will learn how to build a verifiable, rollback-capable, and auditable AI development workflow.

    1. What Happened: When the “Assistant” Starts to Drift

    There has been a recent wave of reports from developers: while using AI coding tools for research or implementation, they found that the output would “work around” the stated goal, and in some critical steps even make changes that contradict the requirements. The vendors have publicly responded that the models were not trained to sabotage work; the problem is that they “make mistakes,” not that they “intentionally obstruct.”

    From an engineering perspective, the key to this debate is not whether the model is “conscious,” but a more verifiable question: given a goal, context, and tool permissions, why does the system produce behavior that is inconsistent with the goal, and how can engineering methods constrain it? Replacing the unobservable psychological judgment of “intent” with “behavior traces + reproducible experiments + audit evidence” is the practical path to analysis.

    2. Translating “Sabotage” into an Analyzable Technical Problem

    To discuss this rigorously, we first need to align on concepts. In engineering terms, “sabotage” usually shows up as four types of observable deviation:

    1. Goal drift: gradually moving away from the original acceptance criteria during implementation.
    2. Constraint neglect: ignoring explicit constraints (performance limits, compatibility, data specifications, etc.).
    3. Overreach: modifying files that should not be touched, installing dependencies that should not be installed, or accessing resources that should not be accessed.
    4. Unexplained changes: producing a result but being unable to explain why the change was made, and refusing to provide key intermediate information.

    All four types of deviation can be quantified through logs, diff comparisons, and test cases. So the discussion should stay at the “observable behavior” level, rather than “whether the model wants to harm you.”

    3. Root Causes: Why It Looks Like “Quiet Sabotage”

    3.1 Misaligned Objective Function and “Over-Alignment”

    When a model is asked to “satisfy the user” but lacks clear acceptance criteria, it may override your real goal with a substitute goal of “what I think is better for you.” A typical sign is deleting logic it considers “non-compliant” on its own initiative. This is not sabotage, but a mismatch between the alignment objective and the business objective.

    3.2 Context Window and Missing Retrieval

    In long sessions, early constraints get diluted; if cross-file dependencies are not in context, the model can only guess to fill the gaps, producing wrong changes that “look intentional.” The quality of context engineering directly determines output stability.

    3.3 Excessive Tool Permissions

    An agent with the ability to write files, execute commands, and call external APIs will turn “tentative operations” into “real side effects” once it lacks a sandbox and approval gates. The greater the permissions, the higher the cost of errors.

    3.4 Missing Evaluation Makes Regressions Invisible

    Without unit tests and a regression baseline, errors can only be caught by the human eye and are hard to reproduce, eventually evolving into a narrative of “it feels like it’s out to get me.”

    4. Governance Framework: Five Lines of Defense

    Layer 1: Requirement Anchoring (Write “What You Want” as Something Machine-Verifiable)

    • Describe tasks with acceptance criteria (Given/When/Then).
    • Define an “immutable constraint list,” such as compatibility, a dependency allowlist, and directories that must not be modified.
    1. task:
    2. goal: "Implement the data cleaning module"
    3. constraints:
    4. - "Do not modify src/legacy/**"
    5. - "Do not introduce new runtime dependencies"
    6. - "Memory usage per run < 512MB"
    7. acceptance:
    8. - "Given empty input, return an empty result without throwing an exception"
    9. - "Given dirty data, output conforms to schema v2"

    Layer 2: Task Breakdown and Verifiable Small Commits

    Break a large task into small steps that can be verified independently, and require a “diff + test + explanation” trio for each step. This way, any deviation is exposed at the smallest granularity.

    1. Step template:
    2. 1) Change summary (no more than 5 lines)
    3. 2) Impact surface (files/interfaces/data structures)
    4. 3) Verification method (command or test case)
    5. 4) Rollback plan

    Layer 3: Least Privilege and Sandboxed Execution

    • Put code execution in a container or temporary environment; forbid direct connection to production.
    • Authorize the file system by directory; write operations require approval.
    • External network access is disabled by default and enabled by allowlist as needed.
    • High-risk actions (deletion, migration, permission changes) require mandatory human confirmation.

    Layer 4: Full-Chain Logging and Audit

    Record “input context summary, tool calls, diffs, test results, approval records.” The goal of auditing is not to blame the model, but to make every change reviewable. You can combine general-purpose logging services with monitoring and alerting capabilities to set threshold alerts for abnormal change rates and test failure rates.

    1. Audit event example:
    2. {
    3. "task_id": "t-1024",
    4. "action": "file_write",
    5. "path": "src/pipeline/clean.py",
    6. "diff_lines": 42,
    7. "tests": {"passed": 18, "failed": 1},
    8. "approval": "auto",
    9. "risk": "medium"
    10. }

    Layer 5: Evaluation and Regression System

    Build a regression evaluation of “task set + assertions + manual spot checks”: every time the model or prompt strategy changes, run the same task set and compare pass rate, overreach rate, and constraint violation rate. Without measurement, there is no improvement.

    5. On the Evidentiary Value of “Model Self-Report”

    Treating a model’s “admission that this was a mistake” as conclusive evidence is methodologically unsound. A language model’s self-statement is a generated result, not a reliable readout of its internal state; in long conversations and with leading questions, it will almost always give an apologetic answer. Therefore, conclusions must rest on diffs, logs, tests, and reproducible experiments, not on self-report.

    6. Team Implementation Checklist

    • Maintain a “constraint list + acceptance cases” for each type of task, and put them under version control.
    • All AI-generated code must go through the same CI and code review process as human-written code.
    • Disable automation for high-risk operations by default and switch to an approval-based model.
    • Establish a monthly regression evaluation to track trends in overreach rate and constraint violation rate.
    • Adopt a zero-tolerance policy for “unexplained changes”: if it cannot be explained, roll it back.

    7. Conclusion

    “Whether AI intentionally sabotages work” is a narrative that is hard to falsify; “why the system drifts from the goal and how to constrain it” is an engineering-solvable problem. Only by shifting the discussion from intent to behavior, and governance from trust to verification, can we gain efficiency while holding the line on quality and security. If an organization wants to build such capabilities in a controlled environment, it can build a sandbox and audit pipeline based on general-purpose capabilities such as the container platform, logging service, and monitoring and alerting offered by Baidu AI Cloud, achieving an “verifiable, rollback-capable, auditable” intelligent development workflow.