Agent rule pattern

Ratchets

Baselines that may only shrink and lists that may only grow.

5 of 100 projects

The shape of the rule

  1. Name the baseline
  2. Set its allowed direction
  3. Check for regressions
How to use it

A known-violations file may only shrink; a tombstone list may only grow. CI usually enforces the direction.

Name the baseline and the only direction it may move. Include the enforcement command and any gaps that still need review.

Examples from real projects

3 examples · Pinned source

Shrink-only baselines and append-only tombstones

The known-violations baseline may only shrink, while tombstone lists may only grow. Removing a violation requires deleting copies, adding a tombstone and adversarial fixture, registering consumers, and updating the audit.

AGENTS.mdL104–105
Source excerpt starting at line 104.
  explicit `@hunk/vcs/*` leaves. The known-violations baseline is shrink-only: fix an edge, rerun  `bun run deps:baseline`, and never add to it.

Prevent quiet downgrades of lint policy

Because lint runs with --quiet, a package-wide downgrade to warning would look configured while enforcing nothing. The file connects this to a shared rule and a shrinking debt baseline.

AGENTS.mdL283–287
Source excerpt starting at line 283.
raises rules to `error`, and blocks scoped to `files`. It must not turn a ruledown for the whole package: every lint script runs with `--quiet`, so a `warn`enforces nothing and reads as if it did. The code-health rule`lint-config-layering` enforces this, with existing debt in`.code-health-baseline.json`, which only shrinks.

Frozen codecs, and a note on what the tests miss

Published codecs may not gain, reorder, or reinterpret fields; incompatible changes need a new name. Digest tests miss appended enum variants, so reachable enums remain closed even when tests pass.

AGENTS.mdL94
Source excerpt starting at line 94.
- Existing-value digests cannot detect an appended enum variant. Review every enum reachable from a frozen codec as append-closed even when tests remain green.

Projects using this pattern (5)

Browse in directory →
← All agent rule patterns