The Claude Error Collector is an MCP server that helps Claude learn from user corrections by recording them as rules in CLAUDE.md files.
Record corrections ( Saves what was wrong, the correct approach, and a derived rule into the appropriate
CLAUDE.md, with optional category taggingAutomatic file selection: Intelligently writes to a project-specific
CLAUDE.mdor the global~/.claude/CLAUDE.mdbased on contextList learned rules ( Displays all recorded rules with filtering by category and grouping options
Delete rules: Remove specific rules by index or substring match
Update rules: Modify the text, date, and/or category of existing rules
Review rules: Assess rule age to assist with lifecycle management
Duplicate detection: Prevents redundant rules via server-side substring matching and semantic evaluation by Claude
Legacy format support: Compatible with existing
CLAUDE.mdfiles that lack metadata
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Claude Error CollectorRecord that I prefer async/await over .then() chains for all API calls"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Claude Error Collector
An MCP server for Claude Code that learns from your corrections. When you tell Claude "that was wrong" or "no, do it like this", it records the lesson as a rule in your CLAUDE.md - so the same mistake doesn't happen twice.
How It Works
You correct Claude during a coding session
Claude recognizes the correction and calls the
record_errortoolThe server derives a rule and writes it to the appropriate
CLAUDE.mdClaude reads that rule in future sessions and avoids repeating the mistake
The server automatically detects whether you're in a project directory (writes to project CLAUDE.md) or your home directory (writes to ~/.claude/CLAUDE.md).
Tools
record_error
Records a correction and saves it as a learned rule with metadata (date, category).
Parameter | Type | Required | Description |
| string | yes | What was wrong |
| string | yes | What is correct |
| string | yes | Derived guideline, e.g. "ALWAYS use X instead of Y" |
| string | no | Rule category (e.g. "n8n", "bash", "google-workspace"). Auto-detected if omitted. |
| string | no | Current working directory (for finding project CLAUDE.md) |
list_errors
Lists all learned rules from the relevant CLAUDE.md. Supports filtering and grouping.
Parameter | Type | Required | Description |
| string | no | Filter rules by category |
| boolean | no | Group rules by category with headings |
| string | no | Current working directory |
delete_rule
Deletes a learned rule by index or substring match.
Parameter | Type | Required | Description |
| number | no* | 1-based index of the rule to delete |
| string | no* | Substring to match (must match exactly one rule) |
| string | no | Current working directory |
*Exactly one of index or match must be provided.
update_rule
Updates an existing rule's text, date, and optionally category.
Parameter | Type | Required | Description |
| number | no* | 1-based index of the rule to update |
| string | no* | Substring to match (must match exactly one rule) |
| string | yes | The new rule text |
| string | no | New category (keeps existing if omitted) |
| string | no | Current working directory |
*Exactly one of index or match must be provided.
review_rules
Reviews all rules with their age for lifecycle management.
Parameter | Type | Required | Description |
| number | no | Threshold in days to consider "old" (default: 30) |
| string | no | Current working directory |
Output Format
Rules are stored in a ## Learned Rules section in your CLAUDE.md with metadata as HTML comments:
## Learned Rules
- Legacy rule without metadata (still supported)
### N8n
- Bei n8n IMMER nodeId verwenden <!-- @date:2026-02-15 @category:n8n -->
### Bash
- NEVER embed large JSON inline in Bash commands <!-- @date:2026-02-20 @category:bash -->Metadata fields:
@date:YYYY-MM-DD— when the rule was created/updated@category:name— rule category for grouping
Rules without metadata (legacy format) remain fully supported and appear at the top of the section without a category heading.
Installation
git clone https://github.com/henningziech/claude-error-collector-mcp.git
cd claude-error-collector-mcp
npm install && npm run build
claude mcp add error-collector -s user -- node "$PWD/dist/index.js"Restart Claude Code after installation. No manual CLAUDE.md editing needed — the server provides its own instructions to Claude via MCP server metadata.
CLAUDE.md Resolution
The server finds the right CLAUDE.md using this logic:
If
project_diris provided: walk up the directory tree looking forCLAUDE.mdIf found and not in the home directory: use it (project-level rules)
Fallback:
~/.claude/CLAUDE.md(global rules)
Duplicate Detection
Duplicate detection works on two levels:
Server-side: Before writing a rule, the server checks existing rules using case-insensitive substring matching. If the new rule is already covered by an existing one (or vice versa), it skips the write.
Semantic (via instructions): The server instructs Claude to review existing learned rules for semantic equivalence before calling
record_error— even if the wording differs. Claude will:Skip silently if the rule clearly already exists
Record it if the rule is clearly new
Ask the user if a similar rule exists but it's not 100% clear whether it's a duplicate, offering options to add alongside, consolidate, or skip
License
MIT