brainclaw 1.28.1 → 1.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/brainclaw-vscode.vsix +0 -0
  2. package/dist/commands/code-map.js +2 -0
  3. package/dist/commands/doctor.js +1 -0
  4. package/dist/commands/harvest.js +32 -43
  5. package/dist/commands/loops-handlers.js +66 -3
  6. package/dist/commands/mcp-catalog.js +2 -2
  7. package/dist/commands/mcp-write-coordination.js +426 -141
  8. package/dist/commands/mcp-write-entities.js +5 -2
  9. package/dist/commands/mcp.js +57 -11
  10. package/dist/core/agentrun-reconciler.js +138 -4
  11. package/dist/core/claims.js +4 -1
  12. package/dist/core/code-map/aggregate.js +20 -7
  13. package/dist/core/code-map/backend.js +25 -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/entity-operations.js +18 -4
  19. package/dist/core/execution-adapters.js +23 -8
  20. package/dist/core/hygiene-policy.js +2 -1
  21. package/dist/core/loop-turn-dispatch.js +18 -1
  22. package/dist/core/loops/attempt-authority.js +22 -4
  23. package/dist/core/loops/attempt-generations.js +17 -4
  24. package/dist/core/loops/attempt-reservation.js +14 -1
  25. package/dist/core/loops/attempt-takeover.js +173 -76
  26. package/dist/core/loops/reconcile-turn.js +224 -26
  27. package/dist/core/loops/result-reducers.js +8 -8
  28. package/dist/core/loops/turn-execution.js +38 -19
  29. package/dist/core/loops/types.js +3 -0
  30. package/dist/core/loops/verbs.js +1 -1
  31. package/dist/core/spawn-check.js +9 -1
  32. package/dist/facts.js +8 -8
  33. package/dist/facts.json +7 -7
  34. package/docs/cli.md +2 -2
  35. package/docs/code-map.md +30 -9
  36. package/docs/concepts/loop-engine.md +5 -0
  37. package/docs/integrations/mcp.md +2 -2
  38. package/docs/mcp-schema-changelog.md +30 -0
  39. package/package.json +1 -1
