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.
Files changed (58) hide show
  1. package/.opencode/skills/critic-gate/SKILL.md +8 -0
  2. package/.opencode/skills/swarm/SKILL.md +12 -8
  3. package/.opencode/skills/swarm-pr-feedback/SKILL.md +252 -62
  4. package/.opencode/skills/swarm-pr-review/SKILL.md +242 -76
  5. package/README.md +3 -1
  6. package/dist/background/lane-output-store.d.ts +10 -0
  7. package/dist/background/pending-delegations.d.ts +3 -0
  8. package/dist/background/workspace-snapshot.d.ts +59 -0
  9. package/dist/cli/{config-doctor-53mnpeke.js → config-doctor-be9sxqx8.js} +2 -2
  10. package/dist/cli/{curation-policy-ny033330.js → curation-policy-52kt6d7t.js} +2 -2
  11. package/dist/cli/{curator-nvn1pdq6.js → curator-hbst8nbc.js} +14 -13
  12. package/dist/cli/{curator-llm-factory-e0tjz8qq.js → curator-llm-factory-frde1955.js} +14 -13
  13. package/dist/cli/{guardrail-explain-d3dd57nf.js → guardrail-explain-112kqmbc.js} +15 -14
  14. package/dist/cli/{guardrail-log-3q2z9axs.js → guardrail-log-c8zcab91.js} +3 -3
  15. package/dist/cli/{hive-promoter-9gbpepgm.js → hive-promoter-448xs2tp.js} +14 -13
  16. package/dist/cli/{index-eeg04r0x.js → index-09vd53pz.js} +1 -1
  17. package/dist/cli/{pending-delegations-e3bcqj77.js → index-0cz1ws47.js} +4 -18
  18. package/dist/cli/{index-v5ecczts.js → index-0y6tmm9v.js} +1 -1
  19. package/dist/cli/{index-13d2g7k9.js → index-67hqr2zv.js} +1 -1
  20. package/dist/cli/{index-e19mxn9f.js → index-6vfvc36k.js} +1 -1
  21. package/dist/cli/{index-qd77aft9.js → index-7j3sm7h8.js} +2 -2
  22. package/dist/cli/{index-wqwpzhv1.js → index-958hf0yr.js} +2 -2
  23. package/dist/cli/{index-z0m4angq.js → index-99ed0h32.js} +5 -5
  24. package/dist/cli/{index-8pz0ypxz.js → index-9hbwa5x1.js} +16 -15
  25. package/dist/cli/{index-mkkx1a4f.js → index-amspa811.js} +1504 -882
  26. package/dist/cli/{index-zjedv2bd.js → index-dx2c2wjt.js} +2 -2
  27. package/dist/cli/{index-htbjqftb.js → index-jh6s75f6.js} +1 -1
  28. package/dist/cli/{index-3yyr4ynk.js → index-kt0awv1n.js} +1 -1
  29. package/dist/cli/index-mg54y5gc.js +564 -0
  30. package/dist/cli/{index-x2mmnrnx.js → index-n6chz2g8.js} +1 -1
  31. package/dist/cli/{index-tyg0zezw.js → index-vtwqjr4z.js} +3 -3
  32. package/dist/cli/{index-c6crt5rs.js → index-xattnmyb.js} +9 -1
  33. package/dist/cli/{index-2x4maxte.js → index-yt1v62pv.js} +4 -4
  34. package/dist/cli/index.js +14 -13
  35. package/dist/cli/{knowledge-escalator-r1s01m3z.js → knowledge-escalator-htafbhxg.js} +3 -3
  36. package/dist/cli/{knowledge-events-a9hmxvke.js → knowledge-events-havw8c4t.js} +1 -1
  37. package/dist/cli/{knowledge-store-jt31br5k.js → knowledge-store-hqngpt2v.js} +1 -1
  38. package/dist/cli/{knowledge-validator-9vrwxr3z.js → knowledge-validator-g7mpnazh.js} +4 -4
  39. package/dist/cli/pending-delegations-7j8xqg5f.js +34 -0
  40. package/dist/cli/{scan-cursor-bkjtsawg.js → scan-cursor-sx7cvh8v.js} +2 -2
  41. package/dist/cli/{schema-y3z416z7.js → schema-2418eqy3.js} +1 -1
  42. package/dist/cli/{skill-generator-794hyndw.js → skill-generator-zggy797r.js} +5 -5
  43. package/dist/cli/workspace-snapshot-c9pxxt9a.js +48 -0
  44. package/dist/commands/registry.d.ts +1 -1
  45. package/dist/hooks/pr-workflow-gate.d.ts +211 -0
  46. package/dist/hooks/pr-workflow-response-gate.d.ts +23 -0
  47. package/dist/hooks/pr-workflow-session-resolver.d.ts +14 -0
  48. package/dist/index.js +477 -445
  49. package/dist/tools/complete-pr-workflow.d.ts +5 -0
  50. package/dist/tools/dispatch-lanes.d.ts +44 -0
  51. package/dist/tools/index.d.ts +2 -0
  52. package/dist/tools/manifest.d.ts +2 -0
  53. package/dist/tools/run-pr-feedback-stage-a.d.ts +69 -0
  54. package/dist/tools/tool-metadata.d.ts +8 -0
  55. package/dist/tools/write-pr-review-trigger-eval.d.ts +56 -46
  56. package/package.json +1 -1
  57. package/dist/cli/index-dqh3zhhc.js +0 -133
  58. package/dist/cli/workspace-snapshot-eyf6gd0d.js +0 -22
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: swarm-pr-review
3
3
  audience: swarm-plugin
4
- description: Run a graph-guided, tool-augmented Swarm PR review using context packing, parallel exploration, triggered plugin micro-lanes, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive tolerance and high recall.
4
+ description: Run a graph-guided, tool-augmented PR review using context packing, parallel exploration, mandatory repository-agnostic micro-lanes, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive tolerance and high recall in any repository.
5
5
  disable-model-invocation: true
6
6
  ---
7
7
 
@@ -11,7 +11,7 @@ Run a structured, high-confidence PR review that maximizes valid findings withou
11
11
 
12
12
  The review ladder is:
13
13
 
14
- **Scope → obligations → context pack → deterministic signals → parallel explorers → triggered Swarm micro-lanes → independent reviewer validation → critic challenge → grouped synthesis → metrics / knowledge writeback.**
14
+ **Scope → obligations → context pack → deterministic signals → parallel explorers → all repository-agnostic review micro-lanes → independent reviewer validation → critic challenge → grouped synthesis → metrics / knowledge writeback.**
15
15
 
16
16
  ## Handoff To PR Feedback
17
17
 
@@ -47,11 +47,11 @@ subscribed session.
47
47
 
48
48
  **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.
49
49
 
50
- This workflow is designed for the Swarm plugin itself and any repo that benefits from Swarm-style review. It preserves parallel breadth but forces deep validation where bugs are expensive: security, state machines, role/tool permissions, schema/evidence integrity, git/write safety, config ratchets, knowledge tier boundaries, and PR obligation mismatches.
50
+ This workflow is designed for any repo that benefits from Swarm-style review. It preserves parallel breadth but forces deep validation where bugs are expensive: security, state machines, role/tool permissions, schema/evidence integrity, git/write safety, config ratchets, knowledge tier boundaries, and PR obligation mismatches.
51
51
 
