brainclaw 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +585 -499
  2. package/dist/brainclaw-vscode.vsix +0 -0
  3. package/dist/commands/harvest.js +1 -1
  4. package/dist/commands/hooks.js +73 -73
  5. package/dist/commands/init.js +1 -1
  6. package/dist/commands/install-hooks.js +78 -78
  7. package/dist/commands/mcp-read-handlers.js +57 -14
  8. package/dist/commands/mcp.js +79 -13
  9. package/dist/commands/switch.js +26 -5
  10. package/dist/commands/version.js +1 -1
  11. package/dist/core/agent-capability.js +19 -4
  12. package/dist/core/agent-files.js +119 -119
  13. package/dist/core/codev-prompts.js +38 -38
  14. package/dist/core/default-profiles/doctor.yaml +11 -11
  15. package/dist/core/default-profiles/janitor.yaml +11 -11
  16. package/dist/core/default-profiles/onboarder.yaml +11 -11
  17. package/dist/core/default-profiles/reviewer.yaml +13 -13
  18. package/dist/core/dispatcher.js +1 -1
  19. package/dist/core/entity-operations.js +29 -3
  20. package/dist/core/execution.js +1 -1
  21. package/dist/core/loops/verbs.js +0 -1
  22. package/dist/core/messaging.js +2 -2
  23. package/dist/core/protocol-skills.js +164 -164
  24. package/dist/core/runtime-signals.js +1 -1
  25. package/dist/core/search.js +19 -2
  26. package/dist/core/security-guard.js +207 -207
  27. package/dist/core/spawn-check.js +16 -2
  28. package/dist/core/staleness.js +1 -1
  29. package/dist/core/store-resolution.js +26 -7
  30. package/dist/core/worktree.js +18 -18
  31. package/dist/facts.js +3 -3
  32. package/dist/facts.json +2 -2
  33. package/docs/PROTOCOL.md +1 -1
  34. package/docs/adapters/openclaw.md +43 -43
  35. package/docs/architecture/project-refs.md +328 -328
  36. package/docs/cli.md +2093 -2093
  37. package/docs/concepts/coordination.md +52 -52
  38. package/docs/concepts/coordinator-runbook.md +129 -129
  39. package/docs/concepts/dispatch-lifecycle.md +245 -245
  40. package/docs/concepts/event-log-store.md +928 -928
  41. package/docs/concepts/ideation-loop.md +317 -317
  42. package/docs/concepts/loop-engine.md +520 -511
  43. package/docs/concepts/mcp-governance.md +268 -268
  44. package/docs/concepts/memory.md +84 -84
  45. package/docs/concepts/multi-agent-workflows.md +167 -167
  46. package/docs/concepts/observer-protocol.md +361 -361
  47. package/docs/concepts/plans-and-claims.md +217 -217
  48. package/docs/concepts/project-md-convention.md +35 -35
  49. package/docs/concepts/runtime-notes.md +38 -38
  50. package/docs/concepts/troubleshooting.md +254 -254
  51. package/docs/concepts/workspace-bootstrapping.md +142 -142
  52. package/docs/context-format-changelog.md +35 -35
  53. package/docs/context-format.md +48 -48
  54. package/docs/index.md +65 -65
  55. package/docs/integrations/agents.md +158 -158
  56. package/docs/integrations/claude-code.md +23 -23
  57. package/docs/integrations/cline.md +77 -77
  58. package/docs/integrations/continue.md +55 -55
  59. package/docs/integrations/copilot.md +68 -68
  60. package/docs/integrations/cursor.md +23 -23
  61. package/docs/integrations/kilocode.md +72 -72
  62. package/docs/integrations/mcp.md +377 -377
  63. package/docs/integrations/mistral-vibe.md +122 -122
  64. package/docs/integrations/openclaw.md +92 -92
  65. package/docs/integrations/opencode.md +84 -84
  66. package/docs/integrations/overview.md +115 -115
  67. package/docs/integrations/roo.md +71 -71
  68. package/docs/integrations/windsurf.md +77 -77
  69. package/docs/mcp-schema-changelog.md +360 -356
  70. package/docs/playbooks/integration/index.md +121 -121
  71. package/docs/playbooks/orchestration.md +37 -0
  72. package/docs/playbooks/productivity/index.md +99 -99
  73. package/docs/playbooks/team/index.md +117 -117
  74. package/docs/product/agent-first-model.md +184 -184
  75. package/docs/product/entity-model-audit.md +462 -462
  76. package/docs/product/positioning.md +86 -86
  77. package/docs/quickstart-existing-project.md +107 -107
  78. package/docs/quickstart.md +183 -183
  79. package/docs/release-maintenance.md +79 -79
  80. package/docs/reputation.md +52 -52
  81. package/docs/review.md +45 -45
  82. package/docs/security.md +212 -212
  83. package/docs/server-operations.md +118 -118
  84. package/docs/storage.md +106 -106
  85. package/package.json +80 -65
  86. package/docs/concepts/event-log-store-critique-A.md +0 -333
  87. package/docs/concepts/event-log-store-critique-B.md +0 -353
  88. package/docs/concepts/event-log-store-phase0-measurements.md +0 -58
  89. package/docs/concepts/event-log-store-proposal-A.md +0 -365
  90. package/docs/concepts/event-log-store-proposal-B.md +0 -404
  91. package/docs/concepts/identity-model-proposal.md +0 -371