@@ -96,7 +96,15 @@ export async function checkAgentSpawn(agent, options = {}) {
96
96
  const stderrRaw = readLogTail(root, assignmentId, 'stderr', 800).trim();
97
97
  const stderrTail = stderrRaw ? stderrRaw.split(/\r?\n/).filter(Boolean) : undefined;
98
98
  if (completed) {
99
- return { agent, binary, status: 'ok', delivered, completed: true, duration_ms, detail: 'ack + completed round-trip' };
99
+ return {
100
+ agent,
101
+ binary,
102
+ status: 'ok',
103
+ delivered,
104
+ completed: true,
105
+ duration_ms,
106
+ detail: `validation probe: ack + completed round-trip (${invoke.promptDelivery}, ${invoke.promptText?.length ?? 0} prompt bytes)`,
107
+ };
100
108
  }
101
109
  if (failed) {
102
110
  const tail = stderrRaw || readLogTail(root, assignmentId, 'stdout', 400).trim();
package/dist/facts.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // Generated by scripts/emit-site-facts.mjs at build time. Do not edit manually.
2
- // Source: brainclaw v1.28.1 on 2026-08-24T17:40:07.204Z
2
+ // Source: brainclaw v1.28.3 on 2026-08-25T23:07:33.877Z
3
3
  export const FACTS = {
4
- "version": "1.28.1",
5
- "generated_at": "2026-08-24T17:40:07.204Z",
4
+ "version": "1.28.3",
5
+ "generated_at": "2026-08-25T23:07:33.877Z",
6
6
  "tools": {
7
7
  "count": 70,
8
8
  "published_count": 68,
@@ -478,7 +478,7 @@ export const FACTS = {
478
478
  },
479
479
  "bench": {
480
480
  "schema": "brainclaw.bench.v1",
481
- "generated_at": "2026-08-24T17:40:05.036Z",
481
+ "generated_at": "2026-08-25T23:07:31.792Z",
482
482
  "node_version": "v24.19.0",
483
483
  "platform": "linux-x64",
484
484
  "repeats": 3,
@@ -487,7 +487,7 @@ export const FACTS = {
487
487
  "name": "cold_onboard",
488
488
  "volume": "empty",
489
489
  "description": "fresh machine → init → first useful context. Baseline for time-to-first-value.",
490
- "duration_ms_median": 85,
490
+ "duration_ms_median": 79,
491
491
  "payload_chars_median": 1640,
492
492
  "payload_tokens_est_median": 410
493
493
  },
@@ -495,7 +495,7 @@ export const FACTS = {
495
495
  "name": "warm_work",
496
496
  "volume": "medium",
497
497
  "description": "bclaw_work consult over a real-shaped store (~200 plans / 500 handoffs / 450 claims).",
498
- "duration_ms_median": 128,
498
+ "duration_ms_median": 122,
499
499
  "payload_chars_median": 2626,
500
500
  "payload_tokens_est_median": 657
501
501
  },
@@ -504,8 +504,8 @@ export const FACTS = {
504
504
  "volume": "medium",
505
505
  "description": "code_find + code_brief on the fresh-agent path (missing index, first touch).",
506
506
  "duration_ms_median": 11,
507
- "payload_chars_median": 1305,
508
- "payload_tokens_est_median": 326
507
+ "payload_chars_median": 1629,
508
+ "payload_tokens_est_median": 407
509
509
  }
510
510
  ]
511
511
  }
package/dist/facts.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.28.1",
3
- "generated_at": "2026-08-24T17:40:07.204Z",
2
+ "version": "1.28.3",
3
+ "generated_at": "2026-08-25T23:07:33.877Z",
4
4
  "tools": {
5
5
  "count": 70,
6
6
  "published_count": 68,
@@ -476,7 +476,7 @@
476
476
  },
477
477
  "bench": {
478
478
  "schema": "brainclaw.bench.v1",
479
- "generated_at": "2026-08-24T17:40:05.036Z",
479
+ "generated_at": "2026-08-25T23:07:31.792Z",
480
480
  "node_version": "v24.19.0",
481
481
  "platform": "linux-x64",
482
482
  "repeats": 3,
@@ -485,7 +485,7 @@
485
485
  "name": "cold_onboard",
486
486
  "volume": "empty",
487
487
  "description": "fresh machine → init → first useful context. Baseline for time-to-first-value.",
488
- "duration_ms_median": 85,
488
+ "duration_ms_median": 79,
489
489
  "payload_chars_median": 1640,
490
490
  "payload_tokens_est_median": 410
491
491
  },
@@ -493,7 +493,7 @@
493
493
  "name": "warm_work",
494
494
  "volume": "medium",
495
495
  "description": "bclaw_work consult over a real-shaped store (~200 plans / 500 handoffs / 450 claims).",
496
- "duration_ms_median": 128,
496
+ "duration_ms_median": 122,
497
497
  "payload_chars_median": 2626,
498
498
  "payload_tokens_est_median": 657
499
499
  },
@@ -502,8 +502,8 @@
502
502
  "volume": "medium",
503
503
  "description": "code_find + code_brief on the fresh-agent path (missing index, first touch).",
504
504
  "duration_ms_median": 11,
505
- "payload_chars_median": 1305,
506
- "payload_tokens_est_median": 326
505
+ "payload_chars_median": 1629,
506
+ "payload_tokens_est_median": 407
507
507
  }
508
508
  ]
509
509
  }