52
52
  Never APPROVE a PR with unresolved CRITICAL findings. Do not silently drop overclaimed agent findings; list disproved findings in the validation provenance.
53
53
 
54
- **Quality is the ONLY metric.** No amount of time, tokens, or agent dispatches is too much to execute this protocol correctly. Speed is irrelevant to correctness. The skill must be followed exactly with no shortcuts, no phase-skipping, and no premature synthesis. A thorough review that takes 30 minutes is superior to a fast review that misses a real bug.
54
+ **Quality is the ONLY metric.** There is no speed, efficiency, or time exception. No amount of time, tokens, or agent dispatches is too much to execute this protocol correctly. Speed is irrelevant to correctness. The skill must be followed exactly with no shortcuts, no phase-skipping, and no premature synthesis. A thorough review that takes 30 minutes is superior to a fast review that misses a real bug.
55
55
 
56
56
  ---
57
57
 
@@ -59,7 +59,7 @@ Never APPROVE a PR with unresolved CRITICAL findings. Do not silently drop overc
59
59
 
60
60
  ### Default layered workflow
61
61
 
62
- Use the default workflow unless the user explicitly triggers council mode. In the default workflow, explorers produce only candidates. The orchestrator does not confirm or disprove candidates.
62
+ Always run the default mechanical workflow. Explorers produce only candidates. The orchestrator does not confirm or disprove candidates.
63
63
 
64
64
  ### Council mode — opt in only
65
65
 
@@ -73,7 +73,7 @@ Council mode applies only when the user explicitly says one of:
73
73
  - `[MODE: PR_REVIEW … council=true]`
74
74
  - `assume all work is wrong`
75
75
 
76
- Council mode is mutually exclusive with the default layered workflow. Do not blend them.
76
+ Council mode supplements the default mechanical workflow; it never replaces or weakens it. Even when council mode is triggered, first complete the exact-six base dispatch, micro-lane ledger persistence, and every repository-agnostic micro-lane at the same exact `pr_head_sha`. Route supplementary council output into the candidate ledger before independent reviewer classification. If the council request arrives after classification has begun, run the council as an additional candidate pass and dispatch a new structured reviewer batch for those candidates before synthesis.
77
77
 
78
78
  ---
79
79
 
@@ -85,7 +85,7 @@ The orchestrator may:
85
85
 
86
86
  - determine scope,
87
87
  - build or request the context pack,
88
- - launch explorers and triggered micro-lanes,
88
+ - launch explorers and every mandatory repository-agnostic micro-lane,
89
89
  - extract candidates from lane artifacts via `parse_lane_candidates` or equivalent parser,
90
90
  - filter, group, and chunk candidates for reviewer dispatch,
91
91
  - route candidates to reviewers,
@@ -137,7 +137,7 @@ If scope cannot be determined, review the narrowest safe scope available and sta
137
137
  Before launching explorers (Phase 3), confirm the PR branch refs are available:
138
138
  - If `head_ref` is a remote branch that is not checked out locally, fetch it via `git fetch origin <head_ref>`
139
139
  - **Check out the head branch locally.** Explorer agents read files from the working tree, not from git history — passing the commit range in the delegation prompt is not sufficient because `Read` / `Glob` / `Grep` tools operate on the filesystem. Without a checkout, explorers silently read the base branch's version of changed files and produce invalid candidates. **Before checking out, verify the working tree is clean (`git status --porcelain`). If uncommitted changes exist, stash them or abort the checkout to prevent data loss.**
140
- - Explicitly pass the commit range (`base_ref..head_ref`) in every explorer delegation so explorers have the revision context for `git show` commands if they need to inspect specific versions.
140
+ - Explicitly pass the verified merge-base range (`base_sha...pr_head_sha`) in every explorer delegation so explorers inspect exactly the controller-bound PR diff. Include `base_ref` only as the live ref used to recompute `base_sha`; do not substitute a two-dot branch-tip range.
141
141
 
142
142
  If refs cannot be fetched or checked out, state the limitation in the context pack.
143
143
 
@@ -149,14 +149,37 @@ pre-confirmed findings.
149
149
 
150
150
  ### PR title and body compliance check
151
151
 
152
- Before deeper analysis, verify the PR meets the commit-pr skill's publication contract (the CI `pr-standards` check enforces the same requirements server-side — this step surfaces issues earlier):
153
-
154
- - **Title format:** `<type>(<scope>): <description>` — lowercase description, no trailing period, allowed types: `feat`, `fix`, `perf`, `revert`, `docs`, `chore`, `refactor`, `test`, `ci`, `build`.
155
- - **Body contract:** `Closes #<issue-number>` as the first line (when the PR resolves an issue), followed by `## Summary`, `## Invariant audit` (all 12 invariants), and `## Test plan` sections.
156
-
157
- **`Closes #N` claim-integrity check:** if the PR body claims `Closes #<issue-number>`, verify (a) the issue is currently open (`gh issue view <N> --json state`), and (b) the diff addresses the issue's acceptance criteria (read the issue, map each criterion to changed files/symbols, and inspect the diff for those areas). If the issue is already closed by another merged PR, do NOT re-close it — the duplicate `Closes #N` reference is misleading and will confuse release-please aggregation. If the issue is open but the diff does not address the acceptance criteria, mark the claim as `UNVERIFIED — claim integrity` in the validation provenance and surface the unresolved claim-integrity gap to the user before synthesis.
158
-
159
- Non-compliance is a ledger item (advisory, not blocking — CI will catch it). If the PR is from an external contributor, note the compliance gap for the maintainer to address before merge.
152
+ Before deeper analysis, discover whether the repository defines a PR
153
+ publication contract (for example a local `commit-pr` skill, `CONTRIBUTING`
154
+ guidance, a PR template, or a CI check such as `pr-standards`). If it does,
155
+ verify the PR against that contract and record any gap as an advisory ledger
156
+ item. If it does not, do not invent opencode-swarm-specific title/body
157
+ sections; still verify that the PR text is not misleading about what the diff
158
+ does or proves.
159
+
160
+ At minimum, check:
161
+
162
+ - required title/body/linked-issue structure from the discovered repository
163
+ contract,
164
+ - issue-closing, migration, release-note, invariant, or test-plan claims made
165
+ in the PR text,
166
+ - whether those claims are supported by the actual diff and the current issue
167
+ state.
168
+
169
+ **Issue-closing claim-integrity check:** if the PR body uses an issue-closing
170
+ keyword such as `Closes #<issue-number>`, verify (a) the issue is currently open
171
+ (`gh issue view <N> --json state` when the host is GitHub), and (b) the diff
172
+ addresses the issue's acceptance criteria (read the issue, map each criterion
173
+ to changed files/symbols, and inspect the diff for those areas). If the issue
174
+ is already closed by another merged PR, do NOT re-close it — the duplicate
175
+ closing reference is misleading. If the issue is open but the diff does not
176
+ address the acceptance criteria, mark the claim as `UNVERIFIED — claim
177
+ integrity` in the validation provenance and surface the unresolved gap to the
178
+ user before synthesis.
179
+
180
+ Contract non-compliance is a ledger item (advisory unless the repository
181
+ explicitly makes it blocking). If the PR is from an external contributor, note
182
+ the compliance gap for the maintainer to address before merge.
160
183
 
161
184
  This intake includes:
162
185
 
@@ -172,6 +195,11 @@ If GraphQL is unavailable, keep the signal and mark
172
195
 
