opencode-swarm 6.13.2 → 6.14.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/README.md +86 -33
- package/dist/cli/index.js +8 -5
- package/dist/config/evidence-schema.d.ts +75 -3
- package/dist/hooks/system-enhancer.d.ts +7 -0
- package/dist/index.js +591 -289
- package/dist/tools/phase-complete.d.ts +16 -0
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ This checks that everything is wired up correctly.
|
|
|
76
76
|
|
|
77
77
|
### Configure Models (Optional)
|
|
78
78
|
|
|
79
|
-
By default, Swarm uses
|
|
79
|
+
By default, Swarm v6.14+ uses free OpenCode Zen models (no API key required). You can override any agent's model by creating `.opencode/swarm.json` in your project. See the [LLM Provider Guide](#llm-provider-guide) for all options.
|
|
80
80
|
|
|
81
81
|
```json
|
|
82
82
|
{
|
|
@@ -127,6 +127,60 @@ Use `/swarm status` at any time to see where things stand.
|
|
|
127
127
|
|
|
128
128
|
---
|
|
129
129
|
|
|
130
|
+
## LLM Provider Guide
|
|
131
|
+
|
|
132
|
+
Swarm works with any LLM provider supported by OpenCode. Different agents benefit from different models — the architect needs strong reasoning, the coder needs strong code generation, and the reviewer benefits from a model different from the coder (to catch blind spots).
|
|
133
|
+
|
|
134
|
+
### Free Tier (OpenCode Zen Models)
|
|
135
|
+
|
|
136
|
+
OpenCode Zen provides free models via the `opencode/` provider prefix. These are excellent starting points and require no API key:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"agents": {
|
|
141
|
+
"coder": { "model": "opencode/minimax-m2.5-free" },
|
|
142
|
+
"reviewer": { "model": "opencode/big-pickle" },
|
|
143
|
+
"test_engineer":{ "model": "opencode/gpt-5-nano" },
|
|
144
|
+
"explorer": { "model": "opencode/trinity-large-preview-free" },
|
|
145
|
+
"sme": { "model": "opencode/trinity-large-preview-free" },
|
|
146
|
+
"critic": { "model": "opencode/trinity-large-preview-free" },
|
|
147
|
+
"docs": { "model": "opencode/trinity-large-preview-free" },
|
|
148
|
+
"designer": { "model": "opencode/trinity-large-preview-free" }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
> Save this configuration to `.opencode/swarm.json` in your project root (or `~/.config/opencode/opencode-swarm.json` for global config).
|
|
154
|
+
|
|
155
|
+
> **Note:** The `architect` key is intentionally omitted — it inherits whatever model you have selected in the OpenCode UI for maximum reasoning quality.
|
|
156
|
+
|
|
157
|
+
### Paid Providers
|
|
158
|
+
|
|
159
|
+
For production use, mix providers to maximize quality across writing vs. reviewing:
|
|
160
|
+
|
|
161
|
+
| Agent | Recommended Model | Why |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `architect` | OpenCode UI selection | Needs strongest reasoning |
|
|
164
|
+
| `coder` | `minimax-coding-plan/MiniMax-M2.5` | Fast, accurate code generation |
|
|
165
|
+
| `reviewer` | `zai-coding-plan/glm-5` | Different training data from coder |
|
|
166
|
+
| `test_engineer` | `minimax-coding-plan/MiniMax-M2.5` | Same strengths as coder |
|
|
167
|
+
| `explorer` | `google/gemini-2.5-flash` | Fast read-heavy analysis |
|
|
168
|
+
| `sme` | `kimi-for-coding/k2p5` | Strong domain expertise |
|
|
169
|
+
| `critic` | `zai-coding-plan/glm-5` | Independent plan review |
|
|
170
|
+
| `docs` | `zai-coding-plan/glm-4.7-flash` | Fast, cost-effective documentation generation |
|
|
171
|
+
| `designer` | `kimi-for-coding/k2p5` | Strong UI/UX generation capabilities |
|
|
172
|
+
|
|
173
|
+
### Provider Formats
|
|
174
|
+
|
|
175
|
+
| Provider | Format | Example |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| OpenCode Zen (free) | `opencode/<model>` | `opencode/trinity-large-preview-free` |
|
|
178
|
+
| Anthropic | `anthropic/<model>` | `anthropic/claude-opus-4-6` |
|
|
179
|
+
| Google | `google/<model>` | `google/gemini-2.5-flash` |
|
|
180
|
+
| Z.ai | `zai-coding-plan/<model>` | `zai-coding-plan/glm-5` |
|
|
181
|
+
| MiniMax | `minimax-coding-plan/<model>` | `minimax-coding-plan/MiniMax-M2.5` |
|
|
182
|
+
| Kimi | `kimi-for-coding/<model>` | `kimi-for-coding/k2p5` |
|
|
183
|
+
|
|
130
184
|
## Useful Commands
|
|
131
185
|
|
|
132
186
|
| Command | What It Does |
|
|
@@ -310,7 +364,7 @@ Per-agent overrides:
|
|
|
310
364
|
| build_check | Runs your project's native build/typecheck |
|
|
311
365
|
| quality_budget | Enforces complexity, duplication, and test ratio limits |
|
|
312
366
|
| pre_check_batch | Runs lint, secretscan, SAST, and quality budget in parallel (~15s vs ~60s sequential) |
|
|
313
|
-
| phase_complete | Enforces phase completion, verifies required agents, logs events, and resets state |
|
|
367
|
+
| phase_complete | Enforces phase completion, verifies required agents, requires a valid retrospective evidence bundle, logs events, and resets state |
|
|
314
368
|
|
|
315
369
|
|
|
316
370
|
All tools run locally. No Docker, no network calls, no external APIs.
|
|
@@ -381,6 +435,35 @@ Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.ope
|
|
|
381
435
|
|
|
382
436
|
### Automation
|
|
383
437
|
|
|
438
|
+
## Mode Detection (v6.13)
|
|
439
|
+
|
|
440
|
+
Swarm now explicitly distinguishes five architect modes:
|
|
441
|
+
|
|
442
|
+
- **`DISCOVER`** — After the explorer finishes scanning the codebase.
|
|
443
|
+
- **`PLAN`** — When the architect writes or updates the plan.
|
|
444
|
+
- **`EXECUTE`** — During task implementation (the normal pipeline).
|
|
445
|
+
- **`PHASE-WRAP`** — After all tasks in a phase are completed, before docs are updated.
|
|
446
|
+
- **`UNKNOWN`** — Fallback when the current state does not match any known mode.
|
|
447
|
+
|
|
448
|
+
Each mode determines which injection blocks are added to the LLM prompt (e.g., plan cursor is injected in `PLAN`, tool output truncation in `EXECUTE`, etc.).
|
|
449
|
+
|
|
450
|
+
Default mode: `manual`. No background automation — all actions require explicit slash commands.
|
|
451
|
+
|
|
452
|
+
Modes:
|
|
453
|
+
|
|
454
|
+
- `manual` — No background automation. All actions via slash commands (default).
|
|
455
|
+
- `hybrid` — Background automation for safe operations, manual for sensitive ones.
|
|
456
|
+
- `auto` — Full background automation.
|
|
457
|
+
|
|
458
|
+
Capability defaults:
|
|
459
|
+
|
|
460
|
+
- `plan_sync`: `true` — Background plan synchronization using `fs.watch` with debounced writes (300ms) and 2-second polling fallback
|
|
461
|
+
- `phase_preflight`: `false` — Phase preflight checks before agent execution (opt-in)
|
|
462
|
+
- `config_doctor_on_startup`: `false` — Validate configuration on startup
|
|
463
|
+
- `config_doctor_autofix`: `false` — Auto-fix for config doctor (opt-in, security-sensitive)
|
|
464
|
+
- `evidence_auto_summaries`: `true` — Automatic summaries for evidence bundles
|
|
465
|
+
- `decision_drift_detection`: `true` — Detect drift between planned and actual decisions
|
|
466
|
+
|
|
384
467
|
## Plan Cursor (v6.13)
|
|
385
468
|
|
|
386
469
|
The `plan_cursor` config compresses the plan that is injected into the LLM context.
|
|
@@ -429,37 +512,6 @@ When truncation is active, a footer is appended:
|
|
|
429
512
|
[output truncated to {maxLines} lines – use `tool_output.per_tool.<tool>` to adjust]
|
|
430
513
|
```
|
|
431
514
|
|
|
432
|
-
## Mode Detection (v6.13)
|
|
433
|
-
|
|
434
|
-
Swarm now explicitly distinguishes five architect modes:
|
|
435
|
-
|
|
436
|
-
| Mode | When Injected |
|
|
437
|
-
|------|----------------|
|
|
438
|
-
| `DISCOVER` | After the explorer finishes scanning the codebase. |
|
|
439
|
-
| `PLAN` | When the architect writes or updates the plan. |
|
|
440
|
-
| `EXECUTE` | During task implementation (the normal pipeline). |
|
|
441
|
-
| `PHASE-WRAP` | After all tasks in a phase are completed, before docs are updated. |
|
|
442
|
-
| `UNKNOWN` | Fallback when the current state does not match any known mode. |
|
|
443
|
-
|
|
444
|
-
Each mode determines which injection blocks are added to the LLM prompt (e.g., plan cursor is injected in `PLAN`, tool output truncation in `EXECUTE`, etc.).
|
|
445
|
-
|
|
446
|
-
Default mode: `manual`. No background automation — all actions require explicit slash commands.
|
|
447
|
-
|
|
448
|
-
Modes:
|
|
449
|
-
|
|
450
|
-
- `manual` — No background automation. All actions via slash commands (default).
|
|
451
|
-
- `hybrid` — Background automation for safe operations, manual for sensitive ones.
|
|
452
|
-
- `auto` — Full background automation.
|
|
453
|
-
|
|
454
|
-
Capability defaults:
|
|
455
|
-
|
|
456
|
-
- `plan_sync`: `true` — Background plan synchronization using `fs.watch` with debounced writes (300ms) and 2-second polling fallback
|
|
457
|
-
- `phase_preflight`: `false` — Phase preflight checks before agent execution (opt-in)
|
|
458
|
-
- `config_doctor_on_startup`: `false` — Validate configuration on startup
|
|
459
|
-
- `config_doctor_autofix`: `false` — Auto-fix for config doctor (opt-in, security-sensitive)
|
|
460
|
-
- `evidence_auto_summaries`: `true` — Automatic summaries for evidence bundles
|
|
461
|
-
- `decision_drift_detection`: `true` — Detect drift between planned and actual decisions
|
|
462
|
-
|
|
463
515
|
---
|
|
464
516
|
|
|
465
517
|
### Disabling Agents
|
|
@@ -671,6 +723,7 @@ Upcoming: v6.14 focuses on further context optimization and agent coordination i
|
|
|
671
723
|
- [Design Rationale](docs/design-rationale.md)
|
|
672
724
|
- [Installation Guide](docs/installation.md)
|
|
673
725
|
- [Linux + Docker Desktop Install Guide](docs/installation-linux-docker.md)
|
|
726
|
+
- [LLM Operator Installation Guide](docs/installation-llm-operator.md)
|
|
674
727
|
- [Pre-Swarm Planning Guide](docs/planning.md)
|
|
675
728
|
- [Swarm Briefing for LLMs](docs/swarm-briefing.md)
|
|
676
729
|
|
package/dist/cli/index.js
CHANGED
|
@@ -53,11 +53,14 @@ async function install() {
|
|
|
53
53
|
if (!fs.existsSync(PLUGIN_CONFIG_PATH)) {
|
|
54
54
|
const defaultConfig = {
|
|
55
55
|
agents: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
coder: { model: "opencode/minimax-m2.5-free" },
|
|
57
|
+
reviewer: { model: "opencode/big-pickle" },
|
|
58
|
+
test_engineer: { model: "opencode/gpt-5-nano" },
|
|
59
|
+
explorer: { model: "opencode/trinity-large-preview-free" },
|
|
60
|
+
sme: { model: "opencode/trinity-large-preview-free" },
|
|
61
|
+
critic: { model: "opencode/trinity-large-preview-free" },
|
|
62
|
+
docs: { model: "opencode/trinity-large-preview-free" },
|
|
63
|
+
designer: { model: "opencode/trinity-large-preview-free" }
|
|
61
64
|
},
|
|
62
65
|
max_iterations: 5
|
|
63
66
|
};
|
|
@@ -191,6 +191,30 @@ export declare const RetrospectiveEvidenceSchema: z.ZodObject<{
|
|
|
191
191
|
}>;
|
|
192
192
|
top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
193
193
|
lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
194
|
+
user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
195
|
+
directive: z.ZodString;
|
|
196
|
+
category: z.ZodEnum<{
|
|
197
|
+
tooling: "tooling";
|
|
198
|
+
code_style: "code_style";
|
|
199
|
+
architecture: "architecture";
|
|
200
|
+
process: "process";
|
|
201
|
+
other: "other";
|
|
202
|
+
}>;
|
|
203
|
+
scope: z.ZodEnum<{
|
|
204
|
+
project: "project";
|
|
205
|
+
session: "session";
|
|
206
|
+
global: "global";
|
|
207
|
+
}>;
|
|
208
|
+
}, z.core.$strip>>>;
|
|
209
|
+
approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
210
|
+
approach: z.ZodString;
|
|
211
|
+
result: z.ZodEnum<{
|
|
212
|
+
success: "success";
|
|
213
|
+
failure: "failure";
|
|
214
|
+
partial: "partial";
|
|
215
|
+
}>;
|
|
216
|
+
abandoned_reason: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strip>>>;
|
|
194
218
|
}, z.core.$strip>;
|
|
195
219
|
export type RetrospectiveEvidence = z.infer<typeof RetrospectiveEvidenceSchema>;
|
|
196
220
|
export declare const SyntaxEvidenceSchema: z.ZodObject<{
|
|
@@ -242,9 +266,9 @@ export declare const PlaceholderEvidenceSchema: z.ZodObject<{
|
|
|
242
266
|
line: z.ZodNumber;
|
|
243
267
|
kind: z.ZodEnum<{
|
|
244
268
|
string: "string";
|
|
269
|
+
other: "other";
|
|
245
270
|
comment: "comment";
|
|
246
271
|
function_body: "function_body";
|
|
247
|
-
other: "other";
|
|
248
272
|
}>;
|
|
249
273
|
excerpt: z.ZodString;
|
|
250
274
|
rule_id: z.ZodString;
|
|
@@ -535,6 +559,30 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
535
559
|
}>;
|
|
536
560
|
top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
537
561
|
lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
562
|
+
user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
563
|
+
directive: z.ZodString;
|
|
564
|
+
category: z.ZodEnum<{
|
|
565
|
+
tooling: "tooling";
|
|
566
|
+
code_style: "code_style";
|
|
567
|
+
architecture: "architecture";
|
|
568
|
+
process: "process";
|
|
569
|
+
other: "other";
|
|
570
|
+
}>;
|
|
571
|
+
scope: z.ZodEnum<{
|
|
572
|
+
project: "project";
|
|
573
|
+
session: "session";
|
|
574
|
+
global: "global";
|
|
575
|
+
}>;
|
|
576
|
+
}, z.core.$strip>>>;
|
|
577
|
+
approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
578
|
+
approach: z.ZodString;
|
|
579
|
+
result: z.ZodEnum<{
|
|
580
|
+
success: "success";
|
|
581
|
+
failure: "failure";
|
|
582
|
+
partial: "partial";
|
|
583
|
+
}>;
|
|
584
|
+
abandoned_reason: z.ZodOptional<z.ZodString>;
|
|
585
|
+
}, z.core.$strip>>>;
|
|
538
586
|
}, z.core.$strip>, z.ZodObject<{
|
|
539
587
|
task_id: z.ZodString;
|
|
540
588
|
timestamp: z.ZodString;
|
|
@@ -582,9 +630,9 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
582
630
|
line: z.ZodNumber;
|
|
583
631
|
kind: z.ZodEnum<{
|
|
584
632
|
string: "string";
|
|
633
|
+
other: "other";
|
|
585
634
|
comment: "comment";
|
|
586
635
|
function_body: "function_body";
|
|
587
|
-
other: "other";
|
|
588
636
|
}>;
|
|
589
637
|
excerpt: z.ZodString;
|
|
590
638
|
rule_id: z.ZodString;
|
|
@@ -870,6 +918,30 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
|
|
|
870
918
|
}>;
|
|
871
919
|
top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
872
920
|
lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
921
|
+
user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
922
|
+
directive: z.ZodString;
|
|
923
|
+
category: z.ZodEnum<{
|
|
924
|
+
tooling: "tooling";
|
|
925
|
+
code_style: "code_style";
|
|
926
|
+
architecture: "architecture";
|
|
927
|
+
process: "process";
|
|
928
|
+
other: "other";
|
|
929
|
+
}>;
|
|
930
|
+
scope: z.ZodEnum<{
|
|
931
|
+
project: "project";
|
|
932
|
+
session: "session";
|
|
933
|
+
global: "global";
|
|
934
|
+
}>;
|
|
935
|
+
}, z.core.$strip>>>;
|
|
936
|
+
approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
937
|
+
approach: z.ZodString;
|
|
938
|
+
result: z.ZodEnum<{
|
|
939
|
+
success: "success";
|
|
940
|
+
failure: "failure";
|
|
941
|
+
partial: "partial";
|
|
942
|
+
}>;
|
|
943
|
+
abandoned_reason: z.ZodOptional<z.ZodString>;
|
|
944
|
+
}, z.core.$strip>>>;
|
|
873
945
|
}, z.core.$strip>, z.ZodObject<{
|
|
874
946
|
task_id: z.ZodString;
|
|
875
947
|
timestamp: z.ZodString;
|
|
@@ -917,9 +989,9 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
|
|
|
917
989
|
line: z.ZodNumber;
|
|
918
990
|
kind: z.ZodEnum<{
|
|
919
991
|
string: "string";
|
|
992
|
+
other: "other";
|
|
920
993
|
comment: "comment";
|
|
921
994
|
function_body: "function_body";
|
|
922
|
-
other: "other";
|
|
923
995
|
}>;
|
|
924
996
|
excerpt: z.ZodString;
|
|
925
997
|
rule_id: z.ZodString;
|
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
* Reads plan.md and injects phase context into the system prompt.
|
|
7
7
|
*/
|
|
8
8
|
import type { PluginConfig } from '../config';
|
|
9
|
+
/**
|
|
10
|
+
* Build a retrospective injection string for the architect system message.
|
|
11
|
+
* Tier 1: direct phase-scoped lookup for same-plan previous phase.
|
|
12
|
+
* Tier 2: cross-project historical lessons (Phase 1 only).
|
|
13
|
+
* Returns null if no valid retrospective found.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildRetroInjection(directory: string, currentPhaseNumber: number, currentPlanTitle?: string): Promise<string | null>;
|
|
9
16
|
/**
|
|
10
17
|
* Creates the experimental.chat.system.transform hook for system enhancement.
|
|
11
18
|
*/
|