@theihtisham/agent-shadow-brain 6.0.2 → 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 (51) hide show
  1. package/CHANGELOG.md +372 -0
  2. package/README.md +366 -455
  3. package/dist/brain/auto-update.js +1 -1
  4. package/dist/brain/brain-portability.js +3 -3
  5. package/dist/brain/brain-portability.js.map +1 -1
  6. package/dist/brain/context-continuity.d.ts +78 -0
  7. package/dist/brain/context-continuity.d.ts.map +1 -0
  8. package/dist/brain/context-continuity.js +341 -0
  9. package/dist/brain/context-continuity.js.map +1 -0
  10. package/dist/brain/global-brain.d.ts.map +1 -1
  11. package/dist/brain/global-brain.js +35 -9
  12. package/dist/brain/global-brain.js.map +1 -1
  13. package/dist/brain/live-brain.d.ts +119 -0
  14. package/dist/brain/live-brain.d.ts.map +1 -0
  15. package/dist/brain/live-brain.js +405 -0
  16. package/dist/brain/live-brain.js.map +1 -0
  17. package/dist/brain/mcp-server.d.ts +4 -0
  18. package/dist/brain/mcp-server.d.ts.map +1 -1
  19. package/dist/brain/mcp-server.js +81 -5
  20. package/dist/brain/mcp-server.js.map +1 -1
  21. package/dist/brain/memory-seeder.d.ts +78 -0
  22. package/dist/brain/memory-seeder.d.ts.map +1 -0
  23. package/dist/brain/memory-seeder.js +326 -0
  24. package/dist/brain/memory-seeder.js.map +1 -0
  25. package/dist/brain/orchestrator.js +1 -1
  26. package/dist/brain/token-economy.d.ts +2 -0
  27. package/dist/brain/token-economy.d.ts.map +1 -1
  28. package/dist/brain/token-economy.js +80 -24
  29. package/dist/brain/token-economy.js.map +1 -1
  30. package/dist/cli.js +240 -31
  31. package/dist/cli.js.map +1 -1
  32. package/dist/dashboard/server.d.ts +5 -0
  33. package/dist/dashboard/server.d.ts.map +1 -1
  34. package/dist/dashboard/server.js +355 -2
  35. package/dist/dashboard/server.js.map +1 -1
  36. package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
  37. package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
  38. package/dist/dashboard/v6-dashboard-html.js +755 -85
  39. package/dist/dashboard/v6-dashboard-html.js.map +1 -1
  40. package/dist/index.d.ts +4 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +4 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/types.d.ts +17 -12
  45. package/dist/types.d.ts.map +1 -1
  46. package/docs/launch/README.md +61 -0
  47. package/docs/launch/RELEASE_CHECKLIST_v6.0.3.md +102 -0
  48. package/docs/launch/RELEASE_NOTES_v6.0.3.md +111 -0
  49. package/package.json +25 -13
  50. package/tools/export-resume-pack.mjs +56 -0
  51. package/tools/record-global-memory.mjs +72 -0
