brainclaw 1.27.0 → 1.28.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 (35) hide show
  1. package/dist/brainclaw-vscode.vsix +0 -0
  2. package/dist/cli/register-coordination.js +12 -0
  3. package/dist/commands/loop.js +12 -0
  4. package/dist/commands/loops-handlers.js +261 -2
  5. package/dist/commands/mcp-catalog.js +16 -3
  6. package/dist/commands/mcp-schemas.generated.js +20 -0
  7. package/dist/commands/mcp-write-claims.js +55 -8
  8. package/dist/commands/mcp-write-coordination.js +3 -0
  9. package/dist/core/actions.js +17 -3
  10. package/dist/core/execution-adapters.js +29 -0
  11. package/dist/core/facade-schema.js +3 -0
  12. package/dist/core/loop-turn-dispatch.js +31 -3
  13. package/dist/core/loops/attempt-authority.js +20 -0
  14. package/dist/core/loops/brief-assembly.js +21 -4
  15. package/dist/core/loops/continuation.js +337 -0
  16. package/dist/core/loops/evidence.js +1 -0
  17. package/dist/core/loops/facade-schema.js +49 -1
  18. package/dist/core/loops/gate-policy.js +52 -4
  19. package/dist/core/loops/impl-bind.js +58 -6
  20. package/dist/core/loops/index.js +1 -0
  21. package/dist/core/loops/reconcile-turn.js +2 -0
  22. package/dist/core/loops/result-reducers.js +15 -1
  23. package/dist/core/loops/store.js +4 -0
  24. package/dist/core/loops/types.js +20 -1
  25. package/dist/core/loops/verbs.js +3 -0
  26. package/dist/core/loops/verify-command.js +77 -15
  27. package/dist/core/reviewer-policy.js +39 -0
  28. package/dist/core/schema.js +21 -1
  29. package/dist/facts.js +7 -7
  30. package/dist/facts.json +6 -6
  31. package/docs/cli.md +4 -2
  32. package/docs/concepts/loop-engine.md +25 -0
  33. package/docs/loops/implementation.md +20 -0
  34. package/docs/mcp-schema-changelog.md +10 -1
  35. package/package.json +1 -1
package/dist/facts.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.27.0",
3
- "generated_at": "2026-08-23T22:12:22.907Z",
2
+ "version": "1.28.1",
3
+ "generated_at": "2026-08-24T17:40:07.204Z",
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-23T22:12:20.808Z",
479
+ "generated_at": "2026-08-24T17:40:05.036Z",
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": 76,
488
+ "duration_ms_median": 85,
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": 123,
496
+ "duration_ms_median": 128,
497
497
  "payload_chars_median": 2626,
498
498
  "payload_tokens_est_median": 657
499
499
  },
@@ -501,7 +501,7 @@
501
501
  "name": "first_edit",
502
502
  "volume": "medium",
503
503
  "description": "code_find + code_brief on the fresh-agent path (missing index, first touch).",
504
- "duration_ms_median": 14,
504
+ "duration_ms_median": 11,
505
505
  "payload_chars_median": 1305,
506
506
  "payload_tokens_est_median": 326
507
507
  }
package/docs/cli.md CHANGED
@@ -1016,9 +1016,11 @@ research, and debug; they are not a review-only command group.
1016
1016
  | `takeover <loop_id>` | slot, turn, expected epoch, cause, liveness evidence, external-effect policy, next workspace and coordinator identity | Fence one physical generation and arm a successor without changing the logical Assignment. |
1017
1017
  | `advance <loop_id>` | — | Advance through the protocol; optional `--to-phase`, `--force`, `--reason`. |
1018
1018
  | `add-artifact <loop_id>` | `--phase --type --body` | Attach a typed artifact; optional producer and ref. |
1019
+ | `continue <loop_id>` | — | Evaluate an attested Ideation→Implementation or Implementation→Review action and persist/apply `AUTO`, `REQUIRE_APPROVAL`, or `DENY`; options: `--action-index`, `--autonomy-mode`, `--risk`. Review continuation selects an independent registered reviewer and fails closed if none is available. |
1019
1020
 
1020
1021
  ```bash
1021
1022
  brainclaw loop advance lop_abc --json
1023
+ brainclaw loop continue lop_abc --autonomy-mode autonomous --risk normal --json
1022
1024
  brainclaw loop takeover lop_abc \
1023
1025
  --slot lsl_abc --turn-id tat_abc --expected-epoch 0 \
1024
1026
  --cause "worker is no longer live" \
@@ -1028,7 +1030,7 @@ brainclaw loop takeover lop_abc \
1028
1030
  ```
1029
1031
 
1030
1032
  The full public lifecycle (`open`, `get`, `list`, `pause`, `resume`, `close`,
1031
- `bind`, `verify`, `request_input`, `provide_input`, and the verbs above) is the
1033
+ `bind`, `verify`, `continue`, `request_input`, `provide_input`, and the verbs above) is the
1032
1034
  MCP `bclaw_loop(intent)` facade. Direct MCP `open` requires
