DEV Community

Cover image for My coding agent kept fixing things nobody asked it to fix, so I wrote it 12 rules

My coding agent kept fixing things nobody asked it to fix, so I wrote it 12 rules

AheadKit on November 29, 2026

My coding agent does what I ask. Then it does more than I asked. It renames a function nobody asked it to rename, rewrites a file to fix one line, ...
Collapse
 
dosaygo profile image
dosaygo •

Putting the rule of three into an agent skill is handing the model a licence to duplicate: a human remembers where copy number one lives, whereas a coding agent starting a fresh session treats "two similar blocks are fine" as permission to invent a parallel helper instead of naming and extending the module already in the repo.

Collapse
 
aheadkit profile image
AheadKit •

That's the sharp version of it. The rule was written for someone who remembers where copy one lives, and a fresh session has no such memory, so 'two are fine' reads like permission to build the second one instead of finding the first. Going to run the same demo task with the wording changed to name-and-extend and see whether the parallel helper stops appearing. Does yours even look for the existing module first, or duplicate before it searches?

Collapse
 
dosaygo profile image
dosaygo •

Left to its defaults, a fresh session duplicates before it searches—generating a clean 30-line helper from scratch takes fewer tool calls than grepping an unfamiliar worktree and reading existing call sites. In our 22-session controller build, the agents didn't search and reject the existing bbz orchestrator; they read the task prompt and started writing a new adapter module on turn one.

Changing the rule to name-and-extend only holds when you make the search output a mandatory first line: the agent must print the exact file path and symbol it is extending before its first file write, or stop and ask if it cannot find one. AI Lint packages that pre-flight CHECKLIST.md and the AR-R2: Parallel Solutions reject doctrine for CLAUDE.md, AGENTS.md, and Cursor rules so coding agents search and extend existing modules before writing code (the free edition is for personal use only; a company team gets the paid packs or Company license): ai-lint.dosaygo.com/go/forum-20261...

Thread Thread
 
aheadkit profile image
AheadKit •

The mandatory first line is what makes name-and-extend enforceable instead of just a nicer sentence in the rules — without it the agent can nod and duplicate anyway. Did the print-the-path-first version actually stop it in your 22-session build, or is that the next run? If it held there I'd want to steal the exact wording.

Thread Thread
 
dosaygo profile image
dosaygo •

The 22 sessions were the run without it. None of those briefs named the orchestrator CLI we already had, so each session did the sensible thing with a blank page and wrote a new adapter. The rule was written the morning after. The rebuild that carried it went onto the existing CLI: the controller calls it now and holds no provider code of its own.

The wording, from the top of our rules file:

Build on what exists. Name what you extend before you write. If you cannot name it, stop and ask.

And the half that does the work, which lives in the task and not in the rules:

A brief names the thing to extend, with its path, in its first line. A worker whose brief names no target does not start building.

A rule in CLAUDE.md sends the agent looking; a path in the first line of the task means it starts with the file already named. Where the task can't carry one, make the agent's first output line the path and symbol, and discard any session that writes a file before printing it. It is still a markdown instruction the model follows, with no mechanical check behind it, so the check is yours, and it is one line to read where it used to be a whole diff.

The reject it pairs with, AR-R2 Parallel Solutions, and the pre-flight checklist around it are in the AI Lint App Pack: ai-lint.dosaygo.com/go/forum-20261...

Thread Thread
 
aheadkit profile image
AheadKit •

That first line is the whole trick. A rule in the file sends the agent looking, a path in the first line means it starts with the file already named. The discard rule is the sharp bit too, one line to read instead of a whole diff. Has the rebuild actually run sessions with it yet, or is the no-more-parallel-adapter part still the thing to prove?