@timmeck/brain 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -170
- package/brain.log +3098 -0
- package/dashboard.html +7 -1
- package/dist/brain.d.ts +1 -0
- package/dist/brain.js +11 -5
- package/dist/brain.js.map +1 -1
- package/dist/cli/commands/dashboard.js +21 -2
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/commands/setup.js +279 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.js +0 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/config.js +2 -29
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/ipc/__tests__/protocol.test.js +1 -1
- package/dist/ipc/__tests__/protocol.test.js.map +1 -1
- package/dist/ipc/router.d.ts +2 -0
- package/dist/ipc/router.js +22 -0
- package/dist/ipc/router.js.map +1 -1
- package/dist/learning/confidence-scorer.d.ts +2 -5
- package/dist/learning/confidence-scorer.js +4 -19
- package/dist/learning/confidence-scorer.js.map +1 -1
- package/dist/learning/decay.js +2 -3
- package/dist/learning/decay.js.map +1 -1
- package/dist/learning/learning-engine.d.ts +2 -5
- package/dist/learning/learning-engine.js +3 -15
- package/dist/learning/learning-engine.js.map +1 -1
- package/dist/mcp/tools.js +36 -0
- package/dist/mcp/tools.js.map +1 -1
- package/dist/parsing/parsers/compiler.js +1 -1
- package/dist/parsing/parsers/compiler.js.map +1 -1
- package/dist/research/research-engine.d.ts +2 -6
- package/dist/research/research-engine.js +3 -23
- package/dist/research/research-engine.js.map +1 -1
- package/dist/services/synapse.service.d.ts +3 -3
- package/dist/synapses/activation.d.ts +3 -13
- package/dist/synapses/activation.js +2 -49
- package/dist/synapses/activation.js.map +1 -1
- package/dist/synapses/decay.d.ts +2 -11
- package/dist/synapses/decay.js +2 -26
- package/dist/synapses/decay.js.map +1 -1
- package/dist/synapses/hebbian.d.ts +2 -13
- package/dist/synapses/hebbian.js +2 -35
- package/dist/synapses/hebbian.js.map +1 -1
- package/dist/synapses/pathfinder.d.ts +2 -14
- package/dist/synapses/pathfinder.js +2 -49
- package/dist/synapses/pathfinder.js.map +1 -1
- package/dist/synapses/synapse-manager.d.ts +7 -23
- package/dist/synapses/synapse-manager.js +6 -63
- package/dist/synapses/synapse-manager.js.map +1 -1
- package/eslint.config.js +14 -0
- package/package.json +61 -50
- package/smithery.yaml +10 -0
package/README.md
CHANGED
|
@@ -4,150 +4,90 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@timmeck/brain)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://github.com/timmeck/brain)
|
|
7
|
+
[](https://smithery.ai/server/@timmeck/brain)
|
|
7
8
|
|
|
8
|
-
**Adaptive Error Memory & Code Intelligence
|
|
9
|
+
**Adaptive Error Memory & Code Intelligence MCP Server for Claude Code**
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Brain is an MCP server that gives Claude Code a persistent memory. It remembers every error you've encountered, every solution that worked (or didn't), and every code module across all your projects. Over time, it learns — strengthening connections between related concepts through a Hebbian synapse network, surfacing patterns, and proactively suggesting solutions before you even ask.
|
|
13
|
-
|
|
14
|
-
## Why Brain?
|
|
15
|
-
|
|
16
|
-
Without Brain, Claude Code starts fresh every session. With Brain:
|
|
17
|
-
|
|
18
|
-
- **Errors are solved faster** — Brain matches new errors against its database and suggests proven solutions with confidence scores
|
|
19
|
-
- **Cross-project learning** — Brain remembers fixes from your other projects and suggests them automatically
|
|
20
|
-
- **Code is never rewritten** — Before writing new code, Brain checks if similar modules already exist across your projects
|
|
21
|
-
- **Patterns emerge automatically** — The research engine analyzes your codebase to find trends, gaps, and synergies
|
|
22
|
-
- **Knowledge compounds** — Every fix, every module, every session makes Brain smarter
|
|
23
|
-
- **Errors are caught automatically** — Hooks detect errors in real-time and report them to Brain without manual intervention
|
|
24
|
-
- **Proactive prevention** — Brain warns you BEFORE an error occurs when it detects code matching known antipatterns
|
|
25
|
-
- **Semantic search** — Local embeddings enable vector-based similarity search alongside TF-IDF matching
|
|
26
|
-
- **Universal access** — REST API and MCP over HTTP make Brain available to any tool, IDE, or CI/CD pipeline
|
|
27
|
-
|
|
28
|
-
## Features
|
|
29
|
-
|
|
30
|
-
### Core Intelligence
|
|
31
|
-
- **Error Memory** — Track errors, match against known solutions, learn from successes and failures
|
|
32
|
-
- **Code Intelligence** — Register and discover reusable code modules across projects
|
|
33
|
-
- **Hebbian Synapse Network** — Weighted graph connecting errors, solutions, code modules, and concepts. Connections strengthen with use (like biological synapses)
|
|
34
|
-
- **Spreading Activation** — Explore related knowledge by activating nodes in the synapse network
|
|
35
|
-
- **Research Engine** — Automated analysis producing actionable insights: trends, gaps, synergies, template candidates
|
|
36
|
-
- **Learning Engine** — Pattern extraction, rule generation, confidence decay, antipattern detection with adaptive thresholds
|
|
37
|
-
|
|
38
|
-
### Smart Matching (v1.3+)
|
|
39
|
-
- **Context Enrichment** — Errors are enriched with task context, working directory, and command information
|
|
40
|
-
- **Error Chain Tracking** — Detects when errors cascade from fix attempts ("this error arose while fixing error #12")
|
|
41
|
-
- **Module Similarity** — Pairwise similarity detection finds duplicate code across projects
|
|
42
|
-
- **Cyclomatic Complexity** — Complexity metrics flow into reusability scores
|
|
43
|
-
- **Source Hash Detection** — Skips re-analysis for unchanged modules, triggers re-analysis on changes
|
|
44
|
-
- **Dependency Synapses** — Internal imports create `depends_on` synapses, enriching the network
|
|
45
|
-
|
|
46
|
-
### Advanced Intelligence (v1.4+)
|
|
47
|
-
- **Cross-Project Transfer Learning** — Matches errors against resolved errors from ALL projects, not just the current one
|
|
48
|
-
- **Proactive Prevention** — Post-write hook checks new code against known antipatterns before errors occur
|
|
49
|
-
- **Adaptive Thresholds** — Learning thresholds auto-calibrate based on data volume (10 errors vs. 500 errors need different sensitivity)
|
|
50
|
-
- **User Feedback Loop** — Rate insights and rules as useful/not useful to improve future analysis
|
|
51
|
-
|
|
52
|
-
### Visualization (v1.5+)
|
|
53
|
-
- **Live Dashboard** — SSE-powered real-time dashboard with streaming stats
|
|
54
|
-
- **Health Score** — Single-number indicator of how well Brain is performing
|
|
55
|
-
- **Error Timeline** — Daily error counts over time, per project
|
|
56
|
-
- **Error Explain** — Full "medical record" of any error: solutions, chains, related errors, rules, insights
|
|
57
|
-
|
|
58
|
-
### Git Integration (v1.6+)
|
|
59
|
-
- **Commit Linking** — Link errors to git commits (introduced_by, fixed_by)
|
|
60
|
-
- **Diff-Aware Context** — Captures current git diff and branch when errors occur
|
|
61
|
-
- **Commit History** — Track which commits introduced errors and which fixed them
|
|
62
|
-
|
|
63
|
-
### Universal Access (v1.7+)
|
|
64
|
-
- **REST API** — Full HTTP API on port 7777 with RESTful routes + generic RPC endpoint
|
|
65
|
-
- **MCP over HTTP/SSE** — Standard MCP protocol over HTTP for Cursor, Windsurf, Cline, Continue, and other tools
|
|
66
|
-
- **Batch RPC** — Send multiple API calls in a single request
|
|
67
|
-
- **API Key Auth** — Optional authentication via `X-API-Key` header
|
|
68
|
-
|
|
69
|
-
### Semantic Search (v1.8+)
|
|
70
|
-
- **Local Embeddings** — all-MiniLM-L6-v2 (23MB) runs locally via ONNX, no cloud required
|
|
71
|
-
- **Hybrid Search** — Triple-signal matching: TF-IDF + Vector Similarity + Synapse Boost
|
|
72
|
-
- **Background Sweep** — Embeddings are computed automatically for all entries
|
|
73
|
-
- **Graceful Fallback** — Works without embeddings; vector search enhances but isn't required
|
|
11
|
+
<!-- TODO: Replace with actual recording once setup wizard is recorded -->
|
|
12
|
+
<!--  -->
|
|
74
13
|
|
|
75
14
|
## Quick Start
|
|
76
15
|
|
|
77
|
-
### Installation
|
|
78
|
-
|
|
79
16
|
```bash
|
|
80
17
|
npm install -g @timmeck/brain
|
|
18
|
+
brain setup
|
|
81
19
|
```
|
|
82
20
|
|
|
83
|
-
|
|
21
|
+
That's it. One command configures MCP, hooks, and starts the daemon. Brain is now learning from every error you encounter.
|
|
84
22
|
|
|
85
|
-
|
|
86
|
-
git clone https://github.com/timmeck/brain.git
|
|
87
|
-
cd brain
|
|
88
|
-
npm install
|
|
89
|
-
npm run build
|
|
90
|
-
```
|
|
23
|
+
## What Brain Does
|
|
91
24
|
|
|
92
|
-
###
|
|
25
|
+
### Before Brain: Every session starts from zero
|
|
93
26
|
|
|
94
|
-
|
|
27
|
+
```
|
|
28
|
+
You: Fix this TypeError
|
|
29
|
+
Claude: *investigates from scratch, tries 3 approaches, 15 minutes later finds the fix*
|
|
95
30
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"mcpServers": {
|
|
99
|
-
"brain": {
|
|
100
|
-
"command": "brain",
|
|
101
|
-
"args": ["mcp-server"]
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"hooks": {
|
|
105
|
-
"PostToolUse": [
|
|
106
|
-
{
|
|
107
|
-
"matcher": {
|
|
108
|
-
"tool_name": "Bash"
|
|
109
|
-
},
|
|
110
|
-
"command": "node C:\\Users\\<YOU>\\AppData\\Roaming\\npm\\node_modules\\@timmeck\\brain\\dist\\hooks\\post-tool-use.js"
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
31
|
+
Next day, same error in another project:
|
|
32
|
+
Claude: *investigates from scratch again*
|
|
115
33
|
```
|
|
116
34
|
|
|
117
|
-
|
|
35
|
+
### After Brain: Errors get solved faster every time
|
|
118
36
|
|
|
119
|
-
|
|
37
|
+
```
|
|
38
|
+
You: Fix this TypeError
|
|
39
|
+
Claude: *Brain found 3 similar errors. Solution with 94% confidence:
|
|
40
|
+
"Add null check before accessing .length — this pattern occurs
|
|
41
|
+
in array-processing modules across 4 of your projects."*
|
|
42
|
+
Fixed in 30 seconds.
|
|
43
|
+
```
|
|
120
44
|
|
|
121
|
-
|
|
45
|
+
### Before Brain: Duplicate code everywhere
|
|
122
46
|
|
|
123
|
-
```json
|
|
124
|
-
{
|
|
125
|
-
"brain": {
|
|
126
|
-
"url": "http://localhost:7778/sse"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
47
|
```
|
|
48
|
+
You: Write a retry wrapper with exponential backoff
|
|
49
|
+
Claude: *writes a new implementation*
|
|
130
50
|
|
|
131
|
-
|
|
51
|
+
Meanwhile, you already have 3 retry wrappers across different projects.
|
|
52
|
+
```
|
|
132
53
|
|
|
133
|
-
###
|
|
54
|
+
### After Brain: Code is never rewritten
|
|
134
55
|
|
|
135
|
-
```bash
|
|
136
|
-
brain start
|
|
137
|
-
brain status
|
|
138
|
-
brain doctor # verify everything is configured correctly
|
|
139
56
|
```
|
|
57
|
+
You: Write a retry wrapper
|
|
58
|
+
Claude: *Brain found a reusable module: src/utils/retry.ts (project: api-server)
|
|
59
|
+
Reusability score: 0.92, used in 4 projects, 12 imports*
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Before Brain: Errors keep recurring
|
|
140
63
|
|
|
141
|
-
|
|
64
|
+
```
|
|
65
|
+
Week 1: ECONNRESET on API call → fix with retry
|
|
66
|
+
Week 2: Same ECONNRESET → debug from scratch
|
|
67
|
+
Week 3: Same pattern in different service → no idea it's related
|
|
68
|
+
```
|
|
142
69
|
|
|
143
|
-
###
|
|
70
|
+
### After Brain: Patterns emerge, prevention kicks in
|
|
144
71
|
|
|
145
|
-
```bash
|
|
146
|
-
brain import ./my-project
|
|
147
|
-
brain projects # see all imported projects
|
|
148
72
|
```
|
|
73
|
+
Brain: "⚠ Warning: This code matches antipattern #7 — missing connection
|
|
74
|
+
timeout on HTTP client. This has caused ECONNRESET in 3 projects.
|
|
75
|
+
Suggested fix: add timeout: 5000 to request config."
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Features
|
|
149
79
|
|
|
150
|
-
|
|
80
|
+
- **Error Memory** — Track errors, match against known solutions with hybrid search (TF-IDF + vector + synapse boost)
|
|
81
|
+
- **Code Intelligence** — Register and discover reusable code modules across all projects
|
|
82
|
+
- **Hebbian Synapse Network** — Weighted graph where connections strengthen with use ("neurons that fire together wire together")
|
|
83
|
+
- **Auto Error Detection** — PostToolUse hook catches errors in real-time, no manual reporting needed
|
|
84
|
+
- **Cross-Project Learning** — Solutions from project A help solve errors in project B
|
|
85
|
+
- **Proactive Prevention** — Warns before errors occur when code matches known antipatterns
|
|
86
|
+
- **Semantic Search** — Local all-MiniLM-L6-v2 embeddings (23MB, no cloud required) for vector similarity
|
|
87
|
+
- **Learning Engine** — Extracts patterns, generates rules, detects antipatterns with adaptive thresholds
|
|
88
|
+
- **Research Engine** — Automated trend analysis, gap detection, cross-project synergy mapping
|
|
89
|
+
- **Git Integration** — Links errors to commits, tracks which changes introduced or fixed bugs
|
|
90
|
+
- **Universal Access** — MCP (stdio + HTTP/SSE), REST API, works with Claude Code, Cursor, Windsurf, Cline
|
|
151
91
|
|
|
152
92
|
## Architecture
|
|
153
93
|
|
|
@@ -190,6 +130,8 @@ Brain scans for source files (TypeScript, JavaScript, Python, Rust, Go, Shell, H
|
|
|
190
130
|
| SQLite (DB) |
|
|
191
131
|
| better-sqlite3 |
|
|
192
132
|
+----------------------+
|
|
133
|
+
|
|
134
|
+
Cross-brain peering via IPC named pipes (\\.\pipe\brain-*, /tmp/brain-*)
|
|
193
135
|
```
|
|
194
136
|
|
|
195
137
|
### Core Components
|
|
@@ -207,26 +149,6 @@ Brain scans for source files (TypeScript, JavaScript, Python, Rust, Go, Shell, H
|
|
|
207
149
|
| **REST API** | HTTP API exposing all 40+ Brain methods as RESTful endpoints |
|
|
208
150
|
| **MCP HTTP Server** | SSE transport enabling non-Claude MCP clients (Cursor, Windsurf, etc.) |
|
|
209
151
|
|
|
210
|
-
## CLI Commands
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
brain start Start the Brain daemon
|
|
214
|
-
brain stop Stop the daemon
|
|
215
|
-
brain status Show stats (errors, solutions, modules, synapses, insights)
|
|
216
|
-
brain doctor Health check: daemon, DB, MCP, hooks
|
|
217
|
-
brain projects List all imported projects with module counts
|
|
218
|
-
brain query <text> Search for errors and solutions
|
|
219
|
-
brain modules List registered code modules
|
|
220
|
-
brain insights Show research insights
|
|
221
|
-
brain network Explore the synapse network
|
|
222
|
-
brain learn Trigger a learning cycle manually
|
|
223
|
-
brain explain <id> Full error report: solutions, chains, rules, insights
|
|
224
|
-
brain config View and manage Brain configuration
|
|
225
|
-
brain export Export Brain data as JSON
|
|
226
|
-
brain import <dir> Import a project directory into Brain
|
|
227
|
-
brain dashboard Generate interactive HTML dashboard (--live for SSE)
|
|
228
|
-
```
|
|
229
|
-
|
|
230
152
|
## MCP Tools
|
|
231
153
|
|
|
232
154
|
These tools are available to Claude Code (and other MCP clients) when Brain is configured:
|
|
@@ -247,10 +169,35 @@ These tools are available to Claude Code (and other MCP clients) when Brain is c
|
|
|
247
169
|
| `brain_suggest` | Get suggestions on what to build or improve |
|
|
248
170
|
| `brain_status` | Current Brain stats |
|
|
249
171
|
| `brain_notifications` | Get pending notifications |
|
|
172
|
+
| `brain_ecosystem_status` | Get status of all brains in the ecosystem |
|
|
173
|
+
| `brain_query_peer` | Query another brain in the ecosystem (method + params) |
|
|
174
|
+
| `brain_error_trading_context` | Correlate an error with trading outcomes from Trading Brain |
|
|
175
|
+
|
|
176
|
+
## CLI Commands
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
brain setup One-command setup: MCP + hooks + daemon
|
|
180
|
+
brain start Start the Brain daemon
|
|
181
|
+
brain stop Stop the daemon
|
|
182
|
+
brain status Show stats (errors, solutions, modules, synapses, insights)
|
|
183
|
+
brain doctor Health check: daemon, DB, MCP, hooks
|
|
184
|
+
brain projects List all imported projects with module counts
|
|
185
|
+
brain query <text> Search for errors and solutions
|
|
186
|
+
brain modules List registered code modules
|
|
187
|
+
brain insights Show research insights
|
|
188
|
+
brain network Explore the synapse network
|
|
189
|
+
brain learn Trigger a learning cycle manually
|
|
190
|
+
brain explain <id> Full error report: solutions, chains, rules, insights
|
|
191
|
+
brain config View and manage Brain configuration
|
|
192
|
+
brain export Export Brain data as JSON
|
|
193
|
+
brain import <dir> Import a project directory into Brain
|
|
194
|
+
brain dashboard Generate interactive HTML dashboard (--live for SSE)
|
|
195
|
+
brain peers Show status of peer brains in the ecosystem
|
|
196
|
+
```
|
|
250
197
|
|
|
251
198
|
## REST API
|
|
252
199
|
|
|
253
|
-
Brain
|
|
200
|
+
Brain includes a full REST API on port 7777 (default).
|
|
254
201
|
|
|
255
202
|
### Generic RPC Endpoint
|
|
256
203
|
|
|
@@ -307,21 +254,26 @@ GET /api/v1/methods # List all 40+ available methods
|
|
|
307
254
|
|
|
308
255
|
### Authentication
|
|
309
256
|
|
|
310
|
-
Set an API key via environment variable:
|
|
311
|
-
|
|
312
257
|
```bash
|
|
313
258
|
BRAIN_API_KEY=your-secret-key brain start
|
|
259
|
+
curl -H "X-API-Key: your-secret-key" http://localhost:7777/api/v1/analytics/summary
|
|
314
260
|
```
|
|
315
261
|
|
|
316
|
-
|
|
262
|
+
## Setup with Cursor / Windsurf / Cline / Continue
|
|
317
263
|
|
|
318
|
-
|
|
319
|
-
|
|
264
|
+
Brain supports MCP over HTTP with SSE transport:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"brain": {
|
|
269
|
+
"url": "http://localhost:7778/sse"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
320
272
|
```
|
|
321
273
|
|
|
322
|
-
|
|
274
|
+
Make sure the Brain daemon is running (`brain start`).
|
|
323
275
|
|
|
324
|
-
|
|
276
|
+
## Configuration
|
|
325
277
|
|
|
326
278
|
| Env Variable | Default | Description |
|
|
327
279
|
|---|---|---|
|
|
@@ -335,21 +287,9 @@ Brain is configured via `config.json` in the data directory or environment varia
|
|
|
335
287
|
| `BRAIN_EMBEDDINGS_ENABLED` | `true` | Enable local embeddings |
|
|
336
288
|
| `BRAIN_EMBEDDINGS_MODEL` | `Xenova/all-MiniLM-L6-v2` | Embedding model |
|
|
337
289
|
|
|
338
|
-
## Auto Error Detection
|
|
339
|
-
|
|
340
|
-
When the PostToolUse hook is configured, Brain automatically:
|
|
341
|
-
|
|
342
|
-
1. **Captures errors** — Detects errors from Bash command output (exit codes, error patterns like `TypeError`, `ENOENT`, `npm ERR!`, `BUILD FAILED`, etc.)
|
|
343
|
-
2. **Reports to Brain** — Sends the error to the daemon for storage and matching
|
|
344
|
-
3. **Suggests solutions** — If Brain has seen a similar error before, it outputs a hint via stderr
|
|
345
|
-
4. **Checks antipatterns** — Warns if the error matches a known antipattern
|
|
346
|
-
5. **Checks code** — PostWrite hook proactively checks new code against known error patterns
|
|
347
|
-
|
|
348
|
-
This happens silently in the background — no manual intervention needed.
|
|
349
|
-
|
|
350
290
|
## How It Learns
|
|
351
291
|
|
|
352
|
-
1. **Error Reported** — Claude encounters an error
|
|
292
|
+
1. **Error Reported** — Claude encounters an error (hook catches it automatically or via `brain_report_error`)
|
|
353
293
|
2. **Context Enriched** — Brain captures task context, working directory, command, git branch, and diff
|
|
354
294
|
3. **Hybrid Matched** — Error is compared against known errors using TF-IDF signals, vector embeddings, and synapse proximity
|
|
355
295
|
4. **Solution Found** — When the error is fixed, `brain_report_solution` records the fix
|
|
@@ -360,17 +300,6 @@ This happens silently in the background — no manual intervention needed.
|
|
|
360
300
|
9. **Embeddings Computed** — Background sweep generates vector embeddings for semantic search
|
|
361
301
|
10. **Next Time** — When a similar error appears, Brain instantly suggests the proven solution — even from other projects
|
|
362
302
|
|
|
363
|
-
## Tech Stack
|
|
364
|
-
|
|
365
|
-
- **TypeScript** — Full type safety, ES2022 target, ESM modules
|
|
366
|
-
- **better-sqlite3** — Fast, embedded, synchronous database
|
|
367
|
-
- **MCP SDK** — Model Context Protocol integration (stdio + HTTP/SSE transports)
|
|
368
|
-
- **@huggingface/transformers** — Local ONNX-based sentence embeddings (all-MiniLM-L6-v2)
|
|
369
|
-
- **Commander** — CLI framework
|
|
370
|
-
- **Chalk** — Colored terminal output
|
|
371
|
-
- **Winston** — Structured logging
|
|
372
|
-
- **Vitest** — Testing
|
|
373
|
-
|
|
374
303
|
## Brain Ecosystem
|
|
375
304
|
|
|
376
305
|
Brain is part of the **Brain Ecosystem** — a family of standalone MCP servers that give Claude Code persistent, self-learning memory.
|
|
@@ -380,10 +309,25 @@ Brain is part of the **Brain Ecosystem** — a family of standalone MCP servers
|
|
|
380
309
|
| **Brain** | Error memory & code intelligence | **7777** / 7778 |
|
|
381
310
|
| [Trading Brain](https://github.com/timmeck/trading-brain) | Adaptive trading intelligence | 7779 / 7780 |
|
|
382
311
|
| [Marketing Brain](https://github.com/timmeck/marketing-brain) | Content strategy & engagement | 7781 / 7782 |
|
|
383
|
-
| [Brain Core](https://github.com/timmeck/brain-core) | Shared infrastructure (
|
|
312
|
+
| [Brain Core](https://github.com/timmeck/brain-core) v1.5.0 | Shared infrastructure (IPC, MCP, REST, CLI, math, synapses) | — |
|
|
384
313
|
| [Brain Hub](https://timmeck.github.io/brain-hub/) | Ecosystem landing page | — |
|
|
385
314
|
|
|
386
|
-
Each brain is **fully standalone** — [Brain Core](https://www.npmjs.com/package/@timmeck/brain-core)
|
|
315
|
+
Each brain is **fully standalone** — [Brain Core](https://www.npmjs.com/package/@timmeck/brain-core) provides shared infrastructure (IPC, MCP, REST API, CLI, math, synapse algorithms) used by all brains, eliminating ~2,800 lines of duplicated code.
|
|
316
|
+
|
|
317
|
+
### Cross-Brain Communication
|
|
318
|
+
|
|
319
|
+
Brains discover and query each other at runtime via IPC named pipes. Use `brain peers` to see online peers, or the `brain_query_peer` / `brain_ecosystem_status` MCP tools to access peer data from Claude Code. Brains also push event notifications to each other — when Brain reports an error, Trading Brain and Marketing Brain are notified automatically.
|
|
320
|
+
|
|
321
|
+
## Tech Stack
|
|
322
|
+
|
|
323
|
+
- **TypeScript** — Full type safety, ES2022 target, ESM modules
|
|
324
|
+
- **better-sqlite3** — Fast, embedded, synchronous database
|
|
325
|
+
- **MCP SDK** — Model Context Protocol integration (stdio + HTTP/SSE transports)
|
|
326
|
+
- **@huggingface/transformers** — Local ONNX-based sentence embeddings (all-MiniLM-L6-v2)
|
|
327
|
+
- **Commander** — CLI framework
|
|
328
|
+
- **Chalk** — Colored terminal output
|
|
329
|
+
- **Winston** — Structured logging
|
|
330
|
+
- **Vitest** — Testing (189 tests)
|
|
387
331
|
|
|
388
332
|
## License
|
|
389
333
|
|