self-correction-loop
Self-Correction Loop
Core Principles
-
Every correction is a compounding investment — A correction costs the user 30 seconds today but saves hours across all future sessions. Treat every correction as high-priority knowledge capture, not a one-time fix.
-
Generalize before storing — "Use
TimeProvidernotDateTime.Nowin the Orders module" becomes "Always useTimeProviderinstead ofDateTime.Now/UtcNowacross all modules." Specific corrections become class-level rules. -
Categorize for retrieval — Rules organized by category (Code Style, Architecture, Naming, Testing, Data Access, API Design, Configuration, Performance) are findable. Uncategorized rules are forgotten.
-
Deduplicate aggressively — Before adding a rule, scan existing rules for overlap. Update an existing rule rather than adding a near-duplicate. Memory bloat defeats the purpose.
-
Review memory at session start — The first thing Claude should do in a new session is check
MEMORY.mdfor project-specific rules. Knowledge captured but never reviewed is wasted effort.
Patterns
Correction Detection & Capture Flow
When a user corrects Claude's output, follow this exact sequence: