brainclaw 0.28.0 → 1.5.3

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 (198) hide show
  1. package/README.md +193 -170
  2. package/dist/brainclaw-vscode.vsix +0 -0
  3. package/dist/cli.js +683 -23
  4. package/dist/commands/accept.js +3 -0
  5. package/dist/commands/add-step.js +11 -26
  6. package/dist/commands/agent-board.js +70 -3
  7. package/dist/commands/audit.js +19 -0
  8. package/dist/commands/check-policy.js +54 -0
  9. package/dist/commands/check-security-mcp.js +145 -0
  10. package/dist/commands/check-security.js +106 -0
  11. package/dist/commands/claim-resource.js +1 -0
  12. package/dist/commands/codev.js +672 -0
  13. package/dist/commands/compact.js +74 -0
  14. package/dist/commands/complete-step.js +16 -26
  15. package/dist/commands/constraint.js +8 -20
  16. package/dist/commands/decision.js +9 -20
  17. package/dist/commands/delete-plan.js +10 -12
  18. package/dist/commands/delete-step.js +16 -0
  19. package/dist/commands/dispatch.js +163 -0
  20. package/dist/commands/doctor.js +1122 -49
  21. package/dist/commands/enable-agent.js +1 -0
  22. package/dist/commands/export.js +280 -22
  23. package/dist/commands/handoff.js +33 -0
  24. package/dist/commands/harvest.js +189 -0
  25. package/dist/commands/hooks.js +82 -25
  26. package/dist/commands/inbox.js +169 -0
  27. package/dist/commands/init.js +38 -31
  28. package/dist/commands/install-hooks.js +71 -44
  29. package/dist/commands/link.js +89 -0
  30. package/dist/commands/list-claims.js +48 -3
  31. package/dist/commands/list-plans.js +129 -25
  32. package/dist/commands/loops-handlers.js +409 -0
  33. package/dist/commands/mcp-read-handlers.js +1628 -0
  34. package/dist/commands/mcp-schemas.generated.js +74 -0
  35. package/dist/commands/mcp.js +4244 -1475
  36. package/dist/commands/plan-resource.js +64 -0
  37. package/dist/commands/plan.js +12 -26
  38. package/dist/commands/prune.js +37 -2
  39. package/dist/commands/reflect.js +20 -7
  40. package/dist/commands/release-claim.js +11 -6
  41. package/dist/commands/release-notes.js +170 -0
  42. package/dist/commands/repair.js +210 -0
  43. package/dist/commands/run-profile.js +57 -0
  44. package/dist/commands/sequence.js +113 -0
  45. package/dist/commands/session-end.js +423 -14
  46. package/dist/commands/session-start.js +214 -41
  47. package/dist/commands/setup-security.js +103 -0
  48. package/dist/commands/setup.js +42 -4
  49. package/dist/commands/stale.js +109 -0
  50. package/dist/commands/switch.js +131 -10
  51. package/dist/commands/trap.js +14 -31
  52. package/dist/commands/update-handoff.js +63 -4
  53. package/dist/commands/update-plan.js +21 -28
  54. package/dist/commands/update-step.js +37 -0
  55. package/dist/commands/upgrade.js +313 -6
  56. package/dist/commands/usage.js +102 -0
  57. package/dist/commands/version.js +20 -0
  58. package/dist/commands/who.js +124 -0
  59. package/dist/commands/worktree.js +105 -0
  60. package/dist/core/actions.js +315 -0
  61. package/dist/core/agent-capability.js +610 -17
  62. package/dist/core/agent-context.js +7 -1
  63. package/dist/core/agent-files.js +1169 -85
  64. package/dist/core/agent-integrations.js +160 -5
  65. package/dist/core/agent-inventory.js +2 -0
  66. package/dist/core/agent-profiles.js +93 -0
  67. package/dist/core/agent-registry.js +162 -30
  68. package/dist/core/agentrun-reconciler.js +345 -0
  69. package/dist/core/agentruns.js +424 -0
  70. package/dist/core/ai-agent-detection.js +31 -10
  71. package/dist/core/archival.js +77 -0
  72. package/dist/core/assignment-sweeper.js +82 -0
  73. package/dist/core/assignments.js +367 -0
  74. package/dist/core/audit.js +30 -0
  75. package/dist/core/bootstrap.js +61 -10
  76. package/dist/core/brainclaw-version.js +94 -2
  77. package/dist/core/candidates.js +93 -2
  78. package/dist/core/claims.js +419 -0
  79. package/dist/core/codev-metrics.js +77 -0
  80. package/dist/core/codev-personas.js +31 -0
  81. package/dist/core/codev-plan-gen.js +35 -0
  82. package/dist/core/codev-prompts.js +74 -0
  83. package/dist/core/codev-responses.js +62 -0
  84. package/dist/core/codev-rounds.js +218 -0
  85. package/dist/core/config.js +4 -0
  86. package/dist/core/context.js +454 -34
  87. package/dist/core/coordination.js +201 -6
  88. package/dist/core/cross-project.js +230 -16
  89. package/dist/core/default-profiles/doctor.yaml +11 -0
  90. package/dist/core/default-profiles/janitor.yaml +11 -0
  91. package/dist/core/default-profiles/onboarder.yaml +11 -0
  92. package/dist/core/default-profiles/reviewer.yaml +13 -0
  93. package/dist/core/dispatcher.js +1189 -0
  94. package/dist/core/duplicates.js +2 -2
  95. package/dist/core/entity-operations.js +450 -0
  96. package/dist/core/entity-registry.js +344 -0
  97. package/dist/core/event-log.js +1 -0
  98. package/dist/core/events.js +106 -2
  99. package/dist/core/execution-adapters.js +154 -0
  100. package/dist/core/execution-context.js +63 -0
  101. package/dist/core/execution-profile.js +270 -0
  102. package/dist/core/execution.js +255 -0
  103. package/dist/core/facade-schema.js +81 -0
  104. package/dist/core/federation-cloud.js +99 -0
  105. package/dist/core/federation-message.js +52 -0
  106. package/dist/core/federation-transport.js +65 -0
  107. package/dist/core/gc-semantic.js +482 -0
  108. package/dist/core/governance.js +247 -0
  109. package/dist/core/guards.js +19 -0
  110. package/dist/core/ideation.js +72 -0
  111. package/dist/core/identity.js +252 -28
  112. package/dist/core/ids.js +6 -0
  113. package/dist/core/input-validation.js +2 -2
  114. package/dist/core/instruction-templates.js +344 -136
  115. package/dist/core/io.js +90 -11
  116. package/dist/core/lock.js +6 -2
  117. package/dist/core/loops/brief-assembly.js +213 -0
  118. package/dist/core/loops/facade-schema.js +148 -0
  119. package/dist/core/loops/index.js +7 -0
  120. package/dist/core/loops/iteration-engine.js +139 -0
  121. package/dist/core/loops/lock.js +385 -0
  122. package/dist/core/loops/store.js +201 -0
  123. package/dist/core/loops/types.js +403 -0
  124. package/dist/core/loops/verbs.js +534 -0
  125. package/dist/core/markdown.js +15 -3
  126. package/dist/core/memory-compactor.js +432 -0
  127. package/dist/core/memory-git.js +152 -8
  128. package/dist/core/messaging.js +278 -0
  129. package/dist/core/migration.js +32 -1
  130. package/dist/core/mutation-pipeline.js +4 -2
  131. package/dist/core/operations/memory-mutation.js +129 -0
  132. package/dist/core/operations/memory-write.js +78 -0
  133. package/dist/core/operations/plan.js +190 -0
  134. package/dist/core/policy.js +169 -0
  135. package/dist/core/repo-analysis.js +67 -0
  136. package/dist/core/reputation.js +9 -3
  137. package/dist/core/schema.js +546 -21
  138. package/dist/core/search.js +21 -2
  139. package/dist/core/security-cache.js +71 -0
  140. package/dist/core/security-guard.js +152 -0
  141. package/dist/core/security-scoring.js +86 -0
  142. package/dist/core/sequence.js +130 -0
  143. package/dist/core/socket-client.js +113 -0
  144. package/dist/core/staleness.js +246 -0
  145. package/dist/core/state.js +98 -22
  146. package/dist/core/store-resolution.js +54 -12
  147. package/dist/core/toml-writer.js +76 -0
  148. package/dist/core/upgrades/backup.js +232 -0
  149. package/dist/core/upgrades/health-check.js +169 -0
  150. package/dist/core/upgrades/patches/candidate-archive.js +145 -0
  151. package/dist/core/upgrades/patches/handoff-review-strip.js +128 -0
  152. package/dist/core/upgrades/patches/provenance-rollout.js +136 -0
  153. package/dist/core/upgrades/schema-version.js +97 -0
  154. package/dist/core/worktree.js +606 -0
  155. package/dist/facts.js +114 -0
  156. package/dist/facts.json +111 -0
  157. package/docs/architecture/project-refs.md +5 -1
  158. package/docs/cli.md +690 -43
  159. package/docs/concepts/ideation-loop.md +317 -0
  160. package/docs/concepts/loop-engine.md +456 -0
  161. package/docs/concepts/mcp-governance.md +268 -0
  162. package/docs/concepts/memory-staleness.md +122 -0
  163. package/docs/concepts/multi-agent-workflows.md +166 -0
  164. package/docs/concepts/plans-and-claims.md +31 -6
  165. package/docs/concepts/project-md-convention.md +35 -0
  166. package/docs/concepts/troubleshooting.md +220 -0
  167. package/docs/concepts/upgrade-cli.md +202 -0
  168. package/docs/concepts/upgrade-dogfood-procedure.md +114 -0
  169. package/docs/context-format-changelog.md +2 -2
  170. package/docs/context-format.md +2 -2
  171. package/docs/index.md +68 -0
  172. package/docs/integrations/agents.md +15 -16
  173. package/docs/integrations/cline.md +88 -0
  174. package/docs/integrations/codex.md +75 -23
  175. package/docs/integrations/continue.md +60 -0
  176. package/docs/integrations/copilot.md +67 -9
  177. package/docs/integrations/kilocode.md +72 -0
  178. package/docs/integrations/mcp.md +304 -21
  179. package/docs/integrations/mistral-vibe.md +122 -0
  180. package/docs/integrations/opencode.md +84 -0
  181. package/docs/integrations/overview.md +23 -8
  182. package/docs/integrations/roo.md +74 -0
  183. package/docs/integrations/windsurf.md +83 -0
  184. package/docs/mcp-schema-changelog.md +191 -1
  185. package/docs/playbooks/integration/index.md +121 -0
  186. package/docs/playbooks/productivity/index.md +102 -0
  187. package/docs/playbooks/team/index.md +122 -0
  188. package/docs/product/agent-first-model.md +184 -0
  189. package/docs/product/entity-model-audit.md +462 -0
  190. package/docs/quickstart-existing-project.md +135 -0
  191. package/docs/quickstart.md +124 -37
  192. package/docs/release-maintenance.md +79 -0
  193. package/docs/review.md +2 -0
  194. package/docs/server-operations.md +118 -0
  195. package/package.json +20 -12
  196. package/dist/commands/claude-desktop-extension.js +0 -18
  197. package/dist/commands/diff.js +0 -99
  198. package/dist/core/claude-desktop-extension.js +0 -224
