@theihtisham/agent-shadow-brain 6.3.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +420 -391
  2. package/LICENSE +21 -21
  3. package/README.md +450 -438
  4. package/dist/adapters/aider.js +13 -13
  5. package/dist/adapters/base-adapter.js +14 -14
  6. package/dist/adapters/codex.js +8 -8
  7. package/dist/adapters/roo-code.js +18 -18
  8. package/dist/brain/adr-engine.js +11 -11
  9. package/dist/brain/analyzer.js +30 -30
  10. package/dist/brain/auto-update.js +1 -1
  11. package/dist/brain/brain-portability.js +1 -1
  12. package/dist/brain/global-brain.d.ts +52 -63
  13. package/dist/brain/global-brain.d.ts.map +1 -1
  14. package/dist/brain/global-brain.js +577 -339
  15. package/dist/brain/global-brain.js.map +1 -1
  16. package/dist/brain/health-score.js +19 -19
  17. package/dist/brain/learning-engine.js +59 -59
  18. package/dist/brain/mcp-server.d.ts +3 -0
  19. package/dist/brain/mcp-server.d.ts.map +1 -1
  20. package/dist/brain/mcp-server.js +50 -6
  21. package/dist/brain/mcp-server.js.map +1 -1
  22. package/dist/brain/orchestrator.js +1 -1
  23. package/dist/brain/plugin-system.js +23 -23
  24. package/dist/brain/pr-generator.js +19 -19
  25. package/dist/brain/project-context.js +1 -1
  26. package/dist/brain/project-context.js.map +1 -1
  27. package/dist/brain/report-generator.js +270 -270
  28. package/dist/brain/task-workflow.d.ts +22 -0
  29. package/dist/brain/task-workflow.d.ts.map +1 -0
  30. package/dist/brain/task-workflow.js +182 -0
  31. package/dist/brain/task-workflow.js.map +1 -0
  32. package/dist/brain/workflow-skills.d.ts +86 -0
  33. package/dist/brain/workflow-skills.d.ts.map +1 -0
  34. package/dist/brain/workflow-skills.js +514 -0
  35. package/dist/brain/workflow-skills.js.map +1 -0
  36. package/dist/cli.js +107 -34
  37. package/dist/cli.js.map +1 -1
  38. package/dist/dashboard/server.js +1 -1
  39. package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
  40. package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
  41. package/dist/dashboard/v6-dashboard-html.js +5 -5
  42. package/dist/index.d.ts +6 -0
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +4 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/types.d.ts +28 -10
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/watchers/git-watcher.d.ts.map +1 -1
  49. package/dist/watchers/git-watcher.js +1 -1
  50. package/dist/watchers/git-watcher.js.map +1 -1
  51. package/dist/workflow-cli.d.ts +3 -0
  52. package/dist/workflow-cli.d.ts.map +1 -0
  53. package/dist/workflow-cli.js +100 -0
  54. package/dist/workflow-cli.js.map +1 -0
  55. package/docs/WORKFLOW_INTEGRATION.md +105 -0
  56. package/docs/launch/RELEASE_CHECKLIST_v7.0.0.md +24 -0
  57. package/docs/launch/RELEASE_NOTES_v7.0.0.md +44 -0
  58. package/docs/launch/RELEASE_NOTES_v7.1.0.md +32 -0
  59. package/package.json +213 -204
  60. package/skills/shadow-debug/SKILL.md +16 -0
  61. package/skills/shadow-implement/SKILL.md +16 -0
  62. package/skills/shadow-release/SKILL.md +16 -0
  63. package/skills/shadow-research/SKILL.md +12 -0
  64. package/skills/shadow-review/SKILL.md +14 -0
  65. package/skills/shadow-workflow/SKILL.md +31 -0
  66. package/docs/launch/README.md +0 -61
