Coding Agent Rules File Study: Advice, Not a Firewall

Coding agent rules file study comparing four AI agents against security boundaries

Many teams drop a one-page rules file into a repository and treat it as a control on their AI coding agents. A new study tested that habit and found a coding agent rules file behaves like advice, with no power to enforce anything. In the tests, a technical gate stopped forbidden requests and the file did not, and the file also dragged down one agent’s results.

How the test was set up

One 278-word rules file was the test subject. The hypotheses and analysis code were deposited before any runs began. The agents were Claude Code, Codex CLI, Gemini CLI and OpenCode (paired with DeepSeek). Each got small coding projects with hidden tests: 20 for one agent and 12 for each of the other three.

Three of the agents then hit four traps built for the study. One was an endpoint they were told not to call, one a tempting destructive shortcut, one an instruction hidden in the project, and one a booby-trapped package. Permission prompts, the control layer each vendor ships, were switched off on purpose. A gate in front of the mock service blocked and logged forbidden requests. Verdicts were taken from records outside the agent’s reach.

What the file did to scores

The headline number comes from Codex CLI, but the effect wasn’t limited to one tool. Pooled across the agents, the file made results worse.

The study’s checkers turned up no genuine bugs either way. The harm appeared in task results. With the file in place, Codex CLI’s hidden-test score dropped from 99.0 to 67.7 percent.

Across 36 steps, Codex CLI declared success 11 times, saying every test was green, when under half of the hidden tests passed. The tests it ran itself did pass. That gap between self-reported success and real success is the part worth watching.

The file contained two rules that clash on these tasks. Three agents put the task first. One obeyed the rule. Overall, the pass rate slid from 98.2 to 90.9 percent. Paired runs lost 7.7 points, or 1.3 points without Codex CLI.

How often agents tried to cross the line

Agents rarely tried to cross a line. Out of 90 gated steps, 5 attempts occurred, 3 without the file and 2 with it. OpenCode with DeepSeek made all of them, and the gate stopped each one.

Remove the gate and the picture changes: with a neutral file, 7 of 45 runs got such requests through to the mock service.

One limit applies. A bug in the run script kept two of the groups behind the gate at the three HTTP traps, so the study can’t say whether the file shapes agent behavior there.

What this means for teams

Teams write these files hoping to keep agents inside limits on services and packages. The study suggests that hope is misplaced when the agent can reach the network or the package manager directly. The permission prompts that vendors build into their own tools were off here by design, so the results describe the file’s effect alone.

For anyone shipping agents into real repositories, the practical reading is simple. A file states what you’d like, and a gate controls what the agent receives. On the evidence measured, the file was only a suggestion.

  • Put hard limits, such as blocked endpoints and package installs, in a gate or sandbox the agent can’t change.
  • Keep rules files short and check them for instructions that conflict on common tasks.
  • Don’t trust an agent’s own “all tests pass” claim without running an independent check.

Where the research goes from here

The work is a single study on small repositories, and the author flagged the script error that limited one comparison. A rerun with the file tested at the HTTP boundaries would close that gap. Until then, the safest assumption is that a rules file shapes what an agent tries to do but doesn’t limit what it can do.

Source: arXiv.org

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.