package/docs/cli.md CHANGED
@@ -4,9 +4,9 @@ The CLI is Brainclaw's explicit operator, scripting, release, and fallback surfa
4
4
 
5
5
  For capable coding agents, prefer MCP for dynamic runtime state:
6
6
 
7
- - `bclaw_bootstrap` instead of manual bootstrap polling
8
- - `bclaw_get_context` instead of repeated raw CLI context calls
9
- - `bclaw_list_plans` / `bclaw_list_claims` / `bclaw_get_agent_board` for live coordination views
7
+ - `bclaw_work(intent)` to start working handles session, context, and claim creation in one call
8
+ - `bclaw_context(kind)` for memory / execution / board reads instead of repeated raw CLI context calls
9
+ - `bclaw_find(entity, filter?)` / `bclaw_get(entity, id)` for plans, claims, candidates, handoffs, and other entities (legacy `bclaw_list_*` / `bclaw_get_context` still work via a redirect warning)
10
10
  - `bclaw_claim`, `bclaw_write_note`, and `bclaw_session_end` for session continuity
11
11
 
12
12
  Use the CLI when a human operator is driving the workflow, when you are scripting setup or release operations, or when MCP is not the integration path.
@@ -56,7 +56,7 @@ brainclaw switch --clear # clear, revert to cwd
56
56
  brainclaw --cwd /other/path status # one-off override without switching
57
57
  ```
58
58
 
59
- **MCP usage:** The active project also affects MCP tools. When `bclaw_get_context()` is called without an explicit path, it resolves context from the active project's store. Agents can also use `BRAINCLAW_PROJECT=<name>` environment variable for the same effect.
59
+ **MCP usage:** The active project also affects MCP tools. When `bclaw_context(kind="memory")` is called without an explicit path, it resolves context from the active project's store. Agents can also use the `BRAINCLAW_PROJECT=<name>` environment variable for the same effect.
60
60
 
61
61
  ---
62
62
 
@@ -224,6 +224,31 @@ When Brainclaw detects generated local agent files such as `.mcp.json` or `.clau
224
224
 
225
225
  In `multi-project` mode with `projects.strategy: folder`, `doctor` now checks the effective workspace project set, not just `config.projects.known`. That avoids false positives on workspaces that resolve child stores from the filesystem or global project registry.
226
226
 
