Skip to content

Latest commit

Β 

History

History
370 lines (266 loc) Β· 18.7 KB

File metadata and controls

370 lines (266 loc) Β· 18.7 KB
Shadow Brain v6.0 β€” Hive Mind lsdefine%2FGenericAgent | Trendshift

🎬 2-minute explainer above β€” auto-plays muted Β· click πŸ”Š to unmute Β· or open on Release page

npm version npm downloads GitHub stars license TypeScript node Brain Modules CLI Commands MCP Tools Tests Local First Free


🧠 Shadow Brain v6.0 β€” Hive Mind

The first open-source brain that every AI coding agent on your machine can share.

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.

# 30 seconds. Every agent + sub-agent on your machine becomes smarter.
npx @theihtisham/agent-shadow-brain@latest attach-all

🎬 Video Β· πŸ“¦ npm Β· ⭐ Star on GitHub Β· πŸ“š Docs Β· πŸ› Issues


⚑ Install in 30 seconds

# Method 1 β€” one command, every agent wired, dashboard launches
npx @theihtisham/agent-shadow-brain@latest attach-all

# Method 2 β€” global install
npm install -g @theihtisham/agent-shadow-brain
shadow-brain attach-all
shadow-brain dash .                 # β†’ http://localhost:7341/

# Method 3 β€” in a specific project only
cd my-project
npx @theihtisham/agent-shadow-brain attach-all

Zero config. Zero API key required. 100 % local-first.


πŸ”₯ Why Shadow Brain? (the 60-second pitch)

Without Shadow Brain With Shadow Brain v6
Every new session β†’ agent starts from zero 2K-token briefing injected before the first prompt
Cursor learns X β†’ Claude doesn't know One singleton brain every agent shares
Claude Task spawns sub-agent β†’ sub-agent starts blind SABB injects focused context slivers into every sub-agent
You can't explain why the AI made a choice Causal Memory Chains render the full DAG of causes
Two agents touching the same file = merge hell Collision Detective catches it in real time
Agents work, then go idle β€” wasted compute Dream Engine reflects during idle, runs counterfactuals
No verifiable record of agent decisions Ed25519-signed Reputation Ledger β€” tamper-proof receipts
Token bills explode across Opus / GPT / Gemini Token Economy routes to cheapest model that passes confidence
Needs its own API key for everything Agent-proxy mode reuses your existing Claude/Cursor/Codex config
Every tool runs hot, every key leaks Air-Gap mode + ChaCha20 encryption at rest

🌟 22 Novel Modules β€” None Exist in Any Other Tool

This isn't a wrapper around someone else's API. All 22 are first-party research-grade implementations, persisted to disk, with real tests.

🧠 Cognition

  1. Sub-Agent Brain Bridge (SABB) β€” sync brain context into Claude Task / Cursor Composer / CrewAI / LangGraph / AutoGen sub-agents
  2. Causal Memory Chains β€” every decision links to its causes; Graphviz DOT export
  3. Dream Engine β€” idle-time reflection: revisit / counterfactual / consolidation / contradiction / pattern-discovery
  4. Swarm Debate Protocol β€” pro / con / arbiter sub-agents for critical decisions
  5. Pre-Mortem Assistant β€” surfaces past failures from your project before you start
  6. Branch Brains β€” git-branch-aware memory context

πŸ” Transparency & Trust

  1. Agent Reputation Ledger β€” Ed25519-signed receipts, portable accuracy score
  2. Attention Heatmap β€” weighted attribution showing which memories shaped a decision
  3. Confidence Calibration Monitor β€” Brier scores + automatic trust-weighting
  4. Formal Verification Bridge β€” natural-language rules β†’ ESLint / Semgrep / LSP diagnostics
  5. Agent Collision Detective β€” real-time overlap detection with advisory locks

πŸ’° Economy & Memory

  1. Token Economy Engine β€” cross-agent spend, savings suggestions, routing advice
  2. Cost-Aware Sub-Agent Spawner β€” auto-route trivial tasks to cheaper models
  3. Forgetting Curve + Sleep Consolidation β€” Ebbinghaus-inspired biological memory

πŸ”’ Privacy & Safety

  1. Air-Gap Mode β€” zero outbound network, localhost-only
  2. E2E Encryption β€” ChaCha20-Poly1305 at rest
  3. Hallucination Quarantine β€” isolate suspect memories, auto-expire in 7 days

✨ Delight & Network Effects

  1. Voice Mode β€” natural-language intent parser for transcripts
  2. Brain Garden β€” animated visualization of memory as a living constellation
  3. PR Auto-Review β€” GitHub PR comments citing project memories
  4. Team Brain Sync (WebRTC) β€” peer-to-peer shared brain, no server
  5. Brain Exchange β€” export / import curated shareable brain slices

⚑ Accelerators

  • Local-First LLM β€” Ollama default; optional Anthropic / OpenAI / OpenRouter / Moonshot / Gemini / DeepSeek / Mistral
  • Hive Accelerator β€” SSSP (arXiv 2504.17033) + TurboQuant (ICLR 2026) for fast causal traversal + 6Γ— vector compression

πŸ–₯️ Complete Web Control Dashboard

Start it:

shadow-brain dash .
# β†’ http://localhost:7341/

28 tabs. Real-time data. Full control. Every feature has live monitoring + interactive controls. Preview:

Overview Live Graph Agents
Overview β€” live counters, charts Live Graph β€” animated signal flow Agents β€” connect / disconnect per agent
Chat Memory SABB
Chat with Brain β€” RAG with citations Memory Browser β€” semantic search SABB β€” sliver generator + quarantine
Causal Dream Reputation
Causal Chains β€” traceable decisions Dream Engine β€” reflection insights Reputation β€” Ed25519 leaderboard
Tokens Models Command
Token Economy β€” $ saved live Models & Intelligence β€” 8 providers ⌘K Command Palette

