brainclaw 1.17.0 → 1.18.0
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.
- package/README.md +5 -5
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/commands/code-map.js +4 -1
- package/dist/commands/codev.js +61 -30
- package/dist/commands/doctor.js +14 -1
- package/dist/commands/harvest.js +196 -42
- package/dist/commands/inbox.js +10 -4
- package/dist/commands/loop.js +2 -2
- package/dist/commands/loops-handlers.js +82 -1
- package/dist/commands/mcp-catalog.js +12 -4
- package/dist/commands/mcp-read-handlers.js +90 -7
- package/dist/commands/mcp-schemas.generated.js +3 -0
- package/dist/commands/mcp-write-coordination.js +159 -40
- package/dist/commands/mcp.js +11 -2
- package/dist/core/agentrun-reconciler.js +171 -7
- package/dist/core/agentruns.js +6 -1
- package/dist/core/code-map/aggregate.js +473 -0
- package/dist/core/code-map/backend.js +36 -10
- package/dist/core/code-map/freshness.js +36 -1
- package/dist/core/code-map/lang/c/imports.scm +12 -0
- package/dist/core/code-map/lang/c/index.js +150 -0
- package/dist/core/code-map/lang/c/tags.scm +68 -0
- package/dist/core/code-map/lang/cpp/imports.scm +14 -0
- package/dist/core/code-map/lang/cpp/index.js +149 -0
- package/dist/core/code-map/lang/cpp/tags.scm +87 -0
- package/dist/core/code-map/lang/csharp/imports.scm +20 -0
- package/dist/core/code-map/lang/csharp/index.js +224 -0
- package/dist/core/code-map/lang/csharp/tags.scm +63 -0
- package/dist/core/code-map/lang/go/imports.scm +13 -0
- package/dist/core/code-map/lang/go/index.js +139 -0
- package/dist/core/code-map/lang/go/tags.scm +36 -0
- package/dist/core/code-map/lang/providers.js +12 -1
- package/dist/core/code-map/lang/ruby/imports.scm +24 -0
- package/dist/core/code-map/lang/ruby/index.js +198 -0
- package/dist/core/code-map/lang/ruby/tags.scm +49 -0
- package/dist/core/code-map/lang/rust/imports.scm +44 -0
- package/dist/core/code-map/lang/rust/index.js +136 -0
- package/dist/core/code-map/lang/rust/tags.scm +47 -0
- package/dist/core/code-map/query.js +229 -80
- package/dist/core/code-map/types.js +18 -0
- package/dist/core/code-map/work-section.js +8 -7
- package/dist/core/codev-responses.js +16 -0
- package/dist/core/dispatcher.js +176 -22
- package/dist/core/execution-adapters.js +29 -3
- package/dist/core/ideation-loop-close.js +124 -0
- package/dist/core/loops/artifact-resolver.js +197 -0
- package/dist/core/loops/attempt-reservation.js +576 -0
- package/dist/core/loops/commit-intent.js +494 -0
- package/dist/core/loops/facade-schema.js +48 -0
- package/dist/core/loops/impl-bind.js +144 -0
- package/dist/core/loops/index.js +1 -1
- package/dist/core/loops/iteration-engine.js +29 -0
- package/dist/core/loops/lock.js +14 -0
- package/dist/core/loops/project-resolution.js +157 -0
- package/dist/core/loops/reconcile-turn.js +369 -0
- package/dist/core/loops/result-reducers.js +88 -0
- package/dist/core/loops/store.js +46 -7
- package/dist/core/loops/types.js +139 -11
- package/dist/core/loops/verbs.js +9 -3
- package/dist/core/loops/verify-command.js +209 -0
- package/dist/core/messaging.js +58 -5
- package/dist/core/review-loop-close.js +5 -2
- package/dist/core/review-loop-turn-dispatch.js +290 -28
- package/dist/core/runtime-signals.js +68 -0
- package/dist/core/schema.js +24 -0
- package/dist/core/worktree.js +24 -0
- package/dist/facts.js +9 -9
- package/dist/facts.json +8 -8
- package/dist/wasm/tree-sitter-c.wasm +0 -0
- package/dist/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/docs/cli.md +1 -1
- package/docs/code-map.md +22 -6
- package/docs/concepts/loop-engine.md +24 -0
- package/docs/concepts/observer-protocol.md +22 -0
- package/docs/mcp-schema-changelog.md +43 -1
- package/package.json +1 -1
package/docs/code-map.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Code Map
|
|
2
2
|
|
|
3
|
-
Code Map is a per-project structural index of your
|
|
4
|
-
TSX, Python, PHP,
|
|
3
|
+
Code Map is a per-project structural index of your codebase across 11 languages:
|
|
4
|
+
JavaScript / TypeScript (including JSX / TSX), Python, PHP, Java, Go, Rust, C#,
|
|
5
|
+
Ruby, C, and C++. It parses each supported file with Tree-sitter and records the
|
|
5
6
|
symbols it defines (functions, classes, types, interfaces, React components and
|
|
6
7
|
hooks), what it imports and exports, and how files relate — then answers fast
|
|
7
8
|
"what should I read before I edit this?" questions for both human operators and
|
|
@@ -201,11 +202,24 @@ single-project repos ignore the flag entirely.
|
|
|
201
202
|
which nested projects have a built index vs `missing_index`, plus an aggregate
|
|
202
203
|
count — so you can see workspace-wide freshness from the root.
|
|
203
204
|
|
|
205
|
+
### Workspace-wide `find` / `brief`
|
|
206
|
+
|
|
207
|
+
Once the per-child indexes exist (built by `--cascade`), `find` and `brief` run
|
|
208
|
+
at a multi-project workspace **root** automatically aggregate across every child
|
|
209
|
+
project's store — no flag needed. Matches are project-tagged with
|
|
210
|
+
workspace-relative paths, and the freshness badge merges per-store status (worst
|
|
211
|
+
status wins) plus coverage (how many projects are indexed, listing any unindexed
|
|
212
|
+
children). An aggregated `brief` also surfaces **cross-package reverse
|
|
213
|
+
dependents**: sibling packages that import the defining package's public name
|
|
214
|
+
rank into the reading list, flagged `cross_package`.
|
|
215
|
+
|
|
216
|
+
From **inside** a child project, reads stay single-store by default (locality).
|
|
217
|
+
An explicit `traversal: "workspace"` (backend option) walks up to the nearest
|
|
218
|
+
enclosing multi-project root and aggregates from there, with the caller's own
|
|
219
|
+
package ranked first (`local: true` on its rows).
|
|
220
|
+
|
|
204
221
|
**Not yet supported** (roadmap):
|
|
205
222
|
|
|
206
|
-
- A single **federated query** at the root that fans out across the per-child
|
|
207
|
-
indexes and merges the results (today, `--cascade` builds the per-child indexes;
|
|
208
|
-
`find` / `brief` still run against one store at a time).
|
|
209
223
|
- **Cross-service edges** — e.g. linking an API call to the route that defines it in
|
|
210
224
|
another service. Code Map indexes language *symbols* and *module imports*, not
|
|
211
225
|
framework routes or runtime HTTP calls, so it does not (today) map "service A calls
|
|
@@ -215,7 +229,9 @@ count — so you can see workspace-wide freshness from the root.
|
|
|
215
229
|
|
|
216
230
|
The parser is [Tree-sitter](https://tree-sitter.github.io/) compiled to
|
|
217
231
|
WebAssembly. The engine glue (`web-tree-sitter`) and the prebuilt grammar `.wasm`
|
|
218
|
-
files
|
|
232
|
+
files — 12 grammars covering the 11 supported languages: `javascript` (also
|
|
233
|
+
handles JSX), `typescript`, `tsx`, `python`, `php`, `java`, `go`, `rust`,
|
|
234
|
+
`c_sharp`, `ruby`, `c`, `cpp` — are **bundled into the package** during the
|
|
219
235
|
build (`scripts/copy-code-map-wasm.mjs` copies them into `dist/wasm/` and vendors
|
|
220
236
|
the engine glue into `dist/vendor/web-tree-sitter/`).
|
|
221
237
|
|
|
@@ -486,6 +486,29 @@ The three rules are independent: `hard_deadline` bounds pathological "heartbeat
|
|
|
486
486
|
- Execution loops (`implementation`) route by `claim_id` — preserved from the claim-routed model already in use.
|
|
487
487
|
- `session_id` is not a routing key; it remains observability-only. This is consistent with `architecture_session_centric_identity` in memory.
|
|
488
488
|
|
|
489
|
+
### Project resolution gate (pln#521 P1)
|
|
490
|
+
|
|
491
|
+
`bclaw_coordinate(intent='review', open_loop=true)` resolves WHICH project the
|
|
492
|
+
loop belongs to before it writes anything. A loop that lands in the wrong store
|
|
493
|
+
persists a candidate, claim, assignment and loop where nobody is watching, and
|
|
494
|
+
spawns the reviewer against the wrong repo.
|
|
495
|
+
|
|
496
|
+
The ladder, in order: an explicit `project` argument; then any selector that
|
|
497
|
+
already won upstream (`--cwd`, `BRAINCLAW_PROJECT`, a session switch, the
|
|
498
|
+
physical child store, the workspace `active-project.json`); then the bare cwd
|
|
499
|
+
fallback. The fallback is accepted in a single-project store — there is exactly
|
|
500
|
+
one answer — and **refused** with `needs_project_selection` when the store can
|
|
501
|
+
host several projects (`project_mode: multi-project`, or a `store_type: workspace`
|
|
502
|
+
parent with nested project stores). The error lists the candidates and creates
|
|
503
|
+
nothing; fix it by passing `project='<name>'` or by making the choice sticky with
|
|
504
|
+
`bclaw_switch`. Ref, scope and path are never used to guess the project (B3
|
|
505
|
+
rejected in `art_e29e88878209`: a wrong guess costs more than an explicit choice).
|
|
506
|
+
|
|
507
|
+
Both `bclaw_coordinate` (open_loop reviews) and `bclaw_dispatch_status` echo the
|
|
508
|
+
decision as `project_name` / `project_cwd`. `dispatch_status` additionally carries
|
|
509
|
+
`_resolution_trace` (`source_cwd`, `effective_cwd`, `active_source`, `project_arg`)
|
|
510
|
+
so a misroute can be diagnosed without reverse-engineering cwd and store state.
|
|
511
|
+
|
|
489
512
|
## Open questions (resolved / deferred)
|
|
490
513
|
|
|
491
514
|
Status after Codex schema review (cnd#574 / `dec_be66ccbf`, verdict `needs_revision` → addressed in v8):
|
|
@@ -519,6 +542,7 @@ Status after Codex schema review (cnd#574 / `dec_be66ccbf`, verdict `needs_revis
|
|
|
519
542
|
The loop surface exposed over MCP is intentionally narrow:
|
|
520
543
|
|
|
521
544
|
- **Review loops** — `bclaw_coordinate(intent="review", open_loop=true, review_mode="asymmetric"|"symmetric", targetAgents=[…])` opens the loop and dispatches the first turn. The reviewer's verdict is then harvested from `LANE-RESULT.json` (`review_verdict`) and **auto-advances/closes the loop on approve** — no manual driving needed for the approve path (pln#628 Focus 4B). `bclaw_loop(intent="turn"|"complete_turn"|"advance"|"close")` remains available to drive turns by hand (e.g. the `request_changes` fix cycle, or a human-operated slot).
|
|
545
|
+
- **Turn-owned exactly-once fix cycle (default, pln#630).** The autonomous `request_changes` fix-cycle re-dispatch runs through the turn-owned attempt state machine (immutable attempt record + atomic launch fence → spawned at most once; `reconcileTurn` finalizes from read-strict, turn-keyed evidence — the ack-wrapper's completion sentinel). It falls back to the legacy closer when a reviewer resolves to inbox/manual (no sentinel) so the loop still converges. **Kill-switch:** set `BRAINCLAW_TURN_OWNED_REVIEW=0` (also `false`/`off`/`no`) to revert review finalization to the legacy presence-based closer.
|
|
522
546
|
- **Ideation loops** — `bclaw_coordinate(intent="ideate", preset="bootstrap")` opens an ideation loop from a preset.
|
|
523
547
|
|
|
524
548
|
Custom phase lists (`LoopPhase[]`) and bespoke `StopCondition` logic exist in the loop engine internally, but are **not** exposed through the MCP facade today: `CoordinateRequestSchema` accepts only `open_loop`, `review_mode`, `preflight`, `ref`, and `preset` — no `phases` or `stop_condition` — and the standalone `bclaw_loop` tool does not expose an `open` intent. Programmatic construction of ad-hoc loops is therefore internal / future work until the facade is extended.
|
|
@@ -213,6 +213,28 @@ the projection rule).
|
|
|
213
213
|
> from the seed otherwise. `agents`/`sessions` are never journaled → always seed.
|
|
214
214
|
> A store that has NOT run the supplement keeps the seed (no regression).
|
|
215
215
|
>
|
|
216
|
+
> **Section CONTENT cutover (pln#560 completion):** once `registryAuthoritative()`
|
|
217
|
+
> is set, the registry/coordination sections (ATTENTION, IN_PROGRESS, SPRINTS,
|
|
218
|
+
> and the flat claims/assignments/runs/actions/candidates drill-downs) serve
|
|
219
|
+
> their entity content from the projection too — zero MCP display fetches on
|
|
220
|
+
> expand. The non-journaled extras on the composites (server-computed
|
|
221
|
+
> `workflow_hints`, loops via `bclaw_loop(intent='list')`, and the
|
|
222
|
+
> `bclaw_dispatch_status` evidence digests of §6/§7) remain best-effort reads
|
|
223
|
+
> through the observer-flagged client: when no client resolves, the section
|
|
224
|
+
> still renders its entities. SYSTEM keeps its MCP fetch regardless — it mixes
|
|
225
|
+
> private/machine runtime_notes (never journaled, visibility boundary) and
|
|
226
|
+
> cross-project config, neither derivable from the shared journal.
|
|
227
|
+
>
|
|
228
|
+
> Two parity notes: (a) sections whose MCP fetch pre-filtered `status:
|
|
229
|
+
> 'pending'` server-side (actions, candidates) apply the equivalent pure
|
|
230
|
+
> filter on the projection, because renderers admit broader statuses; (b)
|
|
231
|
+
> journal-served sections are **legacy-inclusive** — the genesis backfill
|
|
232
|
+
> journals `provenance.kind='legacy'` records that the MCP default read
|
|
233
|
+
> filter excludes, and the projection trim drops the nested `provenance`
|
|
234
|
+
> object, so parity with the MCP default is not reconstructable client-side.
|
|
235
|
+
> Accepted deliberately: the operator tree already passes `includeLegacy:
|
|
236
|
+
> true` wherever it fetches explicitly.
|
|
237
|
+
>
|
|
216
238
|
> The historical (pre-pln#568) description below is kept for context.
|
|
217
239
|
|
|
218
240
|
The journal classifies records into five classes (§2). In phase 1 / `dual`
|
|
@@ -10,6 +10,33 @@ guarantees this changelog follows.
|
|
|
10
10
|
|
|
11
11
|
## Unreleased
|
|
12
12
|
|
|
13
|
+
**Added — turn-attempt evidence-correlation fields (pln#630 PR2b-a)**
|
|
14
|
+
- Additive, backward-compatible: `LaneResultSchema` gains optional `turn_id` /
|
|
15
|
+
`run_id` / `nonce`; `RuntimeEventSchema` gains optional `turn_id` / `nonce`
|
|
16
|
+
(`run_id` already present); `LoopSlotSchema` gains optional `current_turn_id`;
|
|
17
|
+
a `turn_reserved` variant joins the loop event journal. All optional/defaulted
|
|
18
|
+
— legacy records parse unchanged; no tool added/removed/renamed.
|
|
19
|
+
- `LoopSlotSchema.current_turn_id` flows into the zod-derived `LoopSlotInput`
|
|
20
|
+
embedded in `bclaw_loop`'s published inputSchema, so it DOES move the public
|
|
21
|
+
MCP surface fingerprint (bumped in the `(current)` section below) and
|
|
22
|
+
regenerates `mcp-schemas.generated.ts`. Additive optional field — no breaking
|
|
23
|
+
change to the tool contract.
|
|
24
|
+
|
|
25
|
+
**Changed — `bclaw_read_inbox` bounded + focused reads (pln#627 Phase A)**
|
|
26
|
+
- Default status filter is now **actionable** (pending + read); acknowledged and
|
|
27
|
+
archived are hidden unless `includeAll=true` or an explicit `status` is passed.
|
|
28
|
+
Previously an unset status returned every message (the "pending by default"
|
|
29
|
+
description was wrong).
|
|
30
|
+
- Results are ordered **newest-first** by `created_at` before pagination, so a
|
|
31
|
+
bounded page serves the most recent messages instead of the oldest debris.
|
|
32
|
+
- Message bodies are **previewed** (~500 chars) with `text_length` + `truncated`;
|
|
33
|
+
the full body is returned only with `full=true`. The page is size-bounded by
|
|
34
|
+
`budget_tokens` (like `bclaw_find` / `bclaw_search`), with `has_more` /
|
|
35
|
+
`next_offset` paging hints — a single read can no longer blow the token budget.
|
|
36
|
+
- Input schema gains `includeAll`, `full`, and `budget_tokens` (additive; moves
|
|
37
|
+
the surface fingerprint — see the current section). `structuredContent.messages`
|
|
38
|
+
now carries `text_length` + `truncated` per message.
|
|
39
|
+
|
|
13
40
|
**Added — `LaneResultSchema.review_verdict` / `review_summary` (pln#628 Focus 4B)**
|
|
14
41
|
- `LANE-RESULT.json` (the worktree-root file a dispatched worker writes) gains two
|
|
15
42
|
optional fields: `review_verdict` (`approve` | `request_changes`) and
|
|
@@ -238,7 +265,22 @@ will still succeed. A follow-up PR will strip the dead handler code.
|
|
|
238
265
|
changelog records the published MCP surface fingerprint. When a tool
|
|
239
266
|
name, tier, category, or input schema changes, the test fails until
|
|
240
267
|
this section is updated.
|
|
241
|
-
- MCP public surface fingerprint: `sha256:
|
|
268
|
+
- MCP public surface fingerprint: `sha256:8241fa50b8cb4805`
|
|
269
|
+
(updated 2026-07-25 for pln#632: `bclaw_loop` gains the `bind` intent — an
|
|
270
|
+
implementation loop dispatches its linked sequence and advances bind→execute — plus
|
|
271
|
+
its typed inputSchema properties `dry_run`, `lanes`, `auto_execute`, `model`, and
|
|
272
|
+
`max_assignments`. Additive — no tool added/removed/renamed; the new enum value + the
|
|
273
|
+
new properties move the fingerprint.)
|
|
274
|
+
Previous: `sha256:f3d49b28d2d366bb`
|
|
275
|
+
(updated 2026-07-24 for pln#630 PR2b-a: `LoopSlotSchema` gains an optional
|
|
276
|
+
`current_turn_id`, which flows through the zod-derived `LoopSlotInput` into
|
|
277
|
+
`bclaw_loop`'s published inputSchema. Additive optional field; regenerates
|
|
278
|
+
`mcp-schemas.generated.ts`.)
|
|
279
|
+
Previous: `sha256:fd8a7e910bf5f751`
|
|
280
|
+
(updated 2026-07-24 for pln#627 Phase A: the `bclaw_read_inbox` input schema
|
|
281
|
+
gains `includeAll`, `full`, and `budget_tokens`. Additive — no tool
|
|
282
|
+
added/removed/renamed; the three new typed properties move the fingerprint.)
|
|
283
|
+
Previous: `sha256:468f0103414e97e8`
|
|
242
284
|
(updated 2026-07-18 for pln#625 PR #83 + Codex review: `bclaw_list_agents`
|
|
243
285
|
retired and `bclaw_find(entity='agent')` gains `includeReputation` — now typed
|
|
244
286
|
as a boolean in `GRAMMAR_FILTER_CONTRACT.booleanKeys` and validated at the MCP
|