brainclaw 0.29.2 → 1.5.4

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 (197) hide show
  1. package/LICENSE +21 -74
  2. package/README.md +199 -176
  3. package/dist/brainclaw-vscode.vsix +0 -0
  4. package/dist/cli.js +710 -25
  5. package/dist/commands/accept.js +3 -0
  6. package/dist/commands/add-step.js +11 -26
  7. package/dist/commands/agent-board.js +70 -3
  8. package/dist/commands/audit.js +19 -0
  9. package/dist/commands/check-policy.js +54 -0
  10. package/dist/commands/check-security-mcp.js +145 -0
  11. package/dist/commands/check-security.js +106 -0
  12. package/dist/commands/claim-resource.js +1 -0
  13. package/dist/commands/codev.js +672 -0
  14. package/dist/commands/compact.js +74 -0
  15. package/dist/commands/complete-step.js +16 -26
  16. package/dist/commands/constraint.js +8 -20
  17. package/dist/commands/decision.js +9 -20
  18. package/dist/commands/delete-plan.js +10 -12
  19. package/dist/commands/delete-step.js +16 -0
  20. package/dist/commands/dispatch.js +163 -0
  21. package/dist/commands/doctor.js +1122 -49
  22. package/dist/commands/enable-agent.js +1 -0
  23. package/dist/commands/export.js +280 -22
  24. package/dist/commands/handoff.js +33 -0
  25. package/dist/commands/harvest.js +189 -0
  26. package/dist/commands/hooks.js +82 -25
  27. package/dist/commands/inbox.js +169 -0
  28. package/dist/commands/init.js +38 -31
  29. package/dist/commands/install-hooks.js +71 -44
  30. package/dist/commands/link.js +89 -0
  31. package/dist/commands/list-claims.js +48 -3
  32. package/dist/commands/list-plans.js +129 -25
  33. package/dist/commands/loops-handlers.js +409 -0
  34. package/dist/commands/mcp-read-handlers.js +1628 -0
  35. package/dist/commands/mcp-schemas.generated.js +269 -0
  36. package/dist/commands/mcp.js +4224 -1501
  37. package/dist/commands/plan-resource.js +64 -0
  38. package/dist/commands/plan.js +12 -26
  39. package/dist/commands/prune.js +37 -2
  40. package/dist/commands/reflect.js +20 -7
  41. package/dist/commands/release-claim.js +11 -6
  42. package/dist/commands/release-notes.js +170 -0
  43. package/dist/commands/repair.js +210 -0
  44. package/dist/commands/run-profile.js +57 -0
  45. package/dist/commands/sequence.js +113 -0
  46. package/dist/commands/session-end.js +423 -14
  47. package/dist/commands/session-start.js +214 -41
  48. package/dist/commands/setup-security.js +103 -0
  49. package/dist/commands/setup.js +42 -4
  50. package/dist/commands/stale.js +109 -0
  51. package/dist/commands/switch.js +100 -2
  52. package/dist/commands/trap.js +14 -31
  53. package/dist/commands/update-handoff.js +63 -4
  54. package/dist/commands/update-plan.js +21 -28
  55. package/dist/commands/update-step.js +37 -0
  56. package/dist/commands/upgrade.js +313 -6
  57. package/dist/commands/usage.js +102 -0
  58. package/dist/commands/version.js +20 -0
  59. package/dist/commands/who.js +33 -5
  60. package/dist/commands/worktree.js +105 -0
  61. package/dist/core/actions.js +315 -0
  62. package/dist/core/agent-capability.js +610 -17
  63. package/dist/core/agent-context.js +7 -1
  64. package/dist/core/agent-files.js +1169 -85
  65. package/dist/core/agent-integrations.js +160 -5
  66. package/dist/core/agent-inventory.js +2 -0
  67. package/dist/core/agent-profiles.js +93 -0
  68. package/dist/core/agent-registry.js +162 -30
  69. package/dist/core/agentrun-reconciler.js +345 -0
  70. package/dist/core/agentruns.js +424 -0
  71. package/dist/core/ai-agent-detection.js +31 -10
  72. package/dist/core/archival.js +77 -0
  73. package/dist/core/assignment-sweeper.js +82 -0
  74. package/dist/core/assignments.js +367 -0
  75. package/dist/core/audit.js +30 -0
  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 +381 -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/events.js +106 -2
  98. package/dist/core/execution-adapters.js +154 -0
  99. package/dist/core/execution-context.js +63 -0
  100. package/dist/core/execution-profile.js +270 -0
  101. package/dist/core/execution.js +255 -0
  102. package/dist/core/facade-schema.js +81 -0
  103. package/dist/core/federation-cloud.js +99 -0
  104. package/dist/core/federation-message.js +52 -0
  105. package/dist/core/federation-transport.js +65 -0
  106. package/dist/core/gc-semantic.js +482 -0
  107. package/dist/core/governance.js +247 -0
  108. package/dist/core/guards.js +19 -0
  109. package/dist/core/ideation.js +72 -0
  110. package/dist/core/identity.js +110 -25
  111. package/dist/core/ids.js +6 -0
  112. package/dist/core/input-validation.js +2 -2
  113. package/dist/core/instruction-templates.js +344 -136
  114. package/dist/core/io.js +90 -11
  115. package/dist/core/lock.js +6 -2
  116. package/dist/core/loops/brief-assembly.js +213 -0
  117. package/dist/core/loops/facade-schema.js +148 -0
  118. package/dist/core/loops/index.js +7 -0
  119. package/dist/core/loops/iteration-engine.js +139 -0
  120. package/dist/core/loops/lock.js +385 -0
  121. package/dist/core/loops/store.js +201 -0
  122. package/dist/core/loops/types.js +403 -0
  123. package/dist/core/loops/verbs.js +534 -0
  124. package/dist/core/markdown.js +15 -3
  125. package/dist/core/memory-compactor.js +432 -0
  126. package/dist/core/memory-git.js +152 -8
  127. package/dist/core/messaging.js +278 -0
  128. package/dist/core/migration.js +32 -1
  129. package/dist/core/mutation-pipeline.js +4 -2
  130. package/dist/core/operations/memory-mutation.js +129 -0
  131. package/dist/core/operations/memory-write.js +78 -0
  132. package/dist/core/operations/plan.js +190 -0
  133. package/dist/core/policy.js +169 -0
  134. package/dist/core/reputation.js +9 -3
  135. package/dist/core/schema.js +491 -6
  136. package/dist/core/search.js +21 -2
  137. package/dist/core/security-cache.js +71 -0
  138. package/dist/core/security-guard.js +152 -0
  139. package/dist/core/security-scoring.js +86 -0
  140. package/dist/core/sequence.js +130 -0
  141. package/dist/core/socket-client.js +113 -0
  142. package/dist/core/staleness.js +246 -0
  143. package/dist/core/state.js +98 -22
  144. package/dist/core/store-resolution.js +43 -11
  145. package/dist/core/toml-writer.js +76 -0
  146. package/dist/core/upgrades/backup.js +232 -0
  147. package/dist/core/upgrades/health-check.js +169 -0
  148. package/dist/core/upgrades/patches/candidate-archive.js +145 -0
  149. package/dist/core/upgrades/patches/handoff-review-strip.js +128 -0
  150. package/dist/core/upgrades/patches/provenance-rollout.js +136 -0
  151. package/dist/core/upgrades/schema-version.js +97 -0
  152. package/dist/core/worktree.js +606 -0
  153. package/dist/facts.js +114 -0
  154. package/dist/facts.json +111 -0
  155. package/docs/architecture/project-refs.md +5 -1
  156. package/docs/cli.md +690 -43
  157. package/docs/concepts/ideation-loop.md +317 -0
  158. package/docs/concepts/loop-engine.md +456 -0
  159. package/docs/concepts/mcp-governance.md +268 -0
  160. package/docs/concepts/memory-staleness.md +122 -0
  161. package/docs/concepts/multi-agent-workflows.md +166 -0
  162. package/docs/concepts/plans-and-claims.md +31 -6
  163. package/docs/concepts/project-md-convention.md +35 -0
  164. package/docs/concepts/troubleshooting.md +220 -0
  165. package/docs/concepts/upgrade-cli.md +202 -0
  166. package/docs/concepts/upgrade-dogfood-procedure.md +114 -0
  167. package/docs/context-format-changelog.md +2 -2
  168. package/docs/context-format.md +2 -2
  169. package/docs/index.md +68 -0
  170. package/docs/integrations/agents.md +15 -16
  171. package/docs/integrations/cline.md +88 -0
  172. package/docs/integrations/codex.md +75 -23
  173. package/docs/integrations/continue.md +60 -0
  174. package/docs/integrations/copilot.md +67 -9
  175. package/docs/integrations/kilocode.md +72 -0
  176. package/docs/integrations/mcp.md +304 -21
  177. package/docs/integrations/mistral-vibe.md +122 -0
  178. package/docs/integrations/opencode.md +84 -0
  179. package/docs/integrations/overview.md +23 -8
  180. package/docs/integrations/roo.md +74 -0
  181. package/docs/integrations/windsurf.md +83 -0
  182. package/docs/mcp-schema-changelog.md +191 -1
  183. package/docs/playbooks/integration/index.md +121 -0
  184. package/docs/playbooks/productivity/index.md +102 -0
  185. package/docs/playbooks/team/index.md +122 -0
  186. package/docs/product/agent-first-model.md +184 -0
  187. package/docs/product/entity-model-audit.md +462 -0
  188. package/docs/product/positioning.md +10 -10
  189. package/docs/quickstart-existing-project.md +135 -0
  190. package/docs/quickstart.md +124 -37
  191. package/docs/release-maintenance.md +79 -0
  192. package/docs/review.md +2 -0
  193. package/docs/server-operations.md +118 -0
  194. package/package.json +21 -13
  195. package/dist/commands/claude-desktop-extension.js +0 -18
  196. package/dist/commands/diff.js +0 -99
  197. package/dist/core/claude-desktop-extension.js +0 -224