β†’ Browse all 29 tab screenshots

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.


🧩 Works With Every AI Coding Agent

Agent Adapter Hook target
Claude Code βœ… Native ~/.claude/settings.json hooks.SessionStart
Cursor βœ… Native .cursor/rules/shadow-brain.md + MCP
Cline βœ… Native VS Code globalStorage MCP
Codex βœ… Native ~/.codex/config.json
GitHub Copilot βœ… Native .github/copilot-instructions.md
Windsurf βœ… Native .windsurfrules + MCP
Kilo Code βœ… Native ~/.kilocode/settings.json
Roo Code βœ… Native ~/.roocode/mcp.json
OpenCode βœ… Native AGENT.md
Aider βœ… Native .aider.conf.yml

Custom agent? Add its config path in the dashboard "Custom Agent Paths" panel β€” Shadow Brain will auto-read its provider + model + API key.

Sub-agent frameworks supported by SABB: Claude Task, Cursor Composer, Cline Sub-step, CrewAI, LangGraph, AutoGen, generic.


πŸ€– Use Your Own LLM β€” or Your Agent's Already-Configured One

Shadow Brain's ModelRegistry supports 8 providers out of the box:

Ollama (default, local, free) Β· Anthropic Claude Β· OpenAI Β· OpenRouter Β· Moonshot / Kimi Β· Google Gemini Β· DeepSeek Β· Mistral

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.

Auto-discovery reads every agent config on your machine so you never retype a key.


πŸ“Š Real Numbers

Metric Value
Brain modules 48
CLI commands 90+
MCP tools 60+
REST endpoints 50+
Tests passing 148 / 148
TypeScript errors 0
Supported agents 10 (plus custom)
Supported LLM providers 8 (plus agent-proxy)
Novel features nobody else has 22
License MIT
Cost to run $0 forever (local-first)

πŸš€ 30-Second Quickstart

# 1. Install
npx @theihtisham/agent-shadow-brain@latest attach-all

# 2. Launch the dashboard
shadow-brain dash .
# β†’ open http://localhost:7341/

# 3. Seed the brain (optional β€” populates example data)
shadow-brain reputation sign --agent claude-code --ver 4.7 --project demo \
  --decision "use bcrypt cost 12 for all password hashing" \
  --category security --confidence 0.92

# 4. Every new AI agent session automatically gets context injected

That's it. Open any project in Claude Code / Cursor / any supported agent β€” Shadow Brain is already running under the hood.


πŸ§ͺ The Hive Mind Explainer (2 minutes)

Shadow Brain Hive Mind Explainer β€” 2 minutes

β–Ά Click here to watch Β· Full motion graphics explainer with voice-over walking through every feature, the live dashboard, and the 30-second install.

Local file: docs/launch/shadow-brain-motion-explainer-narrated.mp4 (2:05 Β· 1080p Β· narrated).


πŸ“– CLI Reference (top commands)

# Attachment + lifecycle
shadow-brain attach-all          # wire every detected agent
shadow-brain detach-all          # remove every hook
shadow-brain audit-hooks         # list what's installed
shadow-brain dash .              # launch web dashboard at :7341
shadow-brain mcp                 # start MCP server at :7342

# v6 Hive Mind
shadow-brain hive status         # cross-module status
shadow-brain subagent sliver --parent claude-code --task "refactor auth"
shadow-brain causal trace <id>   # render ancestor DAG
shadow-brain dream run           # trigger idle reflection now
shadow-brain debate "Redis or Postgres?" --context "10k users"
shadow-brain premortem "migrate auth to passkeys"
shadow-brain reputation sign --agent claude-code --ver 4.7 --project X \
  --decision "..." --category security --confidence 0.92
shadow-brain reputation badge claude-code --ver 4.7

# Memory + analytics
shadow-brain global recall --keywords "auth"
shadow-brain tokens report       # cross-agent spend + savings
shadow-brain forget consolidate  # run sleep cycle
shadow-brain formal generate "always use parameterized SQL"
shadow-brain formal export-eslint

# Privacy + trust
shadow-brain airgap enable --policy strict
shadow-brain encrypt file ~/.shadow-brain/global.json --passphrase ...
shadow-brain quarantine list

# Sharing
shadow-brain exchange export --name "react-expert-v1" --tags react,auth
shadow-brain exchange import ~/brain-packs/react-expert-v1.json

# Full list
shadow-brain --help

🎯 Tweetable Talking Points

"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."

"Every AI decision Shadow Brain makes is Ed25519-signed. Every cause is traced. Every collision is caught before it happens. Free forever."

"22 novel features nobody else has. Free. Open source. Local-first. npx @theihtisham/agent-shadow-brain."


πŸ› οΈ For Contributors

git clone https://github.com/theihtisham/agent-shadow-brain.git
cd agent-shadow-brain
npm install
npm run build
npm test                # 148/148 tests
npm run dev             # ts-node dev mode

# Rebuild the explainer video
node tools/record-motion-explainer.mjs

# Capture fresh dashboard screenshots
node tools/capture-screenshots.mjs

# Seed the brain with demo data
node tools/seed-brain.mjs

Issues, PRs, discussions welcome. See CONTRIBUTING.md.


πŸ“š Documentation


πŸ’¬ Community

If Shadow Brain makes your AI agents smarter, star the repo ⭐


⭐ Stargazers Over Time

Star History Chart


πŸ“œ License

MIT β€” see LICENSE.

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.


Built by @theihtisham

GitHub npm

The Hive Mind for every AI coding agent on your machine.

npx @theihtisham/agent-shadow-brain@latest attach-all

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