opencode-swarm 7.79.7 → 7.81.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/brainstorm/SKILL.md +2 -2
- package/.opencode/skills/codebase-review-swarm/SKILL.md +6 -0
- package/.opencode/skills/codebase-review-swarm/references/review-protocol-v8.2.md +5 -5
- package/.opencode/skills/council/SKILL.md +10 -3
- package/.opencode/skills/deep-dive/SKILL.md +4 -2
- package/.opencode/skills/deep-research/SKILL.md +13 -5
- package/.opencode/skills/plan/SKILL.md +1 -1
- package/.opencode/skills/specify/SKILL.md +1 -1
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +35 -0
- package/.opencode/skills/swarm-pr-review/SKILL.md +102 -62
- package/dist/background/completion-observer.d.ts +5 -5
- package/dist/background/pending-delegations.d.ts +58 -17
- package/dist/background/task-envelope.d.ts +5 -0
- package/dist/cli/index.js +183 -16
- package/dist/commands/pr-feedback.d.ts +8 -6
- package/dist/config/schema.d.ts +2 -0
- package/dist/hooks/knowledge-curator.d.ts +2 -0
- package/dist/hooks/knowledge-types.d.ts +1 -0
- package/dist/index.js +884 -66
- package/dist/memory/schema.d.ts +4 -4
- package/dist/tools/dispatch-lanes.d.ts +118 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/package.json +1 -1
|
@@ -76,11 +76,11 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
|
|
|
76
76
|
- final_council (default: OFF) -- when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
|
|
77
77
|
|
|
78
78
|
Additionally, present these two sub-items as part of the same exchange:
|
|
79
|
-
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel.
|
|
79
|
+
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
|
|
80
80
|
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
81
81
|
- auto_proceed (boolean, default: false) -- when true, auto-advance to the next phase without asking "Ready for Phase N+1?"; runtime toggle via /swarm auto-proceed on|off.
|
|
82
82
|
|
|
83
|
-
The user answers all
|
|
83
|
+
The user answers all four items (gates, parallel coders, commit frequency, auto_proceed) in one exchange. Wait for the user's response.
|
|
84
84
|
|
|
85
85
|
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
86
86
|
```
|
|
@@ -63,3 +63,9 @@ Use these baselines unless repository policy explicitly requires stricter or old
|
|
|
63
63
|
6. Run inline critic for CRITICAL/HIGH defects, enhancement critic for all kept enhancements, and final whole-report critic.
|
|
64
64
|
7. Write `review-report.md` only after coverage closure and final critic PASS.
|
|
65
65
|
8. Final response reports only the run path, selected tracks, counts summary, highest-risk items, coverage limitations, and confirmation that no source files were modified.
|
|
66
|
+
|
|
67
|
+
## Async advisory lanes
|
|
68
|
+
|
|
69
|
+
When selected-track inventory or candidate generation decomposes into independent read-only units, launch those units with `dispatch_lanes_async` when available. Record each returned `batch_id`, then continue architect-owned deterministic work that does not depend on lane output: update the coverage ledger shell, run safe local tools, prepare validation shards, and document unresolved coverage units. Do not mark coverage `REVIEWED`, promote candidates to findings, or write the final report from running lanes.
|
|
70
|
+
|
|
71
|
+
At every coverage, validation, and synthesis boundary, call `collect_lane_results` with `wait: true` for all open batches. Missing, stale, cancelled, or failed lanes are explicit coverage gaps and must become `BLOCKED` or `SKIPPED_WITH_REASON`; they cannot be silently ignored. If `dispatch_lanes_async` is unavailable, use the existing blocking dispatch pattern and record that async advisory lanes were unavailable.
|
|
@@ -126,9 +126,9 @@ Before writing under `.swarm/`, verify `.swarm/` is ignored or locally excluded.
|
|
|
126
126
|
## Phase 0 safe ordering
|
|
127
127
|
|
|
128
128
|
1. Run 0A alone.
|
|
129
|
-
2. After 0A, run 0B and 0C
|
|
130
|
-
3. After 0B, run 0D and 0E
|
|
131
|
-
4. Preferred batch order: batch 1 = 0F and 0G; batch 2 = 0H and 0I. Never exceed two Phase 0 agents.
|
|
129
|
+
2. After 0A, run 0B and 0C through `dispatch_lanes_async` only if the repository is large enough to benefit. While those lanes run, the Architect continues deterministic inventory work that does not depend on their results.
|
|
130
|
+
3. After 0B, run 0D and 0E through `dispatch_lanes_async` only if 0E can leave `linked_claims` blank for Architect linking in 0J. Otherwise run 0D before 0E.
|
|
131
|
+
4. Preferred async batch order: batch 1 = 0F and 0G; batch 2 = 0H and 0I. Never exceed two Phase 0 agents.
|
|
132
132
|
5. Run 0F after 0E when possible.
|
|
133
133
|
6. Run 0G after 0B and 0C.
|
|
134
134
|
7. Run 0H and 0I after 0B and 0C.
|
|
@@ -136,7 +136,7 @@ Before writing under `.swarm/`, verify `.swarm/` is ignored or locally excluded.
|
|
|
136
136
|
9. Run 0K after 0J. Stop for user track selection unless preselected.
|
|
137
137
|
10. Run 0L after track selection and before Phase 1 candidate generation. 0L is the last Phase 0 step before Phase 1.
|
|
138
138
|
|
|
139
|
-
Do not run dependent inventory passes merely to keep agents busy. Missing dependency context is `unknown`, not guessed.
|
|
139
|
+
Collect every async batch with `collect_lane_results` before consuming its ledger output or advancing to a dependent step. If `dispatch_lanes_async` or `collect_lane_results` is unavailable, fall back to blocking `dispatch_lanes`; if deterministic dispatch is unavailable, run isolated local passes and record that fallback. Do not run dependent inventory passes merely to keep agents busy. Missing dependency context is `unknown`, not guessed.
|
|
140
140
|
|
|
141
141
|
## Phase 0 inventory
|
|
142
142
|
|
|
@@ -205,7 +205,7 @@ Rules:
|
|
|
205
205
|
|
|
206
206
|
## Phase 1 — Candidate generation
|
|
207
207
|
|
|
208
|
-
Every dispatch includes selected track(s), exact file list or surface IDs, source-of-truth packet, repository-context packet, relevant ledgers, the applicable `TRACK_DEPTH_PLAN`, candidate format, `out_of_scope_note` rule, and anti-cursory/non-dilution reminder.
|
|
208
|
+
Every dispatch includes selected track(s), exact file list or surface IDs, source-of-truth packet, repository-context packet, relevant ledgers, the applicable `TRACK_DEPTH_PLAN`, candidate format, `out_of_scope_note` rule, and anti-cursory/non-dilution reminder. Prefer `dispatch_lanes_async` for independent candidate-generation coverage units so the Architect can continue building the review ledger, coverage map, and validation routing while lanes inspect subsystems. Call `collect_lane_results` before Phase 2 reviewer validation; no candidate may be routed, counted, or synthesized until its async batch has settled or been explicitly marked blocked/skipped.
|
|
209
209
|
|
|
210
210
|
File-size rule: no more than 15 files per deep pass; no more than 8 dense files per deep pass. Dense = >300 logical lines, multiple unrelated responsibilities, or interleaved UI/state/network/security logic. No sampling inside assigned scope. Large selections require more deep passes, not larger batches or lower depth.
|
|
211
211
|
|
|
@@ -87,8 +87,12 @@ RESEARCH CONTEXT
|
|
|
87
87
|
|
|
88
88
|
3. Dispatch `the active swarm's council_generalist agent`,
|
|
89
89
|
`the active swarm's council_skeptic agent`, and
|
|
90
|
-
`the active swarm's council_domain_expert agent`
|
|
91
|
-
|
|
90
|
+
`the active swarm's council_domain_expert agent` with `dispatch_lanes_async`
|
|
91
|
+
when available -- one lane per agent. Record the returned `batch_id`, then
|
|
92
|
+
continue only non-dependent architect work: prepare the synthesis outline,
|
|
93
|
+
normalize the RESEARCH CONTEXT citations, and draft disagreement categories.
|
|
94
|
+
Do not call `convene_general_council` or present conclusions from running
|
|
95
|
+
lanes. Each dispatch message must
|
|
92
96
|
include:
|
|
93
97
|
- The question
|
|
94
98
|
- Round number: 1
|
|
@@ -99,7 +103,10 @@ RESEARCH CONTEXT
|
|
|
99
103
|
|
|
100
104
|
Do NOT share other agents' responses at this stage.
|
|
101
105
|
|
|
102
|
-
4.
|
|
106
|
+
4. Call `collect_lane_results` with `wait: true` for the Round 1 batch and collect
|
|
107
|
+
all three JSON responses. If `dispatch_lanes_async` is unavailable, use
|
|
108
|
+
blocking parallel dispatch and record that async advisory lanes were
|
|
109
|
+
unavailable. The `round1Responses` array will contain
|
|
103
110
|
entries with `memberId` of `council_generalist`, `council_skeptic`, and
|
|
104
111
|
`council_domain_expert` and `role` of `generalist`, `skeptic`, and
|
|
105
112
|
`domain_expert` respectively. These come from the agents' JSON output; no
|
|
@@ -45,7 +45,7 @@ Produce a SCOPE MAP: list of files, modules, and interfaces within the audit bou
|
|
|
45
45
|
|
|
46
46
|
## Step 3 — Explorer Missions (Parallel Waves)
|
|
47
47
|
|
|
48
|
-
Dispatch explorer waves
|
|
48
|
+
Dispatch explorer waves with `dispatch_lanes_async` when available. Each wave contains up to `max_explorers` missions.
|
|
49
49
|
|
|
50
50
|
**File caps per mission:**
|
|
51
51
|
- 8 files maximum per mission
|
|
@@ -71,7 +71,9 @@ Each explorer mission receives:
|
|
|
71
71
|
- The scope map context from Step 2
|
|
72
72
|
- Instruction: "You are performing a [LANE] audit. Report findings as candidate observations with severity (INFO/LOW/MEDIUM/HIGH/CRITICAL), location, and evidence."
|
|
73
73
|
|
|
74
|
-
Explorer missions are dispatched in parallel waves.
|
|
74
|
+
Explorer missions are dispatched in parallel waves. Launch the wave, record the returned `batch_id`, then continue deterministic architect work that does not depend on lane output: refine the scope map, build the candidate ledger shell, inspect local evidence with read-only tools, and prepare reviewer shard structure. Do not synthesize findings from running lanes.
|
|
75
|
+
|
|
76
|
+
At the Step 4 boundary, call `collect_lane_results` with `wait: true` for every open wave batch. Treat missing, stale, cancelled, or failed lanes as explicit coverage gaps; do not silently proceed past a required lane. If `dispatch_lanes_async` is unavailable, use blocking `dispatch_lanes` or parallel Task calls and record that async advisory lanes were unavailable.
|
|
75
77
|
|
|
76
78
|
Explorers generate CANDIDATE FINDINGS only — they do NOT make verdicts. All findings are unverified until Step 5.
|
|
77
79
|
|
|
@@ -97,8 +97,12 @@ RESEARCH CONTEXT — <subtopic>
|
|
|
97
97
|
|
|
98
98
|
## Step 4 — Parallel Synthesis Workers
|
|
99
99
|
|
|
100
|
-
Dispatch up to `max_researchers` `the active swarm's sme agent` calls
|
|
101
|
-
— one per subtopic
|
|
100
|
+
Dispatch up to `max_researchers` `the active swarm's sme agent` calls with
|
|
101
|
+
`dispatch_lanes_async` when available — one per subtopic. Record the returned
|
|
102
|
+
`batch_id`, then continue architect-owned retrieval quality work that does not
|
|
103
|
+
depend on worker output: tighten the evidence ledger, check source authority,
|
|
104
|
+
prepare reviewer shard structure, and identify unresolved gaps. Do not write final
|
|
105
|
+
claims from running lanes. Each sme dispatch must
|
|
102
106
|
include:
|
|
103
107
|
- `DOMAIN`: the subtopic
|
|
104
108
|
- `TASK`: "Synthesize an evidence-grounded answer for this subtopic. Cite each
|
|
@@ -109,9 +113,13 @@ include:
|
|
|
109
113
|
- `OUTPUT`: claims with evidence refs, contradictions noted, confidence (0–1)
|
|
110
114
|
- `SKILLS: none`
|
|
111
115
|
|
|
112
|
-
The sme synthesizes only from the provided evidence — it does not fetch.
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
The sme synthesizes only from the provided evidence — it does not fetch. Before
|
|
117
|
+
Step 5, call `collect_lane_results` with `wait: true` for every open synthesis
|
|
118
|
+
batch. Collect all completed worker responses into a candidate findings set, each
|
|
119
|
+
finding tagged with its subtopic, evidence refs, and the worker's confidence.
|
|
120
|
+
Treat missing, stale, cancelled, or failed lanes as explicit coverage gaps. If
|
|
121
|
+
`dispatch_lanes_async` is unavailable, use blocking parallel dispatch and record
|
|
122
|
+
that async advisory lanes were unavailable.
|
|
115
123
|
|
|
116
124
|
## Step 5 — Dual-Reviewer Claim Verification
|
|
117
125
|
|
|
@@ -214,7 +214,7 @@ After `save_plan` succeeds, read `.swarm/context.md`:
|
|
|
214
214
|
- drift_check (default: ON) - mandatory per-phase drift verification at PHASE-WRAP
|
|
215
215
|
- final_council (default: OFF) - when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
|
|
216
216
|
Additionally, present these two sub-items as part of the same exchange:
|
|
217
|
-
- Parallel coders (default: 1, range: 1-4) - how many coders should run in parallel.
|
|
217
|
+
- Parallel coders (default: 1, range: 1-4) - how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files - safe and faster, but only for tasks whose file scopes do NOT overlap. Inspect the plan and recommend a count equal to the number of dependency-ready, file-disjoint task groups (clamped 1-4); recommend 1 (serial) when scopes overlap or are unknown. State your recommendation and reasoning when you ask.
|
|
218
218
|
- Commit frequency (default: phase-level only) - optional per-task checkpoint commit after each task completion.
|
|
219
219
|
The user answers all three (gates, parallel coders, commit frequency) in one exchange. Wait for the user's response.
|
|
220
220
|
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
@@ -47,7 +47,7 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
|
|
|
47
47
|
- final_council (default: OFF) -- when enabled, after all phases complete the architect dispatches the full 5-member council (critic, reviewer, sme, test_engineer, explorer) -- NOT the General Council -- at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This does not require `council.general.enabled`.
|
|
48
48
|
|
|
49
49
|
Additionally, present these three sub-items as part of the same exchange:
|
|
50
|
-
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel.
|
|
50
|
+
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
|
|
51
51
|
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
52
52
|
- auto_proceed (boolean, default: false) -- when true, auto-advance to the next phase without asking "Ready for Phase N+1?"; runtime toggle via /swarm auto-proceed on|off.
|
|
53
53
|
|
|
@@ -16,6 +16,13 @@ Use this skill to close known PR feedback. This is not a fresh broad PR review.
|
|
|
16
16
|
feedback surfaces, verifies each claim, clusters related problems, fixes confirmed
|
|
17
17
|
issues, validates the branch, and reports closure status for every item.
|
|
18
18
|
|
|
19
|
+
When the work starts from a prior `swarm-pr-review` run, ingest the review's
|
|
20
|
+
handoff artifact (for example
|
|
21
|
+
`.swarm/pr-review/<run_id>/feedback-handoff.md` or `.json`) before triage.
|
|
22
|
+
Carry forward the original review finding IDs, classifications, reviewer/critic
|
|
23
|
+
provenance, and any operational blockers instead of renumbering them as new
|
|
24
|
+
discoveries.
|
|
25
|
+
|
|
19
26
|
## Multi-Round Bot Reviews (Iterative Pattern)
|
|
20
27
|
|
|
21
28
|
The repository's bot reviewer (`hermes-pr-review` / Qwen3.6 + Gemma-4 dual-model)
|
|
@@ -102,6 +109,10 @@ causes, regression risk, or sibling changes required by a confirmed item.
|
|
|
102
109
|
GitHub review-thread resolution is user-controlled. Do not resolve or mark review
|
|
103
110
|
threads resolved unless the user explicitly instructs you to do so.
|
|
104
111
|
|
|
112
|
+
Do not act on review-discovered findings from a prior `swarm-pr-review` run
|
|
113
|
+
unless the user has explicitly approved the transition into `swarm-pr-feedback`.
|
|
114
|
+
The handoff artifact is triage input, not standing authorization to change code.
|
|
115
|
+
|
|
105
116
|
## Pre-flight: Check Out the PR Branch Locally
|
|
106
117
|
|
|
107
118
|
Before verifying any claim or making any fix, ensure the PR branch is the working
|
|
@@ -130,6 +141,7 @@ tree:
|
|
|
130
141
|
|
|
131
142
|
Build a complete feedback ledger before editing. Include every available source:
|
|
132
143
|
|
|
144
|
+
- validated findings and operational blockers handed off from `swarm-pr-review`,
|
|
133
145
|
- pasted user or reviewer feedback,
|
|
134
146
|
- GitHub review threads, inline review comments, and review summaries,
|
|
135
147
|
- PR issue comments and requested-changes reviews,
|
|
@@ -142,6 +154,24 @@ Build a complete feedback ledger before editing. Include every available source:
|
|
|
142
154
|
If a source is unavailable, record that limitation. Do not treat missing access as
|
|
143
155
|
evidence that no feedback exists.
|
|
144
156
|
|
|
157
|
+
### Async advisory verification lanes
|
|
158
|
+
|
|
159
|
+
After the complete feedback ledger exists and before editing, use
|
|
160
|
+
`dispatch_lanes_async` when available for independent read-only verification lanes:
|
|
161
|
+
comment classification, CI/log root-cause inspection, test impact mapping,
|
|
162
|
+
release/docs claim checks, and stale-branch/conflict analysis. Record each
|
|
163
|
+
returned `batch_id`, then continue only ledger-safe architect work: normalize
|
|
164
|
+
feedback IDs, gather deterministic PR metadata, prepare reproduction commands,
|
|
165
|
+
and plan likely fix groups. Do not edit, close items, or mark feedback resolved
|
|
166
|
+
from running lanes.
|
|
167
|
+
|
|
168
|
+
Before the Verification step can mark any item `RESOLVED`, `DISPROVED`,
|
|
169
|
+
`PRE_EXISTING`, `NEEDS_MORE_EVIDENCE`, or `NEEDS_USER_DECISION`, call
|
|
170
|
+
`collect_lane_results` with `wait: true` for every open verification batch.
|
|
171
|
+
Missing, stale, cancelled, or failed lanes remain explicit ledger limitations.
|
|
172
|
+
If `dispatch_lanes_async` is unavailable, use blocking verification and record
|
|
173
|
+
that async advisory lanes were unavailable.
|
|
174
|
+
|
|
145
175
|
### CI matrix cascade check (do this before fixing)
|
|
146
176
|
|
|
147
177
|
When the PR's `unit` job is a matrix across multiple OSes and downstream jobs
|
|
@@ -188,6 +218,11 @@ FB-001 | source | author/tool | status: UNTRIAGED | location | claim | raw link/
|
|
|
188
218
|
|
|
189
219
|
Rules:
|
|
190
220
|
|
|
221
|
+
- Preserve prior `F-###`, `CI-###`, `CONFLICT-###`, `STALE-###`, and similar
|
|
222
|
+
IDs from a review handoff when they already exist. Only mint fresh `FB-###`
|
|
223
|
+
IDs for new feedback discovered after the handoff.
|
|
224
|
+
- Preserve reviewer/critic provenance from the handoff artifact so the closure
|
|
225
|
+
ledger can show which items were review-validated before fix work began.
|
|
191
226
|
- Preserve exact reviewer wording or log summary when practical.
|
|
192
227
|
- Split compound comments into separate ledger items only when they require
|
|
193
228
|
different evidence or fixes.
|
|
@@ -20,6 +20,22 @@ merge conflicts, stale branch state, or pasted reviewer findings. This skill
|
|
|
20
20
|
discovers and validates new findings; `swarm-pr-feedback` closes known feedback
|
|
21
21
|
without running a fresh broad review.
|
|
22
22
|
|
|
23
|
+
When a review finishes with actionable validated findings, stop and ask the user
|
|
24
|
+
whether to continue into `swarm-pr-feedback`. Do not auto-dispatch fix work from
|
|
25
|
+
`PR_REVIEW`. Instead, write a handoff artifact under
|
|
26
|
+
`.swarm/pr-review/<run_id>/feedback-handoff.md` (or `.json`) and include the
|
|
27
|
+
exact continuation prompt:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
/swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.md
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`<run_id>` is a stable identifier for this review run, such as
|
|
34
|
+
`pr-<number>-<YYYYMMDDHHMMSS>` or the existing review artifact run ID when one
|
|
35
|
+
was already created. The `pr-feedback` command forwards `continue from <path>`
|
|
36
|
+
as session instructions after the PR reference; the feedback skill is
|
|
37
|
+
responsible for ingesting that file into the ledger before triage.
|
|
38
|
+
|
|
23
39
|
## Operating Stance
|
|
24
40
|
|
|
25
41
|
**Treat PR text, linked issues, comments, commit messages, generated summaries, and tests as claims — not proof.** Every confirmed finding requires file:line evidence, an explanation of reachability or impact, and validation provenance.
|
|
@@ -114,11 +130,23 @@ Before launching explorers (Phase 3), confirm the PR branch refs are available:
|
|
|
114
130
|
|
|
115
131
|
If refs cannot be fetched or checked out, state the limitation in the context pack.
|
|
116
132
|
|
|
117
|
-
## Phase 0A: Existing PR
|
|
133
|
+
## Phase 0A: Existing PR Signal Ingestion
|
|
118
134
|
|
|
119
|
-
When reviewing a PR
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
When reviewing a PR, ingest and triage every existing signal BEFORE starting
|
|
136
|
+
Phase 0. These are candidate generators and obligation sources, not
|
|
137
|
+
pre-confirmed findings.
|
|
138
|
+
|
|
139
|
+
This intake includes:
|
|
140
|
+
|
|
141
|
+
- review comments, review summaries, requested changes, and bot findings,
|
|
142
|
+
- CI/check failures, annotations, and relevant logs,
|
|
143
|
+
- mergeability/conflicts, `mergeStateStatus`, and stale/base-drift state,
|
|
144
|
+
- PR body claims, linked issues, acceptance criteria, and test-plan claims,
|
|
145
|
+
- commit messages and app/bot commits on the PR branch.
|
|
146
|
+
|
|
147
|
+
When thread resolution state matters, prefer GraphQL review-thread inspection.
|
|
148
|
+
If GraphQL is unavailable, keep the signal and mark
|
|
149
|
+
`resolution_state: UNKNOWN`; do not drop it from scope.
|
|
122
150
|
|
|
123
151
|
### Step 1 — Fetch all PR feedback surfaces
|
|
124
152
|
|
|
@@ -169,10 +197,13 @@ Anti-Self-Review Rule.
|
|
|
169
197
|
- ✗ Pre-confirming human review comments without independent validation — even senior reviewers make mistakes
|
|
170
198
|
- ✗ Skipping inline review comments and only reading the summary — inline comments contain the evidence
|
|
171
199
|
|
|
172
|
-
## Phase 0B:
|
|
200
|
+
## Phase 0B: Mergeability and Branch-State Intake
|
|
173
201
|
|
|
174
|
-
Before investing effort in review lanes, verify the PR is mergeable
|
|
175
|
-
|
|
202
|
+
Before investing effort in review lanes, verify the PR is mergeable and record
|
|
203
|
+
branch-state signals. `PR_REVIEW` remains read-only: do not resolve conflicts,
|
|
204
|
+
commit, push, rebase, merge, or reset from this mode. Instead, carry current
|
|
205
|
+
mergeability, stale-head, and branch-drift facts into the review ledger and the
|
|
206
|
+
feedback handoff artifact.
|
|
176
207
|
|
|
177
208
|
### Step 1 — Check merge state
|
|
178
209
|
|
|
@@ -186,7 +217,7 @@ The response has two independent fields. Handle each:
|
|
|
186
217
|
| Value | Meaning | Action |
|
|
187
218
|
|-------|---------|--------|
|
|
188
219
|
| `MERGEABLE` | No conflicts detected | Proceed — check `mergeStateStatus` below |
|
|
189
|
-
| `CONFLICTING` | Merge conflicts exist |
|
|
220
|
+
| `CONFLICTING` | Merge conflicts exist | Record the blocker, keep the review read-only, and hand conflict resolution to `swarm-pr-feedback` |
|
|
190
221
|
| `UNKNOWN` | GitHub still computing | Wait 30s, re-check |
|
|
191
222
|
|
|
192
223
|
**`mergeStateStatus` field** — overall branch state:
|
|
@@ -194,56 +225,48 @@ The response has two independent fields. Handle each:
|
|
|
194
225
|
|-------|--------|
|
|
195
226
|
| `CLEAN` | All checks pass, no conflicts — proceed to Phase 0 |
|
|
196
227
|
| `BEHIND` | Branch behind base — note in report; non-blocking if merge queue handles it |
|
|
197
|
-
| `DIRTY` | Merge conflicts exist —
|
|
198
|
-
| `BLOCKED` | External blocker (branch protection, failing required check) — investigate |
|
|
228
|
+
| `DIRTY` | Merge conflicts exist — keep reviewing, but record the conflict as a first-class blocker in the ledger and handoff artifact |
|
|
229
|
+
| `BLOCKED` | External blocker (branch protection, failing required check) — investigate and record the blocker |
|
|
199
230
|
|
|
200
|
-
### Step 2 —
|
|
231
|
+
### Step 2 — Record conflicts and blockers (when CONFLICTING or DIRTY)
|
|
201
232
|
|
|
202
233
|
When the PR has merge conflicts:
|
|
203
234
|
|
|
204
|
-
1. **Determine the PR's base branch and
|
|
235
|
+
1. **Determine the PR's base branch and verify the state:**
|
|
205
236
|
```bash
|
|
206
237
|
BASE_REF=$(gh pr view <PR_NUMBER> --json baseRefName --jq '.baseRefName')
|
|
207
238
|
git fetch origin $BASE_REF
|
|
208
|
-
|
|
209
|
-
git merge origin/$BASE_REF --no-commit --no-ff
|
|
210
|
-
git diff --name-only --diff-filter=U # list conflicted files
|
|
239
|
+
gh pr view <PR_NUMBER> --json mergeable,mergeStateStatus,baseRefName,headRefName
|
|
211
240
|
```
|
|
212
241
|
|
|
213
|
-
2. **
|
|
214
|
-
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
# For simple conflicts (after resolving markers):
|
|
220
|
-
git add -A
|
|
221
|
-
git commit -m "merge: resolve conflicts with main"
|
|
222
|
-
git push origin <pr-branch>
|
|
223
|
-
```
|
|
242
|
+
2. **Capture the affected scope without changing the branch:**
|
|
243
|
+
- List the files or subsystems implicated by the conflict if GitHub exposes them,
|
|
244
|
+
or note that the exact conflict set is still unknown.
|
|
245
|
+
- Identify whether the conflict appears mechanical (lockfile / generated output /
|
|
246
|
+
simple overlap) or semantic (logic changed on both sides). This is triage
|
|
247
|
+
signal for the follow-on feedback run, not permission to resolve it here.
|
|
224
248
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
# Run affected tests
|
|
230
|
-
bun test tests/unit/path/to/conflicted.test.ts --timeout 30000
|
|
231
|
-
```
|
|
249
|
+
3. **Record explicit next action for the handoff artifact:**
|
|
250
|
+
- `CONFLICT-### | mechanical | likely resolvable during pr-feedback`
|
|
251
|
+
- `CONFLICT-### | semantic | requires focused fix + validation during pr-feedback`
|
|
252
|
+
- `STALE-### | behind base by policy` when the branch is only stale, not conflicted
|
|
232
253
|
|
|
233
|
-
|
|
254
|
+
4. **Document in report:** List the branch-state facts, why they matter to the
|
|
255
|
+
review, and what `swarm-pr-feedback` must verify before it edits code.
|
|
234
256
|
|
|
235
257
|
### Conflict resolution anti-patterns
|
|
236
258
|
- ✗ Accepting "ours" or "theirs" for all conflicts without reading them
|
|
237
259
|
- ✗ Resolving semantic conflicts without understanding both sides
|
|
238
260
|
- ✗ Pushing resolution without running tests on the merged result
|
|
239
|
-
- ✗
|
|
261
|
+
- ✗ Treating `PR_REVIEW` as the place to fix branch state — this mode stays read-only
|
|
240
262
|
|
|
241
|
-
## Phase 0B-bis: Pre-
|
|
263
|
+
## Phase 0B-bis: Pre-Handoff Parallel Work Snapshot
|
|
242
264
|
|
|
243
|
-
When the review surfaces findings that
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
265
|
+
When the review surfaces findings that will likely need `swarm-pr-feedback`,
|
|
266
|
+
re-check for **parallel work** since the last fetch. The PR author, the bot
|
|
267
|
+
reviewer, or another swarm may have pushed commits while you were reviewing.
|
|
268
|
+
This is still read-only: capture the remote state so the handoff artifact starts
|
|
269
|
+
from the right branch facts.
|
|
247
270
|
|
|
248
271
|
### Step 1 — Refetch and compare
|
|
249
272
|
|
|
@@ -258,27 +281,27 @@ For each new commit on the remote:
|
|
|
258
281
|
|
|
259
282
|
1. **Read the commit message and diff.** Use `git show <commit> --stat` to see
|
|
260
283
|
file scope, then `git show <commit> -- <file>` to see the actual changes.
|
|
261
|
-
2. **Compare against
|
|
262
|
-
- Does the remote commit touch the same files
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
- Does the remote commit
|
|
266
|
-
|
|
267
|
-
3. **Default stance: prefer the
|
|
284
|
+
2. **Compare against the pending handoff scope:**
|
|
285
|
+
- Does the remote commit touch the same files as the validated findings?
|
|
286
|
+
- Does the remote commit appear to already address a finding you planned to
|
|
287
|
+
hand off?
|
|
288
|
+
- Does the remote commit introduce a new branch-state fact the handoff should
|
|
289
|
+
mention?
|
|
290
|
+
3. **Default stance: prefer the remote state as the next baseline.** Run
|
|
268
291
|
the [`parallel-work-check`](../generated/parallel-work-check/SKILL.md)
|
|
269
|
-
protocol for the formal decision template
|
|
292
|
+
protocol for the formal decision template and record the outcome in the
|
|
293
|
+
handoff artifact.
|
|
270
294
|
|
|
271
295
|
### Step 3 — Three outcomes
|
|
272
296
|
|
|
273
|
-
- **Parallel work supersedes:**
|
|
274
|
-
|
|
275
|
-
before
|
|
276
|
-
|
|
277
|
-
remote
|
|
278
|
-
|
|
279
|
-
- **Parallel work
|
|
280
|
-
|
|
281
|
-
- **Parallel work unrelated:** Continue with your planned fix.
|
|
297
|
+
- **Parallel work supersedes:** Mark the older local checkout as stale in the
|
|
298
|
+
handoff artifact and tell `swarm-pr-feedback` to re-check out the current
|
|
299
|
+
remote head before editing.
|
|
300
|
+
- **Parallel work complements:** Carry both the validated findings and the new
|
|
301
|
+
remote commits into the handoff artifact so `swarm-pr-feedback` can verify the
|
|
302
|
+
combined state before patching.
|
|
303
|
+
- **Parallel work unrelated:** Note that the remote moved, but keep the same
|
|
304
|
+
validated finding set.
|
|
282
305
|
|
|
283
306
|
### Anti-patterns
|
|
284
307
|
|
|
@@ -468,11 +491,11 @@ Tool candidate rules:
|
|
|
468
491
|
|
|
469
492
|
## Phase 3: Parallel Base Explorer Lanes
|
|
470
493
|
|
|
471
|
-
Launch all base lanes with
|
|
494
|
+
Launch all base lanes with `dispatch_lanes_async` when available. Pass the six lane specs together, set `max_concurrent` to `6`, record the returned `batch_id`, and continue only non-dependent architect work: refine the obligation ledger, inspect PR metadata, prepare micro-lane trigger checks, and run deterministic read-only local tools. Do not synthesize findings from running lanes.
|
|
472
495
|
|
|
473
|
-
If `
|
|
496
|
+
Before Phase 4 or synthesis, call `collect_lane_results` with `wait: true` for the base-lane batch and treat the collected `lane_results` as the join barrier. Missing, stale, cancelled, or failed base lanes are explicit review coverage gaps. If `dispatch_lanes_async` is unavailable, use blocking `dispatch_lanes`; if that is also unavailable, simulate isolated passes. Do not let one lane's conclusions bias another lane, and record unavailable deterministic dispatch in the validation gate.
|
|
474
497
|
|
|
475
|
-
**lane id uniqueness for parallel dispatches:** When re-dispatching failed or re-running explorer lanes, every `dispatch_lanes` lane `id` MUST be unique within that dispatch batch and should include lane and attempt suffixes (e.g. `pr_review_explore_lane1_attempt2`). Never reuse an id in the same batch unless intentionally replacing that exact lane before dispatch.
|
|
498
|
+
**lane id uniqueness for parallel dispatches:** When re-dispatching failed or re-running explorer lanes, every `dispatch_lanes_async` or `dispatch_lanes` lane `id` MUST be unique within that dispatch batch and should include lane and attempt suffixes (e.g. `pr_review_explore_lane1_attempt2`). Never reuse an id in the same batch unless intentionally replacing that exact lane before dispatch.
|
|
476
499
|
|
|
477
500
|
Explorers optimize for recall. Over-reporting is expected. Explorers produce candidates only.
|
|
478
501
|
|
|
@@ -510,7 +533,7 @@ Explorers must not use `CONFIRMED`, `DISPROVED`, or `PRE_EXISTING`.
|
|
|
510
533
|
|
|
511
534
|
## Phase 4: Triggered Swarm Plugin Micro-Lanes
|
|
512
535
|
|
|
513
|
-
After `
|
|
536
|
+
After `collect_lane_results` returns for base lanes, inspect the context pack risk triggers. Launch focused micro-lanes for triggered categories only, using `dispatch_lanes_async` again when more than one read-only micro-lane is needed. Collect every micro-lane batch with `wait: true` before reviewer classification. Do not launch irrelevant micro-lanes.
|
|
514
537
|
|
|
515
538
|
Each micro-lane receives:
|
|
516
539
|
|
|
@@ -793,7 +816,7 @@ Council mode is opt-in only and adversarial.
|
|
|
793
816
|
When triggered:
|
|
794
817
|
|
|
795
818
|
1. Build the same context pack as default mode.
|
|
796
|
-
2. Launch all council agents with one `
|
|
819
|
+
2. Launch all council agents with one `dispatch_lanes_async` call when available; continue only non-dependent context preparation while they run, then use `collect_lane_results` with `wait: true` as the join barrier before reviewer classification. Fall back to blocking `dispatch_lanes` when async launch is unavailable.
|
|
797
820
|
3. Each council agent assumes all work is wrong until code evidence proves otherwise.
|
|
798
821
|
4. Each agent hunts within its lane only.
|
|
799
822
|
5. Agents return evidence states only: `EVIDENCE_FOUND`, `SUSPICIOUS`, or `CLEAN`.
|
|
@@ -985,6 +1008,23 @@ Use one of:
|
|
|
985
1008
|
|
|
986
1009
|
Explain the recommendation in one short paragraph and list required actions before merge if applicable.
|
|
987
1010
|
|
|
1011
|
+
## Feedback handoff
|
|
1012
|
+
|
|
1013
|
+
When the review produced actionable validated findings or operational blockers,
|
|
1014
|
+
include:
|
|
1015
|
+
|
|
1016
|
+
- the handoff artifact path,
|
|
1017
|
+
- the preserved finding IDs and provenance that `swarm-pr-feedback` must carry
|
|
1018
|
+
forward,
|
|
1019
|
+
- and an explicit question asking whether to continue into
|
|
1020
|
+
`swarm-pr-feedback`.
|
|
1021
|
+
|
|
1022
|
+
Use this exact continuation prompt format:
|
|
1023
|
+
|
|
1024
|
+
```text
|
|
1025
|
+
/swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.md
|
|
1026
|
+
```
|
|
1027
|
+
|
|
988
1028
|
---
|
|
989
1029
|
|
|
990
1030
|
# Reviewer Prompt Template
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Background subagent completion
|
|
2
|
+
* Background subagent completion observer/ingester.
|
|
3
3
|
*
|
|
4
4
|
* Registers as a swarm `event` hook to watch for the upstream background-completion signal:
|
|
5
5
|
* a message part with `synthetic === true` whose text is a task envelope with
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* background-delegation record, it is logged (debug-gated) as the empirical confirmation
|
|
8
8
|
* instrument operators use to verify the runtime signal in a real environment.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* PR1 async advisory lanes ingest trusted terminal completions into the durable
|
|
11
|
+
* background-delegation ledger only. This still NEVER advances workflow gates or records
|
|
12
|
+
* gate evidence; gate-bearing execution is intentionally outside this advisory path.
|
|
13
13
|
*
|
|
14
14
|
* The `synthetic` flag is the trust gate (set by OpenCode, not the model/user). Non-synthetic
|
|
15
15
|
* text that merely looks like an envelope is ignored. The observer is fail-open: any error is
|
|
@@ -19,7 +19,7 @@ interface ObserverConfig {
|
|
|
19
19
|
enabled: boolean;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Build the
|
|
22
|
+
* Build the background completion observer. Returns an `event` handler suitable for the
|
|
23
23
|
* OpenCode plugin `event` hook. No-op (cheap early return) when the feature is disabled.
|
|
24
24
|
*/
|
|
25
25
|
export declare function createBackgroundCompletionObserver(opts: {
|