@theihtisham/agent-shadow-brain 5.0.0 → 5.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.
Files changed (61) hide show
  1. package/README.md +575 -292
  2. package/dist/adapters/index.d.ts.map +1 -1
  3. package/dist/adapters/index.js +1 -0
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/brain/auto-setup.d.ts +54 -0
  6. package/dist/brain/auto-setup.d.ts.map +1 -0
  7. package/dist/brain/auto-setup.js +660 -0
  8. package/dist/brain/auto-setup.js.map +1 -0
  9. package/dist/brain/brain-portability.d.ts +81 -0
  10. package/dist/brain/brain-portability.d.ts.map +1 -0
  11. package/dist/brain/brain-portability.js +329 -0
  12. package/dist/brain/brain-portability.js.map +1 -0
  13. package/dist/brain/code-dna.d.ts +70 -0
  14. package/dist/brain/code-dna.d.ts.map +1 -0
  15. package/dist/brain/code-dna.js +611 -0
  16. package/dist/brain/code-dna.js.map +1 -0
  17. package/dist/brain/fine-tuning-engine.d.ts +99 -0
  18. package/dist/brain/fine-tuning-engine.d.ts.map +1 -0
  19. package/dist/brain/fine-tuning-engine.js +681 -0
  20. package/dist/brain/fine-tuning-engine.js.map +1 -0
  21. package/dist/brain/intent-engine.d.ts +64 -0
  22. package/dist/brain/intent-engine.d.ts.map +1 -0
  23. package/dist/brain/intent-engine.js +374 -0
  24. package/dist/brain/intent-engine.js.map +1 -0
  25. package/dist/brain/lsp-server.d.ts +62 -0
  26. package/dist/brain/lsp-server.d.ts.map +1 -0
  27. package/dist/brain/lsp-server.js +480 -0
  28. package/dist/brain/lsp-server.js.map +1 -0
  29. package/dist/brain/mcp-server.d.ts +12 -0
  30. package/dist/brain/mcp-server.d.ts.map +1 -1
  31. package/dist/brain/mcp-server.js +396 -37
  32. package/dist/brain/mcp-server.js.map +1 -1
  33. package/dist/brain/orchestrator.d.ts +13 -0
  34. package/dist/brain/orchestrator.d.ts.map +1 -1
  35. package/dist/brain/orchestrator.js +25 -1
  36. package/dist/brain/orchestrator.js.map +1 -1
  37. package/dist/brain/plugin-system.d.ts +97 -0
  38. package/dist/brain/plugin-system.d.ts.map +1 -0
  39. package/dist/brain/plugin-system.js +404 -0
  40. package/dist/brain/plugin-system.js.map +1 -0
  41. package/dist/brain/smart-cache.d.ts +100 -0
  42. package/dist/brain/smart-cache.d.ts.map +1 -0
  43. package/dist/brain/smart-cache.js +417 -0
  44. package/dist/brain/smart-cache.js.map +1 -0
  45. package/dist/brain/temporal-intelligence.d.ts +89 -0
  46. package/dist/brain/temporal-intelligence.d.ts.map +1 -0
  47. package/dist/brain/temporal-intelligence.js +378 -0
  48. package/dist/brain/temporal-intelligence.js.map +1 -0
  49. package/dist/cli.js +444 -3
  50. package/dist/cli.js.map +1 -1
  51. package/dist/dashboard/server.d.ts +4 -0
  52. package/dist/dashboard/server.d.ts.map +1 -1
  53. package/dist/dashboard/server.js +453 -330
  54. package/dist/dashboard/server.js.map +1 -1
  55. package/dist/index.d.ts +11 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +12 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/types.d.ts +284 -1
  60. package/dist/types.d.ts.map +1 -1
  61. package/package.json +28 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <img src="docs/images/v5-banner.svg" alt="Agent Shadow Brain v5.0.0 — Infinite Intelligence Edition" width="100%">
3
+ <img src="banner.svg" alt="Agent Shadow Brain v5.1.1 — Hyper-Cognitive Intelligence Edition" width="100%">
4
4
 
5
5
  <br/>
6
6
 