173
196
  ### Step 1 — Fetch all PR feedback surfaces
174
197
 
198
+ The commands below are GitHub examples. On GitLab, Bitbucket, Gerrit, or
199
+ another code host, use the host's API/connector/CLI to enumerate the same full
200
+ surface, including pagination and unresolved-thread state. Host choice never
201
+ reduces the intake ledger.
202
+
175
203
  ```bash
176
204
  # Issue comments (general PR thread)
177
205
  gh api --paginate repos/{owner}/{repo}/issues/{PR_NUMBER}/comments
@@ -230,6 +258,10 @@ feedback handoff artifact.
230
258
 
231
259
  ### Step 1 — Check merge state
232
260
 
261
+ The field names and values below are GitHub-specific examples. On another code
262
+ host, record the equivalent mergeability, conflict, required-check, base-drift,
263
+ and stale-head signals and preserve the same read-only behavior.
264
+
233
265
  ```bash
234
266
  gh pr view <PR_NUMBER> --json mergeable,mergeStateStatus
235
267
  ```
@@ -562,7 +594,26 @@ Tool candidate rules:
562
594
 
563
595
  ## Phase 3: Parallel Base Explorer Lanes
564
596
 
565
- 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. Keep each lane `prompt` compact: send the shared review context (PR diff, obligation ledger, scope) ONCE via the `common_prompt` field, or have lanes read it from a file by absolute path, instead of inlining the same large blob into all six prompts — oversized inline prompts produce malformed or truncated tool-call JSON and force clumsy file workarounds.
597
+ Launch all base lanes with `dispatch_lanes_async` when available. Pass the six
598
+ lane specs together, set `mode: "swarm-pr-review:base"`, assign each lane its
599
+ exact `workflow_lane` identifier from the table below, set `max_concurrent` to
600
+ `6`, bind the batch with the exact current `pr_head_sha`, record the returned
601
+ `batch_id`, and pass the exact reviewed merge base and its live base tip/ref as
602
+ `base_sha` and `base_ref`. Every later base retry, micro, council, reviewer, and
603
+ critic dispatch repeats those same exact bindings. The controller recomputes
604
+ `git merge-base -- <base_ref> <pr_head_sha>`, rejects mismatches, and replaces
605
+ caller `scope` text with the complete verified `base_sha...pr_head_sha` PR diff;
606
+ caller scope is retained only as a non-authoritative focus hint. Continue only non-dependent architect
607
+ work: refine the obligation ledger, inspect PR metadata, prepare micro-lane
608
+ trigger checks, and run deterministic read-only local tools. The runtime rejects
609
+ partial, duplicate, mislabelled, or non-explorer base waves. Do not synthesize
610
+ findings from running lanes. Keep each lane `prompt` compact: send the shared
611
+ review context (PR diff, obligation ledger, scope) ONCE via the `common_prompt`
612
+ field, or have lanes read it from a file by absolute path, instead of inlining
613
+ the same large blob into all six prompts — oversized inline prompts produce
614
+ malformed or truncated tool-call JSON and force clumsy file workarounds.
615
+
616
+ This is an exact six-lane gate, not a soft target. If the base wave is launched with fewer than six lanes, the review is BLOCKED until the missing lanes are dispatched and settled; "small PR", "docs-only", "CI-only", and "time-saving" are not exceptions.
566
617
 
567
618
  **Incremental collection:** While base lanes are running, poll with `collect_lane_results` (without `wait` (or `wait: false`)) to check progress and process settled lanes as they complete — call `retrieve_lane_output` for full text when `output_ref` is present, then extract candidates via `parse_lane_candidates`, update the candidate ledger, validate output quality — while continuing independent architect work (obligation refinement, micro-lane trigger checks, local reads) between polls. Only use `wait: true` if lanes are still pending and no more independent work remains.
568
619
 
@@ -570,11 +621,11 @@ Before Phase 4 or synthesis, all base lanes must be settled. `dispatch_lanes_asy
570
621
 
571
622
  **COVERAGE GATE — zero tolerance for unclosed gaps.** After `collect_lane_results`, verify every lane produced validated output. Two failure modes exist:
572
623
  - **Mode A (empty output):** Lane returns 0 chars, `status: cancelled`, `output_digest` matches SHA-256 of empty string (`e3b0c442...b855`).
573
- - **Mode B (intermediate reasoning only):** Lane reports `status: completed` with non-empty output, but the output is preliminary reasoning ("Now let me check...") with zero `[CANDIDATE]` rows. The `output_digest` does NOT match the empty-string hash. `parse_lane_candidates` returns 0 candidates. This mode is MORE dangerous — the lane appears successful but produced no findings.
624
+ - **Mode B (intermediate reasoning only):** Lane reports `status: completed` with non-empty output, but the output is preliminary reasoning ("Now let me check...") with zero `[CANDIDATE]` rows and no parseable `[CLEAN] | workflow_lane | coverage_scope | evidence` attestation. The `output_digest` does NOT match the empty-string hash. `parse_lane_candidates` returns 0 candidates. This mode is MORE dangerous — the lane appears successful but produced no findings or clean proof.
574
625
 
575
626
  For ANY lane that failed (either mode):
576
- 1. **Retry** (max 2 attempts) with materially different parameters — different session, different prompt decomposition, or blocking `dispatch_lanes`.
577
- 2. If retries fail, **deploy an equivalent alternative** and **verify equivalence**: same agent type, same prompt, same scope, same isolation. Fallback order is explicit: retry or re-collect `dispatch_lanes_async` first, use blocking `dispatch_lanes` when async dispatch or collection cannot close coverage, then use the Task tool as the last-resort equivalent dispatch mechanism when lane tools do not work. State the Task fallback equivalence verification explicitly. Task is not an early-poll or empty-partial-output fallback; use `retrieve_lane_output` to inspect the full artifact before declaring equivalence or failure.
627
+ 1. **Retry** (max 2 attempts) with materially different parameters — different session or prompt decomposition, while preserving the required structured async mode and exact head provenance.
628
+ 2. If a base lane fails, retry only the failed `workflow_lane` identifiers with `dispatch_lanes_async`, `mode: "swarm-pr-review:base"`, the same exact `pr_head_sha`, and explorer agents. The durable gate joins successful provenance across the initial wave and retry batches. Blocking `dispatch_lanes` and direct Task dispatch are not equivalent under this workflow because they cannot satisfy the structured provenance gate.
578
629
  3. If no equivalent alternative can be verified, **STOP and surface the lane failure to the user as BLOCKED** with the lane id, scope, failure mode, retry attempts, and why equivalence could not be proven. Do not present partial findings, do not issue a review verdict, and do not synthesize from successful lanes. A low-quality partial review is worse than no review.
579
630
 
580
631
  ### Candidate extraction via parser
@@ -598,7 +649,7 @@ rather than preview-text extraction:
598
649
  4. Stage reviewer-sized chunks, but do not dispatch reviewers yet. Phase 4 must
599
650
  complete trigger accounting and settle every launched micro-lane first.
600
651
 
