opencode-swarm 7.59.1 → 7.61.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 +28 -17
- package/.opencode/skills/council/SKILL.md +3 -2
- package/.opencode/skills/execute/SKILL.md +12 -0
- package/.opencode/skills/phase-wrap/SKILL.md +12 -3
- package/.opencode/skills/plan/SKILL.md +9 -7
- package/.opencode/skills/specify/SKILL.md +17 -41
- package/dist/cli/index.js +320 -229
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/constants.d.ts +2 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +37 -0
- package/dist/council/types.d.ts +8 -2
- package/dist/db/qa-gate-profile.d.ts +8 -5
- package/dist/hooks/delegation-gate.d.ts +9 -0
- package/dist/index.js +3172 -2676
- package/dist/state.d.ts +3 -3
- package/dist/tools/convene-council.d.ts +1 -0
- package/dist/tools/phase-complete/gates/phase-council-gate.d.ts +1 -1
- package/dist/tools/set-qa-gates.d.ts +1 -1
- package/dist/tools/submit-phase-council-verdicts.d.ts +1 -0
- package/dist/tools/update-task-status.d.ts +8 -5
- package/dist/tools/write-final-council-evidence.d.ts +1 -0
- package/dist/turbo/lean/merge-back.d.ts +4 -179
- package/dist/turbo/lean/worktree.d.ts +5 -191
- package/dist/worktree/core.d.ts +194 -0
- package/dist/worktree/index.d.ts +5 -0
- package/dist/worktree/merge.d.ts +183 -0
- package/dist/worktree/types.d.ts +46 -0
- package/package.json +1 -1
|
@@ -21,6 +21,17 @@ MODE: BRAINSTORM runs seven phases in strict order. Do not skip phases. Do not c
|
|
|
21
21
|
- Run CODEBASE REALITY CHECK on any claims the user made in their topic statement. Surface discrepancies before moving forward.
|
|
22
22
|
- Exit when you have a confident map of: (a) existing code and patterns, (b) relevant prior decisions, (c) what is actually unknown.
|
|
23
23
|
|
|
24
|
+
**Phase 1b: GENERAL COUNCIL ADVISORY (optional, architect).**
|
|
25
|
+
If `council.general.enabled` is true in the resolved opencode-swarm config AND a search API key is configured:
|
|
26
|
+
- Ask the user: "Enable General Council advisory input? The 3-agent council (generalist, skeptic, domain expert) will research the problem domain and provide diverse perspectives to inform the specification and plan. (default: no)"
|
|
27
|
+
- If the user declines or config is not enabled, skip to Phase 2.
|
|
28
|
+
- If the user accepts:
|
|
29
|
+
1. Run the Research Phase: formulate 1-3 targeted `web_search` queries grounded in the topic.
|
|
30
|
+
2. Dispatch `the active swarm's council_generalist agent`, `the active swarm's council_skeptic agent`, and `the active swarm's council_domain_expert agent` in PARALLEL with the RESEARCH CONTEXT.
|
|
31
|
+
3. Collect responses, call `convene_general_council` with mode `general`.
|
|
32
|
+
4. Carry the council's consensus and disagreements forward as context for subsequent phases.
|
|
33
|
+
- Exit with council input noted (or skipped).
|
|
34
|
+
|
|
24
35
|
**Phase 2: DIALOGUE (architect ↔ user).**
|
|
25
36
|
- Ask EXACTLY ONE focused question per message. Wait for the user's answer before asking the next.
|
|
26
37
|
- Prioritize questions that materially change scope, risk, or architecture. Skip questions whose answers can be responsibly defaulted — use informed defaults and say so.
|
|
@@ -48,25 +59,29 @@ MODE: BRAINSTORM runs seven phases in strict order. Do not skip phases. Do not c
|
|
|
48
59
|
- Write the final spec to `.swarm/spec.md`.
|
|
49
60
|
- Exit when reviewer signs off (or user explicitly accepts remaining disagreements).
|
|
50
61
|
|
|
51
|
-
**Phase 6: QA GATE SELECTION (architect, dialogue only).**
|
|
52
|
-
Now ask the user which QA gates to enable for this plan -- do not select on their behalf.
|
|
62
|
+
**Phase 6: QA GATE SELECTION, PARALLEL CODERS, AND COMMIT FREQUENCY (architect, dialogue only).**
|
|
63
|
+
Now ask the user which QA gates to enable for this plan, how many parallel coders to use, and the commit frequency -- do not select on their behalf. Present all three items together as one unified exchange.
|
|
53
64
|
|
|
54
|
-
Present the eleven gates with their defaults (DEFAULT_QA_GATES) as a single user-facing
|
|
65
|
+
Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, and commit frequency as a single user-facing section. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
|
|
55
66
|
- reviewer (default: ON) -- code review of coder output
|
|
56
67
|
- test_engineer (default: ON) -- test verification of coder output
|
|
57
68
|
- sme_enabled (default: ON) -- SME consultation during planning/clarification
|
|
58
69
|
- critic_pre_plan (default: ON) -- critic review before plan finalization
|
|
59
70
|
- sast_enabled (default: ON) -- static security scanning
|
|
60
|
-
- council_mode (default: OFF) --
|
|
71
|
+
- council_mode (default: OFF) -- replaces per-task Stage B (reviewer + test_engineer) with the full 5-member council (critic, reviewer, sme, test_engineer, explorer). Requires council.enabled: true in config. (recommended for high-impact architecture, public APIs, schema/data mutation, security-sensitive code)
|
|
61
72
|
- hallucination_guard (default: OFF) -- when enabled, mandatory per-phase API/signature/claim/citation verification via critic_hallucination_verifier at PHASE-WRAP; phase_complete will REJECT phase completion unless .swarm/evidence/{phase}/hallucination-guard.json exists with an APPROVED verdict (recommended for claim-heavy or research-heavy work)
|
|
62
73
|
- mutation_test (default: OFF) -- when enabled, runs mutation testing on source files touched this phase via generate_mutants + mutation_test + write_mutation_evidence at PHASE-WRAP; FAIL verdict blocks phase_complete; WARN is non-blocking (recommended for projects with coverage gaps or safety-critical code)
|
|
63
|
-
-
|
|
74
|
+
- phase_council (default: OFF) -- full 5-member council reviews all work in a phase holistically at phase_complete time. Requires council.enabled: true in config. (recommended for multi-task phases with cross-cutting concerns or high-risk integration)
|
|
64
75
|
- drift_check (default: ON) -- when enabled, mandatory per-phase drift verification via critic_drift_verifier at PHASE-WRAP; compares implemented changes against spec.md intent; hard-blocks phase_complete when spec.md exists and drift evidence is missing or REJECTED; advisory-only when no spec.md exists (recommended for all projects with a specification)
|
|
65
|
-
- final_council (default: OFF)
|
|
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
|
+
|
|
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.
|
|
80
|
+
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
66
81
|
|
|
67
|
-
|
|
82
|
+
The user answers all three (gates, parallel coders, commit frequency) in one exchange. Wait for the user's response.
|
|
68
83
|
|
|
69
|
-
If the user
|
|
84
|
+
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
70
85
|
```
|
|
71
86
|
## Pending Parallelization Config
|
|
72
87
|
- parallelization_enabled: true
|
|
@@ -77,8 +92,6 @@ If the user answered the gate question, immediately follow up with ONE more ques
|
|
|
77
92
|
```
|
|
78
93
|
If the user accepts the default (1), skip writing this section entirely -- serial execution is the default and needs no config.
|
|
79
94
|
|
|
80
|
-
After asking the parallelization question (regardless of whether the user chose serial or parallel), immediately follow up with ONE more question: "Commit frequency for completed tasks? (default: phase-level only; optional per-task checkpoint commit after each task completion)".
|
|
81
|
-
|
|
82
95
|
If the user chooses per-task commits, write this section to `.swarm/context.md`:
|
|
83
96
|
```
|
|
84
97
|
## Task Completion Commit Policy
|
|
@@ -100,14 +113,12 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
|
|
|
100
113
|
→ WRONG: complexity does not exempt this step. Gate selection is mandatory for ALL plans.
|
|
101
114
|
✗ "I already know which gates are right for this project"
|
|
102
115
|
→ WRONG: the architect does not configure gates. The user configures gates. Always ask.
|
|
103
|
-
✗ "council_general_review is off by default, I don't need to mention it"
|
|
104
|
-
→ WRONG: every gate is presented with its default stated. The user opts in or accepts the default explicitly.
|
|
105
116
|
|
|
106
117
|
MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
|
|
107
118
|
You are BLOCKED until ALL THREE of these conditions are met:
|
|
108
|
-
(1) The gate selection
|
|
109
|
-
(2) The user has responded (accept defaults OR customized list)
|
|
110
|
-
(3) The elected gates have been written to .swarm/context.md under "## Pending QA Gate Selection"
|
|
119
|
+
(1) The unified gate/coders/commit selection section has been presented to the user in a single message
|
|
120
|
+
(2) The user has responded (accept defaults OR customized list for all three items)
|
|
121
|
+
(3) The elected gates, parallel coder config, and commit policy have been written to .swarm/context.md under "## Pending QA Gate Selection" (and related sections as applicable)
|
|
111
122
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
112
123
|
|
|
113
124
|
Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Once the user answers, write the elected gates to `.swarm/context.md` under a new section:
|
|
@@ -121,7 +132,7 @@ Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Onc
|
|
|
121
132
|
- council_mode: <true|false>
|
|
122
133
|
- hallucination_guard: <true|false>
|
|
123
134
|
- mutation_test: <true|false>
|
|
124
|
-
-
|
|
135
|
+
- phase_council: <true|false>
|
|
125
136
|
- drift_check: <true|false>
|
|
126
137
|
- final_council: <true|false>
|
|
127
138
|
- recorded_at: <ISO timestamp>
|
|
@@ -136,7 +147,7 @@ MODE: PLAN applies these after `save_plan` succeeds via `set_qa_gates`.
|
|
|
136
147
|
|
|
137
148
|
BRAINSTORM RULES:
|
|
138
149
|
- No skipping phases. Each phase's exit condition must be met before moving on.
|
|
139
|
-
- One question per message in DIALOGUE — never batch.
|
|
150
|
+
- One question per message in DIALOGUE — never batch. Exception: the QA gate selection section (Phase 6) presents gates, parallel coders, and commit frequency together as one unified exchange.
|
|
140
151
|
- Always offer an informed default for every question.
|
|
141
152
|
- The spec produced in Phase 5 must still satisfy the SPEC CONTENT RULES (no tech stack, no implementation details).
|
|
142
153
|
- QA gates elected in Phase 6 are persisted during MODE: PLAN after `save_plan` succeeds and are ratchet-tighter from that point — once persisted you cannot undo them later in the session.
|
|
@@ -25,8 +25,9 @@ answer directly.
|
|
|
25
25
|
|
|
26
26
|
This mode is ADVISORY. It does not block any other workflow and does not modify
|
|
27
27
|
code, plans, or specs. The output is for the user (general mode) or for the spec
|
|
28
|
-
being drafted
|
|
29
|
-
|
|
28
|
+
being drafted (spec_review mode is available via `/swarm council --spec-review`
|
|
29
|
+
for manual spec review). General Council advisory input is offered as an early
|
|
30
|
+
workflow option in MODE: BRAINSTORM (Phase 1b).
|
|
30
31
|
|
|
31
32
|
#### Pre-flight (always run first)
|
|
32
33
|
|
|
@@ -95,6 +95,18 @@ It does NOT mean "code is reviewed." It does NOT mean "code is tested."
|
|
|
95
95
|
After pre_check_batch passes, you MUST STILL delegate to the active swarm's reviewer agent.
|
|
96
96
|
Treating pre_check_batch as a substitute for the active swarm's reviewer agent is a PROCESS VIOLATION.
|
|
97
97
|
|
|
98
|
+
5j-COUNCIL (when council_mode is ON — replaces steps 5j through 5l):
|
|
99
|
+
When `council_mode` is enabled in the QA gate profile, Stage B (steps 5j-5l: reviewer + test_engineer) is REPLACED by the full 5-member council per task.
|
|
100
|
+
|
|
101
|
+
After Stage A (pre_check_batch) passes:
|
|
102
|
+
1. Ensure `declare_council_criteria` was called for this task (prerequisite).
|
|
103
|
+
2. Dispatch all 5 council members (critic, reviewer, sme, test_engineer, explorer) in PARALLEL with task-scoped context.
|
|
104
|
+
3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.
|
|
105
|
+
4. Call `submit_council_verdicts` with the collected verdicts.
|
|
106
|
+
5. Act on the verdict: APPROVE → task passes. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH/CRITICAL findings are blocking, no evidence written, return to coder with requiredFixes and re-council after fixes. CONCERNS with `success: true` → only MEDIUM/LOW advisory findings, task passes. REJECT → return to coder with requiredFixes.
|
|
107
|
+
|
|
108
|
+
When `council_mode` is OFF, the standard Stage B flow (steps 5j-5l: reviewer + test_engineer) runs as normal.
|
|
109
|
+
|
|
98
110
|
5j. the active swarm's reviewer agent - General review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate.
|
|
99
111
|
→ REQUIRED: Print "reviewer: [APPROVED | REJECTED — reason]"
|
|
100
112
|
5k. Security gate: if change matches TIER 3 criteria OR content contains SECURITY_KEYWORDS OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold → MUST delegate the active swarm's reviewer agent security-only review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate to user.
|
|
@@ -97,14 +97,23 @@ The tool will automatically write the retrospective to \`.swarm/evidence/retro-{
|
|
|
97
97
|
- `.swarm/evidence/{phase}/mutation-gate.json` exists with verdict 'pass' or 'warn' (written by YOU via the `write_mutation_evidence` tool after step 5.56) — ONLY required when `mutation_test` is enabled in the QA gate profile
|
|
98
98
|
If any required file is missing, run the missing gate first. Turbo mode skips all gates automatically.
|
|
99
99
|
NOTE: Steps 5.5, 5.55, and 5.56 are enforced by runtime hooks. If `hallucination_guard` is enabled and you skip the critic_hallucination_verifier delegation (or fail to call `write_hallucination_evidence`), phase_complete will be BLOCKED by the plugin. Similarly, if `mutation_test` is enabled and you skip step 5.56 (or fail to call `write_mutation_evidence`), phase_complete will be BLOCKED. These are not suggestions — they are hard enforcement mechanisms.
|
|
100
|
+
5.65. **Phase Council (conditional on QA gate — `phase_council`)**: Check whether `phase_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 5.7.
|
|
101
|
+
This gate is triggered by the `phase_council` QA gate, NOT by `council_mode`. (`council_mode` controls per-task Stage B replacement in MODE: EXECUTE; `phase_council` controls holistic phase-level review here in MODE: PHASE-WRAP.)
|
|
102
|
+
If `phase_council` is enabled:
|
|
103
|
+
1. Build a PHASE DOSSIER from all completed tasks in this phase, their evidence artifacts, changed-file summaries, and any drift/hallucination/mutation evidence.
|
|
104
|
+
2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with phase-scoped context. Each member reviews the entire phase's work holistically and returns a `CouncilMemberVerdict` JSON object.
|
|
105
|
+
3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.
|
|
106
|
+
4. Act on the verdict: APPROVE → proceed. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH/CRITICAL findings are blocking, no evidence written, must resolve requiredFixes and re-council. CONCERNS with `success: true` → only MEDIUM/LOW advisory findings, phase may proceed per `phaseConcernsAllowComplete` flag. REJECT → surface required fixes to the user before proceeding.
|
|
107
|
+
Requires council.enabled: true in config.
|
|
108
|
+
|
|
100
109
|
5.7. **Final Council (conditional on QA gate - last phase only)**: Check whether `final_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 6.
|
|
101
110
|
If enabled AND this is the LAST phase in the plan (all other phases have status 'complete' and no more phases remain):
|
|
102
|
-
1. Build a PROJECT DOSSIER from the completed plan, all phase summaries, changed-file summaries, and all relevant evidence artifacts. This is
|
|
103
|
-
2. Dispatch `the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent` in PARALLEL with project-scoped context. Each member must review the entire completed body of work and return a `CouncilMemberVerdict` JSON object using `agent`, `verdict` (APPROVE|CONCERNS|REJECT), `confidence`, `findings[]`, `criteriaAssessed[]`, `criteriaUnmet[]`, and `durationMs`.
|
|
111
|
+
1. Build a PROJECT DOSSIER from the completed plan, all phase summaries, changed-file summaries, and all relevant evidence artifacts. This is the full 5-member council (NOT the General Council) running a completed-project review.
|
|
112
|
+
2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with project-scoped context. Each member must review the entire completed body of work and return a `CouncilMemberVerdict` JSON object using `agent`, `verdict` (APPROVE|CONCERNS|REJECT), `confidence`, `findings[]`, `criteriaAssessed[]`, `criteriaUnmet[]`, and `durationMs`.
|
|
104
113
|
3. Collect the five returned verdict objects. Do NOT fabricate, infer, or substitute verdicts. If a member does not return valid JSON, re-dispatch that member.
|
|
105
114
|
4. Call `write_final_council_evidence` with `phase`, `projectSummary`, `roundNumber`, and the collected `verdicts` array. This writes `.swarm/evidence/final-council.json` with plan binding, member verdicts, and quorum metadata.
|
|
106
115
|
⚠️ **GOTCHA**: `write_final_council_evidence` normalizes CONCERNS verdicts to "rejected" internally. A CONCERNS verdict in the **final council** still blocks `phase_complete` even with zero required fixes. You MUST either address the concerns and get APPROVE on a second council round, or surface the non-blocking advisory to the user before proceeding. (Note: the **phase-level** council has a `phaseConcernsAllowComplete` flag that makes CONCERNS advisory; the final council does not.)
|
|
107
|
-
5. Do NOT call `convene_general_council`, do NOT dispatch `council_generalist`, `council_skeptic`, or `council_domain_expert`, and do NOT require `council.general.enabled` for this gate. `final_council` is the
|
|
116
|
+
5. Do NOT call `convene_general_council`, do NOT dispatch `council_generalist`, `council_skeptic`, or `council_domain_expert`, and do NOT require `council.general.enabled` for this gate. `final_council` is the full 5-member council (NOT the General Council) rerun at project scope.
|
|
108
117
|
6. Do NOT call `phase_complete` or `/swarm close` until `.swarm/evidence/final-council.json` exists with an approved, plan-bound, quorumed final-council verdict. When `final_council` is enabled, `phase_complete` will block until that evidence exists.
|
|
109
118
|
If enabled but NOT the last phase, skip silently - final council only runs once, after all phases.
|
|
110
119
|
6. Summarize to user
|
|
@@ -185,20 +185,23 @@ After `save_plan` succeeds, read `.swarm/context.md`:
|
|
|
185
185
|
- If a `## Pending QA Gate Selection` section exists: parse the gate values, call `set_qa_gates` with those flags, confirm with the user ("QA gates applied: <list>"), then remove the section from context.md.
|
|
186
186
|
- If a `## Pending Parallelization Config` section also exists: parse the values and call `save_plan` again with `execution_profile` set to `{ parallelization_enabled: <parsed>, max_concurrent_tasks: <parsed>, council_parallel: false, locked: true }`. Then remove the section from context.md. If the plan already had `execution_profile.locked: true`, skip this step — the profile is already locked and immutable.
|
|
187
187
|
- If a `## Task Completion Commit Policy` section exists: preserve it in `.swarm/context.md` (do NOT remove). This section is execution-time guidance for optional per-task checkpoint commits after `update_task_status(status="completed")`.
|
|
188
|
-
- If no pending section exists, ask the user inline now. Present the eleven gates with their defaults (DEFAULT_QA_GATES) as a single user-facing
|
|
188
|
+
- If no pending section exists, ask the user inline now. Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, and commit frequency as a single user-facing section. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
|
|
189
189
|
- reviewer (default: ON) - code review of coder output
|
|
190
190
|
- test_engineer (default: ON) - test verification of coder output
|
|
191
191
|
- sme_enabled (default: ON) - SME consultation during planning/clarification
|
|
192
192
|
- critic_pre_plan (default: ON) - critic review before plan finalization
|
|
193
193
|
- sast_enabled (default: ON) - static security scanning
|
|
194
|
-
- council_mode (default: OFF) -
|
|
194
|
+
- council_mode (default: OFF) - replaces per-task Stage B (reviewer + test_engineer) with the full 5-member council (critic, reviewer, sme, test_engineer, explorer). Requires council.enabled: true in config.
|
|
195
195
|
- hallucination_guard (default: OFF) - mandatory per-phase API/signature/claim/citation verification at PHASE-WRAP
|
|
196
196
|
- mutation_test (default: OFF) - mutation testing on source files touched this phase at PHASE-WRAP
|
|
197
|
-
-
|
|
197
|
+
- phase_council (default: OFF) - full 5-member council reviews all work in a phase holistically at phase_complete time. Requires council.enabled: true in config.
|
|
198
198
|
- drift_check (default: ON) - mandatory per-phase drift verification at PHASE-WRAP
|
|
199
|
-
- final_council (default: OFF) -
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
- 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`.
|
|
200
|
+
Additionally, present these two sub-items as part of the same exchange:
|
|
201
|
+
- Parallel coders (default: 1, range: 1-4) - how many coders should run in parallel.
|
|
202
|
+
- Commit frequency (default: phase-level only) - optional per-task checkpoint commit after each task completion.
|
|
203
|
+
The user answers all three (gates, parallel coders, commit frequency) in one exchange. Wait for the user's response.
|
|
204
|
+
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
202
205
|
```
|
|
203
206
|
## Pending Parallelization Config
|
|
204
207
|
- parallelization_enabled: true
|
|
@@ -208,7 +211,6 @@ After `save_plan` succeeds, read `.swarm/context.md`:
|
|
|
208
211
|
- recorded_at: <ISO timestamp>
|
|
209
212
|
```
|
|
210
213
|
If the user accepts the default (1), skip writing this section entirely; serial execution is the default and needs no config.
|
|
211
|
-
After asking the parallelization question, immediately follow up with one more question: "Commit frequency for completed tasks? (default: phase-level only; optional per-task checkpoint commit after each task completion)".
|
|
212
214
|
If the user chooses per-task commits, write this section to `.swarm/context.md`:
|
|
213
215
|
```
|
|
214
216
|
## Task Completion Commit Policy
|
|
@@ -30,25 +30,29 @@ Activates when: user asks to "specify", "define requirements", "write a spec", o
|
|
|
30
30
|
- Edge cases and known failure modes
|
|
31
31
|
- `[NEEDS CLARIFICATION]` markers for items where uncertainty could change scope, security, or core behavior, BUT ONLY after running the clarification funnel: (1) inventory all material uncertainties without numeric cap, (2) classify each as self_resolved/critic_resolved/research_needed/user_decision/deferred_nonblocking — **overconfidence guard:** if the default is not directly supported by user request, spec, or recorded context, classify as `user_decision` rather than `self_resolved`, (3) consult critic_sounding_board with candidate items — critic responds per SoundingBoardVerdict: UNNECESSARY→DROP, RESOLVE→RESOLVE, REPHRASE→REPHRASE, APPROVED→ASK_USER — **always-surface protection:** always-surface categories must not receive UNNECESSARY/DROP; override to APPROVED/ASK_USER, (4) record all resolved items as explicit assumptions in the spec, (5) use markers only for items that survive the funnel (ASK_USER or unresolved after critic consultation). Decision packet format: grouped by category, recommended defaults, blocking vs optional markers, impact of accepting default. Prefer informed defaults over asking
|
|
32
32
|
5. Write the spec to `.swarm/spec.md`.
|
|
33
|
-
5b. **QA GATE SELECTION (dialogue only).**
|
|
34
|
-
Ask the user which QA gates to enable for this plan
|
|
33
|
+
5b. **QA GATE SELECTION, PARALLEL CODERS, AND COMMIT FREQUENCY (dialogue only).**
|
|
34
|
+
Ask the user which QA gates to enable for this plan, how many parallel coders to use, and the commit frequency -- do not select on their behalf. Present all three items together as one unified exchange.
|
|
35
35
|
|
|
36
|
-
Present the eleven gates with their defaults (DEFAULT_QA_GATES) as a single user-facing
|
|
36
|
+
Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, and commit frequency as a single user-facing section. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
|
|
37
37
|
- reviewer (default: ON) -- code review of coder output
|
|
38
38
|
- test_engineer (default: ON) -- test verification of coder output
|
|
39
39
|
- sme_enabled (default: ON) -- SME consultation during planning/clarification
|
|
40
40
|
- critic_pre_plan (default: ON) -- critic review before plan finalization
|
|
41
41
|
- sast_enabled (default: ON) -- static security scanning
|
|
42
|
-
- council_mode (default: OFF) --
|
|
42
|
+
- council_mode (default: OFF) -- replaces per-task Stage B (reviewer + test_engineer) with the full 5-member council (critic, reviewer, sme, test_engineer, explorer). Requires council.enabled: true in config. (recommended for high-impact architecture, public APIs, schema/data mutation, security-sensitive code)
|
|
43
43
|
- hallucination_guard (default: OFF) -- when enabled, mandatory per-phase API/signature/claim/citation verification via critic_hallucination_verifier at PHASE-WRAP; phase_complete will REJECT phase completion unless .swarm/evidence/{phase}/hallucination-guard.json exists with an APPROVED verdict (recommended for claim-heavy or research-heavy work)
|
|
44
44
|
- mutation_test (default: OFF) -- when enabled, runs mutation testing on source files touched this phase via generate_mutants + mutation_test + write_mutation_evidence at PHASE-WRAP; FAIL verdict blocks phase_complete; WARN is non-blocking (recommended for projects with coverage gaps or safety-critical code)
|
|
45
|
-
-
|
|
45
|
+
- phase_council (default: OFF) -- full 5-member council reviews all work in a phase holistically at phase_complete time. Requires council.enabled: true in config. (recommended for multi-task phases with cross-cutting concerns or high-risk integration)
|
|
46
46
|
- drift_check (default: ON) -- when enabled, mandatory per-phase drift verification via critic_drift_verifier at PHASE-WRAP; compares implemented changes against spec.md intent; hard-blocks phase_complete when spec.md exists and drift evidence is missing or REJECTED; advisory-only when no spec.md exists (recommended for all projects with a specification)
|
|
47
|
-
- final_council (default: OFF)
|
|
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 two sub-items as part of the same exchange:
|
|
50
|
+
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel.
|
|
51
|
+
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
The user answers all three (gates, parallel coders, commit frequency) in one exchange. Wait for the user's response.
|
|
54
|
+
|
|
55
|
+
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
52
56
|
```
|
|
53
57
|
## Pending Parallelization Config
|
|
54
58
|
- parallelization_enabled: true
|
|
@@ -59,8 +63,6 @@ If the user answered the gate question, immediately follow up with ONE more ques
|
|
|
59
63
|
```
|
|
60
64
|
If the user accepts the default (1), skip writing this section entirely -- serial execution is the default and needs no config.
|
|
61
65
|
|
|
62
|
-
After asking the parallelization question (regardless of whether the user chose serial or parallel), immediately follow up with ONE more question: "Commit frequency for completed tasks? (default: phase-level only; optional per-task checkpoint commit after each task completion)".
|
|
63
|
-
|
|
64
66
|
If the user chooses per-task commits, write this section to `.swarm/context.md`:
|
|
65
67
|
```
|
|
66
68
|
## Task Completion Commit Policy
|
|
@@ -82,14 +84,12 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
|
|
|
82
84
|
→ WRONG: complexity does not exempt this step. Gate selection is mandatory for ALL plans.
|
|
83
85
|
✗ "I already know which gates are right for this project"
|
|
84
86
|
→ WRONG: the architect does not configure gates. The user configures gates. Always ask.
|
|
85
|
-
✗ "council_general_review is off by default, I don't need to mention it"
|
|
86
|
-
→ WRONG: every gate is presented with its default stated. The user opts in or accepts the default explicitly.
|
|
87
87
|
|
|
88
88
|
MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
|
|
89
89
|
You are BLOCKED until ALL THREE of these conditions are met:
|
|
90
|
-
(1) The gate selection
|
|
91
|
-
(2) The user has responded (accept defaults OR customized list)
|
|
92
|
-
(3) The elected gates have been written to .swarm/context.md under "## Pending QA Gate Selection"
|
|
90
|
+
(1) The unified gate/coders/commit selection section has been presented to the user in a single message
|
|
91
|
+
(2) The user has responded (accept defaults OR customized list for all three items)
|
|
92
|
+
(3) The elected gates, parallel coder config, and commit policy have been written to .swarm/context.md under "## Pending QA Gate Selection" (and related sections as applicable)
|
|
93
93
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
94
94
|
|
|
95
95
|
Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Once the user answers, write the elected gates to `.swarm/context.md` under a new section:
|
|
@@ -103,38 +103,14 @@ Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Onc
|
|
|
103
103
|
- council_mode: <true|false>
|
|
104
104
|
- hallucination_guard: <true|false>
|
|
105
105
|
- mutation_test: <true|false>
|
|
106
|
-
-
|
|
106
|
+
- phase_council: <true|false>
|
|
107
107
|
- drift_check: <true|false>
|
|
108
108
|
- final_council: <true|false>
|
|
109
109
|
- recorded_at: <ISO timestamp>
|
|
110
110
|
```
|
|
111
111
|
MODE: PLAN will read this section after `save_plan` succeeds and persist via `set_qa_gates`.
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
Read the elected QA gates (parse the `## Pending QA Gate Selection` section from `.swarm/context.md` you just wrote, OR call `get_qa_gate_profile` if a profile already exists). If `council_general_review` is false or absent, skip directly to step 7.
|
|
115
|
-
|
|
116
|
-
If `council_general_review` is true:
|
|
117
|
-
1. Read `council.general` from the resolved opencode-swarm config: global ~/.config/opencode/opencode-swarm.json first, then project .opencode/opencode-swarm.json overrides. A global config is valid and must be used when no project override is present; do not fail after checking only the project file. If `council.general.enabled` is not true OR no search API key is configured, surface to the user: "council_general_review gate is enabled but the General Council is not configured. Set council.general.enabled: true and configure a search API key in global ~/.config/opencode/opencode-swarm.json or project .opencode/opencode-swarm.json, or unset council_general_review and re-run." Then stop.
|
|
118
|
-
2. Run the Research Phase: formulate 1-3 targeted `web_search` queries grounded in the spec's domain, then compile a RESEARCH CONTEXT block (same format as MODE: COUNCIL step 2). If web_search fails or returns no usable current sources for a time-sensitive spec question, stop and report the failed grounding instead of dispatching council members. For stable, non-current spec questions only, note the failed search in the dispatch message and proceed with stable background knowledge.
|
|
119
|
-
3. Dispatch `the active swarm's council_generalist agent`, `the active swarm's council_skeptic agent`, and `the active swarm's council_domain_expert agent` in PARALLEL — one message per agent, then STOP and wait. Pass: the spec text as the question, round number 1, the RESEARCH CONTEXT block, and the instruction "Cite from the RESEARCH CONTEXT for external evidence. Your memberId and role are hardcoded in your system prompt." Do NOT share other agents' perspectives at this stage.
|
|
120
|
-
4. Collect all three JSON responses.
|
|
121
|
-
5. Call `convene_general_council` with mode: 'spec_review', the spec as question, and the collected `round1Responses`. Omit `round2Responses` — spec review is a single-pass advisory, not a full deliberation.
|
|
122
|
-
6. Read `consensusPoints` — incorporate unambiguous consensus directly into the spec.
|
|
123
|
-
7. Read `disagreements` — for each: (a) accept one position with rationale, (b) mark as `[NEEDS CLARIFICATION]` in the spec, or (c) schedule an SME consultation.
|
|
124
|
-
8. Synthesize the final spec-review answer directly from the `synthesis` returned by `convene_general_council`. Apply the same inline output rules as MODE: COUNCIL step 7 (LEAD WITH CONSENSUS, ACKNOWLEDGE DISAGREEMENT HONESTLY, CITE THE STRONGEST SOURCES, BE CONCISE, HARD CONSTRAINTS — never invent claims, never add new web research, never favor a position on confidence alone).
|
|
125
|
-
9. Revise `.swarm/spec.md` to reflect the council input.
|
|
126
|
-
|
|
127
|
-
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
128
|
-
SPECIFY-COUNCIL-REVIEW RULES:
|
|
129
|
-
✗ "council_general_review is off by default, I'll skip this"
|
|
130
|
-
→ CORRECT only when the gate is explicitly false or absent. Do NOT assume false. Read the actual gate value before deciding to skip.
|
|
131
|
-
✗ "The spec is already good, no need to ask the council"
|
|
132
|
-
→ WRONG when gate is true: the user enabled this gate for a reason. Run it regardless.
|
|
133
|
-
✗ "I'll include round2Responses for spec_review — more is better"
|
|
134
|
-
→ WRONG: spec review is a single advisory pass. Omit `round2Responses` for spec_review mode.
|
|
135
|
-
✗ "I'll skip the Research Phase to save time"
|
|
136
|
-
→ WRONG: the council agents have no tools and depend on the architect-supplied RESEARCH CONTEXT for external evidence. Skipping the pre-search degrades every downstream agent's grounding.
|
|
137
|
-
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
113
|
+
General Council advisory input is offered as an early workflow option in MODE: BRAINSTORM (Phase 1b), not as a SPECIFY step. If the user wants council input during SPECIFY, they can use `/swarm council <question>` manually.
|
|
138
114
|
|
|
139
115
|
7. Report a summary to the user (MUST count, SHALL count, scenario count, clarification markers, elected QA gates) and suggest the next step: `CLARIFY-SPEC` (if markers exist) or `PLAN`.
|
|
140
116
|
|