@@ -11,16 +11,19 @@
11
11
  [![GitHub stars](https://img.shields.io/github/stars/theihtisham/agent-shadow-brain?color=f59e0b&labelColor=1a0a2e&style=for-the-badge&logo=github)](https://github.com/theihtisham/agent-shadow-brain/stargazers)
12
12
  [![arXiv](https://img.shields.io/badge/arXiv-2504.17033-ef4444?labelColor=1a0a2e&style=for-the-badge)](https://arxiv.org/abs/2504.17033)
13
13
  [![ICLR 2026](https://img.shields.io/badge/ICLR-2026_TurboQuant-06b6d4?labelColor=1a0a2e&style=for-the-badge)](https://openreview.net/forum?id=TbqSEUXWaO)
14
+ [![Zero Config](https://img.shields.io/badge/zero-config-auto_setup-22c55e?labelColor=1a0a2e&style=for-the-badge)](#)
15
+ [![MCP](https://img.shields.io/badge/MCP-Cursor_+_Claude-8b5cf6?labelColor=1a0a2e&style=for-the-badge)](#)
16
+ [![Dashboard](https://img.shields.io/badge/dashboard-real_time-06b6d4?labelColor=1a0a2e&style=for-the-badge)](#)
14
17
 
15
18
  <br/>
16
19
 
17
- ### **The World's First Infinite-Intelligence AI Coding Brain**
20
+ ### **The World's #1 Hyper-Cognitive AI Coding Brain**
18
21
 
19
- **Shadow Brain** is a self-evolving, infinite-memory intelligence layer for AI coding agents. It watches your code, applies **mathematically proven algorithms** from cutting-edge research, learns across sessions with **zero forgetting**, and makes every AI agent write **better, safer, faster code** — forever.
22
+ **Shadow Brain** is a zero-config, self-evolving, infinite-memory intelligence layer that makes **every AI coding agent** write better, safer, faster code. Install it once, and it automatically detects your project, your AI tools, your frameworks — and starts making your agents smarter forever.
20
23
 
21
- > **v5.0.0 — Infinite Intelligence Edition**: 4-tier hierarchical memory compression (raw → summary → pattern → principle), context-triggered associative recall, multi-agent consensus protocol with trust scoring, collective cross-project learning, TurboQuant 6x compression, SSSP O(m log<sup>2/3</sup>n) routing, self-evolving genetic rules, cross-agent protocol, adversarial hallucination defense, swarm intelligence, knowledge graph with PageRank, predictive bug forecasting.
24
+ > **v5.1.1 — Hyper-Cognitive Intelligence Edition**: 6 new brain modules — **Built-in LSP Server** for real-time IDE feedback, **Custom LLM Fine-Tuning Engine** to train on your codebase, **Smart Cache** with multi-tier predictive prefetch, **Intent Engine** for natural language command understanding, **Code DNA** fingerprinting with 9-gene analysis, and **Temporal Intelligence** for velocity tracking & bug prediction. Plus all v5.0.1 zero-config features (MCP server, dashboard, plugins, export/import), v5.0.0 infinite intelligence (hierarchical memory, consensus, collective learning), and v4.0.0 hyper-intelligence (TurboQuant, SSSP, self-evolution, adversarial defense, swarm, knowledge graph, predictive engine).
22
25
 
23
- [**Install Now**](#-getting-started) · [**v5.0.0 Modules**](#-v50-infinite-intelligence-engine) · [**Algorithms**](#-algorithms--research) · [**CLI Reference**](#-cli-reference) · [**Architecture**](#-architecture)
26
+ [**Install Now**](#-getting-started-30-seconds) · [**Dashboard**](#-web-dashboard) · [**v5.1.1 New**](#-v511-whats-new) · [**Algorithms**](#-algorithms--research) · [**CLI Reference**](#-cli-reference) · [**Architecture**](#-architecture)
24
27
 
25
28
  </div>
26
29
 
@@ -33,50 +36,364 @@ You use AI coding agents. They're powerful, but:
33
36
  | Problem | Impact |
34
37
  |---|---|
35
38
  | Agents **forget everything** between sessions | Same mistakes, zero learning |
36
- | Multiple agents **don't communicate** | Claude doesn't know what Cline learned |
39
+ | Multiple agents **don't communicate** | Claude doesn't know what Cursor learned |
37
40
  | Generated code has **hallucinations** | LLMs fabricate APIs that don't exist |
38
41
  | No **cross-session memory** | Every conversation starts from zero |
39
42
  | No **cross-project learning** | Discoveries in one project don't help others |
40
- | Agents can't **predict bugs** | Reactive, not proactive |
41
- | No **self-improvement** | Rules never get better on their own |
43
+ | Setup is **complicated** | 30 minutes of config before anything works |
44
+ | Each tool needs **separate config** | Claude, Cursor, Cline all need different setup |
42
45
 
43
46
  ## The Solution
44
47
 
45
- **Shadow Brain v5.0.0** runs alongside your agents as an *infinite-intelligence shadow layer*:
46
-
47
- ```
48
- ┌──────────────┐ watches ┌──────────────────────────────────────────┐ injects ┌──────────────┐
49
- │ AI Agents │ ─────────────▶ │ SHADOW BRAIN v5.0.0 │ ────────────▶ │ AI Agents │
50
- │ Claude Code │ file changes │ │ insights + │ Smarter │
51
- │ Kilo Code │ git commits │ ┌─ INFINITE MEMORY ──────────────────┐ │ context + │ Safer │
52
- │ Cline │ activity │ │ Hierarchical 4-tier compression │ │ fixes + │ Faster │
53
- │ OpenCode │ │ │ Context-Triggered Associative │ │ predictions │ Connected │
54
- │ Codex │ │ │ Recall — auto-activate memories │ │ │ Evolving │
55
- │ Roo Code │ │ └────────────────────────────────────┘ │ │ Predictive │
56
- │ Aider │ │ ┌─ MULTI-AGENT INTELLIGENCE ─────────┐ │ │ Trusted │
57
- └──────────────┘ │ │ Consensus Protocol — voting + │ │ │ Infinite │
58
- ▲ │ │ trust scoring + conflict resolve │ │ └──────────────┘
59
- │ │ │ Collective Learning — cross-project│ │ ▲
60
- │ │ │ rule sharing with verification │ │ │
61
- │ │ └────────────────────────────────────┘ │ │
62
- │ │ ┌─ HYPER-INTELLIGENCE (v4) ──────────┐ │ │
63
- │ │ │ TurboQuant ─── 6x Compression │ │ │
64
- │ │ │ SSSP BMSSP ─── Quantum Routing │ │ │
65
- │ │ │ Self-Evolution ─ Living Rules │ │ │
66
- │ │ │ CAIP ───────── Cross-Agent Sync │ │ │
67
- │ │ │ Swarm ──────── File Hotspots │ │ │
68
- │ │ │ PageRank ───── Impact Radar │ │ │
69
- │ │ │ Adversarial ── Trust Verification │ │ │
70
- │ │ └────────────────────────────────────┘ │ │
71
- └──────────────────────┴──────────────────────────────────────────┴───────────────────────┘
72
- shares insights across all agents via Cross-Agent Intelligence Protocol
48
+ **Shadow Brain v5.1.1** — zero-config, auto-detecting, infinite-intelligence shadow layer:
49
+
50
+ ```
51
+ ┌──────────────┐ auto-detect ┌──────────────────────────────────────────┐
52
+ │ AI Agents │ ◀──────────────── │ SHADOW BRAIN v5.1.1 │
53
+ │ Claude Code │ MCP auto-install │ │
54
+ │ Cursor │ zero-config │ ┌─ HYPER-COGNITIVE (v5.1.1 NEW) ────┐ │
55
+ │ Kilo Code │ │ │ Built-in LSP Server (stdio+TCP) │ │
56
+ │ Cline │ watches │ │ Custom LLM Fine-Tuning Engine │ │
57
+ │ OpenCode │ ──────────────▶ │ │ Smart Cache (hot/warm/cold tiers) │ │
58
+ │ Codex │ file changes │ │ Intent Engine (NLP commands) │ │
59
+ │ Roo Code │ git commits │ │ Code DNA (9-gene fingerprinting) │ │
60
+ │ Aider │ activity │ │ Temporal Intelligence (velocity) │ │
61
+ │ Windsurf │ │ └────────────────────────────────────┘ │
62
+ └──────────────┘ │ ┌─ ZERO-CONFIG (v5.0.1) ─────────────┐ │
63
+ ▲ │ │ Auto-detect + MCP + Dashboard │ │
64
+ │ │ │ Plugins + Export/Import + Hooks │ │
65
+ │ │ └────────────────────────────────────┘ │
66
+ │ │ ┌─ INFINITE MEMORY (v5.0.0) ────────┐ │
67
+ │ │ │ 4-tier hierarchical compression │ │
68
+ │ │ │ Context-triggered recall │ │
69
+ │ │ │ Multi-agent consensus + trust │ │
70
+ │ │ │ Collective cross-project learning │ │
71
+ │ │ └────────────────────────────────────┘ │
72
+ │ │ ┌─ HYPER-INTELLIGENCE (v4) ──────────┐ │
73
+ │ │ │ TurboQuant 6x Compression │ │
74
+ │ │ │ SSSP BMSSP Quantum Routing │ │
75
+ │ │ │ Self-Evolution + CAIP + Swarm │ │
76
+ │ │ │ PageRank + Predictive + Adversarial │ │
77
+ └──────────────────────────┴──────────────────────────────────────────┘
78
+ ```
79
+
80
+ ---
81
+
82
+ ## v5.1.1 — What's New
83
+
84
+ ### 6 Hyper-Cognitive Brain Modules
85
+
86
+ <table>
87
+ <tr>
88
+ <td width="50%">
89
+
90
+ ### Built-in LSP Server
91
+
92
+ **Language Server Protocol** — real-time IDE feedback without external tools.
93
+
94
+ Pure Node.js LSP server supporting stdio and TCP transport modes:
95
+ - **Diagnostics**: pushes brain insights as IDE warnings/errors
96
+ - **Hover**: shows code health info on hover
97
+ - **Code Actions**: quick-fix suggestions from brain analysis
98
+ - **Zero dependency**: no external LSP libraries required
99
+
100
+ ```bash
101
+ shadow-brain lsp --stdio # stdio mode (for editors)
102
+ shadow-brain lsp --tcp 2087 # TCP mode (for remote)
103
+ ```
104
+
105
+ ### Custom LLM Fine-Tuning Engine
106
+
107
+ **Train on your codebase** — your brain learns YOUR patterns.
108
+
109
+ Automatic training data generation from code changes, insights, and fixes:
110
+ - **Pair extraction**: before/after code → training pairs
111
+ - **Pattern mining**: recurring fix patterns → fine-tune examples
112
+ - **JSONL export**: ready for OpenAI, Anthropic, or local fine-tuning
113
+ - **Quality scoring**: only high-confidence pairs enter the dataset
114
+
115
+ ```bash
116
+ shadow-brain fine-tune status # Training data stats
117
+ shadow-brain fine-tune generate [dir] # Generate training pairs
118
+ shadow-brain fine-tune export [path] # Export JSONL dataset
119
+ ```
120
+
121
+ </td>
122
+ <td width="50%">
123
+
124
+ ### Smart Cache (Multi-Tier)
125
+
126
+ **Hot/Warm/Cold** — intelligent caching with predictive prefetch.
127
+
128
+ Three-tier LRU cache with automatic promotion and demotion:
129
+ - **Hot tier**: 200 entries, fastest access
130
+ - **Warm tier**: 1000 entries, promoted on repeated access
131
+ - **Cold tier**: 5000 entries, compressed storage
132
+ - **Predictive prefetch**: co-access graph predicts what you'll need next
133
+ - **Tag-based invalidation**: invalidate by category
134
+
135
+ ```bash
136
+ shadow-brain cache stats # Hit rate, tier sizes, memory usage
137
+ shadow-brain cache clear # Clear all tiers
138
+ ```
139
+
140
+ ### Intent Engine
141
+
142
+ **Natural language → brain actions** — understand what you mean.
143
+
144
+ Multi-strategy NLP command understanding:
145
+ - **Keyword matching**: fast path for common commands
146
+ - **Fuzzy matching**: handles typos and variations
147
+ - **Context-aware**: uses current file/project context
148
+ - **Confidence scoring**: routes to best-matching action
149
+
150
+ ```bash
151
+ shadow-brain intent "find security bugs" # Maps to: analyze + security filter
152
+ shadow-brain intent "show hot files" # Maps to: temporal + heatmap
153
+ ```
154
+
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td width="50%">
159
+
160
+ ### Code DNA Fingerprinting
161
+
162
+ **9-gene analysis** — every file gets a unique genetic profile.
163
+
164
+ Analyzes code across 9 gene categories to create a structural fingerprint:
165
+ - **Structure genes**: classes, functions, nesting depth
166
+ - **Complexity genes**: cyclomatic complexity, cognitive load
167
+ - **Style genes**: naming conventions, formatting patterns
168
+ - **Dependency genes**: import graph, coupling metrics
169
+ - **Evolution genes**: change frequency, stability score
170
+ - **Similarity matching**: find structurally similar files across projects
171
+
172
+ ```bash
173
+ shadow-brain dna analyze [dir] # Generate DNA profiles
174
+ shadow-brain dna compare f1 f2 # Compare two file fingerprints
175
+ shadow-brain dna similar [file] # Find similar files
176
+ ```
177
+
178
+ </td>
179
+ <td width="50%">
180
+
181
+ ### Temporal Intelligence
182
+
183
+ **Time-series code evolution** — velocity tracking & bug prediction.
184
+
185
+ Continuous monitoring of code change patterns over time:
186
+ - **Velocity metrics**: daily/weekly/monthly rates with trend detection
187
+ - **File heatmaps**: hotness scoring, churn risk, stability
188
+ - **Bug prediction**: 5-factor probability model per file
189
+ - **Anomaly detection**: burst detection, drought alerts, unusual hours
190
+ - **Peak analysis**: identifies your most productive hours and days
191
+
192
+ ```bash
193
+ shadow-brain temporal stats # Velocity, anomalies, predictions
194
+ shadow-brain temporal hot # Top 10 hottest files
195
+ shadow-brain temporal predict # Bug risk predictions
196
+ shadow-brain temporal timeline # Recent event timeline
197
+ ```
198
+
199
+ </td>
200
+ </tr>
201
+ </table>
202
+
203
+ ---
204
+
205
+ ## v5.0.1 — What's New
206
+
207
+ ### Zero-Config Auto-Setup
208
+
209
+ Install it. That's it. Shadow Brain automatically:
210
+
211
+ - Detects your project type (frontend, backend, fullstack, mobile, game, systems, data-science)
212
+ - Detects 25+ languages, 15+ frameworks, 5+ build tools, 5+ test frameworks
213
+ - Detects which AI tools are installed (Claude Code, Cursor, Kilo Code, Cline, OpenCode, Codex, Aider, Windsurf)
214
+ - Auto-installs MCP server configuration for every detected AI tool
215
+ - Auto-installs git pre-commit and pre-push hooks
216
+ - Generates an optimal brain config based on project complexity
217
+
218
+ ```bash
219
+ npm install @theihtisham/agent-shadow-brain
220
+ # → Shadow Brain v5.1.1 auto-configured for my-app (fullstack)
221
+ # → AI tools detected: Claude Code, Cursor
222
+ # → Run: shadow-brain start
223
+ ```
224
+
225
+ ### MCP Server — Works with EVERY AI Tool
226
+
227
+ The brain exposes itself as a **Model Context Protocol (MCP) server** with 19 tools that any AI tool can call:
228
+
229
+ | MCP Tool | What It Does |
230
+ |---|---|
231
+ | `brain_status` | Get full brain status |
232
+ | `brain_analyze` | Trigger code analysis |
233
+ | `brain_health` | Get health score (A-F) |
234
+ | `brain_insights` | Get recent insights |
235
+ | `brain_fixes` | Get smart fix suggestions |
236
+ | `brain_memory_store` | Store knowledge in hierarchical memory |
237
+ | `brain_memory_search` | Search across all memory tiers |
238
+ | `brain_memory_stats` | Memory compression statistics |
239
+ | `brain_recall` | Context-triggered associative recall |
240
+ | `brain_consensus_propose` | Submit a proposal for agent consensus |
241
+ | `brain_consensus_vote` | Vote on a pending proposal |
242
+ | `brain_collective_propose` | Propose a cross-project rule |
243
+ | `brain_collective_search` | Search collective learning rules |
244
+ | `brain_turbo_search` | Semantic search in compressed memory |
245
+ | `brain_predict` | Predict bug risk for files |
246
+ | `brain_graph_query` | Query knowledge graph |
247
+ | `brain_defense_scan` | Scan for hallucination patterns |
248
+ | `brain_evolve_status` | Get self-evolution status |
249
+ | `brain_dashboard_url` | Get dashboard URL |
250
+
251
+ Works with **Claude Code**, **Cursor**, **Kilo Code**, **Cline**, **OpenCode**, and any MCP-compatible AI tool.
252
+
253
+ ```bash
254
+ # Start MCP server (auto-started by AI tools)
255
+ shadow-brain mcp
256
+
257
+ # Cursor compatibility (root path POST + /v1/chat)
258
+ # Claude Code compatibility (JSON-RPC 2.0 over stdio/HTTP)
259
+ ```
260
+
261
+ ### Rich Web Dashboard
262
+
263
+ Real-time browser dashboard at `http://localhost:7341` with WebSocket live updates:
264
+
265
+ - **Stats Topbar**: 8 live counters — Insights, Fixes, Memory KB, Modules, AI Tools, Evolution Gen, Swarm Convergence, Turbo Compression
266
+ - **Health Score**: A-F grading with dimension breakdown (Security, Quality, Performance, Architecture, Maintainability, Test Coverage)
267
+ - **Memory Tiers**: Visual bars showing Raw (50K), Summary (10K), Pattern (2K), Principle (500) with Turbo compression ratio
268
+ - **Live Insights Stream**: Real-time feed of brain insights with priority badges
269
+ - **Smart Fixes**: Actionable fix suggestions with file/line references
270
+ - **AI Tools Panel**: 8 tools showing connected/detected status
271
+ - **Brain Modules**: 13 modules with active/idle/error indicators
272
+ - **Control Buttons**: Trigger analysis on-demand, refresh data
273
+
274
+ ```bash
275
+ shadow-brain start . # Dashboard auto-starts at http://localhost:7341
276
+ shadow-brain dash . # Dashboard only mode
277
+ ```
278
+
279
+ ### Natural Language Queries
280
+
281
+ Ask your brain questions in plain English:
282
+
283
+ ```bash
284
+ shadow-brain ask "What security issues exist in the auth module?"
285
+ shadow-brain ask "Which files have the highest bug risk?"
286
+ shadow-brain ask "What patterns have we learned about React hooks?"
287
+ ```
288
+
289
+ ### Brain Export/Import — Team Sync
290
+
291
+ Export your brain state and share it with your team:
292
+
293
+ ```bash
294
+ shadow-brain export # Full export with all modules
295
+ shadow-brain export -o ./team-brain # Custom output directory
296
+ shadow-brain import brain-export.json # Import + merge
297
+ shadow-brain import brain-export.json --merge --skip swarm,evolution
298
+ ```
299
+
300
+ ### Plugin System
301
+
302
+ Extend Shadow Brain with custom plugins:
303
+
304
+ ```bash
305
+ shadow-brain plugin list # List installed plugins
306
+ shadow-brain plugin create my-plugin # Create from template
307
+ shadow-brain plugin stats # Plugin system statistics
308
+ ```
309
+
310
+ Plugins can hook into `pre-analysis` and `post-analysis` pipelines to add custom insights, filter results, or integrate with external services.
311
+
312
+ ### 5 New Commands
313
+
314
+ ```bash
315
+ shadow-brain off # Clean shutdown
316
+ shadow-brain ask "..." # Natural language query
317
+ shadow-brain export # Export brain state
318
+ shadow-brain import FILE # Import brain state
319
+ shadow-brain plugin CMD # Plugin management
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Getting Started — 30 Seconds
325
+
326
+ ```bash
327
+ # Install globally
328
+ npm install -g @theihtisham/agent-shadow-brain
329
+
330
+ # Or use npx (no install needed)
331
+ npx @theihtisham/agent-shadow-brain start .
332
+ ```
333
+
334
+ That's literally it. Shadow Brain will:
335
+ 1. **Auto-detect** your project, languages, frameworks, AI tools (zero config)
336
+ 2. **Auto-install** MCP server config for Claude Code, Cursor, Kilo Code, Cline, etc.
337
+ 3. **Auto-install** git hooks for pre-commit and pre-push
338
+ 4. Watch your project files for changes
339
+ 5. Analyze every change with LLM + 22 brain modules
340
+ 6. Inject expert insights into your agent's memory
341
+ 7. Store all knowledge in hierarchical memory for infinite retention
342
+ 8. Activate past memories automatically based on context
343
+ 9. Share verified patterns across projects via collective learning
344
+ 10. Compress knowledge with TurboQuant for infinite retention
345
+ 11. Evolve its own rules via genetic algorithm
346
+ 12. Share insights across agents via CAIP
347
+ 13. Detect hallucinations with adversarial verification
348
+ 14. Run consensus when multiple agents disagree
349
+ 15. Serve a rich web dashboard at `localhost:7341`
350
+
351
+ ### Quick Review (No Watch Mode)
352
+
353
+ ```bash
354
+ shadow-brain review . # One-shot analysis
355
+ shadow-brain review . --show-health # + health score
356
+ shadow-brain review . --show-fixes # + fix suggestions
357
+ shadow-brain review . --output json # JSON for scripting
358
+ ```
359
+
360
+ ---
361
+
362
+ ## Web Dashboard
363
+
364
+ The v5.1.1 dashboard provides a real-time view into your brain:
365
+
366
+ ```
367
+ ┌──────────────────────────────────────────────────────────────────────────┐
368
+ │ Shadow Brain v5.1.1 [Analyze] [↻] │
369
+ ├──────────────────────────────────────────────────────────────────────────┤
370
+ │ Insights: 142 │ Fixes: 38 │ Memory: 247KB │ Modules: 22/22 │ ... │
371
+ ├──────────────┬─────────────────────────────────────┬───────────────────┤
372
+ │ Health: 87% │ Live Insights Stream │ AI Tools │
373
+ │ ████████░░ │ ● [HIGH] SQL injection in login.ts │ ● Claude Code ✓ │
374
+ │ Security: A │ ● [MED] Missing error handling │ ● Cursor ✓ │
375
+ │ Quality: B+ │ ● [LOW] Unused import in utils │ ● Kilo Code ✓ │
376
+ │ Perf: A- │ ● [CRIT] Exposed API key │ ● Cline — │
377
+ │ Arch: B │ │ ● OpenCode — │
378
+ │ Maintain: A ├─────────────────────────────────────┤ ● Codex — │
379
+ │ Tests: C+ │ Smart Fixes │ ● Aider — │
380
+ │ │ 1. Add parameterized query... │ ● Windsurf — │
381
+ ├──────────────┤ 2. Wrap in try/catch with... ├───────────────────┤
382
+ │ Memory Tiers │ 3. Remove unused import on L42 │ Brain Modules │
383
+ │ Raw: 8421 │ │ ● Hierarchical ✓ │
384
+ │ Summ: 1203 │ │ ● TurboMemory ✓ │
385
+ │ Patt: 187 │ │ ● Consensus ✓ │
386
+ │ Princ: 24 │ │ ● Swarm ✓ │
387
+ │ Turbo: 6.2x │ │ ● Evolution ✓ │
388
+ │ │ │ ● Adversarial ✓ │
389
+ └──────────────┴─────────────────────────────────────┴───────────────────┘
73
390
  ```
74
391
 
75
392
  ---
76
393
 
77
394
  ## v5.0.0 Infinite Intelligence Engine
78
395
 
79
- ### 4 New Breakthrough Modules
396
+ ### 4 Breakthrough Modules
80
397
 
81
398
  <table>
82
399
  <tr>
@@ -129,10 +446,10 @@ When multiple AI agents observe the same codebase, they may produce conflicting
129
446
  5. Tracks long-term agent trust based on proposal accuracy
130
447
 
131
448
  ```bash
132
- shadow-brain consensus status # 47 proposals | 89% acceptance rate
449
+ shadow-brain consensus status
133
450
  shadow-brain consensus propose "Use bcrypt for all password hashing" security 0.95
134
451
  shadow-brain consensus vote <id> agree 0.9 "Industry standard"
135
- shadow-brain consensus results # All resolved proposals
452
+ shadow-brain consensus results
136
453
  ```
137
454
 
138
455
  **Collective Learning** — discoveries flow across all projects.
@@ -145,9 +462,9 @@ When you discover a pattern in Project A, it becomes a verified rule available i
145
462
  - Trust scores for rule sources
146
463
 
147
464
  ```bash
148
- shadow-brain collective status # 234 rules | 12 categories
465
+ shadow-brain collective status
149
466
  shadow-brain collective propose "Always validate file upload MIME types" security
150
- shadow-brain collective search performance # Cross-project performance rules
467
+ shadow-brain collective search performance
151
468
  ```
152
469
 
153
470
  </td>
@@ -158,7 +475,7 @@ shadow-brain collective search performance # Cross-project performance rules
158
475
 
159
476
  ## v4.0.0 Hyper-Intelligence Engine
160
477
 
161
- ### 8 Breakthrough Modules (included in v5.0.0)
478
+ ### 8 Breakthrough Modules (included in v5.1.1)
162
479
 
163
480
  <table>
164
481
  <tr>
@@ -175,7 +492,7 @@ Based on Google Research's **TurboQuant** (ICLR 2026):
175
492
  - **Result**: Infinite retention — old knowledge is compressed, never deleted
176
493
 
177
494
  ```bash
178
- shadow-brain turbo stats # Compression stats
495
+ shadow-brain turbo stats
179
496
  shadow-brain turbo search "authentication patterns"
180
497
  ```
181
498
 
@@ -186,7 +503,7 @@ Based on **"Breaking the Sorting Barrier"** (arXiv 2504.17033, Duan et al.):
186
503
  - **Deterministic**: No randomization, provably correct
187
504
 
188
505
  ```bash
189
- shadow-brain route status # Mesh routing status
506
+ shadow-brain route status
190
507
  shadow-brain route find node-A node-B
191
508
  ```
192
509
 
@@ -200,8 +517,8 @@ shadow-brain route find node-A node-B
200
517
  - **Population**: 50 genetic rule chromosomes
201
518
  - **Selection**: Tournament (k=5) — survival of the fittest
202
519
  - **Crossover**: Single-point recombination
203
- - **Mutation**: Gaussian noise (Box-Muller transform, σ=0.1)
204
- - **Fitness**: accuracy × coverage × (1 / falsePositiveRate)
520
+ - **Mutation**: Gaussian noise (Box-Muller transform, sigma=0.1)
521
+ - **Fitness**: accuracy x coverage x (1 / falsePositiveRate)
205
522
 
206
523
  ```bash
207
524
  shadow-brain evolve status
@@ -211,7 +528,7 @@ shadow-brain evolve best-rules security
211
528
 
212
529
  **Cross-Agent Intelligence Protocol (CAIP)** — agents that talk to each other.
213
530
 
214
- Your Claude Code session learns what your Cline session discovered:
531
+ Your Claude Code session learns what your Cursor session discovered:
215
532
  - Zero-config broadcast protocol
216
533
  - Agent identification + insight tagging
217
534
  - Multi-agent consensus building
@@ -284,13 +601,13 @@ shadow-brain predict bugs .
284
601
 
285
602
  ## Algorithms & Research
286
603
 
287
- Shadow Brain v5.0.0 implements algorithms from **peer-reviewed research**:
604
+ Shadow Brain v5.1.1 implements algorithms from **peer-reviewed research**:
288
605
 
289
606
  | Algorithm | Paper / Origin | Application | Complexity |
290
607
  |---|---|---|---|
291
608
  | **Hierarchical Compression** | Novel 4-tier system | Infinite memory with drill-down | O(n) per tier |
292
- | **Associative Recall** | Spreading activation model | Context-triggered memory activation | O(n × k) |
293
- | **Consensus Protocol** | Byzantine fault tolerance | Multi-agent agreement with trust | O(v × log v) |
609
+ | **Associative Recall** | Spreading activation model | Context-triggered memory activation | O(n x k) |
610
+ | **Consensus Protocol** | Byzantine fault tolerance | Multi-agent agreement with trust | O(v x log v) |
294
611
  | **TurboQuant** | Google Research, ICLR 2026 | Vector compression (PolarQuant + QJL) | O(n) per vector |
295
612
  | **BMSSP (SSSP)** | arXiv 2504.17033, Duan et al. | Neural mesh message routing | O(m log<sup>2/3</sup> n) |
296
613
  | **Shannon Entropy** | Claude Shannon, 1948 | Cross-project insight relevance scoring | O(n) |
@@ -300,54 +617,30 @@ Shadow Brain v5.0.0 implements algorithms from **peer-reviewed research**:
300
617
  | **Tarjan's SCC** | Robert Tarjan, 1972 | Dependency cycle detection | O(V + E) |
301
618
  | **Winnowing** | Schleimer et al., 2003 | Code duplicate fingerprinting | O(n) |
302
619
  | **Box-Muller** | Box & Muller, 1958 | Gaussian mutation in genetic algorithm | O(1) per sample |
303
- | **Ant Colony (ACO)** | Dorigo, 1992 | File priority pheromone system | O(n × m) |
620
+ | **Ant Colony (ACO)** | Dorigo, 1992 | File priority pheromone system | O(n x m) |
304
621
  | **Tournament Selection** | Goldberg, 1989 | Genetic rule selection (k=5) | O(k) per selection |
305
622
 
306
623
  ### TurboQuant Pipeline Detail
307
624
 
308
625
  ```
309
626
  Input Vector (64-dim, float64)
310
- │
311
- ▼
312
- ┌─────────────┐
313
- │ PolarQuant │── Cartesian → Polar coordinates
314
- │ 2 bits/dim │── Quantize angles to 4 levels (2 bits each)
315
- └──────┬──────┘ Pack into Uint8Array
316
- │
317
- ▼
318
- ┌─────────────┐
319
- │ QJL Residual│── Random rotation (Hadamard-like)
320
- │ 1 bit/dim │── Sign extraction (1 bit per dim)
321
- └──────┬──────┘ Pack into Uint8Array
322
- │
323
- ▼
627
+ |
628
+ v
629
+ +-------------+
630
+ | PolarQuant |-- Cartesian -> Polar coordinates
631
+ | 2 bits/dim |-- Quantize angles to 4 levels (2 bits each)
632
+ +------+-------+ Pack into Uint8Array
633
+ |
634
+ v
635
+ +-------------+
636
+ | QJL Residual|-- Random rotation (Hadamard-like)
637
+ | 1 bit/dim |-- Sign extraction (1 bit per dim)
638
+ +------+-------+ Pack into Uint8Array
639
+ |
640
+ v
324
641
  TurboVector { polar: Uint8Array, qjl: Uint8Array, dim: number, radius: number }
325
642
  = 3 bits/dim total = 6x compression from float64
326
- = ZERO FORGETTING — compressed knowledge stays searchable forever
327
- ```
328
-
329
- ### Hierarchical Memory Drill-Down
330
-
331
- ```
332
- ┌─────────────┐
333
- │ PRINCIPLE │ 500 entries — timeless design rules
334
- │ (top tier) │ "Always validate inputs at system boundaries"
335
- └──────┬──────┘
336
- │ drill-down
337
- ┌──────┴──────┐
338
- │ PATTERN │ 2K entries — recurring patterns
339
- │ │ "Input validation pattern: zod schema → middleware → handler"
340
- └──────┬──────┘
341
- │ drill-down
342
- ┌──────┴──────┐
343
- │ SUMMARY │ 10K entries — condensed key points
344
- │ │ "auth/login.ts uses JWT with bcrypt — verified secure"
345
- └──────┬──────┘
346
- │ drill-down
347
- ┌──────┴──────┐
348
- │ RAW │ 50K entries — full detail, hot path
349
- │ (base tier) │ Complete analysis of login.ts with all evidence
350
- └─────────────┘
643
+ = ZERO FORGETTING -- compressed knowledge stays searchable forever
351
644
  ```
352
645
 
353
646
  ---
@@ -356,7 +649,30 @@ Input Vector (64-dim, float64)
356
649
 
357
650
  <table>
358
651
  <tr>
359
- <td width="25%">
652
+ <td width="20%">
653
+
654
+ ### Hyper-Cognitive (v5.1.1)
655
+ - Built-in LSP Server
656
+ - Custom LLM Fine-Tuning
657
+ - Smart Cache (3-tier)
658
+ - Intent Engine (NLP)
659
+ - Code DNA Fingerprinting
660
+ - Temporal Intelligence
661
+
662
+ </td>
663
+ <td width="20%">
664
+
665
+ ### Zero Config (v5.0.1)
666
+ - Auto-detect project + tools
667
+ - MCP for ALL AI tools
668
+ - Rich web dashboard
669
+ - Natural language queries
670
+ - Plugin system
671
+ - Brain export/import
672
+ - Git hook auto-install
673
+
674
+ </td>
675
+ <td width="20%">
360
676
 
361
677
  ### Infinite Intelligence (v5)
362
678
  - 4-tier hierarchical memory
@@ -365,7 +681,7 @@ Input Vector (64-dim, float64)
365
681
  - Collective cross-project learning
366
682
 
367
683
  </td>
368
- <td width="25%">
684
+ <td width="20%">
369
685
 
370
686
  ### Hyper-Intelligence (v4)
371
687
  - TurboQuant infinite memory
@@ -378,25 +694,17 @@ Input Vector (64-dim, float64)
378
694
  - Predictive bug forecasting
379
695
 
380
696
  </td>
381
- <td width="25%">
382
-
383
- ### Real-Time Intelligence
384
- - File watching (chokidar)
385
- - Git monitoring (commits, diffs)
386
- - LLM analysis (Anthropic, OpenAI, Ollama)
387
- - Pattern memory across sessions
388
- - Learning engine (automatic)
389
-
390
- </td>
391
- <td width="25%">
697
+ <td width="20%">
392
698
 
393
699
  ### Developer Experience
394
- - **45+ CLI commands** — full terminal control
395
- - MCP Server — Model Context Protocol
396
- - Web dashboard — `localhost:7341`
397
- - Terminal UI — Ink/React dashboard
398
- - Pre-commit hooks — block bad commits
399
- - GitHub Actions — CI integration
700
+ - **60+ CLI commands**
701
+ - MCP Server (19 tools)
702
+ - Built-in LSP Server
703
+ - Web dashboard (real-time)
704
+ - Terminal UI (Ink/React)
705
+ - Pre-commit hooks
706
+ - GitHub Actions CI
707
+ - Plugin architecture
400
708
 
401
709
  </td>
402
710
  </tr>
@@ -406,18 +714,27 @@ Input Vector (64-dim, float64)
406
714
 
407
715
  ## Architecture
408
716
 
409
- <img src="docs/images/v5-banner.svg" alt="v5.0.0 Architecture Overview" width="100%">
410
-
411
- ### v5.0.0 Module Map
717
+ ### v5.1.1 Module Map (22 modules)
412
718
 
413
719
  | Module | File | What It Does | Since |
414
720
  |---|---|---|---|
415
- | **Hierarchical Memory** | `brain/hierarchical-memory.ts` | 4-tier infinite memory with drill-down | v5.0.0 |
416
- | **Context Recall** | `brain/context-recall.ts` | Associative memory activation engine | v5.0.0 |
417
- | **Consensus Engine** | `brain/consensus-engine.ts` | Multi-agent voting + trust scoring | v5.0.0 |
721
+ | **LSP Server** | `brain/lsp-server.ts` | Built-in Language Server Protocol (stdio+TCP) | v5.1.1 |
722
+ | **Fine-Tuning Engine** | `brain/fine-tuning-engine.ts` | Custom LLM training data generation | v5.1.1 |
723
+ | **Smart Cache** | `brain/smart-cache.ts` | Multi-tier caching with predictive prefetch | v5.1.1 |
724
+ | **Intent Engine** | `brain/intent-engine.ts` | Natural language command understanding | v5.1.1 |
725
+ | **Code DNA** | `brain/code-dna.ts` | 9-gene code fingerprinting + similarity | v5.1.1 |
726
+ | **Temporal Intelligence** | `brain/temporal-intelligence.ts` | Velocity tracking, heatmaps, bug prediction | v5.1.1 |
727
+ | **Auto Setup** | `brain/auto-setup.ts` | Zero-config project + tool detection | v5.0.1 |
728
+ | **MCP Server** | `brain/mcp-server.ts` | 19-tool MCP server for all AI tools | v5.0.1 |
729
+ | **Plugin System** | `brain/plugin-system.ts` | Hookable analysis pipeline | v5.0.1 |
730
+ | **Brain Portability** | `brain/brain-portability.ts` | Export/import brain state | v5.0.1 |
731
+ | **Dashboard** | `dashboard/server.ts` | Real-time WebSocket dashboard | v5.0.1 |
732
+ | **Hierarchical Memory** | `brain/hierarchical-memory.ts` | 4-tier infinite memory | v5.0.0 |
733
+ | **Context Recall** | `brain/context-recall.ts` | Associative memory activation | v5.0.0 |
734
+ | **Consensus Engine** | `brain/consensus-engine.ts` | Multi-agent voting + trust | v5.0.0 |
418
735
  | **Collective Learning** | `brain/collective-learning.ts` | Cross-project rule sharing | v5.0.0 |
419
736
  | **TurboMemory** | `brain/turbo-memory.ts` | 6x compressed infinite memory | v4.0.0 |
420
- | **SSSP Router** | `brain/sssp-router.ts` | Sub-sorting-complexity routing | v4.0.0 |
737
+ | **SSSP Router** | `brain/sssp-router.ts` | Sub-sorting routing | v4.0.0 |
421
738
  | **Self-Evolution** | `brain/self-evolution.ts` | Genetic rule optimization | v4.0.0 |
422
739
  | **Cross-Agent** | `brain/cross-agent-protocol.ts` | Multi-agent broadcast | v4.0.0 |
423
740
  | **Adversarial** | `brain/adversarial-defense.ts` | Hallucination detection | v4.0.0 |
@@ -427,110 +744,14 @@ Input Vector (64-dim, float64)
427
744
 
428
745
  ---
429
746
 
430
- ## Getting Started
431
-
432
- ### Install
433
-
434
- ```bash
435
- # Install globally
436
- npm install -g @theihtisham/agent-shadow-brain
437
-
438
- # Or use with npx (no install needed)
439
- npx @theihtisham/agent-shadow-brain review .
440
- ```
441
-
442
- ### One-Command Setup
443
-
444
- ```bash
445
- shadow-brain setup
446
- ```
447
-
448
- ### Start Watching
449
-
450
- ```bash
451
- shadow-brain start .
452
- ```
453
-
454
- That's it. Shadow Brain will:
455
- 1. Auto-detect which AI agents are running (7 supported)
456
- 2. Watch your project files for changes
457
- 3. Analyze every change with LLM + mathematical algorithms
458
- 4. Inject expert insights into your agent's memory
459
- 5. Store all knowledge in hierarchical memory for infinite retention
460
- 6. Activate past memories automatically based on context
461
- 7. Share verified patterns across projects via collective learning
462
- 8. Compress knowledge with TurboQuant for infinite retention
463
- 9. Evolve its own rules via genetic algorithm
464
- 10. Share insights across agents via CAIP
465
- 11. Detect hallucinations with adversarial verification
466
- 12. Run consensus when multiple agents disagree
467
-
468
- ### Quick Review (No Watch Mode)
469
-
470
- ```bash
471
- shadow-brain review . # One-shot analysis
472
- shadow-brain review . --show-health # + health score
473
- shadow-brain review . --show-fixes # + fix suggestions
474
- shadow-brain review . --output json # JSON for scripting
475
- ```
476
-
477
- ### v5.0.0 Commands
478
-
479
- ```bash
480
- # Infinite hierarchical memory
481
- shadow-brain memory stats # 4-tier compression stats
482
- shadow-brain memory store "knowledge" # Store at raw tier
483
- shadow-brain memory search "auth" # Cross-tier search
484
-
485
- # Context-triggered recall
486
- shadow-brain recall . --file src/auth.ts --keywords "jwt,token"
487
-
488
- # Multi-agent consensus
489
- shadow-brain consensus status # Proposal + trust stats
490
- shadow-brain consensus propose "..." security 0.95
491
- shadow-brain consensus vote <id> agree 0.9 "Reason"
492
- shadow-brain consensus results # All resolved proposals
493
-
494
- # Collective cross-project learning
495
- shadow-brain collective status # Rule count + categories
496
- shadow-brain collective propose "Rule" security
497
- shadow-brain collective search performance
498
-
499
- # Run EVERYTHING at once
500
- shadow-brain v5 . # Full v5.0.0 infinite-intelligence analysis
501
- ```
502
-
503
- ### v4.0.0 Commands (still available)
504
-
505
- ```bash
506
- shadow-brain turbo stats # TurboQuant compression stats
507
- shadow-brain turbo search "auth" # Semantic search in compressed memory
508
- shadow-brain route status # SSSP mesh routing status
509
- shadow-brain route find node-A node-B # Shortest path between brain nodes
510
- shadow-brain caip status # Connected agents
511
- shadow-brain caip broadcast "message" # Broadcast to all agents
512
- shadow-brain evolve status # Genetic algorithm stats
513
- shadow-brain evolve run # Evolve one generation
514
- shadow-brain evolve best-rules security # Top evolved security rules
515
- shadow-brain predict bugs . # Bug risk scoring
516
- shadow-brain graph build . # Build + PageRank
517
- shadow-brain graph pagerank # Top impact entities
518
- shadow-brain swarm status # Convergence + pheromone stats
519
- shadow-brain swarm priorities # File hotspot ranking
520
- shadow-brain defense status # Accuracy + blocked count
521
- shadow-brain defense scan "claim text" # Verify a specific claim
522
- shadow-brain v4 . # Full v4.0.0 hyper-analysis
523
- ```
524
-
525
- ---
526
-
527
747
  ## CLI Reference
528
748
 
529
749
  ### Core Commands
530
750
 
531
751
  | Command | Description |
532
752
  |---|---|
533
- | `shadow-brain start [dir]` | Start real-time watching |
753
+ | `shadow-brain start [dir]` | Start real-time watching + dashboard + MCP |
754
+ | `shadow-brain off` | Clean shutdown |
534
755
  | `shadow-brain review [dir]` | One-shot code analysis |
535
756
  | `shadow-brain health [dir]` | Health score (A-F grading) |
536
757
  | `shadow-brain fix [dir]` | Smart fix suggestions |
@@ -542,10 +763,43 @@ shadow-brain v4 . # Full v4.0.0 hyper-analysis
542
763
  | `shadow-brain ci [dir]` | GitHub Actions workflow |
543
764
  | `shadow-brain hook [dir]` | Pre-commit hook |
544
765
  | `shadow-brain dash [dir]` | Web dashboard |
766
+ | `shadow-brain mcp` | MCP server mode |
545
767
  | `shadow-brain inject <msg>` | Inject into agent memory |
546
768
  | `shadow-brain status` | Current configuration |
547
769
  | `shadow-brain setup` | Interactive setup wizard |
548
770
  | `shadow-brain doctor` | Health check & diagnostics |
771
+ | `shadow-brain ask <question>` | Natural language brain query |
772
+
773
+ ### v5.1.1 Hyper-Cognitive Commands (NEW)
774
+
775
+ | Command | Description |
776
+ |---|---|
777
+ | `shadow-brain lsp [--stdio\|--tcp PORT]` | Start built-in LSP server |
778
+ | `shadow-brain fine-tune status` | Fine-tuning training data stats |
779
+ | `shadow-brain fine-tune generate [dir]` | Generate training pairs from code |
780
+ | `shadow-brain fine-tune export [path]` | Export JSONL dataset for fine-tuning |
781
+ | `shadow-brain cache stats` | Smart cache hit rate, tier sizes, memory |
782
+ | `shadow-brain cache clear` | Clear all cache tiers |
783
+ | `shadow-brain intent <text>` | Parse natural language intent |
784
+ | `shadow-brain dna analyze [dir]` | Generate Code DNA profiles |
785
+ | `shadow-brain dna compare <f1> <f2>` | Compare two file fingerprints |
786
+ | `shadow-brain dna similar <file>` | Find structurally similar files |
787
+ | `shadow-brain temporal stats` | Velocity, anomalies, predictions |
788
+ | `shadow-brain temporal hot` | Top 10 hottest files by churn |
789
+ | `shadow-brain temporal predict` | Bug risk predictions |
790
+ | `shadow-brain temporal timeline` | Recent event timeline |
791
+
792
+ ### v5.0.1 Commands
793
+
794
+ | Command | Description |
795
+ |---|---|
796
+ | `shadow-brain off` | Clean shutdown of all brain processes |
797
+ | `shadow-brain ask <question>` | Natural language query to the brain |
798
+ | `shadow-brain export [-o dir]` | Export full brain state to JSON |
799
+ | `shadow-brain import <file> [--merge]` | Import brain state |
800
+ | `shadow-brain plugin list` | List installed plugins |
801
+ | `shadow-brain plugin create <name>` | Create plugin from template |
802
+ | `shadow-brain plugin stats` | Plugin system statistics |
549
803
 
550
804
  ### v5.0.0 Infinite Intelligence Commands
551
805
 
@@ -585,28 +839,6 @@ shadow-brain v4 . # Full v4.0.0 hyper-analysis
585
839
  | `shadow-brain defense scan <text>` | Scan text for hallucination patterns |
586
840
  | `shadow-brain v4 [dir]` | Run ALL v4.0.0 analyses |
587
841
 
588
- ### Super-Intelligence Commands (v2.0+)
589
-
590
- | Command | Description |
591
- |---|---|
592
- | `shadow-brain semantic [dir]` | Symbol extraction, dead code |
593
- | `shadow-brain deps [dir]` | Dependency graph, cycles, hubs |
594
- | `shadow-brain duplicates [dir]` | Duplicate code detection |
595
- | `shadow-brain adr [dir]` | Architecture Decision Records |
596
- | `shadow-brain typesafety [dir]` | TypeScript type analysis |
597
- | `shadow-brain perf [dir]` | Performance profiling |
598
- | `shadow-brain knowledge [dir]` | Project knowledge base |
599
- | `shadow-brain learn [dir]` | Extract patterns & lessons |
600
-
601
- ### Neural Mesh Commands (v2.1+)
602
-
603
- | Command | Description |
604
- |---|---|
605
- | `shadow-brain mesh status` | Mesh state + quantum state |
606
- | `shadow-brain mesh insights` | Cross-session insights |
607
- | `shadow-brain mesh knowledge` | Shared knowledge base |
608
- | `shadow-brain mesh nodes` | Connected brain nodes |
609
-
610
842
  ---
611
843
 
612
844
  ## Programmatic API
@@ -614,10 +846,23 @@ shadow-brain v4 . # Full v4.0.0 hyper-analysis
614
846
  ```typescript
615
847
  import {
616
848
  Orchestrator,
849
+ // v5.1.1 — Hyper-Cognitive modules
850
+ LSPServer,
851
+ FineTuningEngine,
852
+ SmartCache,
853
+ IntentEngine,
854
+ CodeDNA,
855
+ TemporalIntelligence,
856
+ // v5.0.1 — Zero-Config modules
857
+ AutoSetup,
858
+ PluginSystem,
859
+ BrainPortability,
860
+ // v5.0.0 — Infinite Intelligence modules
617
861
  HierarchicalMemory,
618
862
  ContextRecall,
619
863
  ConsensusEngine,
620
864
  CollectiveLearning,
865
+ // v4.0.0 — Hyper-Intelligence modules
621
866
  TurboMemory,
622
867
  SSSPRouter,
623
868
  SelfEvolution,
@@ -629,20 +874,56 @@ import {
629
874
  NeuralMesh,
630
875
  } from '@theihtisham/agent-shadow-brain';
631
876
 
877
+ // v5.1.1 — Built-in LSP server
878
+ const lsp = new LSPServer('./my-project');
879
+ lsp.start({ mode: 'tcp', port: 2087 }); // or { mode: 'stdio' }
880
+
881
+ // v5.1.1 — Smart Cache
882
+ const cache = new SmartCache({ maxHotEntries: 200, enablePrefetch: true });
883
+ cache.set('analysis:auth', analysisResult, { ttl: 300_000, tags: ['security'] });
884
+ const cached = cache.get('analysis:auth');
885
+
886
+ // v5.1.1 — Temporal Intelligence
887
+ const temporal = new TemporalIntelligence('./my-project');
888
+ temporal.recordCommit(['src/auth.ts'], 'fix: JWT rotation');
889
+ const velocity = temporal.getVelocity(); // { daily, weekly, trend: 'accelerating' }
890
+ const bugRisks = temporal.predictBugs(10);
891
+
892
+ // v5.1.1 — Code DNA
893
+ const dna = new CodeDNA('./my-project');
894
+ const profile = await dna.analyze('src/auth.ts');
895
+ const similar = await dna.findSimilar('src/auth.ts', 5);
896
+
897
+ // v5.0.1 — Zero-config auto-setup
898
+ const setup = new AutoSetup('./my-project');
899
+ const config = await setup.detect();
900
+ // → { projectType: 'fullstack', languages: ['typescript','python'], frameworks: ['next.js'], aiTools: [...] }
901
+ await setup.installMCPForTools(['Claude Code', 'Cursor']);
902
+ await setup.installGitHooks();
903
+
632
904
  // Create the brain
633
905
  const brain = new Orchestrator({
634
906
  provider: 'anthropic',
635
907
  projectDir: './my-project',
636
- agents: ['claude-code', 'cline', 'roo-code'],
908
+ agents: ['claude-code', 'cursor', 'cline'],
637
909
  watchMode: true,
638
910
  autoInject: true,
639
911
  brainPersonality: 'balanced',
640
912
  });
641
913
 
914
+ // v5.0.1 — Plugin system
915
+ const plugins = new PluginSystem('./my-project');
916
+ await plugins.loadAll();
917
+ await plugins.preAnalysis({ files: ['src/auth.ts'], projectDir: './my-project' });
918
+
919
+ // v5.0.1 — Brain portability
920
+ const porter = new BrainPortability('./my-project');
921
+ const { filePath, sizeBytes, checksum } = await porter.exportBrain();
922
+
642
923
  // v5.0.0 — Infinite Intelligence
643
924
  const hmem = new HierarchicalMemory();
644
925
  await hmem.store('JWT rotation pattern: rotate every 24h with refresh tokens', 'security', 0.9);
645
- const results = hmem.search('jwt'); // Cross-tier search
926
+ const results = hmem.search('jwt');
646
927
 
647
928
  const recall = new ContextRecall(hmem);
648
929
  const activated = recall.recall({
@@ -651,27 +932,10 @@ const activated = recall.recall({
651
932
  recentEdits: ['src/auth/login.ts', 'src/middleware/auth.ts'],
652
933
  projectType: 'node',
653
934
  keywords: ['jwt', 'authentication', 'session'],
654
- timeOfDay: 14,
655
- dayOfWeek: 2,
656
935
  });
657
936
 
658
937
  const consensus = new ConsensusEngine('my-agent');
659
938
  const proposalId = consensus.propose('Use bcrypt cost factor 12', 'security', 0.95);
660
- consensus.vote(proposalId, 'agree', 0.9, 'Industry standard per OWASP');
661
-
662
- const collective = new CollectiveLearning();
663
- collective.proposeRule('Validate file upload MIME types', 'security', 'my-agent', ['./uploads']);
664
-
665
- // v4.0.0 — Direct module access
666
- const turbo = new TurboMemory({ maxEntries: 100000 });
667
- await turbo.store('auth-pattern', vector, { category: 'security' });
668
-
669
- const evolution = new SelfEvolution({ populationSize: 50 });
670
- const snapshot = await evolution.evolve(insights);
671
-
672
- const kg = new KnowledgeGraph('./my-project');
673
- await kg.build();
674
- const topEntities = kg.getTopEntities(10);
675
939
 
676
940
  // Start everything
677
941
  await brain.start();
@@ -694,14 +958,36 @@ await brain.start();
694
958
 
695
959
  ## Version History
696
960
 
697
- ### v5.0.0 — Infinite Intelligence Edition (Current)
698
- - **Hierarchical Memory Compression** — 4-tier pyramid (raw → summary → pattern → principle) with drill-down/up
699
- - **Context-Triggered Associative Recall** — automatic memory activation based on file paths, keywords, categories, co-occurrence networks
700
- - **Multi-Agent Consensus Protocol** — trust-weighted voting, confidence intervals, conflict resolution, long-term trust scoring
701
- - **Collective Cross-Project Learning** — verified rule sharing, viral propagation, accuracy tracking, category-based organization
961
+ ### v5.1.1 — Hyper-Cognitive Intelligence Edition (Current)
962
+ - **Built-in LSP Server** — pure Node.js Language Server Protocol with stdio + TCP modes, diagnostics, hover, code actions
963
+ - **Custom LLM Fine-Tuning Engine** — automatic training data generation from code changes, JSONL export for fine-tuning
964
+ - **Smart Cache** — 3-tier (hot/warm/cold) LRU cache with predictive prefetch, co-access graph, tag-based invalidation
965
+ - **Intent Engine** — multi-strategy NLP command understanding with keyword, fuzzy, and context-aware matching
966
+ - **Code DNA Fingerprinting** — 9-gene structural analysis (structure, complexity, style, dependency, evolution genes)
967
+ - **Temporal Intelligence** — velocity metrics, file heatmaps, 5-factor bug prediction, anomaly detection, peak analysis
968
+ - **6 new CLI commands** — lsp, fine-tune, cache, intent, dna, temporal
969
+ - **22 brain modules total** — 6 new + 16 existing from v5.0.1
970
+ - All v5.0.1, v5.0.0, and v4.0.0 features included and enhanced
971
+
972
+ ### v5.0.1 — Zero-Config Intelligence Edition
973
+ - **Zero-Config Auto-Setup** — auto-detect project, AI tools, languages, frameworks; auto-install MCP config + git hooks
974
+ - **MCP Server** — 19-tool Model Context Protocol server for Claude Code, Cursor, and all AI tools
975
+ - **Rich Web Dashboard** — real-time WebSocket dashboard with 8 panels (health, memory tiers, insights, fixes, AI tools, modules, stats, controls)
976
+ - **Natural Language Queries** — `shadow-brain ask "..."` for plain-English brain interaction
977
+ - **Plugin System** — hookable analysis pipeline with npm plugin discovery
978
+ - **Brain Export/Import** — full brain state portability for team sync and backup
979
+ - **5 new CLI commands** — off, ask, export, import, plugin
980
+ - **Cursor MCP Compatibility** — root path POST + /v1/chat endpoint support
981
+ - **Postinstall Auto-Setup** — runs automatically after npm install
982
+ - **50+ npm keywords** for discoverability
983
+ - All v5.0.0 and v4.0.0 features included and enhanced
984
+
985
+ ### v5.0.0 — Infinite Intelligence Edition
986
+ - **Hierarchical Memory Compression** — 4-tier pyramid (raw -> summary -> pattern -> principle) with drill-down/up
987
+ - **Context-Triggered Associative Recall** — automatic memory activation based on file paths, keywords, categories
988
+ - **Multi-Agent Consensus Protocol** — trust-weighted voting, confidence intervals, conflict resolution
989
+ - **Collective Cross-Project Learning** — verified rule sharing, viral propagation, accuracy tracking
702
990
  - **5 new CLI commands** — memory, recall, consensus, collective, v5
703
- - **4 new modules**, 2,000+ lines of new code
704
- - All v4.0.0 features included and enhanced
705
991
 
706
992
  ### v4.0.0 — Hyper-Intelligence Edition
707
993
  - **TurboQuant Infinite Memory** — 6x compression, zero forgetting (Google Research, ICLR 2026)
@@ -712,42 +998,34 @@ await brain.start();
712
998
  - **Swarm Intelligence** — Ant Colony pheromone file prioritization
713
999
  - **Knowledge Graph + PageRank** — code impact radar with d=0.85 damping
714
1000
  - **Predictive Engine** — bug risk scoring, debt forecasting, anomaly detection
715
- - **9 new CLI commands** — turbo, route, caip, evolve, predict, graph, swarm, defense, v4
716
1001
 
717
1002
  ### v3.0.0 — Hyper-Intelligence Edition
718
- - Cognitive load analysis
719
- - Security audit engine
720
- - Influence map (cross-file impact)
1003
+ - Cognitive load analysis, security audit engine, influence map
721
1004
 
722
1005
  ### v2.1.0 — Quantum Neural Mesh
723
- - Cross-session shared intelligence
724
- - Shannon entropy relevance scoring
725
- - Cosine similarity knowledge dedup
726
- - Bayesian confidence updating
1006
+ - Cross-session shared intelligence, Shannon entropy, cosine similarity, Bayesian confidence
727
1007
 
728
1008
  ### v2.0.0 — Super-Intelligence Edition
729
- - Semantic analyzer, dependency graph, code similarity
730
- - ADR engine, type safety, performance profiler
731
- - MCP Server, team mode, multi-project
1009
+ - Semantic analyzer, dependency graph, code similarity, MCP Server, team mode
732
1010
 
733
1011
  ### v1.x — Foundation
734
- - 7 agent adapters, health scoring, smart fixes
735
- - Vulnerability scanning, custom rules, notifications
736
- - CI/CD integration, pre-commit hooks
1012
+ - 7 agent adapters, health scoring, smart fixes, vulnerability scanning, CI/CD
737
1013
 
738
1014
  ---
739
1015
 
740
- ## Supported Agents
1016
+ ## Supported Agents & Tools
741
1017
 
742
- | Agent | Status | Injection Target |
743
- |---|---|---|
744
- | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | Full Support | `CLAUDE.md`, `.claude/` |
745
- | [Kilo Code](https://kilocode.ai/) | Full Support | `.kilocode/rules.md` |
746
- | [Cline](https://github.com/cline/cline) | Full Support | `.clinerules` |
747
- | [OpenCode](https://github.com/opencode-ai/opencode) | Full Support | `AGENT.md` |
748
- | [Codex](https://github.com/openai/codex) | Full Support | `AGENTS.md` |
749
- | [Roo Code](https://roocode.com/) | Full Support | `.roo/rules.md` |
750
- | [Aider](https://aider.chat/) | Full Support | `.aider.conf.yml` |
1018
+ | Agent | Status | MCP Support | Injection Target |
1019
+ |---|---|---|---|
1020
+ | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | Full Support | Auto-install | `CLAUDE.md`, `.claude/` |
1021
+ | [Cursor](https://cursor.sh/) | Full Support | Auto-install | `.cursor/mcp.json` |
1022
+ | [Kilo Code](https://kilocode.ai/) | Full Support | Auto-install | `.kilocode/rules.md` |
1023
+ | [Cline](https://github.com/cline/cline) | Full Support | Auto-install | `.clinerules` |
1024
+ | [OpenCode](https://github.com/opencode-ai/opencode) | Full Support | Yes | `AGENT.md` |
1025
+ | [Codex](https://github.com/openai/codex) | Full Support | Yes | `AGENTS.md` |
1026
+ | [Roo Code](https://roocode.com/) | Full Support | Yes | `.roo/rules.md` |
1027
+ | [Aider](https://aider.chat/) | Full Support | Yes | `.aider.conf.yml` |
1028
+ | [Windsurf](https://codeium.com/windsurf) | Detection | Yes | `.windsurfrules` |
751
1029
 
752
1030
  ---
753
1031
 
@@ -776,11 +1054,16 @@ npm test
776
1054
  - [x] ~~Context-triggered associative recall~~ (v5.0)
777
1055
  - [x] ~~Multi-agent consensus protocol~~ (v5.0)
778
1056
  - [x] ~~Collective cross-project learning~~ (v5.0)
779
- - [ ] **IDE extensions** — VS Code extension for inline insights
780
- - [ ] **Custom LLM fine-tuning** — train on your codebase patterns
781
- - [ ] **Docker image** — one-command containerized deployment
782
- - [ ] **Web dashboard v2** — React-based interactive analytics
783
- - [ ] **Language server** — LSP protocol for real-time feedback
1057
+ - [x] ~~Zero-config auto-setup~~ (v5.0.1)
1058
+ - [x] ~~MCP server for Cursor + all tools~~ (v5.0.1)
1059
+ - [x] ~~Rich web dashboard with real-time WebSocket~~ (v5.0.1)
1060
+ - [x] ~~Plugin system + brain export/import~~ (v5.0.1)
1061
+ - [x] ~~Custom LLM fine-tuning~~ (v5.1.1)
1062
+ - [x] ~~Language server (LSP)~~ (v5.1.1)
1063
+ - [x] ~~Web dashboard v3~~ (v5.1.1)
1064
+ - [ ] **Visual Studio Code integration** — inline insight overlays
1065
+ - [ ] **Multi-model orchestration** — route insights through multiple LLMs
1066
+ - [ ] **Real-time collaboration** — team brain with live cursors
784
1067
 
785
1068
  ---
786
1069
 
@@ -807,6 +1090,6 @@ MIT License — see [LICENSE](LICENSE) for details.
807
1090
 
808
1091
  **Built with brains by [theihtisham](https://github.com/theihtisham)**
809
1092
 
810
- **Topics:** `ai` `artificial-intelligence` `llm` `claude-code` `cline` `kilo-code` `codex` `roo-code` `aider` `opencode` `code-review` `static-analysis` `developer-tools` `npm-package` `typescript` `ollama` `openai` `anthropic` `code-quality` `security-scanner` `health-score` `smart-fix` `vulnerability-scanner` `pattern-learning` `agent-tools` `ai-agent` `code-metrics` `pre-commit-hook` `github-actions` `developer-productivity` `neural-mesh` `quantum-computing` `shannon-entropy` `bayesian-inference` `mcp-server` `semantic-analysis` `dependency-graph` `turboquant` `sssp-algorithm` `genetic-algorithm` `swarm-intelligence` `pagerank` `knowledge-graph` `hallucination-detection` `cross-agent` `self-evolving` `predictive-engine` `ant-colony` `infinite-memory` `vector-compression` `iclr-2026` `arxiv` `super-intelligence` `hyper-intelligence` `autonomous-agents` `ai-engineering` `agentic-coding` `vibe-coding` `hierarchical-memory` `context-recall` `consensus-engine` `collective-learning` `infinite-intelligence`
1093
+ **Topics:** `ai` `artificial-intelligence` `llm` `claude-code` `cursor` `cline` `kilo-code` `codex` `roo-code` `aider` `opencode` `windsurf` `code-review` `static-analysis` `developer-tools` `npm-package` `typescript` `ollama` `openai` `anthropic` `code-quality` `security-scanner` `health-score` `smart-fix` `vulnerability-scanner` `pattern-learning` `agent-tools` `ai-agent` `code-metrics` `pre-commit-hook` `github-actions` `developer-productivity` `neural-mesh` `quantum-computing` `shannon-entropy` `bayesian-inference` `mcp-server` `model-context-protocol` `semantic-analysis` `dependency-graph` `turboquant` `sssp-algorithm` `genetic-algorithm` `swarm-intelligence` `pagerank` `knowledge-graph` `hallucination-detection` `cross-agent` `self-evolving` `predictive-engine` `ant-colony` `infinite-memory` `vector-compression` `iclr-2026` `arxiv` `super-intelligence` `hyper-intelligence` `autonomous-agents` `ai-engineering` `agentic-coding` `vibe-coding` `cursor-ai` `zero-config` `auto-setup` `dashboard` `plugin-system` `brain-export` `natural-language` `real-time` `websocket` `team-collaboration` `ci-cd` `open-source` `trending` `hierarchical-memory` `context-recall` `consensus-engine` `collective-learning` `infinite-intelligence` `coding-assistant` `lsp-server` `language-server-protocol` `fine-tuning` `smart-cache` `intent-engine` `code-dna` `temporal-intelligence` `hyper-cognitive`
811
1094
 
812
1095
  </div>