227
+ #### Repair candidates (pln#397)
228
+
229
+ `doctor --json` also emits a `repair_candidates[]` array listing machine-readable remediation actions. Each entry has `{ action, target, description, safe, related_check }`. Safe candidates are pure-creation or idempotent; unsafe candidates relocate existing files and require explicit confirmation. Consume them with `brainclaw repair`.
230
+
231
+ ### `brainclaw repair`
232
+
233
+ Apply the structured `repair_candidates[]` surfaced by `doctor`. By default only `safe: true` candidates run; unsafe candidates stay deferred with a clear reason.
234
+
235
+ | Option | Description |
236
+ |---|---|
237
+ | `--dry-run` | Print the plan without executing anything |
238
+ | `--include-unsafe` | Also apply candidates flagged unsafe (files are **relocated**, never deleted) |
239
+ | `--json` | Output as JSON |
240
+
241
+ ```bash
242
+ brainclaw repair --dry-run # preview
243
+ brainclaw repair # execute safe actions
244
+ brainclaw repair --include-unsafe # include quarantine etc.
245
+ brainclaw repair --json # structured output
246
+ ```
247
+
248
+ Preservation guarantees: the repair module never calls `unlink`/`rm`/`rmdir`. Unsafe actions (e.g. malformed inbox messages) are relocated to labelled parking directories such as `coordination/inbox/.quarantine/` so operators can recover them manually. A preservation banner lists exactly what moves and where before execution.
249
+
250
+ 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`.
251
+
227
252
  ### `brainclaw rebuild`
228
253
 
229
254
  Regenerate `project.md` from canonical state. No options.
@@ -513,12 +538,16 @@ brainclaw instruction "Summarize blockers explicitly" --layer agent --agent open
513
538
 
514
539
  Record an operational observation during a session.
515
540
 
541
+ This is the CLI counterpart of the MCP tool `bclaw_write_note`.
542
+ Use it for session observations, host-specific operator notes, and in-progress findings that are not yet durable decisions or traps.
543
+ For operators who expect a resource-style verb, `brainclaw note create <text>` is accepted as an alias.
544
+
516
545
  | Option | Description |
517
546
  |---|---|
518
- | `--agent <name>` | Authoring agent |
547
+ | `--agent <name>` | Authoring agent; defaults to the configured current agent |
519
548
  | `--project <name>` | Associated project |
520
549
  | `--plan <id>` | Associated plan ID |
521
- | `--visibility <scope>` | Visibility scope (e.g. `machine`) |
550
+ | `--visibility <scope>` | Visibility scope: `shared`, `machine`, `private` |
522
551
  | `--host <name>` | Pin to a specific host |
523
552
  | `--tag <tag>` | Tag for categorization (repeatable) |
524
553
  | `--ttl <duration>` | Time-to-live (e.g. `7d`, `24h`) |
@@ -530,6 +559,17 @@ brainclaw runtime-note "Node not on PATH on this host" --visibility machine
530
559
  brainclaw runtime-note "Use auth gateway for new routes" --auto-reflect
531
560
  ```
532
561
 
562
+ ### `brainclaw note create <text>`
563
+
564
+ Resource-style alias for `brainclaw runtime-note <text>`.
565
+
566
+ Use the same options as `runtime-note` when an operator workflow or wrapper expects `create` semantics.
567
+
568
+ ```bash
569
+ brainclaw note create "Observed host-specific CUDA mismatch on dgx-a"
570
+ brainclaw note create "Need follow-up on launcher script" --plan pln_abc123
571
+ ```
572
+
533
573
  ---
534
574
 
535
575
  ## Memory Review
@@ -779,6 +819,73 @@ brainclaw search "rollout" --since 2026-01-01 --json
779
819
 
780
820
  For capable agents, prefer the MCP plan and claim tools for live runtime interactions. The CLI remains the operator and scripting form of the same coordination model.
781
821
 
822
+ ### `brainclaw codev [topic]`
823
+
824
+ Experimental legacy command. Hidden from the default CLI surface and only registered when `BRAINCLAW_ENABLE_CODEV=1` is set.
825
+
826
+ Multi-perspective ideation session using persona-based group discussion.
827
+
828
+ | Option | Description |
829
+ |---|---|
830
+ | `--personas <tier>` | Persona tier: `tier1` (default), `tier2`, or `list` |
831
+ | `--checkpoint` | Pause after clarification for human input (v2 mode only) |
832
+ | `--spawn` | Spawn agent CLI instances for autonomous group discussion (v3 mode) |
833
+ | `--agents <list>` | Comma-separated agent names for spawn (e.g. `claude-code,codex,antigravity`). Default: auto-detect available agents |
834
+ | `--rounds <N>` | Number of discussion rounds in v3 mode (default: 3, minimum: 2) |
835
+ | `--target-duration <seconds>` | Target response duration indicated to agents (default: 120) |
836
+ | `--json` | Output as JSON |
837
+
838
+ **v3 mode** (`--spawn`): Spawns agents that discuss iteratively in rounds:
839
+ - Round 0 (position): Each agent states their initial position
840
+ - Rounds 1-N (reaction): Agents react to each other's positions
841
+ - Final round (convergence): Identify agreements and remaining tensions
842
+
843
+ Agents are distributed round-robin across available CLI agents. Each round produces an ideation artifact stored in `.brainclaw/coordination/ideation/`.
844
+
845
+ **v2 mode** (without `--spawn`): Generates a coordinator prompt for manual facilitation.
846
+
847
+ Examples:
848
+ ```bash
849
+ # Auto-detect agents, 3 rounds
850
+ brainclaw codev "API redesign" --spawn
851
+
852
+ # Specific agents, 5 rounds, faster target
853
+ brainclaw codev "Migration strategy" --spawn --agents claude-code,codex --rounds 5 --target-duration 90
854
+
855
+ # List available personas
856
+ brainclaw codev --personas list
857
+ ```
858
+
859
+ ### `brainclaw codev-metrics <thread>`
860
+
861
+ Experimental legacy command. Hidden from the default CLI surface and only registered when `BRAINCLAW_ENABLE_CODEV=1` is set.
862
+
863
+ Show per-agent average and p95 response time metrics for a CoDev thread. Useful for diagnosing slow agents or comparing model performance across a multi-agent discussion.
864
+
865
+ | Option | Description |
866
+ |---|---|
867
+ | `--json` | Output as JSON |
868
+
869
+ ```bash
870
+ brainclaw codev-metrics thr_abc123
871
+ brainclaw codev-metrics thr_abc123 --json
872
+ ```
873
+
874
+ ### `brainclaw run [profile-name]`
875
+
876
+ Run an agent profile, or list all available profiles if no name is given. Profiles are named invoke templates that describe how to launch a specific agent CLI for dispatch purposes.
877
+
878
+ | Option | Description |
879
+ |---|---|
880
+ | `--dry` | Print the resolved command without executing |
881
+ | `--agent <name>` | Override the invoke template with a known agent |
882
+
883
+ ```bash
884
+ brainclaw run # list available profiles
885
+ brainclaw run claude-code # run the claude-code profile
886
+ brainclaw run claude-code --dry # preview the resolved command
887
+ ```
888
+
782
889
  ### `brainclaw plan create <text>`
783
890
 
784
891
  Create a shared work item.
@@ -802,6 +909,22 @@ brainclaw plan create "Refactor payments module" --project payments --estimate 9
802
909
 
803
910
  Legacy compatibility: `brainclaw plan "Coordinate auth rollout"`
804
911
 
