Why Your Coding Agent Ignores AGENTS.md and CLAUDE.md Rules
Run agents? ACP lets you see, control, and price every tool call they make — allow/ask/deny policy, per-session cost, and a full audit log for Claude Code, Cursor, Codex, and OpenClaw, in one command:
curl -sf https://agenticcontrolplane.com/install.sh | bash
irm https://agenticcontrolplane.com/install.ps1 | iex
Getting started → · see your first governed call → · free up to 5 agents
Last updated: November 8, 2026.
In January, a developer posted a transcript that made the rounds. Their Cursor agent force-pushed to a branch with --force-with-lease --no-verify, past a rules file that said to ask before any push. The opencode tracker has the same report in different words: “agent commits and pushes without user approval despite explicit rules” (#14923). And the PocketOS database incident was reported with the agent’s own words mid-apology: “I violated every principle I was given.”
Different agents, same pattern. Somebody did the sensible thing and wrote the constraint down, in the file the agent reads, in plain English. It held until it mattered.
Why the rules file loses
The rule lives in the context window. AGENTS.md, CLAUDE.md, and .cursorrules are all context. They sit in the same window as the task, the transcript, the tool results, and whatever a web page or error message dragged in. The rule competes with all of it. Its force is whatever inclination the model has to follow it on this token, in this session, under this much pressure.
Most of the time that is enough. Models follow instructions well. But “most of the time” is a rate, not a guarantee, and the failures aren’t random. They happen in long sessions, failing tasks, and plans the model is confident about and the rule gets in the way of. The force-push transcript reads like that. The agent knew the rule and reasoned past it.
The failure is also quiet. A rules file has no log. Nothing fires when a rule is skipped. You find out the way the Cursor user did: from the git reflog, afterwards.
Where to draw the line

A policy is an object the gateway evaluates: tool, tier, outcome. Agents can propose one. A person turns it on.
Keep writing rules files. Style, conventions, architecture preferences, and judgment that doesn’t reduce to a pattern all belong in prose. The mistake is using the same file as a control. A test: if the sentence is “never X” or “always ask before X,” and you’d be writing an incident report if X happened, it is a policy and needs a mechanism.
A mechanism means something on the execution path checks the action itself. The model proposes a tool call, and before it runs, something that is not the model evaluates it. That can be Claude Code’s deny rules and PreToolUse hooks, with documented limits. It can be an OS sandbox that limits the damage. It can be a rule layer like ACP, which runs as a hook in the harness. There, “ask before pushing” becomes a call that waits for an answer. Force-pushes wait for your approval even with no rule written, as part of the default safety floor in a connected workspace. In Claude Code the wait is a prompt in the session. In other harnesses the call is blocked and you approve it on the console, then retry. We’ve ranked the options.
None of them is perfect. A client-side hook can be turned off by whoever controls the settings, and ACP’s local log is a file on the same machine. But each of them checks the action, and the rules file doesn’t.
Ops teams already know the difference. A runbook that says “never deploy on Friday” is culture. A CI gate that blocks Friday deploys is a control. You want both, and you shouldn’t mix up which one you’re holding. With agents the runbook and the operator now read the same file, so it’s easier to mix them up.
Write both. Then look at your hard constraints and find the ones that nothing but a sentence is holding up.
Frequently asked questions
Why does my coding agent ignore the rules in AGENTS.md or CLAUDE.md?
A rules file is input, not enforcement. It goes into the model’s context next to everything else: the task, the transcript, and tool output. It competes for attention there. Most of the time the model follows it. In a long session, or with a failing task, or when the model has a confident plan, most of the time is not enough. Nothing in the execution path checks the rule. The model’s compliance is the only mechanism.
What's the difference between a rules file and a permission system?
A rules file asks the model to behave. A permission system checks the action. The rule ‘ask before git push’ written in prose is followed only if the model decides to follow it. The same rule set as a policy on the tool call, pausing or denying any Bash call that matches git push, applies whether or not the model remembered.
Should I stop writing rules files for my agent?
No. Prose rules are how you steer style, conventions, and judgment calls that don’t reduce to a pattern, and models follow them most of the time. The mistake is relying on them for hard limits. Anything you’d call a hard constraint, like don’t push, don’t touch prod, or don’t read secrets, needs a mechanism that doesn’t depend on being remembered.
How do I enforce a rule the agent can't ignore?
Move it out of the context window and onto the execution path. In Claude Code that means permission deny rules and PreToolUse hooks, which run before the call (with limits, covered in our deny-rules post). An OS sandbox contains the damage. A rule layer such as an ACP hook checks each call in a process separate from the model. It is still a client-side hook, so a user or agent with access to your settings can switch hooks off.
Where to read more
- Do Claude Code Deny Rules Actually Work?: the same gap one level down, in the client’s own enforcement
- The Best Ways to Control What Claude Code Can Do, Ranked
- Which Coding Agents Can You Actually Control, Ranked
- Sandboxes and control planes: containment vs. per-call policy, and why you want both