601
- If a lane has `output_degraded: true`, `transcript_incomplete: true`, or no usable `output_ref`, apply the COVERAGE GATE from Phase 3: retry (max 2) with materially different parameters, then use blocking `dispatch_lanes` or the Task tool as verified-equivalent fallbacks when lane tools do not work. If the gap cannot be closed, stop and surface the lane failure to the user as BLOCKED. Do not mark affected candidates UNVERIFIED to proceed past the gap. Never infer candidate absence from a preview.
652
+ If a lane has `output_degraded: true`, `transcript_incomplete: true`, or no usable `output_ref`, apply the COVERAGE GATE from Phase 3 with a structured async retry using the applicable workflow mode and the same exact `pr_head_sha`. If the gap cannot be closed, stop and surface the lane failure to the user as BLOCKED. Do not use blocking or direct-Task fallbacks, mark affected candidates UNVERIFIED to proceed, or infer candidate absence from a preview.
602
653
 
603
654
  After candidate parsing and before reviewer dispatch, persist the post-explorer
604
655
  candidate ledger using the Review Finding Persistence contract. This is the
@@ -617,16 +668,24 @@ in the same batch unless intentionally replacing that exact lane before dispatch
617
668
 
618
669
  Explorers optimize for recall. Over-reporting is expected. Explorers produce candidates only.
619
670
 
620
- The six lanes are a fixed **check-type** partition (correctness / security / deps / docs / tests / performance), not an area partition: the count is intentionally constant — every PR needs all six review dimensions — and the lanes deliberately overlap by file, each receiving the same diff via `common_prompt` and viewing it through a different lens. This is the deliberate exception to surface-scaled fan-out: the base wave is a fixed six by design, never collapsed or expanded with the size of the change. Coverage is guaranteed by the six dimensions each reading the whole diff, not by partitioning files across lanes — so the disjoint-partition rule that governs area-split fan-outs does not apply to these check-type lanes.
621
-
622
- | Lane | Focus | Required checks |
671
+ The six lanes are a fixed **check-type** partition, not an area partition: the
672
+ count is intentionally constant — every PR needs all six review dimensions —
673
+ and the lanes deliberately overlap by file, each receiving the same diff via
674
+ `common_prompt` and viewing it through a different lens. Six is this workflow's
675
+ high-assurance policy floor, not a claim that research proves a universal optimal
676
+ agent count. Repository policy may add scrutiny but may never reduce the six.
677
+ This is the deliberate exception to surface-scaled fan-out. Coverage is
678
+ guaranteed by all six dimensions reading the whole diff, so the disjoint-partition
679
+ rule that governs area-split fan-outs does not apply.
680
+
681
+ | `workflow_lane` | Focus | Required checks |
623
682
  |---|---|---|
624
- | Lane 1: Correctness and edge cases | Logic errors, null/undefined handling, incorrect operators, async ordering, races, off-by-one, error paths | input domain, nullability, async/await, loop termination, exception behavior, backward compatibility |
625
- | Lane 2: Security and trust boundaries | Injection, authz/authn bypass, SSRF, path traversal, secret exposure, unsafe deserialization, prompt injection | untrusted input sources, sanitization, credential handling, permission boundary, private network access, output escaping |
626
- | Lane 3: Dependencies and deployment safety | Import changes, version bumps, lockfile drift, breaking APIs, package scripts, runtime assumptions | lockfile consistency, new transitive deps, Node/Bun/runtime compatibility, platform assumptions, license red flags |
627
- | Lane 4: Docs, intent, and drift | PR claims vs implementation, docs mismatch, migration/changelog gaps, stale examples | obligation mapping, changed behavior not documented, docs promising behavior not implemented |
628
- | Lane 5: Tests and falsifiability | Weak assertions, missing edge tests, flaky patterns, mock leakage, fixture drift | assertion strength, tautology patterns (`expect(true).toBe(true)`, `expect(res).toBeDefined()` without further checks), `assertDoesNotThrow` wrapping trivial code), negative paths, isolation, deterministic timing, cross-platform path coverage |
629
- | Lane 6: Performance and architecture | Complexity regressions, memory leaks, over-coupling, inefficient graph scans, global mutable state | algorithmic deltas, caching, resource lifecycle, state ownership, architectural boundary violations |
683
+ | `intent-architecture` | Intent, scope, architecture, and integration | obligation mapping, design fit, callers/consumers, sibling patterns, docs and claimed-vs-actual behavior |
684
+ | `correctness-state` | Functional correctness, data/state flow, edge cases, and failure paths | input domains, nullability, ordering, transactions, error behavior, rollback, backwards behavior |
685
+ | `tests-falsifiability` | Tests, test validity, regressions, and claimed validation | assertion strength, negative paths, isolation, fixtures, deterministic timing, missing proof |
686
+ | `security-trust` | Security, privacy, trust boundaries, unsafe inputs/sinks, and supply chain | authorization, injection, secrets, provenance, dependency risk, data exposure, abuse paths |
687
+ | `reliability-performance` | Reliability, concurrency, retries, resource bounds, and performance | races, retry semantics, timeouts, lifecycle, caching, algorithmic cost, operational failure modes |
688
+ | `compatibility-delivery` | API/schema/config compatibility, maintainability, build/deploy, docs, and release behavior | public contracts, migrations, runtime/platform support, packaging, CI, rollout and recovery guidance |
630
689
 
631
690
  ### Explorer context contract
632
691
 
@@ -639,7 +698,7 @@ Every explorer must inspect or explicitly mark unavailable:
639
698
  5. the nearest relevant test or missing-test location,
640
699
  6. deterministic signal entries mapped to its files/symbols,
641
700
  7. relevant Swarm knowledge/evidence entries, if present.
642
- 8. the commit range to analyze (`base_ref..head_ref`),
701
+ 8. the exact controller-bound range to analyze (`base_sha...pr_head_sha`),
643
702
 
644
703
  ### Explorer output format
645
704
 
@@ -656,31 +715,57 @@ directly in the lane output as a fallback convention.
656
715
 
657
716
  Explorers must not use `CONFIRMED`, `DISPROVED`, or `PRE_EXISTING`.
658
717
 
718
+ A base lane that finds no surviving candidates must emit exactly one fully
719
+ populated clean row:
720
+
721
+ ```text
722
+ [CLEAN] | workflow_lane | coverage_scope | evidence
723
+ ```
724
+
725
+ Header-only `[CLEAN]` markers, prose-only "clean" claims, or empty output do
726
+ not settle the lane.
727
+
659
728
  ---
660
729
 
661
- ## Phase 4: Triggered Swarm Plugin Micro-Lanes
730
+ ## Phase 4: Mandatory Repository-Agnostic Micro-Lanes
662
731
 
663
- After base lanes settle, evaluate every row in the trigger map and print a
664
- mandatory ledger with one row per trigger-map row:
732
+ After base lanes settle, inspect the exact diff/context pack to focus every row
733
+ in the micro-lane map and print a mandatory ledger with one row per map row:
665
734
 
666
735
  ```text
667
- [TRIGGER-EVAL] | trigger_row | MATCHED/NO-MATCH | evidence
736
+ [TRIGGER-EVAL] | trigger_row | MATCHED | focus_evidence
668
737
  ```
669
738
 
