@theihtisham/agent-shadow-brain 4.0.2 → 5.0.0
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 +288 -154
- package/dist/brain/collective-learning.d.ts +54 -0
- package/dist/brain/collective-learning.d.ts.map +1 -0
- package/dist/brain/collective-learning.js +357 -0
- package/dist/brain/collective-learning.js.map +1 -0
- package/dist/brain/consensus-engine.d.ts +65 -0
- package/dist/brain/consensus-engine.d.ts.map +1 -0
- package/dist/brain/consensus-engine.js +385 -0
- package/dist/brain/consensus-engine.js.map +1 -0
- package/dist/brain/context-recall.d.ts +49 -0
- package/dist/brain/context-recall.d.ts.map +1 -0
- package/dist/brain/context-recall.js +502 -0
- package/dist/brain/context-recall.js.map +1 -0
- package/dist/brain/hierarchical-memory.d.ts +49 -0
- package/dist/brain/hierarchical-memory.d.ts.map +1 -0
- package/dist/brain/hierarchical-memory.js +451 -0
- package/dist/brain/hierarchical-memory.js.map +1 -0
- package/dist/brain/orchestrator.d.ts +34 -0
- package/dist/brain/orchestrator.d.ts.map +1 -1
- package/dist/brain/orchestrator.js +83 -1
- package/dist/brain/orchestrator.js.map +1 -1
- package/dist/cli.js +253 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +122 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="docs/images/
|
|
3
|
+
<img src="docs/images/v5-banner.svg" alt="Agent Shadow Brain v5.0.0 — Infinite Intelligence Edition" width="100%">
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
<br/>
|
|
16
16
|
|
|
17
|
-
### **The World's First
|
|
17
|
+
### **The World's First Infinite-Intelligence AI Coding Brain**
|
|
18
18
|
|
|
19
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.
|
|
20
20
|
|
|
21
|
-
> **
|
|
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.
|
|
22
22
|
|
|
23
|
-
[**Install Now**](#-getting-started) · [**
|
|
23
|
+
[**Install Now**](#-getting-started) · [**v5.0.0 Modules**](#-v50-infinite-intelligence-engine) · [**Algorithms**](#-algorithms--research) · [**CLI Reference**](#-cli-reference) · [**Architecture**](#-architecture)
|
|
24
24
|
|
|
25
25
|
</div>
|
|
26
26
|
|
|
@@ -36,35 +36,129 @@ You use AI coding agents. They're powerful, but:
|
|
|
36
36
|
| Multiple agents **don't communicate** | Claude doesn't know what Cline learned |
|
|
37
37
|
| Generated code has **hallucinations** | LLMs fabricate APIs that don't exist |
|
|
38
38
|
| No **cross-session memory** | Every conversation starts from zero |
|
|
39
|
+
| No **cross-project learning** | Discoveries in one project don't help others |
|
|
39
40
|
| Agents can't **predict bugs** | Reactive, not proactive |
|
|
40
41
|
| No **self-improvement** | Rules never get better on their own |
|
|
41
42
|
|
|
42
43
|
## The Solution
|
|
43
44
|
|
|
44
|
-
**Shadow Brain
|
|
45
|
+
**Shadow Brain v5.0.0** runs alongside your agents as an *infinite-intelligence shadow layer*:
|
|
45
46
|
|
|
46
47
|
```
|
|
47
|
-
┌──────────────┐ watches
|
|
48
|
-
│ AI Agents │ ─────────────▶ │
|
|
49
|
-
│ Claude Code │ file changes │
|
|
50
|
-
│ Kilo Code │ git commits │
|
|
51
|
-
│ Cline │ activity │
|
|
52
|
-
│ OpenCode │ │
|
|
53
|
-
│ Codex │ │
|
|
54
|
-
│ Roo Code │ │
|
|
55
|
-
│ Aider │ │
|
|
56
|
-
└──────────────┘ │
|
|
57
|
-
▲
|
|
58
|
-
│
|
|
59
|
-
|
|
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
|
+
└──────────────────────┴──────────────────────────────────────────┴───────────────────────┘
|
|
60
72
|
shares insights across all agents via Cross-Agent Intelligence Protocol
|
|
61
73
|
```
|
|
62
74
|
|
|
63
75
|
---
|
|
64
76
|
|
|
77
|
+
## v5.0.0 Infinite Intelligence Engine
|
|
78
|
+
|
|
79
|
+
### 4 New Breakthrough Modules
|
|
80
|
+
|
|
81
|
+
<table>
|
|
82
|
+
<tr>
|
|
83
|
+
<td width="50%">
|
|
84
|
+
|
|
85
|
+
### Infinite Memory Layer
|
|
86
|
+
|
|
87
|
+
**Hierarchical Memory Compression** — 4-tier pyramid that never forgets.
|
|
88
|
+
|
|
89
|
+
Knowledge flows through compression tiers as it ages:
|
|
90
|
+
- **Raw** (50K entries) — full detail, hot path
|
|
91
|
+
- **Summary** (10K) — condensed key points
|
|
92
|
+
- **Pattern** (2K) — recurring patterns extracted
|
|
93
|
+
- **Principle** (500) — timeless design rules
|
|
94
|
+
|
|
95
|
+
Drill-down and drill-up between tiers. Older knowledge compresses, never deletes.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
shadow-brain memory stats # 4 tiers | 12,847 entries
|
|
99
|
+
shadow-brain memory store "..." # Store new knowledge
|
|
100
|
+
shadow-brain memory search "auth" # Cross-tier semantic search
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Context-Triggered Associative Recall** — memories that activate themselves.
|
|
104
|
+
|
|
105
|
+
Instead of requiring explicit search queries, this engine monitors your current work context and automatically surfaces relevant past knowledge:
|
|
106
|
+
- File path pattern matching (editing `auth/*.ts` → security memories)
|
|
107
|
+
- Keyword detection (typing "database" → SQL pattern memories)
|
|
108
|
+
- Category association (bug-fix context → past fix patterns)
|
|
109
|
+
- Co-occurrence networks (memories activated together strengthen their link)
|
|
110
|
+
- Learned trigger patterns that improve with use
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
shadow-brain recall . --file src/auth/login.ts --keywords "jwt,session"
|
|
114
|
+
# → Activates 8 memories | Top: "JWT rotation pattern (92%)"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
</td>
|
|
118
|
+
<td width="50%">
|
|
119
|
+
|
|
120
|
+
### Multi-Agent Intelligence Layer
|
|
121
|
+
|
|
122
|
+
**Consensus Engine** — voting, trust scoring, conflict resolution.
|
|
123
|
+
|
|
124
|
+
When multiple AI agents observe the same codebase, they may produce conflicting insights. This engine:
|
|
125
|
+
1. Collects proposals from agents
|
|
126
|
+
2. Opens voting windows (agree/disagree/abstain with confidence)
|
|
127
|
+
3. Computes trust-weighted agreement scores
|
|
128
|
+
4. Resolves conflicts via confidence intervals
|
|
129
|
+
5. Tracks long-term agent trust based on proposal accuracy
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
shadow-brain consensus status # 47 proposals | 89% acceptance rate
|
|
133
|
+
shadow-brain consensus propose "Use bcrypt for all password hashing" security 0.95
|
|
134
|
+
shadow-brain consensus vote <id> agree 0.9 "Industry standard"
|
|
135
|
+
shadow-brain consensus results # All resolved proposals
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Collective Learning** — discoveries flow across all projects.
|
|
139
|
+
|
|
140
|
+
When you discover a pattern in Project A, it becomes a verified rule available in Project B:
|
|
141
|
+
- Rule proposal with evidence and verification
|
|
142
|
+
- Viral propagation across connected brain instances
|
|
143
|
+
- Accuracy tracking per rule (tested vs. false positive)
|
|
144
|
+
- Category-based organization (security, performance, architecture...)
|
|
145
|
+
- Trust scores for rule sources
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
shadow-brain collective status # 234 rules | 12 categories
|
|
149
|
+
shadow-brain collective propose "Always validate file upload MIME types" security
|
|
150
|
+
shadow-brain collective search performance # Cross-project performance rules
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
</td>
|
|
154
|
+
</tr>
|
|
155
|
+
</table>
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
65
159
|
## v4.0.0 Hyper-Intelligence Engine
|
|
66
160
|
|
|
67
|
-
### 8
|
|
161
|
+
### 8 Breakthrough Modules (included in v5.0.0)
|
|
68
162
|
|
|
69
163
|
<table>
|
|
70
164
|
<tr>
|
|
@@ -77,11 +171,11 @@ You use AI coding agents. They're powerful, but:
|
|
|
77
171
|
Based on Google Research's **TurboQuant** (ICLR 2026):
|
|
78
172
|
- **PolarQuant**: 2 bits per dimension (polar coordinate quantization)
|
|
79
173
|
- **QJL Residual**: 1 bit per dimension (random rotation + sign)
|
|
80
|
-
- **Total**: 3 bits/dim = **6x compression** with
|
|
174
|
+
- **Total**: 3 bits/dim = **6x compression** with <1% accuracy loss
|
|
81
175
|
- **Result**: Infinite retention — old knowledge is compressed, never deleted
|
|
82
176
|
|
|
83
177
|
```bash
|
|
84
|
-
shadow-brain turbo stats #
|
|
178
|
+
shadow-brain turbo stats # Compression stats
|
|
85
179
|
shadow-brain turbo search "authentication patterns"
|
|
86
180
|
```
|
|
87
181
|
|
|
@@ -90,11 +184,10 @@ shadow-brain turbo search "authentication patterns"
|
|
|
90
184
|
Based on **"Breaking the Sorting Barrier"** (arXiv 2504.17033, Duan et al.):
|
|
91
185
|
- **BMSSP Algorithm**: O(m log<sup>2/3</sup> n) — breaks the sorting barrier
|
|
92
186
|
- **Deterministic**: No randomization, provably correct
|
|
93
|
-
- **Application**: Neural mesh messages find optimal paths between brain nodes
|
|
94
187
|
|
|
95
188
|
```bash
|
|
96
|
-
shadow-brain route status #
|
|
97
|
-
shadow-brain route find node-A node-B
|
|
189
|
+
shadow-brain route status # Mesh routing status
|
|
190
|
+
shadow-brain route find node-A node-B
|
|
98
191
|
```
|
|
99
192
|
|
|
100
193
|
</td>
|
|
@@ -104,18 +197,16 @@ shadow-brain route find node-A node-B # → [node-A, node-C, node-B]
|
|
|
104
197
|
|
|
105
198
|
**Genetic Algorithm Self-Evolution** — rules that write themselves.
|
|
106
199
|
|
|
107
|
-
Inspired by evolutionary computation:
|
|
108
200
|
- **Population**: 50 genetic rule chromosomes
|
|
109
201
|
- **Selection**: Tournament (k=5) — survival of the fittest
|
|
110
202
|
- **Crossover**: Single-point recombination
|
|
111
203
|
- **Mutation**: Gaussian noise (Box-Muller transform, σ=0.1)
|
|
112
204
|
- **Fitness**: accuracy × coverage × (1 / falsePositiveRate)
|
|
113
|
-
- **Meta-Learning**: Bayesian updating per (strategy, category) pair
|
|
114
205
|
|
|
115
206
|
```bash
|
|
116
|
-
shadow-brain evolve status
|
|
117
|
-
shadow-brain evolve run
|
|
118
|
-
shadow-brain evolve best-rules security
|
|
207
|
+
shadow-brain evolve status
|
|
208
|
+
shadow-brain evolve run
|
|
209
|
+
shadow-brain evolve best-rules security
|
|
119
210
|
```
|
|
120
211
|
|
|
121
212
|
**Cross-Agent Intelligence Protocol (CAIP)** — agents that talk to each other.
|
|
@@ -126,8 +217,8 @@ Your Claude Code session learns what your Cline session discovered:
|
|
|
126
217
|
- Multi-agent consensus building
|
|
127
218
|
|
|
128
219
|
```bash
|
|
129
|
-
shadow-brain caip status
|
|
130
|
-
shadow-brain caip broadcast "Security pattern detected
|
|
220
|
+
shadow-brain caip status
|
|
221
|
+
shadow-brain caip broadcast "Security pattern detected"
|
|
131
222
|
```
|
|
132
223
|
|
|
133
224
|
</td>
|
|
@@ -139,27 +230,23 @@ shadow-brain caip broadcast "Security pattern detected in auth/"
|
|
|
139
230
|
|
|
140
231
|
**Adversarial Hallucination Defense** — trust nothing, verify everything.
|
|
141
232
|
|
|
142
|
-
LLMs hallucinate. Shadow Brain catches it:
|
|
143
233
|
- Cross-reference every critical insight against actual code
|
|
144
234
|
- Evidence scoring with confidence thresholds
|
|
145
235
|
- Verdict: `real` | `hallucinated` | `uncertain`
|
|
146
|
-
- Tracks accuracy, false positive rate, blocked count
|
|
147
236
|
|
|
148
237
|
```bash
|
|
149
|
-
shadow-brain defense status
|
|
238
|
+
shadow-brain defense status
|
|
150
239
|
shadow-brain defense scan "This API endpoint exists at /api/v2/users"
|
|
151
240
|
```
|
|
152
241
|
|
|
153
242
|
**Swarm Intelligence** — Ant Colony Optimization for file prioritization.
|
|
154
243
|
|
|
155
|
-
Files with more bugs get more pheromone. Analysis focuses where it matters:
|
|
156
244
|
- Pheromone deposit: +3 for critical, +2 for high, +1 for medium
|
|
157
245
|
- Evaporation: decay over time to avoid staleness
|
|
158
|
-
- Convergence score: measures how focused the swarm is
|
|
159
246
|
|
|
160
247
|
```bash
|
|
161
|
-
shadow-brain swarm status
|
|
162
|
-
shadow-brain swarm priorities
|
|
248
|
+
shadow-brain swarm status
|
|
249
|
+
shadow-brain swarm priorities
|
|
163
250
|
```
|
|
164
251
|
|
|
165
252
|
</td>
|
|
@@ -169,27 +256,24 @@ shadow-brain swarm priorities # Top 10 hotspot files
|
|
|
169
256
|
|
|
170
257
|
**Knowledge Graph + PageRank** — code impact radar.
|
|
171
258
|
|
|
172
|
-
Builds a directed graph of code entities, then runs **PageRank** (d=0.85):
|
|
173
259
|
- Identify high-impact files (change one, break many)
|
|
174
260
|
- Cycle detection in dependency graphs
|
|
175
261
|
- Entity extraction with file/line tracking
|
|
176
262
|
|
|
177
263
|
```bash
|
|
178
|
-
shadow-brain graph build .
|
|
179
|
-
shadow-brain graph pagerank
|
|
180
|
-
shadow-brain graph cycles
|
|
264
|
+
shadow-brain graph build .
|
|
265
|
+
shadow-brain graph pagerank
|
|
266
|
+
shadow-brain graph cycles
|
|
181
267
|
```
|
|
182
268
|
|
|
183
269
|
**Predictive Engine** — predict bugs before they happen.
|
|
184
270
|
|
|
185
|
-
Analyzes code age, churn rate, staleness, and author patterns:
|
|
186
271
|
- Bug risk scoring: `low` | `medium` | `high` | `critical`
|
|
187
272
|
- Technical debt forecasting
|
|
188
273
|
- Anomaly detection in change patterns
|
|
189
|
-
- Factors: days since modification, lines changed, churn rate, staleness
|
|
190
274
|
|
|
191
275
|
```bash
|
|
192
|
-
shadow-brain predict bugs .
|
|
276
|
+
shadow-brain predict bugs .
|
|
193
277
|
```
|
|
194
278
|
|
|
195
279
|
</td>
|
|
@@ -200,11 +284,14 @@ shadow-brain predict bugs . # 3 high-risk files detected
|
|
|
200
284
|
|
|
201
285
|
## Algorithms & Research
|
|
202
286
|
|
|
203
|
-
Shadow Brain
|
|
287
|
+
Shadow Brain v5.0.0 implements algorithms from **peer-reviewed research**:
|
|
204
288
|
|
|
205
289
|
| Algorithm | Paper / Origin | Application | Complexity |
|
|
206
290
|
|---|---|---|---|
|
|
207
|
-
| **
|
|
291
|
+
| **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) |
|
|
294
|
+
| **TurboQuant** | Google Research, ICLR 2026 | Vector compression (PolarQuant + QJL) | O(n) per vector |
|
|
208
295
|
| **BMSSP (SSSP)** | arXiv 2504.17033, Duan et al. | Neural mesh message routing | O(m log<sup>2/3</sup> n) |
|
|
209
296
|
| **Shannon Entropy** | Claude Shannon, 1948 | Cross-project insight relevance scoring | O(n) |
|
|
210
297
|
| **Bayesian Inference** | Thomas Bayes, 1763 | Confidence updating, meta-learning | O(1) per update |
|
|
@@ -215,7 +302,6 @@ Shadow Brain v4.0.0 implements algorithms from **peer-reviewed research**:
|
|
|
215
302
|
| **Box-Muller** | Box & Muller, 1958 | Gaussian mutation in genetic algorithm | O(1) per sample |
|
|
216
303
|
| **Ant Colony (ACO)** | Dorigo, 1992 | File priority pheromone system | O(n × m) |
|
|
217
304
|
| **Tournament Selection** | Goldberg, 1989 | Genetic rule selection (k=5) | O(k) per selection |
|
|
218
|
-
| **Polar Coordinates** | Classical mathematics | Vector compression via angle quantization | O(n) |
|
|
219
305
|
|
|
220
306
|
### TurboQuant Pipeline Detail
|
|
221
307
|
|
|
@@ -240,17 +326,28 @@ Input Vector (64-dim, float64)
|
|
|
240
326
|
= ZERO FORGETTING — compressed knowledge stays searchable forever
|
|
241
327
|
```
|
|
242
328
|
|
|
243
|
-
###
|
|
329
|
+
### Hierarchical Memory Drill-Down
|
|
244
330
|
|
|
245
331
|
```
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
+
└─────────────┘
|
|
254
351
|
```
|
|
255
352
|
|
|
256
353
|
---
|
|
@@ -259,73 +356,48 @@ BMSSP (2025): O(m log^(2/3) n) ── BREAKS THE SORTING BARRIER
|
|
|
259
356
|
|
|
260
357
|
<table>
|
|
261
358
|
<tr>
|
|
262
|
-
<td width="
|
|
359
|
+
<td width="25%">
|
|
263
360
|
|
|
264
|
-
###
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
269
|
-
- Learning engine (automatic)
|
|
270
|
-
|
|
271
|
-
</td>
|
|
272
|
-
<td width="33%">
|
|
273
|
-
|
|
274
|
-
### Security & Quality
|
|
275
|
-
- Vulnerability scanner
|
|
276
|
-
- Custom rules engine (regex)
|
|
277
|
-
- Framework presets (React, Next.js, Django, FastAPI)
|
|
278
|
-
- Smart fix engine with confidence scores
|
|
279
|
-
- Type safety analyzer
|
|
361
|
+
### Infinite Intelligence (v5)
|
|
362
|
+
- 4-tier hierarchical memory
|
|
363
|
+
- Context-triggered recall
|
|
364
|
+
- Multi-agent consensus
|
|
365
|
+
- Collective cross-project learning
|
|
280
366
|
|
|
281
367
|
</td>
|
|
282
|
-
<td width="
|
|
368
|
+
<td width="25%">
|
|
283
369
|
|
|
284
|
-
###
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
-
|
|
289
|
-
-
|
|
370
|
+
### Hyper-Intelligence (v4)
|
|
371
|
+
- TurboQuant infinite memory
|
|
372
|
+
- SSSP quantum routing
|
|
373
|
+
- Self-evolving genetic rules
|
|
374
|
+
- Cross-agent protocol (CAIP)
|
|
375
|
+
- Adversarial defense
|
|
376
|
+
- Swarm intelligence (ACO)
|
|
377
|
+
- Knowledge Graph + PageRank
|
|
378
|
+
- Predictive bug forecasting
|
|
290
379
|
|
|
291
380
|
</td>
|
|
292
|
-
|
|
293
|
-
<tr>
|
|
294
|
-
<td width="33%">
|
|
381
|
+
<td width="25%">
|
|
295
382
|
|
|
296
|
-
###
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
- Roo Code → `.roo/rules.md`
|
|
303
|
-
- Aider → `.aider.conf.yml`
|
|
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)
|
|
304
389
|
|
|
305
390
|
</td>
|
|
306
|
-
<td width="
|
|
391
|
+
<td width="25%">
|
|
307
392
|
|
|
308
393
|
### Developer Experience
|
|
309
|
-
- **
|
|
394
|
+
- **45+ CLI commands** — full terminal control
|
|
310
395
|
- MCP Server — Model Context Protocol
|
|
311
396
|
- Web dashboard — `localhost:7341`
|
|
312
397
|
- Terminal UI — Ink/React dashboard
|
|
313
398
|
- Pre-commit hooks — block bad commits
|
|
314
399
|
- GitHub Actions — CI integration
|
|
315
400
|
|
|
316
|
-
</td>
|
|
317
|
-
<td width="33%">
|
|
318
|
-
|
|
319
|
-
### v4.0.0 Hyper-Intelligence
|
|
320
|
-
- TurboQuant infinite memory
|
|
321
|
-
- SSSP quantum routing
|
|
322
|
-
- Self-evolving genetic rules
|
|
323
|
-
- Cross-agent protocol (CAIP)
|
|
324
|
-
- Adversarial hallucination defense
|
|
325
|
-
- Swarm intelligence (ACO)
|
|
326
|
-
- Knowledge Graph + PageRank
|
|
327
|
-
- Predictive bug forecasting
|
|
328
|
-
|
|
329
401
|
</td>
|
|
330
402
|
</tr>
|
|
331
403
|
</table>
|
|
@@ -334,20 +406,24 @@ BMSSP (2025): O(m log^(2/3) n) ── BREAKS THE SORTING BARRIER
|
|
|
334
406
|
|
|
335
407
|
## Architecture
|
|
336
408
|
|
|
337
|
-
<img src="docs/images/
|
|
409
|
+
<img src="docs/images/v5-banner.svg" alt="v5.0.0 Architecture Overview" width="100%">
|
|
338
410
|
|
|
339
|
-
###
|
|
411
|
+
### v5.0.0 Module Map
|
|
340
412
|
|
|
341
|
-
| Module | File | What It Does |
|
|
413
|
+
| Module | File | What It Does | Since |
|
|
342
414
|
|---|---|---|---|
|
|
343
|
-
| **
|
|
344
|
-
| **
|
|
345
|
-
| **
|
|
346
|
-
| **
|
|
347
|
-
| **
|
|
348
|
-
| **
|
|
349
|
-
| **
|
|
350
|
-
| **
|
|
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 |
|
|
418
|
+
| **Collective Learning** | `brain/collective-learning.ts` | Cross-project rule sharing | v5.0.0 |
|
|
419
|
+
| **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 |
|
|
421
|
+
| **Self-Evolution** | `brain/self-evolution.ts` | Genetic rule optimization | v4.0.0 |
|
|
422
|
+
| **Cross-Agent** | `brain/cross-agent-protocol.ts` | Multi-agent broadcast | v4.0.0 |
|
|
423
|
+
| **Adversarial** | `brain/adversarial-defense.ts` | Hallucination detection | v4.0.0 |
|
|
424
|
+
| **Swarm** | `brain/swarm-intelligence.ts` | File priority pheromones | v4.0.0 |
|
|
425
|
+
| **Knowledge Graph** | `brain/knowledge-graph.ts` | PageRank impact analysis | v4.0.0 |
|
|
426
|
+
| **Predictive** | `brain/predictive-engine.ts` | Bug risk & debt forecasting | v4.0.0 |
|
|
351
427
|
|
|
352
428
|
---
|
|
353
429
|
|
|
@@ -380,10 +456,14 @@ That's it. Shadow Brain will:
|
|
|
380
456
|
2. Watch your project files for changes
|
|
381
457
|
3. Analyze every change with LLM + mathematical algorithms
|
|
382
458
|
4. Inject expert insights into your agent's memory
|
|
383
|
-
5.
|
|
384
|
-
6.
|
|
385
|
-
7. Share
|
|
386
|
-
8.
|
|
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
|
|
387
467
|
|
|
388
468
|
### Quick Review (No Watch Mode)
|
|
389
469
|
|
|
@@ -394,42 +474,51 @@ shadow-brain review . --show-fixes # + fix suggestions
|
|
|
394
474
|
shadow-brain review . --output json # JSON for scripting
|
|
395
475
|
```
|
|
396
476
|
|
|
397
|
-
###
|
|
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)
|
|
398
504
|
|
|
399
505
|
```bash
|
|
400
|
-
# Infinite memory
|
|
401
506
|
shadow-brain turbo stats # TurboQuant compression stats
|
|
402
507
|
shadow-brain turbo search "auth" # Semantic search in compressed memory
|
|
403
|
-
|
|
404
|
-
# Quantum routing
|
|
405
508
|
shadow-brain route status # SSSP mesh routing status
|
|
406
509
|
shadow-brain route find node-A node-B # Shortest path between brain nodes
|
|
407
|
-
|
|
408
|
-
# Cross-agent protocol
|
|
409
510
|
shadow-brain caip status # Connected agents
|
|
410
511
|
shadow-brain caip broadcast "message" # Broadcast to all agents
|
|
411
|
-
|
|
412
|
-
# Self-evolution
|
|
413
512
|
shadow-brain evolve status # Genetic algorithm stats
|
|
414
513
|
shadow-brain evolve run # Evolve one generation
|
|
415
514
|
shadow-brain evolve best-rules security # Top evolved security rules
|
|
416
|
-
|
|
417
|
-
# Predictive engine
|
|
418
515
|
shadow-brain predict bugs . # Bug risk scoring
|
|
419
|
-
|
|
420
|
-
# Knowledge graph
|
|
421
516
|
shadow-brain graph build . # Build + PageRank
|
|
422
517
|
shadow-brain graph pagerank # Top impact entities
|
|
423
|
-
|
|
424
|
-
# Swarm intelligence
|
|
425
518
|
shadow-brain swarm status # Convergence + pheromone stats
|
|
426
519
|
shadow-brain swarm priorities # File hotspot ranking
|
|
427
|
-
|
|
428
|
-
# Adversarial defense
|
|
429
520
|
shadow-brain defense status # Accuracy + blocked count
|
|
430
521
|
shadow-brain defense scan "claim text" # Verify a specific claim
|
|
431
|
-
|
|
432
|
-
# Run EVERYTHING at once
|
|
433
522
|
shadow-brain v4 . # Full v4.0.0 hyper-analysis
|
|
434
523
|
```
|
|
435
524
|
|
|
@@ -458,6 +547,23 @@ shadow-brain v4 . # Full v4.0.0 hyper-analysis
|
|
|
458
547
|
| `shadow-brain setup` | Interactive setup wizard |
|
|
459
548
|
| `shadow-brain doctor` | Health check & diagnostics |
|
|
460
549
|
|
|
550
|
+
### v5.0.0 Infinite Intelligence Commands
|
|
551
|
+
|
|
552
|
+
| Command | Description |
|
|
553
|
+
|---|---|
|
|
554
|
+
| `shadow-brain memory stats` | 4-tier hierarchical memory stats |
|
|
555
|
+
| `shadow-brain memory store <text>` | Store knowledge at raw tier |
|
|
556
|
+
| `shadow-brain memory search <query>` | Cross-tier semantic search |
|
|
557
|
+
| `shadow-brain recall . --file <f>` | Context-triggered associative recall |
|
|
558
|
+
| `shadow-brain consensus status` | Multi-agent consensus stats |
|
|
559
|
+
| `shadow-brain consensus propose <text> <cat> <conf>` | Submit proposal for voting |
|
|
560
|
+
| `shadow-brain consensus vote <id> <vote> <conf> <reason>` | Vote on a proposal |
|
|
561
|
+
| `shadow-brain consensus results` | All resolved proposals |
|
|
562
|
+
| `shadow-brain collective status` | Cross-project rule stats |
|
|
563
|
+
| `shadow-brain collective propose <text> <cat>` | Propose a collective rule |
|
|
564
|
+
| `shadow-brain collective search <cat>` | Search collective rules by category |
|
|
565
|
+
| `shadow-brain v5 [dir]` | Run ALL v5.0.0 analyses |
|
|
566
|
+
|
|
461
567
|
### v4.0.0 Hyper-Intelligence Commands
|
|
462
568
|
|
|
463
569
|
| Command | Description |
|
|
@@ -508,6 +614,10 @@ shadow-brain v4 . # Full v4.0.0 hyper-analysis
|
|
|
508
614
|
```typescript
|
|
509
615
|
import {
|
|
510
616
|
Orchestrator,
|
|
617
|
+
HierarchicalMemory,
|
|
618
|
+
ContextRecall,
|
|
619
|
+
ConsensusEngine,
|
|
620
|
+
CollectiveLearning,
|
|
511
621
|
TurboMemory,
|
|
512
622
|
SSSPRouter,
|
|
513
623
|
SelfEvolution,
|
|
@@ -529,28 +639,40 @@ const brain = new Orchestrator({
|
|
|
529
639
|
brainPersonality: 'balanced',
|
|
530
640
|
});
|
|
531
641
|
|
|
642
|
+
// v5.0.0 — Infinite Intelligence
|
|
643
|
+
const hmem = new HierarchicalMemory();
|
|
644
|
+
await hmem.store('JWT rotation pattern: rotate every 24h with refresh tokens', 'security', 0.9);
|
|
645
|
+
const results = hmem.search('jwt'); // Cross-tier search
|
|
646
|
+
|
|
647
|
+
const recall = new ContextRecall(hmem);
|
|
648
|
+
const activated = recall.recall({
|
|
649
|
+
currentFile: 'src/auth/login.ts',
|
|
650
|
+
currentCategory: 'security',
|
|
651
|
+
recentEdits: ['src/auth/login.ts', 'src/middleware/auth.ts'],
|
|
652
|
+
projectType: 'node',
|
|
653
|
+
keywords: ['jwt', 'authentication', 'session'],
|
|
654
|
+
timeOfDay: 14,
|
|
655
|
+
dayOfWeek: 2,
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
const consensus = new ConsensusEngine('my-agent');
|
|
659
|
+
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
|
+
|
|
532
665
|
// v4.0.0 — Direct module access
|
|
533
666
|
const turbo = new TurboMemory({ maxEntries: 100000 });
|
|
534
667
|
await turbo.store('auth-pattern', vector, { category: 'security' });
|
|
535
|
-
const results = await turbo.search(queryVector, 10);
|
|
536
668
|
|
|
537
669
|
const evolution = new SelfEvolution({ populationSize: 50 });
|
|
538
670
|
const snapshot = await evolution.evolve(insights);
|
|
539
|
-
console.log(`Generation ${snapshot.generation}, Best fitness: ${snapshot.bestFitness}`);
|
|
540
671
|
|
|
541
672
|
const kg = new KnowledgeGraph('./my-project');
|
|
542
673
|
await kg.build();
|
|
543
674
|
const topEntities = kg.getTopEntities(10);
|
|
544
675
|
|
|
545
|
-
const swarm = new SwarmIntelligence();
|
|
546
|
-
swarm.initialize(fileList);
|
|
547
|
-
swarm.depositPheromone(['src/auth.ts'], 3.0);
|
|
548
|
-
const hotspots = swarm.getHighPriorityFiles(10);
|
|
549
|
-
|
|
550
|
-
const defense = new AdversarialDefense();
|
|
551
|
-
const flag = await defense.verifyInsight(insight, './my-project');
|
|
552
|
-
console.log(`Verdict: ${flag?.verdict}, Confidence: ${flag?.confidence}`);
|
|
553
|
-
|
|
554
676
|
// Start everything
|
|
555
677
|
await brain.start();
|
|
556
678
|
```
|
|
@@ -572,7 +694,16 @@ await brain.start();
|
|
|
572
694
|
|
|
573
695
|
## Version History
|
|
574
696
|
|
|
575
|
-
###
|
|
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
|
|
702
|
+
- **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
|
+
|
|
706
|
+
### v4.0.0 — Hyper-Intelligence Edition
|
|
576
707
|
- **TurboQuant Infinite Memory** — 6x compression, zero forgetting (Google Research, ICLR 2026)
|
|
577
708
|
- **SSSP BMSSP Routing** — O(m log<sup>2/3</sup>n) deterministic routing (arXiv 2504.17033)
|
|
578
709
|
- **Self-Evolving Genetic Rules** — tournament selection, Gaussian mutation, Bayesian meta-learning
|
|
@@ -582,7 +713,6 @@ await brain.start();
|
|
|
582
713
|
- **Knowledge Graph + PageRank** — code impact radar with d=0.85 damping
|
|
583
714
|
- **Predictive Engine** — bug risk scoring, debt forecasting, anomaly detection
|
|
584
715
|
- **9 new CLI commands** — turbo, route, caip, evolve, predict, graph, swarm, defense, v4
|
|
585
|
-
- **29 files changed**, 7,000+ lines of new code
|
|
586
716
|
|
|
587
717
|
### v3.0.0 — Hyper-Intelligence Edition
|
|
588
718
|
- Cognitive load analysis
|
|
@@ -642,6 +772,10 @@ npm test
|
|
|
642
772
|
- [x] ~~Self-evolving rules~~ (v4.0)
|
|
643
773
|
- [x] ~~Cross-agent protocol~~ (v4.0)
|
|
644
774
|
- [x] ~~Adversarial hallucination defense~~ (v4.0)
|
|
775
|
+
- [x] ~~Hierarchical memory compression~~ (v5.0)
|
|
776
|
+
- [x] ~~Context-triggered associative recall~~ (v5.0)
|
|
777
|
+
- [x] ~~Multi-agent consensus protocol~~ (v5.0)
|
|
778
|
+
- [x] ~~Collective cross-project learning~~ (v5.0)
|
|
645
779
|
- [ ] **IDE extensions** — VS Code extension for inline insights
|
|
646
780
|
- [ ] **Custom LLM fine-tuning** — train on your codebase patterns
|
|
647
781
|
- [ ] **Docker image** — one-command containerized deployment
|
|
@@ -673,6 +807,6 @@ MIT License — see [LICENSE](LICENSE) for details.
|
|
|
673
807
|
|
|
674
808
|
**Built with brains by [theihtisham](https://github.com/theihtisham)**
|
|
675
809
|
|
|
676
|
-
**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`
|
|
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`
|
|
677
811
|
|
|
678
812
|
</div>
|