package/docs/cli.md CHANGED
@@ -639,11 +639,11 @@ Full reference (freshness model, supported languages, WASM bundling): [docs/code
639
639
 
640
640
  ### `brainclaw code-map status [--cascade]`
641
641
 
642
- Store presence, freshness badge (`fresh` / `stale_changed_files` / `stale_extractor` / `stale_grammar` / `partial` / `missing_index`), and index stats (files, nodes, edges). Read-only. In a multi-project workspace, `--cascade` adds a per-child recap (which nested projects have a built index vs `missing_index`, plus an aggregate count).
642
+ Store presence, freshness badge (`fresh` / `stale_changed_files` / `stale_extractor` / `stale_grammar` / `partial` / `missing_index`), and index stats (files, nodes, edges). Read-only. In a multi-project workspace, `--cascade` adds compact coverage counts and names only non-fresh projects. On the MCP surface, the equivalent `bclaw_code_status(cascade=true)` also follows the latest durable cascade job.
643
643
 
644
644
  ### `brainclaw code-map refresh [--all|--changed] [--cascade]`
645
645
 
646
- Build or update the index. `--changed` (default) re-parses only touched files; `--all` does a full re-index. Run this when status shows `missing_index` or a stale badge. Fails fast (never blocks) if another writer holds the project lock. In a multi-project workspace, `--cascade` refreshes **every nested project** into its own store plus a root store scoped to the files no child owns (zero double-indexing) one command at the root indexes the whole monorepo per-project. See [docs/code-map.md](code-map.md#cascading-a-multi-project-workspace---cascade).
646
+ Build or update the index. `--changed` (default) re-parses only touched files; `--all` does a full re-index. Run this when status shows `missing_index` or a stale badge. Fails fast (never blocks) if another writer holds the project lock. In a multi-project workspace, `--cascade` synchronously refreshes each discovered project into its own store plus a root store scoped to files no child owns (zero double-indexing). The MCP equivalent starts a durable background job instead; follow it with `bclaw_code_status(cascade=true)`. See [docs/code-map.md](code-map.md#cascading-a-multi-project-workspace---cascade).
647
647
 
648
648
  ### `brainclaw code-map find <query> [--limit <n>]`
649
649
 
package/docs/code-map.md CHANGED
@@ -47,6 +47,8 @@ brainclaw code-map status
47
47
  ```
48
48
  Code Map status
49
49
  Store: present
50
+ Root: /workspace/apps/api
51
+ Path: /workspace/apps/api/.brainclaw/code
50
52
  Freshness: fresh
51
53
  Files: 142
52
54
  Nodes: 1873
@@ -124,11 +126,11 @@ all return a `freshness_badge`:
124
126
 
125
127
  | Tool | Kind | Purpose |
126
128
  |---|---|---|
127
- | `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. |
128
130
  | `bclaw_code_find` | read | Ranked symbol-index search (`query`, optional `limit`). Never refreshes. |
129
131
  | `bclaw_code_brief` | read | Reading brief for a symbol/path (`target`, optional `limit`, files capped at 12). Never refreshes. |
130
132
  | `bclaw_code_export` | read | Bounded local subgraph around required `target`; direction/depth/node/edge caps, confidence filtering, and optional Mermaid projection. Never refreshes. |
131
- | `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. |
132
134
 
133
135
  The read tools never trigger a parse — if `bclaw_code_status` /
134
136
  `bclaw_code_find` / `bclaw_code_brief` report `missing_index` or a stale badge,
@@ -176,7 +178,7 @@ No read command parses files or refreshes the index. `bclaw_work` can suggest
176
178
  that explicit refresh, but never performs it lazily.
177
179
  ## Lifecycle — pull-based, no daemon
178
180
 
179
- 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
180
182
  reconciliation at the read path:
181
183
 
182
184
  1. You edit or pull code — the index does not change.
@@ -184,7 +186,9 @@ reconciliation at the read path:
184
186
  file-hash diff vs the stored shards), so a stale index is always *visible*,
185
187
  never silently wrong.
186
188
  3. `refresh --changed` re-parses only the changed files (incremental); `--all` does
187
- 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)`.
188
192
  4. `bclaw_work` nudges a refresh when the badge is `missing_index` or stale, so an
189
193
  agent knows to reconcile before trusting the map.
190
194
 
@@ -212,6 +216,14 @@ Code Map to **that child** — the same per-project scoping that powers `bclaw_w
212
216
  juggling. A submodule that is itself an application (under e.g. `apps/`) is indexed
213
217
  like any other directory.
214
218
 
219
+ Both CLI and MCP status responses disclose the exact resolved project root and
220
+ Code Map store path. The MCP response additionally includes `active_source`, the
221
+ resolved project identity, the running server version, and the package version
222
+ visible on disk. In a monorepo, compare these fields before concluding that an
223
+ index is missing: a root store and a child store are intentionally distinct. If
224
+ the versions differ, restart the MCP server; if the roots differ, select the
225
+ intended project/session (or pass `cascade=true` at the workspace root).
226
+
215
227
  ### Cascading a multi-project workspace (`--cascade`)
216
228
 
217
229
  In a `project_mode: multi-project` workspace, one refresh at the root can index
@@ -230,9 +242,15 @@ double-indexing**, even when projects nest inside one another. `--cascade` is
230
242
  opt-in; without it, the root refresh keeps its single-tree behaviour (above), and
231
243
  single-project repos ignore the flag entirely.
232
244
 
233
- `status --cascade` (or `bclaw_code_status(cascade=true)`) adds a per-child recap —
234
- which nested projects have a built index vs `missing_index`, plus an aggregate
235
- 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.
236
254
 
237
255
  ### Workspace-wide `find` / `brief`
238
256
 
@@ -240,8 +258,11 @@ Once the per-child indexes exist (built by `--cascade`), `find` and `brief` run
240
258
  at a multi-project workspace **root** automatically aggregate across every child
241
259
  project's store — no flag needed. Matches are project-tagged with
242
260
  workspace-relative paths, and the freshness badge merges per-store status (worst
243
- status wins) plus coverage (how many projects are indexed, listing any unindexed
244
- 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
245
266
  dependents**: sibling packages that import the defining package's public name
246
267
  rank into the reading list, flagged `cross_package`.
247
268
 
@@ -518,6 +518,11 @@ The Loop engine is a **control plane**; existing primitives remain the **data pl
518
518
 
519
519
  A Loop never copies these objects — it links them. Deleting the linked primitive does not break the loop; the reference just becomes dangling, surfaced in diagnostics.
520
520
 
521
+ Inline `LoopArtifact.body` values are capped at **4096 UTF-8 bytes**, not 4096
522
+ characters. Larger task and result text remains available through its source
523
+ object or a `ref`; any inline projection is byte-truncated with an explicit
524
+ `…[truncated]` marker. This contract is identical for review and ideation.
525
+
521
526
  ## Per-protocol guides
522
527
 
523
528
  Each of the five kinds has its own operator-facing guide with the same
@@ -108,13 +108,13 @@ Each tool also has an `annotations.category` field: `session`, `context`, `memor
108
108
  | `bclaw_remove` | memory | Archive or purge a canonical entity |
109
109
  | `bclaw_transition` | memory | Move an entity through its validated state machine |
110
110
  | `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) |
111
+ | `bclaw_code_status` | discovery | Active-session Code Map freshness + stats; `cascade:true` follows durable monorepo refresh progress and exceptions |
112
112
  | `bclaw_code_find` | discovery | Search the Code Map symbol index by name (function/class/component/hook/type) |
113
113
  | `bclaw_code_brief` | discovery | Ranked reading list + related decisions/traps before editing a symbol or path |
114
114
  | `bclaw_code_impact` | discovery | Explainable local blast radius from resolved imports: definition, direct dependents, opt-in bounded transitives, tests, and count-based risk |
115
115
  | `bclaw_code_export` | discovery | Compact bounded local nodes/edges around one symbol or file; preserves edge kind/source/confidence, with optional Mermaid projection |
116
116
  | `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`) |
117
+ | `bclaw_code_refresh` | discovery | Rebuild the Code Map index (`scope: changed \| all`); `cascade:true` starts a durable background job |
118
118
 
119
119
  See [code map](../code-map.md) for the full Code Map reference (CLI, freshness model, supported languages).
120
120
 
@@ -8,6 +8,36 @@ guarantees this changelog follows.
8
8
 
9
9
  ---
10
10
 
11
+ ## [1.28.3] — 2026-08-26
12
+
13
+ **Changed — durable Code Map cascade execution**
14
+
15
+ - `bclaw_code_refresh({ cascade: true })` now returns a durable `job_id`
16
+ immediately for multi-project workspaces instead of keeping the MCP request
17
+ open for the whole synchronous cascade.
18
+ - `bclaw_code_status({ cascade: true })` adds the latest job's lifecycle and
19
+ progress (`queued | running | completed | failed`, project counts and current
20
+ project), then a bounded terminal summary with outcome counts and problem
21
+ projects. Discovery truncation and `no_eligible_files`, `locked`, and `failed`
22
+ outcomes remain explicit.
23
+ - All Code Map MCP tools now resolve against the active session project selected
24
+ by `bclaw_work` / `bclaw_switch`; this corrects routing behavior without
25
+ changing their input schemas.
26
+
27
+ **Added — non-blocking proximity hints on canonical memory creation**
28
+
29
+ - Successful `bclaw_create` calls for decisions, constraints, and traps may add
30
+ `nearby_items` (at most three bounded previews with ids and match reasons).
31
+ The requested creation is never rejected solely because a nearby item exists.
32
+
33
+ **Changed — admission failures become pre-mutation**
34
+
35
+ - Unsupported true cross-project auto-execution and empty `stdin_pipe` prompt
36
+ delivery now fail before claims, assignments, loops, or worker processes are
37
+ created. Existing successful response shapes and input schemas are unchanged.
38
+
39
+ No tool was added, removed, or renamed in this release.
40
+
11
41
  ## [1.20.3] — 2026-08-03
12
42
 
13
43
  **Changed — `bclaw_dispatch_status` diagnosis values under the fs-activity veto (#170)**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainclaw",
3
- "version": "1.28.1",
3
+ "version": "1.28.3",
4
4
  "description": "Shared project memory for humans and coding agents.",
5
5
  "type": "module",
6
6
  "repository": {