912
+ ### `brainclaw plan show <id>`
913
+
914
+ Display details of a specific plan item.
915
+
916
+ Use `plan show` for the canonical syntax. `plan get` is accepted as a read alias for operator convenience.
917
+
918
+ | Option | Description |
919
+ |---|---|
920
+ | `--json` | Output as JSON |
921
+
922
+ ```bash
923
+ brainclaw plan show pln_abc123
924
+ brainclaw plan show pln_abc123 --json
925
+ brainclaw plan get pln_abc123
926
+ ```
927
+
805
928
  ### `brainclaw add-step <planId> <text>`
806
929
 
807
930
  Add a step to an existing plan.
@@ -819,14 +942,19 @@ brainclaw add-step pln_001 "Deploy to staging" --assign devops-bot
819
942
 
820
943
  Mark a step in a plan as completed. No options.
821
944
 
945
+ Use the plan item ID plus the step ID returned by `plan show` or `plan list --json`.
946
+ `brainclaw plan update` updates plan items only; it does not operate on `stp_*` step IDs.
947
+
822
948
  ```bash
823
- brainclaw complete-step pln_001 step_001
949
+ brainclaw complete-step pln_001 stp_001
824
950
  ```
825
951
 
826
952
  ### `brainclaw plan update <id>`
827
953
 
828
954
  Update plan status or ownership.
829
955
 
956
+ This command expects a plan ID (`pln_*`), not a step ID. To complete a step, use `brainclaw complete-step <planId> <stepId>`.
957
+
830
958
  | Option | Description |
831
959
  |---|---|
832
960
  | `--status <status>` | Status: `todo`, `in_progress`, `blocked`, `done`, or `dropped` |
@@ -874,10 +1002,78 @@ Update an existing handoff.
874
1002
  |---|---|
875
1003
  | `--status <status>` | New status |
876
1004
  | `--to <name>` | Change recipient |
1005
+ | `--narrative <text>` | Replace the handoff narrative |
1006
+ | `--reviewer <name>` | Set or override the assigned reviewer |
1007
+ | `--review-verdict <verdict>` | Capture a structured review verdict: `approve` or `request_changes` |
1008
+ | `--reviewed-by <name>` | Record who produced the verdict |
1009
+ | `--review-summary <text>` | Attach a short review summary |
1010
+ | `--blocking-issue <text>` | Add a blocking issue (repeatable) |
1011
+ | `--suggestion <text>` | Add a non-blocking suggestion (repeatable) |
877
1012
 
878
1013
  ```bash
879
- brainclaw update-handoff hnd_001 --status done
1014
+ brainclaw update-handoff hnd_001 --status closed
880
1015
  brainclaw update-handoff hnd_001 --to alice
1016
+ brainclaw update-handoff hnd_001 --review-verdict request_changes --reviewed-by codex --blocking-issue "Null guard missing"
1017
+ ```
1018
+
1019
+ ---
1020
+
1021
+ ## Dispatch
1022
+
1023
+ The `dispatch` command group manages the local agent dispatcher: it analyzes the active sequence for lane readiness and assigns work to available agents.
1024
+
1025
+ ### `brainclaw dispatch analysis`
1026
+
1027
+ Analyze the active sequence and show lane status: ready, active, blocked, and done lanes.
1028
+
1029
+ | Option | Description |
1030
+ |---|---|
1031
+ | `--json` | Output as JSON |
1032
+
1033
+ ```bash
1034
+ brainclaw dispatch analysis
1035
+ brainclaw dispatch analysis --json
1036
+ ```
1037
+
1038
+ ### `brainclaw dispatch run`
1039
+
1040
+ Run a dispatch cycle: assign ready lanes to available agents. Optionally preview assignments or spawn CLI agents autonomously.
1041
+
1042
+ | Option | Description |
1043
+ |---|---|
1044
+ | `--agents <names>` | Comma-separated list of agents to dispatch to |
1045
+ | `--lanes <names>` | Comma-separated list of lanes to dispatch |
1046
+ | `--max <n>` | Maximum number of assignments |
1047
+ | `--dry` | Preview assignments without sending messages |
1048
+ | `--spawn` | Autonomously launch CLI agents with invoke templates |
1049
+ | `--agent <name>` | Dispatcher agent name |
1050
+ | `--json` | Output as JSON |
1051
+
1052
+ ```bash
1053
+ brainclaw dispatch run
1054
+ brainclaw dispatch run --dry
1055
+ brainclaw dispatch run --spawn --agents claude-code,codex
1056
+ brainclaw dispatch run --lanes docs,tests --max 2 --json
1057
+ ```
1058
+
1059
+ ### `brainclaw dispatch review`
1060
+
1061
+ Dispatch code reviews for completed handoffs. Finds handoffs ready for review and sends review assignments to available agents.
1062
+
1063
+ | Option | Description |
1064
+ |---|---|
1065
+ | `--handoff <id>` | Specific handoff ID to review |
1066
+ | `--reviewer <name>` | Specific reviewer agent |
1067
+ | `--spawn` | Launch the reviewer CLI agent |
1068
+ | `--dry` | Preview without sending |
1069
+ | `--agent <name>` | Dispatcher agent name |
1070
+ | `--json` | Output as JSON |
1071
+
1072
+ ```bash
1073
+ brainclaw dispatch review
1074
+ brainclaw dispatch review --handoff hnd_001 --reviewer codex
1075
+ brainclaw dispatch review --dry
1076
+ brainclaw dispatch review --spawn --json
881
1077
  ```
882
1078
 
883
1079
  ---
@@ -957,6 +1153,94 @@ brainclaw agent-board --suggest --capabilities
957
1153
 
958
1154
  ---
959
1155
 