1033
1035
  `allow_orphan=true`; review and ideation normally start through
1034
1036
  `bclaw_coordinate` so opening and dispatch stay one operation. See the
@@ -2032,7 +2034,7 @@ The default catalog is intentionally small and centred on the canonical grammar.
2032
2034
  |---|---|
2033
2035
  | `bclaw_coordinate(intent)` | Assign, consult, review, reroute, or summarize across agents. Pass `open_loop: true` on `intent="review"` to also dispatch the reviewer turn. |
2034
2036
  | `bclaw_dispatch(intent)` | Parallelize execute across a sequence's lanes (analysis / execute / review). |
2035
- | `bclaw_loop(intent)` | Open, inspect, or drive a multi-turn loop. The public lifecycle is `open`, `get`, `list`, `turn`, `complete_turn`, `advance`, `add_artifact`, `pause`, `resume`, and `close`; implementation loops also add engine-only `bind` (validate the linked sequence and enter `execute`, never spawn) and `verify`, and any kind may use `request_input` / `provide_input`. Trusted `turn(dispatch=true)` is the common worker launch path. `bclaw_coordinate` / `bclaw_dispatch` remain ergonomic shortcuts. A direct `open` must include `allow_orphan: true` to acknowledge that the caller will dispatch or drive it. |
2037
+ | `bclaw_loop(intent)` | Open, inspect, or drive a multi-turn loop. `continue` persists and applies policy-governed cross-loop progression through the public mutation path. Implementation loops add engine-only `bind` and `verify`; any kind may use `request_input` / `provide_input`. Trusted `turn(dispatch=true)` remains the only worker launch path. A direct `open` must include `allow_orphan: true`. |
2036
2038
 
2037
2039
  **Sequences**:
2038
2040
 
@@ -363,6 +363,7 @@ Additional shared and engine-owned actions complete the lifecycle:
363
363
  - **request_input** / **provide_input** — bounded, evidence-backed operator clarification usable by any protocol.
364
364
  - **bind** — implementation-loop engine action that validates the linked sequence and advances to `execute`; it never launches a worker.
365
365
  - **verify** — implementation/debug engine action that runs the opener-configured command outside the loop lock, then records a verification-attested report.
366
+ - **continue** — orchestration action above the Loop engine. It evaluates an attested `next_action`, persists `AUTO | REQUIRE_APPROVAL | DENY`, and applies supported actions through the same public `open`/`bind` handlers.
366
367
 
367
368
  Artifact authority is sealed at these verb boundaries. `produced_by` is
368
369
  derived from the authenticated slot/engine/coordinator context. A narrative