670
- Evidence must name the diff/context keywords checked. The generic trigger rows
671
- still apply in non-Swarm repositories: schema, config, URL/fetch, git,
672
- shell/write, tests, and metrics cannot be marked `NO-MATCH` merely because the
673
- repository is not the Swarm plugin.
674
-
675
- Launch one focused micro-lane for each `MATCHED` row, using
676
- `dispatch_lanes_async` when more than one lane is needed and a separate batch
677
- from base lanes. Poll incrementally, then settle every launched lane. Persist
739
+ Focus evidence must name the changed files, manifests, imports/symbols, semantic
740
+ signals, or explicit absence conditions the lane should examine. `MATCHED` means
741
+ the lane is required, not that a keyword heuristic guessed applicability.
742
+ Repository identity, technology stack, PR size, elapsed time, or predicted risk
743
+ never justifies skipping a row.
744
+
745
+ Launch one focused micro-lane for every row, using
746
+ `dispatch_lanes_async` with `mode: "swarm-pr-review:micro"` and each lane's
747
+ `workflow_lane` equal to its trigger ID. Include the complete exact-set
748
+ `trigger_evaluation` ledger and the same exact current `pr_head_sha` in that
749
+ dispatch. Use a separate batch from base
750
+ lanes. Because the dispatcher accepts at most eight lanes per call, split the
751
+ eleven mandatory micro-lanes across bounded async batches. The runtime rejects
752
+ unrelated or duplicate micro-lanes within a batch, and final ledger persistence
753
+ rejects any row whose completed unique provenance is absent.
754
+ Poll incrementally, then settle every launched lane. Persist
678
755
  the complete ledger with `write_pr_review_trigger_eval`; its rows use the stable
679
- trigger IDs below, and every `MATCHED` row includes its returned
680
- `source_batch_id` and `source_lane_id`. Missing, extra, duplicate, or unmatched
756
+ trigger IDs below, and every row includes its returned `source_batch_id` and
757
+ `source_lane_id`. Missing, extra, duplicate, `NO-MATCH`, or unprovenanced
681
758
  rows make persistence fail and Phase 4 BLOCKED. The tool atomically writes
682
759
  `.swarm/pr-review/<run_id>/trigger-eval.json`, separate from `findings.jsonl`;
683
- do not add trigger results to the finding-status enum.
760
+ pass the exact reviewed merge-base as `base_sha`, the exact live base branch
761
+ tip/ref used to compute it as `base_ref`, and the same `pr_head_sha` to the
762
+ writer. The writer runs bounded `git merge-base -- <base_ref> <pr_head_sha>` and
763
+ rejects any claimed `base_sha` that is not the exact result. It accepts only the
764
+ exact eleven-row `MATCHED` set backed by
765
+ eleven completed, non-degraded, exact-head artifacts. It never uses keyword
766
+ classification as permission to waive a lane. Any head mismatch makes
767
+ persistence fail.
768
+ Do not add trigger results to the finding-status enum.
684
769
 
685
770
  For each micro `output_ref`, call `parse_lane_candidates` with
686
771
  `producer: "swarm-pr-review"`, `expected_family: "micro_lane"`, and
