Skip to main content
rule CX Codex

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

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/self-correction.mdc
Open on GitHub

What 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set83

The whole set →
no-debug-statements The no-debug-statements rule flags debugging calls for removal before a commit in JavaScript, TypeScript, Python, Go, and Rust files. Use it during a pre-commit review. CX Codex +1 ★ 2,966repo stars quality-gates quality-gates — a Claude rule that makes the agent lint and typecheck before a commit, then sweep the staged diff for debug lines and hardcoded keys. CX Codex +1 ★ 2,966repo stars atomic-commits Enforces Git best practices: atomic commits in Conventional Commits format, mandatory feature branches, and selective file staging. CX Codex +1 ★ 2,966repo stars cost-tracker cost-tracker is a Claude Code command that estimates current-session spend, identifies its main cost drivers, and suggests optimizations. Compare the estimate with a task budget. CX Codex +1 ★ 2,966repo stars mcp-audit Audits active MCP servers, estimates token overhead from tool schemas, and flags unused integrations to disable. CX Codex +1 ★ 2,966repo stars auto-setup auto-setup detects a project’s stack and configures quality gates, permission rules, and hooks. Useful when bringing a new codebase into Claude Code. CX Codex +1 ★ 2,966repo stars compact-guard compact-guard is a Claude Code command that saves working state before context compaction and restores critical data afterward. Run it before manual compaction or when auto-compaction warnings appear. CX Codex +1 ★ 2,966repo stars wrap-up wrap-up audits git diffs, runs test suites, records lessons learned, and prepares context before closing a Claude Code session. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open