1156
+ ## Inbox
1157
+
1158
+ The `inbox` command group manages inter-agent messaging. Agents use inbox messages to assign work, request reviews, share information, and carry on structured conversations.
1159
+
1160
+ ### `brainclaw inbox list`
1161
+
1162
+ List inbox messages. Defaults to pending messages only for the current agent.
1163
+
1164
+ | Option | Description |
1165
+ |---|---|
1166
+ | `--agent <name>` | Agent name |
1167
+ | `--status <status>` | Filter by status: `pending`, `read`, `acknowledged`, `archived` |
1168
+ | `--type <type>` | Filter by type: `assign`, `review`, `rfc`, `info`, `reply` |
1169
+ | `--thread <id>` | Filter by thread ID |
1170
+ | `--all` | Show all messages, not just pending |
1171
+ | `--json` | Output as JSON |
1172
+
1173
+ ```bash
1174
+ brainclaw inbox list
1175
+ brainclaw inbox list --all
1176
+ brainclaw inbox list --status acknowledged --agent copilot
1177
+ brainclaw inbox list --type assign --json
1178
+ ```
1179
+
1180
+ ### `brainclaw inbox ack <id>`
1181
+
1182
+ Acknowledge a message to confirm receipt.
1183
+
1184
+ | Option | Description |
1185
+ |---|---|
1186
+ | `--agent <name>` | Agent name |
1187
+ | `--json` | Output as JSON |
1188
+
1189
+ ```bash
1190
+ brainclaw inbox ack msg_abc123
1191
+ brainclaw inbox ack msg_abc123 --agent copilot
1192
+ ```
1193
+
1194
+ ### `brainclaw inbox archive <id>`
1195
+
1196
+ Archive a message to remove it from the active inbox.
1197
+
1198
+ | Option | Description |
1199
+ |---|---|
1200
+ | `--agent <name>` | Agent name |
1201
+ | `--json` | Output as JSON |
1202
+
1203
+ ```bash
1204
+ brainclaw inbox archive msg_abc123
1205
+ brainclaw inbox archive msg_abc123 --json
1206
+ ```
1207
+
1208
+ ### `brainclaw inbox send <to> <text>`
1209
+
1210
+ Send a message to another agent.
1211
+
1212
+ | Option | Description |
1213
+ |---|---|
1214
+ | `--type <type>` | Message type: `assign`, `review`, `rfc`, `info`, `reply` (default: `info`) |
1215
+ | `--ref <id>` | Reference to a plan, sequence, or other entity |
1216
+ | `--scope <path>` | File scope |
1217
+ | `--thread <id>` | Thread ID for conversations |
1218
+ | `--ack` | Require acknowledgment from the recipient |
1219
+ | `--agent <name>` | Sender agent name |
1220
+ | `--json` | Output as JSON |
1221
+
1222
+ ```bash
1223
+ brainclaw inbox send copilot "Please review the auth module changes"
1224
+ brainclaw inbox send codex "Ready for review" --type review --ref hnd_001
1225
+ brainclaw inbox send alice "Blocked on payments integration" --type rfc --ack
1226
+ brainclaw inbox send copilot "Reply on thread" --type reply --thread thr_001
1227
+ ```
1228
+
1229
+ ### `brainclaw inbox thread <id>`
1230
+
1231
+ Show all messages in a thread, in chronological order.
1232
+
1233
+ | Option | Description |
1234
+ |---|---|
1235
+ | `--json` | Output as JSON |
1236
+
1237
+ ```bash
1238
+ brainclaw inbox thread thr_001
1239
+ brainclaw inbox thread thr_001 --json
1240
+ ```
1241
+
1242
+ ---
1243
+
960
1244
  ## Context and Agents
961
1245
 
962
1246
  ### `brainclaw context`
@@ -1107,12 +1391,15 @@ Mark the end of an agent work session.
1107
1391
  | `--summary <text>` | Summary of work done |
1108
1392
  | `--auto-reflect` | Automatically reflect runtime notes from the session |
1109
1393
  | `--auto-release` | Automatically release all claims held during the session |
1110
- | `--reflect-handoff` | Reflect any open handoffs as candidates |
1394
+ | `--reflect-handoff` | Materialize an open handoff from git commits since session start |
1395
+ | `--dispatch-review` | When used with `--reflect-handoff`, auto-dispatch a code review if the handoff is reviewable |
1396
+ | `--reviewer <name>` | Explicit reviewer for the reflected handoff review |
1111
1397
  | `--json` | Output as JSON |
1112
1398
 
1113
1399
  ```bash
1114
1400
  brainclaw session-end --auto-release
1115
1401
  brainclaw session-end --session sess_42 --summary "Completed auth refactor" --auto-reflect --auto-release
1402
+ brainclaw session-end --auto-release --reflect-handoff --dispatch-review --reviewer codex
1116
1403
  ```
1117
1404
 
1118
1405
  ---
@@ -1229,6 +1516,32 @@ brainclaw check-constraints --staged
1229
1516
  brainclaw check-constraints --files src/payments/index.ts --json
1230
1517
  ```
1231
1518
 
1519
+ ### `brainclaw check-policy`
1520
+
1521
+ Pre-execution policy check. Verifies claims, constraints, traps, and governance instructions for a given scope. Returns blocks (hard stops) and warnings (context to consider).
1522
+
1523
+ | Option | Description |
1524
+ |---|---|
1525
+ | `--scope <path>` | **(required)** File or directory scope to check |
1526
+ | `--agent <name>` | Agent name to check claims for |
1527
+ | `--agent-id <id>` | Agent ID to check claims for |
1528
+ | `--action <type>` | Intended action: edit, create, delete (informational) |
1529
+ | `--json` | Output as JSON |
1530
+
1531
+ **Checks performed (deterministic, no AI):**
1532
+ - **Claim check** — Does the agent have an active claim on the scope? (BLOCK if not)
1533
+ - **Claim conflict** — Is the scope claimed by another agent? (BLOCK)
1534
+ - **Constraint check** — Do active constraints with matching `related_paths` apply? (WARN)
1535
+ - **Trap check** — Are there active traps with matching `related_paths`? (WARN)
1536
+ - **Governance context** — Active global/project instructions are displayed for reference.
1537
+
1538
+ ```bash
1539
+ brainclaw check-policy --scope src/core/auth.ts --agent claude-code
1540
+ brainclaw check-policy --scope src/commands --json
1541
+ ```
1542
+
1543
+ Exit code: 0 if allowed, 1 if blocked. Also available as MCP tool `bclaw_check_policy`.
1544
+
1232
1545
  ---
1233
1546
 
1234
1547
  ## Sync and Distribution
@@ -1283,6 +1596,95 @@ brainclaw push --remote origin --message "chore: push memory state" --json
1283
1596
 
1284
1597
  ---
1285
1598
 
1599
+ ## Federation
1600
+
1601
+ The `federation` command group manages cloud signal exchange with `app.brainclaw.dev`. Federation requires `BRAINCLAW_CLOUD_API_KEY` to be set. It is a planned premium tier for cross-machine and cross-organization coordination.
1602
+
1603
+ ### `brainclaw federation push <message>`
1604
+
1605
+ Push a test signal to the cloud. The signal is sent from the current project and agent to a target project or broadcast address.
1606
+
1607
+ | Option | Description |
1608
+ |---|---|
1609
+ | `--type <type>` | Signal type (default: `runtime_note`). Accepted values: `signal`, `handoff`, `candidate`, `runtime_note`, `board_snapshot` |
1610
+ | `--to-project <project>` | Target project name (default: `broadcast`) |
1611
+ | `--to-agent <agent>` | Target agent name |
1612
+
1613
+ ```bash
1614
+ brainclaw federation push "Auth rollout complete" --to-project lodestar
1615
+ brainclaw federation push "Blocked on payments" --type runtime_note --to-agent copilot
1616
+ ```
1617
+
1618
+ ### `brainclaw federation pull`
1619
+
1620
+ Pull signals from the cloud inbox for the current agent.
1621
+
1622
+ | Option | Description |
1623
+ |---|---|
1624
+ | `--agent <name>` | Agent name to pull for (default: auto-detected) |
1625
+ | `--since <date>` | Only pull signals after this ISO date |
1626
+ | `--limit <n>` | Maximum number of signals to pull (default: 20) |
1627
+
1628
+ ```bash
1629
+ brainclaw federation pull
1630
+ brainclaw federation pull --since 2026-04-01
1631
+ brainclaw federation pull --agent copilot --limit 50
1632
+ ```
1633
+
1634
+ ### `brainclaw federation status`
1635
+
1636
+ Check cloud federation configuration: shows the configured cloud URL, whether the API key is set, and pings the cloud health endpoint if configured.
1637
+
1638
+ ```bash
1639
+ brainclaw federation status
1640
+ ```
1641
+
1642
+ ---
1643
+
1644
+ ## Cross-project links
1645
+
1646
+ The `link` command group manages local cross-project federation peers — entries stored under `cross_project_links` in `.brainclaw/config.yaml`. These are the targets used by `bclaw_write_note --crossProject`, `bclaw_create(entity='handoff', targetProject=…)`, and the runtime cross-project signal writers in `src/core/cross-project.ts`.
1647
+
1648
+ The same entity surface is available through the canonical grammar: `bclaw_create / find / get / update / remove(entity='cross_project_link')`.
1649
+
1650
+ ### `brainclaw link add <path>`
1651
+
1652
+ Register a sibling project as a federation peer. The path is validated to point at an existing brainclaw-initialised directory; the link `name` is auto-derived from the linked project's `project_name` (or its basename) unless `--name` is passed.
1653
+
1654
+ | Option | Description |
1655
+ |---|---|
1656
+ | `--name <slug>` | Override the auto-derived name |
1657
+ | `--role <role>` | `publisher` (push signals out) or `subscriber` (default, read-only) |
1658
+ | `--channels <list>` | Comma-separated allow-list: `candidate,handoff,runtime_note` |
1659
+ | `--force` | Replace an existing link of the same name/path |
1660
+ | `--json` | Emit the resulting link entry as JSON |
1661
+
1662
+ ```bash
1663
+ brainclaw link add ../brainclaw-cloud
1664
+ brainclaw link add ../brainclaw-site --role publisher --channels candidate,handoff
1665
+ brainclaw link add ../brainclaw-cloud --role publisher --force
1666
+ ```
1667
+
1668
+ ### `brainclaw link list`
1669
+
1670
+ Show every configured cross-project link with its resolved absolute path, role, and availability marker (`✓` if the target directory exists and is brainclaw-initialised).
1671
+
1672
+ ```bash
1673
+ brainclaw link list
1674
+ brainclaw link list --json
1675
+ ```
1676
+
1677
+ ### `brainclaw link remove <name|path>`
1678
+
1679
+ Drop a link from the config. Matches by name, exact `path`, resolved absolute path, or basename of the resolved path — the same matcher used by `resolveCrossProjectTarget`.
1680
+
1681
+ ```bash
1682
+ brainclaw link remove brainclaw-cloud
1683
+ brainclaw link remove ../brainclaw-site
1684
+ ```
1685
+
1686
+ ---
1687
+
1286
1688
  ## Monitoring and Maintenance
1287
1689
 
1288
1690
  ### `brainclaw watch`
@@ -1326,6 +1728,44 @@ Remove expired memory items.
1326
1728
  brainclaw prune --expired
1327
1729
  ```
