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.
SymptomYour 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.
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 ifThe most frequent error class recurred at most once since its rule existed, or a code check now blocks it.
Access needed:local-configagent-transcripts
- 01Classify the last month of agent errors by cause before adding any rule.
- 02Find the rule that should have caught each cause that recurs 2 or more times.
- 03Replace that rule, if it exists, with a running check such as a hook, lint or test.
- 04Rewrite the rule's one-line trigger, not its body, if no check is buildable yet.
- 05Add a new prose rule only for a cause no existing rule covers.