@@ -698,10 +783,11 @@ errors, zero malformed rows, and a complete, non-degraded source:
698
783
  ```
699
784
 
700
785
  Header-only or malformed zero output is `UNATTESTED` and must follow the
701
- canonical COVERAGE GATE retry path. Async and blocking lane dispatch both
702
- produce auditable `L1` artifacts. Task output has no `L1` artifact provenance,
703
- so Task-derived findings or CLEAN prose cannot satisfy Phase 4; if bounded lane
704
- dispatch retries cannot produce an artifact, the phase is BLOCKED.
786
+ canonical COVERAGE GATE retry path. Only the structured async PR-workflow path
787
+ preserves the required `L1`, exact-head, batch, and workflow-lane provenance;
788
+ the active controller rejects blocking and direct-Task substitutes. Task-derived
789
+ findings or CLEAN prose cannot satisfy Phase 4; if bounded structured retries
790
+ cannot produce an artifact, the phase is BLOCKED.
705
791
 
706
792
  Each micro-lane receives:
707
793
 
@@ -714,23 +800,28 @@ Each micro-lane receives:
714
800
  - structured candidate output (parser-extracted). If the parser is unavailable,
715
801
  the micro-lane MAY emit `[CANDIDATE]` rows as a fallback convention.
716
802
 
717
- ### Swarm plugin risk trigger map
718
-
719
- | Trigger ID | Trigger in diff or context pack | Launch micro-lane | Invariants to check |
720
- |---|---|---|---|
721
- | `architect-prompts` | `agents`, `prompts`, `templates`, prompt interpolation, role text | Architect prompt integrity | no scope escape, no system prompt leakage, safe `{{variable}}` interpolation, untrusted text isolated from instructions |
722
- | `council-orchestration` | `council`, `verdict`, `quorum`, `veto`, synthesis | Council orchestration | quorum math correct, veto enforced, evidence not lost, dissent preserved, no explorer result treated as final |
723
- | `guardrail-bypass` | `guardrail`, `gate`, `delegation`, `rate limit`, approval checks | Guardrail bypass paths | gates cannot be skipped, delegation cannot bypass policy, rate limits cannot be reset by user-controlled state |
724
- | `evidence-schema` | `schema`, `evidence`, JSONL, migrations, serializers | Evidence schema drift | backward compatibility, required fields preserved, version migration safe, malformed evidence rejected |
725
- | `knowledge-contract` | `knowledge`, `curator`, `hive`, `quarantine`, memory | Knowledge base contract | project vs hive tiers not confused, quarantine honored, CRUD semantics stable, stale knowledge not injected as fact |
726
- | `phase-transitions` | `phase`, `state`, `plan`, `.swarm/state`, completion markers | Phase transition validation | ordering enforced, retro requirements handled, no premature completion, rollback safe |
727
- | `model-role-mapping` | `model`, `role`, `prefix`, `tool`, agent config | Model-to-role mapping | role prefix enforced, tool permissions least-privilege, unauthorized tools impossible, model fallback safe |
728
- | `config-ratchet` | `config`, defaults, ratchet, locks, policy flags | Config ratchet semantics | once-enabled gates cannot silently disable, downgrade attempts detected, lock-state integrity preserved |
729
- | `url-fetch` | `url`, `fetch`, `http`, GitHub PR/issue parsing, package fetch | URL sanitization and external fetch | scheme allowlist, credential stripping, private IP / localhost / metadata IP blocking, redirect handling, timeout safe |
730
- | `git-safety` | `git`, branch, checkout, reset, worktree, `.git` | Git safety | branch detection reliable, no unsafe `reset --hard`, .git protected, path normalization cross-platform, worktree state preserved |
731
- | `shell-write` | `shell`, `exec`, command parser, file writes, delete/move/copy | Shell/write authority and path containment | destructive commands gated, dry-run preferred, symlink/path escape blocked, writes scoped, command injection impossible |
732
- | `test-infrastructure` | `test`, `bun`, mocks, fixtures, CI matrix | Test infrastructure | `bun:test` API correct, mock isolation, cross-platform paths, no hidden dependency on test order, fixtures reset |
733
- | `metrics-privacy` | `metrics`, telemetry, logs, serialized traces | Metrics and evidence privacy | no secrets in logs, evidence reproducible, privacy preserved, counts cannot be gamed, metrics schema stable |
803
+ ### Repository-agnostic mandatory micro-lane map
804
+
805
+ Every row runs in every repository. Diff/context analysis focuses each lane but
806
+ cannot waive it: semantic applicability is not reliably decidable from paths or
807
+ keywords, so `NO-MATCH` is invalid. Repository policy may require supplementary
808
+ specialist review outside this canonical ledger, but supplementary work never
809
+ replaces these portable rows. The `unclassified-risk` lane always runs to cover
810
+ novel failure modes and classification gaps.
811
+
812
+ | Trigger ID | Scope | Trigger in diff or context pack | Launch micro-lane | Invariants to check |
813
+ |---|---|---|---|---|
814
+ | `auth-identity-secrets` | universal | authentication, authorization, identity, sessions, permissions, secrets, cryptography | Identity and secret boundaries | least privilege, confused-deputy paths, credential lifecycle, cryptographic misuse, safe defaults |
815
+ | `untrusted-input-boundaries` | universal | parsing, serialization, queries, templates/rendering, file or network input/output | Untrusted input and sink analysis | injection, traversal, SSRF, unsafe deserialization, output escaping, resource limits |
816
+ | `subprocess-platform` | universal | subprocesses, shell commands, filesystem operations, OS/runtime-specific code | Subprocess and platform safety | array argv, bounded execution, path containment, portability, cleanup, non-interactive behavior |
817
+ | `concurrency-state` | universal | queues, caches, retries, transactions, locks, state machines, async coordination | Concurrency and state transitions | races, atomicity, idempotency, retry accounting, rollback, stale state, bounded growth |
818
+ | `dependencies-build-release` | universal | dependency manifests, lockfiles, installers, build scripts, CI, packaging, deployment | Dependency and delivery integrity | provenance, version/lock consistency, install safety, platform matrices, rollback and release completeness |
819
+ | `api-schema-migrations` | universal | public API, wire/schema/config/storage formats, migrations, feature flags | Compatibility and migration safety | backward/forward compatibility, defaults, validation, mixed-version operation, recovery |
820
+ | `test-infrastructure` | universal | tests, mocks, fixtures, harnesses, coverage, CI matrices | Test validity and isolation | meaningful assertions, contamination, determinism, negative paths, cross-platform proof, test theater |
821
+ | `ui-accessibility-i18n` | universal | user interfaces, interaction flows, rendering, accessibility, localization | UI and human-interface quality | keyboard/screen-reader behavior, focus, error states, responsive behavior, locale-safe formatting |
822
+ | `privacy-observability` | universal | telemetry, logs, analytics, traces, retention, diagnostics | Privacy and observability safety | minimization, redaction, consent, retention, stable metrics, non-gameable evidence |
823
+ | `generated-provenance` | universal | generated, vendored, binary, model-produced, codegen or checked-in build artifacts | Generated artifact provenance | reproducibility, source linkage, tamper evidence, reviewable diffs, licensing and stale output |
824
+ | `unclassified-risk` | universal | any changed artifact or behavior not confidently classified by the rows above | Unclassified high-risk fallback | full change-path review, hidden trust boundaries, novel failure modes, missing specialist classification |
734
825
 
735
826
  Micro-lane output format:
736
827
 
@@ -761,8 +852,8 @@ Verifier output is advisory until incorporated by the independent reviewer or cr
761
852
 
762
853
  ## Phase 6: Independent Reviewer Confirmation
763
854
 
764
- **Reviewer-dispatch join barrier:** reviewer dispatch MUST NOT begin until the trigger ledger is
765
- complete and persisted, every launched micro-lane is settled, and every
855
+ **Reviewer-dispatch join barrier:** reviewer dispatch MUST NOT begin until the micro-lane ledger is
856
+ complete and persisted, all eleven micro-lanes are settled, and every
766
857
  accepted micro result has parser-derived provenance or a valid CLEAN
767
858
  attestation.
768
859
 
@@ -773,6 +864,34 @@ file area, category, or count — not the full candidate set. The reviewer must
773
864
  re-read the candidate's file:line evidence and relevant context pack entries
774
865
  directly.
775
866
 
867
+ Dispatch reviewer chunks with `dispatch_lanes_async`,
868
+ `mode: "swarm-pr-review:reviewer"`, a unique non-empty `workflow_lane` per
869
+ chunk, `review_item_ids` containing the exact candidate IDs assigned to that
870
+ chunk, reviewer-role agents only, and the same exact `pr_head_sha`. The runtime
871
+ requires one parseable `[REVIEWED]` row for every structurally assigned ID; a
872
+ single marker or partial subset cannot settle the lane. Direct Task
873
+ reviewers are rejected because they cannot carry the durable batch and head
874
+ provenance required by this workflow.
875
+
876
+ For every structured PR-review dispatch, the runtime appends an authoritative
877
+ controller block after caller-authored prompt text. It binds the exact
878
+ `workflow_lane`, PR head, content revision, declared scope, and assigned item
879
+ IDs and explicitly forbids speed/time/token waivers. Caller prompt text cannot
880
+ override that block; output with placeholders, invented IDs, generic assurances,
881
+ or evidence unrelated to the bound lane does not settle the artifact.
882
+
883
+ Reviewer ownership is not accepted as an architect assertion. The controller
884
+ derives the immutable candidate inventory from the integrity-checked base,
885
+ mandatory micro-lane, and council artifacts; the union of `review_item_ids` must
886
+ equal that inventory exactly, with no omitted or invented IDs. If discovery
887
+ produces no candidates, the derived sentinel is `CLEAN-REVIEW`, which still
888
+ requires one independent semantic reviewer row.
889
+
890
+ Candidate IDs must therefore be globally unique across every discovery
891
+ artifact in the run. Prefix IDs with the stable workflow-lane ID (or use
892
+ another deterministic globally unique scheme); duplicate IDs fail closed
893
+ instead of being silently merged.
894
+
776
895
  ### Noise budget and universal validation
777
896
 
778
897
  Before reviewer dispatch, the orchestrator may suppress candidates that match ANY of the following (each suppression still requires mandatory disclosure):
@@ -823,6 +942,12 @@ Reviewer output format:
823
942
  [REVIEWED] | candidate_id | classification | evidence_type | final_severity | introduced_by_pr: YES/NO/UNKNOWN | file:line | rationale | falsification_probe | reviewer_id
824
943
  ```
825
944
 
945
+ For the mechanically derived `CLEAN-REVIEW` sentinel, use the same exact row
946
+ with `DISPROVED | STRUCTURALLY_PROVEN | NONE | UNKNOWN | N/A` and concrete
947
+ rationale/probe/reviewer fields; the sentinel means the reviewer independently
948
+ found no surviving actionable candidate, not that reviewer validation was
949
+ skipped.
950
+
826
951
  Every reviewer response must end with one parseable `[REVIEWED]` row per
827
952
  assigned candidate. A malformed `[REVIEWED]` row is not a verdict: re-dispatch
828
953
  with the exact contract (max 2), then mark the reviewer dimension BLOCKED if no
@@ -858,6 +983,31 @@ A finding may still be reported without a runnable command if it is structurally
858
983
 
859
984
  Route every reviewer-confirmed HIGH or CRITICAL finding to a critic. Also route borderline MEDIUM findings when they involve security, state machines, write authority, evidence integrity, model/tool permissions, git safety, or config ratchets.
860
985
 