@@ -1,121 +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.
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,37 @@
1
+ # Asynchronous Orchestrator Playbook
2
+
3
+ This playbook is designed for Manager/Dispatcher AI Agents steering multi-agent projects using Brainclaw. It provides a structured approach to managing complex, asynchronous workflows, ensuring efficient delegation, execution, and review across multiple agents.
4
+
5
+ ## Step 1: Create a Plan
6
+
7
+ Before delegating any work, establish a clear and actionable formulation of the required tasks.
8
+
9
+ - Define a top-level Plan using the canonical `bclaw_create(entity="plan", data={…})` tool. (`bclaw_work` does not create plans — when none is active it returns a `nextActions` hint pointing to `bclaw_create`.)
10
+ - Break down the overarching project goal into manageable sub-steps using the `bclaw_add_step` tool.
11
+ - Ensure that each step has a clear description, expected outcome, and (optionally) an estimated effort. A well-defined plan acts as the ground truth for downstream agents.
12
+
13
+ ## Step 2: Create Sequences for Parallel Work Lanes
14
+
15
+ When tasks are independent or can be parallelized, organize the plan steps into sequences to maximize throughput.
16
+
17
+ - Use the `bclaw_create_sequence` tool to map steps into sequence lanes.
18
+ - Define `hard_after` dependencies if certain steps strictly require others to complete first, or `soft_after` for advisory ordering.
19
+ - Grouping tasks into distinct lanes ensures execution agents run in parallel safely and are not unnecessarily blocked.
20
+
21
+ ## Step 3: Dispatch Work
22
+
23
+ With the plan and sequences established, assign the work to execution agents.
24
+
25
+ - **Sequence-driven execution:** Use `bclaw_dispatch(intent="execute")` to parallelize plans across your defined sequence lanes automatically.
26
+ - **Direct orchestration:** For ad-hoc delegation, use `bclaw_coordinate(intent="assign")` to assign specific tasks to target agents. This seamlessly generates the necessary claims and dispatch briefs.
27
+ - **Reviews & Loops:** To open a structured review process on completed work, use `bclaw_coordinate(intent="review", open_loop=true)`.
28
+ - Use `bclaw_dispatch_status` to verify worker liveness, examine log tails, and ensure dispatches are progressing healthily.
29
+
30
+ ## Step 4: Manage the Inbox
31
+
32
+ As downstream execution agents interact with their assignments, they will emit statuses, request reviews, or supply handoffs back to the orchestrator.
33
+
34
+ - Routinely call `bclaw_read_inbox` to fetch incoming messages, status updates, and peer requests.
35
+ - Acknowledge received messages using `bclaw_ack_message` after processing to keep the inbox clean.
36
+ - Review handoffs and lifecycle events, transitioning the overarching plan steps (e.g., utilizing `bclaw_complete_step`) once execution meets the expected criteria.
37
+ - If an agent is blocked, read their action required prompts from the inbox and respond utilizing `bclaw_assignment_action` or by steering them in a new direction.
@@ -1,102 +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
-
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
92
  ### No init repair path
93
93
  If `brainclaw init` partially fails or produces a bad config, there is still no focused `brainclaw repair-init` path. Re-running `brainclaw init` is now a safe upsert for existing projects, and `--force` rebuilds the managed setup from defaults while preserving canonical memory, but `bclaw_doctor` still auto-repairs very little.
94
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.
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.