# A rule that keeps getting broken needs a gate instead of a sharper rule

With about 350 written rules in place, my agents' top two errors weren't falling.

By Ki Moon · 2026-10-22 · technique · current
Canonical: https://kihmoon.com/bench-notes/p/gate-not-sharper-rule/

**Symptom:** Your agent instruction file gains a rule after each mistake, and the same error class shows up again within weeks.

My coding and GTM agents share one memory of behavioral rules, and each mistake used to earn a new one. By October that memory held about 350 rules.

When I classified four months of caught errors, those rules weren't working.

- Three blind classifiers labelled four months of prompts from June to October.
- 106 errors were on the agent's side.
- 25% were claims made without checking.
- 22% were wrong assumptions about state.

Rules for both top causes already existed. The verification section alone held 28, and neither cause declined in October while design-iteration errors did.

The rules were also crowding each other out. The index that loads them at session start was over its size budget and being cut off at load, so each new rule made older cues less likely to fire.

So I stopped writing prose rules for covered causes. A weekly job mines new error episodes and matches each cluster against the rule inventory. For any cause a rule already covers, that job may only propose a gate or a cue rewrite.

The Claude Code memory documentation says memory files are treated as context rather than enforced configuration, and points to PreToolUse hooks for blocking an action regardless of what Claude decides.

## Check your setup (read-only)

Pick the error class your agents hit most this month from your correction or error log. Find the rule in your instruction files that covers that class. Count recurrences in transcripts since that rule existed. 2 or more recurrences under an existing rule means the rule isn't holding.

**Passes if:** The most frequent error class recurred at most once since its rule existed, or a code check now blocks it.

**Access needed:** local-config, agent-transcripts

## If it fails (changes to make later, not part of the check)

1. Classify the last month of agent errors by cause before adding any rule.
2. Find the rule that should have caught each cause that recurs 2 or more times.
3. Replace that rule, if it exists, with a running check such as a hook, lint or test.
4. Rewrite the rule's one-line trigger, not its body, if no check is buildable yet.
5. Add a new prose rule only for a cause no existing rule covers.

**Applies if:** Your agent instruction files loaded at session start hold more than about 50 behavioral rules.

**Skip if:** Your instruction files loaded at session start fit on one screen, about 50 lines in all.

Tags: agents, reliability, deterministic