986
+ The controller conservatively derives critic ownership from semantic reviewer
987
+ rows: every reviewer-confirmed CRITICAL, HIGH, or MEDIUM item is mandatory
988
+ critic inventory. This intentionally over-routes ordinary MEDIUM items because
989
+ machine enforcement cannot safely infer every repository-specific trust
990
+ boundary from prose. Completion is blocked until that exact derived inventory
991
+ has valid critic rows.
992
+
993
+ Reviewer and critic retries cannot be combined as complementary partial verdict
994
+ sets. Each phase requires at least one fully successful exact batch covering its
995
+ entire mechanically assigned inventory on one revision. A later degraded,
996
+ truncated, stale, wrong-identity, or malformed batch cannot replace an earlier
997
+ valid batch or suppress critic routing.
998
+
999
+ Any newer reviewer batch invalidates every older critic batch, even when the
1000
+ new reviewer rows happen to be identical. Dispatch a fresh critic wave from the
1001
+ latest coherent reviewer batch; critic evidence can never predate the reviewer
1002
+ evidence it purports to challenge.
1003
+
1004
+ Dispatch critic chunks with `dispatch_lanes_async`,
1005
+ `mode: "swarm-pr-review:critic"`, a unique non-empty `workflow_lane` per
1006
+ chunk, `review_item_ids` containing the exact finding IDs assigned to that
1007
+ chunk, critic-role agents only, and the same exact `pr_head_sha`. The runtime
1008
+ requires one parseable `[CRITIC]` row for every structurally assigned ID and
1009
+ requires one coherent fully successful exact reviewer batch before a critic wave.
1010
+
861
1011
  The critic must challenge:
862
1012
 
863
1013
  - severity inflation,
@@ -885,7 +1035,13 @@ The `[CRITIC]` row in the format above is **mandatory contract**, not advisory o
885
1035
 
886
1036
  **Re-dispatch trigger:** when a critic lane response is missing the verdict row, the orchestrator must automatically re-dispatch that lane with the explicit instruction: "Your final line MUST be exactly the Phase 8 contract row: `[CRITIC] | finding_id | UPHELD/DOWNGRADED/DISPROVED/NEEDS_MORE_EVIDENCE | final_severity | reason | required_report_change`. A response without that exact row will be treated as a planning message and re-dispatched." Do not synthesize findings from the planning preamble; only from the re-dispatched verdict.
887
1037
 
888
- **COVERAGE GATE alignment:** Critic lane failures follow the same COVERAGE GATE as explorer lanes: retry (max 2 attempts) with materially different parameters. If retries fail, deploy a verified equivalent alternative (same agent type, same prompt, same scope, same isolation), including Task-tool dispatch as the final fallback when lane tools do not work. If no equivalent can be verified, stop and surface the critic-lane failure to the user as BLOCKED — do NOT mark findings UNVERIFIED or continue past the gap. The orchestrator NEVER fabricates a critic verdict by parsing prose, by tolerating a planning preamble, by presenting partial findings, or by silently accepting reduced coverage.
1038
+ `NEEDS_MORE_EVIDENCE` is deliberately non-terminal and never satisfies critic
1039
+ settlement. Re-dispatch a narrower critic/probe lane or report the dimension
1040
+ BLOCKED. Terminal critic rows are cross-field checked: `DISPROVED` requires
1041
+ `NONE`, `UPHELD` requires CRITICAL/HIGH/MEDIUM, and `DOWNGRADED` cannot remain
1042
+ CRITICAL.
1043
+
1044
+ **COVERAGE GATE alignment:** Critic lane failures follow the same COVERAGE GATE as explorer lanes: retry (max 2 attempts) with materially different parameters using `dispatch_lanes_async`, `mode: "swarm-pr-review:critic"`, and the same exact `pr_head_sha`. Blocking and direct-Task fallbacks are not provenance-equivalent and are rejected. If no structured retry closes coverage, stop and surface the critic-lane failure to the user as BLOCKED — do NOT mark findings UNVERIFIED or continue past the gap. The orchestrator NEVER fabricates a critic verdict by parsing prose, by tolerating a planning preamble, by presenting partial findings, or by silently accepting reduced coverage.
889
1045
 
890
1046
  Refuted findings become `DISPROVED` or `ADVISORY`, depending on critic rationale. Downgrades must be listed in the final validation provenance.
891
1047
 
@@ -1258,11 +1414,11 @@ Council mode is opt-in only and adversarial.
1258
1414
  When triggered:
1259
1415
 
1260
1416
  1. Build the same context pack as default mode.
1261
- 2. Launch all council agents with one `dispatch_lanes_async` call when available; continue independent context preparation while they run, polling with `collect_lane_results` (without `wait`) to process settled agents incrementally. Use `wait: true` only when no independent work remains and agents are still pending. All agents must be settled before reviewer classification. Fall back to blocking `dispatch_lanes` when async launch is unavailable.
1417
+ 2. After the default exact-six base lanes and required micro-lanes are mechanically covered, launch all supplementary council agents with one `dispatch_lanes_async` call using `mode: "swarm-pr-review:council"`, the same exact `pr_head_sha`, and one unique `workflow_lane` per council member; continue independent context preparation while they run, polling with `collect_lane_results` (without `wait`) to process settled agents incrementally. Use `wait: true` only when no independent work remains and agents are still pending. All agents must be settled and their candidates added to the ledger before reviewer classification; the runtime enforces this join barrier. If structured asynchronous dispatch with exact-head and workflow-lane provenance is unavailable, stop as `BLOCKED`; blocking, sequential, or direct-Task fallback is not equivalent.
1262
1418
  3. Each council agent assumes all work is wrong until code evidence proves otherwise.
1263
1419
  4. Each agent hunts within its lane only.
1264
- 5. Agents return evidence states only: `EVIDENCE_FOUND`, `SUSPICIOUS`, or `CLEAN`.
1265
- 6. Agents must not return `CONFIRMED`, `DISPROVED`, or final severity.
1420
+ 5. Agents return the same mechanically parseable candidate contract as other discovery lanes: one `[CANDIDATE]` row per `EVIDENCE_FOUND` or `SUSPICIOUS` claim, or a fully populated `[CLEAN] | workflow_lane | coverage_scope | evidence` row when no candidate survives. Council prose without one of those markers does not settle the lane.
1421
+ 6. Agents must not return `CONFIRMED`, `DISPROVED`, or final severity; candidate severity remains provisional until reviewer classification.
1266
1422
  7. The independent reviewer then classifies every council candidate as `CONFIRMED`, `DISPROVED`, `UNVERIFIED`, or `PRE_EXISTING`.
1267
1423
  8. Apply critic challenge to reviewer-confirmed HIGH/CRITICAL or borderline findings.
1268
1424
  9. Final synthesis distinguishes real blockers, real low-severity issues, accepted caveats, disproved council claims, and follow-up quality work.
@@ -1319,7 +1475,7 @@ Council findings are supplementary, not authoritative overrides. Do not adopt co
1319
1475
  11. Obligation precedence is deterministic. Do not skip higher-precedence sources to fill gaps with LLM synthesis.
1320
1476
  12. Do not leak secrets from logs, evidence bundles, config files, URLs, or scanner output.
1321
1477
  13. Do not recommend destructive git or filesystem actions as fixes unless they are clearly scoped, safe, and necessary.
