opencode-swarm 7.114.0 → 7.114.1
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 +10 -8
- package/.opencode/skills/ci-fix-monitor/SKILL.md +2 -2
- package/.opencode/skills/clarify/SKILL.md +2 -2
- package/.opencode/skills/clarify-spec/SKILL.md +4 -4
- package/.opencode/skills/commit-pr/SKILL.md +32 -20
- package/.opencode/skills/council/SKILL.md +1 -1
- package/.opencode/skills/deep-dive/SKILL.md +3 -3
- package/.opencode/skills/design-docs/SKILL.md +2 -1
- package/.opencode/skills/discover/SKILL.md +2 -2
- package/.opencode/skills/engineering-conventions/SKILL.md +54 -1
- package/.opencode/skills/gate-attribution/SKILL.md +11 -8
- package/.opencode/skills/issue-ingest/SKILL.md +18 -14
- package/.opencode/skills/loop/SKILL.md +3 -4
- package/.opencode/skills/merge-queue-readiness/SKILL.md +6 -13
- package/.opencode/skills/phase-wrap/SKILL.md +30 -28
- package/.opencode/skills/plan/SKILL.md +8 -7
- package/.opencode/skills/resume/SKILL.md +5 -5
- package/.opencode/skills/running-tests/SKILL.md +3 -4
- package/.opencode/skills/specify/SKILL.md +2 -1
- package/.opencode/skills/swarm/SKILL.md +8 -0
- package/.opencode/skills/swarm-ci-monitor/SKILL.md +4 -4
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +55 -38
- package/.opencode/skills/swarm-pr-subscribe/SKILL.md +2 -0
- package/.opencode/skills/test-file-split/SKILL.md +2 -4
- package/.opencode/skills/writing-tests/SKILL.md +97 -27
- package/README.md +2 -2
- package/dist/cli/{curator-llm-factory-awp6xgvt.js → curator-llm-factory-26pyy8cq.js} +1 -1
- package/dist/cli/{curator-wvv628sv.js → curator-wwyj379g.js} +1 -1
- package/dist/cli/{guardrail-explain-hhdtrm60.js → guardrail-explain-qzg7rr7f.js} +2 -2
- package/dist/cli/{hive-promoter-1qkybw79.js → hive-promoter-kfjbydfj.js} +1 -1
- package/dist/cli/{index-jhdv0jdf.js → index-2aszzcyk.js} +1 -1
- package/dist/cli/{index-zezjy05g.js → index-8phvk4v4.js} +16 -20
- package/dist/cli/{index-p35ayncy.js → index-gge9vh5s.js} +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/commands/council.d.ts +0 -1
- package/dist/commands/registry.d.ts +3 -3
- package/dist/index.js +15 -11
- package/dist/tools/test-runner.d.ts +0 -1
- package/package.json +1 -3
|
@@ -54,10 +54,11 @@ If `council.general.enabled` is true in the resolved opencode-swarm config AND a
|
|
|
54
54
|
|
|
55
55
|
**Phase 5: SPEC WRITE + SELF-REVIEW (architect + reviewer).**
|
|
56
56
|
- Generate `.swarm/spec.md` following the same SPEC CONTENT RULES that MODE: SPECIFY uses: WHAT/WHY only, no tech stack, no implementation details, FR-### / SC-### numbering, Given/When/Then scenarios, `[NEEDS CLARIFICATION]` markers only for items that survive the clarification funnel: inventory all material uncertainties without numeric cap → classify each (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` → consult critic_sounding_board — 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 → record resolved items as assumptions → surface only survivors as markers with decision packet format (grouped by category, recommended defaults, blocking vs optional markers).
|
|
57
|
-
- **Important:** If research is ongoing,
|
|
57
|
+
- **Important:** If research is ongoing, apply a fixed 5-minute protocol budget to `research_needed`. If research does not complete before the budget expires, automatically reclassify the item to `user_decision` with a note that research was incomplete, then surface it to the user. This prevents the clarification funnel from stalling while waiting for external research.
|
|
58
58
|
- Cross-reference design sections by name where relevant context helps (but keep HOW out of the spec).
|
|
59
59
|
- Delegate to `the active swarm's reviewer agent` for an independent review of the draft spec. Reviewer must flag: requirements that encode HOW, untestable requirements, missing edge cases, silent assumptions.
|
|
60
60
|
- Apply reviewer feedback. If reviewer rejects, iterate once and re-review. After two rounds, surface remaining disagreements to the user.
|
|
61
|
+
- Before writing `.swarm/spec.md`, apply the FR-002 non-shadowing check: if a non-native spec already exists, do not shadow it (see MODE: SPECIFY step 1b).
|
|
61
62
|
- Write the final spec to `.swarm/spec.md`.
|
|
62
63
|
- Exit when reviewer signs off (or user explicitly accepts remaining disagreements).
|
|
63
64
|
|
|
@@ -70,9 +71,9 @@ hallucination_guard, mutation_test, phase_council, final_council OFF). Do not
|
|
|
70
71
|
write `## Pending Parallelization Config` here because task scopes are not known
|
|
71
72
|
until PLAN; MODE: PLAN will choose safe parallelism automatically. Keep commit
|
|
72
73
|
frequency at phase-level only.
|
|
73
|
-
Now ask the user which QA gates to enable for this plan, how many parallel coders to use,
|
|
74
|
+
Now 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.
|
|
74
75
|
|
|
75
|
-
Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder count,
|
|
76
|
+
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:
|
|
76
77
|
- reviewer (default: ON) -- code review of coder output
|
|
77
78
|
- test_engineer (default: ON) -- test verification of coder output
|
|
78
79
|
- sme_enabled (default: ON) -- SME consultation during planning/clarification
|
|
@@ -85,7 +86,7 @@ Present the eleven gates with their defaults (DEFAULT_QA_GATES), parallel coder
|
|
|
85
86
|
- 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)
|
|
86
87
|
- 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`.
|
|
87
88
|
|
|
88
|
-
Additionally, present these
|
|
89
|
+
Additionally, present these three sub-items as part of the same exchange:
|
|
89
90
|
- Parallel coders (default: 1, range: 1-6) -- how many coders should run in parallel. Parallel coders each run in an isolated git worktree (separate working dir + branch) and merge back automatically, so they never overwrite each other's files -- safe and faster, but only for tasks whose file scopes do NOT overlap. The per-task file scopes that determine a safe parallel count are not known until the plan is finalized, so default to 1 (serial) here; the precise recommendation is made at plan time once the tasks and their scopes exist.
|
|
90
91
|
> COMMON MISCONCEPTION: worktree isolation is baseline for standard parallel coders, governed by the parallel execution profile plus top-level `worktree.policy`. It is not provided by Lean Turbo or Epic. Do not recommend Lean Turbo or Epic to obtain worktree isolation; recommend them only for what they add beyond baseline (Lean Turbo: lane planning, file locks, phase reviewer, integrated diff; Epic: co-change awareness and auto-decide). Worktrees also do not make overlapping scopes safe: dependency readiness, file-disjoint scopes, and merge-back ownership are still required.
|
|
91
92
|
- Commit frequency (default: phase-level only) -- optional per-task checkpoint commit after each task completion.
|
|
@@ -126,13 +127,13 @@ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
|
|
|
126
127
|
✗ "I already know which gates are right for this project"
|
|
127
128
|
→ WRONG: the architect does not configure gates. The user configures gates. Always ask.
|
|
128
129
|
|
|
129
|
-
MANDATORY PAUSE: Do NOT write the spec summary (
|
|
130
|
+
MANDATORY PAUSE: Do NOT write the spec summary (Phase 7 transition). Do NOT suggest next steps.
|
|
130
131
|
Exception: MODE: LOOP with `autonomy=auto` uses the balanced-speed defaults
|
|
131
132
|
above and does not pause for this preference exchange.
|
|
132
133
|
You are BLOCKED until ALL THREE of these conditions are met:
|
|
133
|
-
(1) The unified gate/coders/commit selection section has been presented to the user in a single message
|
|
134
|
-
(2) The user has responded (accept defaults OR customized list for all
|
|
135
|
-
(3) The elected gates, parallel coder config,
|
|
134
|
+
(1) The unified gate/coders/commit/auto_proceed selection section has been presented to the user in a single message
|
|
135
|
+
(2) The user has responded (accept defaults OR customized list for all four items)
|
|
136
|
+
(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)
|
|
136
137
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
137
138
|
|
|
138
139
|
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:
|
|
@@ -149,6 +150,7 @@ Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Onc
|
|
|
149
150
|
- phase_council: <true|false>
|
|
150
151
|
- drift_check: <true|false>
|
|
151
152
|
- final_council: <true|false>
|
|
153
|
+
- auto_proceed: <true|false>
|
|
152
154
|
- recorded_at: <ISO timestamp>
|
|
153
155
|
```
|
|
154
156
|
MODE: PLAN applies these after `save_plan` succeeds via `set_qa_gates`.
|
|
@@ -73,7 +73,7 @@ readCuratorSummary reads file back successfully`), while the same tests pass
|
|
|
73
73
|
on `ubuntu-latest` and `windows-latest`.
|
|
74
74
|
|
|
75
75
|
**Canonical patterns:** See
|
|
76
|
-
`file:.
|
|
76
|
+
`file:.opencode/skills/writing-tests/SKILL.md`
|
|
77
77
|
§ Cross-Platform Requirements → "macOS rename-visibility race" for the
|
|
78
78
|
full three-layer fix pattern (bunWrite + ENOENT retry + Node FileHandle.sync()
|
|
79
79
|
not fsync()). This skill is a triage pointer; the canonical technical
|
|
@@ -85,7 +85,7 @@ or path, the security test `ADVERSARIAL: Command Services Attack Vectors >
|
|
|
85
85
|
Attack Vector 1: Malformed Arguments > EVIDENCE: extremely long task ID
|
|
86
86
|
(buffer overflow) - ACCEPTED by regex but no crash` requires a path length
|
|
87
87
|
guard BEFORE `validateSwarmPath` in `src/evidence/manager.ts:loadEvidence`.
|
|
88
|
-
See `file:.
|
|
88
|
+
See `file:.opencode/skills/engineering-conventions/SKILL.md`
|
|
89
89
|
for the evidence file flow that this gate check triggers on macOS CI.
|
|
90
90
|
|
|
91
91
|
## Step 3 — Diagnose with logs
|
|
@@ -39,7 +39,7 @@ There is NO hard cap on the internal inventory. Record every material uncertaint
|
|
|
39
39
|
Classify each item as exactly one of:
|
|
40
40
|
- `self_resolved`: answered from the user request, spec, plan, codebase reality check, `.swarm/context.md`, repo conventions, or an informed default. **If the default is not directly supported by user request, spec, or recorded context, classify as `user_decision` rather than `self_resolved`.**
|
|
41
41
|
- `critic_resolved`: sent to Critic Sounding Board and resolved by the critic.
|
|
42
|
-
- `research_needed`: needs SME/explorer/domain lookup before user escalation. **Important:** If research is ongoing,
|
|
42
|
+
- `research_needed`: needs SME/explorer/domain lookup before user escalation. **Important:** If research is ongoing, apply a fixed 5-minute protocol budget to `research_needed`. If research does not complete before the budget expires, automatically reclassify the item to `user_decision` with a note that research was incomplete, then surface it to the user. This prevents the clarification funnel from stalling while waiting for external research.
|
|
43
43
|
- `user_decision`: only the user can decide because it affects product scope, risk tolerance, policy, budget, UX, rollout, or destructive behavior.
|
|
44
44
|
- `deferred_nonblocking`: useful follow-up detail that does not block a correct initial plan and can be explicitly recorded as an assumption or follow-up.
|
|
45
45
|
|
|
@@ -107,4 +107,4 @@ All items resolved in Stages 2-3 (self_resolved, critic_resolved, deferred_nonbl
|
|
|
107
107
|
|
|
108
108
|
**Implementation Note:** The hard constraint against `DROP` on always-surface items (defined in Stage 3 of the clarification funnel) is currently enforced via skill instructions to the architect. A lightweight runtime enforcement mechanism is recommended: when processing the critic sounding board verdict response in `src/agents/critic.ts`, validate that any items tagged as "always-surface" do not receive `UNNECESSARY`/`DROP` verdicts. If a DROP verdict is encountered on an always-surface item, override it to `APPROVED`/`ASK_USER` at the code level rather than relying solely on prompt-based enforcement.
|
|
109
109
|
|
|
110
|
-
This mechanical enforcement prevents the following failure mode: the architect prompt instructs the override, but due to parsing errors, context limits, or model behavior variance, the DROP verdict is mistakenly applied to an always-surface item and silently accepted. The validation should occur in the decision-packet assembly code (when building the final clarification packet to surface to the user) and should emit a warning log when an override is applied.
|
|
110
|
+
This mechanical enforcement prevents the following failure mode: the architect prompt instructs the override, but due to parsing errors, context limits, or model behavior variance, the DROP verdict is mistakenly applied to an always-surface item and silently accepted. The validation should occur in the decision-packet assembly code (when building the final clarification packet to surface to the user) and should emit a warning log when an override is applied. This is tracked as future work in a follow-up issue; until then, enforcement relies on the skill instructions.
|
|
@@ -10,7 +10,7 @@ description: >
|
|
|
10
10
|
This protocol is loaded on demand by the architect stub in src/agents/architect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.
|
|
11
11
|
|
|
12
12
|
### MODE: CLARIFY-SPEC
|
|
13
|
-
Activates when: `/swarm sdd status` reports a **single resolved EFFECTIVE spec** (non-null) AND it contains `[NEEDS CLARIFICATION]` markers; OR user says "clarify", "refine spec", "review spec", or "/swarm clarify" is invoked; OR architect transitions from MODE: SPECIFY with open markers.
|
|
13
|
+
Activates when: `/swarm sdd status` reports a **single resolved EFFECTIVE spec** (non-null) AND it contains `[NEEDS CLARIFICATION]` markers; OR user says "clarify", "refine spec", "review spec", or "/swarm clarify" is invoked; OR architect transitions from MODE: SPECIFY or MODE: BRAINSTORM with open markers.
|
|
14
14
|
|
|
15
15
|
`/swarm sdd status` reflects `readEffectiveSpecSync`, which returns **null** (NO effective spec) for: no sources at all, multiple competing sources (e.g. `openspec/` AND `.specify/`), multi-feature Spec-Kit without a selected feature, or any other unresolvable state. CLARIFY-SPEC does NOT activate in these null cases — tell the user: "No resolved effective spec exists. Disambiguate with `/swarm sdd project --source <source>` or `--feature <feature>`, or run `/swarm specify` to generate one first." and stop.
|
|
16
16
|
|
|
@@ -31,7 +31,7 @@ CONSTRAINT: CLARIFY-SPEC must NEVER create a spec. Always consult `/swarm sdd st
|
|
|
31
31
|
- Offer 2–4 multiple-choice options for each question
|
|
32
32
|
- Mark the recommended option with reasoning (e.g., "Recommended: Option 2 because…")
|
|
33
33
|
- Allow free-form input as an alternative to the options
|
|
34
|
-
|
|
34
|
+
6. After each accepted answer, write the resolution to the **resolved effective source** (source-aware write-back):
|
|
35
35
|
- **NATIVE effective spec** (`.swarm/spec.md` exists): update `.swarm/spec.md` with the resolution directly.
|
|
36
36
|
- **NON-NATIVE effective spec** (openspec/specify-only, NO native `.swarm/spec.md`): do NOT write `.swarm/spec.md` — this would silently shadow the non-native source. Instead:
|
|
37
37
|
- (a) If the resolved source supports in-place edits (e.g., OpenSpec sections), update the source artifacts directly.
|
|
@@ -39,8 +39,8 @@ CONSTRAINT: CLARIFY-SPEC must NEVER create a spec. Always consult `/swarm sdd st
|
|
|
39
39
|
- (c) If neither (a) nor (b) applies, stop and tell the user the clarification cannot be auto-written to a non-native source without a projection step.
|
|
40
40
|
- Replace the relevant `[NEEDS CLARIFICATION]` marker or vague language with the accepted answer.
|
|
41
41
|
- If the answer invalidates an earlier requirement, update it to remove the contradiction.
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
7. Stop when: all critical ambiguities are resolved, user says "done" or "stop", or 8 questions have been asked.
|
|
43
|
+
8. Report a ## Clarification Summary: total questions asked, requirements added/modified/removed, remaining open ambiguities (if any), and suggest next step (`PLAN` if spec is clear, or continue clarifying).
|
|
44
44
|
|
|
45
45
|
CLARIFY-SPEC RULES:
|
|
46
46
|
- FR-ID increment rule: When adding new requirements, find the highest existing FR-ID and increment from there (FR-001 → FR-002). Never reuse or skip FR-IDs.
|
|
@@ -72,6 +72,8 @@ Run before publication work:
|
|
|
72
72
|
```bash
|
|
73
73
|
git fetch origin main
|
|
74
74
|
rm -f .swarm/evidence/*.json
|
|
75
|
+
rm -f .swarm/evidence/pr_body.md
|
|
76
|
+
rm -f .swarm/evidence/commit-pr-validation.md
|
|
75
77
|
git status --short
|
|
76
78
|
```
|
|
77
79
|
|
|
@@ -112,6 +114,8 @@ The fragment should cover:
|
|
|
112
114
|
- breaking changes, if any
|
|
113
115
|
- known caveats
|
|
114
116
|
|
|
117
|
+
Bot authors (e.g. `[bot]`, Copilot) and docs/workflow/meta-only changes (no `src/`, `tests/`, `scripts/`, `package.json`, etc.) are exempt from this requirement by CI; all other PRs that touch code must include a fragment.
|
|
118
|
+
|
|
115
119
|
Do not manually edit:
|
|
116
120
|
|
|
117
121
|
- `package.json` version
|
|
@@ -147,24 +151,26 @@ node --input-type=module -e "await import('./dist/index.js'); console.log('dist
|
|
|
147
151
|
|
|
148
152
|
### Tier 1 - quality
|
|
149
153
|
|
|
150
|
-
Run both linter AND formatter — e.g., `bunx @biomejs/biome@<version> check --write .` or equivalent — because CI quality gates reject code that passes tests but fails style validation. **Pin the tool version** to match the version in `package.json` (`@biomejs/biome`); unversioned `bunx biome` resolves to a different version than the CI gate uses.
|
|
154
|
+
Run both linter AND formatter — e.g., `bunx @biomejs/biome@<version> check --write .` or equivalent — because CI quality gates reject code that passes tests but fails style validation. **Pin the tool version** to match the version in `package.json` (`@biomejs/biome`); unversioned `bunx biome` resolves to a different version than the CI gate uses. (the repo script `bun run lint:ci` runs the pinned Biome version; prefer it over invoking `bunx biome` directly).
|
|
151
155
|
|
|
152
156
|
```bash
|
|
153
157
|
bun run typecheck
|
|
154
|
-
|
|
158
|
+
bun run lint:ci
|
|
159
|
+
bun run scripts/check-tool-registration.ts
|
|
160
|
+
bash scripts/check-mock-cleanup.sh
|
|
161
|
+
bash scripts/check-invariants.sh
|
|
162
|
+
bash scripts/check-cross-contamination.sh
|
|
163
|
+
bash scripts/check-test-clock.sh
|
|
155
164
|
```
|
|
156
165
|
|
|
157
166
|
### Tier 2 - unit tests
|
|
158
167
|
|
|
159
168
|
```bash
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
for f in tests/unit/agents/*.test.ts; do bun --smol test "$f" --timeout 30000; done
|
|
163
|
-
for f in tests/unit/hooks/*.test.ts; do bun --smol test "$f" --timeout 30000; done
|
|
164
|
-
bun --smol test tests/unit/cli tests/unit/commands tests/unit/config --timeout 120000
|
|
169
|
+
bun run test:unit:ci # CI-equivalent unit gate (quarantine ledgers + retry budget)
|
|
170
|
+
bun run test:unit:ci <file>... # scoped mode: run only the listed repo-relative test files
|
|
165
171
|
```
|
|
166
172
|
|
|
167
|
-
|
|
173
|
+
`bun run test:unit:ci` runs `scripts/ci/run-unit-tests-local.ts`, the CI-equivalent unit gate with per-platform quarantine ledgers (`scripts/ci/quarantined-tests.txt`, `quarantined-tests-macos.txt`, `quarantined-tests-windows.txt`) and the retry budget. The full serial run is 45–90 min, so use the scoped mode (`bun run test:unit:ci <file>...`) when the evidence justifies narrowing (e.g. you only touched one module). This closes the gap the hand-rolled loops left (~40% of CI's colocated `src/**` tests were uncovered).
|
|
168
174
|
|
|
169
175
|
### Tier 3 - integration
|
|
170
176
|
|
|
@@ -191,7 +197,11 @@ If a failure looks unrelated, prove it on clean `origin/main` before carrying it
|
|
|
191
197
|
|
|
192
198
|
```bash
|
|
193
199
|
git worktree add /tmp/repro-check origin/main
|
|
194
|
-
|
|
200
|
+
cd /tmp/repro-check
|
|
201
|
+
bun install --frozen-lockfile
|
|
202
|
+
bun run build
|
|
203
|
+
bun --smol test <repo-relative-path-to-failing-test> --timeout 120000
|
|
204
|
+
cd ..
|
|
195
205
|
git worktree remove /tmp/repro-check
|
|
196
206
|
```
|
|
197
207
|
|
|
@@ -221,14 +231,14 @@ Before opening a PR, verify no local-only files are staged:
|
|
|
221
231
|
git diff --name-only HEAD origin/main | grep -E '\.(local\.json|vscode|idea)' || true
|
|
222
232
|
```
|
|
223
233
|
|
|
224
|
-
Prefer a single clean commit for the branch before initial PR publication:
|
|
234
|
+
Prefer a single clean commit for the branch before initial PR publication. Resolve the canonical remote first (see "Canonical remote resolution" below), then squash/push:
|
|
225
235
|
|
|
226
236
|
```bash
|
|
227
|
-
git fetch
|
|
228
|
-
git log --oneline
|
|
229
|
-
git reset --soft
|
|
237
|
+
git fetch <canonical-remote> <base-branch>
|
|
238
|
+
git log --oneline <canonical-remote>/<base-branch>..HEAD
|
|
239
|
+
git reset --soft <canonical-remote>/<base-branch>
|
|
230
240
|
git commit -m "type(scope): description"
|
|
231
|
-
git push --force-with-lease -u
|
|
241
|
+
git push --force-with-lease -u <canonical-remote> <branch-name>
|
|
232
242
|
```
|
|
233
243
|
|
|
234
244
|
If a review cycle is already active and inline comments depend on current SHAs, avoid resquashing until threads are resolved.
|
|
@@ -237,8 +247,8 @@ If pushing to a PR branch owned by another agent or bot, push to the PR's actual
|
|
|
237
247
|
|
|
238
248
|
```powershell
|
|
239
249
|
$prBranch = gh pr view <number> --json headRefName --jq '.headRefName'
|
|
240
|
-
git fetch
|
|
241
|
-
git push
|
|
250
|
+
git fetch <canonical-remote> $prBranch
|
|
251
|
+
git push <canonical-remote> "<your-local-branch>:$prBranch" --force-with-lease
|
|
242
252
|
```
|
|
243
253
|
|
|
244
254
|
### Fork PR workflow approval
|
|
@@ -268,13 +278,13 @@ pattern was pushed before the string-concatenation workaround was applied.
|
|
|
268
278
|
**The primary check (pre-push, after commit exists):**
|
|
269
279
|
|
|
270
280
|
```bash
|
|
271
|
-
git log origin/main..HEAD -p | grep -E
|
|
281
|
+
git log origin/main..HEAD -p | grep -E 'sk_live|ghp_|xox[abprs]-|AKIA|eyJ|AIza' || true
|
|
272
282
|
```
|
|
273
283
|
|
|
274
284
|
**The optional pre-commit add-on (staged changes only):**
|
|
275
285
|
|
|
276
286
|
```bash
|
|
277
|
-
git diff --cached | grep -E
|
|
287
|
+
git diff --cached | grep -E 'sk_live|ghp_|xox[abprs]-|AKIA|eyJ|AIza' || true
|
|
278
288
|
```
|
|
279
289
|
|
|
280
290
|
Forbidden patterns: Stripe (`sk_live_*`), GitHub (`ghp_*`), Slack (`xox[abprs]-*`),
|
|
@@ -325,6 +335,8 @@ PR body requirements:
|
|
|
325
335
|
- `## Invariant audit`
|
|
326
336
|
- `## Test plan`
|
|
327
337
|
|
|
338
|
+
CI enforces both the section ORDER (Summary, then Invariant audit, then Test plan) and that each heading is on its own line with nothing trailing but whitespace (see `.github/workflows/pr-standards.yml`).
|
|
339
|
+
|
|
328
340
|
### Publication-gate evidence
|
|
329
341
|
|
|
330
342
|
A repository publication gate (`.github/hooks/pr-publication-gate.json` ->
|
|
@@ -415,6 +427,8 @@ $issueCommentPath = Join-Path ([System.IO.Path]::GetTempPath()) "issue-comment.t
|
|
|
415
427
|
gh issue comment <issue-number> --body-file $issueCommentPath
|
|
416
428
|
````
|
|
417
429
|
|
|
430
|
+
If the PR merged before this was done, post the missing issue comment immediately.
|
|
431
|
+
|
|
418
432
|
## Commit messages
|
|
419
433
|
|
|
420
434
|
`git commit -m "..."` with parens, brackets, backticks, or dollar-signs in the message fails on PowerShell because the shell parses them as expressions. Write the commit message to a UTF-8 (no BOM) file first and use `git commit -F <file>`.
|
|
@@ -435,8 +449,6 @@ git commit -F $commitMsgPath
|
|
|
435
449
|
|
|
436
450
|
Apply this pattern for any commit message containing special characters, multi-paragraph bodies, or code blocks. The plain `git commit -m "..."` form remains fine for short single-line messages with no special characters.
|
|
437
451
|
|
|
438
|
-
If the PR merged before this was done, post the missing issue comment immediately.
|
|
439
|
-
|
|
440
452
|
## Step 7 - Existing PR follow-up and closeout
|
|
441
453
|
|
|
442
454
|
If a PR already exists for the branch:
|
|
@@ -15,7 +15,7 @@ the full execution details live here.
|
|
|
15
15
|
### MODE: COUNCIL
|
|
16
16
|
|
|
17
17
|
Activates when: user invokes `/swarm council <question>` (optionally with
|
|
18
|
-
`--
|
|
18
|
+
`--spec-review`).
|
|
19
19
|
|
|
20
20
|
Purpose: convene a fixed three-agent multi-model General Council
|
|
21
21
|
(generalist / skeptic / domain expert) for an advisory deliberation. The
|
|
@@ -97,12 +97,12 @@ Explorers generate CANDIDATE FINDINGS only — they do NOT make verdicts. All fi
|
|
|
97
97
|
1. Collect all candidate findings from all explorer missions.
|
|
98
98
|
2. Deduplicate: merge findings that reference the same location and issue.
|
|
99
99
|
3. Assign DD-C001 through DD-CNNN identifiers to unique findings.
|
|
100
|
-
4.
|
|
101
|
-
5.
|
|
100
|
+
4. Sort candidates by severity (CRITICAL → HIGH → MEDIUM → LOW → INFO).
|
|
101
|
+
5. Shard into ≤10-candidate shards until all candidates are assigned to a shard.
|
|
102
102
|
|
|
103
103
|
## Step 5 — Always 2 Parallel Reviewers
|
|
104
104
|
|
|
105
|
-
Split the
|
|
105
|
+
Split the candidates into shards of ≤10 each and dispatch 2 parallel `the active swarm's reviewer agent` calls.
|
|
106
106
|
|
|
107
107
|
Each reviewer receives:
|
|
108
108
|
- Their shard of candidates (up to 10)
|
|
@@ -28,8 +28,9 @@ If the header is malformed, report the error and stop.
|
|
|
28
28
|
## Step 1 — Preconditions
|
|
29
29
|
|
|
30
30
|
1. Confirm `design_docs.enabled` is true (the `docs_design` agent only exists when enabled). If it is not, tell the user to set `design_docs.enabled: true` in `opencode-swarm.json` and stop.
|
|
31
|
-
2. If a spec-staleness block is active (`.swarm/spec-staleness.json` present), resolve/acknowledge spec staleness FIRST — otherwise design-doc writes may be blocked by the guardrail
|
|
31
|
+
2. If a spec-staleness block is active (`.swarm/spec-staleness.json` present), resolve/acknowledge spec staleness FIRST — otherwise design-doc writes may be blocked by the guardrail, which emits `SPEC_DRIFT_BLOCK`. Do not blindly retry on `SPEC_DRIFT_BLOCK`.
|
|
32
32
|
3. Read `.swarm/spec.md` if present — it is the authoritative requirements source (FR-### IDs). The design docs must be consistent with it.
|
|
33
|
+
Run `/swarm sdd status` to resolve the effective spec before reading.
|
|
33
34
|
|
|
34
35
|
## Step 2 — Index Existing State (always)
|
|
35
36
|
|
|
@@ -17,5 +17,5 @@ For complex tasks, make a second explorer call focused on risk/gap analysis:
|
|
|
17
17
|
After explorer returns:
|
|
18
18
|
- Run `symbols` tool on key files identified by explorer to understand public API surfaces
|
|
19
19
|
- For multi-file module surveys: prefer `batch_symbols` over sequential single-file symbols calls
|
|
20
|
-
- Run `complexity_hotspots` if not already run
|
|
21
|
-
- Check for project governance files using the `glob` tool with patterns `project-instructions.md`, `docs/project-instructions.md`, `CONTRIBUTING.md`, and `
|
|
20
|
+
- Run `complexity_hotspots` if not already run during project discovery (check context.md for existing analysis). Note modules with recommendation "security_review" or "full_gates" in context.md.
|
|
21
|
+
- Check for project governance files using the `glob` tool with patterns `project-instructions.md`, `docs/project-instructions.md`, `CONTRIBUTING.md`, `INSTRUCTIONS.md`, `AGENTS.md`, and `CLAUDE.md` (process all matches found). For each file found: read it and extract all MUST (mandatory constraints) and SHOULD (recommended practices) rules. Write the extracted rules as a summary to `.swarm/context.md` under a `## Project Governance` section — append if the section already exists, create it if not. If no MUST or SHOULD rules are found in the file, skip writing. If no governance file is found: skip silently. Existing DISCOVER steps are unchanged.
|
|
@@ -35,6 +35,7 @@ If you are not sure whether you are touching one of these, you are touching one
|
|
|
35
35
|
The full list of 12 invariants is in `AGENTS.md`. The four that have caused the most recent production regressions:
|
|
36
36
|
|
|
37
37
|
1. **Plugin initialization is bounded and fail-open.** Every awaited operation on the plugin-init path must be wrapped in `withTimeout(...)` and degrade non-fatally on timeout. Issue #704 (v7.0.3) and the v7.3.3 git-hygiene regression both stem from violating this. The OpenCode plugin host silently drops a plugin whose entry never resolves; users see "no agents in TUI / GUI" with no error.
|
|
38
|
+
- **Bounded is not free:** `withTimeout` only prevents an *unbounded* hang — the awaited work's latency still counts toward the ~400 ms repro-704 init deadline. Defer non-trivial init I/O via `queueMicrotask` when nothing downstream needs it before `server()` resolves.
|
|
38
39
|
2. **Subprocesses are bounded, non-interactive, and killable.** Every `bunSpawn(['<bin>', ...])` call must pass `cwd`, `stdin: 'ignore'` (unless intentionally interactive), `timeout: <ms>`, bounded stdio, and call `proc.kill()` in a `finally`. An outer `withTimeout` is not enough — it lets the awaiter proceed but does not abort the child.
|
|
39
40
|
3. **Runtime portability — Node-ESM-loadable + v1 plugin shape.** No top-level `bun:` imports in `dist/index.js`. Default export is `{ id, server }`. All `Bun.*` calls go through `src/utils/bun-compat.ts`. v6.86.8 / v6.86.9 are the cautionary tales.
|
|
40
41
|
4. **Test mock isolation.** `mock.module(...)` leaks across files in Bun's shared test-runner process. Prefer, in order: (a) `_test_exports` for pure function testing with zero mocks, (b) `_internals` dependency-injection seam for within-module mocking (see `src/utils/gitignore-warning.ts:_internals` and `src/hooks/diff-scope.ts:_internals`), (c) `mock.module` only when unavoidable. Restore in `afterEach`. The writing-tests skill covers all three tiers in detail; load it before modifying tests.
|
|
@@ -49,7 +50,7 @@ The OpenCode `test_runner` tool is for **targeted agent validation** with explic
|
|
|
49
50
|
|
|
50
51
|
- `MAX_SAFE_TEST_FILES = 50` (`src/tools/test-runner.ts`). Resolutions exceeding this return `outcome: 'scope_exceeded'` with a SKIP. Do not lean on this — broad scopes can stall or kill OpenCode before that guard fires.
|
|
51
52
|
- For repo validation, run the shell commands in `contributing.md` / `TESTING.md` directly (per-file isolation loops + tier orchestration).
|
|
52
|
-
- `scope: 'all'`
|
|
53
|
+
- `scope: 'all'` is gated behind the `SWARM_ALLOW_FULL_SUITE=1` env var (intended for opt-in CI mirrors only); there is no `allow_full_suite` arg. Default to `files: [...]` instead.
|
|
53
54
|
|
|
54
55
|
## The invariant-audit gate (PR-time)
|
|
55
56
|
|
|
@@ -57,6 +58,58 @@ Every PR that touches a relevant area must include an `## Invariant audit` secti
|
|
|
57
58
|
|
|
58
59
|
If you cannot prove a touched invariant from source and test output, **do not push**.
|
|
59
60
|
|
|
61
|
+
## Evidence file flow (`.swarm/evidence/{taskId}.json`)
|
|
62
|
+
|
|
63
|
+
**Agents NEVER write these files directly.** The `delegation-gate` hook
|
|
64
|
+
writes them automatically after each reviewer/test_engineer Task
|
|
65
|
+
delegation returns. The schema is defined in `src/gate-evidence.ts`:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
export interface GateEvidence {
|
|
69
|
+
sessionId: string; // actual session ID from the Task delegation
|
|
70
|
+
timestamp: string; // ISO 8601
|
|
71
|
+
agent: string; // 'reviewer' | 'test_engineer' | 'sme' | etc.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface TaskEvidence {
|
|
75
|
+
taskId: string;
|
|
76
|
+
required_gates: string[];
|
|
77
|
+
gates: Record<string, GateEvidence>;
|
|
78
|
+
turbo?: boolean;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**How to verify the flow is working:**
|
|
83
|
+
|
|
84
|
+
1. After dispatching a reviewer/test_engineer Task, the `delegation-gate`
|
|
85
|
+
toolAfter hook should automatically write/update
|
|
86
|
+
`.swarm/evidence/{taskId}.json`.
|
|
87
|
+
2. When you call `update_task_status(completed)`, the tool reads the
|
|
88
|
+
evidence file and verifies the `required_gates` are all present.
|
|
89
|
+
3. If `update_task_status` fails with "required QA gates not yet satisfied"
|
|
90
|
+
or "Evidence file is corrupt or unreadable," inspect the evidence
|
|
91
|
+
file with `cat .swarm/evidence/{taskId}.json` to diagnose.
|
|
92
|
+
|
|
93
|
+
**Do NOT manually write or fabricate evidence files.** This bypasses the
|
|
94
|
+
gate enforcement and can cause downstream tool failures when the real
|
|
95
|
+
session IDs are looked up.
|
|
96
|
+
|
|
97
|
+
**When to suspect the flow is broken:**
|
|
98
|
+
|
|
99
|
+
- The evidence file doesn't exist after a reviewer/test_engineer Task
|
|
100
|
+
delegation returns
|
|
101
|
+
- The evidence file exists but has wrong `agent` or `sessionId` values
|
|
102
|
+
- The plan has newly-added task IDs that the hook may not recognize
|
|
103
|
+
|
|
104
|
+
**Workaround for broken flow:** If the hook consistently fails to write
|
|
105
|
+
the evidence file, escalate to the user — do NOT silently fabricate
|
|
106
|
+
evidence with placeholder session IDs. The gate check exists to enforce
|
|
107
|
+
that a real review/test run happened.
|
|
108
|
+
|
|
109
|
+
See [`.opencode/skills/writing-tests/SKILL.md`](../writing-tests/SKILL.md)
|
|
110
|
+
§ Cross-Platform Requirements → "macOS rename-visibility race" for the
|
|
111
|
+
ENOENT retry pattern that this gate flow triggers on macOS CI.
|
|
112
|
+
|
|
60
113
|
## Init-path-safe imports (invariant 1 deep-dive)
|
|
61
114
|
|
|
62
115
|
The most expensive invariant-1 violations come from **transitive import chains** that silently load heavy modules (WASM, tree-sitter) at plugin init time. A single `import { X } from '../../lang'` in a tool-time module can transitively load `runtime.ts` → `web-tree-sitter` (heavy WASM), spiking init latency well past the repro-704 T1 deadline (observed during issue #1471 development).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gate-attribution
|
|
3
3
|
audience: swarm-plugin
|
|
4
|
-
description: Per-task gate dispatch protocol. Documents single-task attribution plus parseable set-dispatch reviewer/test_engineer rows.
|
|
4
|
+
description: Per-task gate dispatch protocol for reviewer/test_engineer set-dispatch attribution. Activates when dispatch_lanes returns set-dispatch verdict rows that must be attributed to plan tasks. Documents single-task attribution plus parseable set-dispatch reviewer/test_engineer rows.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Gate Attribution
|
|
@@ -14,17 +14,20 @@ output includes parseable per-task rows:
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
[REVIEWED] | task-2.1 | APPROVED | ...
|
|
17
|
-
[
|
|
17
|
+
[TESTED] | 2.1 | PASS | ...
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
`[REVIEWED]` verdicts are `APPROVED | REJECTED | CONCERNS`; `[TESTED]` verdicts
|
|
21
|
+
are `PASS | FAIL | SKIPPED`. Rows with `task-X.Y` are normalized to `X.Y`;
|
|
22
|
+
unsafe or non-plan IDs are ignored.
|
|
23
|
+
Each parseable per-task verdict row creates gate evidence (regardless of verdict
|
|
24
|
+
value); the gate's pass/fail decision is made elsewhere from the accumulated
|
|
25
|
+
evidence. If no rows are parseable, attribution falls back to the single-task
|
|
26
|
+
rule.
|
|
24
27
|
|
|
25
28
|
## Protocol
|
|
26
29
|
1. **For unrelated or high-risk tasks:** Dispatch separate reviewer and/or test_engineer lanes with exactly ONE taskId.
|
|
27
|
-
2. **For a true set-dispatch:** Require one `[REVIEWED] | task-id | verdict | ...` row per task in the returned output.
|
|
30
|
+
2. **For a true set-dispatch:** Require one `[REVIEWED] | task-id | verdict | ...` (or `[TESTED] | ...`) row per task in the returned output. Each parseable row creates gate evidence; the gate decision is made from the accumulated evidence.
|
|
28
31
|
3. **Minimize overhead via parallel dispatch when set-dispatch is not appropriate:**
|
|
29
32
|
```
|
|
30
33
|
dispatch_lanes_async with:
|
|
@@ -35,7 +38,7 @@ no reviewed rows are parseable, attribution falls back to the single-task rule.
|
|
|
35
38
|
4. **Collect + attribute:** Single-task lanes auto-attribute to their taskId; set-dispatch rows auto-attribute per parsed row.
|
|
36
39
|
5. **Do NOT rely on prose summaries:** A batched dispatch without parseable rows is ambiguous and does not count per-task.
|
|
37
40
|
|
|
38
|
-
Gate evidence is persisted independently as `.swarm/evidence/{taskId}.json` for each task.
|
|
41
|
+
Gate evidence is persisted independently as `.swarm/evidence/{taskId}.json` for each task. Each parseable set-dispatch row causes the hook to write one task-scoped evidence file for that task (regardless of verdict value); a single multi-task evidence file cannot satisfy any task.
|
|
39
42
|
|
|
40
43
|
## Optimization for trivial tasks
|
|
41
44
|
For pure ceremony gates (1-line doc fix):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: issue-ingest
|
|
3
3
|
audience: swarm-plugin
|
|
4
4
|
description: >
|
|
5
|
-
Full execution protocol for MODE: ISSUE_INGEST -- GitHub issue intake, localization, spec generation, and transition to
|
|
5
|
+
Full execution protocol for MODE: ISSUE_INGEST -- GitHub issue intake, localization, spec generation, and transition to the full fix workflow.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Issue Ingest Protocol
|
|
@@ -16,19 +16,21 @@ Purpose: ingest a GitHub issue, localize root cause, and produce a resolution sp
|
|
|
16
16
|
|
|
17
17
|
Flags parsed from signal:
|
|
18
18
|
- `plan=true` → after spec generation, transition to MODE: PLAN (create implementation plan)
|
|
19
|
-
- `trace=true` → after plan, delegate to swarm-implement skill for
|
|
20
|
-
- `noRepro=true` → skip reproduction
|
|
19
|
+
- `trace=true` → after plan, delegate to swarm-implement skill for the fix workflow; the user invokes commit-pr to publish (implies plan=true)
|
|
20
|
+
- `noRepro=true` → skip the reproduction step below
|
|
21
21
|
|
|
22
22
|
#### Phase 1: INTAKE
|
|
23
23
|
1. Fetch the issue body using the GitHub CLI (`gh issue view <N> --repo <owner>/<repo> --json title,body,labels,assignees,comments`) or web fetch.
|
|
24
|
+
- If the issue cannot be fetched (404, private repo, no `gh` auth, or the argument resolves to a PR not an issue), report the blocked operation explicitly and do not proceed on empty intake; fall back to any pasted issue text the user provided. Closed-issue cases proceed but note the closed state.
|
|
24
25
|
2. Parse the issue into a normalized **Intake Note** with four required fields:
|
|
25
26
|
- **Observed behavior**: what the issue reports
|
|
26
27
|
- **Expected behavior**: what should happen instead
|
|
27
28
|
- **Reproduction steps**: how to trigger the issue (may be absent; flag with `[NEEDS REPRO]` if missing)
|
|
28
29
|
- **Environment**: platform, version, configuration context
|
|
29
30
|
3. If any required field is missing and cannot be inferred from context, flag as `[NEEDS REPRO]`.
|
|
30
|
-
4.
|
|
31
|
-
5.
|
|
31
|
+
4. Attempt a minimal reproduction of the reported issue: record the exact commands and their output. Skip this step when `noRepro=true` (set via `--no-repro`); in that case, note that reproduction was skipped and proceed on the issue text alone.
|
|
32
|
+
5. Ask the user clarifying questions one at a time, max 6 per intake, when the issue text is ambiguous; otherwise flag the item with markers like `[NEEDS REPRO]` or `[NEEDS CLARIFICATION]` and proceed.
|
|
33
|
+
6. Exit when the Intake Note is complete or all missing fields are flagged.
|
|
32
34
|
|
|
33
35
|
#### Phase 2: LOCALIZATION
|
|
34
36
|
1. Delegate to `the active swarm's explorer agent` to scan the codebase for code areas related to the issue's observed behavior.
|
|
@@ -41,23 +43,25 @@ Flags parsed from signal:
|
|
|
41
43
|
5. Exit when a root cause is identified with ≥70% confidence, or when all hypotheses are exhausted (report ambiguity).
|
|
42
44
|
|
|
43
45
|
#### Phase 3: SPEC GENERATION
|
|
44
|
-
0. Include a **Root Cause** section derived from Phase 2 localization results: concise statement of the identified root cause, location, and confidence score. Include a **Fix Strategy** section at product/behavior level (what the fix must accomplish, not how to implement it).
|
|
45
|
-
1.
|
|
46
|
+
0. Include a **Root Cause** section derived from Phase 2 localization results: concise statement of the identified root cause, location, and confidence score; the `location` field (file/function from Phase 2 localization) is the sole exception to the no-implementation-detail rule. Include a **Fix Strategy** section at product/behavior level (what the fix must accomplish, not how to implement it).
|
|
47
|
+
1. If `.swarm/spec.md` already exists, route through MODE: SPECIFY step 1's classification (overwrite / refine / archive / non-shadowing check) before writing — do not clobber an existing spec. (This protects the drift-gate which consumes spec.md.)
|
|
48
|
+
2. Generate `.swarm/spec.md` using the same SPEC CONTENT RULES as MODE: SPECIFY:
|
|
46
49
|
- WHAT users need and WHY — never HOW to implement
|
|
47
50
|
- FR-### / SC-### numbering, Given/When/Then scenarios
|
|
48
51
|
- No technology stack, APIs, or code structure
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
- `[NEEDS CLARIFICATION]` markers only for items that survive the clarification funnel: inventory all material uncertainties without numeric cap → classify each (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` → consult critic_sounding_board — 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 → record resolved items as assumptions → surface only survivors as markers with decision packet format (grouped by category, recommended defaults, blocking vs optional markers)
|
|
53
|
+
- **Important:** Apply a fixed 5-minute protocol budget to `research_needed`. If research does not complete within 5 minutes, automatically reclassify the item to `user_decision` with a note that research was incomplete, then surface it to the user.
|
|
54
|
+
3. Cross-reference the spec against the issue's expected behavior to ensure alignment.
|
|
55
|
+
4. If the issue is a bug: spec must describe the correct behavior, not the broken behavior.
|
|
56
|
+
5. If the issue is a feature: spec must describe the user-facing outcome, not the implementation.
|
|
57
|
+
6. Carry forward any `[NEEDS REPRO]` / `[NEEDS CLARIFICATION]` flags from Phase 1 into the spec as open questions; do not silently drop them.
|
|
58
|
+
7. QA GATE SELECTION: Ask user which QA gates to enable (same dialogue as MODE: SPECIFY). Write to `.swarm/context.md` under `## Pending QA Gate Selection`.
|
|
55
59
|
|
|
56
60
|
#### Phase 4: TRANSITION
|
|
57
61
|
Based on flags:
|
|
58
62
|
- No flags → report spec summary and suggest `PLAN` or `CLARIFY-SPEC`
|
|
59
63
|
- `plan=true` → transition to MODE: PLAN using the generated spec
|
|
60
|
-
- `trace=true` → transition to MODE: PLAN, then delegate to swarm-implement skill for
|
|
64
|
+
- `trace=true` → transition to MODE: PLAN, then delegate to swarm-implement skill for the fix workflow; the user invokes commit-pr to publish
|
|
61
65
|
|
|
62
66
|
RULES:
|
|
63
67
|
- One question per message in INTAKE dialogue (max 6 questions)
|
|
@@ -256,8 +256,7 @@ When a stop condition fires:
|
|
|
256
256
|
- Learnings captured this run and where they live.
|
|
257
257
|
- Suggested next steps (e.g., open a PR via `/swarm pr-review` or the
|
|
258
258
|
commit-pr flow — do NOT open a PR unless the user asks).
|
|
259
|
-
3. Emit a
|
|
260
|
-
automation can detect terminal state:
|
|
259
|
+
3. Emit a completion marker on its own line to summarize terminal state for human readers:
|
|
261
260
|
|
|
262
261
|
`<loop-complete reason="objective-met|budget-exhausted|plateau|oscillation|unrecoverable-error|user-stop" cycles="N"/>`
|
|
263
262
|
|
|
@@ -293,8 +292,8 @@ A minimal, append-friendly shape — extend as needed but keep these fields:
|
|
|
293
292
|
|
|
294
293
|
| Behavior | `auto` (default) | `checkpoint` |
|
|
295
294
|
| --- | --- | --- |
|
|
296
|
-
| Pause at phase gates | Yes — wait for user approval |
|
|
297
|
-
| Confirm before next cycle |
|
|
295
|
+
| Pause at phase gates | No | Yes — wait for user approval |
|
|
296
|
+
| Confirm before next cycle | No | Yes |
|
|
298
297
|
| Mandatory review + critic gates | Enforced | Enforced |
|
|
299
298
|
| Hard stop conditions (budget, plateau, oscillation, errors) | Enforced | Enforced |
|
|
300
299
|
| Weaken/mock/skip a failing test | Never | Never |
|
|
@@ -13,20 +13,13 @@ Before adding the PR to the merge queue (or before the final push if the repo us
|
|
|
13
13
|
1. **Fetch latest main:** `git fetch origin main`
|
|
14
14
|
2. **Run the simulation command (preferred):**
|
|
15
15
|
```
|
|
16
|
-
/swarm ci-simulate
|
|
16
|
+
/swarm ci-simulate [<pr-ref>]
|
|
17
17
|
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
integration/security/smoke tests, and `bun run drift:check`.
|
|
21
|
-
`test:unit:ci` runs unit tests per file with the repo's quarantine filters
|
|
22
|
-
and retry budget, matching CI's mock-isolation semantics. The command creates
|
|
23
|
-
a temporary detached worktree under `.swarm/ci-simulate`, merges the PR branch
|
|
24
|
-
or current worktree commit, runs the gate sequence, removes the worktree, and
|
|
25
|
-
prunes metadata. It does not accept arbitrary shell commands.
|
|
26
|
-
3. **Manual fallback:** If the command is unavailable, create a temporary simulation worktree (do NOT mutate the PR branch). Use a project-relative path UNDER the swarm worktree base so the path is portable across OSes and its later removal is permitted by the worktree guardrail (paths outside `.swarm-worktrees/` are blocked). Do NOT hardcode `/tmp` — it does not exist on Windows.
|
|
18
|
+
The optional positional `<pr-ref>` is the PR branch/ref to simulate (defaults to the current branch). It does NOT accept `--base`/`--head` flags. The command runs fixed local gates: `bun run typecheck`, `bun run lint`, `bun run build`, then a full-batch `bun test`. It creates a temporary detached worktree under `os.tmpdir()/swarm-ci-simulate` (a SIBLING of the project root, not project-relative), merges the PR ref, runs the gate sequence, removes the worktree, and prunes metadata. It does not accept arbitrary shell commands and does NOT replicate CI's quarantine/retry semantics — it is a fast pre-merge signal, not a CI parity check.
|
|
19
|
+
3. **Manual fallback:** If the command is unavailable, create a temporary simulation worktree (do NOT mutate the PR branch). The default worktree base is a SIBLING of the project root (`<parent>/.swarm-worktrees/`), overridable via the `worktree_dir` config; on Windows, very long paths may be shortened to `os.tmpdir()/swwt/...`. Place the worktree under that base. Do NOT hardcode `/tmp` — it does not exist on Windows.
|
|
27
20
|
```
|
|
28
|
-
git worktree add
|
|
29
|
-
cd
|
|
21
|
+
git worktree add ../.swarm-worktrees/merge-sim origin/main
|
|
22
|
+
cd ../.swarm-worktrees/merge-sim
|
|
30
23
|
git merge <pr-branch> --no-edit
|
|
31
24
|
```
|
|
32
25
|
4. **Run integration + unit tests against the merged result:**
|
|
@@ -36,7 +29,7 @@ Before adding the PR to the merge queue (or before the final push if the repo us
|
|
|
36
29
|
```
|
|
37
30
|
(Use per-file loops for hot modules per AGENTS.md invariant 6)
|
|
38
31
|
5. **If failures:** Fix on the PR branch, re-push, re-simulate. Always run the cleanup step (6) before re-simulating or on any exit path — do not leave the simulation worktree behind.
|
|
39
|
-
6. **Cleanup for manual fallback (run on EVERY exit path, including failure):** `git worktree remove
|
|
32
|
+
6. **Cleanup for manual fallback (run on EVERY exit path, including failure):** Prefer non-force `git worktree remove ../.swarm-worktrees/merge-sim`. If the removal is blocked or fails, surface the block to the user (the worktree guard fails closed for safety) and run `git worktree prune`.
|
|
40
33
|
7. **Only after simulation passes,** add PR to the merge queue.
|
|
41
34
|
|
|
42
35
|
## Why this matters
|