brainclaw 1.28.2 → 1.28.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 (49) hide show
  1. package/README.md +6 -0
  2. package/dist/brainclaw-vscode.vsix +0 -0
  3. package/dist/commands/harvest.js +67 -25
  4. package/dist/commands/loops-handlers.js +28 -1
  5. package/dist/commands/mcp-catalog.js +25 -4
  6. package/dist/commands/mcp-read-handlers.js +15 -1
  7. package/dist/commands/mcp-schemas.generated.js +13 -0
  8. package/dist/commands/mcp-write-coordination.js +97 -26
  9. package/dist/commands/mcp-write-entities.js +5 -2
  10. package/dist/commands/mcp-write-memory.js +87 -1
  11. package/dist/commands/mcp.js +41 -9
  12. package/dist/core/code-map/aggregate.js +20 -7
  13. package/dist/core/code-map/backend.js +17 -7
  14. package/dist/core/code-map/cascade-jobs.js +174 -0
  15. package/dist/core/code-map/cascade-worker.js +15 -0
  16. package/dist/core/code-map/cascade.js +63 -26
  17. package/dist/core/code-map/query.js +6 -3
  18. package/dist/core/context.js +16 -3
  19. package/dist/core/dispatch-status.js +36 -14
  20. package/dist/core/dispatcher.js +28 -20
  21. package/dist/core/entity-operations.js +80 -8
  22. package/dist/core/entity-registry.js +3 -3
  23. package/dist/core/execution-adapters.js +18 -1
  24. package/dist/core/facade-schema.js +10 -0
  25. package/dist/core/ideation-loop-close.js +3 -1
  26. package/dist/core/lane-result-file.js +72 -0
  27. package/dist/core/loop-turn-dispatch.js +2 -0
  28. package/dist/core/loops/brief-assembly.js +19 -11
  29. package/dist/core/loops/next-expected.js +56 -1
  30. package/dist/core/loops/reconcile-turn.js +8 -0
  31. package/dist/core/loops/result-reducers.js +14 -12
  32. package/dist/core/loops/store.js +4 -0
  33. package/dist/core/loops/types.js +14 -2
  34. package/dist/core/loops/verbs.js +8 -1
  35. package/dist/core/loops/worker-reply-contract.js +1 -1
  36. package/dist/core/protocol-tool-policy.js +1 -0
  37. package/dist/core/review-loop-turn-dispatch.js +1 -0
  38. package/dist/core/schema.js +24 -1
  39. package/dist/core/search.js +3 -2
  40. package/dist/core/spawn-check.js +9 -1
  41. package/dist/core/worktree.js +14 -7
  42. package/dist/facts.js +10 -9
  43. package/dist/facts.json +9 -8
  44. package/docs/cli.md +35 -2
  45. package/docs/code-map.md +20 -9
  46. package/docs/concepts/ideation-loop.md +35 -14
  47. package/docs/integrations/mcp.md +15 -5
  48. package/docs/mcp-schema-changelog.md +72 -6
  49. package/package.json +1 -1
package/docs/code-map.md CHANGED
@@ -126,11 +126,11 @@ all return a `freshness_badge`:
126
126
 
127
127
  | Tool | Kind | Purpose |
128
128
  |---|---|---|
129
- | `bclaw_code_status` | read | Store presence, freshness badge, index stats. Never refreshes. |
129
+ | `bclaw_code_status` | read | Active-session project store, freshness, index stats; `cascade=true` also follows the latest cascade job. Never refreshes. |
130
130
  | `bclaw_code_find` | read | Ranked symbol-index search (`query`, optional `limit`). Never refreshes. |
131
131
  | `bclaw_code_brief` | read | Reading brief for a symbol/path (`target`, optional `limit`, files capped at 12). Never refreshes. |
132
132
  | `bclaw_code_export` | read | Bounded local subgraph around required `target`; direction/depth/node/edge caps, confidence filtering, and optional Mermaid projection. Never refreshes. |