1328
1730
 
1731
+ ### `brainclaw compact`
1732
+
1733
+ LLM-driven semantic memory compaction. Archives old items that are superseded or low-signal and provides a summary template for review. Use `--assess` to see what would be compacted before committing.
1734
+
1735
+ | Option | Description |
1736
+ |---|---|
1737
+ | `--assess` | Show pressure assessment and compaction template without archiving |
1738
+ | `--dry-run` | Preview eligible items without archiving |
1739
+ | `--max-items <n>` | Maximum items to compact (default: 20) |
1740
+ | `--min-age <days>` | Minimum age in days for eligibility (default: 7) |
1741
+
1742
+ ```bash
1743
+ brainclaw compact --assess
1744
+ brainclaw compact --dry-run
1745
+ brainclaw compact --max-items 10 --min-age 14
1746
+ ```
1747
+
1748
+ ### `brainclaw refresh`
1749
+
1750
+ Refresh live companion files with current state (plans, claims, traps, sequences). These files are gitignored and safe to run frequently. Use this after a bulk memory operation or when an agent's companion view may be stale.
1751
+
1752
+ ```bash
1753
+ brainclaw refresh
1754
+ ```
1755
+
1756
+ ### `brainclaw patch-configs`
1757
+
1758
+ Patch all MCP config files to use the current brainclaw binary path. Run this after reinstalling or moving the brainclaw binary to ensure all agent MCP integrations point to the correct executable.
1759
+
1760
+ | Option | Description |
1761
+ |---|---|
1762
+ | `--json` | Output as JSON |
1763
+
1764
+ ```bash
1765
+ brainclaw patch-configs
1766
+ brainclaw patch-configs --json
1767
+ ```
1768
+
1329
1769
  ### `brainclaw rollback`
1330
1770
 
1331
1771
  Roll back a memory item to a previous state.
@@ -1344,7 +1784,7 @@ brainclaw rollback --audit-id aud_042 --json
1344
1784
 
1345
1785
  ### `brainclaw audit`
1346
1786
 
1347
- Show the audit log of memory changes.
1787
+ Show the audit log of memory changes, or generate a governance posture report.
1348
1788
 
1349
1789
  | Option | Description |
1350
1790
  |---|---|
@@ -1352,11 +1792,25 @@ Show the audit log of memory changes.
1352
1792
  | `--actor <name>` | Filter by actor |
1353
1793
  | `--action <type>` | Filter by action type |
1354
1794
  | `--limit <n>` | Maximum number of entries |
1795
+ | `--governance` | Generate an aggregated governance posture report instead of chronological log |
1796
+ | `--scope <path>` | Filter governance report by scope (used with `--governance`) |
1355
1797
  | `--json` | Output as JSON |
1356
1798
 
1799
+ **Chronological mode (default):** Shows individual audit entries with timestamp, actor, action, and scope.
1800
+
1801
+ **Governance mode (`--governance`):** Produces an aggregated posture report:
1802
+ - Active global instructions ("constitution vivante")
1803
+ - Constraints by category ("red lines")
1804
+ - Claims by agent, expired claims needing release
1805
+ - Open traps by severity
1806
+ - Mutations without claim (last 24h)
1807
+ - Actionable recommendations
1808
+
1357
1809
  ```bash
1358
1810
  brainclaw audit --since 2026-03-01 --actor copilot
1359
1811
  brainclaw audit --action accept --limit 20 --json
1812
+ brainclaw audit --governance
1813
+ brainclaw audit --governance --json
1360
1814
  ```
1361
1815
 
1362
1816
  ### `brainclaw history <id>`
@@ -1382,39 +1836,43 @@ brainclaw mcp
1382
1836
 
1383
1837
  #### Available MCP tools
1384
1838
 
