Brain: A Persistent Error Memory System for Claude Code via MCP

What Brain Does
Brain is an MCP server that provides Claude Code with persistent, cross-project memory. It stores every error encountered, every solution that worked or didn't, and every code module across all projects. Over time, it learns by strengthening connections between related concepts through a Hebbian synapse network, surfacing patterns, and proactively suggesting solutions.
How It Works
When Claude encounters an error, Brain:
- Captures full context — error message, stack trace, working directory, git branch, current diff, and the command that caused it
- Matches it against every error it has ever seen using a triple-signal hybrid search (TF-IDF + vector embeddings + synapse proximity)
- Suggests proven solutions with confidence scores based on Wilson Score Intervals
- Tracks error chains — detects when errors cascade from fix attempts
- Learns from the outcome — if the fix works, the connection strengthens; if it fails, Brain remembers that too
The key insight: errors from Project A help solve bugs in Project B. That async/await race condition you fixed in your backend? Brain will suggest the same pattern when it sees a similar error in a completely different project.
The Synapse Network
Brain builds a weighted graph connecting:
- Errors ↔ Solutions
- Errors ↔ Code Modules
- Modules ↔ Dependencies
- Everything ↔ Concepts
Connections strengthen with repeated use (Hebbian learning) and decay over time if unused. You can explore related knowledge through spreading activation:
brain explore "ENOENT file not found"This might surface: a solution from 3 months ago, a related module that handles file paths, and a preventive rule about checking file existence before reads.
The creator's current network: 18,138 code modules connected by 37,215 synapses across all projects — and 3,870 active insights generated automatically by the research engine.
Architecture
Brain is built as a modular system with multiple access points:
+------------------+ +------------------+ +------------------+
| Claude Code | | Cursor/Windsurf | | Browser/CI/CD |
| (MCP stdio) | | (MCP HTTP/SSE) | | (REST API) |
+--------+---------+ +--------+---------+ +--------+---------+
| | |
v v v
+--------+---------+ +--------+---------+ +--------+---------+
| MCP Server | | MCP HTTP/SSE | | REST API |
| (stdio) | | (port 7778) | | (port 7777) |
+--------+---------+ +--------+---------+ +--------+---------+
| | |
+----------+-------------+------------------------+
v
+----------+-----------+
| BrainCore |
| (Daemon / Services) |
+----------+-----------+
+-------+-------+--------+--------+
| | | | |
v v v v v
Error Code Synapse Git Embedding
Memory Brain Network Intel Engine
| | | | |
v v v v v
Learn Module Hebbian Commit Vector
Engine Score Learn Track Search
|
v
SQLite (DB)
better-sqlite310 core components, all feeding into one SQLite database (21.8 MB for the creator's setup).
Key Features
Auto Error Detection: A PostToolUse hook catches errors automatically from Bash output — exit codes, TypeError, ENOENT, npm ERR!, BUILD FAILED, etc. You never have to manually report anything.
Proactive Prevention: Brain doesn't just react — it warns you BEFORE bugs happen. A PostWrite hook checks new code against known antipatterns.
Source: github.com/timmeck/brain
📖 Read the full source: r/ClaudeAI
👀 See Also

Open-Source Web UI for Parallel Claude Code Sessions Using Git Worktree
A developer has built an open-source web UI called CCUI that enables running multiple Claude Code sessions in parallel using git worktree. It runs as a local web server accessible via browser and supports SSH port forwarding for remote development.

Claude-Code v2.1.76 adds MCP elicitation, worktree optimizations, and numerous fixes
Claude-Code v2.1.76 introduces MCP elicitation support for structured input mid-task, adds worktree.sparsePaths for monorepo efficiency, and fixes 20+ issues including deferred tool schema loss, slash command problems, and Remote Control session stability.

2-Prompt System to Carry Context Between Claude Chats Without Token Waste
A developer shares two prompts for compressing an entire Claude conversation into a structured context block and loading it into a fresh chat, preserving decisions, work, and next steps.

Claude Code vs. Codex: Real-World Build Test – 36 Files vs. 28, Infinite Loop, and $0.46 Cost Difference
A developer pits Claude Code against Cursor's Codex on two real tasks: a PR triage bot and a WebSocket code review UI. Claude built 36 files in 12 minutes with zero TypeScript errors; Codex produced a working UI but hit an infinite React loop. Cost difference: ~$0.46.