package/README.md CHANGED
@@ -1,455 +1,366 @@
1
- <div align="center">
2
-
3
- <a href="https://github.com/theihtisham/agent-shadow-brain">
4
- <img src="banner-v6.0.2.png" alt="Shadow Brain v6.0.2 — Singularity · 35 new modules · 5 viral features · 10 brain-quality upgrades · One brain, every agent" width="100%">
5
- </a>
6
- <a href="https://trendshift.io/repositories/25944" target="_blank"><img src="https://trendshift.io/api/badge/repositories/25944" alt="lsdefine%2FGenericAgent | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
7
- <br/><br/>
8
-
9
- <!-- v6.0.2 hero video — auto-plays muted on GitHub README -->
10
- <video src="https://raw.githubusercontent.com/theihtisham/agent-shadow-brain/main/docs/launch/shadow-brain-v6.0.2-hero.mp4"
11
- poster="banner-v6.0.2.png"
12
- autoplay
13
- muted
14
- loop
15
- controls
16
- playsinline
17
- width="100%">
18
- Your browser doesn't support inline video.
19
- <a href="https://github.com/theihtisham/agent-shadow-brain/releases/tag/v6.0.2">Watch the v6.0.2 hero video on the release page</a>.
20
- </video>
21
-
22
- ### 🎬 **2-minute v6.0.2 hero above — auto-plays muted · click 🔊 to unmute · [v6.0.2 release page](https://github.com/theihtisham/agent-shadow-brain/releases/tag/v6.0.2) · [original 2-min explainer](docs/launch/shadow-brain-motion-explainer-narrated.mp4) · [dashboard tour](docs/launch/shadow-brain-dashboard-tour.mp4)**
23
-
24
- [![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)
25
- [![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)
26
- [![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)
27
- [![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)
28
- [![TypeScript](https://img.shields.io/badge/TypeScript-100%25-3178c6?labelColor=1a0a2e&style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
29
- [![node](https://img.shields.io/badge/node-%3E%3D18-22c55e?labelColor=1a0a2e&style=for-the-badge&logo=node.js)](https://nodejs.org/)
30
- [![Brain Modules](https://img.shields.io/badge/brain_modules-122-ec4899?labelColor=1a0a2e&style=for-the-badge)](#-architecture)
31
- [![CLI Commands](https://img.shields.io/badge/CLI-120%2B_commands-eab308?labelColor=1a0a2e&style=for-the-badge&logo=windowsterminal)](#-cli-reference)
32
- [![MCP Tools](https://img.shields.io/badge/MCP-60%2B_tools-8b5cf6?labelColor=1a0a2e&style=for-the-badge&logo=anthropic)](#-mcp-tools)
33
- [![Tests](https://img.shields.io/badge/tests-148%2F148_passing-10b981?labelColor=1a0a2e&style=for-the-badge&logo=vitest)](#)
34
- [![Local First](https://img.shields.io/badge/local--first-ollama_default-f97316?labelColor=1a0a2e&style=for-the-badge&logo=ollama)](#)
35
- [![Free](https://img.shields.io/badge/price-%240_forever-22c55e?labelColor=1a0a2e&style=for-the-badge)](#)
36
-
37
- <br/>
38
-
39
- # 🧠 Shadow Brain v6.0.2 — Singularity
40
-
41
- ### *The first open-source brain that every AI coding agent on your machine can share.*
42
-
43
- **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.
44
-
45
- > **🆕 v6.0.2 "Singularity" — 19 world-first features. Every one of them shareable.**
46
- >
47
- > **The 5 viral artifacts** — each renders as a tweet-ready PNG/SVG/MP4:
48
- > 🎬 **Brain Replay** · 🧬 **Brain DNA** · 🗳️ **Hive Voice** · ⏰ **Time Capsule** · 🔬 **Brain Diff**
49
- >
50
- > **The 14 advanced features** — Spotify-Wrapped-meets-AI-codebase:
51
- > 🎵 **Brain Cinema** (auto 60s SVG-animated video of brain growth) · 🎼 **Brain Sonification** (your codebase as music) · 🏆 **Brain Trophies** (25 achievements + share cards) · 🎁 **Brain Holiday Card** (year-in-review) · 🧭 **Brain Coach** (proactive idle suggestions) · 🗺️ **Brain Quest** (gamified onboarding adventures) · 📓 **Brain Notebook** (Jupyter-style brain explorer) · ⚡ **Brain Reflex** (local-model inline completion) · 🔥 **Brain Roast** (comedy code reviews, 6 personas) · 🔮 **Brain Tarot** (78-card divination from git+brain) · 🎨 **Brain ASCII** (terminal art representations) · 😂 **Brain Memes** (auto-generated dev memes) · 🌌 **Brain 3D** (Three.js rotatable graph viewer) · 💞 **Brain Doppelganger** (find your codebase's twin)
52
- >
53
- > **The infrastructure** — real ANN HNSW index · Constitution layer · Confidence Gate · multimodal vision (llava) · LoRA distillation pipeline · SWE-Bench-Lite eval harness · OpenTelemetry-lite tracing · git-trackable Markdown brain export/import.
54
- >
55
- > [Full release notes →](docs/launch/RELEASE_NOTES_v6.0.2.md)
56
-
57
- ```bash
58
- # 30 seconds. Every agent + sub-agent on your machine becomes smarter.
59
- npx @theihtisham/agent-shadow-brain@latest attach-all
60
-
61
- # Or — the 30-second wow tour
62
- npx @theihtisham/agent-shadow-brain@latest demo
63
- ```
64
-
65
- **[🎬 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)**
66
-
67
- </div>
68
-
69
- ---
70
-
71
- ## ⚡ Install in 30 seconds
72
-
73
- ```bash
74
- # Method 1 — one command, every agent wired, dashboard launches
75
- npx @theihtisham/agent-shadow-brain@latest attach-all
76
-
77
- # Method 2 — global install
78
- npm install -g @theihtisham/agent-shadow-brain
79
- shadow-brain attach-all
80
- shadow-brain dash . # → http://localhost:7341/
81
-
82
- # Method 3 — in a specific project only
83
- cd my-project
84
- npx @theihtisham/agent-shadow-brain attach-all
85
- ```
86
-
87
- **Zero config. Zero API key required. 100 % local-first.**
88
-
89
- ---
90
-
91
- ## 🆕 What's New in v6.0.2 — "Singularity"
92
-
93
- > **35 new modules + 27 new CLI commands + 7 sample artifacts. Zero new npm deps. tsc-clean.**
94
-
95
- ### 🌟 The 5 World-First Viral Features
96
-
97
- Every one of these renders as a tweet-ready PNG/SVG. *Cursor doesn't have these. Cline doesn't have these. Nobody has these.*
98
-
99
- | | Feature | What it does |
100
- |---|---|---|
101
- | 🎬 | **[Brain Replay](docs/launch/v6.0.2-samples/brain-replay-sample.svg)** | Scrubbable timeline of every brain event since day-zero. Drag the cursor, rewind to any moment. SVG export. |
102
- | 🧬 | **[Brain DNA](docs/launch/v6.0.2-samples/brain-dna-sample.svg)** | Spotify-Wrapped-style fingerprint card. 8 personality archetypes (The Architect, The Debugger, …). 1080×1080 share card. |
103
- | 🗳️ | **Hive Voice** | 3 local models debate-vote on every architecture question. See consensus, dissent, and confidence — live. SVG bar chart. |
104
- | ⏰ | **Brain Time Capsule** | Freeze + label + resurrect brain snapshots. "Here's what we knew about React in January." Ed25519-signed bundles. |
105
- | 🔬 | **Brain Diff** | Semantic diff between two brains. Venn-diagram SVG + English narrative. "What did Team A learn that Team B didn't?" |
106
-
107
- ```bash
108
- shadow-brain dna card --out my-brain.svg # 🧬 generate your DNA card
109
- shadow-brain replay export --format svg --out timeline.svg # 🎬 scrubbable timeline
110
- shadow-brain hive-voice ask "Server Components by default?" # 🗳️ multi-model vote
111
- shadow-brain capsule freeze --label "pre-redesign" # ⏰ freeze a snapshot
112
- shadow-brain brain-diff compare brain-a/ brain-b/ # 🔬 semantic diff
113
- ```
114
-
115
- ### 🎁 14 More Advanced Features
116
-
117
- | | | | |
118
- |---|---|---|---|
119
- | 🎵 **Brain Cinema** — auto-procedural 60-sec SVG video | 🎼 **Brain Sonification** — your codebase as music (WAV) | 🏆 **Brain Trophies** — 25 achievements w/ share cards | 🎁 **Brain Holiday Card** — year-in-review SVG |
120
- | 🧭 **Brain Coach** — 10 proactive idle-suggestion rules | 🗺️ **Brain Quest** — 5 gamified onboarding adventures | 📓 **Brain Notebook** — Jupyter-style brain explorer | ⚡ **Brain Reflex** — local-model inline completion |
121
- | 🔥 **Brain Roast** — comedy code review (6 personas) | 🔮 **Brain Tarot** — 78-card divination from git+brain | 🎨 **Brain ASCII** — terminal-art brain (6 styles) | 😂 **Brain Memes** — auto-generated dev memes (10 templates) |
122
- | 🌌 **Brain 3D** — rotatable Three.js graph viewer | 💞 **Brain Doppelganger** — find your codebase's twin | | |
123
-
124
- ### 🧠 10 Brain-Quality Upgrades (the engineering wins)
125
-
126
- | Recall quality | Memory arch | Efficiency | Intelligence | Size + Learning |
127
- |---|---|---|---|---|
128
- | **Rerank** (BM25 + cosine hybrid) | **Memory Tiers** (episodic/semantic) | **Working Memory** (LRU + predictive prefetch) | **Contradictions** (46 polarity pairs) | **Quantize** (int8 vectors, 4× smaller, 0.000298 mean error) |
129
- | **Query Expander** (synonyms + abbrev + HyDE) | **Consolidator** (dedup + abstractions) | **Recall Cache** (bloom filter, 65k bits, ~4% FP @ 10k keys) | **Graph Walker** (5 edge types, 3-hop BFS) | **Active Learner** (accept/reject feedback bias) |
130
-
131
- ### ⚙️ Production Infrastructure
132
-
133
- - **Real ANN vector index** (`embeddings-v2.ts`) — HNSW-style graph, M=8, sub-100ms recall over 10k vectors, sharded persistence (5MB cap), auto-pulls `nomic-embed-text` from Ollama on first run
134
- - **Constitution layer** — `<project>/.shadow-brain/constitution.md` parser + hot-reload + injection
135
- - **Confidence Gate** — active output filter, Brier score + ECE stats
136
- - **Multimodal vision** — Ollama llava / llava-llama3 / bakllava ingestion
137
- - **Markdown brain export/import** — git-trackable `.shadow-brain.md` round-trip
138
- - **OpenTelemetry-lite tracing** — OTel-compatible JSONL, daily rotation
139
- - **LoRA distillation pipeline** (`tools/lora-pipeline/`) — turn your brain into a Qwen2.5-Coder-1.5B adapter
140
- - **SWE-Bench-Lite harness** (`tools/swe-bench-lite/`) — 10 curated bugs, brain-on vs brain-off, statistical scoring
141
- - **30-second demo**: `npx @theihtisham/agent-shadow-brain demo`
142
-
143
- ### 📊 v6.0.2 by the numbers
144
-
145
- | | |
146
- |---|---|
147
- | New brain modules | **35** (25 features + 10 quality stack) |
148
- | New CLI command groups | **27** |
149
- | New LOC | **~16,000** (TypeScript) |
150
- | New npm dependencies | **0** |
151
- | Sample artifacts shipped | **7** (DNA card, Replay timeline, Cinema, Holiday wrapped, Tarot, Trophy wall, 3D viewer HTML) |
152
- | Quantization roundtrip error | **0.000298** (16× better than spec) |
153
- | TypeScript errors | **0** |
154
-
155
- **Full release notes:** [docs/launch/RELEASE_NOTES_v6.0.2.md](docs/launch/RELEASE_NOTES_v6.0.2.md)
156
- **Strategic roadmap (v7+):** [docs/ROADMAP-v7.md](docs/ROADMAP-v7.md)
157
- **Launch playbook:** [docs/VIRAL-PLAYBOOK.md](docs/VIRAL-PLAYBOOK.md)
158
-
159
- ---
160
-
161
- ## 🔥 Why Shadow Brain? (the 60-second pitch)
162
-
163
- | Without Shadow Brain | With Shadow Brain v6 |
164
- |---|---|
165
- | Every new session → agent starts from zero | 2K-token briefing injected **before** the first prompt |
166
- | Cursor learns X → Claude doesn't know | **One singleton brain** every agent shares |
167
- | Claude Task spawns sub-agent → sub-agent starts blind | **SABB** injects focused context slivers into every sub-agent |
168
- | You can't explain *why* the AI made a choice | **Causal Memory Chains** render the full DAG of causes |
169
- | Two agents touching the same file = merge hell | **Collision Detective** catches it in real time |
170
- | Agents work, then go idle — wasted compute | **Dream Engine** reflects during idle, runs counterfactuals |
171
- | No verifiable record of agent decisions | **Ed25519-signed Reputation Ledger** — tamper-proof receipts |
172
- | Token bills explode across Opus / GPT / Gemini | **Token Economy** routes to cheapest model that passes confidence |
173
- | Needs its own API key for everything | **Agent-proxy mode** reuses your existing Claude/Cursor/Codex config |
174
- | Every tool runs hot, every key leaks | **Air-Gap mode** + ChaCha20 encryption at rest |
175
-
176
- ---
177
-
178
- ## 🌟 22 Novel Modules — None Exist in Any Other Tool
179
-
180
- > *This isn't a wrapper around someone else's API. All 22 are first-party research-grade implementations, persisted to disk, with real tests.*
181
-
182
- ### 🧠 Cognition
183
- 1. **Sub-Agent Brain Bridge (SABB)** — sync brain context into Claude Task / Cursor Composer / CrewAI / LangGraph / AutoGen sub-agents
184
- 2. **Causal Memory Chains** — every decision links to its causes; Graphviz DOT export
185
- 3. **Dream Engine** — idle-time reflection: revisit / counterfactual / consolidation / contradiction / pattern-discovery
186
- 4. **Swarm Debate Protocol** — pro / con / arbiter sub-agents for critical decisions
187
- 5. **Pre-Mortem Assistant** — surfaces past failures from *your* project before you start
188
- 6. **Branch Brains** — git-branch-aware memory context
189
-
190
- ### 🔍 Transparency & Trust
191
- 7. **Agent Reputation Ledger** — Ed25519-signed receipts, portable accuracy score
192
- 8. **Attention Heatmap** — weighted attribution showing which memories shaped a decision
193
- 9. **Confidence Calibration Monitor** — Brier scores + automatic trust-weighting
194
- 10. **Formal Verification Bridge** — natural-language rules → ESLint / Semgrep / LSP diagnostics
195
- 11. **Agent Collision Detective** — real-time overlap detection with advisory locks
196
-
197
- ### 💰 Economy & Memory
198
- 12. **Token Economy Engine** — cross-agent spend, savings suggestions, routing advice
199
- 13. **Cost-Aware Sub-Agent Spawner** — auto-route trivial tasks to cheaper models
200
- 14. **Forgetting Curve + Sleep Consolidation** — Ebbinghaus-inspired biological memory
201
-
202
- ### 🔒 Privacy & Safety
203
- 15. **Air-Gap Mode** — zero outbound network, localhost-only
204
- 16. **E2E Encryption** — ChaCha20-Poly1305 at rest
205
- 17. **Hallucination Quarantine** — isolate suspect memories, auto-expire in 7 days
206
-
207
- ### ✨ Delight & Network Effects
208
- 18. **Voice Mode** — natural-language intent parser for transcripts
209
- 19. **Brain Garden** — animated visualization of memory as a living constellation
210
- 20. **PR Auto-Review** — GitHub PR comments citing project memories
211
- 21. **Team Brain Sync (WebRTC)** — peer-to-peer shared brain, no server
212
- 22. **Brain Exchange** — export / import curated shareable brain slices
213
-
214
- ### ⚡ Accelerators
215
- - **Local-First LLM** — Ollama default; optional Anthropic / OpenAI / OpenRouter / Moonshot / Gemini / DeepSeek / Mistral
216
- - **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
217
-
218
- ---
219
-
220
- ## 🖥️ Complete Web Control Dashboard
221
-
222
- Start it:
223
- ```bash
224
- shadow-brain dash .
225
- # → http://localhost:7341/
226
- ```
227
-
228
- **28 tabs. Real-time data. Full control.** Every feature has live monitoring + interactive controls. Preview:
229
-
230
- | | | |
231
- |---|---|---|
232
- | ![Overview](docs/launch/screenshots/01-overview.png) | ![Live Graph](docs/launch/screenshots/02-graph.png) | ![Agents](docs/launch/screenshots/03-agents.png) |
233
- | **Overview** — live counters, charts | **Live Graph** — animated signal flow | **Agents** — connect / disconnect per agent |
234
- | ![Chat](docs/launch/screenshots/04-chat.png) | ![Memory](docs/launch/screenshots/05-memory.png) | ![SABB](docs/launch/screenshots/07-sabb.png) |
235
- | **Chat with Brain** — RAG with citations | **Memory Browser** — semantic search | **SABB** — sliver generator + quarantine |
236
- | ![Causal](docs/launch/screenshots/08-causal.png) | ![Dream](docs/launch/screenshots/10-dream.png) | ![Reputation](docs/launch/screenshots/11-reputation.png) |
237
- | **Causal Chains** — traceable decisions | **Dream Engine** — reflection insights | **Reputation** — Ed25519 leaderboard |
238
- | ![Tokens](docs/launch/screenshots/19-tokens.png) | ![Models](docs/launch/screenshots/27-models.png) | ![Command](docs/launch/screenshots/29-command-palette.png) |
239
- | **Token Economy** — $ saved live | **Models & Intelligence** — 8 providers | **⌘K Command Palette** |
240
-
241
- **→ [Browse all 29 tab screenshots](docs/launch/screenshots/)**
242
-
243
- 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.
244
-
245
- ---
246
-
247
- ## 🧩 Works With Every AI Coding Agent
248
-
249
- | Agent | Adapter | Hook target |
250
- |---|---|---|
251
- | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | ✅ Native | `~/.claude/settings.json` hooks.SessionStart |
252
- | [Cursor](https://cursor.sh/) | ✅ Native | `.cursor/rules/shadow-brain.md` + MCP |
253
- | [Cline](https://github.com/cline/cline) | ✅ Native | VS Code globalStorage MCP |
254
- | [Codex](https://github.com/openai/codex) | ✅ Native | `~/.codex/config.json` |
255
- | [GitHub Copilot](https://github.com/features/copilot) | ✅ Native | `.github/copilot-instructions.md` |
256
- | [Windsurf](https://codeium.com/windsurf) | ✅ Native | `.windsurfrules` + MCP |
257
- | [Kilo Code](https://kilocode.ai/) | ✅ Native | `~/.kilocode/settings.json` |
258
- | [Roo Code](https://roocode.com/) | ✅ Native | `~/.roocode/mcp.json` |
259
- | [OpenCode](https://github.com/opencode-ai/opencode) | ✅ Native | `AGENT.md` |
260
- | [Aider](https://aider.chat/) | ✅ Native | `.aider.conf.yml` |
261
-
262
- **Custom agent?** Add its config path in the dashboard "Custom Agent Paths" panel — Shadow Brain will auto-read its provider + model + API key.
263
-
264
- **Sub-agent frameworks supported by SABB:** Claude Task, Cursor Composer, Cline Sub-step, CrewAI, LangGraph, AutoGen, generic.
265
-
266
- ---
267
-
268
- ## 🤖 Use Your Own LLM — or Your Agent's Already-Configured One
269
-
270
- Shadow Brain's **ModelRegistry** supports 8 providers out of the box:
271
-
272
- **Ollama (default, local, free)** · **Anthropic Claude** · **OpenAI** · **OpenRouter** · **Moonshot / Kimi** · **Google Gemini** · **DeepSeek** · **Mistral**
273
-
274
- 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**.
275
-
276
- Auto-discovery reads every agent config on your machine so you never retype a key.
277
-
278
- ---
279
-
280
- ## 📊 Real Numbers
281
-
282
- | Metric | Value |
283
- |---|---|
284
- | Brain modules | **48** |
285
- | CLI commands | **90+** |
286
- | MCP tools | **60+** |
287
- | REST endpoints | **50+** |
288
- | Tests passing | **148 / 148** |
289
- | TypeScript errors | **0** |
290
- | Supported agents | **10** (plus custom) |
291
- | Supported LLM providers | **8** (plus agent-proxy) |
292
- | Novel features nobody else has | **22** |
293
- | License | **MIT** |
294
- | Cost to run | **$0 forever** (local-first) |
295
-
296
- ---
297
-
298
- ## 🚀 30-Second Quickstart
299
-
300
- ```bash
301
- # 1. Install
302
- npx @theihtisham/agent-shadow-brain@latest attach-all
303
-
304
- # 2. Launch the dashboard
305
- shadow-brain dash .
306
- # → open http://localhost:7341/
307
-
308
- # 3. Seed the brain (optional — populates example data)
309
- shadow-brain reputation sign --agent claude-code --ver 4.7 --project demo \
310
- --decision "use bcrypt cost 12 for all password hashing" \
311
- --category security --confidence 0.92
312
-
313
- # 4. Every new AI agent session automatically gets context injected
314
- ```
315
-
316
- **That's it.** Open any project in Claude Code / Cursor / any supported agent — Shadow Brain is already running under the hood.
317
-
318
- ---
319
-
320
- ## 🧪 The Hive Mind Explainer (2 minutes)
321
-
322
- [![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)
323
-
324
- **[▶ 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.
325
-
326
- Local file: `docs/launch/shadow-brain-motion-explainer-narrated.mp4` (2:05 · 1080p · narrated).
327
-
328
- ---
329
-
330
- ## 📖 CLI Reference (top commands)
331
-
332
- ```bash
333
- # Attachment + lifecycle
334
- shadow-brain attach-all # wire every detected agent
335
- shadow-brain detach-all # remove every hook
336
- shadow-brain audit-hooks # list what's installed
337
- shadow-brain dash . # launch web dashboard at :7341
338
- shadow-brain mcp # start MCP server at :7342
339
-
340
- # v6 Hive Mind
341
- shadow-brain hive status # cross-module status
342
- shadow-brain subagent sliver --parent claude-code --task "refactor auth"
343
- shadow-brain causal trace <id> # render ancestor DAG
344
- shadow-brain dream run # trigger idle reflection now
345
- shadow-brain debate "Redis or Postgres?" --context "10k users"
346
- shadow-brain premortem "migrate auth to passkeys"
347
- shadow-brain reputation sign --agent claude-code --ver 4.7 --project X \
348
- --decision "..." --category security --confidence 0.92
349
- shadow-brain reputation badge claude-code --ver 4.7
350
-
351
- # Memory + analytics
352
- shadow-brain global recall --keywords "auth"
353
- shadow-brain tokens report # cross-agent spend + savings
354
- shadow-brain forget consolidate # run sleep cycle
355
- shadow-brain formal generate "always use parameterized SQL"
356
- shadow-brain formal export-eslint
357
-
358
- # Privacy + trust
359
- shadow-brain airgap enable --policy strict
360
- shadow-brain encrypt file ~/.shadow-brain/global.json --passphrase ...
361
- shadow-brain quarantine list
362
-
363
- # Sharing
364
- shadow-brain exchange export --name "react-expert-v1" --tags react,auth
365
- shadow-brain exchange import ~/brain-packs/react-expert-v1.json
366
-
367
- # Full list
368
- shadow-brain --help
369
- ```
370
-
371
- ---
372
-
373
- ## 🎯 Tweetable Talking Points
374
-
375
- > *"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."*
376
-
377
- > *"Every AI decision Shadow Brain makes is Ed25519-signed. Every cause is traced. Every collision is caught before it happens. Free forever."*
378
-
379
- > *"22 novel features nobody else has. Free. Open source. Local-first. `npx @theihtisham/agent-shadow-brain`."*
380
-
381
- ---
382
-
383
- ## 🛠️ For Contributors
384
-
385
- ```bash
386
- git clone https://github.com/theihtisham/agent-shadow-brain.git
387
- cd agent-shadow-brain
388
- npm install
389
- npm run build
390
- npm test # 148/148 tests
391
- npm run dev # ts-node dev mode
392
-
393
- # Rebuild the explainer video
394
- node tools/record-motion-explainer.mjs
395
-
396
- # Capture fresh dashboard screenshots
397
- node tools/capture-screenshots.mjs
398
-
399
- # Seed the brain with demo data
400
- node tools/seed-brain.mjs
401
- ```
402
-
403
- Issues, PRs, discussions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
404
-
405
- ---
406
-
407
- ## 📚 Documentation
408
-
409
- - **[CHANGELOG.md](CHANGELOG.md)** — release notes
410
- - **[docs/versions/v6.0.0.md](docs/versions/v6.0.0.md)** — v6 release details
411
- - **[docs/launch/HIVEMIND_VIDEO.md](docs/launch/HIVEMIND_VIDEO.md)** — video production pipeline
412
- - **[docs/launch/screenshots/](docs/launch/screenshots/)** — all 29 dashboard screenshots
413
- - **[SECURITY.md](SECURITY.md)** — security policy
414
- - **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** — community guidelines
415
-
416
- ---
417
-
418
- ## 💬 Community
419
-
420
- - **[GitHub Issues](https://github.com/theihtisham/agent-shadow-brain/issues)** — bug reports, feature requests
421
- - **[GitHub Discussions](https://github.com/theihtisham/agent-shadow-brain/discussions)** — questions, ideas, show-and-tell
422
- - **[GitHub Releases](https://github.com/theihtisham/agent-shadow-brain/releases)** — download the explainer MP4 + release assets
423
-
424
- **If Shadow Brain makes your AI agents smarter, star the repo ⭐**
425
-
426
- ---
427
-
428
- ## ⭐ Stargazers Over Time
429
-
430
- [![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)
431
-
432
- ---
433
-
434
- ## 📜 License
435
-
436
- **MIT** — see [LICENSE](LICENSE).
437
-
438
- 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.
439
-
440
- ---
441
-
442
- <div align="center">
443
-
444
- ### Built by [@theihtisham](https://github.com/theihtisham)
445
-
446
- <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>
447
- <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>
448
-
449
- ### The Hive Mind for every AI coding agent on your machine.
450
-
451
- **`npx @theihtisham/agent-shadow-brain@latest attach-all`**
452
-
453
- <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>
454
-
455
- </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