@theihtisham/agent-shadow-brain 6.0.0 → 6.0.3

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 (191) hide show
  1. package/CHANGELOG.md +372 -0
  2. package/README.md +366 -355
  3. package/dist/brain/auto-update.js +1 -1
  4. package/dist/brain/brain-3d.d.ts +79 -0
  5. package/dist/brain/brain-3d.d.ts.map +1 -0
  6. package/dist/brain/brain-3d.js +468 -0
  7. package/dist/brain/brain-3d.js.map +1 -0
  8. package/dist/brain/brain-active-learner.d.ts +74 -0
  9. package/dist/brain/brain-active-learner.d.ts.map +1 -0
  10. package/dist/brain/brain-active-learner.js +425 -0
  11. package/dist/brain/brain-active-learner.js.map +1 -0
  12. package/dist/brain/brain-ascii.d.ts +32 -0
  13. package/dist/brain/brain-ascii.d.ts.map +1 -0
  14. package/dist/brain/brain-ascii.js +402 -0
  15. package/dist/brain/brain-ascii.js.map +1 -0
  16. package/dist/brain/brain-cinema.d.ts +45 -0
  17. package/dist/brain/brain-cinema.d.ts.map +1 -0
  18. package/dist/brain/brain-cinema.js +393 -0
  19. package/dist/brain/brain-cinema.js.map +1 -0
  20. package/dist/brain/brain-coach.d.ts +45 -0
  21. package/dist/brain/brain-coach.d.ts.map +1 -0
  22. package/dist/brain/brain-coach.js +383 -0
  23. package/dist/brain/brain-coach.js.map +1 -0
  24. package/dist/brain/brain-consolidator.d.ts +56 -0
  25. package/dist/brain/brain-consolidator.d.ts.map +1 -0
  26. package/dist/brain/brain-consolidator.js +386 -0
  27. package/dist/brain/brain-consolidator.js.map +1 -0
  28. package/dist/brain/brain-contradictions.d.ts +57 -0
  29. package/dist/brain/brain-contradictions.d.ts.map +1 -0
  30. package/dist/brain/brain-contradictions.js +443 -0
  31. package/dist/brain/brain-contradictions.js.map +1 -0
  32. package/dist/brain/brain-diff.d.ts +61 -0
  33. package/dist/brain/brain-diff.d.ts.map +1 -0
  34. package/dist/brain/brain-diff.js +439 -0
  35. package/dist/brain/brain-diff.js.map +1 -0
  36. package/dist/brain/brain-dna.d.ts +59 -0
  37. package/dist/brain/brain-dna.d.ts.map +1 -0
  38. package/dist/brain/brain-dna.js +336 -0
  39. package/dist/brain/brain-dna.js.map +1 -0
  40. package/dist/brain/brain-doppelganger.d.ts +32 -0
  41. package/dist/brain/brain-doppelganger.d.ts.map +1 -0
  42. package/dist/brain/brain-doppelganger.js +417 -0
  43. package/dist/brain/brain-doppelganger.js.map +1 -0
  44. package/dist/brain/brain-graph-walker.d.ts +54 -0
  45. package/dist/brain/brain-graph-walker.d.ts.map +1 -0
  46. package/dist/brain/brain-graph-walker.js +412 -0
  47. package/dist/brain/brain-graph-walker.js.map +1 -0
  48. package/dist/brain/brain-holiday-card.d.ts +50 -0
  49. package/dist/brain/brain-holiday-card.d.ts.map +1 -0
  50. package/dist/brain/brain-holiday-card.js +432 -0
  51. package/dist/brain/brain-holiday-card.js.map +1 -0
  52. package/dist/brain/brain-memes.d.ts +44 -0
  53. package/dist/brain/brain-memes.d.ts.map +1 -0
  54. package/dist/brain/brain-memes.js +438 -0
  55. package/dist/brain/brain-memes.js.map +1 -0
  56. package/dist/brain/brain-memory-tiers.d.ts +67 -0
  57. package/dist/brain/brain-memory-tiers.d.ts.map +1 -0
  58. package/dist/brain/brain-memory-tiers.js +292 -0
  59. package/dist/brain/brain-memory-tiers.js.map +1 -0
  60. package/dist/brain/brain-notebook.d.ts +68 -0
  61. package/dist/brain/brain-notebook.d.ts.map +1 -0
  62. package/dist/brain/brain-notebook.js +379 -0
  63. package/dist/brain/brain-notebook.js.map +1 -0
  64. package/dist/brain/brain-portability.js +3 -3
  65. package/dist/brain/brain-portability.js.map +1 -1
  66. package/dist/brain/brain-quantize.d.ts +62 -0
  67. package/dist/brain/brain-quantize.d.ts.map +1 -0
  68. package/dist/brain/brain-quantize.js +346 -0
  69. package/dist/brain/brain-quantize.js.map +1 -0
  70. package/dist/brain/brain-query-expander.d.ts +31 -0
  71. package/dist/brain/brain-query-expander.d.ts.map +1 -0
  72. package/dist/brain/brain-query-expander.js +417 -0
  73. package/dist/brain/brain-query-expander.js.map +1 -0
  74. package/dist/brain/brain-quest.d.ts +58 -0
  75. package/dist/brain/brain-quest.d.ts.map +1 -0
  76. package/dist/brain/brain-quest.js +541 -0
  77. package/dist/brain/brain-quest.js.map +1 -0
  78. package/dist/brain/brain-recall-cache.d.ts +73 -0
  79. package/dist/brain/brain-recall-cache.d.ts.map +1 -0
  80. package/dist/brain/brain-recall-cache.js +444 -0
  81. package/dist/brain/brain-recall-cache.js.map +1 -0
  82. package/dist/brain/brain-reflex.d.ts +55 -0
  83. package/dist/brain/brain-reflex.d.ts.map +1 -0
  84. package/dist/brain/brain-reflex.js +364 -0
  85. package/dist/brain/brain-reflex.js.map +1 -0
  86. package/dist/brain/brain-replay.d.ts +74 -0
  87. package/dist/brain/brain-replay.d.ts.map +1 -0
  88. package/dist/brain/brain-replay.js +336 -0
  89. package/dist/brain/brain-replay.js.map +1 -0
  90. package/dist/brain/brain-rerank.d.ts +39 -0
  91. package/dist/brain/brain-rerank.d.ts.map +1 -0
  92. package/dist/brain/brain-rerank.js +216 -0
  93. package/dist/brain/brain-rerank.js.map +1 -0
  94. package/dist/brain/brain-roast.d.ts +44 -0
  95. package/dist/brain/brain-roast.d.ts.map +1 -0
  96. package/dist/brain/brain-roast.js +566 -0
  97. package/dist/brain/brain-roast.js.map +1 -0
  98. package/dist/brain/brain-sonification.d.ts +57 -0
  99. package/dist/brain/brain-sonification.d.ts.map +1 -0
  100. package/dist/brain/brain-sonification.js +286 -0
  101. package/dist/brain/brain-sonification.js.map +1 -0
  102. package/dist/brain/brain-tarot.d.ts +49 -0
  103. package/dist/brain/brain-tarot.d.ts.map +1 -0
  104. package/dist/brain/brain-tarot.js +634 -0
  105. package/dist/brain/brain-tarot.js.map +1 -0
  106. package/dist/brain/brain-time-capsule.d.ts +80 -0
  107. package/dist/brain/brain-time-capsule.d.ts.map +1 -0
  108. package/dist/brain/brain-time-capsule.js +289 -0
  109. package/dist/brain/brain-time-capsule.js.map +1 -0
  110. package/dist/brain/brain-trophies.d.ts +60 -0
  111. package/dist/brain/brain-trophies.d.ts.map +1 -0
  112. package/dist/brain/brain-trophies.js +431 -0
  113. package/dist/brain/brain-trophies.js.map +1 -0
  114. package/dist/brain/brain-working-memory.d.ts +78 -0
  115. package/dist/brain/brain-working-memory.d.ts.map +1 -0
  116. package/dist/brain/brain-working-memory.js +367 -0
  117. package/dist/brain/brain-working-memory.js.map +1 -0
  118. package/dist/brain/confidence-gate.d.ts +69 -0
  119. package/dist/brain/confidence-gate.d.ts.map +1 -0
  120. package/dist/brain/confidence-gate.js +244 -0
  121. package/dist/brain/confidence-gate.js.map +1 -0
  122. package/dist/brain/constitution.d.ts +59 -0
  123. package/dist/brain/constitution.d.ts.map +1 -0
  124. package/dist/brain/constitution.js +315 -0
  125. package/dist/brain/constitution.js.map +1 -0
  126. package/dist/brain/context-continuity.d.ts +78 -0
  127. package/dist/brain/context-continuity.d.ts.map +1 -0
  128. package/dist/brain/context-continuity.js +341 -0
  129. package/dist/brain/context-continuity.js.map +1 -0
  130. package/dist/brain/embeddings-v2.d.ts +58 -0
  131. package/dist/brain/embeddings-v2.d.ts.map +1 -0
  132. package/dist/brain/embeddings-v2.js +344 -0
  133. package/dist/brain/embeddings-v2.js.map +1 -0
  134. package/dist/brain/global-brain.d.ts.map +1 -1
  135. package/dist/brain/global-brain.js +35 -9
  136. package/dist/brain/global-brain.js.map +1 -1
  137. package/dist/brain/hive-voice.d.ts +71 -0
  138. package/dist/brain/hive-voice.d.ts.map +1 -0
  139. package/dist/brain/hive-voice.js +352 -0
  140. package/dist/brain/hive-voice.js.map +1 -0
  141. package/dist/brain/live-brain.d.ts +119 -0
  142. package/dist/brain/live-brain.d.ts.map +1 -0
  143. package/dist/brain/live-brain.js +405 -0
  144. package/dist/brain/live-brain.js.map +1 -0
  145. package/dist/brain/markdown-export.d.ts +48 -0
  146. package/dist/brain/markdown-export.d.ts.map +1 -0
  147. package/dist/brain/markdown-export.js +382 -0
  148. package/dist/brain/markdown-export.js.map +1 -0
  149. package/dist/brain/mcp-server.d.ts +4 -0
  150. package/dist/brain/mcp-server.d.ts.map +1 -1
  151. package/dist/brain/mcp-server.js +81 -5
  152. package/dist/brain/mcp-server.js.map +1 -1
  153. package/dist/brain/memory-seeder.d.ts +78 -0
  154. package/dist/brain/memory-seeder.d.ts.map +1 -0
  155. package/dist/brain/memory-seeder.js +326 -0
  156. package/dist/brain/memory-seeder.js.map +1 -0
  157. package/dist/brain/multimodal-vision.d.ts +38 -0
  158. package/dist/brain/multimodal-vision.d.ts.map +1 -0
  159. package/dist/brain/multimodal-vision.js +257 -0
  160. package/dist/brain/multimodal-vision.js.map +1 -0
  161. package/dist/brain/orchestrator.js +1 -1
  162. package/dist/brain/otel-lite.d.ts +71 -0
  163. package/dist/brain/otel-lite.d.ts.map +1 -0
  164. package/dist/brain/otel-lite.js +232 -0
  165. package/dist/brain/otel-lite.js.map +1 -0
  166. package/dist/brain/token-economy.d.ts +2 -0
  167. package/dist/brain/token-economy.d.ts.map +1 -1
  168. package/dist/brain/token-economy.js +80 -24
  169. package/dist/brain/token-economy.js.map +1 -1
  170. package/dist/cli.js +1120 -32
  171. package/dist/cli.js.map +1 -1
  172. package/dist/dashboard/server.d.ts +5 -0
  173. package/dist/dashboard/server.d.ts.map +1 -1
  174. package/dist/dashboard/server.js +355 -2
  175. package/dist/dashboard/server.js.map +1 -1
  176. package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
  177. package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
  178. package/dist/dashboard/v6-dashboard-html.js +755 -85
  179. package/dist/dashboard/v6-dashboard-html.js.map +1 -1
  180. package/dist/index.d.ts +4 -0
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +4 -0
  183. package/dist/index.js.map +1 -1
  184. package/dist/types.d.ts +17 -12
  185. package/dist/types.d.ts.map +1 -1
  186. package/docs/launch/README.md +61 -0
  187. package/docs/launch/RELEASE_CHECKLIST_v6.0.3.md +102 -0
  188. package/docs/launch/RELEASE_NOTES_v6.0.3.md +111 -0
  189. package/package.json +25 -13
  190. package/tools/export-resume-pack.mjs +56 -0
  191. package/tools/record-global-memory.mjs +72 -0
