Skip to content

ConventionRuleDiffReview

Dennis Lee edited this page Oct 21, 2026 · 1 revision

title: Convention-Rule Diff Review radar_quadrant: Techniques radar_ring: Assess radar_position: inner

Convention-Rule Diff Review

Code written by AI agents often passes linting and tests yet still breaks a team's conventions, for example by swallowing exceptions, duplicating tool registrations, or adding product-specific branches to shared code. Written style guides get skimmed, and asking a chat model to review a diff gives inconsistent answers. Convention-Rule Diff Review turns each convention into a testable question that a decision model scores against every change (blog post).

The Pattern

Each team rule is written as a named mistake, such as "the change catches an exception and returns None". Rules live in rules.yaml files next to the code they cover, each with a fix and a reference file. Every rule becomes one yes/no question put to the decision model with the diff or screenshots as state. The score is flipped so that a high number means the change follows the rule, and anything under 80% becomes a hint.

Workflow

Before coding, a command lists the rules that apply to the files about to change, with no model call. During coding, lint and tests run as usual. After coding, one review call checks the whole change against all applicable rules. The agent fixes real problems or dismisses false alarms with a written reason, for at most three rounds.

Testing the Rules

Rules are tested like code. Each has labeled violating and compliant cases, and a margin measures how cleanly they separate. A rule is reworded until the margin passes. The author found that rules phrased as mistakes work better than rules phrased as virtues, and reports one rule's margin improving from 0.24 to 0.96 after rewording.

Placement Ladder

The author proposes a ladder for where a convention belongs: make the mistake impossible in code first, then use lint or tests, then a model judge, and only then a guide entry.

Caveats

Code goes to a third-party provider, the provider can fail, the plumbing is real work, and human judgment is still needed for new kinds of mistakes. The author reports reviews costing cents, with the largest around $0.04, and taking about a minute.

Radar Assessment

Convention-Rule Diff Review is placed in Assess within Techniques. It extends the sensor idea in Maintainability Sensors for Coding Agents with team-specific, testable rules, and the evidence comes from the author's own team. No first-person production use has been confirmed, so the ring remains Assess.

References

Clone this wiki locally