133
- | `bclaw_code_refresh` | write | Rebuild the index. `scope` = `"changed"` (default) or `"all"`. Fails fast on a live lock. |
133
+ | `bclaw_code_refresh` | write | Rebuild the index. `scope` = `"changed"` (default) or `"all"`; MCP `cascade=true` starts a durable background job and returns immediately. |
134
134
 
135
135
  The read tools never trigger a parse — if `bclaw_code_status` /
136
136
  `bclaw_code_find` / `bclaw_code_brief` report `missing_index` or a stale badge,
@@ -178,7 +178,7 @@ No read command parses files or refreshes the index. `bclaw_work` can suggest
178
178
  that explicit refresh, but never performs it lazily.
179
179
  ## Lifecycle — pull-based, no daemon
180
180
 
181
- Code Map never runs in the background and never auto-reindexes. The model is lazy
181
+ Code Map never auto-reindexes and has no daemon. The model is lazy
182
182
  reconciliation at the read path:
183
183
 
184
184
  1. You edit or pull code — the index does not change.
@@ -186,7 +186,9 @@ reconciliation at the read path:
186
186
  file-hash diff vs the stored shards), so a stale index is always *visible*,
187
187
  never silently wrong.
188
188
  3. `refresh --changed` re-parses only the changed files (incremental); `--all` does
189
- a full rebuild + orphan compaction.
189
+ a full rebuild + orphan compaction. The one bounded background path is an
190
+ explicitly requested MCP monorepo cascade, whose durable progress is read
191
+ through `bclaw_code_status(cascade=true)`.
190
192
  4. `bclaw_work` nudges a refresh when the badge is `missing_index` or stale, so an
191
193
  agent knows to reconcile before trusting the map.
192
194
 
@@ -240,9 +242,15 @@ double-indexing**, even when projects nest inside one another. `--cascade` is
240
242
  opt-in; without it, the root refresh keeps its single-tree behaviour (above), and
241
243
  single-project repos ignore the flag entirely.
242
244
 
243
- `status --cascade` (or `bclaw_code_status(cascade=true)`) adds a per-child recap —
244
- which nested projects have a built index vs `missing_index`, plus an aggregate
245
- count so you can see workspace-wide freshness from the root.
245
+ The CLI cascade stays synchronous. MCP `bclaw_code_refresh(cascade=true)` returns
246
+ a durable `job_id` immediately, avoiding the client timeout that a large workspace
247
+ can hit; follow it with `bclaw_code_status(cascade=true)`. Status reports completed
248
+ and total project counts, the project currently being indexed, and terminal
249
+ outcomes. Successful rows are aggregated; only exceptions are named. A project
250
+ with a valid empty index is labeled `no_eligible_files`, while lock contention and
251
+ refresh failures remain distinct (`locked` / `failed`). `discovery_truncated=true`
252
+ warns that the bounded nested-project scan could not inspect deeper branches, so
253
+ the reported project total must not be treated as complete.
246
254
 
247
255
  ### Workspace-wide `find` / `brief`
248
256
 
@@ -250,8 +258,11 @@ Once the per-child indexes exist (built by `--cascade`), `find` and `brief` run
250
258
  at a multi-project workspace **root** automatically aggregate across every child
251
259
  project's store — no flag needed. Matches are project-tagged with
252
260
  workspace-relative paths, and the freshness badge merges per-store status (worst
253
- status wins) plus coverage (how many projects are indexed, listing any unindexed
254
- children). An aggregated `brief` also surfaces **cross-package reverse
261
+ status wins) plus coverage. Missing child stores make the top-line badge
262
+ `partial`, never `fresh`; diagnostics carry status counts and only the non-fresh
263
+ exceptions instead of repeating every project. Weak shared-token candidates that
264
+ do not contain the normalized query are omitted rather than returned as plausible
265
+ score-1/2 noise. An aggregated `brief` also surfaces **cross-package reverse
255
266
  dependents**: sibling packages that import the defining package's public name
256
267
  rank into the reading list, flagged `cross_package`.
257
268
 