package/README.md CHANGED
@@ -1,355 +1,366 @@
1
- <div align="center">
2
-
3
- <a href="https://github.com/theihtisham/agent-shadow-brain/raw/main/docs/launch/shadow-brain-motion-explainer-narrated.mp4">
4
- <img src="Banner (2).png" alt="Shadow Brain v6.0 — Hive Mind · Click to watch the 2-minute explainer" width="100%">
5
- </a>
6
-
7
- ### 🎬 **[▶ Watch the 2-minute explainer](https://github.com/theihtisham/agent-shadow-brain/raw/main/docs/launch/shadow-brain-motion-explainer-narrated.mp4)** · Click the banner above
8
-
9
- [![npm version](https://img.shields.io/npm/v/@theihtisham/agent-shadow-brain?color=a855f7&labelColor=1a0a2e&style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@theihtisham/agent-shadow-brain)
10
- [![npm downloads](https://img.shields.io/npm/dt/@theihtisham/agent-shadow-brain?color=06b6d4&labelColor=1a0a2e&style=for-the-badge)](https://www.npmjs.com/package/@theihtisham/agent-shadow-brain)
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
- [![license](https://img.shields.io/badge/license-MIT-8b5cf6?labelColor=1a0a2e&style=for-the-badge)](https://github.com/theihtisham/agent-shadow-brain/blob/main/LICENSE)
13
- [![TypeScript](https://img.shields.io/badge/TypeScript-100%25-3178c6?labelColor=1a0a2e&style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
14
- [![node](https://img.shields.io/badge/node-%3E%3D18-22c55e?labelColor=1a0a2e&style=for-the-badge&logo=node.js)](https://nodejs.org/)
15
- [![Brain Modules](https://img.shields.io/badge/brain_modules-48-ec4899?labelColor=1a0a2e&style=for-the-badge)](#-architecture)
16
- [![CLI Commands](https://img.shields.io/badge/CLI-90%2B_commands-eab308?labelColor=1a0a2e&style=for-the-badge&logo=windowsterminal)](#-cli-reference)
17
- [![MCP Tools](https://img.shields.io/badge/MCP-60%2B_tools-8b5cf6?labelColor=1a0a2e&style=for-the-badge&logo=anthropic)](#-mcp-tools)
18
- [![Tests](https://img.shields.io/badge/tests-148%2F148_passing-10b981?labelColor=1a0a2e&style=for-the-badge&logo=vitest)](#)
19
- [![Local First](https://img.shields.io/badge/local--first-ollama_default-f97316?labelColor=1a0a2e&style=for-the-badge&logo=ollama)](#)
20
- [![Free](https://img.shields.io/badge/price-%240_forever-22c55e?labelColor=1a0a2e&style=for-the-badge)](#)
21
-
22
- <br/>
23
-
24
- # 🧠 Shadow Brain v6.0 — Hive Mind
25
-
26
- ### *The first open-source brain that every AI coding agent on your machine can share.*
27
-
28
- **Claude Code · Cursor · Cline · Codex · Copilot · Windsurf · Kilo · Roo · OpenCode · Aider** — all running on one local brain. What one agent learns, every agent knows. What one sub-agent discovers, every sub-agent inherits.
29
-
30
- ```bash
31
- # 30 seconds. Every agent + sub-agent on your machine becomes smarter.
32
- npx @theihtisham/agent-shadow-brain@latest attach-all
33
- ```
34
-
35
- **[🎬 Video](https://github.com/theihtisham/agent-shadow-brain/raw/main/docs/launch/shadow-brain-motion-explainer-narrated.mp4) · [📦 npm](https://www.npmjs.com/package/@theihtisham/agent-shadow-brain) · [⭐ Star on GitHub](https://github.com/theihtisham/agent-shadow-brain) · [📚 Docs](https://github.com/theihtisham/agent-shadow-brain/tree/main/docs) · [🐛 Issues](https://github.com/theihtisham/agent-shadow-brain/issues)**
36
-
37
- </div>
38
-
39
- ---
40
-
41
- ## ⚡ Install in 30 seconds
42
-
43
- ```bash
44
- # Method 1 — one command, every agent wired, dashboard launches
45
- npx @theihtisham/agent-shadow-brain@latest attach-all
46
-
47
- # Method 2 — global install
48
- npm install -g @theihtisham/agent-shadow-brain
49
- shadow-brain attach-all
50
- shadow-brain dash . # → http://localhost:7341/
51
-
52
- # Method 3 — in a specific project only
53
- cd my-project
54
- npx @theihtisham/agent-shadow-brain attach-all
55
- ```
56
-
57
- **Zero config. Zero API key required. 100 % local-first.**
58
-
59
- ---
60
-
61
- ## 🔥 Why Shadow Brain? (the 60-second pitch)
62
-
63
- | Without Shadow Brain | With Shadow Brain v6 |
64
- |---|---|
65
- | Every new session → agent starts from zero | 2K-token briefing injected **before** the first prompt |
66
- | Cursor learns X → Claude doesn't know | **One singleton brain** every agent shares |
67
- | Claude Task spawns sub-agent → sub-agent starts blind | **SABB** injects focused context slivers into every sub-agent |
68
- | You can't explain *why* the AI made a choice | **Causal Memory Chains** render the full DAG of causes |
69
- | Two agents touching the same file = merge hell | **Collision Detective** catches it in real time |
70
- | Agents work, then go idle — wasted compute | **Dream Engine** reflects during idle, runs counterfactuals |
71
- | No verifiable record of agent decisions | **Ed25519-signed Reputation Ledger** — tamper-proof receipts |
72
- | Token bills explode across Opus / GPT / Gemini | **Token Economy** routes to cheapest model that passes confidence |
73
- | Needs its own API key for everything | **Agent-proxy mode** reuses your existing Claude/Cursor/Codex config |
74
- | Every tool runs hot, every key leaks | **Air-Gap mode** + ChaCha20 encryption at rest |
75
-
76
- ---
77
-
78
- ## 🌟 22 Novel Modules — None Exist in Any Other Tool
79
-
80
- > *This isn't a wrapper around someone else's API. All 22 are first-party research-grade implementations, persisted to disk, with real tests.*
81
-
82
- ### 🧠 Cognition
83
- 1. **Sub-Agent Brain Bridge (SABB)** — sync brain context into Claude Task / Cursor Composer / CrewAI / LangGraph / AutoGen sub-agents
84
- 2. **Causal Memory Chains** — every decision links to its causes; Graphviz DOT export
85
- 3. **Dream Engine** — idle-time reflection: revisit / counterfactual / consolidation / contradiction / pattern-discovery
86
- 4. **Swarm Debate Protocol** — pro / con / arbiter sub-agents for critical decisions
87
- 5. **Pre-Mortem Assistant** — surfaces past failures from *your* project before you start
88
- 6. **Branch Brains** — git-branch-aware memory context
89
-
90
- ### 🔍 Transparency & Trust
91
- 7. **Agent Reputation Ledger** — Ed25519-signed receipts, portable accuracy score
92
- 8. **Attention Heatmap** — weighted attribution showing which memories shaped a decision
93
- 9. **Confidence Calibration Monitor** — Brier scores + automatic trust-weighting
94
- 10. **Formal Verification Bridge** — natural-language rules → ESLint / Semgrep / LSP diagnostics
95
- 11. **Agent Collision Detective** — real-time overlap detection with advisory locks
96
-
97
- ### 💰 Economy & Memory
98
- 12. **Token Economy Engine** — cross-agent spend, savings suggestions, routing advice
99
- 13. **Cost-Aware Sub-Agent Spawner** — auto-route trivial tasks to cheaper models
100
- 14. **Forgetting Curve + Sleep Consolidation** — Ebbinghaus-inspired biological memory
101
-
102
- ### 🔒 Privacy & Safety
103
- 15. **Air-Gap Mode** — zero outbound network, localhost-only
104
- 16. **E2E Encryption** — ChaCha20-Poly1305 at rest
105
- 17. **Hallucination Quarantine** — isolate suspect memories, auto-expire in 7 days
106
-
107
- ### ✨ Delight & Network Effects
108
- 18. **Voice Mode** — natural-language intent parser for transcripts
109
- 19. **Brain Garden** — animated visualization of memory as a living constellation
110
- 20. **PR Auto-Review** — GitHub PR comments citing project memories
111
- 21. **Team Brain Sync (WebRTC)** — peer-to-peer shared brain, no server
112
- 22. **Brain Exchange** — export / import curated shareable brain slices
113
-
114
- ### ⚡ Accelerators
115
- - **Local-First LLM** — Ollama default; optional Anthropic / OpenAI / OpenRouter / Moonshot / Gemini / DeepSeek / Mistral
116
- - **Hive Accelerator** — SSSP ([arXiv 2504.17033](https://arxiv.org/abs/2504.17033)) + TurboQuant ([ICLR 2026](https://openreview.net/forum?id=TbqSEUXWaO)) for fast causal traversal + 6× vector compression
117
-
118
- ---
119
-
120
- ## 🖥️ Complete Web Control Dashboard
121
-
122
- Start it:
123
- ```bash
124
- shadow-brain dash .
125
- # → http://localhost:7341/
126
- ```
127
-
128
- **28 tabs. Real-time data. Full control.** Every feature has live monitoring + interactive controls. Preview:
129
-
130
- | | | |
131
- |---|---|---|
132
- | ![Overview](docs/launch/screenshots/01-overview.png) | ![Live Graph](docs/launch/screenshots/02-graph.png) | ![Agents](docs/launch/screenshots/03-agents.png) |
133
- | **Overview** — live counters, charts | **Live Graph** — animated signal flow | **Agents** — connect / disconnect per agent |
134
- | ![Chat](docs/launch/screenshots/04-chat.png) | ![Memory](docs/launch/screenshots/05-memory.png) | ![SABB](docs/launch/screenshots/07-sabb.png) |
135
- | **Chat with Brain** — RAG with citations | **Memory Browser** — semantic search | **SABB** — sliver generator + quarantine |
136
- | ![Causal](docs/launch/screenshots/08-causal.png) | ![Dream](docs/launch/screenshots/10-dream.png) | ![Reputation](docs/launch/screenshots/11-reputation.png) |
137
- | **Causal Chains** — traceable decisions | **Dream Engine** — reflection insights | **Reputation** — Ed25519 leaderboard |
138
- | ![Tokens](docs/launch/screenshots/19-tokens.png) | ![Models](docs/launch/screenshots/27-models.png) | ![Command](docs/launch/screenshots/29-command-palette.png) |
139
- | **Token Economy** — $ saved live | **Models & Intelligence** — 8 providers | **⌘K Command Palette** |
140
-
141
- **→ [Browse all 29 tab screenshots](docs/launch/screenshots/)**
142
-
143
- Features: dark + light theme · command palette (⌘K) · keyboard shortcuts · toast notifications · Chart.js analytics · responsive (mobile / tablet / desktop) · real-time WebSocket · stop button that actually stops the process.
144
-
145
- ---
146
-
147
- ## 🧩 Works With Every AI Coding Agent
148
-
149
- | Agent | Adapter | Hook target |
150
- |---|---|---|
151
- | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | ✅ Native | `~/.claude/settings.json` hooks.SessionStart |
152
- | [Cursor](https://cursor.sh/) | ✅ Native | `.cursor/rules/shadow-brain.md` + MCP |
153
- | [Cline](https://github.com/cline/cline) | ✅ Native | VS Code globalStorage MCP |
154
- | [Codex](https://github.com/openai/codex) | ✅ Native | `~/.codex/config.json` |
155
- | [GitHub Copilot](https://github.com/features/copilot) | ✅ Native | `.github/copilot-instructions.md` |
156
- | [Windsurf](https://codeium.com/windsurf) | ✅ Native | `.windsurfrules` + MCP |
157
- | [Kilo Code](https://kilocode.ai/) | ✅ Native | `~/.kilocode/settings.json` |
158
- | [Roo Code](https://roocode.com/) | ✅ Native | `~/.roocode/mcp.json` |
159
- | [OpenCode](https://github.com/opencode-ai/opencode) | ✅ Native | `AGENT.md` |
160
- | [Aider](https://aider.chat/) | ✅ Native | `.aider.conf.yml` |
161
-
162
- **Custom agent?** Add its config path in the dashboard "Custom Agent Paths" panel — Shadow Brain will auto-read its provider + model + API key.
163
-
164
- **Sub-agent frameworks supported by SABB:** Claude Task, Cursor Composer, Cline Sub-step, CrewAI, LangGraph, AutoGen, generic.
165
-
166
- ---
167
-
168
- ## 🤖 Use Your Own LLM — or Your Agent's Already-Configured One
169
-
170
- Shadow Brain's **ModelRegistry** supports 8 providers out of the box:
171
-
172
- **Ollama (default, local, free)** · **Anthropic Claude** · **OpenAI** · **OpenRouter** · **Moonshot / Kimi** · **Google Gemini** · **DeepSeek** · **Mistral**
173
-
174
- Plus a unique **Agent Proxy** mode: if you already use Claude Code / Cursor / Codex with their own API key, Shadow Brain borrows their intelligence — **zero new API keys, zero cost**.
175
-
176
- Auto-discovery reads every agent config on your machine so you never retype a key.
177
-
178
- ---
179
-
180
- ## 📊 Real Numbers
181
-
182
- | Metric | Value |
183
- |---|---|
184
- | Brain modules | **48** |
185
- | CLI commands | **90+** |
186
- | MCP tools | **60+** |
187
- | REST endpoints | **50+** |
188
- | Tests passing | **148 / 148** |
189
- | TypeScript errors | **0** |
190
- | Supported agents | **10** (plus custom) |
191
- | Supported LLM providers | **8** (plus agent-proxy) |
192
- | Novel features nobody else has | **22** |
193
- | License | **MIT** |
194
- | Cost to run | **$0 forever** (local-first) |
195
-
196
- ---
197
-
198
- ## 🚀 30-Second Quickstart
199
-
200
- ```bash
201
- # 1. Install
202
- npx @theihtisham/agent-shadow-brain@latest attach-all
203
-
204
- # 2. Launch the dashboard
205
- shadow-brain dash .
206
- # → open http://localhost:7341/
207
-
208
- # 3. Seed the brain (optional — populates example data)
209
- shadow-brain reputation sign --agent claude-code --ver 4.7 --project demo \
210
- --decision "use bcrypt cost 12 for all password hashing" \
211
- --category security --confidence 0.92
212
-
213
- # 4. Every new AI agent session automatically gets context injected
214
- ```
215
-
216
- **That's it.** Open any project in Claude Code / Cursor / any supported agent — Shadow Brain is already running under the hood.
217
-
218
- ---
219
-
220
- ## 🧪 The Hive Mind Explainer (2 minutes)
221
-
222
- [![Shadow Brain Hive Mind Explainer — 2 minutes](banner.svg)](https://github.com/theihtisham/agent-shadow-brain/raw/main/docs/launch/shadow-brain-motion-explainer-narrated.mp4)
223
-
224
- **[▶ Click here to watch](https://github.com/theihtisham/agent-shadow-brain/raw/main/docs/launch/shadow-brain-motion-explainer-narrated.mp4)** · Full motion graphics explainer with voice-over walking through every feature, the live dashboard, and the 30-second install.
225
-
226
- Local file: `docs/launch/shadow-brain-motion-explainer-narrated.mp4` (2:05 · 1080p · narrated).
227
-
228
- ---
229
-
230
- ## 📖 CLI Reference (top commands)
231
-
232
- ```bash
233
- # Attachment + lifecycle
234
- shadow-brain attach-all # wire every detected agent
235
- shadow-brain detach-all # remove every hook
236
- shadow-brain audit-hooks # list what's installed
237
- shadow-brain dash . # launch web dashboard at :7341
238
- shadow-brain mcp # start MCP server at :7342
239
-
240
- # v6 Hive Mind
241
- shadow-brain hive status # cross-module status
242
- shadow-brain subagent sliver --parent claude-code --task "refactor auth"
243
- shadow-brain causal trace <id> # render ancestor DAG
244
- shadow-brain dream run # trigger idle reflection now
245
- shadow-brain debate "Redis or Postgres?" --context "10k users"
246
- shadow-brain premortem "migrate auth to passkeys"
247
- shadow-brain reputation sign --agent claude-code --ver 4.7 --project X \
248
- --decision "..." --category security --confidence 0.92
249
- shadow-brain reputation badge claude-code --ver 4.7
250
-
251
- # Memory + analytics
252
- shadow-brain global recall --keywords "auth"
253
- shadow-brain tokens report # cross-agent spend + savings
254
- shadow-brain forget consolidate # run sleep cycle
255
- shadow-brain formal generate "always use parameterized SQL"
256
- shadow-brain formal export-eslint
257
-
258
- # Privacy + trust
259
- shadow-brain airgap enable --policy strict
260
- shadow-brain encrypt file ~/.shadow-brain/global.json --passphrase ...
261
- shadow-brain quarantine list
262
-
263
- # Sharing
264
- shadow-brain exchange export --name "react-expert-v1" --tags react,auth
265
- shadow-brain exchange import ~/brain-packs/react-expert-v1.json
266
-
267
- # Full list
268
- shadow-brain --help
269
- ```
270
-
271
- ---
272
-
273
- ## 🎯 Tweetable Talking Points
274
-
275
- > *"Shadow Brain is the first open-source brain that works with sub-agents. Claude Task, Cursor Composer, CrewAI, LangGraph, AutoGen — all finally share context. One `npx` command. Zero API keys."*
276
-
277
- > *"Every AI decision Shadow Brain makes is Ed25519-signed. Every cause is traced. Every collision is caught before it happens. Free forever."*
278
-
279
- > *"22 novel features nobody else has. Free. Open source. Local-first. `npx @theihtisham/agent-shadow-brain`."*
280
-
281
- ---
282
-
283
- ## 🛠️ For Contributors
284
-
285
- ```bash
286
- git clone https://github.com/theihtisham/agent-shadow-brain.git
287
- cd agent-shadow-brain
288
- npm install
289
- npm run build
290
- npm test # 148/148 tests
291
- npm run dev # ts-node dev mode
292
-
293
- # Rebuild the explainer video
294
- node tools/record-motion-explainer.mjs
295
-
296
- # Capture fresh dashboard screenshots
297
- node tools/capture-screenshots.mjs
298
-
299
- # Seed the brain with demo data
300
- node tools/seed-brain.mjs
301
- ```
302
-
303
- Issues, PRs, discussions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
304
-
305
- ---
306
-
307
- ## 📚 Documentation
308
-
309
- - **[CHANGELOG.md](CHANGELOG.md)** — release notes
310
- - **[docs/versions/v6.0.0.md](docs/versions/v6.0.0.md)** — v6 release details
311
- - **[docs/launch/HIVEMIND_VIDEO.md](docs/launch/HIVEMIND_VIDEO.md)** — video production pipeline
312
- - **[docs/launch/screenshots/](docs/launch/screenshots/)** — all 29 dashboard screenshots
313
- - **[SECURITY.md](SECURITY.md)** — security policy
314
- - **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** — community guidelines
315
-
316
- ---
317
-
318
- ## 💬 Community
319
-
320
- - **[GitHub Issues](https://github.com/theihtisham/agent-shadow-brain/issues)** — bug reports, feature requests
321
- - **[GitHub Discussions](https://github.com/theihtisham/agent-shadow-brain/discussions)** — questions, ideas, show-and-tell
322
- - **[GitHub Releases](https://github.com/theihtisham/agent-shadow-brain/releases)** — download the explainer MP4 + release assets
323
-
324
- **If Shadow Brain makes your AI agents smarter, star the repo ⭐**
325
-
326
- ---
327
-
328
- ## ⭐ Stargazers Over Time
329
-
330
- [![Star History Chart](https://api.star-history.com/svg?repos=theihtisham/agent-shadow-brain&type=Date)](https://star-history.com/#theihtisham/agent-shadow-brain&Date)
331
-
332
- ---
333
-
334
- ## 📜 License
335
-
336
- **MIT** — see [LICENSE](LICENSE).
337
-
338
- Free to use, modify, fork, commercialize. Local-first by default. Works offline, in air-gapped environments, in privacy-constrained enterprises. No telemetry. No phone-home. No trial expiration.
339
-
340
- ---
341
-
342
- <div align="center">
343
-
344
- ### Built by [@theihtisham](https://github.com/theihtisham)
345
-
346
- <a href="https://github.com/theihtisham"><img src="https://img.shields.io/badge/GitHub-theihtisham-181717?style=for-the-badge&logo=github" alt="GitHub"></a>
347
- <a href="https://www.npmjs.com/~theihtisham"><img src="https://img.shields.io/badge/npm-@theihtisham-CB3837?style=for-the-badge&logo=npm" alt="npm"></a>
348
-
349
- ### The Hive Mind for every AI coding agent on your machine.
350
-
351
- **`npx @theihtisham/agent-shadow-brain@latest attach-all`**
352
-
353
- <sub>Topics: `ai` · `llm` · `claude-code` · `cursor` · `cline` · `codex` · `copilot` · `hive-mind` · `sub-agent` · `sabb` · `causal-chains` · `dream-engine` · `reputation-ledger` · `swarm-debate` · `pre-mortem` · `branch-brain` · `attention-heatmap` · `token-economy` · `forgetting-curve` · `formal-verification` · `calibration-monitor` · `air-gap` · `e2e-encryption` · `hallucination-quarantine` · `voice-mode` · `brain-garden` · `pr-review` · `team-brain` · `brain-exchange` · `local-first` · `ollama` · `anthropic` · `openai` · `openrouter` · `gemini` · `deepseek` · `moonshot` · `mistral` · `mcp-server` · `model-context-protocol` · `lsp-server` · `cross-agent` · `multi-agent` · `autonomous-agents` · `agentic-ai` · `vibe-coding` · `cursor-ai` · `developer-tools` · `developer-productivity` · `coding-assistant` · `ai-coding` · `code-review` · `static-analysis` · `knowledge-graph` · `semantic-search` · `vector-embeddings` · `prompt-caching` · `json-mode` · `chat-with-memory` · `ed25519` · `chacha20-poly1305` · `sssp` · `turboquant` · `iclr-2026` · `arxiv` · `zero-config` · `typescript` · `open-source` · `free-forever` · `mit-license`</sub>
354
-
355
- </div>
1
+ # Agent Shadow Brain
2
+
3
+ Local-first memory and coordination for AI coding agents.
4
+
5
+ Version: 6.0.3
6
+
7
+ Agent Shadow Brain gives tools like Codex, Claude Code, Cursor, Cline, OpenCode, Aider, and related MCP clients a shared local memory layer. It stores compact, source-backed lessons about projects, recalls them later, generates fresh-session briefings, audits memory quality, and exports JSONL training/eval packs.
8
+
9
+ It does not change model weights by itself. It helps agents work better by giving them relevant, current, source-linked context before and during complex work.
10
+
11
+ ## What It Actually Does
12
+
13
+ - Stores cross-project and cross-agent memories in a local JSON brain at `~/.shadow-brain/global.json`.
14
+ - Recalls memories by project, agent, category, and keywords.
15
+ - Generates source-backed resume packs for fresh sessions, account switches, context compaction, and handoffs.
16
+ - Audits memory quality: source coverage, stale entries, duplicates, low-quality notes, recall health.
17
+ - Creates verified memory seed drafts from dashboard/API, then requires user, agent, or dual approval before writing to durable memory.
18
+ - Exports JSONL rows for evals, distillation, or local fine-tuning pipelines.
19
+ - Provides CLI, dashboard API, and MCP tool surfaces.
20
+ - Includes safety helpers such as hook audit, detach, and action firewall checks.
21
+ - Works without telemetry and without an API key for local memory features.
22
+
23
+ ## What It Does Not Claim
24
+
25
+ - It does not secretly train GPT, Claude, Gemini, or any remote model.
26
+ - It does not guarantee perfect recall.
27
+ - It does not replace project docs, tests, source control, or human review.
28
+ - It does not make every listed agent automatically available. Agent support depends on local installation and hook/config compatibility.
29
+ - It does not publish or sync data unless you explicitly use export, sync, or other sharing commands.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ npm install -g @theihtisham/agent-shadow-brain
35
+ ```
36
+
37
+ CLI binaries:
38
+
39
+ ```bash
40
+ shadow-brain --help
41
+ asb --help
42
+ ```
43
+
44
+ You can also run without global install:
45
+
46
+ ```bash
47
+ npx @theihtisham/agent-shadow-brain@latest --help
48
+ ```
49
+
50
+ ## Safe First Run
51
+
52
+ Start by auditing before attaching hooks:
53
+
54
+ ```bash
55
+ shadow-brain audit-hooks .
56
+ shadow-brain live-brain status .
57
+ ```
58
+
59
+ Only attach after you review what will be changed:
60
+
61
+ ```bash
62
+ shadow-brain attach-all .
63
+ ```
64
+
65
+ Detach later if needed:
66
+
67
+ ```bash
68
+ shadow-brain detach-all .
69
+ ```
70
+
71
+ ## v6.0.3: Live Brain
72
+
73
+ The 6.0.3 release focuses on practical long-memory improvement for agents.
74
+
75
+ ### Live Brain Status
76
+
77
+ ```bash
78
+ shadow-brain live-brain status .
79
+ ```
80
+
81
+ Shows:
82
+
83
+ - memory count
84
+ - average memory quality
85
+ - source coverage
86
+ - stale memories
87
+ - duplicate clusters
88
+ - recall eval score
89
+ - recommended cleanup actions
90
+
91
+ JSON output:
92
+
93
+ ```bash
94
+ shadow-brain live-brain status . --json
95
+ ```
96
+
97
+ ### Agent Briefing
98
+
99
+ Generate a markdown briefing for a fresh agent session:
100
+
101
+ ```bash
102
+ shadow-brain live-brain brief . -o SHADOW_BRAIN_AGENT_BRIEF.md
103
+ ```
104
+
105
+ The briefing includes:
106
+
107
+ - rules for agents
108
+ - top source-backed memories
109
+ - memory warnings
110
+ - recall health
111
+ - commands agents should run next
112
+
113
+ ### Recall Eval
114
+
115
+ Check whether the brain can retrieve useful memories for common agent tasks:
116
+
117
+ ```bash
118
+ shadow-brain live-brain eval .
119
+ ```
120
+
121
+ Custom eval queries use pipe separators:
122
+
123
+ ```bash
124
+ shadow-brain live-brain eval . --queries "current blocker|do not repeat|verified command"
125
+ ```
126
+
127
+ ### Memory Hygiene
128
+
129
+ List concrete cleanup and learning actions:
130
+
131
+ ```bash
132
+ shadow-brain live-brain hygiene .
133
+ ```
134
+
135
+ This highlights missing sources, stale memories, duplicates, weak recall, and missing project-scoped memories.
136
+
137
+ ### Training/Eval Export
138
+
139
+ Export source-backed memories as JSONL:
140
+
141
+ ```bash
142
+ shadow-brain live-brain train-pack . --out shadow-brain-training.jsonl
143
+ ```
144
+
145
+ This is useful for:
146
+
147
+ - retrieval evals
148
+ - local distillation experiments
149
+ - supervised fine-tuning datasets
150
+ - memory regression tests
151
+
152
+ The export is only data preparation. You choose the downstream training/eval tool.
153
+
154
+ ## Core Memory Commands
155
+
156
+ Recall from the global brain:
157
+
158
+ ```bash
159
+ shadow-brain global recall --query "current blocker next step" --json --limit 8
160
+ ```
161
+
162
+ Show global stats:
163
+
164
+ ```bash
165
+ shadow-brain global stats
166
+ ```
167
+
168
+ Create a source-backed resume seed:
169
+
170
+ ```bash
171
+ shadow-brain resume-seed . -o SHADOW_BRAIN_RESUME_SEED.md
172
+ ```
173
+
174
+ Show what a project has learned:
175
+
176
+ ```bash
177
+ shadow-brain timeline . --limit 30
178
+ ```
179
+
180
+ Create a cross-agent handoff packet:
181
+
182
+ ```bash
183
+ shadow-brain handoff codex claude-code . --task "continue release verification"
184
+ ```
185
+
186
+ Record a durable memory from a script:
187
+
188
+ ```bash
189
+ node tools/record-global-memory.mjs ^
190
+ --project-dir "." ^
191
+ --project-name "my-project" ^
192
+ --agent codex ^
193
+ --category "project.lesson" ^
194
+ --importance 0.8 ^
195
+ --tags "memory,release" ^
196
+ --sources "README.md,CHANGELOG.md" ^
197
+ --content "Keep release notes source-backed and verify npm metadata before publish."
198
+ ```
199
+
200
+ ## Dashboard
201
+
202
+ Start the local dashboard:
203
+
204
+ ```bash
205
+ shadow-brain dash . --no-open --port 7341
206
+ ```
207
+
208
+ For a fast UI/API-only launch on a large repo:
209
+
210
+ ```bash
211
+ shadow-brain dash . --no-open --no-analysis --host 127.0.0.1 --port 7341
212
+ ```
213
+
214
+ Open:
215
+
216
+ ```text
217
+ http://127.0.0.1:7341
218
+ ```
219
+
220
+ The v6 dashboard includes a **Live Brain** tab for memory health, source coverage, recall evals, hygiene actions, top memories, and the generated agent briefing.
221
+
222
+ It also includes:
223
+
224
+ - **Memory Browser intelligence cards** for total memories, source coverage, fresh learning, seed queue, top categories, agent coverage, and top tags.
225
+ - **Memory Seeder** for controlled research-to-memory workflows. Drafts stay out of the global brain until approval is complete.
226
+ - **Token Economy accuracy split**: current runtime agent is shown separately from historical model spend, so old Claude/Cursor spend records do not imply the dashboard is running that agent.
227
+
228
+ Memory seeding API:
229
+
230
+ ```text
231
+ GET /api/v6/seed-drafts
232
+ POST /api/v6/seed-draft
233
+ POST /api/v6/seed-approve
234
+ POST /api/v6/seed-reject
235
+ POST /api/v6/seed-commit
236
+ GET /api/v6/memory-intelligence
237
+ ```
238
+
239
+ Useful API endpoints:
240
+
241
+ ```text
242
+ GET/POST /api/v6/live-brain
243
+ GET/POST /api/v6/resume-pack
244
+ GET/POST /api/v6/ww2br-recall
245
+ GET/POST /api/v6/memory-browser
246
+ ```
247
+
248
+ Example:
249
+
250
+ ```bash
251
+ curl "http://127.0.0.1:7341/api/v6/live-brain?projectDir=C:/path/to/project"
252
+ ```
253
+
254
+ ## MCP Tools
255
+
256
+ The MCP server exposes memory and agent-control tools for compatible clients.
257
+
258
+ New in 6.0.3:
259
+
260
+ - `live_brain_status`
261
+ - `live_brain_brief`
262
+ - `live_brain_train_pack`
263
+
264
+ Existing useful tools include:
265
+
266
+ - `global_recall`
267
+ - `global_stats`
268
+ - `global_timeline`
269
+ - `subconscious_inject`
270
+ - `agent_handoff`
271
+ - `firewall_check`
272
+
273
+ Start MCP from the dashboard API or existing CLI/server integration, depending on your setup.
274
+
275
+ ## How Agents Should Use It
276
+
277
+ Recommended workflow for complex work:
278
+
279
+ 1. Run `shadow-brain live-brain status <project>`.
280
+ 2. Generate or read a live briefing.
281
+ 3. Verify current project docs and source files.
282
+ 4. Work normally.
283
+ 5. Record only durable, source-backed lessons after proof.
284
+ 6. Run recall evals when memory quality starts to drift.
285
+
286
+ Good memories are short, action-oriented, and source-backed:
287
+
288
+ ```text
289
+ [lesson:release-readme-v1] Before publishing, verify package.json version, package-lock root version, README install commands, build output, and npm pack contents.
290
+ Sources: package.json; package-lock.json; README.md
291
+ Tags: release,npm,verification
292
+ ```
293
+
294
+ Bad memories are vague:
295
+
296
+ ```text
297
+ Make project better.
298
+ ```
299
+
300
+ ## Local Data
301
+
302
+ Default global brain:
303
+
304
+ ```text
305
+ ~/.shadow-brain/global.json
306
+ ```
307
+
308
+ Project-local generated files may include:
309
+
310
+ ```text
311
+ SHADOW_BRAIN_AGENT_BRIEF.md
312
+ SHADOW_BRAIN_RESUME_SEED.md
313
+ shadow-brain-training.jsonl
314
+ ```
315
+
316
+ Do not store secrets, API keys, passwords, private keys, or raw credentials in memory content, metadata, tags, prompts, reports, or exported training data.
317
+
318
+ ## Development
319
+
320
+ ```bash
321
+ npm install
322
+ npm run build
323
+ npm test
324
+ ```
325
+
326
+ Focused tests:
327
+
328
+ ```bash
329
+ npx vitest run tests/brain/live-brain.test.ts tests/brain/context-continuity.test.ts
330
+ ```
331
+
332
+ On Windows PowerShell, if execution policy blocks `npm.ps1`, use:
333
+
334
+ ```powershell
335
+ npm.cmd run build
336
+ npx.cmd vitest run tests\brain\live-brain.test.ts
337
+ ```
338
+
339
+ ## Release Checklist
340
+
341
+ For a 6.0.3 release:
342
+
343
+ ```bash
344
+ npm run build
345
+ npm test
346
+ npm pack --dry-run
347
+ ```
348
+
349
+ Then publish only after verifying the package contents:
350
+
351
+ ```bash
352
+ npm publish --access public
353
+ ```
354
+
355
+ GitHub release should include:
356
+
357
+ - this README
358
+ - `CHANGELOG.md`
359
+ - `docs/launch/RELEASE_NOTES_v6.0.3.md`
360
+ - `docs/launch/RELEASE_CHECKLIST_v6.0.3.md`
361
+ - build/test output
362
+ - npm package dry-run output
363
+
364
+ ## License
365
+
366
+ MIT