brainclaw 1.8.0 → 1.9.1

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 (178) hide show
  1. package/README.md +592 -505
  2. package/dist/brainclaw-vscode.vsix +0 -0
  3. package/dist/cli.js +138 -13
  4. package/dist/commands/add-step.js +1 -1
  5. package/dist/commands/bootstrap.js +2 -26
  6. package/dist/commands/check-security-mcp.js +50 -33
  7. package/dist/commands/check-security.js +86 -43
  8. package/dist/commands/claim.js +22 -21
  9. package/dist/commands/confirm.js +26 -0
  10. package/dist/commands/context-diff.js +1 -1
  11. package/dist/commands/dispatch-watch.js +142 -0
  12. package/dist/commands/doctor.js +113 -2
  13. package/dist/commands/estimation-report.js +115 -16
  14. package/dist/commands/harvest.js +286 -23
  15. package/dist/commands/hooks.js +73 -73
  16. package/dist/commands/init.js +124 -22
  17. package/dist/commands/install-hooks.js +78 -78
  18. package/dist/commands/loops-handlers.js +4 -0
  19. package/dist/commands/mcp-read-handlers.js +253 -41
  20. package/dist/commands/mcp.js +664 -102
  21. package/dist/commands/memory.js +21 -17
  22. package/dist/commands/migrate.js +81 -17
  23. package/dist/commands/prune.js +78 -4
  24. package/dist/commands/reflect.js +26 -20
  25. package/dist/commands/register-agent.js +57 -1
  26. package/dist/commands/repair.js +20 -0
  27. package/dist/commands/session-end.js +15 -6
  28. package/dist/commands/session-start.js +18 -1
  29. package/dist/commands/setup-security.js +39 -18
  30. package/dist/commands/setup.js +26 -27
  31. package/dist/commands/stale.js +16 -2
  32. package/dist/commands/switch.js +26 -5
  33. package/dist/commands/uninstall.js +126 -34
  34. package/dist/commands/update-step.js +6 -0
  35. package/dist/commands/version.js +1 -1
  36. package/dist/commands/worktree.js +60 -0
  37. package/dist/core/actions.js +12 -3
  38. package/dist/core/agent-capability.js +30 -17
  39. package/dist/core/agent-files.js +963 -666
  40. package/dist/core/agent-integrations.js +0 -3
  41. package/dist/core/agent-inventory.js +67 -0
  42. package/dist/core/agent-registry.js +163 -29
  43. package/dist/core/agentrun-reconciler.js +33 -2
  44. package/dist/core/agentruns.js +7 -1
  45. package/dist/core/ai-agent-detection.js +31 -44
  46. package/dist/core/archival.js +15 -9
  47. package/dist/core/assignment-reconciler.js +56 -0
  48. package/dist/core/assignment-sweeper.js +127 -4
  49. package/dist/core/assignments.js +69 -11
  50. package/dist/core/bootstrap.js +233 -67
  51. package/dist/core/brainclaw-version.js +22 -0
  52. package/dist/core/candidates.js +21 -1
  53. package/dist/core/claims.js +313 -150
  54. package/dist/core/codev-prompts.js +38 -38
  55. package/dist/core/config.js +6 -1
  56. package/dist/core/context-diff.js +148 -20
  57. package/dist/core/context.js +129 -8
  58. package/dist/core/coordination.js +22 -3
  59. package/dist/core/default-profiles/doctor.yaml +11 -11
  60. package/dist/core/default-profiles/janitor.yaml +11 -11
  61. package/dist/core/default-profiles/onboarder.yaml +11 -11
  62. package/dist/core/default-profiles/reviewer.yaml +13 -13
  63. package/dist/core/dispatch-status.js +79 -5
  64. package/dist/core/dispatcher.js +65 -12
  65. package/dist/core/entity-operations.js +74 -27
  66. package/dist/core/entity-registry.js +31 -5
  67. package/dist/core/event-log.js +138 -21
  68. package/dist/core/events/checkpoint.js +258 -0
  69. package/dist/core/events/genesis.js +220 -0
  70. package/dist/core/events/journal.js +507 -0
  71. package/dist/core/events/materialize.js +126 -0
  72. package/dist/core/events/registry-post-image.js +110 -0
  73. package/dist/core/events/verify.js +109 -0
  74. package/dist/core/execution-adapters.js +23 -0
  75. package/dist/core/execution.js +1 -1
  76. package/dist/core/facade-schema.js +38 -0
  77. package/dist/core/gc-semantic.js +130 -5
  78. package/dist/core/handoff-snapshot.js +68 -0
  79. package/dist/core/ids.js +19 -8
  80. package/dist/core/instruction-templates.js +34 -115
  81. package/dist/core/io.js +39 -3
  82. package/dist/core/json-store.js +10 -1
  83. package/dist/core/lock.js +153 -28
  84. package/dist/core/loops/bootstrap-acquire.js +25 -1
  85. package/dist/core/loops/facade-schema.js +2 -0
  86. package/dist/core/loops/hooks/survey-signals-baseline.js +36 -0
  87. package/dist/core/loops/index.js +1 -0
  88. package/dist/core/loops/presets/bootstrap.js +7 -0
  89. package/dist/core/loops/store.js +17 -0
  90. package/dist/core/loops/verbs.js +24 -2
  91. package/dist/core/markdown.js +8 -76
  92. package/dist/core/mcp-command-resolution.js +245 -0
  93. package/dist/core/memory-compactor.js +5 -3
  94. package/dist/core/memory-lifecycle.js +282 -0
  95. package/dist/core/merge-risk.js +150 -0
  96. package/dist/core/messaging.js +10 -3
  97. package/dist/core/migration.js +11 -1
  98. package/dist/core/observer-mode.js +26 -0
  99. package/dist/core/operations/memory-mutation.js +90 -65
  100. package/dist/core/operations/plan.js +27 -1
  101. package/dist/core/protocol-skills.js +210 -0
  102. package/dist/core/reflection-safety.js +6 -7
  103. package/dist/core/reputation.js +84 -2
  104. package/dist/core/runtime-signals.js +72 -10
  105. package/dist/core/runtime.js +84 -1
  106. package/dist/core/schema.js +114 -0
  107. package/dist/core/search.js +19 -2
  108. package/dist/core/security-detectors.js +125 -0
  109. package/dist/core/security-extract.js +189 -0
  110. package/dist/core/security-guard.js +217 -139
  111. package/dist/core/security-packages.js +121 -0
  112. package/dist/core/security-scoring.js +76 -9
  113. package/dist/core/security.js +34 -2
  114. package/dist/core/sequence.js +11 -2
  115. package/dist/core/setup-flow.js +141 -13
  116. package/dist/core/spawn-check.js +16 -2
  117. package/dist/core/staleness.js +73 -2
  118. package/dist/core/state.js +250 -54
  119. package/dist/core/store-resolution.js +45 -12
  120. package/dist/core/worktree.js +90 -26
  121. package/dist/facts.js +8 -8
  122. package/dist/facts.json +7 -7
  123. package/docs/PROTOCOL.md +223 -0
  124. package/docs/adapters/openclaw.md +43 -43
  125. package/docs/architecture/project-refs.md +328 -328
  126. package/docs/cli.md +2097 -2096
  127. package/docs/concepts/coordination.md +52 -52
  128. package/docs/concepts/coordinator-runbook.md +129 -0
  129. package/docs/concepts/dispatch-lifecycle.md +245 -245
  130. package/docs/concepts/event-log-store.md +928 -0
  131. package/docs/concepts/ideation-loop.md +317 -317
  132. package/docs/concepts/loop-engine.md +520 -511
  133. package/docs/concepts/mcp-governance.md +268 -268
  134. package/docs/concepts/memory.md +89 -88
  135. package/docs/concepts/multi-agent-workflows.md +167 -167
  136. package/docs/concepts/observer-protocol.md +361 -0
  137. package/docs/concepts/parallel-merge-protocol.md +71 -0
  138. package/docs/concepts/plans-and-claims.md +217 -174
  139. package/docs/concepts/project-md-convention.md +35 -35
  140. package/docs/concepts/runtime-notes.md +38 -38
  141. package/docs/concepts/skills.md +78 -0
  142. package/docs/concepts/troubleshooting.md +254 -254
  143. package/docs/concepts/workspace-bootstrapping.md +142 -81
  144. package/docs/context-format-changelog.md +35 -35
  145. package/docs/context-format.md +48 -48
  146. package/docs/index.md +65 -65
  147. package/docs/integrations/agents.md +162 -162
  148. package/docs/integrations/claude-code.md +23 -23
  149. package/docs/integrations/cline.md +87 -88
  150. package/docs/integrations/codex.md +2 -2
  151. package/docs/integrations/continue.md +60 -60
  152. package/docs/integrations/copilot.md +82 -80
  153. package/docs/integrations/cursor.md +23 -23
  154. package/docs/integrations/kilocode.md +72 -72
  155. package/docs/integrations/mcp.md +377 -377
  156. package/docs/integrations/mistral-vibe.md +122 -122
  157. package/docs/integrations/openclaw.md +99 -98
  158. package/docs/integrations/opencode.md +84 -84
  159. package/docs/integrations/overview.md +122 -122
  160. package/docs/integrations/roo.md +74 -74
  161. package/docs/integrations/windsurf.md +83 -83
  162. package/docs/mcp-schema-changelog.md +360 -329
  163. package/docs/playbooks/integration/index.md +121 -121
  164. package/docs/playbooks/orchestration.md +37 -0
  165. package/docs/playbooks/productivity/index.md +99 -99
  166. package/docs/playbooks/team/index.md +117 -117
  167. package/docs/product/agent-first-model.md +184 -184
  168. package/docs/product/entity-model-audit.md +462 -462
  169. package/docs/product/positioning.md +86 -86
  170. package/docs/quickstart-existing-project.md +107 -107
  171. package/docs/quickstart.md +148 -147
  172. package/docs/release-maintenance.md +79 -79
  173. package/docs/reputation.md +52 -52
  174. package/docs/review.md +45 -45
  175. package/docs/security.md +212 -53
  176. package/docs/server-operations.md +118 -118
  177. package/docs/storage.md +110 -108
  178. package/package.json +86 -69