@@ -49,7 +49,7 @@ proposal → critique ↔ revision → synthesis
49
49
  | Phase | Purpose | What the slot produces |
50
50
  |---|---|---|
51
51
  | `proposal` | Seed: the original idea / decision under consideration | A `proposal` artifact (the task text from the caller) |
52
- | `critique` | Adversarial review against project memory | One or more `critique` artifacts citing real memory ids |
52
+ | `critique` | Adversarial review seeded by project memory and verified against the current worktree | One or more `critique` artifacts citing repository evidence and any memory ids used as leads |
53
53
  | `revision` | Champion's response to the critique batch | A `revision` artifact addressing the points raised |
54
54
  | `synthesis` | Final plan_draft folding the cycle's outputs | A `plan_draft` artifact with `addresses_critique:[ids]` |
55
55
 
@@ -171,6 +171,10 @@ goal: …
171
171
  ## what to produce
172
172
  - Phase "critique" expects you to act in role "critic".
173
173
  - Emit findings as LoopArtifacts via bclaw_loop intent='complete_turn'…
174
+ - Treat memory as an investigation lead, not current-code proof.
175
+ - Verify implementation findings against the worktree and cite a path plus a
176
+ line, symbol, assertion, or test/command result. Unverified concerns remain
177
+ questions, not findings.
174
178
  - Cite the memory ids you relied on so the synthesis can audit coverage.
175
179
  ```
176
180
 
@@ -222,26 +226,43 @@ filter, gate, iteration accounting) but want to drive each turn
222
226
  yourself — useful for one-shot consultations or when you don't have
223
227
  a separate critic agent on hand.
224
228
 
225
- ### Multi-agent mode
229
+ ### Multi-instance, multi-turn mode
226
230
 
227
231
  ```
228
232
  bclaw_coordinate(intent='ideate',
229
233
  task='Should we adopt approach A or approach B?',
230
- targetAgents=['codex'])
234
+ targetAgents=['codex', 'codex', 'codex'],
235
+ criticPerspectives=[
236
+ 'challenge assumptions and demand evidence',
237
+ 'focus on failure modes and recovery',
238
+ 'develop alternatives and compare trade-offs'
239
+ ])
231
240
  ```
232
241
 
233
242
  - Opens a loop with `champion` slot (caller) + one `critic` slot per
234
- target agent.
243
+ requested target instance. Repeated identities are intentional: a user with
244
+ only one installed agent can request three isolated Codex, Claude, or other
245
+ critic instances. Each occurrence gets its own slot, claim, worktree,
246
+ assignment, and turn authority; the three-artifact gate does not require
247
+ three different agent families.
235
248
  - Stores `task` as a `proposal` artifact.
236
249
  - Advances proposal → critique.
237
- - For each critic slot: assembles the brief via `buildIdeationBrief`
238
- honouring the critique phase's context_filter, calls
239
- `bclaw_loop(intent='turn')` to flip the slot to `assigned`, and
240
- queues a coordinate message with the brief as body and
241
- `{intent: 'ideate', loop_id, slot_id, phase, iteration,
242
- proposal_artifact_id}` payload.
250
+ - Persists a distinct `perspective` on every critic slot. When
251
+ `criticPerspectives` is omitted, Brainclaw supplies complementary evidence,
252
+ failure-mode, and alternatives/trade-off lenses.
253
+ - Uses `ideation_schedule='sequential'` by default. Only critic A starts
254
+ initially. After its result is harvested, `continuations` and `next_actions`
255
+ name critic B's real `turn(dispatch=true)`; B's brief includes A's critique
256
+ from the current round. C then sees A+B. The champion revises after the gate,
257
+ and the ordered conversation starts again in the next iteration.
258
+ - `ideation_schedule='parallel'` is an explicit latency/quality trade-off that
259
+ starts every critic immediately. It is useful when independent first
260
+ impressions matter more than cross-challenge and token cost.
261
+ - `brainclaw harvest <assignment>` and MCP `bclaw_harvest` both surface the
262
+ loop continuation. Workers may also finish through `complete_turn` directly.
243
263
  - Returns `{loop_id, …, mode: 'multi_agent',
244
- dispatched_critics: N, current_phase: 'critique'}`.
264
+ ideation_schedule, dispatched_critics, pending_critics,
265
+ current_phase: 'critique'}`.
245
266
 