1385
- **Read tools** (no trust requirement):
1386
-
1387
- | Tool | Description |
1388
- |---|---|
1389
- | `bclaw_get_context` | Full workspace context (constraints, decisions, traps, plans, handoffs) |
1390
- | `bclaw_bootstrap` | Derive brownfield bootstrap signals from repo docs and git history |
1391
- | `bclaw_get_execution_context` | Inspect local execution environment and agent tooling signals |
1392
- | `bclaw_read_handoff` | Read an open handoff ticket with git diff and state snapshot |
1393
- | `bclaw_get_agent_board` | Live plan + claim board with active sessions |
1394
- | `bclaw_search` | Full-text BM25 search across all memory items |
1395
- | `bclaw_estimation_report` | Estimation accuracy report for completed plans |
1396
- | `bclaw_list_plans` | List plan items with filters, pagination (`limit`/`offset`), `compact` mode, and direct `id` lookup |
1397
- | `bclaw_list_claims` | List claims with the same filters as `brainclaw claim list` |
1398
- | `bclaw_list_agents` | List registered agents, optionally with bounded reputation summaries |
1399
- | `bclaw_list_instructions` | List raw or resolved shared instructions |
1400
- | `bclaw_list_candidates` | List pending or archived review candidates |
1401
-
1402
- **Write tools** (contributor trust or above):
1403
-
1404
- | Tool | Description |
1405
- |---|---|
1406
- | `bclaw_write_note` | Add a runtime note (supports TTL and auto-reflect) |
1407
- | `bclaw_create_candidate` | Create a memory candidate (decision, constraint, trap, handoff) |
1408
- | `bclaw_accept` | Accept a pending candidate into canonical memory |
1409
- | `bclaw_reject` | Reject a pending candidate |
1410
- | `bclaw_claim` | Claim a work scope (advisory lock) |
1411
- | `bclaw_release_claim` | Release a claim, optionally updating the linked plan status |
1412
- | `bclaw_session_start` | Start an agent session and register identity |
1413
- | `bclaw_session_end` | End session, optionally auto-reflect notes as candidates |
1414
- | `bclaw_create_plan` | Create a new plan item |
1415
- | `bclaw_update_plan` | Update plan status, actual effort, priority, or assignee |
1416
- | `bclaw_add_step` | Add a sub-step to a plan item |
1417
- | `bclaw_complete_step` | Mark a plan sub-step as done |
1839
+ The default catalog is intentionally small and centred on the canonical grammar. The full live tool list is the source of truth — see [`docs/integrations/mcp.md`](integrations/mcp.md) and [`docs/concepts/mcp-governance.md`](concepts/mcp-governance.md) for the complete catalog, tier rules, and stability contract.
1840
+
1841
+ **Entry facades** start here:
1842
+
1843
+ | Tool | Purpose |
1844
+ |---|---|
1845
+ | `bclaw_work(intent)` | Start a session, load context, and (for `intent="execute"`) claim a scope in one call. Returns a compact payload by default (pass `compact: false` for the full context). |
1846
+ | `bclaw_context(kind)` | Unified context read: `kind` is one of `memory`, `execution`, `board`, `board_summary`, or `delta`. |
1847
+
1848
+ **Canonical grammar** your main tool for working with memory entities (plan, decision, constraint, trap, handoff, runtime_note, candidate, claim, action, assignment, agent_run):
1849
+
1850
+ | Tool | Purpose |
1851
+ |---|---|
1852
+ | `bclaw_find(entity, filter?)` | List entities of a given type with optional filters and pagination. |
1853
+ | `bclaw_get(entity, id)` | Read a single entity by id. |
1854
+ | `bclaw_create(entity, data)` | Create a new entity (plan, decision, constraint, trap, handoff, candidate, runtime_note, …). |
1855
+ | `bclaw_update(entity, id, patch)` | Edit an entity in place. |
1856
+ | `bclaw_remove(entity, id, purge?)` | Soft-delete (or purge) an entity. |
1857
+ | `bclaw_transition(entity, id, to)` | Change an entity's status (e.g. plan `todo` → `in_progress` → `done`, candidate `pending` → `accepted`). |
1858
+
1859
+ **Multi-agent coordination** (escalation path when delegating to other agents):
1860
+
1861
+ | Tool | Purpose |
1862
+ |---|---|
1863
+ | `bclaw_coordinate(intent)` | Assign, consult, review, reroute, or summarize across agents. Pass `open_loop: true` on `intent="review"` to also dispatch the reviewer turn. |
1864
+ | `bclaw_dispatch(intent)` | Parallelize execute across a sequence's lanes (analysis / execute / review). |
1865
+ | `bclaw_loop(intent)` | Drive a turn in an existing multi-turn loop (`turn`, `complete_turn`, `advance`, `close`). Do not call `bclaw_loop(intent="open")` directly without dispatch — use `bclaw_coordinate(intent="review", open_loop: true)` instead. |
1866
+
1867
+ **Session, claims, plans, handoffs**:
1868
+
1869
+ `bclaw_session_start`, `bclaw_session_end`, `bclaw_claim`, `bclaw_release_claim`, `bclaw_add_step`, `bclaw_complete_step`, `bclaw_update_step`, `bclaw_delete_step`, `bclaw_read_inbox`, `bclaw_ack_message`, `bclaw_send_message`, `bclaw_correct_handoff`.
1870
+
1871
+ **Notes, search, setup, navigation**:
1872
+
1873
+ `bclaw_write_note`, `bclaw_quick_capture`, `bclaw_search`, `bclaw_setup`, `bclaw_bootstrap`, `bclaw_switch`, `bclaw_release_notes`, `bclaw_doctor`.
1874
+
1875
+ **Legacy per-entity tools** (`bclaw_list_plans` / `bclaw_list_claims` / `bclaw_list_candidates` / `bclaw_list_sequences`, `bclaw_get_context` / `bclaw_get_execution_context` / `bclaw_get_agent_board`, `bclaw_create_plan` / `bclaw_create_candidate`, `bclaw_update_plan` / `bclaw_update_handoff` / `bclaw_update_memory`, `bclaw_read_handoff` / `bclaw_delete_memory`, `bclaw_accept` / `bclaw_reject`, `bclaw_dispatch_analysis` / `bclaw_dispatch_review`, and others) were removed from the discoverable catalog at v1.0. Direct calls still succeed as a migration escape hatch but emit a redirect warning pointing at the canonical grammar. The full removal list and replacement map lives in [`docs/mcp-schema-changelog.md`](mcp-schema-changelog.md) under the v1.0 "Removed" section. Raw MCP clients can request the full advanced catalog with `tools/list` params `{ catalog: "all" }`.
1418
1876
 
1419
1877
  ---
1420
1878
 
@@ -1442,4 +1900,193 @@ brainclaw version --publish-local --release-notes "Add estimation-report command
1442
1900
  - if `brainclaw_update_source` is configured, use it
1443
1901
  - otherwise, fall back to the public npm channel `brainclaw@latest`
1444
1902
 