package/README.md CHANGED
@@ -1,505 +1,592 @@
1
- <p align="center">
2
- <img src="https://brainclaw.dev/logo.png" alt="brainclaw" width="140" />
3
- </p>
4
-
5
- <h1 align="center">brainclaw</h1>
6
-
7
- <p align="center"><strong>Local-first coordination and shared memory for coding agents.</strong></p>
8
-
9
- ---
10
-
11
- If you've ever:
12
- - **lost your conversation** when your agent hit credit limits mid-task,
13
- - returned to a project **after a week** with no idea where you left off,
14
- - watched two coworkers (or two agents) **edit the same files** without knowing it,
15
- - or **gave up running multiple agents in parallel** because keeping them in sync was a pain,
16
-
17
- brainclaw gives you durable shared state across sessions, agents, and teammates. Plans, claims, handoffs, decisions, and traps live in `.brainclaw/`, work identically across any compatible agent (Claude Code, Codex, Copilot, Cline, OpenCode, Cursor, Windsurf, Kilocode, Roo Code, Continue, Mistral Vibe, Hermes, Antigravity/Gemini CLI, …), and stay accessible whether you orchestrate them in parallel or pick them up one after another.
18
-
19
- Use it two ways — **together or separately**:
20
-
21
- - **Active orchestration** — dispatch work in parallel across multiple agent instances. Claims prevent conflicts, sequences manage lane dependencies, the dispatcher routes by capacity.
22
- - **Async shared state** — when an agent runs out of credits, when you return to a project after weeks, or when teammates work in parallel: the next agent (or you) resumes cleanly with the same context, plans, and constraints.
23
-
24
- The same primitives — plans, claims, handoffs, decisions, traps — serve both modes. That's the design point. brainclaw stores everything locally as plain text + JSON, versions it in Git, and asks no opinion about which agent you should use for what.
25
-
26
- It sits alongside your coding agents and gives them a shared state layer they can resume from reliably. brainclaw is also starting to model other local AI work surfaces on the same machine, such as ChatGPT Desktop, Claude Desktop, Claude Cowork, and Gemini web or CLI, to keep a project-level queue of non-code work for those surfaces.
27
-
28
- ---
29
-
30
- ## What it provides
31
-
32
- | | |
33
- |---|---|
34
- | **Project memory** | constraints, decisions, traps, handoffs, and layered instructions agents can resume from |
35
- | **Coordination state** | shared plans, file claims, runtime notes, and board views for active work |
36
- | **Agent-ready context** | compact, prompt-sized context built from real workspace state instead of stale instructions |
37
- | **Native agent files** | auto-writes `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/`, `.windsurfrules`, and similar local guidance |
38
- | **Multi-turn loops** | review and ideation loops with structured phases, iteration semantics, and per-phase memory filters see [loop engine](docs/concepts/loop-engine.md) and [ideation loop](docs/concepts/ideation-loop.md) |
39
- | **Machine AI surface discovery** | detects local coding agents plus desktop AI work surfaces such as ChatGPT Desktop and Gemini CLI |
40
- | **Queued surface tasks** | stores project-scoped requests for other local AI surfaces, such as visual generation, drafting, summaries, or research |
41
- | **Local-first storage** | plain text + JSON, Git-friendly, no mandatory cloud, no telemetry by default |
42
-
43
- ---
44
-
45
- ## Agent Surfaces
46
-
47
- brainclaw exposes the same collaboration state through three surfaces, but they do not have the same role in an agent-first workflow.
48
-
49
- | Surface | Primary use |
50
- |---|---|
51
- | **MCP** | default path for capable agents that need fresh context, board state, plans, claims, and write operations |
52
- | **Native agent files** | local guidance and bootstrap hints for a specific agent surface (`AGENTS.md`, `CLAUDE.md`, Cursor rules, etc.) |
53
- | **CLI** | operator workflows, scripting, setup, debugging, release, and fallback access when MCP is not the integration path |
54
-
55
- If you are documenting or integrating an agent workflow, treat MCP as the primary runtime path.
56
-
57
- ---
58
-
59
- ## Works With
60
-
61
- brainclaw is designed to sit alongside the coding agents teams are already using, not behind a separate hosted control plane.
62
-
63
- ### Code Agents
64
-
65
- | Logo | Agent | Tier | What brainclaw configures |
66
- |---|---|---|---|
67
- | [![Claude Code](https://img.shields.io/badge/Claude_Code-111111?logo=anthropic&logoColor=white)](https://github.com/anthropics/claude-code) | **[Claude Code](https://github.com/anthropics/claude-code)** | A | MCP + CLAUDE.md + hooks + auto-approve + permissions + /brainclaw skill |
68
- | [![Codex](https://img.shields.io/badge/Codex-111111?logo=openai&logoColor=white)](https://openai.com/codex/) | **[Codex](https://openai.com/codex/)** | A | MCP + AGENTS.md + hooks + skills |
69
- | [![Cursor](https://img.shields.io/badge/Cursor-1F2430?logo=cursor&logoColor=white)](https://cursor.com/en-US) | **[Cursor](https://cursor.com/en-US)** | A | MCP (machine) + .cursor/rules/ + hooks + skills |
70
- | [![Windsurf](https://img.shields.io/badge/Windsurf-0B1220?logo=codeium&logoColor=white)](https://windsurf.com/) | **[Windsurf](https://windsurf.com/)** | A | MCP (machine) + .windsurfrules + hooks + skills |
71
- | [![Cline](https://img.shields.io/badge/Cline-0F766E?logoColor=white)](https://github.com/cline/cline) | **[Cline](https://github.com/cline/cline)** | A | MCP + auto-approve + .clinerules/ + hooks + skills |
72
- | [![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-181717?logo=githubcopilot&logoColor=white)](https://github.com/features/copilot) | **[GitHub Copilot](https://github.com/features/copilot)** | A | MCP + copilot-instructions.md + hooks + skills |
73
- | [![Roo](https://img.shields.io/badge/Roo-7C3AED?logoColor=white)](https://github.com/RooCodeInc/Roo-Code) | **[Roo](https://github.com/RooCodeInc/Roo-Code)** | B | MCP + auto-approve + .roo/rules/ |
74
- | [![Continue](https://img.shields.io/badge/Continue-2563EB?logoColor=white)](https://github.com/continuedev/continue) | **[Continue](https://github.com/continuedev/continue)** | B | MCP + .continue/rules/ |
75
- | [![OpenCode](https://img.shields.io/badge/OpenCode-0F172A?logoColor=white)](https://github.com/opencode-ai/opencode) | **[OpenCode](https://github.com/opencode-ai/opencode)** | B | MCP + AGENTS.md |
76
- | [![Gemini CLI](https://img.shields.io/badge/Gemini_CLI-1A73E8?logo=googlegemini&logoColor=white)](https://github.com/google-gemini/gemini-cli) | **[Antigravity / Gemini CLI](https://github.com/google-gemini/gemini-cli)** | B | MCP + GEMINI.md |
77
-
78
- **Tier A** = MCP + hooks + skills (context injected dynamically, lightweight instruction files). **Tier B** = MCP only, no hooks (richer static instruction files with architecture + top traps). Tier can degrade at runtime if integration surfaces are missing.
79
-
80
- ### Autonomous Agents
81
-
82
- | Logo | Agent | Tier | What brainclaw configures |
83
- |---|---|---|---|
84
- | [![OpenClaw](https://img.shields.io/badge/OpenClaw-FF6B35?logoColor=white)](https://github.com/openclaw/openclaw) | **[OpenClaw](https://github.com/openclaw/openclaw)** | B | MCP + brainclaw skill (SKILL.md) for structured project memory |
85
- | [![Hermes](https://img.shields.io/badge/Hermes-111111?logoColor=white)](https://github.com/NousResearch/hermes-agent) | **[Hermes Agent](https://github.com/NousResearch/hermes-agent)** | B | MCP + universal `.agents/skills/brainclaw/SKILL.md` |
86
- | [![NanoClaw](https://img.shields.io/badge/NanoClaw-4A90D9?logoColor=white)](https://github.com/qwibitai/nanoclaw) | **[NanoClaw](https://github.com/qwibitai/nanoclaw)** | C | brainclaw skill messaging agent (WhatsApp, Telegram, Slack) |
87
- | [![NemoClaw](https://img.shields.io/badge/NemoClaw-76B900?logo=nvidia&logoColor=white)](https://github.com/NVIDIA/NemoClaw) | **[NemoClaw](https://github.com/NVIDIA/NemoClaw)** | C | brainclaw skill — NVIDIA enterprise agent stack |
88
- | [![PicoClaw](https://img.shields.io/badge/PicoClaw-00ADD8?logo=go&logoColor=white)](https://github.com/sipeed/picoclaw) | **[PicoClaw](https://github.com/sipeed/picoclaw)** | C | brainclaw skill — edge/IoT agent (Go, <10MB RAM) |
89
- | [![ZeroClaw](https://img.shields.io/badge/ZeroClaw-B7410E?logoColor=white)](https://github.com/zeroclaw-labs/zeroclaw) | **[ZeroClaw](https://github.com/zeroclaw-labs/zeroclaw)** | C | brainclaw skill — ultra-lightweight Rust agent (20+ channels) |
90
-
91
- **Tier C** = no MCP, no hooks — skill-based only with inline context and constrained resources. Autonomous agents use `--profile compact` for short sessions.
92
-
93
- brainclaw is most effective today when one agent works at a time in a given checkout and the next agent resumes from shared context, claims, and handoffs.
94
-
95
- ---
96
-
97
- ## Platform Support
98
-
99
- brainclaw declares support for Node.js 20+ in `package.json`, and CI actively exercises Node 20, 22, and 24 across the main Linux path (Windows runs on Node 24). Real-world support is still not perfectly even yet.
100
-
101
- | Logo | Platform | Status today | Notes |
102
- |---|---|---|---|
103
- | [![Linux](https://img.shields.io/badge/Linux-111111?logo=linux&logoColor=white)](https://www.kernel.org/) | **[Linux](https://www.kernel.org/)** | Recommended | best-supported environment today; GitHub CI runs on Ubuntu with Node 20, 22, and 24 |
104
- | [![macOS](https://img.shields.io/badge/macOS-000000?logo=apple&logoColor=white)](https://www.apple.com/macos/) | **[macOS](https://www.apple.com/macos/)** | Likely supported | Unix-like path and shell model should map well, but it is less exercised than Linux |
105
- | [![Windows](https://img.shields.io/badge/Windows-0078D4?logo=windows&logoColor=white)](https://www.microsoft.com/windows/) | **[Windows](https://www.microsoft.com/windows/)** | Supported with caveats | native support exists, but PATH, npm, SSH, and PowerShell quoting still create more friction than on Unix systems |
106
- | [![Windows + WSL2](https://img.shields.io/badge/Windows%20%2B%20WSL2-0078D4?logo=windows&logoColor=white)](https://learn.microsoft.com/windows/wsl/) | **[Windows + WSL2](https://learn.microsoft.com/windows/wsl/)** | Important, still maturing | Brainclaw detects this setup explicitly, but setup/install/store parity across Windows and WSL is not fully seamless yet |
107
-
108
- If you want the least surprising setup today, use Linux first. If you are on Windows, prefer a disciplined single-environment workflow and expect a few extra machine-specific fixes.
109
-
110
- ---
111
-
112
- ## Get Started
113
-
114
- ### 1. Let your coding agent lead
115
-
116
- The smoothest first-run path is agent-first:
117
-
118
- 1. ask your coding agent to inspect the package and explain what brainclaw does
119
- 2. ask it to install brainclaw and initialize or join the project you're working on
120
- 3. use the CLI yourself when you need an explicit operator or fallback path
121
-
122
- If you want to drive setup manually, use the steps below.
123
-
124
- ### 2. Install
125
-
126
- ```bash
127
- npm install -g brainclaw
128
- ```
129
-
130
- ### 3. Bootstrap this machine
131
-
132
- ```bash
133
- brainclaw setup-machine --yes
134
- ```
135
-
136
- This detects the installed coding agents on the current machine, writes the machine-level MCP and user config Brainclaw manages for that detected set, and does **not** scan or initialize repositories.
137
-
138
- ### 4. Initialize or refresh the current project
139
-
140
- ```bash
141
- cd your-project
142
- brainclaw init
143
- ```
144
-
145
- `brainclaw init` is now safe to rerun. It creates `.brainclaw/` when the project is new, or refreshes the managed Brainclaw and agent integration files when the project already has memory.
146
-
147
- If you are explicitly adding another agent to an existing Brainclaw project, use:
148
-
149
- ```bash
150
- brainclaw enable-agent <agent-name>
151
- ```
152
-
153
- ### 5. Restart your agent
154
-
155
- Restart your coding agent (or reload MCP servers) so it picks up the new configuration. After that, brainclaw tools are available.
156
-
157
- ### 6. Start working
158
-
159
- Pick one of the canonical entry points depending on what you're doing:
160
-
161
- ```text
162
- # Solo work — start a session, load context, claim a scope:
163
- bclaw_work(intent="execute", scope="src/feature")
164
-
165
- # Multi-agent — assign work, consult, open a review, or open an ideation loop:
166
- bclaw_coordinate(intent="assign|consult|review|ideate", task="...", targetAgents=[...])
167
-
168
- # Parallel lanes — dispatch a sequence across several agent instances:
169
- bclaw_dispatch(intent="execute", agents=[...])
170
- ```
171
-
172
- Common follow-ups during work — all use the canonical CRUD grammar:
173
-
174
- ```text
175
- bclaw_context(kind="memory", path=...) → narrow project memory to a scope
176
- bclaw_find(entity="...", filter=...) list plans, claims, handoffs, candidates,
177
- bclaw_get(entity="...", id=...) read one item
178
- bclaw_create(entity="runtime_note", data=…) record an observation, decision, or trap
179
- bclaw_read_inbox() pick up assigned work or review requests
180
- bclaw_session_end(narrative=…) close cleanly, hand off context to the next agent
181
- ```
182
-
183
- For agents without MCP (e.g. Copilot reads `.github/copilot-instructions.md`), regenerate the instruction file when project memory changes:
184
-
185
- ```bash
186
- brainclaw export --detect --write
187
- ```
188
-
189
- ### 7. Verify it works
190
-
191
- ```bash
192
- brainclaw status # see active sessions, claims, plans
193
- brainclaw agent-board # see what each agent is doing
194
- ```
195
-
196
- ### Multi-agent setup
197
-
198
- To configure brainclaw for all your repos and agents at once:
199
-
200
- ```bash
201
- brainclaw setup --yes
202
- ```
203
-
204
- This is the broader multi-repo wizard. It bootstraps the machine, scans your project roots, and initializes selected repositories in one pass.
205
-
206
- ### Existing projects
207
-
208
- For repos that already have code, brainclaw can extract context automatically:
209
-
210
- ```bash
211
- brainclaw bootstrap --json # preview what brainclaw detected
212
- brainclaw bootstrap --apply # import into memory
213
- ```
214
-
215
- See `docs/quickstart.md` for the full walkthrough, `docs/integrations/overview.md` for agent-specific details.
216
-
217
- ---
218
-
219
- ## Current state
220
-
221
- Recent releases have moved a lot of multi-agent parallel work from "risky" to "supported":
222
-
223
- - **Per-claim auto-worktree** — each dispatched lane gets its own isolated git worktree; the coordinator integrates with an octopus merge.
224
- - **Sequenced parallel execute** — `bclaw_dispatch(intent="execute")` fans out independent lanes across several agent instances and integrates the result.
225
- - **Symmetric review-fix loops** — `bclaw_coordinate(intent="review", open_loop=true, review_mode="symmetric")` runs an alternating review-and-fix conversation across two slots without shared-checkout collisions.
226
- - **Cross-platform spawn** — OS-aware prompt delivery (stdin pipe / inline arg) plus a brief-ack file handshake, so spawned workers can be detected and timed out reliably on Windows and Unix.
227
- - **Worktree GC is scope-bounded** symlinks and junctions are no longer followed during cleanup, so post-merge sweeps can't wipe `node_modules` or other neighboring directories.
228
- - **MCP runtime self-heal** — when the runtime is corrupted, the server logs an actionable repair pointer; `brainclaw doctor --repair` rebuilds dist in one step.
229
-
230
- Still sharp:
231
-
232
- 1. **Same-checkout concurrent edits** running two agents in the *same* working tree (no per-claim worktree) is still the wrong answer. Use the dispatch path (auto-worktree per claim) instead of raw concurrent CLI sessions.
233
- 2. **Cross-machine sync** — federation across machines is on the roadmap, not in v1.x. Today brainclaw's store is local and one-machine-per-project.
234
- 3. **Spawn-and-forget assumptions** spawned workers don't always commit their work cleanly. The brief-ack file confirms the spawn started; in the worst case the coordinator harvests open changes.
235
- 4. **Live state for hook-less agents** — Tier B/C agents without lifecycle hooks (Cursor, Cline, Windsurf, Copilot, Continue, Kilocode, Mistral Vibe, Hermes) get live context via `.live.md` companions regenerated on session-end and handoff, not via real-time push.
236
-
237
- Recommended use today:
238
-
239
- 1. for parallel work, dispatch a sequence with `bclaw_dispatch(intent="execute")` — each lane gets its own worktree
240
- 2. for sequential work in the same project, let one agent claim at a time and rely on handoffs
241
- 3. when reviewing or fixing across agents, prefer symmetric review loops over manual ping-pong
242
- 4. keep multi-machine workflows on a single source of truth until federation lands
243
-
244
- ---
245
-
246
- ## Multi-stack worktree
247
-
248
- When brainclaw creates an agent worktree, it auto-detects which dependency directories to symlink from the main worktree based on stack markers present in the project root:
249
-
250
- | Stack marker | Symlinked directories |
251
- |---|---|
252
- | `package.json` | `node_modules` |
253
- | `requirements.txt` / `pyproject.toml` / `Pipfile` | `venv`, `.venv` |
254
- | `Gemfile` | `vendor/bundle` |
255
- | `go.mod` | `vendor` |
256
- | `composer.json` | `vendor` |
257
- | `mix.exs` | `deps` |
258
-
259
- Maven, Gradle, and Cargo are intentionally excluded — their dependency caches are machine-global (`~/.m2`, `~/.gradle/caches`, `~/.cargo/registry`) and found automatically by the toolchain.
260
-
261
- Build outputs like `dist` are **not** symlinked — they must be per-worktree to avoid EBUSY errors when other processes hold handles on the output directory.
262
-
263
- Override detection in `.brainclaw/config.yaml`:
264
-
265
- ```yaml
266
- worktree:
267
- shared_paths: [".cache"] # additive to auto-detected
268
- exclude_shared: ["node_modules"] # opt-out a detected entry
269
- ```
270
-
271
- ---
272
-
273
- ## Cross-project links
274
-
275
- Link a sibling brainclaw project so that signals (candidates, handoffs, runtime notes) can flow between them. Stored under `cross_project_links` in `.brainclaw/config.yaml`.
276
-
277
- ```bash
278
- # Subscribe to incoming signals from a peer (default role)
279
- brainclaw link add ../brainclaw-cloud
280
-
281
- # Publish candidates only to a peer
282
- brainclaw link add ../brainclaw-site --role publisher --channels candidate
283
-
284
- # Replace an existing entry of the same name/path
285
- brainclaw link add ../brainclaw-cloud --role publisher --force
286
-
287
- # Inspect what's wired
288
- brainclaw link list
289
-
290
- # Drop a link by name, path, or basename
291
- brainclaw link remove brainclaw-cloud
292
- ```
293
-
294
- `role: publisher` is required to push signals out (`bclaw_write_note --crossProject`, `bclaw_create(entity='handoff', targetProject=…)`, etc.). `role: subscriber` (the default) marks the link as readable only.
295
-
296
- The same surface is available through the canonical grammar for agents: `bclaw_create/find/get/update/remove(entity='cross_project_link')`.
297
-
298
- ---
299
-
300
- ## Documentation
301
-
302
- The npm package includes the Markdown docs below under `docs/`. Public web docs on `brainclaw.dev` are still being rolled out, so the npm README does not depend on private GitHub links.
303
-
304
- If you are integrating Brainclaw into an agent workflow, start with the agent-facing docs first:
305
-
306
- | | |
307
- |---|---|
308
- | `docs/index.md` | Documentation index grouped by getting started, guides, reference, and design |
309
- | `docs/integrations/overview.md` | Start here for agent integrations |
310
- | `docs/integrations/mcp.md` | MCP runtime path for capable agents |
311
- | `docs/quickstart.md` | First-time setup on a new project (greenfield) |
312
- | `docs/quickstart-existing-project.md` | Joining a project that already has `.brainclaw/` |
313
- | `docs/server-operations.md` | Operator and remote-server workflow guide |
314
- | `docs/cli.md` | CLI reference for operators, scripts, and fallback use |
315
- | `docs/concepts/memory.md` | What "memory" means in brainclaw |
316
- | `docs/concepts/plans-and-claims.md` | Coordination layer |
317
- | `docs/concepts/runtime-notes.md` | Ephemeral observations |
318
- | `docs/concepts/multi-agent-workflows.md` | The four common scenarios — orchestration, agent switching, project recovery, team async |
319
- | `docs/concepts/troubleshooting.md` | Runbook for degraded coordination state — stale claims, missing dist, octopus failures, etc. |
320
- | `docs/integrations/cursor.md` | Cursor |
321
- | `docs/integrations/claude-code.md` | Claude Code |
322
- | `docs/integrations/copilot.md` | GitHub Copilot |
323
- | `docs/integrations/codex.md` | Codex |
324
- | `docs/storage.md` | Storage model |
325
- | `docs/security.md` | Security model |
326
- | `docs/review.md` | Reflective review |
327
- | `docs/reputation.md` | Reputation signals |
328
- | `docs/playbooks/` | Audience design constraints for brainclaw development |
329
-
330
- ---
331
-
332
- ## Running tests
333
-
334
- Contributor note: the commands below are for developing Brainclaw itself, not for normal agent usage inside a target repo.
335
-
336
- ```bash
337
- npm test # unit + smoke (fast path)
338
- npm run test:e2e # full suite
339
- npm run test:coverage # with coverage report
340
- ```
341
-
342
- ---
343
-
344
- ## Changelog
345
-
346
- For older releases (v0.x and the early v1.0 launch series), `git log` on `master` is the source of truth — every release commit follows the `chore(release): bump version to <semver>` convention, and the matching feature/fix commits reference their plan id (e.g. `feat(mcp): self-heal ... (pln#478)`).
347
-
348
- ### v1.8.0
349
-
350
- - **Multi-agent dispatch convergence — "worktree-as-contract"** (from a real
351
- cross-project field session where a sandboxed worker could neither commit nor
352
- reach MCP). The worker's contract shrinks to "edit files in this worktree +
353
- drop `LANE-RESULT.json`": `brainclaw harvest --integrate` commits the worktree
354
- diff on behalf of a worker that can't self-commit (hard-guarded to the linked
355
- worktree, never the main repo), then completes the assignment and releases the
356
- claim with plan cascade. A `LANE-RESULT.json` is now the #1 verdict signal in
357
- `bclaw_dispatch_status` (worker FINISHED, even without self-update); the
358
- dispatcher refuses to spawn without an isolated worktree; `open_loop` reviews
359
- pre-flight each reviewer agent with a trivial validation spawn (clear
360
- boot-failure reason instead of a generic loop timeout); and decisions/traps
361
- gain `verified_at`/`verify_cmd` so perishable facts can be flagged stale.
362
- Additive + opt-in throughout. (pln#530, pln#531, pln#532, pln#533, pln#534, trp#468)
363
-
364
- ### v1.7.5
365
-
366
- - **Security patch (recommended upgrade)**fixes a git command-injection / RCE
367
- vector flagged by Socket AI: several commands interpolated a git ref (notably
368
- one derived from the persisted session `git_sha`) into `execSync` shell
369
- strings. All git calls now use `execFileSync` (no shell) and `git_sha` is
370
- validated as a hex SHA. No functional change. (session-end, release-claims,
371
- release-notes, sync)
372
-
373
- ### v1.7.4
374
-
375
- - **Dispatch observability + worker DX hardening** (from a real cross-project
376
- field session) — `bclaw_dispatch_status` and the reconciler now derive liveness
377
- from filesystem activity (log + worktree mtime), so a worker actively editing
378
- files is no longer falsely flagged `stalled`, and known codex boot-failure
379
- stderr signatures get a targeted diagnosis; briefs are transport-aware (a
380
- sandboxed agent without MCP/commit gets the file protocol, not instructions it
381
- can't follow), backed by a derived capability matrix
382
- (`dispatchHasMcp`/`dispatchCanCommit`); `bclaw_claim` gains an advisory
383
- (no-worktree) mode; `bclaw_find` payloads are size-bounded with pagination
384
- metadata; an opt-in per-worktree `tsc --noEmit` pre-commit gate; gated ready
385
- lanes carry a code-propagation advisory; the reconciler auto-releases the claim
386
- of a run it infers failed; and `plan.related_paths` is now updatable.
387
- (pln#479, pln#491, pln#527, pln#528, pln#529, trp#291, trp#431, trp#433, trp#434)
388
-
389
- ### v1.7.3
390
-
391
- - **Multi-agent dispatch hardening for JS/TS monorepos** — dispatched worktrees
392
- junction-link per-package `node_modules` (npm / yarn / pnpm workspaces), not
393
- just the root, and surface failed links instead of swallowing them; `brainclaw
394
- worktree clean` now garbage-collects merged worktrees past birth-noise instead
395
- of skipping them all; the agent inventory reports an agent `spawnable` when its
396
- binary is on PATH even if `--version` is slow to start; dispatch-verification
397
- guidance leads with `bclaw_dispatch_status` (not the untrustworthy Windows
398
- wrapper pid); and a new `LANE-RESULT.json` convention + `brainclaw harvest
399
- <assignment_id>` give workers a standard, MCP-free result channel. The dispatch
400
- dirty-guard also ignores `.claude/`, `.cursor/`, and `.codex/` agent-local
401
- config. (pln#523, pln#524, pln#525, pln#526, trp#371, trp#427, trp#428)
402
-
403
- ### v1.7.2
404
-
405
- - **Sequence MCP tools are agent-first by default** sequence creation,
406
- listing, update, and deletion tools are now in the default MCP catalog, with
407
- explicit lane item schemas (`planId`, optional `stepId`, `rank`,
408
- dependencies, lane metadata) and matching canonical CRUD validation for
409
- `entity="sequence"`.
410
-
411
- ### v1.7.1
412
-
413
- - **MCP project context isolation fix** — `bclaw_switch` now keeps MCP switches
414
- session-scoped even when the agent session has to be resolved or created on
415
- the fly. Session lookup honors explicit session IDs, avoids adopting another
416
- live process's session, detects Codex via native `CODEX_*` runtime variables,
417
- and `bclaw_switch(list=true)` reports the session active project with
418
- `active_source`.
419
-
420
- ### v1.7.0
421
-
422
- - **Dispatch reliability + scope-aware dirty guard** evidence-first
423
- `agent_run` reconciliation avoids false terminal states, `bclaw_coordinate`
424
- accepts pinned refs and a scope-aware `allow_dirty` guard, and the Hermes
425
- agent integration joins the supported surfaces.
426
-
427
- ### v1.6.0
428
-
429
- - **Bootstrap loop + cross-project agent workflow** — the bootstrap ideation
430
- preset can materialize `PROJECT.md`, `bclaw_init_project` initializes and links
431
- arbitrary project paths, and `project=` routing reaches `bclaw_work` /
432
- `bclaw_loop` for linked-project operations.
433
-
434
- ### v1.5.3
435
-
436
- - **Cross-project canonical grammar + CLI parity** (pln#359, all phases) — the canonical grammar (`bclaw_find / get / create / update / remove / transition`), `bclaw_context`, and `bclaw_coordinate` now accept an optional `project: <name>` argument that routes the operation to a linked project. Two link kinds are recognised: `cross_project_links` (sibling/peer projects in `config.yaml`, `brainclaw link list`) and workspace store-chain children. Arbitrary directory paths are rejected — adoption requires an explicit link, which gives the user a single point of control over what an agent can reach. Identity is sourced from the caller's home registry; entity writes + audit log entries land in the target. Unknown project names throw `validation_error` with a hint listing the configured links — no silent fallback. Cross-project `bclaw_coordinate` is **inbox-only**: claim/assignment/message all land in the target, the target agent picks the brief up async via its own `bclaw_work`, and auto-spawn from the source process is force-disabled because the spawn cwd / worktree are tied to the target's git repo (a warning surfaces in `FacadeResponse.warnings`). The CLI exposes the same as a global `--project <name>` flag, mutually exclusive with `--cwd`. Refs: helper `resolveProjectCwd` in `src/core/cross-project.ts`, MCP write/read handler dispatch in `src/commands/mcp.ts` and `src/commands/mcp-read-handlers.ts`, `--project` plumbing in `src/cli.ts` preAction, surface advertisement in `src/core/instruction-templates.ts`, plus tests in `tests/unit/cross-project.test.ts` (10 unit cases on the helper), `tests/unit/bclaw-coordinate.test.ts` (4 cross-project routing cases), and `tests/cli-cross-project.test.ts` (5 e2e cases). Closes the `--cwd` workaround pattern that had been the day-to-day shape of multi-project sessions.
437
- - **Site facts contract** (umbrella `pln_7fdfd70d` sprint 0) — new `scripts/emit-site-facts.mjs` emits `dist/facts.{js,json}` from `MCP_TOOL_NAMES` + `ENTITY_NAMES` so the brainclaw-site (and any consumer) can pull live tool/entity counts at build time without forking the values into a hand-maintained config. The package `files` list ships `dist/facts.json`; build:cli runs the emitter as part of the chain.
438
-
439
- ### v1.5.2
440
-
441
- - **Grammar fix: `bclaw_update` no longer silently drops patches** (trp#187, pln#500) — the canonical CRUD surface promised that `EntityRegistry.updatable` listed every patchable field, but the legacy impls behind the dispatch (`updatePlan`, `updateMemoryItem`) only handled a typed subset. A `as UpdatePlanInput` cast in `entity-operations.ts` masked the gap from TypeScript: callers passed `{text, tags, severity, …}`, validation accepted them, and the function bodies never read them. Empirically reproduced this session on `pln#359` (text+tags drop) and `trp#187` itself (severity drop). Fix adds a generic-patch escape-hatch (`patch?: Partial<…>`) on `UpdatePlanInput` and `UpdateMemoryInput`, applied via `Object.assign` after the typed fields so legacy CLI callers keep their behaviour. The dispatch in `entity-operations.ts` now passes the full patch through that escape-hatch for plan/decision/constraint/trap. `runtime_note`, `candidate`, and `cross_project_link` were already correct. New `tests/unit/entity-update-coverage.test.ts` is parametric: for every `(entity, field)` pair in `EntityRegistry.updatable`, create + patch + get + assert the field actually persisted (29 cases). Adding a new updatable field will require adding a coverage row, so the contract stays honest.
442
-
443
- ### v1.5.1
444
-
445
- - **Cross-project link CLI + grammar parity** (pln#454 step 2) — new `brainclaw link add/list/remove` subcommands and a stateless `cross_project_link` entity wired into the canonical CRUD verbs (`bclaw_create / find / get / update / remove`). The pain point was small (config.yaml is hand-editable) but the asymmetry runtime cross-project signaling shipped, management UX did not — meant federation peers had no first-class affordance. Storage stays in `config.cross_project_links`; the entity is intentionally stateless (no transitions). Refs: `src/commands/link.ts`, `src/core/cross-project.ts` (new `addCrossProjectLink` / `removeCrossProjectLink`), `src/core/entity-registry.ts` (new `xpl` prefix), `src/core/entity-operations.ts` dispatch cases, `tests/unit/link.test.ts` + `tests/unit/cross-project-link-grammar.test.ts` (26 new cases).
446
- - **Agent registry pruned** (pln#454 step 1) — 8 synthetic profiles (antigravity, copilot-vscode, claude-opus, copilot-identity, copilot, claude-sonnet, visionnaire, copilot-codev) and 11 abandoned sessions archived under `.brainclaw/archive/agents/2026-05-07/`. The whitelist that survives matches `feedback_allowed_dispatch_agents.md`: `claude-code`, `codex`, `github-copilot`, plus `jberdah` (curator). Auto-re-registration in `detectAiAgent` is intentionally preserved — if a real surface starts a session, the registry auto-rebuilds for it. Pure store cleanup, no code change.
447
- - **Inbox + assignment lifecycle reconciliation** (housekeeping) — 89 stale inbox messages and 7 orphan offered-assignments closed with retroactive lifecycle updates. The plans they backed (pln#478 mcp self-heal, pln#480 multi-stack worktree, pln#483 bclaw_work compact, pln#471 tier-B live companions) had all merged weeks earlier without the dispatch path calling `bclaw_assignment_update`. Captured as `feedback_dispatch_test_inbox_debris` so future drift is mass-acked instead of triaged per-message.
448
-
449
- ### v1.5.0
450
-
451
- - **Ideation loop MVP** (pln#492) — new `bclaw_coordinate(intent='ideate')` opens a memory-confrontation loop: critic reads only adversarial categories (traps + feedback + runtime_notes + critique_history) and gets a BM25-ranked, context-filtered, 12k-token-capped brief assembled from project memory. Single-agent (champion drives manually) or multi-agent (auto-dispatch a turn per critic). Iteration block (cycle, max_iterations, exit_when), phase-advance gate (≥3 critique artifacts before leaving critique), system events (`phase_advance_blocked`, `max_iterations_reached`). Full design: [docs/concepts/ideation-loop.md](docs/concepts/ideation-loop.md).
452
- - **Reliable dispatch + autonomy contract** (pln#496) — codex / sandboxed task-based agents now emit the full lifecycle (accepted → started → progress → completed). `briefMode` resolution corrected: `task-based && hasMcp → 'full'` (not 'compact', which silently dropped the protocol section). Lazy reconciliation pattern: `agentrun-reconciler` runs at every read path (`bclaw_assignment_events`, `bclaw_loop intent='get'`, `doctor --dispatch`) instead of a daemon; first run auto-recovered 9 historical orphan agent_runs in <1s. New autonomy contract section in instruction surfaces — agents execute protocol-defined transitions instead of pausing to ask. New `buildClaimEnvPrefix` consolidates cross-shell env injection (Windows defaults to cmd, POSIX uses unquoted bytes per PATH conventions). New `brainclaw doctor --dispatch` for operator-facing dispatch health.
453
- - **Worktree junction wipe fix** (pln#498) — `detachWorktreeJunctions` runs before `git worktree remove` on Windows so git's recursive rm cannot follow the `node_modules` junction back into the main repo. Closes the recurring post-merge wipe trap; validated empirically on multiple back-to-back merges in the v1.5.0 session.
454
- - **Methodological lessons** captured as user auto-memory feedback memos: bisect historical state before bisecting code (regression vs. always-broken-but-hidden), lazy reconcile at read paths beats daemon polling, codex briefs MUST include the Protocol section (implicit instructions don't propagate to sandboxed CLIs).
455
-
456
- ### v1.2.0
457
-
458
- - **zod 3 4 migration** (pln#486) — schemas are semantically equivalent but the JSON Schema emitted by `tools/list` shifted shape; downstream MCP clients that snapshot schemas should re-pin. See `docs/mcp-schema-changelog.md` for the public surface fingerprint.
459
-
460
- ### v1.1.0
461
-
462
- - **Node 20+ baseline** (pln#485) — `engines.node` is now `>=20.0.0` (Node 18 reached EOL in April 2025). CI matrix runs Node 20, 22, and 24 on Linux; Windows on Node 24.
463
- - **commander 13 → 14** (requires Node 20+).
464
- - **@types/node 22 24** (LTS-aligned).
465
-
466
- ### v1.0.15
467
-
468
- - **TypeScript 5.8 6.0** (pln#484) migration to `module: "nodenext"` (`Node16` is deprecated in TS 6, scheduled for removal in TS 7); explicit `types: ["node"]` since TS 6 changed the default to `[]`.
469
-
470
- ### v1.0.14
471
-
472
- - **`bclaw_work` compact payload by default** (pln#483) avoids exceeding the ~25k MCP token cap on projects with substantial memory. Pass `compact: false` for the full payload, or call `bclaw_context(kind="memory")` after.
473
- - **MCP runtime self-heal + `doctor --repair`** (pln#478) — when `dist/mcp-worker.js` is missing, the server logs an actionable repair pointer and read-only handlers keep serving in-process. `brainclaw doctor --repair` rebuilds dist in one step.
474
- - **Tier B/C native live companions** (pln#471) — `.cursor/live.md`, `.clinerules/live.md`, `.windsurf/rules/live.md`, `.github/copilot-instructions.live.md`, `.continue/live.md`, `GEMINI.live.md` regenerated on session-end and handoff. Opt-in via `brainclaw export --include-live --write`.
475
-
476
- ### v1.0.13
477
-
478
- - **Worktree GC scope hardening** (pln#477) — `safeRemoveWorktreeDir` no longer follows symlinks/junctions during cleanup. Closes a class of post-merge wipes that previously destroyed `node_modules` and other neighboring directories on Windows.
479
-
480
- ### v1.0.10–v1.0.12
481
-
482
- - **GitHub Copilot CLI is spawnable** (pln#440) Copilot CLI 1.0.35+ supports `-p "<prompt>" --allow-all --no-ask-user`; tier promoted to A.
483
- - **Codex spawn on Windows: stdin pipe + 30s handshake TTL** (pln#475) — fixes embedded backticks/`#`/multi-line content getting mis-parsed by `cmd.exe` when a prompt is passed as an inline argument.
484
- - **Brief-ack file handshake** (pln#476) `.brainclaw/coordination/runtime/ack/<assignmentId>.ack` proves a spawned worker started, decoupling the handshake from MCP availability inside the worker (important for Codex in `--sandbox workspace-write`).
485
- - **`bclaw_loop(intent="open")` orphan-gate** (pln#461) — refuses to open a loop without dispatch unless `allow_orphan: true` is explicit. Use `bclaw_coordinate(intent="review", open_loop: true)` instead.
486
- - **Kilocode** Tier B integration with native MCP config and live companion (pln#464).
487
-
488
- ### v1.0.0
489
-
490
- - **Canonical grammar promoted to standard tier** — `bclaw_find` / `bclaw_get` / `bclaw_create` / `bclaw_update` / `bclaw_remove` / `bclaw_transition`, plus the entry facades `bclaw_work` and `bclaw_context`, the multi-agent facades `bclaw_coordinate` and `bclaw_dispatch`, and the loop facade `bclaw_loop`. Legacy per-entity tools removed from the discoverable surface (still callable as a migration escape hatch). See `docs/concepts/mcp-governance.md` for tier rules and the deprecation policy.
491
-
492
- ---
493
-
494
- ## License
495
-
496
- brainclaw core is published under the [MIT License](LICENSE) — (c) 2024-2026 Juan Berdah.
497
-
498
- The licensing split is simple:
499
-
500
- - the local-first brainclaw core is MIT
501
- - cloud shared-memory, remote collaboration services, advanced dashboards, and related hosted add-ons will live in separate commercial products
502
-
503
- The MIT core covers what makes brainclaw useful inside a repo today: local project memory, local MCP and CLI coordination, onboarding and bootstrap, plans, claims, handoffs, runtime notes, and local agent integrations.
504
-
505
- The goal is not to close brainclaw down. The goal is to keep the local-first core open and genuinely useful on its own, while keeping hosted collaboration features separate.
1
+ <p align="center">
2
+ <img src="https://brainclaw.dev/logo.png" alt="brainclaw" width="140" />
3
+ </p>
4
+
5
+ <h1 align="center">brainclaw</h1>
6
+
7
+ <p align="center"><strong>Local-first coordination and shared memory for coding agents.</strong></p>
8
+
9
+ ---
10
+
11
+ If you've ever:
12
+
13
+ - **lost your conversation** when your agent hit credit limits mid-task,
14
+ - returned to a project **after a week** with no idea where you left off,
15
+ - watched two coworkers (or two agents) **edit the same files** without knowing it,
16
+ - or **gave up running multiple agents in parallel** because keeping them in sync was a pain,
17
+
18
+ brainclaw gives you durable shared state across sessions, agents, and teammates. Plans, claims, handoffs, decisions, and traps live in `.brainclaw/`, work identically across any compatible agent (Claude Code, Codex, Copilot, Cline, OpenCode, Cursor, Windsurf, Kilocode, Roo Code, Continue, Mistral Vibe, Hermes, Antigravity/Gemini CLI, …), and stay accessible whether you orchestrate them in parallel or pick them up one after another.
19
+
20
+ Use it two ways — **together or separately**:
21
+
22
+ - **Active orchestration** — dispatch work in parallel across multiple agent instances. Dispatched work runs in isolated Git Worktrees to prevent conflicts, sequences manage lane dependencies, the dispatcher routes by capacity.
23
+ - **Async shared state** — when an agent runs out of credits, when you return to a project after weeks, or when teammates work in parallel: the next agent (or you) resumes cleanly with the same context, plans, and constraints.
24
+
25
+ The same primitives — plans, claims, handoffs, decisions, traps — serve both modes. That's the design point. brainclaw stores everything locally as plain text + JSON, versions it in Git, and asks no opinion about which agent you should use for what.
26
+
27
+ It sits alongside your coding agents and gives them a shared state layer they can resume from reliably. brainclaw is also starting to model other local AI work surfaces on the same machine, such as ChatGPT Desktop, Claude Desktop, Claude Cowork, and Gemini web or CLI, to keep a project-level queue of non-code work for those surfaces.
28
+
29
+ ---
30
+
31
+ ## What it provides
32
+
33
+ | | |
34
+ | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
+ | **Project memory** | constraints, decisions, traps, handoffs, and layered instructions agents can resume from |
36
+ | **Coordination state** | shared plans, file claims (dispatched work isolated in Git Worktrees), runtime notes, and board views for active work |
37
+ | **Agent-ready context** | compact, prompt-sized context built from real workspace state instead of stale instructions |
38
+ | **Native agent files** | auto-writes `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/`, `.windsurfrules`, and similar local guidance |
39
+ | **Multi-turn loops** | review and ideation loops with structured phases, iteration semantics, and per-phase memory filters see[loop engine](docs/concepts/loop-engine.md) and [ideation loop](docs/concepts/ideation-loop.md) |
40
+ | **Machine AI surface discovery** | detects local coding agents plus desktop AI work surfaces such as ChatGPT Desktop and Gemini CLI |
41
+ | **Queued surface tasks** | stores project-scoped requests for other local AI surfaces, such as visual generation, drafting, summaries, or research |
42
+ | **Local-first storage** | plain text + JSON, Git-friendly, no mandatory cloud, no telemetry by default |
43
+
44
+ ---
45
+
46
+ ## Agent Surfaces
47
+
48
+ brainclaw exposes the same collaboration state through three surfaces, but they do not have the same role in an agent-first workflow.
49
+
50
+ | Surface | Primary use |
51
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------ |
52
+ | **MCP** | default path for capable agents that need fresh context, board state, plans, claims, and write operations |
53
+ | **Native agent files** | local guidance and bootstrap hints for a specific agent surface (`AGENTS.md`, `CLAUDE.md`, Cursor rules, etc.) |
54
+ | **CLI** | operator workflows, scripting, setup, debugging, release, and fallback access when MCP is not the integration path |
55
+
56
+ If you are documenting or integrating an agent workflow, treat MCP as the primary runtime path.
57
+
58
+ ---
59
+
60
+ ## Works With
61
+
62
+ brainclaw is designed to sit alongside the coding agents teams are already using, not behind a separate hosted control plane.
63
+
64
+ ### Code Agents
65
+
66
+ | Logo | Agent | Tier | What brainclaw configures |
67
+ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ---- | ----------------------------------------------------------------------- |
68
+ | [![Claude Code](https://img.shields.io/badge/Claude_Code-111111?logo=anthropic&logoColor=white)](https://github.com/anthropics/claude-code) | **[Claude Code](https://github.com/anthropics/claude-code)** | A | MCP + CLAUDE.md + hooks + auto-approve + permissions + /brainclaw skill |
69
+ | [![Codex](https://img.shields.io/badge/Codex-111111?logo=openai&logoColor=white)](https://openai.com/codex/) | **[Codex](https://openai.com/codex/)** | A | MCP + AGENTS.md + skills |
70
+ | [![Cursor](https://img.shields.io/badge/Cursor-1F2430?logo=cursor&logoColor=white)](https://cursor.com/en-US) | **[Cursor](https://cursor.com/en-US)** | A | MCP (machine) + .cursor/rules/ + hooks + skills |
71
+ | [![Windsurf](https://img.shields.io/badge/Windsurf-0B1220?logo=codeium&logoColor=white)](https://windsurf.com/) | **[Windsurf](https://windsurf.com/)** | A | MCP (machine) + .windsurfrules + .windsurf/rules/ |
72
+ | [![Cline](https://img.shields.io/badge/Cline-0F766E?logoColor=white)](https://github.com/cline/cline) | **[Cline](https://github.com/cline/cline)** | A | MCP + auto-approve + .clinerules/ |
73
+ | [![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-181717?logo=githubcopilot&logoColor=white)](https://github.com/features/copilot) | **[GitHub Copilot](https://github.com/features/copilot)** | A | MCP + copilot-instructions.md + hooks + skills |
74
+ | [![Roo](https://img.shields.io/badge/Roo-7C3AED?logoColor=white)](https://github.com/RooCodeInc/Roo-Code) | **[Roo](https://github.com/RooCodeInc/Roo-Code)** | B | MCP + auto-approve + .roo/rules/ |
75
+ | [![Continue](https://img.shields.io/badge/Continue-2563EB?logoColor=white)](https://github.com/continuedev/continue) | **[Continue](https://github.com/continuedev/continue)** | B | MCP + .continue/rules/ |
76
+ | [![OpenCode](https://img.shields.io/badge/OpenCode-0F172A?logoColor=white)](https://github.com/opencode-ai/opencode) | **[OpenCode](https://github.com/opencode-ai/opencode)** | B | MCP + AGENTS.md |
77
+ | [![Gemini CLI](https://img.shields.io/badge/Gemini_CLI-1A73E8?logo=googlegemini&logoColor=white)](https://github.com/google-gemini/gemini-cli) | **[Antigravity / Gemini CLI](https://github.com/google-gemini/gemini-cli)** | B | MCP + GEMINI.md |
78
+
79
+ **Tier A** = strongest supported integration for that agent family (usually MCP plus native files, and hooks/skills where the agent exposes them). **Tier B** = MCP/native-file integration with fewer automation surfaces. Tier can degrade at runtime if integration surfaces are missing.
80
+
81
+ ### Autonomous Agents
82
+
83
+ | Logo | Agent | Tier | What brainclaw configures |
84
+ | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ---- | -------------------------------------------------------------- |
85
+ | [![OpenClaw](https://img.shields.io/badge/OpenClaw-FF6B35?logoColor=white)](https://github.com/openclaw/openclaw) | **[OpenClaw](https://github.com/openclaw/openclaw)** | B | MCP + brainclaw skill (SKILL.md) for structured project memory |
86
+ | [![Hermes](https://img.shields.io/badge/Hermes-111111?logoColor=white)](https://github.com/NousResearch/hermes-agent) | **[Hermes Agent](https://github.com/NousResearch/hermes-agent)** | B | MCP + universal `.agents/skills/brainclaw/SKILL.md` |
87
+ | [![NanoClaw](https://img.shields.io/badge/NanoClaw-4A90D9?logoColor=white)](https://github.com/qwibitai/nanoclaw) | **[NanoClaw](https://github.com/qwibitai/nanoclaw)** | C | brainclaw skill — messaging agent (WhatsApp, Telegram, Slack) |
88
+ | [![NemoClaw](https://img.shields.io/badge/NemoClaw-76B900?logo=nvidia&logoColor=white)](https://github.com/NVIDIA/NemoClaw) | **[NemoClaw](https://github.com/NVIDIA/NemoClaw)** | C | brainclaw skill — NVIDIA enterprise agent stack |
89
+ | [![PicoClaw](https://img.shields.io/badge/PicoClaw-00ADD8?logo=go&logoColor=white)](https://github.com/sipeed/picoclaw) | **[PicoClaw](https://github.com/sipeed/picoclaw)** | C | brainclaw skill — edge/IoT agent (Go, <10MB RAM) |
90
+ | [![ZeroClaw](https://img.shields.io/badge/ZeroClaw-B7410E?logoColor=white)](https://github.com/zeroclaw-labs/zeroclaw) | **[ZeroClaw](https://github.com/zeroclaw-labs/zeroclaw)** | C | brainclaw skill — ultra-lightweight Rust agent (20+ channels) |
91
+
92
+ **Tier C** = no MCP, no hooks — skill-based only with inline context and constrained resources. Autonomous agents use `--profile compact` for short sessions.
93
+
94
+ brainclaw is most effective today when one agent works at a time in a given checkout and the next agent resumes from shared context, claims, and handoffs.
95
+
96
+ ---
97
+
98
+ ## Platform Support
99
+
100
+ brainclaw declares support for Node.js 20+ in `package.json` (`engines.node = ">=20.0.0"`). CI actively exercises Node 22 (Active LTS) and Node 24 (current LTS) on Linux; Windows runs on Node 24. Node 20 still works as a minimum runtime but is no longer CI-verified — it reached EOL in April 2026 and was removed from GitHub-hosted runners. The recommended runtime is Node 22 LTS or Node 24 LTS. Real-world support is still not perfectly even yet.
101
+
102
+ | Logo | Platform | Status today | Notes |
103
+ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
104
+ | [![Linux](https://img.shields.io/badge/Linux-111111?logo=linux&logoColor=white)](https://www.kernel.org/) | **[Linux](https://www.kernel.org/)** | Recommended | best-supported environment today; GitHub CI runs on Ubuntu with Node 22 and 24 |
105
+ | [![macOS](https://img.shields.io/badge/macOS-000000?logo=apple&logoColor=white)](https://www.apple.com/macos/) | **[macOS](https://www.apple.com/macos/)** | Likely supported | Unix-like path and shell model should map well, but it is less exercised than Linux |
106
+ | [![Windows](https://img.shields.io/badge/Windows-0078D4?logo=windows&logoColor=white)](https://www.microsoft.com/windows/) | **[Windows](https://www.microsoft.com/windows/)** | Supported with caveats | native support exists, but PATH, npm, SSH, and PowerShell quoting still create more friction than on Unix systems |
107
+ | [![Windows + WSL2](https://img.shields.io/badge/Windows%20%2B%20WSL2-0078D4?logo=windows&logoColor=white)](https://learn.microsoft.com/windows/wsl/) | **[Windows + WSL2](https://learn.microsoft.com/windows/wsl/)** | Important, still maturing | Brainclaw detects this setup explicitly, but setup/install/store parity across Windows and WSL is not fully seamless yet |
108
+
109
+ If you want the least surprising setup today, use Linux first. If you are on Windows, prefer a disciplined single-environment workflow and expect a few extra machine-specific fixes.
110
+
111
+ ---
112
+
113
+ ## Get Started
114
+
115
+ ### 1. Let your coding agent lead
116
+
117
+ The smoothest first-run path is agent-first:
118
+
119
+ 1. ask your coding agent to inspect the package and explain what brainclaw does
120
+ 2. ask it to install brainclaw and initialize or join the project you're working on
121
+ 3. use the CLI yourself when you need an explicit operator or fallback path
122
+
123
+ If you want to drive setup manually, use the steps below.
124
+
125
+ ### 2. Install
126
+
127
+ ```bash
128
+ npm install -g brainclaw
129
+ ```
130
+
131
+ ### 3. Bootstrap this machine
132
+
133
+ ```bash
134
+ brainclaw setup-machine --yes
135
+ ```
136
+
137
+ This detects the installed coding agents on the current machine, writes the machine-level MCP and user config Brainclaw manages for that detected set, and does **not** scan or initialize repositories.
138
+
139
+ ### 4. Initialize or refresh the current project
140
+
141
+ ```bash
142
+ cd your-project
143
+ brainclaw init
144
+ ```
145
+
146
+ `brainclaw init` is now safe to rerun. It creates `.brainclaw/` when the project is new, or refreshes the managed Brainclaw and agent integration files when the project already has memory.
147
+
148
+ If you are explicitly adding another agent to an existing Brainclaw project, use:
149
+
150
+ ```bash
151
+ brainclaw enable-agent <agent-name>
152
+ ```
153
+
154
+ ### 5. Restart your agent
155
+
156
+ Restart your coding agent (or reload MCP servers) so it picks up the new configuration. After that, brainclaw tools are available.
157
+
158
+ ### 6. Start working
159
+
160
+ Pick one of the canonical entry points depending on what you're doing:
161
+
162
+ ```text
163
+ # Solo work — start a session, load context, claim a scope:
164
+ bclaw_work(intent="execute", scope="src/feature")
165
+
166
+ # Multi-agent — assign work, consult, open a review, or open an ideation loop:
167
+ bclaw_coordinate(intent="assign|consult|review|ideate", task="...", targetAgents=[...])
168
+
169
+ # Parallel lanes — dispatch a sequence across several agent instances:
170
+ bclaw_dispatch(intent="execute", agents=[...])
171
+ ```
172
+
173
+ Common follow-ups during work — all use the canonical CRUD grammar:
174
+
175
+ ```text
176
+ bclaw_context(kind="memory", path=...) narrow project memory to a scope
177
+ bclaw_find(entity="...", filter=...) list plans, claims, handoffs, candidates, …
178
+ bclaw_get(entity="...", id=...) read one item
179
+ bclaw_create(entity="runtime_note", data=…) record an observation, decision, or trap
180
+ bclaw_read_inbox() pick up assigned work or review requests
181
+ bclaw_session_end(narrative=…) → close cleanly, hand off context to the next agent
182
+ ```
183
+
184
+ For agents without MCP (e.g. Copilot reads `.github/copilot-instructions.md`), regenerate the instruction file when project memory changes:
185
+
186
+ ```bash
187
+ brainclaw export --detect --write
188
+ ```
189
+
190
+ ### 7. Verify it works
191
+
192
+ ```bash
193
+ brainclaw status # see active sessions, claims, plans
194
+ brainclaw agent-board # see what each agent is doing
195
+ ```
196
+
197
+ ## A Day in the Life of a Brainclaw Agent
198
+
199
+ Here's how a typical autonomous task progresses using Brainclaw:
200
+
201
+ ```javascript
202
+ // 1. Session start & Context setup
203
+ bclaw_work({ intent: "execute", scope: "src/feature-auth" });
204
+ // (Brainclaw starts/resumes the session, builds context, and claims the scope.
205
+ // Isolated Git Worktrees are provisioned when work is dispatched to other agents
206
+ // via bclaw_dispatch / bclaw_coordinate(intent="assign"|"review").)
207
+
208
+ // 2. The agent writes code, tests it, and completes the step...
209
+ // write code, test code
210
+ bclaw_complete_step({ planId: "pln_123", stepId: "stp_456" });
211
+
212
+ // 3. The agent releases the claim and requests a review from a peer agent
213
+ bclaw_release_claim({ id: "clm_789", planStatus: "done" });
214
+ bclaw_coordinate({
215
+ intent: "review",
216
+ open_loop: true,
217
+ review_mode: "symmetric",
218
+ targetAgents: ["claude-code"]
219
+ });
220
+
221
+ // 4. The loop progresses as agents interact and resolve findings
222
+ bclaw_loop({ intent: "advance", loop_id: "lop_abc" });
223
+ ```
224
+
225
+ ## The Loop Engine (Multi-Turn Workflows)
226
+
227
+ Brainclaw's Loop Engine moves beyond manual ping-pong by formalizing multi-turn workflows (review, ideation, testing). It features two distinct review modes:
228
+
229
+ - **Asymmetric Mode**: The classic author→reviewer handoff. The reviewer creates findings, and the original author must apply the fixes.
230
+ - **Symmetric Mode**: Eliminates unnecessary round-trips. Both the author and reviewer slots can apply fixes directly, drastically speeding up spec and documentation reviews.
231
+
232
+ Each loop maintains a structured lifecycle, explicit phases, iteration bounds, and per-phase memory filters, executed seamlessly via `bclaw_loop`.
233
+
234
+ ## Enterprise Ready: Mono-repo & Micro-services
235
+
236
+ Brainclaw is designed to scale across complex environments. Using the **`project_mode`** setting, Brainclaw seamlessly auto-detects folder boundaries for mono-repos and applies proper environment bootstrapping.
237
+
238
+ Additionally, **`cross_project_links`** enables inter-project communication:
239
+
240
+ - **Signals**: Candidates, handoffs, and runtime notes gracefully flow between sibling or micro-service projects.
241
+ - **Inbox**: Agents can dispatch review/assign tasks to agents operating in completely different projects using unified inbox routing.
242
+
243
+ ### Multi-agent setup
244
+
245
+ To configure brainclaw for all your repos and agents at once:
246
+
247
+ ```bash
248
+ brainclaw setup --yes
249
+ ```
250
+
251
+ This is the broader multi-repo wizard. It bootstraps the machine, scans your project roots, and initializes selected repositories in one pass.
252
+
253
+ ### Existing projects
254
+
255
+ For repos that already have code, brainclaw can extract context automatically:
256
+
257
+ ```bash
258
+ brainclaw bootstrap --json # preview what brainclaw detected
259
+ brainclaw bootstrap --apply # import into memory
260
+ ```
261
+
262
+ See `docs/quickstart.md` for the full walkthrough, `docs/integrations/overview.md` for agent-specific details.
263
+
264
+ ---
265
+
266
+ ## Current state
267
+
268
+ Recent releases have moved a lot of multi-agent parallel work from "risky" to "supported":
269
+
270
+ - **Per-claim auto-worktree** — each dispatched lane gets its own isolated git worktree; the coordinator integrates with an octopus merge.
271
+ - **Sequenced parallel execute** — `bclaw_dispatch(intent="execute")` fans out independent lanes across several agent instances and integrates the result.
272
+ - **Symmetric review-fix loops** — `bclaw_coordinate(intent="review", open_loop=true, review_mode="symmetric")` runs an alternating review-and-fix conversation across two slots without shared-checkout collisions.
273
+ - **Cross-platform spawn** — OS-aware prompt delivery (stdin pipe / inline arg) plus a brief-ack file handshake, so spawned workers can be detected and timed out reliably on Windows and Unix.
274
+ - **Worktree GC is scope-bounded** — symlinks and junctions are no longer followed during cleanup, so post-merge sweeps can't wipe `node_modules` or other neighboring directories.
275
+ - **MCP runtime self-heal** when the runtime is corrupted, the server logs an actionable repair pointer; `brainclaw doctor --repair` rebuilds dist in one step.
276
+
277
+ Still sharp:
278
+
279
+ 1. **Same-checkout concurrent edits** — running two agents in the *same* working tree (no per-claim worktree) is still the wrong answer. Use the dispatch path (auto-worktree per claim) instead of raw concurrent CLI sessions.
280
+ 2. **Cross-machine sync** — federation across machines is on the roadmap, not in v1.x. Today brainclaw's store is local and one-machine-per-project.
281
+ 3. **Spawn-and-forget assumptions** spawned workers don't always commit their work cleanly. The brief-ack file confirms the spawn started; in the worst case the coordinator harvests open changes.
282
+ 4. **Live state for hook-less agents** supported hook-less file surfaces such as Cline, Windsurf, Continue, Antigravity/Gemini CLI, and Mistral Vibe can get live context via `.live.md` companions regenerated on session-end and handoff, not via real-time push.
283
+
284
+ Recommended use today:
285
+
286
+ 1. for parallel work, dispatch a sequence with `bclaw_dispatch(intent="execute")` — each lane gets its own worktree
287
+ 2. for sequential work in the same project, let one agent claim at a time and rely on handoffs
288
+ 3. when reviewing or fixing across agents, prefer symmetric review loops over manual ping-pong
289
+ 4. keep multi-machine workflows on a single source of truth until federation lands
290
+
291
+ ---
292
+
293
+ ## Multi-stack worktree
294
+
295
+ When brainclaw creates an agent worktree, it auto-detects which dependency directories to symlink from the main worktree based on stack markers present in the project root:
296
+
297
+ | Stack marker | Symlinked directories |
298
+ | ------------------------------------------------------- | --------------------- |
299
+ | `package.json` | `node_modules` |
300
+ | `requirements.txt` / `pyproject.toml` / `Pipfile` | `venv`, `.venv` |
301
+ | `Gemfile` | `vendor/bundle` |
302
+ | `go.mod` | `vendor` |
303
+ | `composer.json` | `vendor` |
304
+ | `mix.exs` | `deps` |
305
+
306
+ Maven, Gradle, and Cargo are intentionally excluded — their dependency caches are machine-global (`~/.m2`, `~/.gradle/caches`, `~/.cargo/registry`) and found automatically by the toolchain.
307
+
308
+ Build outputs like `dist` are **not** symlinked they must be per-worktree to avoid EBUSY errors when other processes hold handles on the output directory.
309
+
310
+ Override detection in `.brainclaw/config.yaml`:
311
+
312
+ ```yaml
313
+ worktree:
314
+ shared_paths: [".cache"] # additive to auto-detected
315
+ exclude_shared: ["node_modules"] # opt-out a detected entry
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Cross-project links
321
+
322
+ Link a sibling brainclaw project so that signals (candidates, handoffs, runtime notes) can flow between them. Stored under `cross_project_links` in `.brainclaw/config.yaml`.
323
+
324
+ ```bash
325
+ # Subscribe to incoming signals from a peer (default role)
326
+ brainclaw link add ../brainclaw-cloud
327
+
328
+ # Publish candidates only to a peer
329
+ brainclaw link add ../brainclaw-site --role publisher --channels candidate
330
+
331
+ # Replace an existing entry of the same name/path
332
+ brainclaw link add ../brainclaw-cloud --role publisher --force
333
+
334
+ # Inspect what's wired
335
+ brainclaw link list
336
+
337
+ # Drop a link by name, path, or basename
338
+ brainclaw link remove brainclaw-cloud
339
+ ```
340
+
341
+ `role: publisher` is required to push signals out (`bclaw_write_note --crossProject`, `bclaw_create(entity='handoff', targetProject=…)`, etc.). `role: subscriber` (the default) marks the link as readable only.
342
+
343
+ The same surface is available through the canonical grammar for agents: `bclaw_create/find/get/update/remove(entity='cross_project_link')`.
344
+
345
+ ---
346
+
347
+ ## Documentation
348
+
349
+ The npm package includes the Markdown docs below under `docs/`. Public web docs on `brainclaw.dev` are still being rolled out, so the npm README does not depend on private GitHub links.
350
+
351
+ If you are integrating Brainclaw into an agent workflow, start with the agent-facing docs first:
352
+
353
+ | | |
354
+ | ------------------------------------------ | --------------------------------------------------------------------------------------------- |
355
+ | `docs/index.md` | Documentation index grouped by getting started, guides, reference, and design |
356
+ | `docs/integrations/overview.md` | Start here for agent integrations |
357
+ | `docs/integrations/mcp.md` | MCP runtime path for capable agents |
358
+ | `docs/quickstart.md` | First-time setup on a new project (greenfield) |
359
+ | `docs/quickstart-existing-project.md` | Joining a project that already has `.brainclaw/` |
360
+ | `docs/server-operations.md` | Operator and remote-server workflow guide |
361
+ | `docs/cli.md` | CLI reference for operators, scripts, and fallback use |
362
+ | `docs/concepts/memory.md` | What "memory" means in brainclaw |
363
+ | `docs/concepts/plans-and-claims.md` | Coordination layer |
364
+ | `docs/concepts/runtime-notes.md` | Ephemeral observations |
365
+ | `docs/concepts/multi-agent-workflows.md` | The four common scenarios — orchestration, agent switching, project recovery, team async |
366
+ | `docs/concepts/troubleshooting.md` | Runbook for degraded coordination state stale claims, missing dist, octopus failures, etc. |
367
+ | `docs/integrations/cursor.md` | Cursor |
368
+ | `docs/integrations/claude-code.md` | Claude Code |
369
+ | `docs/integrations/copilot.md` | GitHub Copilot |
370
+ | `docs/integrations/codex.md` | Codex |
371
+ | `docs/storage.md` | Storage model |
372
+ | `docs/security.md` | Security model |
373
+ | `docs/review.md` | Reflective review |
374
+ | `docs/reputation.md` | Reputation signals |
375
+ | `docs/playbooks/` | Audience design constraints for brainclaw development |
376
+
377
+ ---
378
+
379
+ ## Running tests
380
+
381
+ Contributor note: the commands below are for developing Brainclaw itself, not for normal agent usage inside a target repo.
382
+
383
+ ```bash
384
+ npm test # unit + smoke (fast path)
385
+ npm run test:e2e # end-to-end suite
386
+ npm run test:all # full suite
387
+ npm run test:coverage # with coverage report
388
+ ```
389
+
390
+ ---
391
+
392
+ ## Changelog
393
+
394
+ For older releases (v0.x and the early v1.0 launch series), `git log` on `master` is the source of truth — every release commit follows the `chore(release): bump version to <semver>` convention, and the matching feature/fix commits reference their plan id (e.g. `feat(mcp): self-heal ... (pln#478)`).
395
+
396
+ ### v1.9.1
397
+
398
+ - **Multi-project scoping fixes for monorepos** MCP reads/writes resolve the
399
+ effective project from an explicit arg, the MCP session, `BRAINCLAW_CWD`, or
400
+ the global active project (in that order), so commands target the right store
401
+ inside a monorepo; `bclaw_find` legacy-filter diagnostics report how many
402
+ `provenance.kind="legacy"` records the default filter excluded.
403
+ - **Case-insensitive agent names** — `targetAgents=["Codex"]` (any casing) now
404
+ resolves like `codex`; dispatch/coordinate no longer silently drop a reviewer
405
+ over a capital letter, and an unresolved name reports a distinct `unknown_agent`
406
+ reason instead of the misleading "no CLI spawn template (IDE-only?)".
407
+ - **Docs** revamped Loop Engine, Git Worktrees, Cross-Project Signals, and the
408
+ Orchestration Playbook, corrected against actual behavior (`bclaw_work` =
409
+ session + context + claim, not worktree provisioning; worktrees come from
410
+ dispatch/coordinate; plans via `bclaw_create(entity="plan")`).
411
+
412
+ ### v1.9.0
413
+
414
+ - **Release hardening for npm publishing + agent-surface coherence** (pln#571).
415
+ A dedicated CI **Release Package Check** builds the CLI, builds the optional
416
+ VS Code extension, runs the extension tests, and verifies the published tarball
417
+ contents; `version --publish-local`/`prepublishOnly` now run `build:release` +
418
+ `pack:check` before `npm pack`. The `.vsix` ships as an *optional* IDE
419
+ companion (local CLI builds skip it; release builds stay strict). Generated
420
+ agent surfaces no longer pin the npm semver (stable `Managed by brainclaw`
421
+ banner), and `.brainclaw/project.md` is documented as a legacy derived view —
422
+ root `PROJECT.md` is the durable project vision; live claims/plans/handoffs
423
+ live in `agent-board` / MCP context.
424
+ - **Coordination & safety fixes** strict claim isolation (a duplicate active
425
+ claim on the same scope now fails inside the mutation lock instead of warning),
426
+ `JsonStore` entity-id validation to prevent path traversal (pln#571), and
427
+ `reflect --batch` no longer swallows identity/security errors so a strict
428
+ import can never silently skip sensitive content (pln#572).
429
+ - **Concurrency & CI robustness** — the journal append waits fairly under
430
+ contention so a multi-process kill-9 storm converges without seq reuse
431
+ (pln#573/#574), and `merge-risk` reconciles Windows 8.3 short-name worktree
432
+ paths so a claim matches its lane on Windows runners (pln#576).
433
+ - **Docs** — Roo, Continue, Windsurf, Copilot, OpenClaw, quickstart, and the
434
+ agent-integration docs now match the current export formats and setup behavior
435
+ (pln#571/#575).
436
+
437
+ ### v1.8.0
438
+
439
+ - **Multi-agent dispatch convergence — "worktree-as-contract"** (from a real
440
+ cross-project field session where a sandboxed worker could neither commit nor
441
+ reach MCP). The worker's contract shrinks to "edit files in this worktree +
442
+ drop `LANE-RESULT.json`": `brainclaw harvest --integrate` commits the worktree
443
+ diff on behalf of a worker that can't self-commit (hard-guarded to the linked
444
+ worktree, never the main repo), then completes the assignment and releases the
445
+ claim with plan cascade. A `LANE-RESULT.json` is now the #1 verdict signal in
446
+ `bclaw_dispatch_status` (worker FINISHED, even without self-update); the
447
+ dispatcher refuses to spawn without an isolated worktree; `open_loop` reviews
448
+ pre-flight each reviewer agent with a trivial validation spawn (clear
449
+ boot-failure reason instead of a generic loop timeout); and decisions/traps
450
+ gain `verified_at`/`verify_cmd` so perishable facts can be flagged stale.
451
+ Additive + opt-in throughout. (pln#530, pln#531, pln#532, pln#533, pln#534, trp#468)
452
+
453
+ ### v1.7.5
454
+
455
+ - **Security patch (recommended upgrade)** — fixes a git command-injection / RCE
456
+ vector flagged by Socket AI: several commands interpolated a git ref (notably
457
+ one derived from the persisted session `git_sha`) into `execSync` shell
458
+ strings. All git calls now use `execFileSync` (no shell) and `git_sha` is
459
+ validated as a hex SHA. No functional change. (session-end, release-claims,
460
+ release-notes, sync)
461
+
462
+ ### v1.7.4
463
+
464
+ - **Dispatch observability + worker DX hardening** (from a real cross-project
465
+ field session) — `bclaw_dispatch_status` and the reconciler now derive liveness
466
+ from filesystem activity (log + worktree mtime), so a worker actively editing
467
+ files is no longer falsely flagged `stalled`, and known codex boot-failure
468
+ stderr signatures get a targeted diagnosis; briefs are transport-aware (a
469
+ sandboxed agent without MCP/commit gets the file protocol, not instructions it
470
+ can't follow), backed by a derived capability matrix
471
+ (`dispatchHasMcp`/`dispatchCanCommit`); `bclaw_claim` gains an advisory
472
+ (no-worktree) mode; `bclaw_find` payloads are size-bounded with pagination
473
+ metadata; an opt-in per-worktree `tsc --noEmit` pre-commit gate; gated ready
474
+ lanes carry a code-propagation advisory; the reconciler auto-releases the claim
475
+ of a run it infers failed; and `plan.related_paths` is now updatable.
476
+ (pln#479, pln#491, pln#527, pln#528, pln#529, trp#291, trp#431, trp#433, trp#434)
477
+
478
+ ### v1.7.3
479
+
480
+ - **Multi-agent dispatch hardening for JS/TS monorepos** — dispatched worktrees
481
+ junction-link per-package `node_modules` (npm / yarn / pnpm workspaces), not
482
+ just the root, and surface failed links instead of swallowing them; `brainclaw worktree clean` now garbage-collects merged worktrees past birth-noise instead
483
+ of skipping them all; the agent inventory reports an agent `spawnable` when its
484
+ binary is on PATH even if `--version` is slow to start; dispatch-verification
485
+ guidance leads with `bclaw_dispatch_status` (not the untrustworthy Windows
486
+ wrapper pid); and a new `LANE-RESULT.json` convention + `brainclaw harvest <assignment_id>` give workers a standard, MCP-free result channel. The dispatch
487
+ dirty-guard also ignores `.claude/`, `.cursor/`, and `.codex/` agent-local
488
+ config. (pln#523, pln#524, pln#525, pln#526, trp#371, trp#427, trp#428)
489
+
490
+ ### v1.7.2
491
+
492
+ - **Sequence MCP tools are agent-first by default** — sequence creation,
493
+ listing, update, and deletion tools are now in the default MCP catalog, with
494
+ explicit lane item schemas (`planId`, optional `stepId`, `rank`,
495
+ dependencies, lane metadata) and matching canonical CRUD validation for
496
+ `entity="sequence"`.
497
+
498
+ ### v1.7.1
499
+
500
+ - **MCP project context isolation fix** — `bclaw_switch` now keeps MCP switches
501
+ session-scoped even when the agent session has to be resolved or created on
502
+ the fly. Session lookup honors explicit session IDs, avoids adopting another
503
+ live process's session, detects Codex via native `CODEX_*` runtime variables,
504
+ and `bclaw_switch(list=true)` reports the session active project with
505
+ `active_source`.
506
+
507
+ ### v1.7.0
508
+
509
+ - **Dispatch reliability + scope-aware dirty guard** — evidence-first
510
+ `agent_run` reconciliation avoids false terminal states, `bclaw_coordinate`
511
+ accepts pinned refs and a scope-aware `allow_dirty` guard, and the Hermes
512
+ agent integration joins the supported surfaces.
513
+
514
+ ### v1.6.0
515
+
516
+ - **Bootstrap loop + cross-project agent workflow** — the bootstrap ideation
517
+ preset can materialize `PROJECT.md`, `bclaw_init_project` initializes and links
518
+ arbitrary project paths, and `project=` routing reaches `bclaw_work` /
519
+ `bclaw_loop` for linked-project operations.
520
+
521
+ ### v1.5.3
522
+
523
+ - **Cross-project canonical grammar + CLI parity** (pln#359, all phases) — the canonical grammar (`bclaw_find / get / create / update / remove / transition`), `bclaw_context`, and `bclaw_coordinate` now accept an optional `project: <name>` argument that routes the operation to a linked project. Two link kinds are recognised: `cross_project_links` (sibling/peer projects in `config.yaml`, `brainclaw link list`) and workspace store-chain children. Arbitrary directory paths are rejected — adoption requires an explicit link, which gives the user a single point of control over what an agent can reach. Identity is sourced from the caller's home registry; entity writes + audit log entries land in the target. Unknown project names throw `validation_error` with a hint listing the configured links — no silent fallback. Cross-project `bclaw_coordinate` is **inbox-only**: claim/assignment/message all land in the target, the target agent picks the brief up async via its own `bclaw_work`, and auto-spawn from the source process is force-disabled because the spawn cwd / worktree are tied to the target's git repo (a warning surfaces in `FacadeResponse.warnings`). The CLI exposes the same as a global `--project <name>` flag, mutually exclusive with `--cwd`. Refs: helper `resolveProjectCwd` in `src/core/cross-project.ts`, MCP write/read handler dispatch in `src/commands/mcp.ts` and `src/commands/mcp-read-handlers.ts`, `--project` plumbing in `src/cli.ts` preAction, surface advertisement in `src/core/instruction-templates.ts`, plus tests in `tests/unit/cross-project.test.ts` (10 unit cases on the helper), `tests/unit/bclaw-coordinate.test.ts` (4 cross-project routing cases), and `tests/cli-cross-project.test.ts` (5 e2e cases). Closes the `--cwd` workaround pattern that had been the day-to-day shape of multi-project sessions.
524
+ - **Site facts contract** (umbrella `pln_7fdfd70d` sprint 0) — new `scripts/emit-site-facts.mjs` emits `dist/facts.{js,json}` from `MCP_TOOL_NAMES` + `ENTITY_NAMES` so the brainclaw-site (and any consumer) can pull live tool/entity counts at build time without forking the values into a hand-maintained config. The package `files` list ships `dist/facts.json`; build:cli runs the emitter as part of the chain.
525
+
526
+ ### v1.5.2
527
+
528
+ - **Grammar fix: `bclaw_update` no longer silently drops patches** (trp#187, pln#500) — the canonical CRUD surface promised that `EntityRegistry.updatable` listed every patchable field, but the legacy impls behind the dispatch (`updatePlan`, `updateMemoryItem`) only handled a typed subset. A `as UpdatePlanInput` cast in `entity-operations.ts` masked the gap from TypeScript: callers passed `{text, tags, severity, …}`, validation accepted them, and the function bodies never read them. Empirically reproduced this session on `pln#359` (text+tags drop) and `trp#187` itself (severity drop). Fix adds a generic-patch escape-hatch (`patch?: Partial<…>`) on `UpdatePlanInput` and `UpdateMemoryInput`, applied via `Object.assign` after the typed fields so legacy CLI callers keep their behaviour. The dispatch in `entity-operations.ts` now passes the full patch through that escape-hatch for plan/decision/constraint/trap. `runtime_note`, `candidate`, and `cross_project_link` were already correct. New `tests/unit/entity-update-coverage.test.ts` is parametric: for every `(entity, field)` pair in `EntityRegistry.updatable`, create + patch + get + assert the field actually persisted (29 cases). Adding a new updatable field will require adding a coverage row, so the contract stays honest.
529
+
530
+ ### v1.5.1
531
+
532
+ - **Cross-project link CLI + grammar parity** (pln#454 step 2) — new `brainclaw link add/list/remove` subcommands and a stateless `cross_project_link` entity wired into the canonical CRUD verbs (`bclaw_create / find / get / update / remove`). The pain point was small (config.yaml is hand-editable) but the asymmetry — runtime cross-project signaling shipped, management UX did not — meant federation peers had no first-class affordance. Storage stays in `config.cross_project_links`; the entity is intentionally stateless (no transitions). Refs: `src/commands/link.ts`, `src/core/cross-project.ts` (new `addCrossProjectLink` / `removeCrossProjectLink`), `src/core/entity-registry.ts` (new `xpl` prefix), `src/core/entity-operations.ts` dispatch cases, `tests/unit/link.test.ts` + `tests/unit/cross-project-link-grammar.test.ts` (26 new cases).
533
+ - **Agent registry pruned** (pln#454 step 1) — 8 synthetic profiles (antigravity, copilot-vscode, claude-opus, copilot-identity, copilot, claude-sonnet, visionnaire, copilot-codev) and 11 abandoned sessions archived under `.brainclaw/archive/agents/2026-05-07/`. The whitelist that survives matches `feedback_allowed_dispatch_agents.md`: `claude-code`, `codex`, `github-copilot`, plus `jberdah` (curator). Auto-re-registration in `detectAiAgent` is intentionally preserved — if a real surface starts a session, the registry auto-rebuilds for it. Pure store cleanup, no code change.
534
+ - **Inbox + assignment lifecycle reconciliation** (housekeeping) — 89 stale inbox messages and 7 orphan offered-assignments closed with retroactive lifecycle updates. The plans they backed (pln#478 mcp self-heal, pln#480 multi-stack worktree, pln#483 bclaw_work compact, pln#471 tier-B live companions) had all merged weeks earlier without the dispatch path calling `bclaw_assignment_update`. Captured as `feedback_dispatch_test_inbox_debris` so future drift is mass-acked instead of triaged per-message.
535
+
536
+ ### v1.5.0
537
+
538
+ - **Ideation loop MVP** (pln#492) — new `bclaw_coordinate(intent='ideate')` opens a memory-confrontation loop: critic reads only adversarial categories (traps + feedback + runtime_notes + critique_history) and gets a BM25-ranked, context-filtered, 12k-token-capped brief assembled from project memory. Single-agent (champion drives manually) or multi-agent (auto-dispatch a turn per critic). Iteration block (cycle, max_iterations, exit_when), phase-advance gate (≥3 critique artifacts before leaving critique), system events (`phase_advance_blocked`, `max_iterations_reached`). Full design: [docs/concepts/ideation-loop.md](docs/concepts/ideation-loop.md).
539
+ - **Reliable dispatch + autonomy contract** (pln#496) — codex / sandboxed task-based agents now emit the full lifecycle (accepted → started → progress → completed). `briefMode` resolution corrected: `task-based && hasMcp → 'full'` (not 'compact', which silently dropped the protocol section). Lazy reconciliation pattern: `agentrun-reconciler` runs at every read path (`bclaw_assignment_events`, `bclaw_loop intent='get'`, `doctor --dispatch`) instead of a daemon; first run auto-recovered 9 historical orphan agent_runs in <1s. New autonomy contract section in instruction surfaces — agents execute protocol-defined transitions instead of pausing to ask. New `buildClaimEnvPrefix` consolidates cross-shell env injection (Windows defaults to cmd, POSIX uses unquoted bytes per PATH conventions). New `brainclaw doctor --dispatch` for operator-facing dispatch health.
540
+ - **Worktree junction wipe fix** (pln#498) — `detachWorktreeJunctions` runs before `git worktree remove` on Windows so git's recursive rm cannot follow the `node_modules` junction back into the main repo. Closes the recurring post-merge wipe trap; validated empirically on multiple back-to-back merges in the v1.5.0 session.
541
+ - **Methodological lessons** captured as user auto-memory feedback memos: bisect historical state before bisecting code (regression vs. always-broken-but-hidden), lazy reconcile at read paths beats daemon polling, codex briefs MUST include the Protocol section (implicit instructions don't propagate to sandboxed CLIs).
542
+
543
+ ### v1.2.0
544
+
545
+ - **zod 3 → 4 migration** (pln#486) — schemas are semantically equivalent but the JSON Schema emitted by `tools/list` shifted shape; downstream MCP clients that snapshot schemas should re-pin. See `docs/mcp-schema-changelog.md` for the public surface fingerprint.
546
+
547
+ ### v1.1.0
548
+
549
+ - **Node 20+ baseline** (pln#485) — `engines.node` is now `>=20.0.0` (Node 18 reached EOL in April 2025). CI matrix runs Node 22 and 24 on Linux; Windows on Node 24. Node 20 remains the minimum installable runtime but is no longer CI-verified.
550
+ - **commander 13 → 14** (requires Node 20+).
551
+ - **@types/node 22 → 24** (LTS-aligned).
552
+
553
+ ### v1.0.15
554
+
555
+ - **TypeScript 5.8 → 6.0** (pln#484) — migration to `module: "nodenext"` (`Node16` is deprecated in TS 6, scheduled for removal in TS 7); explicit `types: ["node"]` since TS 6 changed the default to `[]`.
556
+
557
+ ### v1.0.14
558
+
559
+ - **`bclaw_work` compact payload by default** (pln#483) — avoids exceeding the ~25k MCP token cap on projects with substantial memory. Pass `compact: false` for the full payload, or call `bclaw_context(kind="memory")` after.
560
+ - **MCP runtime self-heal + `doctor --repair`** (pln#478) — when `dist/mcp-worker.js` is missing, the server logs an actionable repair pointer and read-only handlers keep serving in-process. `brainclaw doctor --repair` rebuilds dist in one step.
561
+ - **Tier B/C native live companions** (pln#471) — `.cursor/live.md`, `.clinerules/live.md`, `.windsurf/rules/live.md`, `.github/copilot-instructions.live.md`, `.continue/live.md`, `GEMINI.live.md` regenerated on session-end and handoff. Opt-in via `brainclaw export --include-live --write`.
562
+
563
+ ### v1.0.13
564
+
565
+ - **Worktree GC scope hardening** (pln#477) — `safeRemoveWorktreeDir` no longer follows symlinks/junctions during cleanup. Closes a class of post-merge wipes that previously destroyed `node_modules` and other neighboring directories on Windows.
566
+
567
+ ### v1.0.10–v1.0.12
568
+
569
+ - **GitHub Copilot CLI is spawnable** (pln#440) — Copilot CLI 1.0.35+ supports `-p "<prompt>" --allow-all --no-ask-user`; tier promoted to A.
570
+ - **Codex spawn on Windows: stdin pipe + 30s handshake TTL** (pln#475) — fixes embedded backticks/`#`/multi-line content getting mis-parsed by `cmd.exe` when a prompt is passed as an inline argument.
571
+ - **Brief-ack file handshake** (pln#476) — `.brainclaw/coordination/runtime/ack/<assignmentId>.ack` proves a spawned worker started, decoupling the handshake from MCP availability inside the worker (important for Codex in `--sandbox workspace-write`).
572
+ - **`bclaw_loop(intent="open")` orphan-gate** (pln#461) — refuses to open a loop without dispatch unless `allow_orphan: true` is explicit. Use `bclaw_coordinate(intent="review", open_loop: true)` instead.
573
+ - **Kilocode** — Tier B integration with native MCP config and live companion (pln#464).
574
+
575
+ ### v1.0.0
576
+
577
+ - **Canonical grammar promoted to standard tier** — `bclaw_find` / `bclaw_get` / `bclaw_create` / `bclaw_update` / `bclaw_remove` / `bclaw_transition`, plus the entry facades `bclaw_work` and `bclaw_context`, the multi-agent facades `bclaw_coordinate` and `bclaw_dispatch`, and the loop facade `bclaw_loop`. Legacy per-entity tools removed from the discoverable surface (still callable as a migration escape hatch). See `docs/concepts/mcp-governance.md` for tier rules and the deprecation policy.
578
+
579
+ ---
580
+
581
+ ## License
582
+
583
+ brainclaw core is published under the [MIT License](LICENSE) — (c) 2024-2026 Juan Berdah.
584
+
585
+ The licensing split is simple:
586
+
587
+ - the local-first brainclaw core is MIT
588
+ - cloud shared-memory, remote collaboration services, advanced dashboards, and related hosted add-ons will live in separate commercial products
589
+
590
+ The MIT core covers what makes brainclaw useful inside a repo today: local project memory, local MCP and CLI coordination, onboarding and bootstrap, plans, claims, handoffs, runtime notes, and local agent integrations.
591
+
592
+ The goal is not to close brainclaw down. The goal is to keep the local-first core open and genuinely useful on its own, while keeping hosted collaboration features separate.