self-correction — Claude Code rule: what it does, how to install
self-correction turns a correction into a one-line [LEARN] rule with a category, and saves it only once you approve the wording.
MIT ★ 2,966 updated 2026-09-29
.cursor/rules/self-correction.mdcWhat self-correction does
The rule kicks in when you point out a mistake or the agent spots one. It names what went wrong, drafts a single line tagged [LEARN] with a category, then holds that line until you agree. No reply, no saved rule.
The categories are fixed: Navigation, Editing, Testing, Git, Quality, Context, Architecture, Performance. The frontmatter carries alwaysApply: true, so the behaviour is on in every session instead of waiting for a trigger.
You can nudge it with phrases like remember this, add to rules or don't do that again. Approval is the gate — without it the proposed entry never reaches your rules file.
What it helps with
- capture a repeated agent mistake as one line of rules
- sort corrections into a fixed set of categories
- keep the agent from writing into your rules file on its own
- carry a fix from one session into the next
Example prompts for the agent
- Remember this: stop editing files outside
src/without asking, and propose a rule for it. - Add to rules that migrations only run through
make migrate. - You broke the build again. Don't do that again — write it down as
[LEARN] Testing: ....
How to install self-correction
Manually: put the files in place
.cursor/rules/self-correction.mdcFrontmatter: description, globs, alwaysApply
1Plugin marketplace
/plugin marketplace add rohitg00/pro-workflow/plugin install pro-workflow@pro-workflow2Manually: put the files in place
.claude/rules/self-correction.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/self-correction.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/self-correction.mdManually: put the files in place
.clinerules/self-correction.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about self-correction
How do I install self-correction in Claude Code?
Run /plugin marketplace add rohitg00/pro-workflow, then /plugin install pro-workflow@pro-workflow. The rule itself lives at .claude/rules/self-correction.md.
What does self-correction do?
On a correction it has the agent state the mistake, draft a one-line [LEARN] rule with a category, and wait for your approval before persisting it.
Which categories can a learning use?
Navigation, Editing, Testing, Git, Quality, Context, Architecture, Performance.
Source text
self-correction.mdc · MIT
--- description: Self-correction protocol - capture mistakes as learnings, compound improvements over time alwaysApply: true --- When corrected or when a mistake is identified: 1. Acknowledge specifically what went wrong 2. Propose a concise rule: `[LEARN] Category: One-line rule` 3. Wait for approval before persisting the learning Categories: Navigation, Editing, Testing, Git, Quality, Context, Architecture, Performance Learnings compound over time. A correction today prevents the same mistake tomorrow. Trigger phrases that indicate a correction: "remember this", "add to rules", "don't do that again"
© Rohit Ghumare · MIT · rohitg00/pro-workflow