@@ -0,0 +1,74 @@
1
+ # Roo Integration
2
+
3
+ brainclaw integrates with Roo through MCP tools and project-scoped rules, providing shared memory, plans, and multi-agent coordination.
4
+
5
+ ## Auto-setup
6
+
7
+ `brainclaw init` detects Roo and writes `.roo/rules/brainclaw.md` automatically. Or manually:
8
+
9
+ ```bash
10
+ brainclaw export --format roo-rules --write
11
+ ```
12
+
13
+ ## MCP configuration
14
+
15
+ Roo reads MCP servers from `.roo/mcp.json` (project-scoped) or the global `mcp_settings.json`. Add brainclaw:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "brainclaw": {
21
+ "command": "npx",
22
+ "args": ["-y", "brainclaw@latest", "mcp"]
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Permissions
29
+
30
+ Roo supports per-server auto-approval via `alwaysAllow` array, plus a global toggle:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "brainclaw": {
36
+ "command": "npx",
37
+ "args": ["-y", "brainclaw@latest", "mcp"],
38
+ "alwaysAllow": ["bclaw_context", "bclaw_work", "bclaw_find", "bclaw_get"]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ brainclaw emits `alwaysAllow` with all known tool names during setup.
45
+
46
+ ## Instruction files
47
+
48
+ - `.roo/instructions.md` — global instructions (Roo reads at session start)
49
+ - `.roo/rules/` — rule files, equivalent to `.clinerules/`
50
+ - `.rooignore` — file-level ignore patterns (respects `.gitignore` syntax)
51
+
52
+ Roo also supports mode-specific rules and skills (e.g., `skills-code/`, `skills-architect/`).
53
+
54
+ ## SKILL.md discovery
55
+
56
+ Roo auto-discovers skills from `.roo/skills/`, `.agents/skills/`, and `.claude/skills/`. A single `.agents/skills/brainclaw/SKILL.md` is picked up automatically.
57
+
58
+ ## Headless invocation
59
+
60
+ Roo headless is available via Cloud Agents only (no local CLI headless mode).
61
+
62
+ ## Invoke template
63
+
64
+ ```
65
+ # From within VS Code with Roo extension
66
+ # Use -y flag for auto-approve in supported contexts
67
+ ```
68
+
69
+ ## Caveats
70
+
71
+ - **No hooks**: Hook support is proposed but unreleased as of April 2026.
72
+ - **No local headless CLI**: Headless dispatch requires Roo Cloud Agents.
73
+ - **Cline family**: Roo is a Cline fork — config patterns are similar but paths differ (`.roo/` vs `.cline/`).
74
+ - **Windows/Linux**: Works via VS Code extension on all platforms.
@@ -0,0 +1,83 @@
1
+ # Windsurf Integration
2
+
3
+ brainclaw integrates with Windsurf through MCP tools and instruction rules, providing shared memory, plans, and coordination state to Cascade.
4
+
5
+ ## Auto-setup
6
+
7
+ `brainclaw init` detects Windsurf and writes `.windsurfrules` automatically. Or manually:
8
+
9
+ ```bash
10
+ brainclaw export --format windsurfrules --write
11
+ ```
12
+
13
+ ## MCP configuration
14
+
15
+ Windsurf reads MCP servers from a **machine-scoped** config file:
16
+
17
+ ```
18
+ ~/.codeium/windsurf/mcp_config.json
19
+ ```
20
+
21
+ Add brainclaw:
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "brainclaw": {
27
+ "command": "npx",
28
+ "args": ["-y", "brainclaw@latest", "mcp"]
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ Note: this is a global config — it applies to all Windsurf projects on the machine.
35
+
36
+ ## Permissions
37
+
38
+ Windsurf supports `alwaysAllow` as an array on each MCP server entry:
39
+
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "brainclaw": {
44
+ "command": "npx",
45
+ "args": ["-y", "brainclaw@latest", "mcp"],
46
+ "alwaysAllow": ["bclaw_context", "bclaw_work", "bclaw_find", "bclaw_get"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ brainclaw does not yet emit `alwaysAllow` for Windsurf automatically.
53
+
54
+ ## Instruction files
55
+
56
+ - `.windsurf/rules/*.md` — modern format (recommended), multiple rule files
57
+ - `.windsurfrules` — legacy single-file format (still supported)
58
+
59
+ brainclaw currently emits the legacy format. Modern `.windsurf/rules/` support is planned.
60
+
61
+ ## SKILL.md discovery
62
+
63
+ Windsurf uses `.windsurf/workflows/*.md` for slash-command workflows (12k char max). It does not auto-discover `.agents/skills/`. Skills must be wired as workflows manually.
64
+
65
+ ## Headless invocation
66
+
67
+ Windsurf does not offer a headless CLI. It runs as a Docker-based environment — no `-p` flag equivalent.
68
+
69
+ ## Invoke template
70
+
71
+ ```
72
+ # Windsurf is GUI-only — no CLI invoke
73
+ # Use within the Windsurf IDE (Cascade panel)
74
+ ```
75
+
76
+ ## Caveats
77
+
78
+ - **Machine-scoped MCP**: The config at `~/.codeium/windsurf/mcp_config.json` is global, not per-project. All projects share the same server list.
79
+ - **No hooks**: Cascade Hooks exist but are limited to logging — no pre-prompt injection.
80
+ - **Legacy format**: brainclaw currently writes `.windsurfrules` (single file). Modern `.windsurf/rules/` multi-file support is planned (P5).
81
+ - **No headless**: Cannot be used as a brainclaw dispatch target.
82
+ - **Plan Mode**: Windsurf's "megaplan" mode is separate from brainclaw plans — they don't conflict but don't interoperate.
83
+ - **Windows/Linux**: Works on all platforms via the Windsurf IDE.
@@ -2,9 +2,199 @@
2
2
 
3
3
  This document tracks all breaking and notable changes to the brainclaw MCP server protocol.
4
4
 
5
+ See [docs/concepts/mcp-governance.md](concepts/mcp-governance.md) for the
6
+ versioning rules, breaking-change policy, deprecation window, and tier
7
+ guarantees this changelog follows.
8
+
9
+ ---
10
+
11
+ ## Unreleased
12
+
13
+ **Changed — JSON Schema generation shift (pln#486, zod 4 migration)**
14
+ - Migration from zod 3.24 → 4.3.6 changes the introspection output that
15
+ feeds `tools/list`. Schemas are semantically equivalent but the emitted
16
+ JSON differs in incidental shape (key order, optional-property
17
+ encoding). MCP clients that snapshot or hash schemas should re-pin.
18
+ - Public surface fingerprint moves from `sha256:a479f710ff043ef6` (zod 3)
19
+ to `sha256:860fbaa30a486093` (zod 4). No tool was added, removed,
20
+ renamed, or had its required arguments change.
21
+
22
+ **Changed — `bclaw_loop(intent: 'open')` anti-pattern gate (pln#461)**
23
+ - New optional field `allow_orphan: boolean` on `BclawLoopOpenSchema`.
24
+ - Default (absent / `false`) — handler rejects with `validation_error`
25
+ and points to `bclaw_coordinate(intent: 'review', open_loop: true)`
26
+ as the recommended path. Prevents the "loop opened without
27
+ dispatch → no claim, no inbox, no agent picks it up" trap called
28
+ out in `CLAUDE.md`.
29
+ - `allow_orphan: true` — explicit acknowledgement that the caller
30
+ will drive `turn()` + dispatch manually (advanced / test use only).
31
+ - Internal callers (`bclaw_coordinate`, `bclaw_dispatch`) are not
32
+ affected — they bypass `handleBclawLoop` and invoke the core
33
+ `openLoop()` directly.
34
+
35
+ ---
36
+
37
+ ## 1.0.0 (current)
38
+
39
+ **Public launch candidate.** Phase 3 slice 3i of `pln_c6472192`.
40
+ Completes the canonical grammar refactor: canonical verbs promoted to
41
+ the default `standard` tier, legacy per-entity tools removed from the
42
+ discoverable surface.
43
+
44
+ **Changed — tier promotion**
45
+ All canonical verbs land in the default `standard` catalog:
46
+ - `bclaw_find`, `bclaw_get`, `bclaw_create`, `bclaw_update`,
47
+ `bclaw_remove`, `bclaw_transition`
48
+ - `bclaw_context(kind)` — memory / execution / board / board_summary / delta
49
+ - `bclaw_dispatch(intent)` — analysis / execute / review
50
+ - `bclaw_correct_handoff` — P6.1 tombstone for handoff corrections
51
+
52
+ **Breaking — legacy per-entity tools removed from the catalog**
53
+ The following tools are no longer returned by `tools/list` default or
54
+ `catalog: "standard"`. They were marked deprecated throughout the
55
+ 0.8.x window. Replacement is named in parentheses:
56
+
57
+ - `bclaw_list_plans` (→ `bclaw_find(entity: "plan")`)
58
+ - `bclaw_list_candidates` (→ `bclaw_find(entity: "candidate")`)
59
+ - `bclaw_list_claims` (→ `bclaw_find(entity: "claim")`)
60
+ - `bclaw_list_actions` (→ `bclaw_find(entity: "action")`)
61
+ - `bclaw_list_assignments` (→ `bclaw_find(entity: "assignment")`)
62
+ - `bclaw_list_runs` (→ `bclaw_find(entity: "agent_run")`)
63
+ - `bclaw_read_handoff` (→ `bclaw_get(entity: "handoff", id)`)
64
+ - `bclaw_create_plan` / `bclaw_create_candidate` (→ `bclaw_create`)
65
+ - `bclaw_update_plan` (→ `bclaw_update` + `bclaw_transition`)
66
+ - `bclaw_accept` / `bclaw_reject` (→ `bclaw_transition(entity: "candidate")`)
67
+ - `bclaw_get_execution_context` / `bclaw_get_agent_board` /
68
+ `bclaw_get_agent_board_summary` (→ `bclaw_context(kind)`)
69
+ - `bclaw_dispatch_analysis` / `bclaw_dispatch_review` (→ `bclaw_dispatch(intent)`)
70
+ - `bclaw_update_handoff` (→ `bclaw_correct_handoff` — P6.1 tombstone)
71
+
72
+ The tool *handlers* remain in place for now as defensive code — a
73
+ direct call by a non-MCP-compliant caller that bypasses `tools/list`
74
+ will still succeed. A follow-up PR will strip the dead handler code.
75
+
76
+ **Changed — versions**
77
+ - `SCHEMA_VERSION` bump: `0.8.0 → 1.0.0`
78
+ - `package.json` bump: `0.63.0 → 1.0.0`
79
+
80
+ **Changed — governance guard**
81
+ - `tests/unit/mcp-governance.test.ts` now checks that the current
82
+ changelog records the published MCP surface fingerprint. When a tool
83
+ name, tier, category, or input schema changes, the test fails until
84
+ this section is updated.
85
+ - MCP public surface fingerprint: `sha256:724085642dc3e2d7`
86
+
87
+ See `docs/integrations/mcp.md` for the full canonical surface + an
88
+ example gallery per verb. See `docs/concepts/mcp-governance.md` for
89
+ the stability contract now that v1.0 has shipped.
90
+
91
+ ---
92
+
93
+ ## 0.8.0
94
+
95
+ Phase 3 canonical grammar slices shipped under `pln_c6472192` (slices
96
+ 3a–3g). Every addition is behind `catalog: "all"` until the v1.0 cut
97
+ (slice 3i) promotes the new verbs to the default catalog and removes
98
+ the deprecated surface.
99
+
100
+ **Added (canonical CRUD verbs)**
101
+ - `bclaw_find(entity, filter?)` — list query with default provenance
102
+ filter (excludes `legacy` + `auto_reflect < 0.6`; override via
103
+ `filter.includeLegacy` / `filter.minAutoReflectConfidence`).
104
+ - `bclaw_get(entity, id)` — fetch by id or short_label.
105
+ - `bclaw_create(entity, data)` — auto-stamps provenance (kind: user
106
+ by default).
107
+ - `bclaw_update(entity, id, patch)` — rejects non-updatable fields
108
+ per EntityRegistry.
109
+ - `bclaw_remove(entity, id, purge?)` — archive (default) or purge.
110
+ - `bclaw_transition(entity, id, to, reason?)` — validated against
111
+ declarative transition matrix; returns side-effect tags.
112
+
113
+ **Added (unified intent dispatchers)**
114
+ - `bclaw_context(kind)` — unifies `bclaw_get_context` /
115
+ `_execution_context` / `_agent_board` / `_agent_board_summary`.
116
+ Adds `kind: "delta", since: <session_id>` for memory diffs (P6.4).
117
+ - `bclaw_dispatch(intent)` — intent discriminator over the existing
118
+ bclaw_dispatch tool. `analysis` / `execute` (default, legacy) /
119
+ `review` (with openLoop + reviewMode).
120
+ - `bclaw_correct_handoff(originalId, ...)` — P6.1 tombstone pattern.
121
+ Writes a correction handoff with `supersedes` / `superseded_by`
122
+ pointers; refuses to supersede already-superseded or closed
123
+ handoffs.
124
+
125
+ **Added (schema)**
126
+ - `Provenance` discriminated union: agent / auto_reflect / user /
127
+ loop_artifact / federation / correction / legacy. Exported from
128
+ `src/core/schema.ts`. Stamped on creates; federation-safe.
129
+ - `Handoff.superseded_by` and `Handoff.supersedes` — P6.1 tombstone
130
+ pointers, optional passthrough.
131
+
132
+ **Deprecated (19 tools)**
133
+ All redirects are non-breaking (old tools still work until slice 3i
134
+ removal). Warnings surface on every call through the
135
+ `executeMcpToolCall` exit wrapper:
136
+ - `bclaw_list_plans/candidates/claims/actions/assignments/runs` →
137
+ `bclaw_find(entity, filter)`
138
+ - `bclaw_read_handoff` → `bclaw_get(entity: "handoff", id)`
139
+ - `bclaw_create_plan/candidate` → `bclaw_create`
140
+ - `bclaw_update_plan` → `bclaw_update` / `bclaw_transition`
141
+ - `bclaw_accept/reject` → `bclaw_transition(entity: "candidate")`
142
+ - `bclaw_get_execution_context/_agent_board/_agent_board_summary` →
143
+ `bclaw_context(kind)`
144
+ - `bclaw_dispatch_analysis/_review` → `bclaw_dispatch(intent)`
145
+ - `bclaw_update_handoff` → `bclaw_correct_handoff` (P6.1)
146
+
147
+ ---
148
+
149
+ ## 0.7.0
150
+
151
+ Shipped in brainclaw app `0.63.0`. Consolidates the surface listed
152
+ below — previously accumulating under an inaccurate `SCHEMA_VERSION = '0.6.0'`
153
+ constant — and brings the runtime value in line with the documented
154
+ state. Governance cross-check now passes (see governance doc).
155
+
156
+ **Added (this landing)**
157
+ - `bclaw_doctor --after-migration` — post-v1-upgrade health check
158
+ reporting one finding per invariant (provenance coverage, handoff
159
+ review-strip, candidate archive, schema-version marker). Exits
160
+ non-zero on any failure.
161
+ - `brainclaw upgrade --to=1.0` — one-shot v1 schema migration
162
+ covering candidate archive (P6.6), handoff review-strip (P6.1
163
+ groundwork), provenance rollout (P6.3), schema-version bump
164
+ (0.6.0 → 0.8.0 in the store marker). Plus `--backup` /
165
+ `--no-backup` / `--rollback` flags.
166
+ - `provenance` optional passthrough field on Decision, Constraint,
167
+ Trap, Handoff, RuntimeNote — discriminated-union typing lands in
168
+ Phase 3 (`pln_c6472192 / 3f`). The declaration lets migration
169
+ patches stamp `{ kind: 'legacy' }` without Zod stripping it on
170
+ persist.
171
+
172
+ **Added (previously unreleased 0.7.0 surface)**
173
+ - `bclaw_check_policy` — pre-execution governance check for a scope
174
+ - Input: `scope` (required), `agent`, `agentId`, `action`
175
+ - Returns `allowed` boolean, `blocks[]` (hard stops), `warnings[]` (context)
176
+ - Checks: claim active, claim conflict, constraint matching, trap matching
177
+ - Returns `governance_context` with active instructions count, matching items
178
+ - `bclaw_audit` now supports `governance: true` parameter
179
+ - Returns aggregated posture report instead of chronological log
180
+ - Includes: constitution (global instructions), red lines (constraints by category), claims by agent, open traps by severity, mutations without claim, recommendations
181
+ - Supports `scope` filter for governance mode
182
+ - `bclaw_claim` response now includes automatic policy warnings
183
+ - Constraints and traps matching the claimed scope are surfaced as warnings
184
+ - No extra call needed — governance context is provided at claim time
185
+ - Enriched `AuditEntry` fields: `scope`, `session_id`, `host_id`
186
+ - Claim/release entries include the scope being claimed
187
+ - Session start/end entries include session and host IDs
188
+ - `promote_direct` and `trust_change` actions now propagated to events.jsonl
189
+
190
+ **Changed**
191
+ - MCP schema version bumped to 0.7.0
192
+ - Governance report filters machine/private traps — only shared-visibility traps affect project posture
193
+ - Audit chronological mode now shows `scope` field for claim actions
194
+
5
195
  ---
6
196
 
7
- ## 0.6.0 (current)
197
+ ## 0.6.0
8
198
 
9
199
  **Added**
10
200
  - `bclaw_get_capabilities` — list all registered project capabilities with optional filtering by category
@@ -0,0 +1,121 @@
1
+ # Audience: AI Builders
2
+
3
+ Design constraints for agents developing brainclaw features that serve agent integrators, tool builders, and enterprise AI governance teams.
4
+
5
+ ## Profiles
6
+
7
+ ### Agent Integrators
8
+ Developers building new coding agents, CLI wrappers, or AI-powered tools who want to leverage brainclaw's memory and coordination instead of building their own.
9
+
10
+ ### Enterprise AI Governance
11
+ IT and compliance teams who manage organizational policies across many AI agents on developer desktops. They need transparency, auditability, and control.
12
+
13
+ ## Design Constraints
14
+
15
+ These rules apply to any feature that touches this audience:
16
+
17
+ 1. **MCP is the integration contract.** External tools integrate through MCP (~60 published tools today; the canonical grammar — `bclaw_work`, `bclaw_context`, `bclaw_find/get/create/update/remove/transition` plus the multi-agent facades — is the stable surface), not by reading `.brainclaw/` files directly. The file-based store is an internal implementation detail. If an integration need cannot be met through MCP, the gap is a bug, not a reason to expose internals.
18
+
19
+ 2. **The MCP schema is a public API.** Breaking changes to tool signatures, context format, or response shapes require versioning and changelog entries (`docs/context-format-changelog.md`, `docs/mcp-schema-changelog.md`). Integrators depend on stability — every schema change has downstream cost. The context schema is versioned (`context_schema` field in every response).
20
+
21
+ 3. **Agent capability profiles must be factual.** The 3-tier system (A/B/C) in `agent-capability.ts` defines per-agent: MCP support, hooks, auto-approve, skills, instruction file path, invoke templates, role capabilities (execute/coordinate/review/consult), and delivery methods (inline_arg, temp_file, stdin_pipe, inbox_structured). Profiles can degrade at runtime (`agent-integrations.ts` assesses declared vs present surfaces) — Tier A can drop to B if hooks are missing, B to C if MCP is absent.
22
+
23
+ 4. **Security boundaries are non-negotiable.** brainclaw operates in the user's local filesystem. It must never expose file contents, memory, or coordination state beyond the project scope. Cross-project leakage is a security bug. The policy system (`bclaw_check_policy`) enforces boundaries with glob-based scope matching. `bclaw_check_security` provides supply chain risk scoring via Socket.dev for npm/pip packages.
24
+
25
+ 5. **Audit must be passive and complete.** Governance teams should not need to configure anything. The audit system (`audit.ts`) logs 30+ action types in JSONL with auto-rotation (10MB), captures actor/action/before-after/scope/session_id/host_id. The governance posture report (`bclaw_audit`) aggregates into constitution, red-lines, claim activity, and structured recommendations.
26
+
27
+ 6. **Integration must not require brainclaw-specific agent code.** The ideal integration is: add MCP server config, the agent discovers tools, the agent uses them. The facades (`bclaw_work`, `bclaw_coordinate`) simplify the MCP surface to 2 entry points for agents that don't need granular access.
28
+
29
+ ## Anti-Patterns
30
+
31
+ - Exposing `.brainclaw/` file structure as a stable interface (it is internal)
32
+ - Breaking MCP tool signatures without versioning
33
+ - Hardcoding agent-specific behavior in core brainclaw (use capability profiles instead)
34
+ - Storing sensitive data (tokens, credentials) in brainclaw memory or state
35
+ - Requiring agent-side code changes to use brainclaw (beyond MCP config)
36
+ - Shipping capability profiles that overstate what an agent can actually do
37
+ - Ignoring tier degradation — if an agent's surfaces drift, the effective tier must reflect reality
38
+
39
+ ## Key Features for This Audience
40
+
41
+ ### MCP Surface (primary integration point)
42
+ - MCP server (`brainclaw mcp`) — ~60 published tools over stdio (canonical grammar in the default catalog; the full advanced catalog available via `tools/list { catalog: "all" }`)
43
+ - `bclaw_work(intent)` — entry facade: session + context + claim in one call (returns a compact payload by default to stay under MCP token caps)
44
+ - `bclaw_context(kind)` — unified context read: `memory` / `execution` / `board` / `board_summary` / `delta`
45
+ - `bclaw_find` / `bclaw_get` / `bclaw_create` / `bclaw_update` / `bclaw_remove` / `bclaw_transition` — canonical CRUD across all entities
46
+ - `bclaw_coordinate(intent)` / `bclaw_dispatch(intent)` / `bclaw_loop(intent)` — multi-agent facades for assign / review / reroute / parallel execute / multi-turn loops
47
+ - Context format contract versioned via `context_schema` field
48
+
49
+ ### Agent Detection & Configuration
50
+ - Auto-detection via env vars (`ai-agent-detection.ts`): BRAINCLAW_AGENT, CLAUDE_CODE_VERSION, CURSOR_*, WINDSURF_*, CLINE_*, GITHUB_COPILOT_PRODUCT, home dir checks for 10+ agents
51
+ - AI surface inventory (`ai-surface-inventory.ts`): detects desktop apps, web surfaces, CLI agents with status (not_detected → brainclaw_ready) and capability flags (supports_mcp, remote_connectors, context_export, etc.)
52
+ - 3-tier capability system with runtime degradation assessment
53
+ - 14+ agent profiles with per-agent invoke templates and role capabilities
54
+ - `bclaw_get_discovery` — scan workspace for MCP configs, skills, hooks, integrations
55
+ - `bclaw_context(kind="execution")` — platform, shell, git, toolchains, env signals snapshot
56
+
57
+ ### Agent Profiles (reusable invocation templates)
58
+ - YAML profiles in `default-profiles/`: doctor, janitor, onboarder, reviewer
59
+ - Per-profile: trust_level, trigger (manual/auto), prompt template, invoke command
60
+ - User profiles override defaults; loaded via agent-profiles API
61
+ - `brainclaw run [profile-name]` — execute a profile
62
+
63
+ ### Security & Governance
64
+ - `bclaw_check_policy` — pre-execution scope compliance with glob matching
65
+ - `bclaw_check_security` — supply chain risk scoring via Socket.dev (pass/warn/block per package)
66
+ - `bclaw_audit` — governance posture report with structured recommendations
67
+ - `bclaw_history` — full mutation history per item with before/after snapshots
68
+ - Lifecycle trigger tags (`trigger:post-claim`, `trigger:pre-session-end`) for event-driven constraints
69
+
70
+ ### Cross-Project Federation
71
+ - Signal entities only: candidate, handoff, runtime_note (execution stays local)
72
+ - Schema-versioned federation messages with from_project/from_agent/target_project metadata
73
+ - Cycle detection (A→B→A prevention)
74
+ - CLI: `brainclaw federation push/pull/status`
75
+ - Inbox directory pattern: `coordination/inbox/cross-project/`
76
+
77
+ ### Versioning & Contracts
78
+ - Context format: `docs/context-format.md` + `docs/context-format-changelog.md`
79
+ - MCP schema: `docs/mcp-schema-changelog.md`
80
+ - Document schemas with migration support (`schema.ts`, `migration.ts`)
81
+ - `bclaw_release_notes` — agent-first release notes with breaking risk assessment
82
+
83
+ ## Known Gaps
84
+
85
+ Features this audience would naturally expect but that are not yet implemented:
86
+
87
+ ### No plugin/extension system
88
+ Tools added via `bclaw_add_tool` are metadata-only — they don't become callable MCP tools. There is no way for third parties to register executable MCP extensions, custom memory store backends, custom validators, or export format plugins without modifying brainclaw core. The architecture is monolithic.
89
+ **Impact:** Integrators must fork brainclaw to add domain-specific functionality.
90
+
91
+ ### No tool-level API versioning or deprecation
92
+ MCP protocol version exists (`2025-11-25` in `mcp.ts`), but individual tools have no version annotations. No compatibility negotiation ("client supports bclaw_work v2, server has v1.5"), no deprecation lifecycle (added/deprecated/removed dates), no feature flags for experimental tools.
93
+ **Impact:** Integrators discover breaking changes at runtime, not at integration time.
94
+
95
+ ### No real-time event streaming
96
+ The event log (`event-log.ts`) supports cursor-based polling but there are no WebSocket, SSE, or pub/sub subscriptions. Agents must poll every N seconds to discover changes. No event filtering ("only claim events from agent X").
97
+ **Impact:** Integrators building real-time dashboards or reactive agents must build their own polling + change detection.
98
+
99
+ ### No rate limiting or quota enforcement
100
+ No throttling or per-agent call budgets anywhere in the MCP handler path. `circuit-breaker.ts` exists but is unused. LLM-invoking tools (`bclaw_compact`, plus legacy experimental `codev` when enabled) have no usage limits. Agents can make unlimited calls.
101
+ **Impact:** A misbehaving agent can overwhelm the store or run up LLM costs without any guardrail.
102
+
103
+ ### Memory type system is closed
104
+ Fixed set of types: constraint, decision, trap, handoff, candidate, plan, sequence, runtime_note, instruction (`schema.ts`). Integrators cannot define custom types (e.g., "ProjectRisk", "DesignPattern") with custom fields. No type inheritance or middleware for custom validation.
105
+ **Impact:** Domain-specific knowledge must be shoehorned into generic types or stored as untyped notes.
106
+
107
+ ### No multi-tenant isolation beyond project boundaries
108
+ Isolation is project-directory level only. No team/department boundaries within a project, no role-based data visibility (all agents in a project see all memory), no data residency controls, no per-team audit segmentation.
109
+ **Impact:** Enterprise teams sharing a monorepo cannot enforce internal boundaries through brainclaw.
110
+
111
+ ### Token/cost tracking exists but has no enforcement
112
+ Usage tracking (`usage.ts`) records chars and estimated tokens per tool/agent, but there is no cost model ($/token), no quota enforcement ("agent X gets 100M tokens/month"), no cost alerts, no projected spend.
113
+ **Impact:** Governance teams can see usage after the fact but cannot prevent overruns.
114
+
115
+ ### Tool discovery lacks trust/dependency introspection
116
+ The default `tools/list` catalog is now curated around facades and daily runtime tools, and raw MCP clients can request the full registry, but there is still no trust-level annotation per tool and no tool dependency graph ("bclaw_dispatch requires active sequence"). Agents still need docs or source to understand tool preconditions.
117
+ **Impact:** New agent integrations require trial-and-error to discover which tools work in their context.
118
+
119
+ ### No metrics MCP endpoint
120
+ CLI metrics exist (`brainclaw metrics`, `brainclaw usage`, `brainclaw estimation-report`) but none are exposed as MCP tools. Agents cannot programmatically query coordination health or usage data through the standard integration surface.
121
+ **Impact:** Governance dashboards must shell out to CLI instead of using the MCP contract.
@@ -0,0 +1,102 @@
1
+ # Audience: End-Users & Solo Devs
2
+
3
+ Design constraints for agents developing brainclaw features that serve end-users, solo developers, and power-users.
4
+
5
+ ## Profiles
6
+
7
+ ### Non-Tech Creators
8
+ People who rely on AI agents to write code for them. They never open a terminal manually. They interact with brainclaw only through their agent.
9
+
10
+ ### Solo Developers
11
+ Developers who code alongside their agent. They use one agent at a time, session after session, on the same project.
12
+
13
+ ### Power-Users
14
+ Developers who orchestrate multiple agents on the same project. They use handoffs, plans, and claims to coordinate between agents.
15
+
16
+ ## Design Constraints
17
+
18
+ These rules apply to any feature that touches this audience:
19
+
20
+ 1. **Every feature MUST have an agent-only path.** If a feature requires the user to type a CLI command, it must also be achievable through MCP or natural language instruction to the agent. The CLI is a fallback, not the default.
21
+
22
+ 2. **Zero-config is the baseline.** `brainclaw init` must produce a working setup without follow-up questions for simple projects. Sensible defaults over configuration dialogs.
23
+
24
+ 3. **Memory must survive sessions.** Any decision, constraint, or trap recorded in one session must be available in the next session without the user re-stating it. This is the core value proposition for solo devs.
25
+
26
+ 4. **Context must be prompt-sized.** End-users don't manage context windows. brainclaw must produce compact, relevant context that fits within agent limits without manual pruning. The 9 context profiles (dev, dense, compact, copilot, quick, briefing, openclaw, ops, research) exist for this — the right profile is selected automatically based on agent tier and session type.
27
+
28
+ 5. **Onboarding must be expressible in one sentence.** The install path is: user tells agent "install brainclaw and use it". If onboarding requires more steps, the feature is too complex for this audience. The auto-bootstrap (`bclaw_bootstrap`) handles brownfield scanning (README, docs, git history, existing agent files) and derives memory seeds without user input.
29
+
30
+ 6. **Handoffs must be seamless.** When a power-user switches from one agent to another, the next agent must pick up where the last one left off without the user re-explaining the current state. Context diff (`context-diff.ts`) shows exactly what changed since the last session so agents resume from delta, not from scratch.
31
+
32
+ ## Anti-Patterns
33
+
34
+ - Adding CLI-only features with no MCP equivalent
35
+ - Requiring manual file editing to configure brainclaw behavior
36
+ - Producing context that exceeds prompt limits or requires the user to select what to include
37
+ - Assuming the user understands brainclaw internals (store structure, export formats, tier model)
38
+ - Breaking session continuity — any mutation that makes the next session start from scratch
39
+ - Forcing the user to manually maintain memory — `bclaw_compact` (semantic deduplication) and `bclaw_quick_capture` (auto-classification) exist to reduce this friction
40
+
41
+ ## Key Features for This Audience
42
+
43
+ ### Session & Context (core loop)
44
+ - `bclaw_work(intent)` — entry facade: session + context + claim in one call (compact payload by default to stay under MCP token caps; pass `compact: false` for the full memory dump)
45
+ - `bclaw_session_start` / `bclaw_session_end` — explicit session lifecycle with auto-reflect (when finer control is needed)
46
+ - `bclaw_context(kind)` — unified context read with profile selection (9 profiles): `memory` / `execution` / `board` / `board_summary` / `delta`
47
+ - Context diff via `bclaw_context(kind="delta", since=…)` — incremental delta since the last session
48
+
49
+ ### Memory (persistence across sessions)
50
+ - `bclaw_write_note` — persistent runtime observations
51
+ - `bclaw_quick_capture` — free-form text auto-classified into decision/trap/note
52
+ - `bclaw_search` — BM25 full-text search across all memory items
53
+ - `bclaw_compact` — semantic deduplication with archive (never deletes)
54
+ - Project memory types: constraints, decisions, traps, handoffs, layered instructions
55
+
56
+ ### Onboarding & Discovery
57
+ - `brainclaw init` / `brainclaw setup` / `bclaw_setup` — onboarding path
58
+ - `bclaw_bootstrap` — brownfield auto-scan with interview and profile caching
59
+ - `bclaw_context(kind="execution")` — workspace detection, toolchains, git status
60
+ - `bclaw_release_notes` — agent-first version notes (breaking risk, highlights)
61
+ - Native agent file generation (CLAUDE.md, AGENTS.md, .cursor/rules/, .windsurfrules, GEMINI.md, etc.)
62
+
63
+ ### Multi-Agent Handoffs (power-users)
64
+ - `bclaw_get(entity="handoff", id)` / `bclaw_update(entity="handoff", id, patch)` — structured agent transitions with git diff
65
+ - `bclaw_create(entity="plan", data)` / `bclaw_update(entity="plan", id, patch)` / `bclaw_transition(entity="plan", id, to)` — shared work that survives agent switches
66
+ - `bclaw_claim` / `bclaw_release_claim` — scope reservation before editing
67
+
68
+ ## Known Gaps
69
+
70
+ Features this audience would naturally expect but that are not yet implemented:
71
+
72
+ ### Session continuity diff not auto-surfaced on start
73
+ `bclaw_session_start` returns a full context snapshot but does not auto-include "here's what changed since your last session". The diff logic exists (`context-diff.ts`, `since_session` parameter) but the agent must explicitly request it via `bclaw_context(kind="delta", since=<sess_id>)`. For solo devs resuming next morning, the agent should get the delta automatically.
74
+ **Impact:** Solo devs re-read stale context instead of focusing on what changed.
75
+
76
+ ### No fuzzy search or typo tolerance
77
+ `bclaw_search` uses BM25 with exact tokenization only (`search.ts`). No Levenshtein distance, no prefix matching, no "did you mean?" suggestions. Searching "postgre" when the memory says "PostgreSQL" returns nothing.
78
+ **Impact:** Non-tech creators who can't spell technical terms get zero results.
79
+
80
+ ### Memory accumulates with no staleness management
81
+ Traps have `expires_at` and `status` fields (`traps.ts`), and `bclaw_doctor` lists expired items, but there is no auto-expiry workflow. No staleness warnings ("this constraint hasn't been reviewed in 90 days"), no "mark as resolved" flow that archives instead of deletes. Memory grows until manual cleanup via `bclaw_compact` or `bclaw_delete_memory`.
82
+ **Impact:** After months of use, context becomes noisy with obsolete items.
83
+
84
+ ### No context weight personalization
85
+ Context profiles are hardcoded in `context.ts` with fixed section weights (plans +4, handoffs +3, decisions/traps +2 in dense mode). There is no per-user or per-agent configuration to say "show me more traps, fewer plans" or "pin this item to always appear".
86
+ **Impact:** One-size-fits-all context may miss what matters most to a specific user.
87
+
88
+ ### No undo beyond single-item rollback
89
+ `rollback.ts` can revert a single item to its previous state via audit snapshots, but there is no batch undo ("undo all changes from session X"), no point-in-time restore, no "undo last 5 edits" convenience.
90
+ **Impact:** If an agent writes bad memory, cleanup is manual and item-by-item.
91
+
92
+ ### No init repair path
93
+ If `brainclaw init` partially fails or produces a bad config, there is no `brainclaw repair` command. Re-init requires `--force` which risks destroying existing memory. `bclaw_doctor` checks for issues but auto-repairs very little.
94
+ **Impact:** Corrupted setups require manual intervention that non-tech creators cannot do.
95
+
96
+ ### Cross-project learning is manual only
97
+ Projects are siloed. Federation exists (`federation-transport.ts`) but requires explicit config and manual push/pull. There is no auto-detection of common learnings across projects (e.g., "3 projects use React, here are shared patterns"). No cross-project search.
98
+ **Impact:** Solo devs working on multiple repos re-discover the same constraints.
99
+
100
+ ### Quick capture is keyword-heuristic only
101
+ `bclaw_quick_capture` uses keyword heuristics, not LLM inference. An agent cannot say "remember that we decided to use PostgreSQL" and have it auto-classified as a decision with confidence scoring.
102
+ **Impact:** Agents must use structured MCP calls with explicit type parameters instead of natural language.