1903
+ If the release changes CLI, MCP, or context-schema behavior, run the release checklist in [release-maintenance.md](release-maintenance.md) before `--publish-local`.
1904
+
1905
+ ### `brainclaw release-notes`
1906
+
1907
+ Generate agent-first release notes from git history.
1908
+
1909
+ | Option | Description |
1910
+ |---|---|
1911
+ | `--from <ref>` | Base git ref (default: latest tag) |
1912
+ | `--json` | Output as JSON |
1913
+
1914
+ ---
1915
+
1916
+ ## Additional Operational Commands
1917
+
1918
+ ### `brainclaw uninstall`
1919
+
1920
+ Remove brainclaw from a project and/or machine. Cleans up generated agent files, hooks, and MCP configurations.
1921
+
1922
+ | Option | Description |
1923
+ |---|---|
1924
+ | `--global` | Also uninstall the global npm package |
1925
+ | `--keep-memory` | Remove agent files but preserve `.brainclaw/` memory |
1926
+ | `--json` | Output as JSON |
1927
+
1928
+ ### `brainclaw discover`
1929
+
1930
+ Scan the workspace for MCP configs, instruction files, skills, hooks, and agent integrations. Produces a structured discovery profile saved to `.brainclaw/discovery/`.
1931
+
1932
+ | Option | Description |
1933
+ |---|---|
1934
+ | `--refresh` | Force a fresh scan even if a cached profile exists |
1935
+ | `--no-save` | Do not persist the discovery profile |
1936
+ | `--json` | Output as JSON |
1937
+
1938
+ ### `brainclaw migrate`
1939
+
1940
+ Migrate memory items between stores (e.g. promote machine-scoped items to user store).
1941
+
1942
+ | Option | Description |
1943
+ |---|---|
1944
+ | `--dry-run` | Show what would be migrated without making changes |
1945
+ | `--json` | Output as JSON |
1946
+
1947
+ ### `brainclaw runtime-status`
1948
+
1949
+ Show runtime notes.
1950
+
1951
+ | Option | Description |
1952
+ |---|---|
1953
+ | `--agent <agent>` | Filter by agent |
1954
+ | `--plan <id>` | Filter by linked plan item |
1955
+ | `--visibility <visibility>` | Visibility filter: `shared`, `machine`, `private`, `all` |
1956
+ | `--host <host>` | Include machine-local notes for a specific host |
1957
+ | `--all-hosts` | Include machine-local notes from all hosts |
1958
+ | `--json` | Output as JSON |
1959
+
1960
+ ### `brainclaw check-security`
1961
+
1962
+ Check supply chain security scores for packages via Socket.dev.
1963
+
1964
+ | Option | Description |
1965
+ |---|---|
1966
+ | `--packages <names>` | Comma-separated package names such as `axios,express` or `axios@1.14.1` |
1967
+ | `--ecosystem <type>` | Package ecosystem: `npm` or `pypi` |
1968
+ | `--json` | Output as JSON |
1969
+
1970
+ ### `brainclaw setup-security`
1971
+
1972
+ Enable the supply chain security gate by generating wrapper scripts and configuring preinstall checks.
1973
+
1974
+ | Option | Description |
1975
+ |---|---|
1976
+ | `--mode <mode>` | Security mode: `advisory` or `enforced` |
1977
+
1978
+ ### `brainclaw worktree`
1979
+
1980
+ Manage Git worktrees for stronger agent isolation.
1981
+
1982
+ Subcommands:
1983
+
1984
+ - `brainclaw worktree create <branch>` — create a linked worktree for a branch
1985
+ - `brainclaw worktree list` — list known worktrees for the current project
1986
+ - `brainclaw worktree remove <path>` — remove a linked worktree
1987
+ - `brainclaw worktree prune` — prune stale Git worktree administrative files
1988
+ - `brainclaw worktree clean` — remove merged worktrees and orphan directories
1989
+ - `brainclaw worktree merge <branch>` — merge a worktree branch with auto-restoration
1990
+
1991
+ `create` options:
1992
+
1993
+ | Option | Description |
1994
+ |---|---|
1995
+ | `--session-id <id>` | Associate the worktree with a brainclaw session |
1996
+ | `--agent <name>` | Associate the worktree with an agent name |
1997
+
1998
+ `remove` options:
1999
+
2000
+ | Option | Description |
2001
+ |---|---|
2002
+ | `--force` | Force removal even with uncommitted changes |
2003
+
2004
+ `clean` options:
2005
+
2006
+ | Option | Description |
2007
+ |---|---|
2008
+ | `--force` | Force removal even with uncommitted changes |
2009
+ | `--dry-run` | Show what would be removed without actually removing |
2010
+
2011
+ `merge` options:
2012
+
2013
+ | Option | Description |
2014
+ |---|---|
2015
+ | `-m, --message <message>` | Merge commit message |
2016
+ | `--dry-run` | Show what would be merged without committing |
2017
+
2018
+ ```bash
2019
+ brainclaw worktree clean --dry-run
2020
+ brainclaw worktree clean --force
2021
+ brainclaw worktree merge feat/my-feature
2022
+ brainclaw worktree merge feat/my-feature --dry-run
2023
+ ```
2024
+
2025
+ ### `brainclaw memory-log`
2026
+
2027
+ Show recent memory change history from the internal git repo.
2028
+
2029
+ | Option | Description |
2030
+ |---|---|
2031
+ | `-n, --limit <count>` | Number of entries to show |
2032
+
2033
+ ### `brainclaw memory-rollback <ref>`
2034
+
2035
+ Restore only the current project's live Brainclaw memory to a previous git snapshot. This command is reserved to registered human identities and preserves durable audit logs, archives, compaction outputs, and backups instead of performing a full destructive reset. Use `memory-log` to find valid refs.
2036
+
2037
+ | Option | Description |
2038
+ |---|---|
2039
+ | `--actor <name>` | Explicit registered human identity to authorize the rollback |
2040
+
2041
+ If no human identity is registered yet:
2042
+
2043
+ ```bash
2044
+ brainclaw register-agent <name> --kind human --set-current
2045
+ ```
2046
+
2047
+ ### `brainclaw agent-inventory`
2048
+
2049
+ Detect all installed AI coding agents and their capabilities on this machine.
2050
+
2051
+ | Option | Description |
2052
+ |---|---|
2053
+ | `--refresh` | Force regeneration even if an inventory already exists |
2054
+ | `--json` | Output as JSON |
2055
+
2056
+ ### `brainclaw projects`
2057
+
2058
+ List all brainclaw-initialized projects on this machine from the global registry.
2059
+
2060
+ | Option | Description |
2061
+ |---|---|
2062
+ | `--scan <roots>` | Comma-separated directories to scan for projects |
2063
+ | `--register` | Register the current project in the global registry |
2064
+ | `--json` | Output as JSON |
2065
+
2066
+ ### `brainclaw check-events`
2067
+
2068
+ Show unseen events from the event bus (`events.jsonl`) for the current agent.
2069
+
2070
+ | Option | Description |
2071
+ |---|---|
2072
+ | `--agent <name>` | Agent to check events for |
2073
+ | `--json` | Output as JSON |
2074
+
2075
+ ### `brainclaw who`
2076
+
2077
+ List active agent sessions on this workspace. Shows agent, user, project, claims count, and last activity.
2078
+
2079
+ | Option | Description |
2080
+ |---|---|
2081
+ | `--all` | Include stale sessions |
2082
+ | `--gc` | Remove stale sessions |
2083
+
2084
+ ### `brainclaw usage`
2085
+
2086
+ Show brainclaw context volume stats — tokens injected per agent and per MCP tool call.
2087
+
2088
+ | Option | Description |
2089
+ |---|---|
2090
+ | `--json` | Output as JSON |
2091
+
1445
2092
  This keeps end-user installs aware of published npm releases without requiring a local tarball channel. To keep beta testers on a different channel, set `brainclaw_update_source` to `type: npm` with a different `dist_tag`, such as `prelaunch`.