opencode-swarm 7.124.0 → 7.125.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/.opencode/skills/critic-gate/SKILL.md +8 -0
- package/.opencode/skills/swarm/SKILL.md +12 -8
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +252 -62
- package/.opencode/skills/swarm-pr-review/SKILL.md +242 -76
- package/README.md +3 -1
- package/dist/background/lane-output-store.d.ts +10 -0
- package/dist/background/pending-delegations.d.ts +3 -0
- package/dist/background/workspace-snapshot.d.ts +59 -0
- package/dist/cli/{config-doctor-53mnpeke.js → config-doctor-be9sxqx8.js} +2 -2
- package/dist/cli/{curation-policy-ny033330.js → curation-policy-52kt6d7t.js} +2 -2
- package/dist/cli/{curator-nvn1pdq6.js → curator-hbst8nbc.js} +14 -13
- package/dist/cli/{curator-llm-factory-e0tjz8qq.js → curator-llm-factory-frde1955.js} +14 -13
- package/dist/cli/{guardrail-explain-d3dd57nf.js → guardrail-explain-112kqmbc.js} +15 -14
- package/dist/cli/{guardrail-log-3q2z9axs.js → guardrail-log-c8zcab91.js} +3 -3
- package/dist/cli/{hive-promoter-9gbpepgm.js → hive-promoter-448xs2tp.js} +14 -13
- package/dist/cli/{index-eeg04r0x.js → index-09vd53pz.js} +1 -1
- package/dist/cli/{pending-delegations-e3bcqj77.js → index-0cz1ws47.js} +4 -18
- package/dist/cli/{index-v5ecczts.js → index-0y6tmm9v.js} +1 -1
- package/dist/cli/{index-13d2g7k9.js → index-67hqr2zv.js} +1 -1
- package/dist/cli/{index-e19mxn9f.js → index-6vfvc36k.js} +1 -1
- package/dist/cli/{index-qd77aft9.js → index-7j3sm7h8.js} +2 -2
- package/dist/cli/{index-wqwpzhv1.js → index-958hf0yr.js} +2 -2
- package/dist/cli/{index-z0m4angq.js → index-99ed0h32.js} +5 -5
- package/dist/cli/{index-8pz0ypxz.js → index-9hbwa5x1.js} +16 -15
- package/dist/cli/{index-mkkx1a4f.js → index-amspa811.js} +1504 -882
- package/dist/cli/{index-zjedv2bd.js → index-dx2c2wjt.js} +2 -2
- package/dist/cli/{index-htbjqftb.js → index-jh6s75f6.js} +1 -1
- package/dist/cli/{index-3yyr4ynk.js → index-kt0awv1n.js} +1 -1
- package/dist/cli/index-mg54y5gc.js +564 -0
- package/dist/cli/{index-x2mmnrnx.js → index-n6chz2g8.js} +1 -1
- package/dist/cli/{index-tyg0zezw.js → index-vtwqjr4z.js} +3 -3
- package/dist/cli/{index-c6crt5rs.js → index-xattnmyb.js} +9 -1
- package/dist/cli/{index-2x4maxte.js → index-yt1v62pv.js} +4 -4
- package/dist/cli/index.js +14 -13
- package/dist/cli/{knowledge-escalator-r1s01m3z.js → knowledge-escalator-htafbhxg.js} +3 -3
- package/dist/cli/{knowledge-events-a9hmxvke.js → knowledge-events-havw8c4t.js} +1 -1
- package/dist/cli/{knowledge-store-jt31br5k.js → knowledge-store-hqngpt2v.js} +1 -1
- package/dist/cli/{knowledge-validator-9vrwxr3z.js → knowledge-validator-g7mpnazh.js} +4 -4
- package/dist/cli/pending-delegations-7j8xqg5f.js +34 -0
- package/dist/cli/{scan-cursor-bkjtsawg.js → scan-cursor-sx7cvh8v.js} +2 -2
- package/dist/cli/{schema-y3z416z7.js → schema-2418eqy3.js} +1 -1
- package/dist/cli/{skill-generator-794hyndw.js → skill-generator-zggy797r.js} +5 -5
- package/dist/cli/workspace-snapshot-c9pxxt9a.js +48 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/hooks/pr-workflow-gate.d.ts +211 -0
- package/dist/hooks/pr-workflow-response-gate.d.ts +23 -0
- package/dist/hooks/pr-workflow-session-resolver.d.ts +14 -0
- package/dist/index.js +477 -445
- package/dist/tools/complete-pr-workflow.d.ts +5 -0
- package/dist/tools/dispatch-lanes.d.ts +44 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/run-pr-feedback-stage-a.d.ts +69 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/dist/tools/write-pr-review-trigger-eval.d.ts +56 -46
- package/package.json +1 -1
- package/dist/cli/index-dqh3zhhc.js +0 -133
- package/dist/cli/workspace-snapshot-eyf6gd0d.js +0 -22
|
@@ -25,6 +25,14 @@ Delegate plan to the active swarm's critic agent for review BEFORE any implement
|
|
|
25
25
|
|
|
26
26
|
You MUST NOT proceed to MODE: EXECUTE without printing this checklist with filled values.
|
|
27
27
|
|
|
28
|
+
**Post-approval verification:** Before dispatching the first coder in
|
|
29
|
+
MODE: EXECUTE, call `get_approved_plan` to confirm the critic's APPROVED
|
|
30
|
+
verdict was recorded. The approval-recording heuristic can fail silently
|
|
31
|
+
if the dispatch prompt didn't contain the expected keywords. Dispatching
|
|
32
|
+
coders without a recorded approval wastes cycles — the coder gate will
|
|
33
|
+
reject with `PLAN_CRITIC_GATE_VIOLATION`. One read-only call prevents
|
|
34
|
+
this entire failure class.
|
|
35
|
+
|
|
28
36
|
CRITIC-GATE TRIGGER: Run ONCE when you first write the complete .swarm/plan.md.
|
|
29
37
|
Do NOT re-run CRITIC-GATE before every project phase.
|
|
30
38
|
If resuming a project with an existing approved plan, CRITIC-GATE is already satisfied.
|
|
@@ -5,7 +5,8 @@ description: Cross-agent swarm-mode behavior model — a higher-rigor workflow u
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Goal
|
|
8
|
-
Turn the host agent into a swarm-like orchestrator
|
|
8
|
+
Turn the host agent into a swarm-like orchestrator that prioritizes complete,
|
|
9
|
+
evidence-backed results over elapsed time, token count, or dispatch count.
|
|
9
10
|
|
|
10
11
|
## What this mode changes
|
|
11
12
|
When enabled, the agent should:
|
|
@@ -16,22 +17,25 @@ When enabled, the agent should:
|
|
|
16
17
|
- keep quality as the only metric that matters
|
|
17
18
|
- treat time pressure as nonexistent
|
|
18
19
|
- preserve normal host-agent strengths: parallel subagents, scoped exploration, and fast synthesis
|
|
19
|
-
-
|
|
20
|
+
- spend the deepest validation effort where it materially reduces ship risk,
|
|
21
|
+
without using time, token, or dispatch cost to waive a required gate
|
|
20
22
|
|
|
21
|
-
## Quality
|
|
23
|
+
## Quality policy
|
|
22
24
|
Code quality and pre-ship defect detection are paramount.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
Elapsed time, token count, dispatch count, and perceived repository simplicity
|
|
26
|
+
are never reasons to weaken a required workflow step. Parallelism is used to
|
|
27
|
+
reduce wall-clock latency without reducing coverage or independence.
|
|
26
28
|
|
|
27
29
|
That means:
|
|
28
30
|
- parallelize breadth aggressively
|
|
29
31
|
- validate in depth selectively based on risk
|
|
30
|
-
-
|
|
32
|
+
- run every reviewer or critic loop required by the active workflow; optional
|
|
33
|
+
extra scrutiny may still be risk-targeted
|
|
31
34
|
- spend the most time on correctness, security, edge cases, regressions, and claimed-vs-actual mismatches
|
|
32
35
|
- keep low-risk nits cheap
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
Only explicitly optional workflow steps may be skipped. A required step remains
|
|
38
|
+
required even when the architect predicts that it will find nothing.
|
|
35
39
|
If a workflow step prevents real bugs from shipping, keep it even if it costs time.
|
|
36
40
|
|
|
37
41
|
## Default triage model
|
|
@@ -6,9 +6,9 @@ description: >
|
|
|
6
6
|
Use when addressing pasted PR feedback, GitHub review comments or threads,
|
|
7
7
|
requested changes, CI/check failures, merge conflicts, stale PR branches, or
|
|
8
8
|
PR follow-up work that must close all known issues without dropping findings.
|
|
9
|
-
Supports multi-round bot reviews
|
|
10
|
-
posts a new review after every push
|
|
11
|
-
|
|
9
|
+
Supports multi-round bot reviews when the repo uses an auto-review bot that
|
|
10
|
+
posts a new review after every push, via the iterative pattern documented in
|
|
11
|
+
the body. Stage A
|
|
12
12
|
(structural pre-checks) and Stage B (reviewer + test_engineer) gates and the
|
|
13
13
|
reviewer + critic closeout gate are MANDATORY for any change made as part of
|
|
14
14
|
this process.
|
|
@@ -17,6 +17,7 @@ description: >
|
|
|
17
17
|
# Swarm PR Feedback
|
|
18
18
|
|
|
19
19
|
Use this skill to close known PR feedback. This is not a fresh broad PR review.
|
|
20
|
+
Repository-specific bot names and examples below are illustrative; substitute the repo's actual bot and branch-state surfaces when they differ.
|
|
20
21
|
`swarm-pr-review` discovers new findings; `swarm-pr-feedback` ingests existing
|
|
21
22
|
feedback surfaces, verifies each claim, clusters related problems, fixes confirmed
|
|
22
23
|
issues, validates the branch, and reports closure status for every item.
|
|
@@ -25,7 +26,8 @@ issues, validates the branch, and reports closure status for every item.
|
|
|
25
26
|
(reviewer + test_engineer) gates and the reviewer + critic closeout gate are
|
|
26
27
|
MANDATORY for any change made as part of this process. No fix lands, no closure
|
|
27
28
|
ledger row is marked FIXED, and no PR is published until all three gates pass on
|
|
28
|
-
the current diff.
|
|
29
|
+
the current diff. There is no speed, efficiency, or time exception. See
|
|
30
|
+
"Mandatory Gates" below for the full protocol.
|
|
29
31
|
|
|
30
32
|
When the work starts from a prior `swarm-pr-review` run, ingest the review's
|
|
31
33
|
handoff artifact (for example
|
|
@@ -43,10 +45,10 @@ fixes.
|
|
|
43
45
|
|
|
44
46
|
## Multi-Round Bot Reviews (Iterative Pattern)
|
|
45
47
|
|
|
46
|
-
When the repo uses an auto-review bot
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
N pushes, and budget for it.
|
|
48
|
+
When the repo uses an auto-review bot that posts a new review comment after
|
|
49
|
+
**every push** to the PR branch, identify that bot from the repository contract
|
|
50
|
+
and apply this pattern (for example `hermes-pr-review` in this repo). Expect N
|
|
51
|
+
rounds of review for N pushes, and budget for it.
|
|
50
52
|
|
|
51
53
|
**Round N+1 deltas vs Round N:**
|
|
52
54
|
- Fresh `FB-###` ledger IDs for new findings (do not reuse IDs from earlier rounds)
|
|
@@ -63,12 +65,15 @@ N pushes, and budget for it.
|
|
|
63
65
|
2. **Carry forward unresolved items.** Findings you marked `PARTIAL` or `NEEDS_USER_DECISION`
|
|
64
66
|
in round N will still be open in round N+1. The closure ledger should show their
|
|
65
67
|
evolution (e.g., "PARTIAL round 1 → CONFIRMED round 2 after evidence collected").
|
|
66
|
-
3. **Apply the 3-strikes-
|
|
67
|
-
raised 3+ times across rounds,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
3. **Apply the 3-strikes evidence-escalation rule.** When the same finding is
|
|
69
|
+
raised 3+ times across rounds, re-run source verification with a fresh
|
|
70
|
+
reviewer context and surface the disagreement explicitly. Add a
|
|
71
|
+
defense-in-depth change only when that fresh verification proves the change
|
|
72
|
+
is correct, preserves the real invariant, and adds meaningful protection.
|
|
73
|
+
Repetition, time, token cost, and reviewer persistence are never substitutes
|
|
74
|
+
for evidence. Document any parent-vs-inner relationship inline so future
|
|
75
|
+
readers see the rationale.
|
|
76
|
+
**Do not add the repeated suggestion:** If it would add incorrect or
|
|
72
77
|
misleading code about existing guards — e.g., an outer guard that already exists at an
|
|
73
78
|
inner scope and whose addition would imply the inner guard is absent, a type
|
|
74
79
|
narrowing that masks a real error class, or a check whose presence asserts a
|
|
@@ -117,11 +122,15 @@ current branch before editing:
|
|
|
117
122
|
|
|
118
123
|
### Automated Security Finding Verification
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
This is a repository-agnostic verification checklist. Technology names and
|
|
126
|
+
paths in the examples below are illustrative only: apply an example only when
|
|
127
|
+
the reviewed repository actually uses that API, validator, runtime, or file
|
|
128
|
+
layout, and otherwise translate the same origin-to-sink question to the
|
|
129
|
+
repository's language and framework. No example creates a dependency on the
|
|
130
|
+
opencode-swarm tree.
|
|
131
|
+
|
|
132
|
+
Automated security bots can produce CRITICAL or HIGH false positives. Before
|
|
133
|
+
acting on any bot security finding, perform these source-level checks:
|
|
125
134
|
|
|
126
135
|
1. **`child_process.exec` vs `RegExp.exec`**: SAST rules pattern-match on
|
|
127
136
|
`.exec(` and cannot distinguish `child_process.exec(userInput)` (real
|
|
@@ -187,11 +196,12 @@ tree:
|
|
|
187
196
|
|
|
188
197
|
- If `head_ref` is a remote branch that is not checked out locally, fetch it
|
|
189
198
|
(`git fetch origin <head_ref>`).
|
|
190
|
-
- **Check for parallel work first.** Before checkout,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
199
|
+
- **Check for parallel work first.** Before checkout, use the repository or
|
|
200
|
+
runtime's parallel-work check. When the bundled
|
|
201
|
+
`parallel-work-check` skill exists, it is one conditional implementation to
|
|
202
|
+
detect concurrent pushes from other agents (for example the repo's
|
|
203
|
+
auto-review bot following up, a maintainer pushing fixes, or parallel swarm
|
|
204
|
+
work). If remote has new commits: read `git log local..remote`, evaluate whether the parallel work
|
|
195
205
|
supersedes your planned fixes, and prefer the parallel work if it's more
|
|
196
206
|
comprehensive (more tests, better edge coverage, clearer error handling).
|
|
197
207
|
Abort your rebase, take the remote state, then add minor improvements on top.
|
|
@@ -200,12 +210,18 @@ tree:
|
|
|
200
210
|
- **Check out the head branch locally.** Feedback verification reads the working-tree
|
|
201
211
|
filesystem (`Read`/`Glob`/`Grep`), and fixes must land on the PR branch — without a
|
|
202
212
|
checkout you would verify and patch the base branch's code instead. Record the
|
|
203
|
-
`
|
|
204
|
-
- Pass the `
|
|
213
|
+
exact `merge_base...head_ref` range for diff-scoped inspection.
|
|
214
|
+
- Pass the exact `merge_base...head_ref` commit range in every read-only verification or
|
|
205
215
|
explorer/advisory-lane delegation so lane agents can inspect specific revisions
|
|
206
216
|
with `git show` when needed.
|
|
207
217
|
- If no PR reference was provided (a pasted-feedback session on the current branch),
|
|
208
218
|
confirm the current branch is the intended PR branch before editing.
|
|
219
|
+
- If the fetched PR head is detached or has no local tracking branch, establish
|
|
220
|
+
it only during this pre-bind transition with the constrained existing-remote
|
|
221
|
+
form `git switch -c <local-branch> --track <remote>/<remote-branch>` (or set
|
|
222
|
+
the upstream of an existing local branch with
|
|
223
|
+
`git branch --set-upstream-to=<remote>/<remote-branch> <local-branch>`).
|
|
224
|
+
Branch creation/tracking is blocked after the immutable head is bound.
|
|
209
225
|
|
|
210
226
|
When a verification lane result includes `output_ref`, treat `output` as a
|
|
211
227
|
preview and call `retrieve_lane_output` before using it to classify, resolve,
|
|
@@ -218,9 +234,7 @@ ledger items as `NEEDS_MORE_EVIDENCE` or re-dispatch a narrower read-only lane.
|
|
|
218
234
|
Before staging any files for the PR commit, check the working tree state:
|
|
219
235
|
|
|
220
236
|
**The problem:** `git add -A` stages every uncommitted change in the working tree,
|
|
221
|
-
including pre-existing changes from other branches or prior work.
|
|
222
|
-
in one session during PR #1472 review, producing a 59-file commit instead of the
|
|
223
|
-
intended 2-file targeted fix.
|
|
237
|
+
including pre-existing changes from other branches or prior work.
|
|
224
238
|
|
|
225
239
|
**The check:** Run `git status --porcelain` first. If output is non-empty, identify
|
|
226
240
|
which files are PR-related vs pre-existing uncommitted changes.
|
|
@@ -235,13 +249,13 @@ git add src/foo.ts tests/foo.test.ts
|
|
|
235
249
|
Never use `git add -A` when the working tree has pre-existing changes from other
|
|
236
250
|
branches or prior work sessions.
|
|
237
251
|
|
|
238
|
-
*Reference: Caught during PR #1472 Round 1 closure.*
|
|
239
|
-
|
|
240
252
|
## Batch Collection (mandatory before any fix)
|
|
241
253
|
|
|
242
|
-
|
|
254
|
+
When the runtime provides a CI-failure-batching workflow, load it before
|
|
255
|
+
proceeding. The bundled `ci-failure-batching` skill is one conditional
|
|
256
|
+
implementation; otherwise apply the host-neutral complete-ledger protocol
|
|
257
|
+
below.
|
|
243
258
|
|
|
244
|
-
Issue #1746: 8+ push cycles where 3–4 would have sufficed with batching.
|
|
245
259
|
The anti-pattern: iterating check-by-check, proposing a fix for one failure,
|
|
246
260
|
pushing, waiting for CI, then discovering the next failure. Each cycle costs
|
|
247
261
|
one push + one CI run.
|
|
@@ -265,6 +279,12 @@ for the Fix Planning step.
|
|
|
265
279
|
|
|
266
280
|
## Pre-flight: Scope Discipline
|
|
267
281
|
|
|
282
|
+
The following `save_plan` / `declare_scope` mechanics apply only when those
|
|
283
|
+
plugin tools are available. In other repositories or runtimes, use the native
|
|
284
|
+
scope controller; if none exists, put exact allowed files and non-goals in the
|
|
285
|
+
delegation and verify the resulting diff mechanically. Never bypass an
|
|
286
|
+
available scope controller merely to reduce ceremony.
|
|
287
|
+
|
|
268
288
|
`declare_scope({ taskId, files })` enforces that the delegated coder agent may only modify the declared files. The enforcement requires an active `.swarm/plan.json` — calling `declare_scope` in a feedback-closure run (which does not go through `save_plan`) rejects with "No plan found."
|
|
269
289
|
|
|
270
290
|
**When to use `declare_scope` (preferred):** any feedback round that touches 2+ files, OR any feedback round where the file scope is not 100% obvious from the prompt. Before delegating, save a minimal plan via `save_plan` with a single phase containing the feedback-closure tasks, then call `declare_scope` per task with the exact file list.
|
|
@@ -292,12 +312,17 @@ If a source is unavailable, retry with alternative access paths. If unavailable
|
|
|
292
312
|
### Async advisory verification lanes
|
|
293
313
|
|
|
294
314
|
After the complete feedback ledger exists and before editing, use
|
|
295
|
-
`dispatch_lanes_async`
|
|
315
|
+
`dispatch_lanes_async` with `mode: "swarm-pr-feedback:verification"`, the
|
|
316
|
+
complete immutable `feedback_inventory` ID list, the exact current
|
|
317
|
+
`pr_head_sha`, and each lane's exact
|
|
318
|
+
`feedback_item_ids` ownership list for independent read-only verification lanes:
|
|
296
319
|
comment classification, CI/log root-cause inspection, test impact mapping,
|
|
297
320
|
release/docs claim checks, and stale-branch/conflict analysis. Partition the
|
|
298
321
|
ledger so each `FB-###` item is owned by exactly one verification lane and the
|
|
299
322
|
union of lanes covers the entire ledger — no feedback item may be left
|
|
300
|
-
unassigned to a lane; state each lane's owned
|
|
323
|
+
unassigned to a lane; state each lane's owned IDs both structurally and in its
|
|
324
|
+
prompt. The runtime rejects missing, duplicate, overlapping, or unknown item
|
|
325
|
+
ownership and blocks mutation until the verification batch settles. Scale
|
|
301
326
|
the lane count to the ledger size: a 1–3 item round may use a single combined
|
|
302
327
|
lane, while a large multi-round intake may warrant one lane per category above.
|
|
303
328
|
Cap each `dispatch_lanes_async` batch at 8 lanes (`MAX_LANES`); if the ledger
|
|
@@ -308,6 +333,15 @@ architect work: normalize feedback IDs, gather deterministic PR metadata, prepar
|
|
|
308
333
|
reproduction commands, and plan likely fix groups. Do not edit, close items, or
|
|
309
334
|
mark feedback resolved from running lanes.
|
|
310
335
|
|
|
336
|
+
Every verification lane must end with one parseable row for each owned item:
|
|
337
|
+
|
|
338
|
+
```text
|
|
339
|
+
[FEEDBACK-VERIFIED] | FB-### | CONFIRMED/PARTIAL/DISPROVED/PRE_EXISTING/NEEDS_MORE_EVIDENCE/NEEDS_USER_DECISION | evidence
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Non-empty prose without this marker contract is not a settled verification
|
|
343
|
+
artifact and cannot unlock mutation.
|
|
344
|
+
|
|
311
345
|
Before the Verification step can mark any item `CONFIRMED`, `PARTIAL`,
|
|
312
346
|
`DISPROVED`, `PRE_EXISTING`, `NEEDS_MORE_EVIDENCE`, or `NEEDS_USER_DECISION`,
|
|
313
347
|
every open verification batch must be fully settled. Poll with
|
|
@@ -319,10 +353,12 @@ exhausted, to confirm every lane is settled.
|
|
|
319
353
|
Missing, stale, cancelled, or failed lanes are coverage gaps that must be closed
|
|
320
354
|
before marking any item CONFIRMED/PARTIAL/DISPROVED/PRE_EXISTING. Apply the
|
|
321
355
|
COVERAGE GATE:
|
|
322
|
-
retry failed lanes (max 2)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
to the user as BLOCKED.
|
|
356
|
+
retry failed lanes (max 2) as another
|
|
357
|
+
`swarm-pr-feedback:verification` async batch with the same immutable inventory,
|
|
358
|
+
exact `pr_head_sha`, agent type, prompt, scope, and isolation, or stop and
|
|
359
|
+
surface the lane failure to the user as BLOCKED. Blocking and direct-Task
|
|
360
|
+
fallbacks are rejected because they cannot satisfy the durable ownership and
|
|
361
|
+
head-provenance gate.
|
|
326
362
|
Do not proceed with "blocking verification and record that async advisory lanes
|
|
327
363
|
were unavailable" — record-and-continue is not coverage closure.
|
|
328
364
|
|
|
@@ -351,6 +387,12 @@ entire pipeline. Before triaging, check:
|
|
|
351
387
|
|
|
352
388
|
### PR body claim verification
|
|
353
389
|
|
|
390
|
+
The `.swarm/evidence/` paths below apply only when the reviewed repository uses
|
|
391
|
+
this plugin's council evidence contract. For any other repository, locate the
|
|
392
|
+
authoritative CI attestation, code-host review record, or repository-declared
|
|
393
|
+
evidence store; the universal rule is that an approval claim needs a real,
|
|
394
|
+
retrievable provenance artifact.
|
|
395
|
+
|
|
354
396
|
PR body text like "PHASE 2 council APPROVED (5/5, round 2)" or "Final council
|
|
355
397
|
APPROVED" must be backed by an evidence file under `.swarm/evidence/` — phase
|
|
356
398
|
councils write `.swarm/evidence/{phaseNumber}/phase-council.json`; the final
|
|
@@ -464,7 +506,11 @@ Verification checklist:
|
|
|
464
506
|
- Check related tests and whether a failing/proposed test would prove the item.
|
|
465
507
|
- Check whether multiple feedback items share one root cause.
|
|
466
508
|
|
|
467
|
-
### DI seam migration validation
|
|
509
|
+
### DI seam migration validation (when the repository uses this pattern)
|
|
510
|
+
|
|
511
|
+
`_internals` and `mock.module()` below are JavaScript/TypeScript examples only.
|
|
512
|
+
For another stack, apply the same live-binding question using that language and
|
|
513
|
+
test runner's dependency-injection/mocking semantics.
|
|
468
514
|
|
|
469
515
|
When a test file mutates a DI seam object (e.g., `_internals.foo = mock`),
|
|
470
516
|
verify that the production source reads from the seam at call time. A common
|
|
@@ -523,7 +569,11 @@ or compatibility policy, mark the item `NEEDS_USER_DECISION` and ask.
|
|
|
523
569
|
and let the merge queue perform final current-base validation. Still resolve real
|
|
524
570
|
merge conflicts and SHA-dependent review threads before queuing.
|
|
525
571
|
|
|
526
|
-
###
|
|
572
|
+
### Conditional runtime/host gotchas
|
|
573
|
+
|
|
574
|
+
Apply each item below only when the named plugin tool, plan model, shell, or
|
|
575
|
+
code-host client is actually present. They are portability examples, not
|
|
576
|
+
requirements imposed on unrelated repositories.
|
|
527
577
|
|
|
528
578
|
- **Plan identity change:** When switching from a review plan to a feedback-closure
|
|
529
579
|
plan, `save_plan` rejects with `PLAN_IDENTITY_MISMATCH`. Pass
|
|
@@ -554,6 +604,64 @@ pre-checks; Stage B = `reviewer` + `test_engineer` per-task gates (consistent
|
|
|
554
604
|
with `execute`, `plan`, `specify`, `brainstorm`, `docs/swarm-briefing.md`, and
|
|
555
605
|
`docs/council/README.md`).
|
|
556
606
|
|
|
607
|
+
**Mechanical controller contract.** Prose acknowledgements, direct `Task` calls,
|
|
608
|
+
blocking dispatch, reused conversations, and free-form `APPROVE`/`PASS` text do
|
|
609
|
+
not satisfy these gates. The durable controller requires this exact sequence on
|
|
610
|
+
one content digest:
|
|
611
|
+
|
|
612
|
+
Controller authority follows the parent/child session ancestry. Coder and
|
|
613
|
+
nested child tool calls inherit the parent feedback gate; delegation never
|
|
614
|
+
grants early commit, push, remote-write, checkout, or protected-evidence
|
|
615
|
+
authority.
|
|
616
|
+
|
|
617
|
+
1. `run_pr_feedback_stage_a` with array-form commands for every concrete
|
|
618
|
+
workspace/category/source build, typecheck, and lint/format obligation
|
|
619
|
+
mechanically discovered from the repository's manifests, configs, scripts,
|
|
620
|
+
or bounded `.pr-validation.json` contract, plus exact
|
|
621
|
+
`["git", "diff", "--check"]`. A category with no repository-local signal is
|
|
622
|
+
not invented merely to reach a fixed command count.
|
|
623
|
+
Add one required proof command: use the exact failing CI/test reproduction
|
|
624
|
+
when the immutable inventory includes a defect or CI/test failure; otherwise
|
|
625
|
+
add a repo-appropriate targeted regression/test command that exercises the
|
|
626
|
+
changed behavior. The tool executes the commands; naming a category without
|
|
627
|
+
executing it is not evidence. The controller binds that reproduction receipt
|
|
628
|
+
to the complete immutable feedback inventory, so no feedback item can reach
|
|
629
|
+
Stage B with an unrelated or unowned Stage A receipt.
|
|
630
|
+
2. One `dispatch_lanes_async` lane with
|
|
631
|
+
`mode: "swarm-pr-feedback:stage-b-reviewer"`,
|
|
632
|
+
`workflow_lane: "stage-b-reviewer"`, every immutable
|
|
633
|
+
`feedback_item_ids`, and `max_concurrent: 1`.
|
|
634
|
+
3. After that lane settles positively, one fresh `test_engineer` lane with
|
|
635
|
+
`mode: "swarm-pr-feedback:stage-b-test"`, matching `workflow_lane`, the
|
|
636
|
+
complete inventory, and `max_concurrent: 1`.
|
|
637
|
+
4. After Stage B settles, one separate fresh reviewer lane with
|
|
638
|
+
`mode: "swarm-pr-feedback:closeout-reviewer"`, then one separate fresh
|
|
639
|
+
critic lane with `mode: "swarm-pr-feedback:closeout-critic"`. Each owns the
|
|
640
|
+
complete inventory and uses `max_concurrent: 1`.
|
|
641
|
+
|
|
642
|
+
Every gate lane emits exactly one fully populated row per feedback ID:
|
|
643
|
+
|
|
644
|
+
```text
|
|
645
|
+
[STAGE-B-REVIEW] | FB-001 | APPROVE|NEEDS_REVISION|BLOCKED | evidence
|
|
646
|
+
[STAGE-B-TEST] | FB-001 | PASS|FAIL|BLOCKED | evidence
|
|
647
|
+
[CLOSEOUT-REVIEW] | FB-001 | APPROVE|NEEDS_REVISION|BLOCKED | evidence
|
|
648
|
+
[CLOSEOUT-CRITIC] | FB-001 | APPROVE|NEEDS_REVISION|BLOCKED | evidence
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
Only exact positive verdict fields pass. A sentence containing “not APPROVE,” a
|
|
652
|
+
header without item rows, duplicate rows, missing IDs, degraded/truncated
|
|
653
|
+
artifacts, wrong roles, stale content digests, parallel or out-of-order phases,
|
|
654
|
+
and reused pre-edit approvals all fail closed. Any content change after Stage A
|
|
655
|
+
invalidates Stage A and every later gate; restart at step 1. Publication tools
|
|
656
|
+
and `git commit`/`git push` remain blocked until all four ordered lane phases
|
|
657
|
+
settle on the Stage-A digest. After they settle, only one standalone `git commit`
|
|
658
|
+
command may create the reviewed commit; push and remote publication remain
|
|
659
|
+
blocked until that exact commit is armed. The first completion requires a clean
|
|
660
|
+
index/worktree and a non-merge direct child commit whose sole parent is the
|
|
661
|
+
immutable intake head, so zero commits, multiple commits, merge commits,
|
|
662
|
+
amend/non-descendant histories,
|
|
663
|
+
`--allow-empty`, and partially committed reviewed content fail closed. There is no speed, efficiency, token, or time exception.
|
|
664
|
+
|
|
557
665
|
If a gate failure is suspected pre-existing, prove it on the base branch or
|
|
558
666
|
label it `UNVERIFIED`. Do not call the branch green while required checks are
|
|
559
667
|
non-green.
|
|
@@ -564,13 +672,56 @@ Run for every changed surface. No "where relevant" — every PR-feedback change
|
|
|
564
672
|
runs these; if a surface is genuinely untouched, state that explicitly rather
|
|
565
673
|
than skipping silently.
|
|
566
674
|
|
|
567
|
-
-
|
|
568
|
-
|
|
569
|
-
-
|
|
675
|
+
- the repository's actual build validation for the changed surface — must
|
|
676
|
+
succeed when that surface participates in a build,
|
|
677
|
+
- the repository's actual typecheck/static-analysis validation for the changed
|
|
678
|
+
surface — must pass when such a check exists,
|
|
679
|
+
- the repository's actual lint/format validation for the changed surface — must
|
|
680
|
+
pass when such a check exists,
|
|
570
681
|
- `git diff --check` — no whitespace or merge-marker errors.
|
|
571
|
-
-
|
|
572
|
-
|
|
573
|
-
|
|
682
|
+
- one proof command is mandatory on every run:
|
|
683
|
+
- use the exact failing CI/test command when a ledger item is rooted in a
|
|
684
|
+
defect or CI/test failure; the reproduction must fail on the pre-fix tree
|
|
685
|
+
and pass after the fix.
|
|
686
|
+
- otherwise run a repo-appropriate targeted regression/test command that
|
|
687
|
+
exercises the changed behavior and passes on the post-fix tree.
|
|
688
|
+
|
|
689
|
+
Execute these through `run_pr_feedback_stage_a` when available. Its bounded
|
|
690
|
+
array-form commands are not arbitrary shell escape hatches: diff-check and a
|
|
691
|
+
targeted reproduction are unconditional, every mechanically discovered
|
|
692
|
+
workspace/category/source obligation is also required, and each command must
|
|
693
|
+
match its declared build/typecheck/lint/diff-check/reproduction intent. Multiple
|
|
694
|
+
commands in one category are mandatory when polyglot or monorepo discovery
|
|
695
|
+
produces multiple obligations; use the exact `working_directory` and
|
|
696
|
+
`obligation_id` for each. Every obligation ID gets exactly one independently
|
|
697
|
+
executed receipt; identical commands remain separate only when distinct
|
|
698
|
+
repository sources mechanically require them. The
|
|
699
|
+
reproduction command must name at least one exact test, package, path, or
|
|
700
|
+
regression selector in `targets`. Invoke recognized validators and test runners
|
|
701
|
+
directly. Standard contained `./gradlew` and `./mvnw` wrappers are supported. A
|
|
702
|
+
repository with a custom validator can declare its exact array-form command in a
|
|
703
|
+
bounded `.pr-validation.json` version-1 contract that is byte-identical to
|
|
704
|
+
the immutable `base_ref`/`base_sha` merge-base copy and reference the exact
|
|
705
|
+
contract path/id. A contract added or changed by the PR never authorizes a
|
|
706
|
+
command. When that trusted contract replaces an otherwise opaque named
|
|
707
|
+
package script, the controller preserves the contract identity on the discovered
|
|
708
|
+
obligation and receipt, requires non-empty execution evidence, and permits only
|
|
709
|
+
an exact inspected npm, pnpm, yarn, or Bun script selection. Unsupported
|
|
710
|
+
workspace-glob semantics fail closed rather than silently omitting a workspace.
|
|
711
|
+
Arbitrary opaque scripts and unverified package-script names remain non-proof
|
|
712
|
+
because a name such as `test` or `build` can hide a no-op. A
|
|
713
|
+
reproduction must also return non-empty machine-observable runner output.
|
|
714
|
+
The reproduction check also supplies one `feedback_targets` row per immutable
|
|
715
|
+
feedback ID, in inventory order: exact `feedback_item_id`, one executed `target`,
|
|
716
|
+
and concrete `expected_behavior`. Missing, duplicate, invented, or target-less
|
|
717
|
+
mappings block Stage B; the controller persists that exact per-item mapping
|
|
718
|
+
rather than stamping an unrelated test onto the whole inventory.
|
|
719
|
+
No-op/help/list/dry-run,
|
|
720
|
+
fix/update, package publication/deployment, Git mutation, remote client,
|
|
721
|
+
shell/eval/wrapper, and credentialed publication surfaces fail closed. The
|
|
722
|
+
controller snapshots the content revision plus HEAD, index, refs, upstream, and
|
|
723
|
+
Git config before and after every command (including failures/timeouts); any
|
|
724
|
+
mutation invalidates Stage A and prevents later commands from becoming proof.
|
|
574
725
|
|
|
575
726
|
### Stage B — reviewer + test_engineer (mandatory after Stage A passes)
|
|
576
727
|
|
|
@@ -582,15 +733,18 @@ risks the test_engineer pinning a not-yet-approved fix shape.
|
|
|
582
733
|
- **reviewer** — independent (fresh context, not the implementer, not a continued
|
|
583
734
|
conversation). Validates each fix on the current diff against the feedback
|
|
584
735
|
item it closes. Verdict per item: APPROVE / NEEDS_REVISION / BLOCKED.
|
|
585
|
-
- **test_engineer** —
|
|
586
|
-
that proves each fix
|
|
587
|
-
newly covered gaps).
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
736
|
+
- **test_engineer** — independently designs and runs the falsification probe or
|
|
737
|
+
regression test that proves each fix resolves its item (tests for changed
|
|
738
|
+
behavior or newly covered gaps). The structured gate lane is read-only: if a
|
|
739
|
+
missing test must be authored, return `FAIL` with the exact requested probe so
|
|
740
|
+
implementation can add it before the sequence restarts. Verdict per item:
|
|
741
|
+
PASS / FAIL / BLOCKED.
|
|
742
|
+
|
|
743
|
+
Address every NEEDS_REVISION / BLOCKED / FAIL, then restart at Stage A on the
|
|
744
|
+
current diff. When implementation authors or modifies test files requested by
|
|
745
|
+
the test_engineer, the content-digest controller invalidates all earlier
|
|
746
|
+
receipts automatically. Stage A must be green over the full Stage-B-inclusive
|
|
747
|
+
diff before a new Stage B reviewer and test engineer run.
|
|
594
748
|
|
|
595
749
|
### Closeout gate — reviewer + critic (mandatory after Stage B)
|
|
596
750
|
|
|
@@ -613,10 +767,9 @@ reviewer's or critic's approval invalidates that approval** — re-run the
|
|
|
613
767
|
affected gate on the current diff before publishing.
|
|
614
768
|
|
|
615
769
|
Record both closeout verdicts (reviewer + critic, with HEAD/diff) in the
|
|
616
|
-
runtime's session task-gates artifact
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
write task artifacts there).
|
|
770
|
+
runtime's session task-gates artifact using the repository/runtime-specific
|
|
771
|
+
durable-session guidance when one exists. `.swarm/` is the plugin's runtime
|
|
772
|
+
state — never write task artifacts there.
|
|
620
773
|
|
|
621
774
|
### Post-publish verification (mandatory after the PR is pushed)
|
|
622
775
|
|
|
@@ -632,8 +785,35 @@ pre-checks and must not be folded into Stage A.
|
|
|
632
785
|
|
|
633
786
|
## Publishing And Communication
|
|
634
787
|
|
|
635
|
-
|
|
636
|
-
|
|
788
|
+
After every ordered local gate passes on one unchanged content digest, create
|
|
789
|
+
the reviewed commit with one standalone `git commit` command. Then call
|
|
790
|
+
`complete_pr_workflow` once with `mode: "PR_FEEDBACK"` and the immutable intake
|
|
791
|
+
`pr_head_sha`. A `ready-to-publish` result arms publication but deliberately
|
|
792
|
+
keeps the durable gate active and binds that post-commit HEAD to the current
|
|
793
|
+
branch's exact upstream remote-tracking ref. Configure the repository's intended
|
|
794
|
+
PR-branch upstream before committing and arming. Push is blocked before this
|
|
795
|
+
transition. Arming fails unless the index/worktree are clean and the bound HEAD
|
|
796
|
+
is a non-merge direct child whose sole parent is the immutable intake head. Any content
|
|
797
|
+
mutation or amend after it is blocked; restart at Stage A if the approved
|
|
798
|
+
content must change.
|
|
799
|
+
|
|
800
|
+
After arming, publish with exactly one non-force, single-ref command of the
|
|
801
|
+
form `git push <bound-remote> <bound-commit>:refs/heads/<bound-branch>`. The
|
|
802
|
+
source must be the literal commit ID bound by the first completion call, not
|
|
803
|
+
`HEAD`; the destination must be the branch behind the bound upstream
|
|
804
|
+
remote-tracking ref. Force flags, mirror/all/tags/delete operations, extra
|
|
805
|
+
refspecs, URLs, wrappers, `git -C`, `gh` writes, aliases, and other publication
|
|
806
|
+
surfaces fail closed. Read-only inspection remains available. Immediately
|
|
807
|
+
after the exact push and read-only remote verification, call
|
|
808
|
+
`complete_pr_workflow` again to prove the bound remote-tracking ref points at
|
|
809
|
+
the bound commit. Completion also performs a bounded query of the actual remote
|
|
810
|
+
branch; a locally forged or fetched tracking ref is never publication proof.
|
|
811
|
+
The gate clears only after both observations agree, before any PR
|
|
812
|
+
comment/body/thread write.
|
|
813
|
+
|
|
814
|
+
Commits and pushes follow the repository's commit/PR workflow (for example
|
|
815
|
+
`file:.swarm/bundled-skills/commit-pr/SKILL.md` when that bundled workflow is
|
|
816
|
+
available) — do not push ad-hoc.
|
|
637
817
|
|
|
638
818
|
After fixes, update the PR body or comment with a closure ledger:
|
|
639
819
|
|
|
@@ -653,6 +833,16 @@ head, and record the exact evidence used.
|
|
|
653
833
|
|
|
654
834
|
## Final Output
|
|
655
835
|
|
|
836
|
+
Before emitting the user-facing final response, call `complete_pr_workflow` a
|
|
837
|
+
second time with the same mode and immutable verification `pr_head_sha`. The
|
|
838
|
+
tool clears the durable session gate only when the content digest still equals
|
|
839
|
+
the independently approved digest, the exact approved commit remains current,
|
|
840
|
+
its bound upstream remote-tracking ref points to that exact commit, every
|
|
841
|
+
feedback ID has exact-provenance evidence, and no PR-workflow lanes remain
|
|
842
|
+
open. While the gate remains active, the runtime replaces architect
|
|
843
|
+
final-response text with a mechanical blocked notice and re-wakes an idle
|
|
844
|
+
parent session.
|
|
845
|
+
|
|
656
846
|
Report:
|
|
657
847
|
|
|
658
848
|
- intake sources checked and unavailable sources,
|