DEV Community

We put a 'Violate when:' exit clause on every AGENTS.md rule - agent over-engineering dropped from 3/10 to 8/10

TL;DR: AI coding agents (Claude Code, Codex, anything that reads AGENTS.md) obey architecture rules like dogma. So we put a Violate when: exit clause on every single rule - a rule without one does not ship. 21 rules, zero binaries, zero CI plugins. Our own bench on 10 small design tickets: 3/10 → 8/10 design-quality score, with an over-design probe proving the pack doesn't just trade one disease for another. Repo: theBigGavin/arch-rule-packs

The symptom, in the agents' own words

You have probably seen this exact commit in your own AI-assisted repo:

  • "Introduced a Provider interface for the Stripe client" - there is one Stripe client, and there has only ever been one.
  • "Extracted a 4-layer Clean Architecture" - around a 200-line cron job.
  • "Added a plugin system for future extensibility" - for a reuse point that has appeared exactly once.

Here's the uncomfortable part: none of these are hallucinations. The agent is following your rules. Your AGENTS.md says "prefer composition over inheritance", "open for extension", "separate domain from infrastructure". The agent dutifully applies them, forever, at every scale - including scales where they cost 2 extra files per service and make the codebase 30% larger without removing a single coupling.

The diagnosis: rules without exit clauses

Every architecture rule is conditional, but almost nobody writes the condition. "Interfaces at vendor boundaries" is great advice - right up until you put an interface in front of Math.max() (not a joke; we have seen the equivalent in review).

When you give an LLM a rule without a condition, it optimizes for visibly obeying the rule, because that's what's checkable in its context window. The judgment call - does this rule apply here? - silently defaults to "yes", because "yes" produces visible artifacts (an interface, a layer, a factory) and "no" produces... nothing. Nothing looks like failure to a model trained to look like it did something.

The fix: every rule ships its own escape hatch

Our pack ships each rule with two hard sections:

R3 - Interfaces at vendor boundaries

Apply: HTTP clients, payment SDKs, model providers - anything with a network or a vendor you can swap.

Violate when: the client has exactly one implementation AND no second implementation is planned in this quarter. A concrete class is fine. Delete the interface the day the second implementation appears.

Two properties make it work:

  • Violate when: is machine-checkable prose. The agent must cite the rule or the exit clause in its commit message. If it cites the exit clause, it has to say which condition fired. If it cites neither, the change gets bounced. We watched commit messages get meaningfully more honest within a week.
  • A rule without an exit clause doesn't ship. This constraint did more for our rule quality than any wording tweak - writing the exit clause is exactly the work of thinking about when the rule shouldn't fire, which is the half everyone skips.

The numbers, and why they're not 10/10

We ran our own dogfood bench (public in bench/): 10 small design tickets - each a one-paragraph task a coding agent would plausibly get - scored blind on design quality by a hidden check that evaluates the design, not the tests. Same model, same tickets, one arm with the pack in AGENTS.md, one without.

Arm Design-quality score
No pack 3/10
arch-rule-packs 8/10
Over-design probe (tickets that punish speculative abstraction) passes in both arms

We want to be straight with you about what this is and isn't:

  • It's real, on our repo, on our model. 3 → 8 across 10 tickets with hidden scoring.
  • It is not 3 → 10. The pack is a nudge, not a god mode. Your numbers will differ with your model, your prompts, and your codebase. We published the harness so you can run it on your tickets and tell us if we're fooling ourselves.
  • The probe matters more than the headline. Two of the ten tickets are reverse-probes that score you down for speculative abstraction. Both arms passed them, which is our evidence the pack doesn't just trade under-engineering for over-engineering.

What it is not

  • Not a linter. Zero code. No CI plugin, no runtime, no lockfile. A plain-text pack your agent reads.
  • Not another rule dump. The crowded rule-pack market mostly ships "do X" prose. To the best of our knowledge nobody ships a mandatory exit clause per rule - that's the entire differentiation, and it's one grep away from falsifying us.
  • Not free forever, promised. The pack is open source (MIT) and the beta is free; a hosted version (pack + per-repo drift check) is in preparation, no price, no promises.

Take it for a spin

curl -fsSL -o AGENTS.md https://raw.githubusercontent.com/theBigGavin/arch-rule-packs/main/AGENTS.md

Or clone it and pick rules: each file in rules/ is standalone. 21 rules, each with Apply: / Violate when:. MIT. Repo: theBigGavin/arch-rule-packs - if you've watched your agent invent a factory for a singleton, the bench README has the 10 tickets; open a PR with your score on your model. We collect them.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.