brainclaw 1.9.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 (91) hide show
  1. package/README.md +585 -499
  2. package/dist/brainclaw-vscode.vsix +0 -0
  3. package/dist/commands/harvest.js +1 -1
  4. package/dist/commands/hooks.js +73 -73
  5. package/dist/commands/init.js +1 -1
  6. package/dist/commands/install-hooks.js +78 -78
  7. package/dist/commands/mcp-read-handlers.js +57 -14
  8. package/dist/commands/mcp.js +79 -13
  9. package/dist/commands/switch.js +26 -5
  10. package/dist/commands/version.js +1 -1
  11. package/dist/core/agent-capability.js +19 -4
  12. package/dist/core/agent-files.js +119 -119
  13. package/dist/core/codev-prompts.js +38 -38
  14. package/dist/core/default-profiles/doctor.yaml +11 -11
  15. package/dist/core/default-profiles/janitor.yaml +11 -11
  16. package/dist/core/default-profiles/onboarder.yaml +11 -11
  17. package/dist/core/default-profiles/reviewer.yaml +13 -13
  18. package/dist/core/dispatcher.js +1 -1
  19. package/dist/core/entity-operations.js +29 -3
  20. package/dist/core/execution.js +1 -1
  21. package/dist/core/loops/verbs.js +0 -1
  22. package/dist/core/messaging.js +2 -2
  23. package/dist/core/protocol-skills.js +164 -164
  24. package/dist/core/runtime-signals.js +1 -1
  25. package/dist/core/search.js +19 -2
  26. package/dist/core/security-guard.js +207 -207
  27. package/dist/core/spawn-check.js +16 -2
  28. package/dist/core/staleness.js +1 -1
  29. package/dist/core/store-resolution.js +26 -7
  30. package/dist/core/worktree.js +18 -18
  31. package/dist/facts.js +3 -3
  32. package/dist/facts.json +2 -2
  33. package/docs/PROTOCOL.md +1 -1
  34. package/docs/adapters/openclaw.md +43 -43
  35. package/docs/architecture/project-refs.md +328 -328
  36. package/docs/cli.md +2093 -2093
  37. package/docs/concepts/coordination.md +52 -52
  38. package/docs/concepts/coordinator-runbook.md +129 -129
  39. package/docs/concepts/dispatch-lifecycle.md +245 -245
  40. package/docs/concepts/event-log-store.md +928 -928
  41. package/docs/concepts/ideation-loop.md +317 -317
  42. package/docs/concepts/loop-engine.md +520 -511
  43. package/docs/concepts/mcp-governance.md +268 -268
  44. package/docs/concepts/memory.md +84 -84
  45. package/docs/concepts/multi-agent-workflows.md +167 -167
  46. package/docs/concepts/observer-protocol.md +361 -361
  47. package/docs/concepts/plans-and-claims.md +217 -217
  48. package/docs/concepts/project-md-convention.md +35 -35
  49. package/docs/concepts/runtime-notes.md +38 -38
  50. package/docs/concepts/troubleshooting.md +254 -254
  51. package/docs/concepts/workspace-bootstrapping.md +142 -142
  52. package/docs/context-format-changelog.md +35 -35
  53. package/docs/context-format.md +48 -48
  54. package/docs/index.md +65 -65
  55. package/docs/integrations/agents.md +158 -158
  56. package/docs/integrations/claude-code.md +23 -23
  57. package/docs/integrations/cline.md +77 -77
  58. package/docs/integrations/continue.md +55 -55
  59. package/docs/integrations/copilot.md +68 -68
  60. package/docs/integrations/cursor.md +23 -23
  61. package/docs/integrations/kilocode.md +72 -72
  62. package/docs/integrations/mcp.md +377 -377
  63. package/docs/integrations/mistral-vibe.md +122 -122
  64. package/docs/integrations/openclaw.md +92 -92
  65. package/docs/integrations/opencode.md +84 -84
  66. package/docs/integrations/overview.md +115 -115
  67. package/docs/integrations/roo.md +71 -71
  68. package/docs/integrations/windsurf.md +77 -77
  69. package/docs/mcp-schema-changelog.md +360 -356
  70. package/docs/playbooks/integration/index.md +121 -121
  71. package/docs/playbooks/orchestration.md +37 -0
  72. package/docs/playbooks/productivity/index.md +99 -99
  73. package/docs/playbooks/team/index.md +117 -117
  74. package/docs/product/agent-first-model.md +184 -184
  75. package/docs/product/entity-model-audit.md +462 -462
  76. package/docs/product/positioning.md +86 -86
  77. package/docs/quickstart-existing-project.md +107 -107
  78. package/docs/quickstart.md +183 -183
  79. package/docs/release-maintenance.md +79 -79
  80. package/docs/reputation.md +52 -52
  81. package/docs/review.md +45 -45
  82. package/docs/security.md +212 -212
  83. package/docs/server-operations.md +118 -118
  84. package/docs/storage.md +106 -106
  85. package/package.json +80 -65
  86. package/docs/concepts/event-log-store-critique-A.md +0 -333
  87. package/docs/concepts/event-log-store-critique-B.md +0 -353
  88. package/docs/concepts/event-log-store-phase0-measurements.md +0 -58
  89. package/docs/concepts/event-log-store-proposal-A.md +0 -365
  90. package/docs/concepts/event-log-store-proposal-B.md +0 -404
  91. package/docs/concepts/identity-model-proposal.md +0 -371