246
267
  When the critique phase brief is truncated for any slot, a per-slot
247
268
  warning surfaces. When dispatch fails (e.g. an agent is unknown), the
@@ -299,9 +320,9 @@ which critiques were honoured vs ignored.
299
320
  framings, and "wrong question" findings that memory-driven critique
300
321
  is structurally unable to produce. Validated empirically; ships on
301
322
  its own cadence after MVP usage telemetry.
302
- - **Profile-based slot diversity.** Champion / simplifier / pessimist
303
- as separate slot types with their own context filters. Deferred
304
- until the single-slot model is validated in production.
323
+ - **Richer perspective presets.** Slots already persist caller-provided or
324
+ default critic lenses. Named reusable perspective packs can build on that
325
+ contract without coupling diversity to agent identity.
305
326
  - **Cross-loop memory.** Promoting validated plan_drafts back into
306
327
  the project memory store with provenance. Today the synthesis
307
328
  artifact lives only in the loop event journal.
@@ -47,7 +47,7 @@ Every tool has one of three tiers in its `annotations.tier` field:
47
47
  - **standard** — Day-to-day coordination tools: plans, claims, messaging, sequences, dispatch, review, memory. Returned by default alongside facades.
48
48
  - **advanced** — Specialized governance, audit, registry, and power tools.
49
49
 
50
- By default, `tools/list` returns **facade + standard** tools (49 tools). To get all tools including advanced, pass `{ "catalog": "all" }`, `{ "include": "all" }`, or `{ "advanced": true }`. To filter by a single tier, pass `{ "tier": "facade" }`, `{ "tier": "standard" }`, or `{ "tier": "advanced" }`.
50
+ By default, `tools/list` returns **facade + standard** tools (50 tools). To get all tools including advanced, pass `{ "catalog": "all" }`, `{ "include": "all" }`, or `{ "advanced": true }`. To filter by a single tier, pass `{ "tier": "facade" }`, `{ "tier": "standard" }`, or `{ "tier": "advanced" }`.
51
51
 
52
52
  Published tools remain callable regardless of catalog filtering — the tier only affects discovery via `tools/list`.
53
53
 
@@ -101,6 +101,7 @@ Each tool also has an `annotations.category` field: `session`, `context`, `memor
101
101
  | `bclaw_assignment_update` | coordination | Report assignment lifecycle status; v2 logical Assignments require the full generation fence and accept only accepted/started/progress before settlement |
102
102
  | `bclaw_assignment_action` | coordination | Resolve or reject a pending ActionRequired item |
103
103
  | `bclaw_harvest_candidates` | coordination | Harvest sandboxed worktree candidate files into the main project store |
104
+ | `bclaw_harvest` | coordination | Harvest or integrate worker `LANE-RESULT.json` files, reconcile loop turns, and return the exact continuation |
104
105
  | `bclaw_find` | memory | List canonical entities with filters |
105
106
  | `bclaw_get` | memory | Fetch a canonical entity by id or short label |
106
107
  | `bclaw_create` | memory | Create a canonical entity |
@@ -108,13 +109,13 @@ Each tool also has an `annotations.category` field: `session`, `context`, `memor
108
109
  | `bclaw_remove` | memory | Archive or purge a canonical entity |
109
110
  | `bclaw_transition` | memory | Move an entity through its validated state machine |
110
111
  | `bclaw_move` | memory | Relocate an item to another project, id-preserving (multi-project) |
111
- | `bclaw_code_status` | discovery | Code Map freshness badge + index stats (store presence, files/nodes/edges) |
112
+ | `bclaw_code_status` | discovery | Active-session Code Map freshness + stats; `cascade:true` follows durable monorepo refresh progress and exceptions |
112
113
  | `bclaw_code_find` | discovery | Search the Code Map symbol index by name (function/class/component/hook/type) |
