opencode-swarm 7.79.1 → 7.79.5
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/council/SKILL.md +2 -1
- package/.opencode/skills/loop/SKILL.md +311 -0
- package/.opencode/skills/plan/SKILL.md +17 -1
- package/.opencode/skills/specify/SKILL.md +9 -9
- package/dist/agents/architect.d.ts +2 -1
- package/dist/cli/index.js +1969 -1070
- package/dist/commands/learning.d.ts +4 -0
- package/dist/commands/loop.d.ts +15 -0
- package/dist/commands/registry.d.ts +68 -0
- package/dist/config/bundled-skills.d.ts +1 -1
- package/dist/hooks/curator-types.d.ts +8 -3
- package/dist/hooks/curator.d.ts +20 -3
- package/dist/hooks/knowledge-curator.d.ts +2 -0
- package/dist/hooks/trajectory-logger.d.ts +6 -0
- package/dist/hooks/trajectory-step-state.d.ts +11 -0
- package/dist/index.js +3342 -2824
- package/dist/prm/escalation.d.ts +3 -3
- package/dist/prm/index.d.ts +14 -1
- package/dist/prm/replay.d.ts +32 -0
- package/dist/prm/trajectory-store.d.ts +3 -0
- package/dist/services/learning-metrics.d.ts +4 -2
- package/package.json +3 -2
|
@@ -27,7 +27,8 @@ 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
28
|
being drafted (spec_review mode is available via `/swarm council --spec-review`
|
|
29
29
|
for manual spec review). General Council advisory input is offered as an early
|
|
30
|
-
workflow option in MODE: BRAINSTORM (Phase 1b)
|
|
30
|
+
workflow option in MODE: BRAINSTORM (Phase 1b) and MODE: PLAN before
|
|
31
|
+
`save_plan`.
|
|
31
32
|
|
|
32
33
|
#### Pre-flight (always run first)
|
|
33
34
|
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loop
|
|
3
|
+
description: >
|
|
4
|
+
Full execution protocol for MODE: LOOP — the compound-engineering loop:
|
|
5
|
+
brainstorm → plan → build → review → improve, iterating under
|
|
6
|
+
defense-in-depth stop conditions with generator/critic separation,
|
|
7
|
+
durable resumable state, and mandatory compounding learning capture.
|
|
8
|
+
Loaded on demand by the architect when the loop command emits a
|
|
9
|
+
[MODE: LOOP ...] signal.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Compound-Engineering Loop Protocol
|
|
13
|
+
|
|
14
|
+
MODE: LOOP runs an objective end to end as a series of gated phases, then
|
|
15
|
+
loops to compound improvements until the objective is met or a stop condition
|
|
16
|
+
fires. Each cycle reuses the existing mode skills (`brainstorm`, `plan`,
|
|
17
|
+
`critic-gate`, `execute`, `phase-wrap`) and ends with a learning-capture step
|
|
18
|
+
so the next cycle is cheaper — that is what makes the loop *compounding* rather
|
|
19
|
+
than merely repeating.
|
|
20
|
+
|
|
21
|
+
This is a real implementation workflow: it delegates to the coder, declares
|
|
22
|
+
scope, and mutates source code through the normal EXECUTE path. It is distinct
|
|
23
|
+
from full-auto (autonomous cross-phase oversight via the `critic_oversight`
|
|
24
|
+
agent) and turbo (parallel lanes within a single phase). LOOP is a
|
|
25
|
+
user-initiated, gated, sequential, compounding workflow.
|
|
26
|
+
|
|
27
|
+
The two design rules that everything below serves:
|
|
28
|
+
|
|
29
|
+
1. **Separate the generator from the verifier.** The context that writes a
|
|
30
|
+
change must never be the only context that approves it. Implementation,
|
|
31
|
+
independent review, and critic challenge live in separate delegated
|
|
32
|
+
contexts. Review is report-only; a distinct fix step applies changes.
|
|
33
|
+
2. **Stop on positive evidence or a budget — never on vibes.** Every phase has
|
|
34
|
+
an entry gate and an exit gate backed by concrete evidence, and the loop has
|
|
35
|
+
layered stop conditions so it can never run away.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 0 — Parse Header
|
|
40
|
+
|
|
41
|
+
Parse the `[MODE: LOOP ...]` header to extract:
|
|
42
|
+
|
|
43
|
+
- `objective`: the goal text after the header (the WHAT to achieve). Empty only
|
|
44
|
+
when `resume=true`.
|
|
45
|
+
- `max_cycles`: integer 1..5 (default 3) — hard cap on outer improvement cycles.
|
|
46
|
+
- `autonomy`: `checkpoint` (default) or `auto`.
|
|
47
|
+
- `checkpoint`: pause at each phase gate and wait for explicit user approval
|
|
48
|
+
before continuing.
|
|
49
|
+
- `auto`: proceed across gates without prompting, but still enforce every
|
|
50
|
+
hard stop condition and the mandatory review/critic gates.
|
|
51
|
+
- `depth`: `standard` (default) or `exhaustive` (wider exploration in
|
|
52
|
+
BRAINSTORM and PLAN: more candidate approaches, deeper localization).
|
|
53
|
+
- `resume`: `true` | `false`. When true, resume the existing run from durable
|
|
54
|
+
state instead of starting a new objective.
|
|
55
|
+
|
|
56
|
+
If the header is malformed or required fields are missing, report the error and
|
|
57
|
+
stop.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 1 — Preconditions & Durable State
|
|
62
|
+
|
|
63
|
+
1. **Working tree.** Check `git status`. If the tree is dirty, surface the
|
|
64
|
+
uncommitted changes and ask whether to proceed (checkpoint) or proceed only
|
|
65
|
+
if the changes are clearly part of this objective (auto). Do not silently
|
|
66
|
+
build on an unknown working state.
|
|
67
|
+
2. **Run state directory.** Loop state lives under `.swarm/loop/<run-id>/`
|
|
68
|
+
(containment invariant — never write loop state outside `.swarm/`).
|
|
69
|
+
- New run (`resume=false`): allocate a `run-id` (short slug + timestamp),
|
|
70
|
+
create `.swarm/loop/<run-id>/state.json`, and record the baseline:
|
|
71
|
+
objective, parsed parameters, start HEAD commit, `cycle: 0`,
|
|
72
|
+
`phase: brainstorm`, empty `improvements` and `learnings` lists.
|
|
73
|
+
- Resume (`resume=true`): locate the most recent `.swarm/loop/<run-id>/`
|
|
74
|
+
with an unfinished state, read it, **validate required fields** (`run_id`,
|
|
75
|
+
`cycle`, `phase`, `done` must all be present and have the correct types;
|
|
76
|
+
if any are missing or malformed, report the corruption clearly and stop
|
|
77
|
+
rather than continuing with undefined values), print a short progress
|
|
78
|
+
summary (cycle N of max_cycles, current phase, last gate result), and
|
|
79
|
+
continue from the recorded phase. If no resumable run exists, say so and
|
|
80
|
+
stop.
|
|
81
|
+
- **Retention:** On both new-run and resume entry, prune completed runs
|
|
82
|
+
(`.done === true`) that exceed 10 in count — keep the 10 most recent by
|
|
83
|
+
timestamp, remove the rest. This prevents unbounded state accumulation
|
|
84
|
+
under `.swarm/loop/`.
|
|
85
|
+
3. **State is derived, not authoritative for code.** The durable state file
|
|
86
|
+
tracks *loop control* (cycle counter, phase, gate outcomes, captured
|
|
87
|
+
learnings, stop reason). Actual implementation progress is derived from git
|
|
88
|
+
and the plan ledger (`.swarm/plan-ledger.jsonl`), never from conversation
|
|
89
|
+
memory — so a killed/resumed session never loses or re-does work.
|
|
90
|
+
|
|
91
|
+
Write the state file after every gate transition. The on-disk state is the
|
|
92
|
+
single source of truth for resumability.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Step 2 — The Cycle
|
|
97
|
+
|
|
98
|
+
One cycle is five phases run in order: **BRAINSTORM → PLAN → BUILD → REVIEW →
|
|
99
|
+
IMPROVE**. Do not skip or collapse phases. Each phase has an entry gate
|
|
100
|
+
(precondition) and an exit gate (positive evidence required before the next
|
|
101
|
+
phase begins). In `checkpoint` autonomy, pause at each gate for user approval.
|
|
102
|
+
|
|
103
|
+
On cycle 2+, BRAINSTORM is replaced by a lightweight **refinement** step: feed
|
|
104
|
+
the prior cycle's captured improvements and residual findings into PLAN
|
|
105
|
+
directly (skip full discovery dialogue) — the objective is already framed.
|
|
106
|
+
|
|
107
|
+
### Phase 1 — BRAINSTORM (cycle 1 only)
|
|
108
|
+
|
|
109
|
+
- **Entry gate:** objective is non-empty; no approved plan already covers it.
|
|
110
|
+
- **Action:** Load `file:.opencode/skills/brainstorm/SKILL.md` and run it to
|
|
111
|
+
produce `.swarm/spec.md` and a QA gate profile. With `depth=exhaustive`,
|
|
112
|
+
require at least one non-obvious candidate approach.
|
|
113
|
+
- **Exit gate:** `spec.md` exists with explicit, testable success criteria and
|
|
114
|
+
scope boundaries. Record the success criteria into loop state — they are the
|
|
115
|
+
objective-met test used by the stop conditions. Checkpoint: confirm the spec
|
|
116
|
+
with the user.
|
|
117
|
+
|
|
118
|
+
### Phase 2 — PLAN
|
|
119
|
+
|
|
120
|
+
- **Entry gate:** a spec (or, on cycle 2+, the improvement directives) exists.
|
|
121
|
+
- **Action:**
|
|
122
|
+
1. Load `file:.opencode/skills/pre-phase-briefing/SKILL.md` (required before
|
|
123
|
+
planning, especially on cycle 2+: it reads the prior retrospective and
|
|
124
|
+
verifies codebase reality so the new plan reflects what actually changed).
|
|
125
|
+
2. Load `file:.opencode/skills/plan/SKILL.md` to decompose the work into
|
|
126
|
+
tasks and call `save_plan`. With `depth=exhaustive`, prefer finer task
|
|
127
|
+
granularity and deeper localization.
|
|
128
|
+
3. Load `file:.opencode/skills/critic-gate/SKILL.md` to put the plan through
|
|
129
|
+
an independent critic.
|
|
130
|
+
- **Exit gate:** critic verdict is APPROVED (NEEDS_REVISION → revise and
|
|
131
|
+
re-submit, max 2 cycles per the critic-gate skill; REJECTED → stop and report
|
|
132
|
+
to the user). Record the verdict in loop state.
|
|
133
|
+
|
|
134
|
+
### Phase 3 — BUILD
|
|
135
|
+
|
|
136
|
+
- **Entry gate:** a critic-approved plan exists.
|
|
137
|
+
- **Action:** Load `file:.opencode/skills/execute/SKILL.md` and run the plan
|
|
138
|
+
phase by phase. The coder implements each task; per-task QA gates (tests,
|
|
139
|
+
lint, security, etc.) run as defined by the selected QA profile. The coder
|
|
140
|
+
context is the **generator** — it does not get to declare its own work
|
|
141
|
+
correct.
|
|
142
|
+
- **Exit gate:** all planned tasks for the cycle are implemented and their
|
|
143
|
+
per-task QA gates pass with recorded evidence. NEVER weaken, mock, skip, or
|
|
144
|
+
delete a failing test/assertion to make a gate pass — fix the root cause or
|
|
145
|
+
stop and report.
|
|
146
|
+
|
|
147
|
+
### Phase 4 — REVIEW (report-only) + FIX
|
|
148
|
+
|
|
149
|
+
This phase is the heart of the generator/verifier separation. It runs on the
|
|
150
|
+
**actual current diff**, in contexts independent of the coder.
|
|
151
|
+
|
|
152
|
+
- **Entry gate:** BUILD exit gate passed; capture the current diff
|
|
153
|
+
(`git diff` against the cycle's start commit).
|
|
154
|
+
- **Action:**
|
|
155
|
+
1. **Independent reviewer.** Delegate the real diff and the QA evidence to a
|
|
156
|
+
fresh reviewer context. It defaults to disbelief, looks for correctness
|
|
157
|
+
bugs, regressions, security issues, missing edge cases, and
|
|
158
|
+
claimed-vs-actual mismatches, and classifies each finding. The reviewer
|
|
159
|
+
does not edit code — it reports.
|
|
160
|
+
2. **Critic challenge.** Delegate the reviewer-approved diff and any
|
|
161
|
+
HIGH/CRITICAL findings to a separate critic context that challenges weak
|
|
162
|
+
evidence, overclaimed severity, and missing sibling-file checks. The
|
|
163
|
+
critic may overturn the reviewer.
|
|
164
|
+
3. **Fix step.** For every `NEEDS_REVISION` / `REJECTED` / `BLOCKED` item,
|
|
165
|
+
return to the coder (generator) to fix it with code, tests, or evidence,
|
|
166
|
+
then re-run the affected reviewer/critic gate. Any edit after approval
|
|
167
|
+
invalidates that approval — re-review.
|
|
168
|
+
- **Exit gate:** reviewer approval AND critic approval on the latest diff, with
|
|
169
|
+
the latest edit older than both approvals. Record the reviewer/critic verdicts
|
|
170
|
+
durably alongside the phase evidence (the phase-wrap evidence manager writes
|
|
171
|
+
retrospective and gate artifacts under `.swarm/evidence/` — keep the
|
|
172
|
+
review/critic outcomes with that phase's evidence so `phase_complete` and any
|
|
173
|
+
later audit can read them). This satisfies the mandatory implementation
|
|
174
|
+
closeout gate.
|
|
175
|
+
|
|
176
|
+
### Phase 5 — IMPROVE (phase-wrap + compounding capture)
|
|
177
|
+
|
|
178
|
+
This is what makes the loop compound. Do not declare completion without it.
|
|
179
|
+
|
|
180
|
+
- **Entry gate:** REVIEW exit gate passed.
|
|
181
|
+
- **Action:**
|
|
182
|
+
1. Load `file:.opencode/skills/phase-wrap/SKILL.md` and write the mandatory
|
|
183
|
+
retrospective (the `phase_complete` gate blocks without a valid `retro-N`
|
|
184
|
+
bundle). Rescan the codebase and update documentation exactly as the
|
|
185
|
+
phase-wrap skill directs — that is, scoped to its authorized set
|
|
186
|
+
(README.md / CONTRIBUTING.md / docs/ via the `docs` agent). Do NOT edit the
|
|
187
|
+
governance contract files (AGENTS.md / CLAUDE.md); they constrain the loop
|
|
188
|
+
and are out of scope for autonomous edits.
|
|
189
|
+
2. **Capture learnings durably.** Distill what this cycle taught — recurring
|
|
190
|
+
bug classes, surprising couplings, tooling gotchas, convention decisions —
|
|
191
|
+
into the knowledge base (the `knowledge_add` tool / the memory tools when
|
|
192
|
+
enabled) and/or a categorized note under `.swarm/loop/<run-id>/learnings/`.
|
|
193
|
+
3. **Make learnings discoverable.** Ensure the next loop will actually read
|
|
194
|
+
them: persist via `knowledge_add` (which `knowledge_recall` surfaces in
|
|
195
|
+
later phases) rather than a write-only note nobody reads — capturing
|
|
196
|
+
learnings nothing retrieves does not compound.
|
|
197
|
+
4. **Feed findings forward.** Record any review/critic finding that recurred
|
|
198
|
+
so it becomes an explicit check in the next cycle's reviewer prompt.
|
|
199
|
+
- **Exit gate:** retrospective written and accepted by `phase_complete`;
|
|
200
|
+
learnings persisted; the cycle's improvements and residual findings recorded
|
|
201
|
+
in loop state.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Step 3 — Loop Decision (Stop Conditions)
|
|
206
|
+
|
|
207
|
+
After IMPROVE, evaluate the stop conditions **in order**. Use defense in depth:
|
|
208
|
+
several overlapping conditions, not one. Record the chosen `stop_reason` in
|
|
209
|
+
loop state.
|
|
210
|
+
|
|
211
|
+
1. **Objective met (primary).** The success criteria captured in Phase 1 are
|
|
212
|
+
all satisfied AND the full validation suite / required QA gates are green.
|
|
213
|
+
→ STOP (success).
|
|
214
|
+
2. **Cycle budget exhausted.** `cycle >= max_cycles`. → STOP. Never exceed
|
|
215
|
+
`max_cycles`.
|
|
216
|
+
3. **No-progress / plateau.** The just-finished cycle produced no qualifying
|
|
217
|
+
improvement toward the objective (no new passing criteria, no accepted
|
|
218
|
+
review fix that advanced the goal). → STOP and report the plateau; looping
|
|
219
|
+
again would burn budget without progress.
|
|
220
|
+
4. **Oscillation.** The cycle reintroduced or reverted a change made in a prior
|
|
221
|
+
cycle (the diff fingerprint repeats). → STOP and report; the loop is
|
|
222
|
+
thrashing.
|
|
223
|
+
5. **Unrecoverable error.** A gate cannot pass for a reason outside this
|
|
224
|
+
objective's scope (e.g., REJECTED plan, environment failure, a required
|
|
225
|
+
external dependency is unavailable). → STOP and report.
|
|
226
|
+
6. **Explicit user stop.** The user asked to stop. → STOP immediately.
|
|
227
|
+
|
|
228
|
+
If none fire and budget remains: increment `cycle`, set the next cycle's input
|
|
229
|
+
to the recorded improvement directives + residual findings, and return to
|
|
230
|
+
**Phase 2 (PLAN)** (cycle 2+ skips full BRAINSTORM). In `checkpoint` autonomy,
|
|
231
|
+
confirm "continue for another cycle?" with the user before looping.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Step 4 — Completion
|
|
236
|
+
|
|
237
|
+
When a stop condition fires:
|
|
238
|
+
|
|
239
|
+
1. Mark loop state `done` with the `stop_reason` and final HEAD commit.
|
|
240
|
+
2. Present a human-readable summary:
|
|
241
|
+
- Objective and whether it was met.
|
|
242
|
+
- Baseline → final state (what changed, key files/tasks).
|
|
243
|
+
- Cycles run (and why it stopped).
|
|
244
|
+
- Tasks completed vs deferred; residual review findings and where they are
|
|
245
|
+
recorded.
|
|
246
|
+
- Learnings captured this run and where they live.
|
|
247
|
+
- Suggested next steps (e.g., open a PR via `/swarm pr-review` or the
|
|
248
|
+
commit-pr flow — do NOT open a PR unless the user asks).
|
|
249
|
+
3. Emit a machine-detectable completion marker on its own line so callers /
|
|
250
|
+
automation can detect terminal state:
|
|
251
|
+
|
|
252
|
+
`<loop-complete reason="objective-met|budget-exhausted|plateau|oscillation|unrecoverable-error|user-stop" cycles="N"/>`
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Durable State Schema (`.swarm/loop/<run-id>/state.json`)
|
|
257
|
+
|
|
258
|
+
A minimal, append-friendly shape — extend as needed but keep these fields:
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"run_id": "rate-limit-20260618T0712Z",
|
|
263
|
+
"objective": "add rate limiting to the public API",
|
|
264
|
+
"params": { "max_cycles": 3, "autonomy": "checkpoint", "depth": "standard" },
|
|
265
|
+
"start_commit": "<sha>",
|
|
266
|
+
"cycle": 1,
|
|
267
|
+
"phase": "review",
|
|
268
|
+
"success_criteria": ["...", "..."],
|
|
269
|
+
"gates": [
|
|
270
|
+
{ "cycle": 1, "phase": "plan", "result": "approved", "at": "<iso>" }
|
|
271
|
+
],
|
|
272
|
+
"improvements": [],
|
|
273
|
+
"learnings": [],
|
|
274
|
+
"done": false,
|
|
275
|
+
"stop_reason": null,
|
|
276
|
+
"final_commit": null
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Autonomy Quick Reference
|
|
283
|
+
|
|
284
|
+
| Behavior | `checkpoint` (default) | `auto` |
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| Pause at phase gates | Yes — wait for user approval | No |
|
|
287
|
+
| Confirm before next cycle | Yes | No |
|
|
288
|
+
| Mandatory review + critic gates | Enforced | Enforced |
|
|
289
|
+
| Hard stop conditions (budget, plateau, oscillation, errors) | Enforced | Enforced |
|
|
290
|
+
| Weaken/mock/skip a failing test | Never | Never |
|
|
291
|
+
|
|
292
|
+
`auto` reduces prompts; it never reduces verification.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Anti-Patterns (do not do these)
|
|
297
|
+
|
|
298
|
+
- Letting the coder context approve its own diff. Review and critic must be
|
|
299
|
+
independent contexts.
|
|
300
|
+
- Treating passing tests, explorer output, or self-review as the implementation
|
|
301
|
+
closeout gate. They are not.
|
|
302
|
+
- Editing code after reviewer/critic approval and then declaring done without
|
|
303
|
+
re-review. Any post-approval edit invalidates the approval.
|
|
304
|
+
- Looping "one more time" past `max_cycles` or after a plateau because it feels
|
|
305
|
+
close. Stop and report.
|
|
306
|
+
- Skipping the IMPROVE/compound capture step to finish faster. The compounding
|
|
307
|
+
step is the point of the loop.
|
|
308
|
+
- Storing loop progress only in conversation context. Persist to
|
|
309
|
+
`.swarm/loop/<run-id>/` so the loop survives interruption.
|
|
310
|
+
- Weakening, mocking, skipping, or deleting a failing assertion to turn a gate
|
|
311
|
+
green. Fix the root cause or stop.
|
|
@@ -39,6 +39,22 @@ This is a SOFT gate. When the user chooses "Skip and plan directly", proceed to
|
|
|
39
39
|
|
|
40
40
|
Run CODEBASE REALITY CHECK scoped to codebase elements referenced in spec.md or user constraints. Discrepancies must be reflected in the generated plan.
|
|
41
41
|
|
|
42
|
+
### GENERAL COUNCIL ADVISORY OPTION (pre-save_plan)
|
|
43
|
+
|
|
44
|
+
Before drafting or saving the plan, the architect MUST offer General Council advisory input when `council.general.enabled` is true in the resolved opencode-swarm config and a search API key is configured.
|
|
45
|
+
|
|
46
|
+
- Ask the user: "Use General Council advisory input before I write the plan? The 3-agent council (generalist, skeptic, domain expert) will gather current external context and provide perspectives that I will fold into the plan before critic review. (default: no)"
|
|
47
|
+
- If the user declines, proceed to the clarification funnel and planning normally.
|
|
48
|
+
- If the user accepts:
|
|
49
|
+
1. Run the General Council Research Phase: formulate 1-3 targeted `web_search` queries grounded in the work being planned.
|
|
50
|
+
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.
|
|
51
|
+
3. Collect responses and call `convene_general_council` with mode `general`.
|
|
52
|
+
4. Record the council consensus, disagreements, cited sources, and any plan-impacting assumptions in `.swarm/context.md` under `## Decisions`.
|
|
53
|
+
5. Use that recorded council input as planning context before calling `save_plan`.
|
|
54
|
+
- If General Council is unavailable and the user explicitly requested council input, surface the config/key requirement and stop before `save_plan` rather than writing an ungrounded plan.
|
|
55
|
+
|
|
56
|
+
General Council is advisory and distinct from `council_mode`, `phase_council`, and `final_council`. It is not a QA gate. Its purpose here is to make current external context available before the architect writes any plan and before any critic pre-plan review.
|
|
57
|
+
|
|
42
58
|
### CLARIFICATION FUNNEL (pre-save_plan)
|
|
43
59
|
|
|
44
60
|
Before calling `save_plan` — whether creating a new plan or finalizing an external plan ingestion — the architect MUST run this four-stage clarification funnel. The goal is to limit unnecessary user interruption, not planning completeness.
|
|
@@ -292,4 +308,4 @@ After the QA gate selection has been persisted via `set_qa_gates` and the TRACEA
|
|
|
292
308
|
3. Wait for the critic's verdict before proceeding to MODE: EXECUTE.
|
|
293
309
|
4. If the critic approves: proceed to MODE: EXECUTE for implementation.
|
|
294
310
|
5. If the critic requests revision (NEEDS_REVISION): revise the plan and re-submit to the critic (max 2 cycles).
|
|
295
|
-
6. If the critic rejects after 2 cycles: escalate to the user with a full explanation.
|
|
311
|
+
6. If the critic rejects after 2 cycles: escalate to the user with a full explanation.
|
|
@@ -30,10 +30,10 @@ 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, PARALLEL CODERS,
|
|
34
|
-
Ask the user which QA gates to enable for this plan, how many parallel coders to use,
|
|
33
|
+
5b. **QA GATE SELECTION, PARALLEL CODERS, COMMIT FREQUENCY, AND AUTO_PROCEED (dialogue only).**
|
|
34
|
+
Ask the user which QA gates to enable for this plan, how many parallel coders to use, the commit frequency, and auto_proceed -- do not select on their behalf. Present all four items together as one unified exchange.
|
|
35
35
|
|
|
36
|
-
Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count,
|
|
36
|
+
Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count, commit frequency, and auto_proceed 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
|
|
@@ -46,12 +46,12 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
|
|
|
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
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
|
-
Additionally, present these
|
|
49
|
+
Additionally, present these three sub-items as part of the same exchange:
|
|
50
50
|
- Parallel coders (default: 1, range: 1-4) -- how many coders should run in parallel.
|
|
51
51
|
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
52
52
|
- auto_proceed (boolean, default: false) -- when true, auto-advance to the next phase without asking "Ready for Phase N+1?"; runtime toggle via /swarm auto-proceed on|off.
|
|
53
53
|
|
|
54
|
-
The user answers all
|
|
54
|
+
The user answers all four (gates, parallel coders, commit frequency, auto_proceed) in one exchange. Wait for the user's response.
|
|
55
55
|
|
|
56
56
|
If the user says parallel coders > 1, write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
|
|
57
57
|
```
|
|
@@ -88,9 +88,9 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
|
|
|
88
88
|
|
|
89
89
|
MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
|
|
90
90
|
You are BLOCKED until ALL THREE of these conditions are met:
|
|
91
|
-
(1) The unified gate/coders/commit selection section has been presented to the user in a single message
|
|
92
|
-
(2) The user has responded (accept defaults OR customized list for all
|
|
93
|
-
(3) The elected gates, parallel coder config,
|
|
91
|
+
(1) The unified gate/coders/commit/auto_proceed selection section has been presented to the user in a single message
|
|
92
|
+
(2) The user has responded (accept defaults OR customized list for all four items)
|
|
93
|
+
(3) The elected gates, parallel coder config, commit policy, and auto_proceed selection have been written to .swarm/context.md under "## Pending QA Gate Selection" (and related sections as applicable)
|
|
94
94
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
95
95
|
|
|
96
96
|
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:
|
|
@@ -111,7 +111,7 @@ Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Onc
|
|
|
111
111
|
```
|
|
112
112
|
MODE: PLAN will read this section after `save_plan` succeeds and persist via `set_qa_gates`.
|
|
113
113
|
|
|
114
|
-
General Council advisory input is offered as an early workflow option in MODE: BRAINSTORM (Phase 1b)
|
|
114
|
+
General Council advisory input is offered as an early workflow option in MODE: BRAINSTORM (Phase 1b) and MODE: PLAN before `save_plan`, not as a SPECIFY step. If the user wants council input during SPECIFY, they can use `/swarm council <question>` manually.
|
|
115
115
|
|
|
116
116
|
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`.
|
|
117
117
|
|
|
@@ -21,7 +21,8 @@ export interface CouncilWorkflowConfig {
|
|
|
21
21
|
/**
|
|
22
22
|
* General Council Mode (advisory). When `general?.enabled === true`, the
|
|
23
23
|
* architect's tool list includes `convene_general_council` and the prompt
|
|
24
|
-
* emits `MODE: COUNCIL`
|
|
24
|
+
* emits `MODE: COUNCIL` plus pre-plan advisory instructions in the loaded
|
|
25
|
+
* PLAN protocol.
|
|
25
26
|
*/
|
|
26
27
|
general?: {
|
|
27
28
|
enabled?: boolean;
|