brainclaw 1.7.5 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -11
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli.js +139 -13
- package/dist/commands/add-step.js +1 -1
- package/dist/commands/bootstrap.js +2 -26
- package/dist/commands/check-security-mcp.js +50 -33
- package/dist/commands/check-security.js +86 -43
- package/dist/commands/claim.js +22 -21
- package/dist/commands/confirm.js +26 -0
- package/dist/commands/context-diff.js +1 -1
- package/dist/commands/dispatch-watch.js +142 -0
- package/dist/commands/doctor.js +113 -2
- package/dist/commands/estimation-report.js +115 -16
- package/dist/commands/harvest.js +502 -16
- package/dist/commands/init.js +123 -21
- package/dist/commands/loops-handlers.js +4 -0
- package/dist/commands/mcp-read-handlers.js +198 -29
- package/dist/commands/mcp.js +615 -92
- package/dist/commands/memory.js +21 -17
- package/dist/commands/migrate.js +81 -17
- package/dist/commands/prune.js +78 -4
- package/dist/commands/reflect.js +26 -20
- package/dist/commands/register-agent.js +57 -1
- package/dist/commands/repair.js +20 -0
- package/dist/commands/session-end.js +15 -6
- package/dist/commands/session-start.js +18 -1
- package/dist/commands/setup-security.js +39 -18
- package/dist/commands/setup.js +26 -27
- package/dist/commands/stale.js +16 -2
- package/dist/commands/uninstall.js +126 -34
- package/dist/commands/update-step.js +6 -0
- package/dist/commands/worktree.js +60 -0
- package/dist/core/actions.js +12 -3
- package/dist/core/agent-capability.js +11 -13
- package/dist/core/agent-files.js +844 -547
- package/dist/core/agent-integrations.js +0 -3
- package/dist/core/agent-inventory.js +67 -0
- package/dist/core/agent-registry.js +163 -29
- package/dist/core/agentrun-reconciler.js +33 -2
- package/dist/core/agentruns.js +7 -1
- package/dist/core/ai-agent-detection.js +31 -44
- package/dist/core/archival.js +15 -9
- package/dist/core/assignment-reconciler.js +56 -0
- package/dist/core/assignment-sweeper.js +127 -4
- package/dist/core/assignments.js +69 -11
- package/dist/core/bootstrap.js +233 -67
- package/dist/core/brainclaw-version.js +22 -0
- package/dist/core/candidates.js +21 -1
- package/dist/core/claims.js +313 -150
- package/dist/core/config.js +6 -1
- package/dist/core/context-diff.js +148 -20
- package/dist/core/context.js +129 -8
- package/dist/core/coordination.js +22 -3
- package/dist/core/dispatch-status.js +109 -5
- package/dist/core/dispatcher.js +65 -11
- package/dist/core/entity-operations.js +45 -24
- package/dist/core/entity-registry.js +31 -5
- package/dist/core/event-log.js +138 -21
- package/dist/core/events/checkpoint.js +258 -0
- package/dist/core/events/genesis.js +220 -0
- package/dist/core/events/journal.js +507 -0
- package/dist/core/events/materialize.js +126 -0
- package/dist/core/events/registry-post-image.js +110 -0
- package/dist/core/events/verify.js +109 -0
- package/dist/core/execution-adapters.js +23 -0
- package/dist/core/execution.js +25 -0
- package/dist/core/facade-schema.js +48 -0
- package/dist/core/gc-semantic.js +130 -5
- package/dist/core/handoff-snapshot.js +68 -0
- package/dist/core/ids.js +19 -8
- package/dist/core/instruction-templates.js +34 -115
- package/dist/core/io.js +39 -3
- package/dist/core/json-store.js +10 -1
- package/dist/core/lock.js +153 -28
- package/dist/core/loops/bootstrap-acquire.js +25 -1
- package/dist/core/loops/facade-schema.js +2 -0
- package/dist/core/loops/hooks/survey-signals-baseline.js +36 -0
- package/dist/core/loops/index.js +1 -0
- package/dist/core/loops/presets/bootstrap.js +7 -0
- package/dist/core/loops/store.js +17 -0
- package/dist/core/loops/verbs.js +24 -1
- package/dist/core/markdown.js +8 -76
- package/dist/core/mcp-command-resolution.js +245 -0
- package/dist/core/memory-compactor.js +5 -3
- package/dist/core/memory-lifecycle.js +282 -0
- package/dist/core/merge-risk.js +150 -0
- package/dist/core/messaging.js +8 -1
- package/dist/core/migration.js +11 -1
- package/dist/core/observer-mode.js +26 -0
- package/dist/core/operations/memory-mutation.js +90 -65
- package/dist/core/operations/plan.js +27 -1
- package/dist/core/protocol-skills.js +210 -0
- package/dist/core/reflection-safety.js +6 -7
- package/dist/core/reputation.js +84 -2
- package/dist/core/runtime-signals.js +71 -9
- package/dist/core/runtime.js +84 -1
- package/dist/core/schema.js +125 -0
- package/dist/core/security-detectors.js +125 -0
- package/dist/core/security-extract.js +189 -0
- package/dist/core/security-guard.js +107 -29
- package/dist/core/security-packages.js +121 -0
- package/dist/core/security-scoring.js +76 -9
- package/dist/core/security.js +34 -2
- package/dist/core/sequence.js +11 -2
- package/dist/core/setup-flow.js +141 -13
- package/dist/core/spawn-check.js +110 -4
- package/dist/core/staleness.js +109 -1
- package/dist/core/state.js +250 -54
- package/dist/core/store-resolution.js +19 -5
- package/dist/core/worktree.js +169 -7
- package/dist/facts.js +8 -8
- package/dist/facts.json +7 -7
- package/docs/PROTOCOL.md +223 -0
- package/docs/cli.md +11 -10
- package/docs/concepts/coordinator-runbook.md +129 -0
- package/docs/concepts/dispatch-lifecycle.md +17 -0
- package/docs/concepts/event-log-store-critique-A.md +333 -0
- package/docs/concepts/event-log-store-critique-B.md +353 -0
- package/docs/concepts/event-log-store-phase0-measurements.md +58 -0
- package/docs/concepts/event-log-store-proposal-A.md +365 -0
- package/docs/concepts/event-log-store-proposal-B.md +404 -0
- package/docs/concepts/event-log-store.md +928 -0
- package/docs/concepts/identity-model-proposal.md +371 -0
- package/docs/concepts/memory.md +5 -4
- package/docs/concepts/observer-protocol.md +361 -0
- package/docs/concepts/parallel-merge-protocol.md +71 -0
- package/docs/concepts/plans-and-claims.md +43 -0
- package/docs/concepts/skills.md +78 -0
- package/docs/concepts/workspace-bootstrapping.md +61 -0
- package/docs/integrations/agents.md +4 -4
- package/docs/integrations/cline.md +10 -11
- package/docs/integrations/codex.md +2 -2
- package/docs/integrations/continue.md +5 -5
- package/docs/integrations/copilot.md +14 -12
- package/docs/integrations/openclaw.md +7 -6
- package/docs/integrations/overview.md +7 -7
- package/docs/integrations/roo.md +3 -3
- package/docs/integrations/windsurf.md +6 -6
- package/docs/mcp-schema-changelog.md +51 -20
- package/docs/quickstart.md +48 -47
- package/docs/security.md +174 -15
- package/docs/storage.md +4 -2
- package/package.json +8 -6
package/dist/facts.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by scripts/emit-site-facts.mjs at build time. Do not edit manually.
|
|
2
|
-
// Source: brainclaw v1.
|
|
2
|
+
// Source: brainclaw v1.9.0 on 2026-06-15T14:49:43.510Z
|
|
3
3
|
export const FACTS = {
|
|
4
|
-
"version": "1.
|
|
5
|
-
"generated_at": "2026-06-
|
|
4
|
+
"version": "1.9.0",
|
|
5
|
+
"generated_at": "2026-06-15T14:49:43.510Z",
|
|
6
6
|
"tools": {
|
|
7
7
|
"count": 62,
|
|
8
8
|
"published_count": 61,
|
|
@@ -197,8 +197,8 @@ export const FACTS = {
|
|
|
197
197
|
"workflow_model": "interactive",
|
|
198
198
|
"tier": "A",
|
|
199
199
|
"has_mcp": true,
|
|
200
|
-
"has_hooks":
|
|
201
|
-
"has_skills":
|
|
200
|
+
"has_hooks": false,
|
|
201
|
+
"has_skills": false,
|
|
202
202
|
"has_rules": true,
|
|
203
203
|
"instruction_file": ".clinerules/brainclaw.md",
|
|
204
204
|
"mcp_config_scope": "project",
|
|
@@ -214,7 +214,7 @@ export const FACTS = {
|
|
|
214
214
|
"workflow_model": "task-based",
|
|
215
215
|
"tier": "A",
|
|
216
216
|
"has_mcp": true,
|
|
217
|
-
"has_hooks":
|
|
217
|
+
"has_hooks": false,
|
|
218
218
|
"has_skills": true,
|
|
219
219
|
"has_rules": true,
|
|
220
220
|
"instruction_file": "AGENTS.md",
|
|
@@ -436,8 +436,8 @@ export const FACTS = {
|
|
|
436
436
|
"workflow_model": "interactive",
|
|
437
437
|
"tier": "A",
|
|
438
438
|
"has_mcp": true,
|
|
439
|
-
"has_hooks":
|
|
440
|
-
"has_skills":
|
|
439
|
+
"has_hooks": false,
|
|
440
|
+
"has_skills": false,
|
|
441
441
|
"has_rules": true,
|
|
442
442
|
"instruction_file": ".windsurfrules",
|
|
443
443
|
"mcp_config_scope": "machine",
|
package/dist/facts.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
3
|
-
"generated_at": "2026-06-
|
|
2
|
+
"version": "1.9.0",
|
|
3
|
+
"generated_at": "2026-06-15T14:49:43.510Z",
|
|
4
4
|
"tools": {
|
|
5
5
|
"count": 62,
|
|
6
6
|
"published_count": 61,
|
|
@@ -195,8 +195,8 @@
|
|
|
195
195
|
"workflow_model": "interactive",
|
|
196
196
|
"tier": "A",
|
|
197
197
|
"has_mcp": true,
|
|
198
|
-
"has_hooks":
|
|
199
|
-
"has_skills":
|
|
198
|
+
"has_hooks": false,
|
|
199
|
+
"has_skills": false,
|
|
200
200
|
"has_rules": true,
|
|
201
201
|
"instruction_file": ".clinerules/brainclaw.md",
|
|
202
202
|
"mcp_config_scope": "project",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"workflow_model": "task-based",
|
|
213
213
|
"tier": "A",
|
|
214
214
|
"has_mcp": true,
|
|
215
|
-
"has_hooks":
|
|
215
|
+
"has_hooks": false,
|
|
216
216
|
"has_skills": true,
|
|
217
217
|
"has_rules": true,
|
|
218
218
|
"instruction_file": "AGENTS.md",
|
|
@@ -434,8 +434,8 @@
|
|
|
434
434
|
"workflow_model": "interactive",
|
|
435
435
|
"tier": "A",
|
|
436
436
|
"has_mcp": true,
|
|
437
|
-
"has_hooks":
|
|
438
|
-
"has_skills":
|
|
437
|
+
"has_hooks": false,
|
|
438
|
+
"has_skills": false,
|
|
439
439
|
"has_rules": true,
|
|
440
440
|
"instruction_file": ".windsurfrules",
|
|
441
441
|
"mcp_config_scope": "machine",
|
package/docs/PROTOCOL.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Brainclaw Protocol — v0.1 (draft)
|
|
2
|
+
|
|
3
|
+
> Status: **draft** — pre-public RFC. Versioned in [docs/PROTOCOL.md](./PROTOCOL.md);
|
|
4
|
+
> brainclaw is the reference implementation.
|
|
5
|
+
>
|
|
6
|
+
> Feedback target: external OSS agent integrators (Cline, OpenCode, Hermes,
|
|
7
|
+
> Mistral Vibe, Continue) — see "Feedback wanted" at the bottom.
|
|
8
|
+
|
|
9
|
+
## 1. What this spec is
|
|
10
|
+
|
|
11
|
+
Brainclaw runs a multi-agent coordination loop on top of a shared project
|
|
12
|
+
memory. The implementation has converged on a small grammar — entities, verbs,
|
|
13
|
+
lifecycle sentinels — that the rest of the system (CLI, MCP server, writers,
|
|
14
|
+
hooks) is just a delivery channel for.
|
|
15
|
+
|
|
16
|
+
This document carves out that grammar as a **transport-agnostic protocol** so
|
|
17
|
+
other agents and agent platforms can either:
|
|
18
|
+
|
|
19
|
+
- speak it natively (via brainclaw's MCP server, the reference transport), or
|
|
20
|
+
- implement it themselves and interoperate with brainclaw-managed projects.
|
|
21
|
+
|
|
22
|
+
The protocol does **not** standardize storage, file layouts, or the internal
|
|
23
|
+
state machine. Those are implementation details; brainclaw's are documented
|
|
24
|
+
under [`docs/concepts/`](./concepts/).
|
|
25
|
+
|
|
26
|
+
## 2. Versioning
|
|
27
|
+
|
|
28
|
+
| Field | Rule |
|
|
29
|
+
|-------------------|-------------------------------------------------------------------------|
|
|
30
|
+
| `protocol.major` | Bumped only for breaking entity / verb / sentinel changes. |
|
|
31
|
+
| `protocol.minor` | Bumped for additive entities, verbs, sentinels, or new optional fields. |
|
|
32
|
+
| `protocol.patch` | Editorial / clarifying changes; no behavioral impact. |
|
|
33
|
+
|
|
34
|
+
Current draft: **0.1** — entity surface stable; verb surface stable on the
|
|
35
|
+
"canonical grammar" (see §4); lifecycle sentinels stable for sessions, claims,
|
|
36
|
+
plans, assignments. Coordination / loop verbs are explicitly experimental.
|
|
37
|
+
|
|
38
|
+
Implementers SHOULD advertise the maximum supported version via an
|
|
39
|
+
`X-Brainclaw-Protocol` header (HTTP transports) or a server-info field
|
|
40
|
+
(MCP transports). Brainclaw's MCP server returns `0.1` in `serverInfo.version`.
|
|
41
|
+
|
|
42
|
+
## 3. Entities
|
|
43
|
+
|
|
44
|
+
The protocol recognises eight kinds of memory objects. Each has a unique `id`,
|
|
45
|
+
a canonical `kind`, and a small set of mutable fields. Storage of additional
|
|
46
|
+
fields is implementation-defined.
|
|
47
|
+
|
|
48
|
+
| Kind | Purpose | Lifecycle states |
|
|
49
|
+
|--------------|----------------------------------------------------------------------|---------------------------------------------------------|
|
|
50
|
+
| `constraint` | Active rule the project must respect. | `active` → `resolved` / `expired` |
|
|
51
|
+
| `decision` | Recorded architectural / process decision. | `pending` → `approved` / `rejected` / `deferred` |
|
|
52
|
+
| `trap` | Known failure mode; reminder for future work. | `active` → `resolved` / `expired` |
|
|
53
|
+
| `plan` | Unit of work tracked across agents. | `open` → `in_progress` → `done` / `cancelled` |
|
|
54
|
+
| `claim` | Mutex over a file scope. | `open` → `released` (or `expired` via TTL) |
|
|
55
|
+
| `handoff` | Asynchronous instruction from one agent to another. | `open` → `accepted` → `closed` |
|
|
56
|
+
| `candidate` | Proposed memory item awaiting review. | `proposed` → `accepted` / `rejected` / `merged` |
|
|
57
|
+
| `assignment` | Dispatched work item routed to a specific agent. | `offered` → `accepted` → `started` → `completed` / `failed` / `blocked` / `cancelled` |
|
|
58
|
+
|
|
59
|
+
Entities have these well-known fields (implementations MAY add more):
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
id string // implementation-assigned, opaque, stable
|
|
63
|
+
kind string // one of the kinds above
|
|
64
|
+
status string // one of the lifecycle states above
|
|
65
|
+
text string? // human-readable summary
|
|
66
|
+
tags string[]?
|
|
67
|
+
created_at string // ISO-8601 UTC
|
|
68
|
+
updated_at string // ISO-8601 UTC
|
|
69
|
+
provenance object? // {kind: 'agent'|'human'|'auto'|'legacy', author, source}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Brainclaw's full field set lives in [`src/core/schema.ts`](../src/core/schema.ts).
|
|
73
|
+
Future protocol minors will promote additional fields to "well-known" as they
|
|
74
|
+
prove portable across implementations.
|
|
75
|
+
|
|
76
|
+
## 4. The canonical grammar (verbs)
|
|
77
|
+
|
|
78
|
+
The protocol exposes seven canonical verbs. Implementations MUST support these
|
|
79
|
+
in order to claim protocol compliance. They are deliberately narrow so the
|
|
80
|
+
surface stays small; richer ergonomic helpers are facades on top.
|
|
81
|
+
|
|
82
|
+
| Verb | Shape | Effect |
|
|
83
|
+
|-------------------|-----------------------------------------------------------------|---------------------------------------------------------|
|
|
84
|
+
| `work(intent)` | `intent: consult \| execute \| resume \| review` | Open a session; optionally claim a scope. |
|
|
85
|
+
| `context(kind)` | `kind: memory \| execution \| board \| delta` | Read shared state. |
|
|
86
|
+
| `find(entity, …)` | `entity, filter, limit` | Query entities. |
|
|
87
|
+
| `get(entity, id)` | `entity, id` (or `short_label`) | Fetch one entity by identifier. |
|
|
88
|
+
| `create(entity)` | `entity, data` | Insert a new entity (validated against schema). |
|
|
89
|
+
| `update(entity)` | `entity, id, patch` | Patch mutable fields. Status changes go via `transition`. |
|
|
90
|
+
| `transition(…)` | `entity, id, status` | Move an entity along its lifecycle. Triggers side-effects. |
|
|
91
|
+
|
|
92
|
+
The reference implementation surfaces these as MCP tools named
|
|
93
|
+
`bclaw_work`, `bclaw_context`, `bclaw_find`, `bclaw_get`, `bclaw_create`,
|
|
94
|
+
`bclaw_update`, `bclaw_transition`. The same names appear in
|
|
95
|
+
`src/commands/mcp.ts:MCP_CANONICAL_GRAMMAR_TOOL_NAMES` and are derived from
|
|
96
|
+
the tool catalog, not hand-curated. Hermes and other narrow-surface agents
|
|
97
|
+
include exactly this set in their MCP `tools.include`.
|
|
98
|
+
|
|
99
|
+
### 4.1 Coordination verbs (experimental — protocol v0.2 candidates)
|
|
100
|
+
|
|
101
|
+
These are present in the reference implementation but **not yet stable**.
|
|
102
|
+
Implementations MAY support them but should expect breaking changes:
|
|
103
|
+
|
|
104
|
+
- `coordinate(intent: assign|consult|review|reroute)` — multi-agent routing.
|
|
105
|
+
- `dispatch(plan, agents)` — concrete spawn / claim ledger.
|
|
106
|
+
- `loop(kind: ideation|implementation|review)` — multi-round loops.
|
|
107
|
+
|
|
108
|
+
## 5. Lifecycle sentinels
|
|
109
|
+
|
|
110
|
+
The protocol defines **named state transitions** so any compliant agent can
|
|
111
|
+
reason about another's progress without parsing free-form text. These are the
|
|
112
|
+
strings agents are expected to emit at protocol-defined moments.
|
|
113
|
+
|
|
114
|
+
### 5.1 Session sentinels
|
|
115
|
+
|
|
116
|
+
| Moment | Sentinel |
|
|
117
|
+
|-----------------------|-----------------------------------------------------------------------|
|
|
118
|
+
| Agent reaches its loop | Filesystem heartbeat: `.brainclaw-heartbeat-<assignment_id>` |
|
|
119
|
+
| Session opens | `work(intent)` response carries the `session_id` and seed context. |
|
|
120
|
+
| Session ends | `work(intent: …)` is terminal; or implementation-specific close call. |
|
|
121
|
+
|
|
122
|
+
### 5.2 Assignment sentinels
|
|
123
|
+
|
|
124
|
+
The lifecycle a coordinator can observe on a dispatched assignment:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
offered → accepted → started → (progress)* → completed
|
|
128
|
+
| failed
|
|
129
|
+
| blocked
|
|
130
|
+
| cancelled
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Each transition is emitted via `transition('assignment', id, <status>)`.
|
|
134
|
+
A worker that cannot reach the protocol transport (sandboxed) MAY drop a
|
|
135
|
+
`LANE-RESULT.json` file at the worktree root as the fallback signal — the
|
|
136
|
+
coordinator harvests it.
|
|
137
|
+
|
|
138
|
+
### 5.3 Claim sentinels
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
open → released (worker calls transition('claim', id, 'released'))
|
|
142
|
+
open → expired (TTL-driven; reaper marks expired)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
A claim that converged on `done` MAY carry a `planStatus` hint so the
|
|
146
|
+
coordinator updates the linked plan atomically with the release.
|
|
147
|
+
|
|
148
|
+
### 5.4 Plan-step sentinels
|
|
149
|
+
|
|
150
|
+
Plans contain ordered steps with their own status. The grammar verbs
|
|
151
|
+
`update('plan', id, {steps:[…]})` and `transition('plan', id, 'done')`
|
|
152
|
+
operate over the whole plan; the canonical step sentinel is a step-level
|
|
153
|
+
`status: done`. Implementations MAY surface `bclaw_complete_step` as a
|
|
154
|
+
sugar on top.
|
|
155
|
+
|
|
156
|
+
## 6. Conformance levels
|
|
157
|
+
|
|
158
|
+
| Level | What conformance means |
|
|
159
|
+
|-------|----------------------------------------------------------------------------------------|
|
|
160
|
+
| **L1 — Read** | Implementation can issue `work(intent: consult)` + `context` + `find` + `get` and respect active claims. Minimum bar for "I can run inside a brainclaw-managed project without breaking it." |
|
|
161
|
+
| **L2 — Write** | All of L1 plus `create` / `update` / `transition` on the entities above with valid lifecycle transitions. |
|
|
162
|
+
| **L3 — Coordinate** | All of L2 plus the experimental coordination verbs (§4.1) and assignment sentinels. Required for spawning / accepting dispatched work. |
|
|
163
|
+
|
|
164
|
+
Hermes and Mistral Vibe ship at L1 (narrow surface). Claude Code, Codex,
|
|
165
|
+
Copilot, and Cline are L3. The reference implementation enforces the
|
|
166
|
+
L3 contract via assignment-convergence tests (see
|
|
167
|
+
[`tests/unit/assignment-convergence.test.ts`](../tests/unit/assignment-convergence.test.ts)).
|
|
168
|
+
|
|
169
|
+
## 7. Transport bindings
|
|
170
|
+
|
|
171
|
+
The protocol is transport-agnostic. The reference implementation ships an
|
|
172
|
+
MCP server (`brainclaw mcp`); other implementations MAY add JSON-RPC over
|
|
173
|
+
stdio, HTTP, or a local IPC socket without changing the entity / verb /
|
|
174
|
+
sentinel surface.
|
|
175
|
+
|
|
176
|
+
A transport binding MUST specify:
|
|
177
|
+
|
|
178
|
+
- how the seven canonical verbs are named (mapping to the binding's call shape),
|
|
179
|
+
- how entity identifiers are serialised (recommend opaque strings),
|
|
180
|
+
- how lifecycle sentinels are encoded (recommend `transition` calls,
|
|
181
|
+
not free-form status strings).
|
|
182
|
+
|
|
183
|
+
## 8. Storage and federation
|
|
184
|
+
|
|
185
|
+
Out of scope for v0.1. The reference implementation uses git-backed
|
|
186
|
+
JSON/YAML in `.brainclaw/`. Multi-project federation is a planned
|
|
187
|
+
extension — see [docs/concepts/](./concepts/) and the brainclaw memory
|
|
188
|
+
files for the current direction. A future protocol version will define
|
|
189
|
+
the wire format for cross-project signaling.
|
|
190
|
+
|
|
191
|
+
## 9. Reference implementation map
|
|
192
|
+
|
|
193
|
+
| Protocol concept | Reference implementation in brainclaw |
|
|
194
|
+
|-------------------------------|-----------------------------------------------------------------------|
|
|
195
|
+
| Entity schemas | [`src/core/schema.ts`](../src/core/schema.ts) |
|
|
196
|
+
| Canonical grammar tool set | [`src/commands/mcp.ts`](../src/commands/mcp.ts) — `MCP_CANONICAL_GRAMMAR_TOOL_NAMES` |
|
|
197
|
+
| MCP tool catalog | [`src/commands/mcp.ts`](../src/commands/mcp.ts) — `ALL_TOOLS` |
|
|
198
|
+
| Per-agent writer wiring | [`src/core/agent-files.ts`](../src/core/agent-files.ts) — `AGENT_WIRING_REGISTRY` |
|
|
199
|
+
| Capability profiles | [`src/core/agent-capability.ts`](../src/core/agent-capability.ts) |
|
|
200
|
+
| Assignment lifecycle | [`src/core/assignments.ts`](../src/core/assignments.ts) + [`tests/unit/assignment-convergence.test.ts`](../tests/unit/assignment-convergence.test.ts) |
|
|
201
|
+
| Claim lifecycle / TTL | [`src/core/claims.ts`](../src/core/claims.ts) |
|
|
202
|
+
|
|
203
|
+
## 10. Feedback wanted
|
|
204
|
+
|
|
205
|
+
The following questions are open for v0.2. We're soliciting input from agent
|
|
206
|
+
integrators before declaring any of them stable:
|
|
207
|
+
|
|
208
|
+
1. **Coordination verb shape (§4.1)** — should `coordinate(intent: assign|…)`
|
|
209
|
+
stay as a single verb with an intent enum, or split into named verbs
|
|
210
|
+
(`assign`, `reroute`, `review_request`) per L3 capability?
|
|
211
|
+
2. **Sentinel transport for sandboxed workers** — the `LANE-RESULT.json`
|
|
212
|
+
fallback file is brainclaw-specific. Is there an interest in
|
|
213
|
+
standardising a "filesystem fallback" format so any coordinator can
|
|
214
|
+
harvest results from any sandboxed worker?
|
|
215
|
+
3. **Entity field portability** — which fields beyond the well-known set
|
|
216
|
+
(§3) are universal enough to promote in v0.2? Candidates: `severity`,
|
|
217
|
+
`priority`, `category`, `effort_minutes`, `assignee`.
|
|
218
|
+
4. **L1-only adoption surface** — would a CLI-only L1 reference (no MCP
|
|
219
|
+
dependency) lower the adoption bar for OSS agents that don't speak MCP
|
|
220
|
+
yet?
|
|
221
|
+
|
|
222
|
+
Open an issue, ping `ai@thomgroup.com`, or comment on the brainclaw plan
|
|
223
|
+
tracking this draft (pln#546).
|
package/docs/cli.md
CHANGED
|
@@ -276,9 +276,9 @@ Preservation guarantees: the repair module never calls `unlink`/`rm`/`rmdir`. Un
|
|
|
276
276
|
|
|
277
277
|
Today the flow covers missing entity subdirectories (`mkdir` action) and inbox hygiene (`move_inbox_message`, `quarantine_inbox_message`). More actions — orphaned agent references, mixed-version drift — land as additional repair candidates emitted by `doctor`.
|
|
278
278
|
|
|
279
|
-
### `brainclaw rebuild`
|
|
280
|
-
|
|
281
|
-
Regenerate
|
|
279
|
+
### `brainclaw rebuild`
|
|
280
|
+
|
|
281
|
+
Regenerate the legacy `.brainclaw/project.md` readable summary from canonical state. No options. This file is derived and does not replace the root `PROJECT.md` project vision or live coordination surfaces such as `agent-board`.
|
|
282
282
|
|
|
283
283
|
```bash
|
|
284
284
|
brainclaw rebuild
|
|
@@ -1500,7 +1500,7 @@ Export memory as a native agent instruction file.
|
|
|
1500
1500
|
|
|
1501
1501
|
| Option | Description |
|
|
1502
1502
|
|---|---|
|
|
1503
|
-
| `--format <format>` | Target format: `copilot-instructions`, `cursor-rules`, `agents-md`, `claude-md`, `gemini-md`, `windsurf`, `cline`, `roo`, or `
|
|
1503
|
+
| `--format <format>` | Target format: `copilot-instructions`, `cursor-rules`, `agents-md`, `claude-md`, `gemini-md`, `windsurf`, `cline`, `roo`, `continue`, `openclaw`, `nanoclaw`, `nemoclaw`, `picoclaw`, or `zeroclaw` |
|
|
1504
1504
|
| `--detect` | Auto-detect the running agent and write to its native file |
|
|
1505
1505
|
| `--all` | Write all known agent instruction files at once (deduplicates by format) |
|
|
1506
1506
|
| `--write` | Write output to the native file path (instead of stdout); generated workspace files are treated as local and added to `.gitignore` |
|
|
@@ -1518,12 +1518,13 @@ brainclaw export --format cursor-rules --write # .cursor/rules/braincl
|
|
|
1518
1518
|
brainclaw export --format windsurf --write # .windsurfrules
|
|
1519
1519
|
brainclaw export --format cline --write # .clinerules/brainclaw.md
|
|
1520
1520
|
brainclaw export --format agents-md --write # AGENTS.md (Codex, OpenCode)
|
|
1521
|
-
brainclaw export --format roo --write # .roo/rules/brainclaw.md
|
|
1522
|
-
brainclaw export --format continue --write # .continue/rules/brainclaw.md
|
|
1523
|
-
brainclaw export --format
|
|
1524
|
-
brainclaw export --format claude-md
|
|
1525
|
-
brainclaw export --
|
|
1526
|
-
|
|
1521
|
+
brainclaw export --format roo --write # .roo/rules/brainclaw.md
|
|
1522
|
+
brainclaw export --format continue --write # .continue/rules/brainclaw.md
|
|
1523
|
+
brainclaw export --format openclaw --write # skills/openclaw/SKILL.md
|
|
1524
|
+
brainclaw export --format claude-md --write --shared # publish CLAUDE.md intentionally
|
|
1525
|
+
brainclaw export --format claude-md # stdout
|
|
1526
|
+
brainclaw export --all # all known agent files at once
|
|
1527
|
+
```
|
|
1527
1528
|
|
|
1528
1529
|
`brainclaw export --write` is local-first by default: the generated workspace file and any companion MCP/settings files are added to `.gitignore`. Use `--shared` only when you intentionally want the main instruction file to be committed. `brainclaw export --detect` also writes companion MCP config where relevant, including `opencode.json` for OpenCode and `.gemini/antigravity/mcp_config.json` for Antigravity/Gemini when the local environment is available.
|
|
1529
1530
|
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Coordinator runbook
|
|
2
|
+
|
|
3
|
+
Operational procedures for running multi-agent dispatches, distilled from the
|
|
4
|
+
2026-06-10 coordination session (pln#554). Audience: the coordinator — human or
|
|
5
|
+
agent — who dispatched workers and now has to triage what came back (or didn't).
|
|
6
|
+
|
|
7
|
+
Rule zero across everything below: **evidence before verdict**. Administrative
|
|
8
|
+
status (assignment/run records) is the WEAKEST signal; worker-written results
|
|
9
|
+
and git state are the strongest. Acting on administrative status alone expired
|
|
10
|
+
live workers three times in one night (can_948acfd6).
|
|
11
|
+
|
|
12
|
+
## 1. Baseline triage — is it actually a regression?
|
|
13
|
+
|
|
14
|
+
Before calling anything a regression, run the exact same check on the
|
|
15
|
+
pre-change ref. Twice in the 2026-06-10 session a "sprint-1 regression" turned
|
|
16
|
+
out to be a bug that had always existed — manual workflows had simply masked it
|
|
17
|
+
(see also trap: bisect state before code).
|
|
18
|
+
|
|
19
|
+
Procedure:
|
|
20
|
+
|
|
21
|
+
1. Reproduce the failure on the current ref. Capture the command verbatim.
|
|
22
|
+
2. `git stash` nothing, delete nothing — check out the pre-change ref in a
|
|
23
|
+
SEPARATE worktree (`git worktree add ../baseline <ref>`).
|
|
24
|
+
3. Run the same command there.
|
|
25
|
+
- Fails on the baseline too → not a regression. Re-scope the bug, exonerate
|
|
26
|
+
the change, and continue the dispatch.
|
|
27
|
+
- Passes on the baseline → real regression; only now is bisecting the diff
|
|
28
|
+
worth the time.
|
|
29
|
+
4. Before bisecting code at all, read the historical ENTITY state first
|
|
30
|
+
(assignment / event / completed_at records): the May 2026 codex
|
|
31
|
+
`run_completed` "regression" was state drift, not code.
|
|
32
|
+
|
|
33
|
+
## 2. Dead-worker decision tree
|
|
34
|
+
|
|
35
|
+
A worker looks dead (stale heartbeat, exited process, expired assignment).
|
|
36
|
+
Collect worktree evidence BEFORE any kill / reroute / re-dispatch — recovery is
|
|
37
|
+
cheap, a wrongly killed worker is not.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
worker presumed dead
|
|
41
|
+
│
|
|
42
|
+
├─ 1. LANE-RESULT.json at the worktree root?
|
|
43
|
+
│ yes → it FINISHED. `brainclaw harvest <asgn> [--integrate]`. Done.
|
|
44
|
+
│
|
|
45
|
+
├─ 2. git evidence (shared helper: commits_ahead + dirty_tracked,
|
|
46
|
+
│ surfaced by dispatch-status / dispatch watch):
|
|
47
|
+
│ commits ahead + CLEAN tracked tree
|
|
48
|
+
│ → worker delivered, only exit formalities missing.
|
|
49
|
+
│ Harvest/merge it. NEVER kill-and-reroute a delivered lane.
|
|
50
|
+
│
|
|
51
|
+
├─ 3. dirty tracked files? → work in flight. Check liveness before declaring death:
|
|
52
|
+
│ ├─ fs mtime fresh (logs/worktree written < ~5 min)? → ALIVE, leave it.
|
|
53
|
+
│ ├─ real agent child process under the wrapper pid?
|
|
54
|
+
│ │ (wrapper alive + child gone = abrupt death; orphaned grandchildren
|
|
55
|
+
│ │ hold the pipes open so the wrapper never emits a sentinel)
|
|
56
|
+
│ └─ both dead + fs stale → recover, do not re-dispatch blind:
|
|
57
|
+
│ `brainclaw harvest <asgn> --orphaned`
|
|
58
|
+
│ (typecheck if possible → commit on-behalf with the standard
|
|
59
|
+
│ marker → lifecycle → release claim → run targeted tests + merge)
|
|
60
|
+
│
|
|
61
|
+
└─ 4. clean tree, no commits ahead, no result → nothing to recover.
|
|
62
|
+
Now (and only now) reroute / re-dispatch.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Hard rules:
|
|
66
|
+
|
|
67
|
+
- Never delete or reset a worktree during triage — the diff on disk IS the
|
|
68
|
+
recovery (twice on 2026-06-10: 42 and 41 files recovered, zero loss).
|
|
69
|
+
- Never kill processes by name; source the pid from agent_run.pid and
|
|
70
|
+
cross-check launched_at (the operator's IDE runs the same binaries).
|
|
71
|
+
- A failed observation is not evidence: "could not probe the child process"
|
|
72
|
+
must never be read as "the child is dead".
|
|
73
|
+
|
|
74
|
+
## 3. Post-dispatch verification reflex
|
|
75
|
+
|
|
76
|
+
Delivery is not execution. `delivered_and_started` means the message landed and
|
|
77
|
+
a process spawned — not that the worker reached its work loop.
|
|
78
|
+
|
|
79
|
+
After every dispatch:
|
|
80
|
+
|
|
81
|
+
1. `bclaw_dispatch_status(target_id: <asgn|clm|run>)` — one call resolves the
|
|
82
|
+
assignment, claim, run, heartbeat, logs, lane-result, and git evidence into
|
|
83
|
+
a single health verdict + next action.
|
|
84
|
+
2. Or query directly: `bclaw_find(entity: "agent_run", message_id: <msg>)` —
|
|
85
|
+
no run record means the spawn never produced a process.
|
|
86
|
+
3. Expect the step-0 heartbeat (`.brainclaw-heartbeat-<asgn>` at the worktree
|
|
87
|
+
root) within the first minutes. Missing heartbeat + no fs activity = the
|
|
88
|
+
worker never reached its loop; check the captured stderr for boot
|
|
89
|
+
signatures (model/config mismatches are diagnosed by dispatch-status).
|
|
90
|
+
|
|
91
|
+
Known gap: `intent=ideate` dispatches are inbox-only (can_29f1e1ac) — there is
|
|
92
|
+
no agent_run to verify; track those by reply message, not by run records.
|
|
93
|
+
|
|
94
|
+
## 4. `brainclaw dispatch watch` — monitor contract
|
|
95
|
+
|
|
96
|
+
Blocking watch over one dispatch; encodes the decision tree above as a poller.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
brainclaw dispatch watch <asgn_|clm_|run_> [--interval 60] [--timeout 90] [--base master] [--json]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Exit codes (script on these, not on the log text):
|
|
103
|
+
|
|
104
|
+
| code | state | meaning / next action |
|
|
105
|
+
|------|----------------------|---------------------------------------------------------|
|
|
106
|
+
| 0 | done | lane-result, run completed, or committed-clean → harvest |
|
|
107
|
+
| 2 | timeout | worker still running at --timeout → re-run or inspect |
|
|
108
|
+
| 3 | failed | lane-result/run reported failure → read stderr, fix |
|
|
109
|
+
| 4 | worker-process-gone | dead with uncommitted work → `harvest --orphaned` |
|
|
110
|
+
| 5 | unresolved | target id did not resolve to anything |
|
|
111
|
+
|
|
112
|
+
Evidence priority inside the watch (strongest first): worker-written results >
|
|
113
|
+
git evidence > process evidence > administrative status. Fresh filesystem
|
|
114
|
+
activity vetoes process-gone verdicts (a stale tracked pid after a manual
|
|
115
|
+
respawn must not kill a worker that is visibly writing).
|
|
116
|
+
|
|
117
|
+
## Cross-references
|
|
118
|
+
|
|
119
|
+
- can_948acfd6 — assignment expired while the worker was delivering; git
|
|
120
|
+
evidence outranks administrative status.
|
|
121
|
+
- can_d622e024 — claude -p "delivered-but-end-stalled": committed-clean is done.
|
|
122
|
+
- can_9458576e — wrapper-alive/child-dead death mode (orphaned pipe holders).
|
|
123
|
+
- can_29f1e1ac — intent=ideate is inbox-only; no run record to verify.
|
|
124
|
+
- cnd_asgn_7336aa79_heartbeat_sandbox / can_asgn_b0169fd8_heartbeat — sandboxes
|
|
125
|
+
refuse absolute heartbeat paths; briefs point sandboxed workers at a
|
|
126
|
+
worktree-relative path.
|
|
127
|
+
- trap: agent shell env contaminates tests — strip BRAINCLAW_CWD/_AGENT before
|
|
128
|
+
running suites from an agent shell.
|
|
129
|
+
- docs/concepts/dispatch-lifecycle.md — full entity/FSM model behind all of this.
|
|
@@ -150,6 +150,23 @@ You called `bclaw_coordinate(intent="review", open_loop=true, …)` and got back
|
|
|
150
150
|
|
|
151
151
|
---
|
|
152
152
|
|
|
153
|
+
## Worktree-as-contract harvest
|
|
154
|
+
|
|
155
|
+
Some dispatched workers cannot self-commit or call MCP. For example, a sandboxed Codex run may have `dispatchCanCommit=false` because its writable root is the linked worktree, while `.git` lives outside that root. In that case the worker contract is intentionally small:
|
|
156
|
+
|
|
157
|
+
1. Edit files inside the dispatched worktree.
|
|
158
|
+
2. Write `LANE-RESULT.json` at the worktree root.
|
|
159
|
+
|
|
160
|
+
The worker does not need to commit, call `bclaw_assignment_update`, or release the claim itself. The worktree is the contract.
|
|
161
|
+
|
|
162
|
+
When the coordinator runs `brainclaw harvest <assignment_id> --integrate`, brainclaw reads the worker's `LANE-RESULT.json`, commits the linked worktree diff on the worker's behalf onto the lane branch, then completes the assignment and releases the claim, including the normal plan-status cascade.
|
|
163
|
+
|
|
164
|
+
The on-behalf commit is guarded by the linked-worktree check (`isLinkedWorktree`): integration only targets the worktree associated with the assignment, never the main repository. This keeps sandboxed-worker harvesting from turning into an accidental main-repo commit path.
|
|
165
|
+
|
|
166
|
+
Integration is strictly additive and opt-in. Plain `brainclaw harvest <assignment_id>` remains report-only; it reads and reports the lane result without committing or mutating assignment / claim state. The on-behalf commit and lifecycle completion happen only when the coordinator passes `--integrate`.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
153
170
|
## Diagnostic playbook
|
|
154
171
|
|
|
155
172
|
When a dispatch hangs, work top-down through these checks. For the symptom-driven variant see [troubleshooting.md#inbox-messages-stuck--brief-ack-never-arrived](troubleshooting.md#inbox-messages-stuck--brief-ack-never-arrived).
|