113
114
  | `bclaw_code_brief` | discovery | Ranked reading list + related decisions/traps before editing a symbol or path |
114
115
  | `bclaw_code_impact` | discovery | Explainable local blast radius from resolved imports: definition, direct dependents, opt-in bounded transitives, tests, and count-based risk |
115
116
  | `bclaw_code_export` | discovery | Compact bounded local nodes/edges around one symbol or file; preserves edge kind/source/confidence, with optional Mermaid projection |
116
117
  | `bclaw_code_outline` | discovery | Source-ordered symbols of one indexed file (span, exported, confidence) — no reparse |
117
- | `bclaw_code_refresh` | discovery | Rebuild the Code Map index (`scope: changed \| all`) |
118
+ | `bclaw_code_refresh` | discovery | Rebuild the Code Map index (`scope: changed \| all`); `cascade:true` starts a durable background job |
118
119
 
119
120
  See [code map](../code-map.md) for the full Code Map reference (CLI, freshness model, supported languages).
120
121
 
@@ -403,11 +404,20 @@ bclaw_dispatch({ intent: 'review', openLoop: true, reviewMode: 'symmetric' })
403
404
  // synthesis are worker phases available through trusted turn(dispatch:true).
404
405
  bclaw_coordinate({ intent: 'ideate', task: 'Should we extract the dispatcher into a separate package?' })
405
406
 
406
- // Multi-agent ideation: critic gets a context-filtered, BM25-ranked brief auto-dispatched
407
+ // Multi-instance ideation is sequential and multi-turn by default: each critic
408
+ // sees the earlier contributions in its round. Repeated identities are valid.
407
409
  bclaw_coordinate({
408
410
  intent: 'ideate',
409
411
  task: 'Should we adopt approach A or approach B?',
410
- targetAgents: ['codex'],
412
+ targetAgents: ['codex', 'codex', 'codex'],
413
+ criticPerspectives: ['assumptions/evidence', 'failure modes/recovery', 'alternatives/trade-offs'],
414
+ })
415
+
416
+ // Opt into independent immediate fan-out only when latency matters more than
417
+ // cross-challenge and cost.
418
+ bclaw_coordinate({
419
+ intent: 'ideate', task: 'Collect independent first impressions',
420
+ targetAgents: ['codex', 'codex', 'codex'], ideation_schedule: 'parallel',
411
421
  })
412
422
 
413
423
  // Open a direct implementation loop. The caller owns subsequent bind/turn
@@ -8,6 +8,73 @@ guarantees this changelog follows.
8
8
 
9
9
  ---
10
10
 