@@ -1,52 +1,52 @@
1
- # Coordination
2
-
3
- brainclaw is not only a memory layer.
4
- It is also a coordination layer.
5
-
6
- That distinction matters.
7
-
8
- ## Why coordination is needed
9
-
10
- Multiple humans and coding agents working in the same repo can easily:
11
-
12
- - duplicate work
13
- - miss handoffs
14
- - overwrite each other
15
- - diverge on plan status
16
- - act on stale assumptions
17
-
18
- Traditional instruction files do not solve this well because they describe how to behave, but not what is currently happening.
19
-
20
- ## What brainclaw adds
21
-
22
- brainclaw introduces shared operational state for a workspace, including:
23
-
24
- - plans
25
- - task status
26
- - file claims
27
- - handoffs
28
- - runtime notes
29
- - board views
30
-
31
- ## The key idea
32
-
33
- A workspace should expose not only what the project knows, but also what is currently being done.
34
-
35
- That includes:
36
-
37
- - what matters
38
- - what is active
39
- - who is working where
40
- - what is blocked
41
- - what needs review or handoff
42
-
43
- ## Why this is different from another agent
44
-
45
- brainclaw does not try to become the agent that does everything.
46
- It helps many tools collaborate against the same workspace state.
47
-
48
- ## Related pages
49
-
50
- - [plans-and-claims.md](plans-and-claims.md)
51
- - [runtime-notes.md](runtime-notes.md)
52
- - [../integrations/overview.md](../integrations/overview.md)
1
+ # Coordination
2
+
3
+ brainclaw is not only a memory layer.
4
+ It is also a coordination layer.
5
+
6
+ That distinction matters.
7
+
8
+ ## Why coordination is needed
9
+
10
+ Multiple humans and coding agents working in the same repo can easily:
11
+
12
+ - duplicate work
13
+ - miss handoffs
14
+ - overwrite each other
15
+ - diverge on plan status
16
+ - act on stale assumptions
17
+
18
+ Traditional instruction files do not solve this well because they describe how to behave, but not what is currently happening.
19
+
20
+ ## What brainclaw adds
21
+
22
+ brainclaw introduces shared operational state for a workspace, including:
23
+
24
+ - plans
25
+ - task status
26
+ - file claims
27
+ - handoffs
28
+ - runtime notes
29
+ - board views
30
+
31
+ ## The key idea
32
+
33
+ A workspace should expose not only what the project knows, but also what is currently being done.
34
+
35
+ That includes:
36
+
37
+ - what matters
38
+ - what is active
39
+ - who is working where
40
+ - what is blocked
41
+ - what needs review or handoff
42
+
43
+ ## Why this is different from another agent
44
+
45
+ brainclaw does not try to become the agent that does everything.
46
+ It helps many tools collaborate against the same workspace state.
47
+
48
+ ## Related pages
49
+
50
+ - [plans-and-claims.md](plans-and-claims.md)
51
+ - [runtime-notes.md](runtime-notes.md)
52
+ - [../integrations/overview.md](../integrations/overview.md)
@@ -1,129 +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.
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.