1322
- 14. If subagents fail, timeout, or return malformed output, retry with corrected parameters (max 2 attempts). If retries fail, deploy a provably equivalent alternative (same agent type, same prompt, same scope, same isolation different dispatch mechanism acceptable), with Task-tool dispatch explicitly allowed as the final fallback when lane tools do not work, and verify equivalence. If no equivalent alternative exists, the affected coverage dimension is BLOCKED and must be surfaced to the user before synthesis. Do not fabricate validation results, do not present partial findings, and do not silently mark candidates UNVERIFIED to proceed past the gap.
1478
+ 14. If subagents fail, timeout, or return malformed output, retry with corrected parameters (max 2 attempts) through the same structured `dispatch_lanes_async` workflow mode and exact `pr_head_sha`. Blocking or direct-Task dispatch cannot preserve the durable provenance contract and is not an equivalent fallback. If structured retries fail, the affected coverage dimension is BLOCKED and must be surfaced to the user before synthesis. Do not fabricate validation results, do not present partial findings, and do not silently mark candidates UNVERIFIED to proceed past the gap.
1323
1479
 
1324
1480
  15. If context pack, repo graph, deterministic signals, or Swarm artifacts are unavailable, retry with alternative access paths. If unavailable after retry, the affected coverage dimension is BLOCKED and must be surfaced to the user. Do not proceed to synthesis with unclosed coverage gaps under a "best available evidence" rationale — the architect is not authorized to produce a degraded review.
1325
1481
 
@@ -1338,7 +1494,7 @@ Before writing the final output, print this checklist with filled values. Every
1338
1494
  [VALIDATION] deterministic lane dispatcher used: YES/NO — ___
1339
1495
  [VALIDATION] base explorer lanes dispatched: ___ / 6
1340
1496
  [VALIDATION] base explorer lanes returned: ___ / 6
1341
- [VALIDATION] trigger map evaluated: ___ rows (X MATCHED → X micro-lanes dispatched) OR BLOCKED — <unevaluated rows>
1497
+ [VALIDATION] mandatory micro-lanes dispatched and settled: ___ / 11 OR BLOCKED — <missing rows>
1342
1498
  [VALIDATION] Swarm verifier routing used: ___
1343
1499
  [VALIDATION] raw candidates: ___
1344
1500
  [VALIDATION] tool candidates: ___
@@ -1561,12 +1717,13 @@ You must inspect or mark unavailable:
1561
1717
  5. nearest test or missing-test location,
1562
1718
  6. deterministic signals,
1563
1719
  7. Swarm artifacts/knowledge,
1564
- 8. the exact `base_ref..head_ref` commit range and both endpoint revisions.
1720
+ 8. the exact `base_sha...pr_head_sha` merge-base range and both endpoint revisions.
1565
1721
 
1566
1722
  Return:
1567
1723
  [CANDIDATE] | candidate_id | lane | severity | category | file:line | claim | evidence_summary | impact_context | confidence
1568
1724
  Emit the marker-bearing header once, then unprefixed data rows.
1569
1725
  For a clean micro-lane, emit `[CLEAN] | micro_lane | coverage_scope | evidence`.
1726
+ For a clean base lane, emit `[CLEAN] | workflow_lane | coverage_scope | evidence`.
1570
1727
  ```
1571
1728
 
1572
1729
  The orchestrator extracts candidates from the full lane artifact via
@@ -1576,3 +1733,12 @@ unavailable. Explorers should still emit structured records regardless of
1576
1733
  whether the parser is present.
1577
1734
 
1578
1735
  Do not let speed degrade validation quality.
1736
+
1737
+ After metrics and durable review artifacts are complete, but before emitting the
1738
+ user-facing final report, call `complete_pr_workflow` with mode `PR_REVIEW` and
1739
+ the same exact
1740
+ `pr_head_sha`. The tool refuses to clear the session gate while required base,
1741
+ trigger, declared reviewer/critic, or open-lane obligations remain incomplete.
1742
+ While the gate remains active, the runtime replaces architect final-response
1743
+ text with a mechanical blocked notice and re-wakes an idle parent session. Only
1744
+ emit the final report after the completion tool confirms that the gate cleared.
package/README.md CHANGED
@@ -810,7 +810,9 @@ Every candidate passes a 3-gate pipeline before entering quarantine:
810
810
  | generate_mutants | Architect-only: generates LLM-based mutation patches (5–10 per function across 6 types: off-by-one, null substitution, operator swap, guard removal, branch swap, side-effect deletion) for direct consumption by the mutation_test tool; returns SKIP verdict on LLM failure rather than throwing |
811
811
  | write_mutation_evidence | Architect-only: writes mutation gate results atomically to `.swarm/evidence/{phase}/mutation-gate.json`; accepts verdict (PASS/WARN/FAIL/SKIP), kill rate metrics, and optional survived mutant details; normalizes uppercase-to-lowercase before persisting |
812
812
  | parse_lane_candidates | Architect-only: parses `[CANDIDATE]` rows and micro-lane `[CLEAN]` attestations from a lane `output_ref`; supports asserted batch families, preserves dispatch provenance, and persists sidecar JSONL records |
813
- | write_pr_review_trigger_eval | Architect-only: validates the exact PR-review trigger-map ID set, requires provenance for every matched micro-lane, and atomically persists `.swarm/pr-review/<run_id>/trigger-eval.json` |
813
+ | write_pr_review_trigger_eval | Architect-only: validates the exact mandatory PR-review micro-lane ID set, requires completed provenance for all 11 repository-agnostic lanes, verifies the claimed merge base against an exact live base ref, rejects every `NO-MATCH` waiver, and atomically persists `.swarm/pr-review/<run_id>/trigger-eval.json` |
814
+ | complete_pr_workflow | Architect-only: validates terminal PR-review or PR-feedback coverage; feedback uses a two-call arm/publish protocol and clears only after the approved content is observed on both the bound remote-tracking ref and the actual remote branch |
815
+ | run_pr_feedback_stage_a | Architect-only: executes targeted reproduction/regression and exact `git diff --check` plus every mechanically applicable workspace/category/source build, typecheck, and lint obligation, then persists content-bound Stage A receipts before ordered feedback review gates |
814
816
  | git_blame | Per-line git blame metadata (sha, author, date, summary) via `git blame --porcelain`; supports optional line range filtering |
815
817
  | diff | Structured git diff with contract change detection; supports `summaryOnly` mode returning file list with additions/deletions counts |
816
818
  | suggest_patch | Reviewer-safe structured patch suggestion; supports `format` parameter ('json' or 'unified') where unified outputs valid unified diff with `diff --git` headers, hunks, and context |
@@ -11,6 +11,11 @@ declare const LaneOutputArtifactSchema: z.ZodObject<{
11
11
  sessionId: z.ZodOptional<z.ZodString>;
12
12
  parentSessionId: z.ZodOptional<z.ZodString>;
13
13
  mode: z.ZodOptional<z.ZodString>;
14
+ workflowLane: z.ZodOptional<z.ZodString>;
15
+ prHeadSha: z.ZodOptional<z.ZodString>;
16
+ gitHead: z.ZodOptional<z.ZodString>;
17
+ revisionDigest: z.ZodOptional<z.ZodString>;
18
+ scope: z.ZodOptional<z.ZodString>;
14
19
  source: z.ZodEnum<{
15
20
  dispatch_lanes: "dispatch_lanes";
16
21
  collect_lane_results: "collect_lane_results";
@@ -34,6 +39,11 @@ export interface StoreLaneOutputInput {
34
39
  sessionId?: string;
35
40
  parentSessionId?: string;
36
41
  mode?: string;
42
+ workflowLane?: string;
43
+ prHeadSha?: string;
44
+ gitHead?: string;
45
+ revisionDigest?: string;
46
+ scope?: string;
37
47
  source: LaneOutputSource;
38
48
  text: string;
39
49
  messageCount?: number;