package/CHANGELOG.md CHANGED
@@ -1,391 +1,420 @@
1
- # Changelog
2
-
3
- ## [6.3.0] - 2026-06-06 - Recall Confidence + Issue-Bot Spam Fix
4
-
5
- This release adds per-memory recall confidence scoring and fixes a GitHub Actions
6
- issue-bot that was opening duplicate milestone/spike issues.
7
-
8
- ### Added
9
-
10
- - `GlobalBrain.recallScored()`: recall enriched with a blended `RecallConfidence` per entry. Signals: keyword relevance, recency (30-day half-life decay), author-assigned importance, cross-agent corroboration, and prior usage. Results are ranked by confidence and support a `minConfidence` floor.
11
- - `RecallConfidence` and `ScoredGlobalEntry` types in `src/types.ts`.
12
- - MCP tool `global_recall_scored` exposing scored recall to compatible clients.
13
- - Dashboard recall results now show a color-coded confidence badge (high/medium/low) with a per-signal breakdown on hover; the `/api/v6/ww2br-recall` endpoint now returns scored results.
14
- - Focused tests in `tests/brain/global-recall-confidence.test.ts` for scoring, importance ranking, cross-agent corroboration, and `minConfidence` filtering.
15
-
16
- ### Fixed
17
-
18
- - Viral Amplifier bot opened dozens of duplicate `Milestone — 25 stars` and `Momentum spike` issues. Root causes: (1) the milestone job ran on every cron schedule (including the every-6h trending cron) instead of only the daily run, and (2) both scripts trusted local state files (`.github/.milestone-state.json`, `.github/.trending-state.json`) that the workflow never committed, so each fresh checkout reset state and re-fired.
19
- - `milestone-notifier.mjs` and `trending-detector.mjs` are now idempotent: they verify against GitHub (open/closed issues for milestones, open issues within the 24h window for spikes) before posting, and treat lookup failures as "skip" to stay spam-safe.
20
- - `viral-amplifier.yml`: milestone job restricted to the daily 14:00 UTC cron; `welcome-new-issue` now ignores bot-authored issues so the bot no longer triages its own issues.
21
-
22
- ## [6.0.3] - 2026-06-03 - Live Brain Release
23
-
24
- This release makes Shadow Brain more realistic and more useful for complex agent work. It focuses on source-backed long memory, live memory health, recall evals, agent briefings, and release-ready docs.
25
-
26
- ### Added
27
-
28
- - `src/brain/live-brain.ts`: Live Brain report engine for memory health, recall evals, hygiene actions, top memories, and agent briefings.
29
- - `src/brain/memory-seeder.ts`: verified memory seeding workflow with draft, user approval, agent approval, dual approval, reject, and seed-to-brain states.
30
- - `shadow-brain live-brain status`: shows memory quality, source coverage, recall health, and recommended actions.
31
- - `shadow-brain live-brain brief`: writes a markdown briefing for fresh sessions, handoffs, and context recovery.
32
- - `shadow-brain live-brain eval`: checks whether useful memory can be recalled for agent workflows.
33
- - `shadow-brain live-brain hygiene`: lists stale, duplicate, low-quality, and source-light memory issues.
34
- - `shadow-brain live-brain train-pack`: exports source-backed JSONL examples for evals, distillation, or local fine-tuning pipelines.
35
- - `/api/v6/live-brain` and the v6 dashboard Live Brain tab: dashboard/API route and UI for the same report and markdown briefing.
36
- - `/api/v6/memory-intelligence`: live memory data for source coverage, freshness, categories, agents, tags, recent writes, and approval queue counts.
37
- - `/api/v6/seed-*`: dashboard/API workflow for creating research drafts, approving/rejecting them, and committing approved drafts to global memory.
38
- - Dashboard Memory Seeder tab: select research agent, approval agent, approval mode, project path, sources, category, tags, and importance before writing durable memory.
39
- - Dashboard launch controls: `shadow-brain dash --host 127.0.0.1 --no-analysis` for fast UI/API startup on large repos.
40
- - MCP tools: `live_brain_status`, `live_brain_brief`, and `live_brain_train_pack`.
41
- - Focused tests for Live Brain scoring, briefing, recall eval, JSONL export, and memory seeding approval gates.
42
-
43
- ### Changed
44
-
45
- - README rewritten to be realistic about what the project does and does not do.
46
- - npm package version updated to `6.0.3`.
47
- - npm package description replaced with a practical local-first memory description.
48
- - Runtime-visible versions updated in CLI, auto-update, portability export, orchestrator status, and MCP server metadata.
49
- - Resume-pack source discovery now includes common repo docs such as `README.md`, `CHANGELOG.md`, `package.json`, and roadmap docs in addition to project-specific agent/progress files.
50
- - CLI config merging now honors explicit `watchMode: false` from one-shot commands.
51
- - Token Economy dashboard now separates the current runtime agent from historical model spend records, avoiding misleading labels such as an old Claude model appearing as the active Codex runtime.
52
-
53
- ### Notes
54
-
55
- - "Training" in this release means data export for user-run evals, distillation, or local fine-tuning. Shadow Brain does not modify remote model weights.
56
- - No new runtime dependencies were added.
57
- - Verification: TypeScript build passed; the full Vitest suite passed; `npm pack --dry-run` passed.
58
-
59
- ---
60
-
61
- All notable changes to `@theihtisham/agent-shadow-brain` are documented here.
62
-
63
- This project follows [Semantic Versioning](https://semver.org/) and [Keep a Changelog](https://keepachangelog.com/) conventions.
64
-
65
- > For detailed release notes with migration guides, see the [docs/versions/](docs/versions/) directory.
66
-
67
- ---
68
-
69
- ## [6.0.2] — 2026-05-12 — Singularity Edition (Current)
70
-
71
- > **5 world-first viral features + real ANN vector index + Constitution layer + Confidence Gate + multimodal vision + LoRA distillation pipeline + SWE-Bench-Lite eval harness. Semver-strict this is v7.0.0; numbered 6.0.2 by author preference. See `docs/launch/RELEASE_NOTES_v6.0.2.md` for the full story.**
72
-
73
- ### Added — 5 viral world-first features
74
-
75
- 1. **Brain Replay** (`src/brain/brain-replay.ts`) — scrubbable timeline of every brain event since day zero. Exports tweet-ready SVG with density histogram + milestone markers.
76
- 2. **Brain DNA** (`src/brain/brain-dna.ts`) — Spotify-Wrapped-style 1080×1080 fingerprint card per codebase. 8 personality archetypes (Architect, Debugger, Speedster, Scholar, Cartographer, Diplomat, Sentinel, Wanderer).
77
- 3. **Hive Voice** (`src/brain/hive-voice.ts`) — multi-model debate-vote on any question. Outputs SVG consensus bar chart with explicit dissent + confidence distribution.
78
- 4. **Brain Time Capsule** (`src/brain/brain-time-capsule.ts`) — freeze + label + resurrect brain snapshots. Ed25519-signed (stub) `.tcz` bundles.
79
- 5. **Brain Diff** (`src/brain/brain-diff.ts`) — semantic diff between two brains. Outputs Venn-diagram SVG + English narrative.
80
-
81
- ### Added — infrastructure
82
-
83
- 6. **Real ANN vector index v2** (`src/brain/embeddings-v2.ts`) — hand-rolled HNSW-style graph (M=8, efSearch=32). Sub-100ms recall over 10k vectors. Sharded persistence (5MB cap). Auto-pulls `nomic-embed-text` from Ollama on first run. Zero new deps.
84
- 7. **Constitution layer** (`src/brain/constitution.ts`) — `<project>/.shadow-brain/constitution.md` parser + injector + validator. Hot-reload via fs.watch. Logs violations to JSONL.
85
- 8. **Confidence Gate** (`src/brain/confidence-gate.ts`) — active output filter (`block` / `downgrade` / `flag` modes). Persists calibration history; reports Brier score + ECE.
86
- 9. **Multimodal vision** (`src/brain/multimodal-vision.ts`) — Ollama llava/llava-llama3/bakllava integration. Image ingestion → description → embedding → indexed search.
87
- 10. **Markdown brain export/import** (`src/brain/markdown-export.ts`) — git-trackable `.shadow-brain.md` round-trip. Diff before write.
88
- 11. **OpenTelemetry-lite tracing** (`src/brain/otel-lite.ts`) — zero-dep OTel-compatible JSONL tracer. Daily file rotation. `tracer.withSpan(name, fn)` helper.
89
-
90
- ### Added — research-grade scaffolds
91
-
92
- 12. **Project-LoRA distillation pipeline** (`tools/lora-pipeline/`) — `generate_training_data.py`, `train_lora.py`, `eval_lora.py`, `serve_lora.py`. Distill the brain into a Qwen2.5-Coder-1.5B LoRA adapter. Run when ready.
93
- 13. **SWE-Bench-Lite micro-eval harness** (`tools/swe-bench-lite/`) — 10 hand-curated public-repo bugs. `runner.py` + `score.py` + pre-filled `report-template.md`. Realistic expected lift: +20-40% resolution rate with brain on.
94
-
95
- ### Added — DX
96
-
97
- 14. **`shadow-brain demo` command** — 30-second hello-world: auto-ingests sample repo, runs queries, opens dashboard.
98
- 15. **Forgetting curve transparency + pinning** — every memory shows decay reason; `pin: true` flag prevents auto-decay.
99
- 16. **Dashboard tour video** (`docs/launch/shadow-brain-dashboard-tour.mp4`) — 5-minute narrated walkthrough of every panel.
100
- 17. **MCP server hardening** — better discovery, full feature surface, docs at `/mcp/info`.
101
-
102
- ### Changed
103
-
104
- - `embeddings.ts` kept untouched; `embeddings-v2.ts` composes it (no breaking change for callers that imported v1)
105
- - `package.json` version → 6.0.2; description updated to reflect new features
106
- - README hero updated with v6.0.2 feature row + new install command
107
-
108
- ### Docs
109
-
110
- - `docs/launch/RELEASE_NOTES_v6.0.2.md` — full release notes
111
- - `docs/ROADMAP-v7.md` — v7+ strategic plan
112
- - `docs/VIRAL-PLAYBOOK.md` — launch playbook
113
-
114
- ### Notes
115
-
116
- - **No new npm runtime dependencies.** Zero-dep philosophy preserved.
117
- - TypeScript strict mode passes. All new modules compile cleanly.
118
- - Backwards compatible with v6.0 brains; no migration required.
119
-
120
- ---
121
-
122
- ## [6.0.0] — 2026-04-24 — Hive Mind Edition
123
-
124
- > **Hive Mind for AI agents — the first sub-agent-aware brain. 22 genuinely new features. 100% local-first, free, open source.**
125
-
126
- ### The Hive Mind
127
-
128
- Before v6.0, every AI agent and sub-agent started from zero. Claude's `Task` tool, Cursor's Composer, CrewAI/LangGraph/AutoGen sub-agents — none shared memory with the parent. Shadow Brain v6 is the first tool that bridges the brain across frameworks AND into sub-agents.
129
-
130
- ### Added — 22 genuinely novel modules
131
-
132
- 1. **Sub-Agent Brain Bridge (SABB)** (`src/brain/subagent-bridge.ts`) — detects sub-agent spawns, computes focused context slivers, quarantines sub-agent memories until graduated (confidence ≥ 0.7).
133
- 2. **Causal Memory Chains** (`src/brain/causal-chains.ts`) — tracks cause→effect relationships, renders as Graphviz DAG, answers "why did X happen?"
134
- 3. **Agent Collision Detective** (`src/brain/collision-detective.ts`) — real-time overlapping edit intent detection with advisory locks.
135
- 4. **Dream Engine** (`src/brain/dream-engine.ts`) — background idle reflection via local LLM (Ollama): revisit, counterfactual, consolidation, contradiction, pattern-discovery.
136
- 5. **Agent Reputation Ledger** (`src/brain/reputation-ledger.ts`) — Ed25519-signed decision receipts with portable accuracy scores and shields.io badges.
137
- 6. **Swarm Debate Protocol** (`src/brain/swarm-debate.ts`) — pro/con/arbiter multi-agent debate for critical decisions.
138
- 7. **Pre-Mortem Assistant** (`src/brain/pre-mortem.ts`) — surfaces past failures from project memory before significant tasks.
139
- 8. **Branch Brains** (`src/brain/branch-brain.ts`) — git-branch-aware memory context switching.
140
- 9. **Attention Heatmap** (`src/brain/attention-heatmap.ts`) — weighted attribution of which memories influenced each decision.
141
- 10. **Token Economy Engine** (`src/brain/token-economy.ts`) — cross-agent cost tracking, monthly projections, savings suggestions.
142
- 11. **Forgetting Curve + Sleep Consolidation** (`src/brain/forgetting-curve.ts`) — Ebbinghaus-inspired natural decay + tier promotion.
143
- 12. **Formal Verification Bridge** (`src/brain/formal-verification-bridge.ts`) — natural-language rules → ESLint / Semgrep / LSP diagnostics.
144
- 13. **Confidence Calibration Monitor** (`src/brain/calibration-monitor.ts`) — Brier-score based agent trust weighting.
145
- 14. **Cost-Aware Sub-Agent Spawner** (`src/brain/cost-aware-spawner.ts`) — routes sub-agent spawns to cheapest model that satisfies task.
146
- 15. **Air-Gap Mode** (`src/brain/air-gap.ts`) — block outbound network; localhost-only.
147
- 16. **E2E Encryption** (`src/brain/brain-encryption.ts`) — ChaCha20-Poly1305 at rest with scrypt key derivation.
148
- 17. **Hallucination Quarantine** (`src/brain/hallucination-quarantine.ts`) — isolate suspect memories; auto-delete after 7 days.
149
- 18. **Voice Mode** (`src/brain/voice-mode.ts`) — transcript processing with brain integration.
150
- 19. **Brain Garden** (`src/brain/brain-garden.ts`) — living constellation visualization data source.
151
- 20. **PR Auto-Review** (`src/brain/pr-auto-review.ts`) — GitHub PR comment generator citing project memories.
152
- 21. **Team Brain Sync** (`src/brain/team-brain-sync.ts`) — P2P peer state layer for WebRTC team brain.
153
- 22. **Brain Exchange** (`src/brain/brain-exchange.ts`) — export + import curated shareable brain slices with redaction.
154
-
155
- ### Added — supporting infrastructure
156
-
157
- - **Local-First LLM Adapter** (`src/brain/local-llm.ts`) — unified Ollama-first adapter used by Dream Engine, Swarm Debate, Pre-Mortem. Graceful fallback when unreachable.
158
- - **Hive Accelerator** (`src/brain/hive-accelerator.ts`) — wires SSSP (arXiv 2504.17033) for causal traversal + TurboQuant (ICLR 2026) for similarity scoring.
159
- - **Complete Web Control Dashboard** (`src/dashboard/v6-dashboard-html.ts` + server routes) — 23-tab SPA at `http://localhost:7341/hive`. Controls every feature: enable/disable, configure, monitor. Agent connect/disconnect. Unified activity log. API+MCP configuration panels. Brain Garden D3 canvas.
160
- - **48 new CLI commands** grouped under `hive`, `subagent`, `causal`, `collision`, `dream`, `reputation`, `debate`, `premortem`, `branch-brain`, `attention`, `tokens`, `forget`, `formal`, `calibrate`, `airgap`, `encrypt`, `quarantine`, `voice`, `garden`, `pr-review`, `team-sync`, `exchange`.
161
- - **36 new MCP tool handlers** for every v6 module — any MCP-compatible AI tool can now call them.
162
- - **v6 integration tests** (`tests/brain/hivemind-v6.test.ts`) — 24 smoke tests covering every module.
163
-
164
- ### Changed
165
-
166
- - Version: `5.2.0` → `6.0.0`
167
- - Total brain modules: **26 → 48** (22 new v6 modules + Hive Accelerator + Local LLM)
168
- - CLI commands: **70+ → 90+**
169
- - MCP tools: **~27 → 60+** (existing + 36 v6 handlers)
170
- - README hero: v6.0 Hive Mind positioning with 22 novel features prominently listed
171
- - Web dashboard: `/` (legacy) + `/hive` or `/v6` (complete Hive Mind control)
172
- - `package.json` description + 25 new v6 keywords for maximum discoverability
173
-
174
- ### Removed
175
-
176
- - Repo hygiene cleanup — removed stray files (`C:Userstheihtmp_b64_3.txt`, `eng.traineddata`, `write_pattern.py`, `.playwright-mcp/`, `seo-gists/`, empty `.codex`). Updated `.gitignore` to prevent recurrence.
177
-
178
- ### Security
179
-
180
- - ChaCha20-Poly1305 AEAD encryption for brain-at-rest
181
- - Ed25519 cryptographic signatures on agent reputation receipts
182
- - Air-gap mode with RFC1918 + metadata-endpoint blocking
183
- - Hallucination quarantine prevents unverified claims from polluting global brain
184
-
185
- ### Philosophy
186
-
187
- **Local-first default.** All AI features (Dream Engine, Swarm Debate, Pre-Mortem, Voice) route to Ollama by default. Zero API keys needed. Zero network required. Zero cost to run. Shadow Brain works offline, in air-gapped environments, and in compliance-constrained enterprises. Remote providers (Anthropic, OpenAI, GLM) remain an optional upgrade — never a requirement.
188
-
189
- ---
190
-
191
- ## [5.2.0] — 2026-04-22 — Subconscious Singularity Edition
192
-
193
- > **One brain. Every agent. Every project. Every session. Forever.**
194
-
195
- ### The Singularity
196
-
197
- Before v5.2.0, every project had its own brain and every AI agent (Claude, Cursor, Cline...) had to be told what each project knew. Now there is **one brain** — a singleton global JSON store at `~/.shadow-brain/global.json` that every agent reads from and writes to.
198
-
199
- What Cursor learns in project A is instantly known to Claude Code in project B.
200
-
201
- ### Added
202
-
203
- - **Singleton Global Brain** (`src/brain/global-brain.ts`) — one `~/.shadow-brain/global.json` is the source of truth for every project + agent on the machine. Atomic write-and-rename plus an in-process write queue handles concurrent multi-agent writes without native dependencies. Auto-prune at 1GB. Project-scoped views via `GlobalBrain.projectIdFor(rootDir)`.
204
- - **Subconscious Engine** (`src/brain/subconscious.ts`) — proactive context injection on every session start. The agent doesn't have to ask — the brain surfaces recent decisions, active tasks, similar past work, project state, cross-agent insights, and warnings. Hard-capped at 2K tokens, relevance-ranked, agent-configurable.
205
- - **Universal Bootstrap** (`src/brain/session-hooks.ts`) — `asb attach-all` detects every installed AI agent on your machine and installs SessionStart hooks per agent's native mechanism (Claude Code settings.json, Cursor `.cursor/rules`, Cline VS Code extension, Windsurf `.windsurfrules`, Codex config.json, Aider `.aider.conf.yml`, Copilot `.github/copilot-instructions.md`, etc.). Every agent calls Shadow Brain on first prompt of every session.
206
- - **L0 In-Memory Hot Tier** (`src/brain/l0-cache.ts`) — sub-millisecond recall via byte-budgeted Map LRU. Sits in front of the global JSON brain. Per-namespace caches with `getCache(name)`. Default 64MB budget, configurable.
207
- - **Agent Safety Firewall** (`src/brain/agent-firewall.ts`) — blocks risky agent actions such as secret file access, destructive commands, curl-to-shell installs, and prompt-injection payloads before tools execute.
208
- - **Agent Handoff Packets** (`src/brain/agent-handoff.ts`) — `asb handoff cursor codex` generates a cross-agent continuation packet with task state, changed files, recent memories, and safety warnings.
209
- - **Proof Timeline + Share Report** — `asb timeline` and `asb proof report` expose the viral proof stream: what agents learned, when, and what the firewall blocked.
210
- - **Cursor Adapter** (`src/adapters/cursor.ts`) — first-class adapter, no more falling back to ClineAdapter. Reads conversations from `~/.cursor/conversations`, injects into `.cursor/rules/shadow-brain-insights.md`, escalates critical insights to `.cursorrules`.
211
- - **Windsurf Adapter** (`src/adapters/windsurf.ts`) — first-class adapter. Reads from `~/.windsurf/conversations`, writes to `.windsurfrules` with `# === Shadow Brain Insights ===` marker for safe re-injection.
212
- - **GitHub Copilot Adapter** (`src/adapters/copilot.ts`) — workspace-level integration via `.github/copilot-instructions.md` (Copilot's official context file). Replaces a marker block on each update so injection is idempotent.
213
- - **4 New CLI Commands**:
214
- - `asb attach-all` — universal bootstrap for every detected agent
215
- - `asb subconscious inject|status|configure` — manage proactive context injection
216
- - `asb global stats|recall|cache|sync` — inspect the singleton global brain
217
- - `asb handoff`, `asb timeline`, `asb firewall`, `asb detach-all`, `asb audit-hooks`, `asb proof report` — trust, safety, and launch-proof commands
218
- - **4 New MCP Tools** — `subconscious_inject`, `global_recall`, `global_stats`, `attach_status`. Now any MCP client can talk to the global brain directly.
219
-
220
- ### Changed
221
-
222
- - **AgentTool union** now includes `'copilot'` — full type-safe support for 10 agents (was 9)
223
- - **adapters/index.ts** — Cursor and Windsurf no longer alias ClineAdapter; each gets its own implementation
224
- - **Description + 80 npm keywords** rewritten for v5.2.0 positioning and maximum discoverability
225
- - **Total brain modules: 26** (4 new + 22 from v5.1.1)
226
-
227
- ### Performance
228
-
229
- - Hot recalls now <1ms via L0 cache (was 10-30ms via SQLite)
230
- - Cross-project queries replace per-project DB lookup overhead with a single indexed query
231
-
232
- ### Fixed
233
-
234
- - Cursor and Windsurf adapters previously reused ClineAdapter — they now have correct path detection and conversation parsing for their actual file layouts
235
-
236
- ### Migration Notes
237
-
238
- v5.2.0 is **fully backward-compatible** with v5.1.1. The global brain is created on first init and coexists with project-local brains. No breaking changes to existing CLI commands or MCP tools.
239
-
240
- To opt into the new singleton model: run `asb attach-all` once and every future session of every agent will auto-bootstrap.
241
-
242
- ---
243
-
244
- ## [5.1.1] — 2026-04-18 — Hyper-Cognitive Intelligence Edition
245
-
246
- ### Added
247
- - **Built-in LSP Server** — pure Node.js Language Server Protocol implementation with stdio + TCP transport modes, real-time diagnostics, hover info, and code actions
248
- - **Custom LLM Fine-Tuning Engine** — automatic training data generation from code changes, JSONL export, multi-model training pipeline
249
- - **Smart Cache** — 3-tier (hot/warm/cold) LRU cache with predictive prefetch via co-access graph, tag-based invalidation, and adaptive tier promotion
250
- - **Intent Engine** — multi-strategy NLP command understanding with keyword, fuzzy, and context-aware matching strategies
251
- - **Code DNA Fingerprinting** — 9-gene structural analysis covering structure, complexity, style, dependency, and evolution gene categories
252
- - **Temporal Intelligence** — velocity metrics, file heatmaps, 5-factor bug prediction, anomaly detection, and peak hour/day analysis
253
- - 6 new CLI commands: `lsp`, `fine-tune`, `cache`, `intent`, `dna`, `temporal`
254
- - 27 README badges for maximum discoverability
255
-
256
- ### Changed
257
- - Total brain modules: **22** (6 new + 16 from v5.0.1)
258
- - All v5.0.1, v5.0.0, and v4.0.0 features included and enhanced
259
- - Expanded npm keywords to 50+
260
-
261
- ### Fixed
262
- - 18 TypeScript compilation errors in CLI — aligned property references with actual module interfaces
263
-
264
- ---
265
-
266
- ## [5.0.1] — 2026-04-15 — Zero-Config Intelligence Edition
267
-
268
- ### Added
269
- - **Zero-Config Auto-Setup** — auto-detect project type, AI tools, languages, frameworks; setup is explicit and reversible in v5.2.0
270
- - **MCP Server** — 19-tool Model Context Protocol server for Claude Code, Cursor, and all AI tools
271
- - **Rich Web Dashboard** — real-time WebSocket dashboard with 8 panels (health, memory tiers, insights, fixes, AI tools, modules, stats, controls)
272
- - **Natural Language Queries** — `shadow-brain ask "..."` for plain-English brain interaction
273
- - **Plugin System** — hookable analysis pipeline with npm plugin discovery
274
- - **Brain Export/Import** — full brain state portability for team sync and backup
275
- - 5 new CLI commands: `off`, `ask`, `export`, `import`, `plugin`
276
- - **Cursor MCP Compatibility** — root path POST + `/v1/chat` endpoint support
277
- - **Postinstall Auto-Setup** — runs automatically after `npm install`
278
-
279
- ### Changed
280
- - 50+ npm keywords for discoverability
281
- - All v5.0.0 and v4.0.0 features included and enhanced
282
-
283
- ---
284
-
285
- ## [5.0.0] — 2026-04-12 — Infinite Intelligence Edition
286
-
287
- ### Added
288
- - **Hierarchical Memory Compression** — 4-tier pyramid (raw -> summary -> pattern -> principle) with drill-down/up navigation
289
- - **Context-Triggered Associative Recall** — automatic memory activation based on file paths, keywords, and categories
290
- - **Multi-Agent Consensus Protocol** — trust-weighted voting, confidence intervals, conflict resolution across multiple AI agents
291
- - **Collective Cross-Project Learning** — verified rule sharing, viral propagation, accuracy tracking across projects
292
- - 5 new CLI commands: `memory`, `recall`, `consensus`, `collective`, `v5`
293
-
294
- ### Changed
295
- - Memory architecture fully rewritten for infinite retention
296
- - Cross-agent communication protocol standardized
297
-
298
- ---
299
-
300
- ## [4.0.0] — 2026-04-08 — Hyper-Intelligence Edition
301
-
302
- ### Added
303
- - **TurboQuant Infinite Memory** — 6x compression, zero forgetting (based on Google Research, ICLR 2026)
304
- - **SSSP BMSSP Routing** — O(m log^(2/3) n) deterministic routing (based on arXiv 2504.17033, Duan et al.)
305
- - **Self-Evolving Genetic Rules** — tournament selection, Gaussian mutation, Bayesian meta-learning
306
- - **Cross-Agent Intelligence Protocol (CAIP)** — 7 agents share insights in real-time via WebSocket
307
- - **Adversarial Hallucination Defense** — cross-reference verification, evidence scoring, confidence thresholds
308
- - **Swarm Intelligence** — Ant Colony Optimization pheromone-based file prioritization
309
- - **Knowledge Graph + PageRank** — code entity impact radar with d=0.85 damping factor
310
- - **Predictive Engine** — bug risk scoring, technical debt forecasting, anomaly detection
311
- - 9 new CLI commands: `turbo`, `route`, `caip`, `evolve`, `predict`, `graph`, `swarm`, `defense`, `v4`
312
-
313
- ### Changed
314
- - All v3.0.0 features included and enhanced
315
- - Neural mesh upgraded with TurboMemory integration
316
- - Pattern memory upgraded with compressed vector storage
317
- - Learning engine upgraded with genetic optimization
318
-
319
- ---
320
-
321
- ## [3.0.0] — 2026-04-01 — Hyper-Intelligence Edition
322
-
323
- ### Added
324
- - **Cognitive Load Analysis** — estimates mental complexity of code sections
325
- - **Security Audit Engine** — vulnerability scanning, dependency risk assessment
326
- - **Influence Map** — tracks which code changes ripple through the codebase
327
- - Enhanced neural mesh with Shannon entropy and cosine similarity
328
- - Bayesian confidence scoring for all insights
329
-
330
- ### Changed
331
- - Analysis pipeline fully restructured for hyper-intelligence features
332
- - CLI expanded with security and cognitive commands
333
-
334
- ---
335
-
336
- ## [2.1.0] — 2026-03-25 — Quantum Neural Mesh
337
-
338
- ### Added
339
- - **Cross-Session Shared Intelligence** — persist and share insights across sessions
340
- - **Shannon Entropy Analysis** — information-theoretic code complexity measurement
341
- - **Cosine Similarity Matching** — semantic code comparison
342
- - **Bayesian Confidence** — probabilistic confidence scoring for recommendations
343
-
344
- ### Changed
345
- - Neural mesh architecture upgraded for cross-session persistence
346
- - Insight quality improved with entropy-based scoring
347
-
348
- ---
349
-
350
- ## [2.0.0] — 2026-03-18 — Super-Intelligence Edition
351
-
352
- ### Added
353
- - **Semantic Analyzer** — deep code understanding beyond syntax
354
- - **Dependency Graph** — full project dependency visualization and analysis
355
- - **Code Similarity Engine** — detect duplicated and near-duplicated code
356
- - **MCP Server** — initial Model Context Protocol server implementation
357
- - **Team Mode** — collaborative AI-assisted development
358
-
359
- ### Changed
360
- - Complete architecture rewrite from v1.x
361
- - CLI expanded from 15 to 35+ commands
362
-
363
- ---
364
-
365
- ## [1.x] — 2026-02 to 2026-03 — Foundation
366
-
367
- ### v1.2.0
368
- - Added vulnerability scanning
369
- - Added CI/CD integration hooks
370
-
371
- ### v1.1.0
372
- - Added smart fix suggestions
373
- - Added health scoring with weighted metrics
374
-
375
- ### v1.0.0
376
- - Initial release
377
- - 7 agent adapters (Claude Code, Cursor, Cline, Windsurf, Copilot, Kilo Code, Amp)
378
- - Basic health scoring and analysis pipeline
379
- - Vulnerability scanning
380
- - CLI with 15 commands
381
-
382
- ---
383
-
384
- [5.2.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.2.0
385
- [5.1.1]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.1.1
386
- [5.0.1]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.0.1
387
- [5.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.0.0
388
- [4.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v4.0.0
389
- [3.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v3.0.0
390
- [2.1.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v2.1.0
391
- [2.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v2.0.0
1
+ # Changelog
2
+
3
+ ## [7.1.0] - 2026-11-11 - Focused Workflows and Portable Skills
4
+
5
+ - Bundle six reusable skills for proportionate planning, implementation, diagnosis, review, research, and release work.
6
+ - Add project-local skill installation for Codex, Claude Code, OpenCode, DeepSeek Harness, and compatible portable clients. Preview by default; preserve user instructions, reject conflicting local edits and stale plans, validate paths, and back up managed updates.
7
+ - Add `skills list`, `skills show`, `skills targets`, `skills install`, and `workflow analyze` CLI commands.
8
+ - Add read-only `workflow_analyze` and `workflow_skills` MCP tools and public library APIs.
9
+ - Respect plan-only, diagnosis-only, and review-only scope in advisory routing. Add explicit task, mode, and complexity overrides; no provider calls or automatic task execution.
10
+ - Verify skill packaging, fresh-consumer installation, safe update behavior, and representative task scenarios.
11
+
12
+
13
+ ## [7.0.0] - 2026-11-11 - Durable Memory and Explained Recall
14
+
15
+ ### Breaking changes
16
+
17
+ - Require Node 22.12+ in 22.x, 24.x, or 26+; update dependency majors including simple-git, Zod, Anthropic SDK, and Vitest.
18
+ - Remove automatic install-time agent configuration. Setup is explicit.
19
+ - Reject unreadable, invalid, and unsupported stores without silently resetting or renaming them.
20
+ - Recall scoring uses real keyword coverage, creation-age recency, and matching-content agent reports. Existing minimum-confidence thresholds may return different results.
21
+
22
+ ### Added and fixed
23
+
24
+ - Serialize cross-process commits; merge latest data with pending operations, preserve external deletions, and use unique temporary files.
25
+ - Acknowledge queued writes after persistence, retain failed changes for retry, and expose structured storage diagnostics.
26
+ - Add `storage-health` and `recall-explain` commands, `global_storage_health` MCP tool, and public GlobalBrain library exports/types.
27
+ - Make scored recall finite and deterministic across the full candidate pool; explain matches and supporting identities.
28
+ - Load CLI configuration only when required, redact diagnostic key output, and escape dashboard activity text.
29
+ - Update dependencies, isolate tests from personal state, correct a date-dependent training-export test, add artifact consumer smoke checks, and expand CI to Windows/Linux on Node 22/24/26.
30
+ - Make legacy promotional automation manual-only.
31
+
32
+ ## [6.3.0] - 2026-06-06 - Recall Confidence + Issue-Bot Spam Fix
33
+
34
+ This release adds per-memory recall confidence scoring and fixes a GitHub Actions
35
+ issue-bot that was opening duplicate milestone/spike issues.
36
+
37
+ ### Added
38
+
39
+ - `GlobalBrain.recallScored()`: recall enriched with a blended `RecallConfidence` per entry. Signals: keyword relevance, recency (30-day half-life decay), author-assigned importance, cross-agent corroboration, and prior usage. Results are ranked by confidence and support a `minConfidence` floor.
40
+ - `RecallConfidence` and `ScoredGlobalEntry` types in `src/types.ts`.
41
+ - MCP tool `global_recall_scored` exposing scored recall to compatible clients.
42
+ - Dashboard recall results now show a color-coded confidence badge (high/medium/low) with a per-signal breakdown on hover; the `/api/v6/ww2br-recall` endpoint now returns scored results.
43
+ - Focused tests in `tests/brain/global-recall-confidence.test.ts` for scoring, importance ranking, cross-agent corroboration, and `minConfidence` filtering.
44
+
45
+ ### Fixed
46
+
47
+ - Viral Amplifier bot opened dozens of duplicate `Milestone — 25 stars` and `Momentum spike` issues. Root causes: (1) the milestone job ran on every cron schedule (including the every-6h trending cron) instead of only the daily run, and (2) both scripts trusted local state files (`.github/.milestone-state.json`, `.github/.trending-state.json`) that the workflow never committed, so each fresh checkout reset state and re-fired.
48
+ - `milestone-notifier.mjs` and `trending-detector.mjs` are now idempotent: they verify against GitHub (open/closed issues for milestones, open issues within the 24h window for spikes) before posting, and treat lookup failures as "skip" to stay spam-safe.
49
+ - `viral-amplifier.yml`: milestone job restricted to the daily 14:00 UTC cron; `welcome-new-issue` now ignores bot-authored issues so the bot no longer triages its own issues.
50
+
51
+ ## [6.0.3] - 2026-06-03 - Live Brain Release
52
+
53
+ This release makes Shadow Brain more realistic and more useful for complex agent work. It focuses on source-backed long memory, live memory health, recall evals, agent briefings, and release-ready docs.
54
+
55
+ ### Added
56
+
57
+ - `src/brain/live-brain.ts`: Live Brain report engine for memory health, recall evals, hygiene actions, top memories, and agent briefings.
58
+ - `src/brain/memory-seeder.ts`: verified memory seeding workflow with draft, user approval, agent approval, dual approval, reject, and seed-to-brain states.
59
+ - `shadow-brain live-brain status`: shows memory quality, source coverage, recall health, and recommended actions.
60
+ - `shadow-brain live-brain brief`: writes a markdown briefing for fresh sessions, handoffs, and context recovery.
61
+ - `shadow-brain live-brain eval`: checks whether useful memory can be recalled for agent workflows.
62
+ - `shadow-brain live-brain hygiene`: lists stale, duplicate, low-quality, and source-light memory issues.
63
+ - `shadow-brain live-brain train-pack`: exports source-backed JSONL examples for evals, distillation, or local fine-tuning pipelines.
64
+ - `/api/v6/live-brain` and the v6 dashboard Live Brain tab: dashboard/API route and UI for the same report and markdown briefing.
65
+ - `/api/v6/memory-intelligence`: live memory data for source coverage, freshness, categories, agents, tags, recent writes, and approval queue counts.
66
+ - `/api/v6/seed-*`: dashboard/API workflow for creating research drafts, approving/rejecting them, and committing approved drafts to global memory.
67
+ - Dashboard Memory Seeder tab: select research agent, approval agent, approval mode, project path, sources, category, tags, and importance before writing durable memory.
68
+ - Dashboard launch controls: `shadow-brain dash --host 127.0.0.1 --no-analysis` for fast UI/API startup on large repos.
69
+ - MCP tools: `live_brain_status`, `live_brain_brief`, and `live_brain_train_pack`.
70
+ - Focused tests for Live Brain scoring, briefing, recall eval, JSONL export, and memory seeding approval gates.
71
+
72
+ ### Changed
73
+
74
+ - README rewritten to be realistic about what the project does and does not do.
75
+ - npm package version updated to `6.0.3`.
76
+ - npm package description replaced with a practical local-first memory description.
77
+ - Runtime-visible versions updated in CLI, auto-update, portability export, orchestrator status, and MCP server metadata.
78
+ - Resume-pack source discovery now includes common repo docs such as `README.md`, `CHANGELOG.md`, `package.json`, and roadmap docs in addition to project-specific agent/progress files.
79
+ - CLI config merging now honors explicit `watchMode: false` from one-shot commands.
80
+ - Token Economy dashboard now separates the current runtime agent from historical model spend records, avoiding misleading labels such as an old Claude model appearing as the active Codex runtime.
81
+
82
+ ### Notes
83
+
84
+ - "Training" in this release means data export for user-run evals, distillation, or local fine-tuning. Shadow Brain does not modify remote model weights.
85
+ - No new runtime dependencies were added.
86
+ - Verification: TypeScript build passed; the full Vitest suite passed; `npm pack --dry-run` passed.
87
+
88
+ ---
89
+
90
+ All notable changes to `@theihtisham/agent-shadow-brain` are documented here.
91
+
92
+ This project follows [Semantic Versioning](https://semver.org/) and [Keep a Changelog](https://keepachangelog.com/) conventions.
93
+
94
+ > For detailed release notes with migration guides, see the [docs/versions/](docs/versions/) directory.
95
+
96
+ ---
97
+
98
+ ## [6.0.2] — 2026-05-12 — Singularity Edition (Current)
99
+
100
+ > **5 world-first viral features + real ANN vector index + Constitution layer + Confidence Gate + multimodal vision + LoRA distillation pipeline + SWE-Bench-Lite eval harness. Semver-strict this is v7.0.0; numbered 6.0.2 by author preference. See `docs/launch/RELEASE_NOTES_v6.0.2.md` for the full story.**
101
+
102
+ ### Added — 5 viral world-first features
103
+
104
+ 1. **Brain Replay** (`src/brain/brain-replay.ts`) — scrubbable timeline of every brain event since day zero. Exports tweet-ready SVG with density histogram + milestone markers.
105
+ 2. **Brain DNA** (`src/brain/brain-dna.ts`) — Spotify-Wrapped-style 1080×1080 fingerprint card per codebase. 8 personality archetypes (Architect, Debugger, Speedster, Scholar, Cartographer, Diplomat, Sentinel, Wanderer).
106
+ 3. **Hive Voice** (`src/brain/hive-voice.ts`) — multi-model debate-vote on any question. Outputs SVG consensus bar chart with explicit dissent + confidence distribution.
107
+ 4. **Brain Time Capsule** (`src/brain/brain-time-capsule.ts`) — freeze + label + resurrect brain snapshots. Ed25519-signed (stub) `.tcz` bundles.
108
+ 5. **Brain Diff** (`src/brain/brain-diff.ts`) — semantic diff between two brains. Outputs Venn-diagram SVG + English narrative.
109
+
110
+ ### Added — infrastructure
111
+
112
+ 6. **Real ANN vector index v2** (`src/brain/embeddings-v2.ts`) — hand-rolled HNSW-style graph (M=8, efSearch=32). Sub-100ms recall over 10k vectors. Sharded persistence (5MB cap). Auto-pulls `nomic-embed-text` from Ollama on first run. Zero new deps.
113
+ 7. **Constitution layer** (`src/brain/constitution.ts`) — `<project>/.shadow-brain/constitution.md` parser + injector + validator. Hot-reload via fs.watch. Logs violations to JSONL.
114
+ 8. **Confidence Gate** (`src/brain/confidence-gate.ts`) — active output filter (`block` / `downgrade` / `flag` modes). Persists calibration history; reports Brier score + ECE.
115
+ 9. **Multimodal vision** (`src/brain/multimodal-vision.ts`) — Ollama llava/llava-llama3/bakllava integration. Image ingestion → description → embedding → indexed search.
116
+ 10. **Markdown brain export/import** (`src/brain/markdown-export.ts`) — git-trackable `.shadow-brain.md` round-trip. Diff before write.
117
+ 11. **OpenTelemetry-lite tracing** (`src/brain/otel-lite.ts`) — zero-dep OTel-compatible JSONL tracer. Daily file rotation. `tracer.withSpan(name, fn)` helper.
118
+
119
+ ### Added — research-grade scaffolds
120
+
121
+ 12. **Project-LoRA distillation pipeline** (`tools/lora-pipeline/`) — `generate_training_data.py`, `train_lora.py`, `eval_lora.py`, `serve_lora.py`. Distill the brain into a Qwen2.5-Coder-1.5B LoRA adapter. Run when ready.
122
+ 13. **SWE-Bench-Lite micro-eval harness** (`tools/swe-bench-lite/`) — 10 hand-curated public-repo bugs. `runner.py` + `score.py` + pre-filled `report-template.md`. Realistic expected lift: +20-40% resolution rate with brain on.
123
+
124
+ ### Added — DX
125
+
126
+ 14. **`shadow-brain demo` command** — 30-second hello-world: auto-ingests sample repo, runs queries, opens dashboard.
127
+ 15. **Forgetting curve transparency + pinning** — every memory shows decay reason; `pin: true` flag prevents auto-decay.
128
+ 16. **Dashboard tour video** (`docs/launch/shadow-brain-dashboard-tour.mp4`) — 5-minute narrated walkthrough of every panel.
129
+ 17. **MCP server hardening** — better discovery, full feature surface, docs at `/mcp/info`.
130
+
131
+ ### Changed
132
+
133
+ - `embeddings.ts` kept untouched; `embeddings-v2.ts` composes it (no breaking change for callers that imported v1)
134
+ - `package.json` version → 6.0.2; description updated to reflect new features
135
+ - README hero updated with v6.0.2 feature row + new install command
136
+
137
+ ### Docs
138
+
139
+ - `docs/launch/RELEASE_NOTES_v6.0.2.md` — full release notes
140
+ - `docs/ROADMAP-v7.md` — v7+ strategic plan
141
+ - `docs/VIRAL-PLAYBOOK.md` — launch playbook
142
+
143
+ ### Notes
144
+
145
+ - **No new npm runtime dependencies.** Zero-dep philosophy preserved.
146
+ - TypeScript strict mode passes. All new modules compile cleanly.
147
+ - Backwards compatible with v6.0 brains; no migration required.
148
+
149
+ ---
150
+
151
+ ## [6.0.0] — 2026-04-24 — Hive Mind Edition
152
+
153
+ > **Hive Mind for AI agents — the first sub-agent-aware brain. 22 genuinely new features. 100% local-first, free, open source.**
154
+
155
+ ### The Hive Mind
156
+
157
+ Before v6.0, every AI agent and sub-agent started from zero. Claude's `Task` tool, Cursor's Composer, CrewAI/LangGraph/AutoGen sub-agents — none shared memory with the parent. Shadow Brain v6 is the first tool that bridges the brain across frameworks AND into sub-agents.
158
+
159
+ ### Added — 22 genuinely novel modules
160
+
161
+ 1. **Sub-Agent Brain Bridge (SABB)** (`src/brain/subagent-bridge.ts`) — detects sub-agent spawns, computes focused context slivers, quarantines sub-agent memories until graduated (confidence ≥ 0.7).
162
+ 2. **Causal Memory Chains** (`src/brain/causal-chains.ts`) — tracks cause→effect relationships, renders as Graphviz DAG, answers "why did X happen?"
163
+ 3. **Agent Collision Detective** (`src/brain/collision-detective.ts`) — real-time overlapping edit intent detection with advisory locks.
164
+ 4. **Dream Engine** (`src/brain/dream-engine.ts`) — background idle reflection via local LLM (Ollama): revisit, counterfactual, consolidation, contradiction, pattern-discovery.
165
+ 5. **Agent Reputation Ledger** (`src/brain/reputation-ledger.ts`) — Ed25519-signed decision receipts with portable accuracy scores and shields.io badges.
166
+ 6. **Swarm Debate Protocol** (`src/brain/swarm-debate.ts`) — pro/con/arbiter multi-agent debate for critical decisions.
167
+ 7. **Pre-Mortem Assistant** (`src/brain/pre-mortem.ts`) — surfaces past failures from project memory before significant tasks.
168
+ 8. **Branch Brains** (`src/brain/branch-brain.ts`) — git-branch-aware memory context switching.
169
+ 9. **Attention Heatmap** (`src/brain/attention-heatmap.ts`) — weighted attribution of which memories influenced each decision.
170
+ 10. **Token Economy Engine** (`src/brain/token-economy.ts`) — cross-agent cost tracking, monthly projections, savings suggestions.
171
+ 11. **Forgetting Curve + Sleep Consolidation** (`src/brain/forgetting-curve.ts`) — Ebbinghaus-inspired natural decay + tier promotion.
172
+ 12. **Formal Verification Bridge** (`src/brain/formal-verification-bridge.ts`) — natural-language rules → ESLint / Semgrep / LSP diagnostics.
173
+ 13. **Confidence Calibration Monitor** (`src/brain/calibration-monitor.ts`) — Brier-score based agent trust weighting.
174
+ 14. **Cost-Aware Sub-Agent Spawner** (`src/brain/cost-aware-spawner.ts`) — routes sub-agent spawns to cheapest model that satisfies task.
175
+ 15. **Air-Gap Mode** (`src/brain/air-gap.ts`) — block outbound network; localhost-only.
176
+ 16. **E2E Encryption** (`src/brain/brain-encryption.ts`) — ChaCha20-Poly1305 at rest with scrypt key derivation.
177
+ 17. **Hallucination Quarantine** (`src/brain/hallucination-quarantine.ts`) — isolate suspect memories; auto-delete after 7 days.
178
+ 18. **Voice Mode** (`src/brain/voice-mode.ts`) — transcript processing with brain integration.
179
+ 19. **Brain Garden** (`src/brain/brain-garden.ts`) — living constellation visualization data source.
180
+ 20. **PR Auto-Review** (`src/brain/pr-auto-review.ts`) — GitHub PR comment generator citing project memories.
181
+ 21. **Team Brain Sync** (`src/brain/team-brain-sync.ts`) — P2P peer state layer for WebRTC team brain.
182
+ 22. **Brain Exchange** (`src/brain/brain-exchange.ts`) — export + import curated shareable brain slices with redaction.
183
+
184
+ ### Added — supporting infrastructure
185
+
186
+ - **Local-First LLM Adapter** (`src/brain/local-llm.ts`) — unified Ollama-first adapter used by Dream Engine, Swarm Debate, Pre-Mortem. Graceful fallback when unreachable.
187
+ - **Hive Accelerator** (`src/brain/hive-accelerator.ts`) — wires SSSP (arXiv 2504.17033) for causal traversal + TurboQuant (ICLR 2026) for similarity scoring.
188
+ - **Complete Web Control Dashboard** (`src/dashboard/v6-dashboard-html.ts` + server routes) — 23-tab SPA at `http://localhost:7341/hive`. Controls every feature: enable/disable, configure, monitor. Agent connect/disconnect. Unified activity log. API+MCP configuration panels. Brain Garden D3 canvas.
189
+ - **48 new CLI commands** grouped under `hive`, `subagent`, `causal`, `collision`, `dream`, `reputation`, `debate`, `premortem`, `branch-brain`, `attention`, `tokens`, `forget`, `formal`, `calibrate`, `airgap`, `encrypt`, `quarantine`, `voice`, `garden`, `pr-review`, `team-sync`, `exchange`.
190
+ - **36 new MCP tool handlers** for every v6 module — any MCP-compatible AI tool can now call them.
191
+ - **v6 integration tests** (`tests/brain/hivemind-v6.test.ts`) — 24 smoke tests covering every module.
192
+
193
+ ### Changed
194
+
195
+ - Version: `5.2.0` → `6.0.0`
196
+ - Total brain modules: **26 → 48** (22 new v6 modules + Hive Accelerator + Local LLM)
197
+ - CLI commands: **70+ → 90+**
198
+ - MCP tools: **~27 → 60+** (existing + 36 v6 handlers)
199
+ - README hero: v6.0 Hive Mind positioning with 22 novel features prominently listed
200
+ - Web dashboard: `/` (legacy) + `/hive` or `/v6` (complete Hive Mind control)
201
+ - `package.json` description + 25 new v6 keywords for maximum discoverability
202
+
203
+ ### Removed
204
+
205
+ - Repo hygiene cleanup — removed stray files (`C:Userstheihtmp_b64_3.txt`, `eng.traineddata`, `write_pattern.py`, `.playwright-mcp/`, `seo-gists/`, empty `.codex`). Updated `.gitignore` to prevent recurrence.
206
+
207
+ ### Security
208
+
209
+ - ChaCha20-Poly1305 AEAD encryption for brain-at-rest
210
+ - Ed25519 cryptographic signatures on agent reputation receipts
211
+ - Air-gap mode with RFC1918 + metadata-endpoint blocking
212
+ - Hallucination quarantine prevents unverified claims from polluting global brain
213
+
214
+ ### Philosophy
215
+
216
+ **Local-first default.** All AI features (Dream Engine, Swarm Debate, Pre-Mortem, Voice) route to Ollama by default. Zero API keys needed. Zero network required. Zero cost to run. Shadow Brain works offline, in air-gapped environments, and in compliance-constrained enterprises. Remote providers (Anthropic, OpenAI, GLM) remain an optional upgrade — never a requirement.
217
+
218
+ ---
219
+
220
+ ## [5.2.0] — 2026-04-22 — Subconscious Singularity Edition
221
+
222
+ > **One brain. Every agent. Every project. Every session. Forever.**
223
+
224
+ ### The Singularity
225
+
226
+ Before v5.2.0, every project had its own brain and every AI agent (Claude, Cursor, Cline...) had to be told what each project knew. Now there is **one brain** — a singleton global JSON store at `~/.shadow-brain/global.json` that every agent reads from and writes to.
227
+
228
+ What Cursor learns in project A is instantly known to Claude Code in project B.
229
+
230
+ ### Added
231
+
232
+ - **Singleton Global Brain** (`src/brain/global-brain.ts`) — one `~/.shadow-brain/global.json` is the source of truth for every project + agent on the machine. Atomic write-and-rename plus an in-process write queue handles concurrent multi-agent writes without native dependencies. Auto-prune at 1GB. Project-scoped views via `GlobalBrain.projectIdFor(rootDir)`.
233
+ - **Subconscious Engine** (`src/brain/subconscious.ts`) — proactive context injection on every session start. The agent doesn't have to ask — the brain surfaces recent decisions, active tasks, similar past work, project state, cross-agent insights, and warnings. Hard-capped at 2K tokens, relevance-ranked, agent-configurable.
234
+ - **Universal Bootstrap** (`src/brain/session-hooks.ts`) — `asb attach-all` detects every installed AI agent on your machine and installs SessionStart hooks per agent's native mechanism (Claude Code settings.json, Cursor `.cursor/rules`, Cline VS Code extension, Windsurf `.windsurfrules`, Codex config.json, Aider `.aider.conf.yml`, Copilot `.github/copilot-instructions.md`, etc.). Every agent calls Shadow Brain on first prompt of every session.
235
+ - **L0 In-Memory Hot Tier** (`src/brain/l0-cache.ts`) — sub-millisecond recall via byte-budgeted Map LRU. Sits in front of the global JSON brain. Per-namespace caches with `getCache(name)`. Default 64MB budget, configurable.
236
+ - **Agent Safety Firewall** (`src/brain/agent-firewall.ts`) — blocks risky agent actions such as secret file access, destructive commands, curl-to-shell installs, and prompt-injection payloads before tools execute.
237
+ - **Agent Handoff Packets** (`src/brain/agent-handoff.ts`) — `asb handoff cursor codex` generates a cross-agent continuation packet with task state, changed files, recent memories, and safety warnings.
238
+ - **Proof Timeline + Share Report** — `asb timeline` and `asb proof report` expose the viral proof stream: what agents learned, when, and what the firewall blocked.
239
+ - **Cursor Adapter** (`src/adapters/cursor.ts`) — first-class adapter, no more falling back to ClineAdapter. Reads conversations from `~/.cursor/conversations`, injects into `.cursor/rules/shadow-brain-insights.md`, escalates critical insights to `.cursorrules`.
240
+ - **Windsurf Adapter** (`src/adapters/windsurf.ts`) — first-class adapter. Reads from `~/.windsurf/conversations`, writes to `.windsurfrules` with `# === Shadow Brain Insights ===` marker for safe re-injection.
241
+ - **GitHub Copilot Adapter** (`src/adapters/copilot.ts`) — workspace-level integration via `.github/copilot-instructions.md` (Copilot's official context file). Replaces a marker block on each update so injection is idempotent.
242
+ - **4 New CLI Commands**:
243
+ - `asb attach-all` — universal bootstrap for every detected agent
244
+ - `asb subconscious inject|status|configure` — manage proactive context injection
245
+ - `asb global stats|recall|cache|sync` — inspect the singleton global brain
246
+ - `asb handoff`, `asb timeline`, `asb firewall`, `asb detach-all`, `asb audit-hooks`, `asb proof report` — trust, safety, and launch-proof commands
247
+ - **4 New MCP Tools** — `subconscious_inject`, `global_recall`, `global_stats`, `attach_status`. Now any MCP client can talk to the global brain directly.
248
+
249
+ ### Changed
250
+
251
+ - **AgentTool union** now includes `'copilot'` — full type-safe support for 10 agents (was 9)
252
+ - **adapters/index.ts** — Cursor and Windsurf no longer alias ClineAdapter; each gets its own implementation
253
+ - **Description + 80 npm keywords** rewritten for v5.2.0 positioning and maximum discoverability
254
+ - **Total brain modules: 26** (4 new + 22 from v5.1.1)
255
+
256
+ ### Performance
257
+
258
+ - Hot recalls now <1ms via L0 cache (was 10-30ms via SQLite)
259
+ - Cross-project queries replace per-project DB lookup overhead with a single indexed query
260
+
261
+ ### Fixed
262
+
263
+ - Cursor and Windsurf adapters previously reused ClineAdapter — they now have correct path detection and conversation parsing for their actual file layouts
264
+
265
+ ### Migration Notes
266
+
267
+ v5.2.0 is **fully backward-compatible** with v5.1.1. The global brain is created on first init and coexists with project-local brains. No breaking changes to existing CLI commands or MCP tools.
268
+
269
+ To opt into the new singleton model: run `asb attach-all` once and every future session of every agent will auto-bootstrap.
270
+
271
+ ---
272
+
273
+ ## [5.1.1] — 2026-04-18 — Hyper-Cognitive Intelligence Edition
274
+
275
+ ### Added
276
+ - **Built-in LSP Server** — pure Node.js Language Server Protocol implementation with stdio + TCP transport modes, real-time diagnostics, hover info, and code actions
277
+ - **Custom LLM Fine-Tuning Engine** — automatic training data generation from code changes, JSONL export, multi-model training pipeline
278
+ - **Smart Cache** — 3-tier (hot/warm/cold) LRU cache with predictive prefetch via co-access graph, tag-based invalidation, and adaptive tier promotion
279
+ - **Intent Engine** — multi-strategy NLP command understanding with keyword, fuzzy, and context-aware matching strategies
280
+ - **Code DNA Fingerprinting** — 9-gene structural analysis covering structure, complexity, style, dependency, and evolution gene categories
281
+ - **Temporal Intelligence** — velocity metrics, file heatmaps, 5-factor bug prediction, anomaly detection, and peak hour/day analysis
282
+ - 6 new CLI commands: `lsp`, `fine-tune`, `cache`, `intent`, `dna`, `temporal`
283
+ - 27 README badges for maximum discoverability
284
+
285
+ ### Changed
286
+ - Total brain modules: **22** (6 new + 16 from v5.0.1)
287
+ - All v5.0.1, v5.0.0, and v4.0.0 features included and enhanced
288
+ - Expanded npm keywords to 50+
289
+
290
+ ### Fixed
291
+ - 18 TypeScript compilation errors in CLI — aligned property references with actual module interfaces
292
+
293
+ ---
294
+
295
+ ## [5.0.1] — 2026-04-15 — Zero-Config Intelligence Edition
296
+
297
+ ### Added
298
+ - **Zero-Config Auto-Setup** — auto-detect project type, AI tools, languages, frameworks; setup is explicit and reversible in v5.2.0
299
+ - **MCP Server** — 19-tool Model Context Protocol server for Claude Code, Cursor, and all AI tools
300
+ - **Rich Web Dashboard** — real-time WebSocket dashboard with 8 panels (health, memory tiers, insights, fixes, AI tools, modules, stats, controls)
301
+ - **Natural Language Queries** — `shadow-brain ask "..."` for plain-English brain interaction
302
+ - **Plugin System** — hookable analysis pipeline with npm plugin discovery
303
+ - **Brain Export/Import** — full brain state portability for team sync and backup
304
+ - 5 new CLI commands: `off`, `ask`, `export`, `import`, `plugin`
305
+ - **Cursor MCP Compatibility** — root path POST + `/v1/chat` endpoint support
306
+ - **Postinstall Auto-Setup** — runs automatically after `npm install`
307
+
308
+ ### Changed
309
+ - 50+ npm keywords for discoverability
310
+ - All v5.0.0 and v4.0.0 features included and enhanced
311
+
312
+ ---
313
+
314
+ ## [5.0.0] — 2026-04-12 — Infinite Intelligence Edition
315
+
316
+ ### Added
317
+ - **Hierarchical Memory Compression** — 4-tier pyramid (raw -> summary -> pattern -> principle) with drill-down/up navigation
318
+ - **Context-Triggered Associative Recall** — automatic memory activation based on file paths, keywords, and categories
319
+ - **Multi-Agent Consensus Protocol** — trust-weighted voting, confidence intervals, conflict resolution across multiple AI agents
320
+ - **Collective Cross-Project Learning** — verified rule sharing, viral propagation, accuracy tracking across projects
321
+ - 5 new CLI commands: `memory`, `recall`, `consensus`, `collective`, `v5`
322
+
323
+ ### Changed
324
+ - Memory architecture fully rewritten for infinite retention
325
+ - Cross-agent communication protocol standardized
326
+
327
+ ---
328
+
329
+ ## [4.0.0] — 2026-04-08 — Hyper-Intelligence Edition
330
+
331
+ ### Added
332
+ - **TurboQuant Infinite Memory** — 6x compression, zero forgetting (based on Google Research, ICLR 2026)
333
+ - **SSSP BMSSP Routing** — O(m log^(2/3) n) deterministic routing (based on arXiv 2504.17033, Duan et al.)
334
+ - **Self-Evolving Genetic Rules** — tournament selection, Gaussian mutation, Bayesian meta-learning
335
+ - **Cross-Agent Intelligence Protocol (CAIP)** — 7 agents share insights in real-time via WebSocket
336
+ - **Adversarial Hallucination Defense** — cross-reference verification, evidence scoring, confidence thresholds
337
+ - **Swarm Intelligence** — Ant Colony Optimization pheromone-based file prioritization
338
+ - **Knowledge Graph + PageRank** — code entity impact radar with d=0.85 damping factor
339
+ - **Predictive Engine** — bug risk scoring, technical debt forecasting, anomaly detection
340
+ - 9 new CLI commands: `turbo`, `route`, `caip`, `evolve`, `predict`, `graph`, `swarm`, `defense`, `v4`
341
+
342
+ ### Changed
343
+ - All v3.0.0 features included and enhanced
344
+ - Neural mesh upgraded with TurboMemory integration
345
+ - Pattern memory upgraded with compressed vector storage
346
+ - Learning engine upgraded with genetic optimization
347
+
348
+ ---
349
+
350
+ ## [3.0.0] — 2026-04-01 — Hyper-Intelligence Edition
351
+
352
+ ### Added
353
+ - **Cognitive Load Analysis** — estimates mental complexity of code sections
354
+ - **Security Audit Engine** — vulnerability scanning, dependency risk assessment
355
+ - **Influence Map** — tracks which code changes ripple through the codebase
356
+ - Enhanced neural mesh with Shannon entropy and cosine similarity
357
+ - Bayesian confidence scoring for all insights
358
+
359
+ ### Changed
360
+ - Analysis pipeline fully restructured for hyper-intelligence features
361
+ - CLI expanded with security and cognitive commands
362
+
363
+ ---
364
+
365
+ ## [2.1.0] — 2026-03-25 — Quantum Neural Mesh
366
+
367
+ ### Added
368
+ - **Cross-Session Shared Intelligence** — persist and share insights across sessions
369
+ - **Shannon Entropy Analysis** — information-theoretic code complexity measurement
370
+ - **Cosine Similarity Matching** — semantic code comparison
371
+ - **Bayesian Confidence** — probabilistic confidence scoring for recommendations
372
+
373
+ ### Changed
374
+ - Neural mesh architecture upgraded for cross-session persistence
375
+ - Insight quality improved with entropy-based scoring
376
+
377
+ ---
378
+
379
+ ## [2.0.0] — 2026-03-18 — Super-Intelligence Edition
380
+
381
+ ### Added
382
+ - **Semantic Analyzer** — deep code understanding beyond syntax
383
+ - **Dependency Graph** — full project dependency visualization and analysis
384
+ - **Code Similarity Engine** — detect duplicated and near-duplicated code
385
+ - **MCP Server** — initial Model Context Protocol server implementation
386
+ - **Team Mode** — collaborative AI-assisted development
387
+
388
+ ### Changed
389
+ - Complete architecture rewrite from v1.x
390
+ - CLI expanded from 15 to 35+ commands
391
+
392
+ ---
393
+
394
+ ## [1.x] — 2026-02 to 2026-03 — Foundation
395
+
396
+ ### v1.2.0
397
+ - Added vulnerability scanning
398
+ - Added CI/CD integration hooks
399
+
400
+ ### v1.1.0
401
+ - Added smart fix suggestions
402
+ - Added health scoring with weighted metrics
403
+
404
+ ### v1.0.0
405
+ - Initial release
406
+ - 7 agent adapters (Claude Code, Cursor, Cline, Windsurf, Copilot, Kilo Code, Amp)
407
+ - Basic health scoring and analysis pipeline
408
+ - Vulnerability scanning
409
+ - CLI with 15 commands
410
+
411
+ ---
412
+
413
+ [5.2.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.2.0
414
+ [5.1.1]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.1.1
415
+ [5.0.1]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.0.1
416
+ [5.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v5.0.0
417
+ [4.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v4.0.0
418
+ [3.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v3.0.0
419
+ [2.1.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v2.1.0
420
+ [2.0.0]: https://github.com/theihtisham/agent-shadow-brain/releases/tag/v2.0.0