11
+ ## [1.28.4] — 2026-08-28
12
+
13
+ - MCP public surface fingerprint: `sha256:42cd662667260792`
14
+
15
+ **Added — lane-result harvest parity**
16
+
17
+ - `bclaw_harvest` is a new standard coordination write tool matching the CLI
18
+ lane-result path. It accepts one `assignmentId` or `all=true`, optional
19
+ `worktreePaths`, `dryRun`, and `integrate`; successful report harvests return
20
+ reconciled `continuations` and executable `next_actions`.
21
+
22
+ **Changed — ideation is instance-based and sequential by default**
23
+
24
+ - `bclaw_coordinate(intent="ideate")` accepts repeated `targetAgents`, an
25
+ optional positionally aligned `criticPerspectives` array, and
26
+ `ideation_schedule: "sequential" | "parallel"` (default sequential).
27
+ - The result adds `ideation_schedule` and `pending_critics`. Sequential briefs
28
+ include critiques already produced in the same round, so participants
29
+ challenge one another before champion revision and the next bounded round.
30
+
31
+ **Changed — compact, actionable read projections**
32
+
33
+ - `bclaw_find` accepts optional `fields`; one item larger than `budget_tokens`
34
+ is projected to identity/status fields and reports
35
+ `oversized_item_projected` rather than overrunning the response budget.
36
+ - Agent rows add `declared_spawnable`, `executable_now`, `availability_code`,
37
+ and `availability_reason`.
38
+ - Work context's `pending_notifications` is now a compact summary containing
39
+ `actionable_count`, `by_type`, and `telemetry_events_omitted`; the raw event
40
+ count remains available as `unseen_event_count`.
41
+ - `bclaw_dispatch_status` adds canonical `terminal_signal` evidence and may
42
+ diagnose stale explicit progress as `stalled` despite a live wrapper PID or
43
+ unrelated filesystem activity.
44
+
45
+ All changes are additive except the intentionally compacted
46
+ `pending_notifications` value shape.
47
+
48
+ ## [1.28.3] — 2026-08-26
49
+
50
+ **Changed — durable Code Map cascade execution**
51
+
52
+ - `bclaw_code_refresh({ cascade: true })` now returns a durable `job_id`
53
+ immediately for multi-project workspaces instead of keeping the MCP request
54
+ open for the whole synchronous cascade.
55
+ - `bclaw_code_status({ cascade: true })` adds the latest job's lifecycle and
56
+ progress (`queued | running | completed | failed`, project counts and current
57
+ project), then a bounded terminal summary with outcome counts and problem
58
+ projects. Discovery truncation and `no_eligible_files`, `locked`, and `failed`
59
+ outcomes remain explicit.
60
+ - All Code Map MCP tools now resolve against the active session project selected
61
+ by `bclaw_work` / `bclaw_switch`; this corrects routing behavior without
62
+ changing their input schemas.
63
+
64
+ **Added — non-blocking proximity hints on canonical memory creation**
65
+
66
+ - Successful `bclaw_create` calls for decisions, constraints, and traps may add
67
+ `nearby_items` (at most three bounded previews with ids and match reasons).
68
+ The requested creation is never rejected solely because a nearby item exists.
69
+
70
+ **Changed — admission failures become pre-mutation**
71
+
72
+ - Unsupported true cross-project auto-execution and empty `stdin_pipe` prompt
73
+ delivery now fail before claims, assignments, loops, or worker processes are
74
+ created. Existing successful response shapes and input schemas are unchanged.
75
+
76
+ No tool was added, removed, or renamed in this release.
77
+
11
78
  ## [1.20.3] — 2026-08-03
12
79
 
13
80
  **Changed — `bclaw_dispatch_status` diagnosis values under the fs-activity veto (#170)**
@@ -408,12 +475,11 @@ will still succeed. A follow-up PR will strip the dead handler code.
408
475
  changelog records the published MCP surface fingerprint. When a tool
409
476
  name, tier, category, or input schema changes, the test fails until
410
477
  this section is updated.
411
- - MCP public surface fingerprint: `sha256:be86e5571fcd0226`
412
- (updated 2026-08-24 for persisted continuation authority: additive
413
- `bclaw_loop(intent="continue")` inputs `action_index`, `autonomy_mode`, and
414
- `risk`; the intent evaluates an attested Ideation→Implementation action,
415
- persists AUTO/REQUIRE_APPROVAL/DENY, and reuses the public open/bind path.)
416
- Previous: `sha256:681c47cba85b79c3`
478
+ - MCP public surface fingerprint: `sha256:42cd662667260792`
479
+ (updated 2026-08-28 for the additive `bclaw_harvest` surface, sequential
480
+ ideation controls, compact read projections, and loop-slot perspective and
481
+ completion fields.)
482
+ Previous: `sha256:be86e5571fcd0226`
417
483
  (`LoopSlotInput` gains optional `lane`, `scope_hint`, `plan_ids`, and
418
484
  `step_ids` fields so implementation-loop lane scope and provenance survive
419
485
  through the public facade. Existing callers remain valid.)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainclaw",
3
- "version": "1.28.2",
3
+ "version": "1.28.4",
4
4
  "description": "Shared project memory for humans and coding agents.",
5
5
  "type": "module",
6
6
  "repository": {