@@ -396,6 +397,7 @@ type BclawLoopInput = BclawLoopCallerEnvelope & (
396
397
  | { intent: 'close'; loop_id: LoopId; status: 'completed' | 'cancelled' | 'blocked'; reason?: string; expected_version?: number }
397
398
  | { intent: 'verify'; loop_id: LoopId }
398
399
  | { intent: 'bind'; loop_id: LoopId; dry_run?: boolean; lanes?: string[]; auto_execute?: boolean; model?: string; max_assignments?: number }
400
+ | { intent: 'continue'; loop_id: LoopId; action_index?: number; autonomy_mode?: 'autonomous' | 'require_approval' | 'deny'; risk?: 'normal' | 'protected' }
399
401
  | { intent: 'request_input'; loop_id: LoopId; slot_id: SlotId; phase: string; question_text: string; evidence: string[]; suggested_default?: string; options?: OperatorQuestionOption[]; pause_scope: 'slot' | 'loop'; on_timeout: 'use_default' | 'cancel_loop' | 'continue_incomplete'; timeout_at?: string; expected_version?: number }
400
402
  | { intent: 'provide_input'; loop_id: LoopId; replies_to: string; resolved_via: 'answer' | 'choose' | 'skip' | 'timeout_default'; answer_text?: string; chosen_option_id?: string; by?: 'operator' | 'system'; expected_version?: number }
401
403
  | { intent: 'get'; loop_id: LoopId; include_events?: boolean }
@@ -470,6 +472,29 @@ The shared lifecycle verbs are `turn`, `complete_turn`, `advance`,
470
472
  use engine-only `bind` to validate their linked sequence and enter `execute`,
471
473
  then `turn(dispatch:true)` for worker slots; `verify` runs their declared command.
472
474
 
475
+ ### Persisted continuation authority
476
+
477
+ An accepted ideation synthesis and an attested implementation handoff no
478
+ longer expose ungoverned downstream mutations. Their `next_actions` point to
479
+ `bclaw_loop(intent="continue")`. The
480
+ continuation record binds the source loop, iteration, sealed artifact digest,
481
+ canonical action hash and policy version into a deterministic key. It is
482
+ written before the downstream mutation.
483
+
484
+ For Ideation→Implementation, `AUTO` invokes the ordinary public `open` handler
485
+ with that key in `linked.continuation_key`, then invokes engine-only `bind`.
486
+ For Implementation→Review, it deterministically selects a project-registered,
487
+ spawnable review-capable identity that did not occupy an implementation slot,
488
+ then invokes the ordinary public `bclaw_coordinate(intent="review",
489
+ open_loop=true)` path. If no independent reviewer exists, it fails closed.
490
+ A retry first scans existing loops for the key, so a crash after either public
491
+ mutation but before the response reuses the same loop. A live concurrent owner
492
+ is observed rather than stolen.
493
+ `REQUIRE_APPROVAL` creates an `ActionRequired` whose discriminated target is
494
+ the continuation; approval resumes the same record, while rejection or expiry
495
+ persists `DENY`. Unsupported actions, placeholders, missing evidence and
496
+ ambiguous downstreams fail closed.
497
+
473
498
  ### Clarification is a cross-cutting primitive
474
499
 
475
500
  Clarification is deliberately not a sixth protocol. Any workflow can call
@@ -19,6 +19,11 @@ validates the plan/sequence link and advances to `execute`. It never launches
19
19
  a worker. `execute ↔ verify` iterates until the verify command is green or
20
20
  the cycle cap is hit.
21
21
 
22
+ Binding validates the complete graph: every sequence item must reference a
23
+ linked, existing plan (and an existing step when `stepId` is present). Explicit
24
+ sequence lanes are paired deterministically with worker slots, one slot per
25
+ lane. Each slot then carries its lane, plan/step ids, and `scope_hint`.
26
+
22
27
  ## Default protocol
23
28
 
24
29
  ```
@@ -67,6 +72,11 @@ iteration** — this guards the narrated-verify anti-pattern where a slot
67
72
  claims it verified without actually running the command. `command_green` in
68
73
  the iteration engine reads the reports produced against this gate.
69
74
 
75
+ For bound lanes, call `bclaw_loop(intent='verify', slot_id=…)`. The command
76
+ runs in that slot assignment's worktree. Omitting `slot_id` when several lane
77
+ worktrees exist fails closed, and `command_green` requires a current-iteration
78
+ green report from every bound lane.
79
+
70
80
  ## Stop condition
71
81
 
72
82
  ```ts
@@ -96,6 +106,9 @@ the iteration engine reads the reports produced against this gate.
96
106
  scope claim created by `turn(dispatch=true)`, and the common driver runs in
97
107
  the worktree bound to that claim. `bind` creates neither claim nor assignment.
98
108
  `session_id` is observability-only.
109
+ Dispatch also uses the bound `scope_hint` to retrieve only path-related
110
+ decisions, constraints, traps and runtime context (while retaining unscoped
111
+ project-wide memory).
99
112
  [Attempt authority](../concepts/attempt-authority.md#ordered-dispatch)
100
113
  mints a deterministic `turn_id` from `(loop_id, slot_id, iteration)` on
101
114
  every dispatch, so a concurrent re-dispatch hits `reservation_exists` and
@@ -105,6 +118,13 @@ uses `(loop_id, slot_id, phase, iteration)` for a versioned successor logical
105
118
  turn. This is a Loop Engine rule shared by every kind, not implementation-loop
106
119
  special handling.
107
120
 
121
+ At `handoff_ready`, the facade emits a structured `next_actions` call for
122
+ `bclaw_coordinate(intent='review', open_loop=true)`. It remains explicit: the
123
+ engine does not invent a reviewer or silently mutate external state. The
124
+ created review loop persists `linked.source_loop_id`, while the implementation
125
+ loop received the same provenance from its ideation source, so `list/get`
126
+ surfaces the pipeline chain without a separate registry.
127
+
108
128
  ## Recovery
109
129
 
110
130
  - **Execute worker crashed mid-iteration.** Launch grant lease expires;
@@ -408,7 +408,16 @@ will still succeed. A follow-up PR will strip the dead handler code.
408
408
  changelog records the published MCP surface fingerprint. When a tool
409
409
  name, tier, category, or input schema changes, the test fails until
410
410
  this section is updated.
411
- - MCP public surface fingerprint: `sha256:81243f3d507c274e`
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`
417
+ (`LoopSlotInput` gains optional `lane`, `scope_hint`, `plan_ids`, and
418
+ `step_ids` fields so implementation-loop lane scope and provenance survive
419
+ through the public facade. Existing callers remain valid.)
420
+ Previous: `sha256:81243f3d507c274e`
412
421
  (updated 2026-08-23 for the common Loop Engine worker driver: `turn` exposes
413
422
  real dispatch/model/candidate controls and `complete_turn` exposes the full
414
423
  AttemptAuthority fence; bind remains engine-only with compatibility inputs.)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainclaw",
3
- "version": "1.27.0",
3
+ "version": "1.28.1",
4
4
  "description": "Shared project memory for humans and coding agents.",
5
5
  "type": "module",
6
6
  "repository": {