opencode-swarm 6.31.3 → 6.31.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +96 -110
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,24 +1,42 @@
1
1
  # OpenCode Swarm
2
2
 
3
- **Your AI writes the code. Swarm makes sure it actually works.**
3
+ <div align="center">
4
4
 
5
- https://swarmai.site/
5
+ **Your AI writes the code. Swarm makes sure it actually works.**
6
6
 
7
- OpenCode Swarm is a plugin for [OpenCode](https://opencode.ai) that turns a single AI coding session into an architect-led team of specialized agents. One agent writes the code. A different agent reviews it. Another writes and runs tests. Another checks security. Nothing ships until every required gate passes.
7
+ [![npm version](https://img.shields.io/npm/v/opencode-swarm?color=brightgreen&label=npm)](https://www.npmjs.com/package/opencode-swarm)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Tests](https://img.shields.io/badge/tests-6000%2B-success)](https://github.com/zaxbysauce/opencode-swarm)
8
10
 
9
- You do **not** manually switch between Swarm's internal agents during normal use.
11
+ [Website](https://swarmai.site/) · [Getting Started](docs/getting-started.md) · [Configuration](docs/configuration.md) · [Architecture](docs/architecture.md)
10
12
 
11
- You must **explicitly choose a Swarm architect** in the OpenCode GUI before starting. The architect name shown in OpenCode is config-driven — you can define multiple architects with different model assignments in your configuration, and those custom names will appear in the GUI dropdown.
13
+ </div>
12
14
 
13
- If you use OpenCode's default `Build` / `Plan` options instead of selecting a Swarm architect, the plugin is bypassed entirely.
15
+ ---
14
16
 
15
- Once you select a Swarm architect, that architect coordinates the internal pipeline behind the scenes, and all project state is persisted to `.swarm/` so work can resume later.
17
+ OpenCode Swarm is a plugin for [OpenCode](https://opencode.ai) that turns a single AI coding session into an **architect-led team of 9 specialized agents**. One agent writes the code. A different agent reviews it. Another writes and runs tests. Another checks security. **Nothing ships until every required gate passes.**
16
18
 
17
19
  ```bash
18
20
  npm install -g opencode-swarm
19
21
  ```
20
22
 
21
- * * *
23
+ ### Why Swarm?
24
+
25
+ Most AI coding tools let one model write code and ask that same model whether the code is good. That misses too much. Swarm separates planning, implementation, review, testing, and documentation into specialized internal roles — and enforces gated execution so agents never mutate the codebase in parallel.
26
+
27
+ ### Key Features
28
+
29
+ - 🏗️ **9 specialized agents** — architect, coder, reviewer, test engineer, critic, explorer, SME, docs, designer
30
+ - 🔒 **Gated pipeline** — code never ships without reviewer + test engineer approval
31
+ - 🔁 **Resumable sessions** — all state saved to `.swarm/`; pick up any project any day
32
+ - 🌐 **11 languages** — TypeScript, Python, Go, Rust, Java, Kotlin, C#, C/C++, Swift, Dart, Ruby
33
+ - 🛡️ **Built-in security** — SAST, secrets scanning, dependency audit per task
34
+ - 🆓 **Free tier** — works with OpenCode Zen's free model roster
35
+ - ⚙️ **Fully configurable** — override any agent's model, disable agents, tune guardrails
36
+
37
+ > **You select a Swarm architect once in the OpenCode GUI.** The architect coordinates all other agents automatically — you never manually switch between internal roles. If you use the default OpenCode `Build` / `Plan` modes, the plugin is bypassed entirely.
38
+
39
+ ---
22
40
 
23
41
  ## What Actually Happens
24
42
 
@@ -59,92 +77,57 @@ All project state lives in `.swarm/`:
59
77
  └── drift-report-phase-N.json # Plan-vs-reality drift reports
60
78
  ```
61
79
 
62
- That means Swarm is resumable by design. If you come back later and `.swarm/` already exists, the architect may go straight into **RESUME** or **EXECUTE** instead of replaying the full first-run discovery flow.
63
-
64
- ---
65
-
66
- ## Why This Exists
67
-
68
- Most AI coding tools let one model write code and then ask that same model whether the code is good. That misses too much.
69
-
70
- Swarm separates planning, implementation, review, testing, and documentation into specialized internal roles, and it enforces gated execution instead of letting multiple agents mutate the codebase in parallel.
80
+ Swarm is resumable by design. If `.swarm/` already exists, the architect goes straight into **RESUME** **EXECUTE** instead of repeating discovery.
71
81
 
72
82
  ---
73
83
 
74
84
  ## Quick Start
75
85
 
76
- ### 1. Install
86
+ > **Prerequisites:** [OpenCode](https://opencode.ai) installed and working. An API key for at least one LLM provider (or use the free OpenCode Zen tier — no key required).
87
+
88
+ ### Step 1 — Install
77
89
 
78
90
  ```bash
79
91
  npm install -g opencode-swarm
80
92
  ```
81
93
 
82
- ### 2. Open your project in OpenCode
94
+ ### Step 2 Open your project in OpenCode
83
95
 
84
96
  ```bash
97
+ cd /your/project
85
98
  opencode
86
99
  ```
87
100
 
88
- ### 3. Verify Swarm is loaded
101
+ ### Step 3 Select a Swarm architect and describe your goal
89
102
 
90
- Run these once in a project:
91
-
92
- ```text
93
- /swarm diagnose
94
- /swarm agents
95
- /swarm config
96
- ```
97
-
98
- What they tell you:
99
-
100
- * `/swarm diagnose` verifies Swarm health and setup
101
- * `/swarm agents` shows the registered internal agents and model assignments
102
- * `/swarm config` shows the resolved configuration currently in effect
103
-
104
- ### 4. Select a Swarm architect and start
105
-
106
- 1. **Choose a Swarm architect** in the OpenCode GUI (the exact name depends on your configuration — you can define multiple architects with different model assignments)
107
- 2. Then describe what you want to build.
103
+ 1. In the OpenCode GUI, open the **agent/mode dropdown** and select a **Swarm architect** (e.g., `architect`).
104
+ 2. Type what you want to build:
108
105
 
109
106
  ```text
110
107
  Build a REST API with user registration, login, and JWT auth.
111
108
  ```
112
109
 
113
- You do **not** manually choose `coder`, `reviewer`, `critic`, or other internal agents. The **architect** coordinates them automatically after you select it.
114
-
115
- ### 5. Understand first run vs later runs
110
+ That's it. The architect coordinates all other agents automatically.
116
111
 
117
- On a brand-new project with no `.swarm/` state, Swarm usually starts by clarifying, discovering, consulting, and planning.
112
+ > **First time?** Run `/swarm diagnose` to verify Swarm is healthy, `/swarm agents` to see registered agents, and `/swarm config` to see the resolved configuration.
118
113
 
119
- On a project that already has `.swarm/plan.md`, Swarm may resume immediately. That is expected.
120
-
121
- Use these commands any time:
114
+ ### Step 4 Monitor progress
122
115
 
123
116
  ```text
124
- /swarm status
125
- /swarm plan
126
- /swarm history
117
+ /swarm status # Current phase and task
118
+ /swarm plan # Full project plan
119
+ /swarm evidence # Review and test results per task
127
120
  ```
128
121
 
129
- ### 6. Start over when needed
130
-
131
- If you want a completely fresh Swarm run for the current project:
122
+ ### Step 5 — Start over if needed
132
123
 
133
124
  ```text
134
125
  /swarm reset --confirm
135
126
  ```
136
127
 
137
- Use this only when you intentionally want to discard current Swarm state.
128
+ ### Step 6 Configure models (optional)
138
129
 
139
- ### 7. Configure models (optional)
140
-
141
- By default, Swarm works with its default model setup. If you want to override agent models, create:
142
-
143
- ```text
144
- .opencode/opencode-swarm.json
145
- ```
146
-
147
- Example:
130
+ Swarm works with its defaults out of the box. To override models, create `.opencode/opencode-swarm.json`:
148
131
 
149
132
  ```json
150
133
  {
@@ -155,17 +138,17 @@ Example:
155
138
  }
156
139
  ```
157
140
 
158
- You only need to specify the agents you want to override.
141
+ You only need to specify the agents you want to override. The `architect` inherits the model currently selected in the OpenCode UI unless you set it explicitly.
142
+
143
+ See the [full configuration reference](#configuration-reference) and the [free-tier model setup](#free-tier-opencode-zen-models) for more options.
159
144
 
160
- > Note: if `architect` is not set explicitly, it inherits the current model selected in the OpenCode UI.
145
+ ---
161
146
 
162
147
  ## Common First-Run Questions
163
148
 
164
149
  ### "Do I need to select a Swarm architect?"
165
150
 
166
- **Yes.** You must explicitly choose a Swarm architect agent in the OpenCode GUI before starting your session. The architect name shown in OpenCode is config-driven you can define multiple architects with different model assignments in your configuration.
167
-
168
- If you use the default OpenCode `Build` / `Plan` options without selecting a Swarm architect, the plugin is bypassed entirely.
151
+ **Yes.** You must explicitly choose a Swarm architect agent in the OpenCode GUI before starting your session. If you use the default OpenCode `Build` / `Plan` options, the plugin is bypassed entirely.
169
152
 
170
153
  ### "Why did the second run start coding immediately?"
171
154
 
@@ -195,7 +178,7 @@ Run:
195
178
 
196
179
  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).
197
180
 
198
- ### Free Tier (OpenCode Zen Models)
181
+ ### Free Tier OpenCode Zen Models {#free-tier-opencode-zen-models}
199
182
 
200
183
  OpenCode Zen provides free models via the `opencode/` provider prefix. These are excellent starting points and require no API key:
201
184
 
@@ -644,7 +627,7 @@ Optional enhancement: Semgrep (if on PATH).
644
627
  </details>
645
628
 
646
629
  <details>
647
- <summary><strong>Full Configuration Reference</strong></summary>
630
+ <summary id="configuration-reference"><strong>Full Configuration Reference</strong></summary>
648
631
 
649
632
  Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.opencode/opencode-swarm.json` (project). Project config merges over global.
650
633
 
@@ -939,34 +922,54 @@ The following tools can be assigned to agents via overrides:
939
922
 
940
923
  ---
941
924
 
942
- ## Recent Changes
925
+ <details>
926
+ <summary><strong>Recent Changes (v6.12 – v6.31)</strong></summary>
943
927
 
944
- ### v6.29.3 Curator Visibility + Documentation Refresh
928
+ > For the complete version history, see [CHANGELOG.md](CHANGELOG.md) or [docs/releases/](docs/releases/).
945
929
 
946
- This release adds Curator status reporting to `/swarm diagnose` and refreshes documentation to reflect current behavior.
930
+ ### v6.31.0 process.cwd() Cleanup + Watchdog + Knowledge Tools
947
931
 
948
- - **Curator status in diagnose**: `/swarm diagnose` now reports whether Curator is enabled/disabled and validates the `curator-summary.json` artifact if present.
949
- - **README and config docs refreshed**: Updated `.swarm/` directory tree, Curator configuration options, and drift report artifacts to match current implementation.
932
+ - **process.cwd() cleanup**: All 14 source files now use plugin-injected `directory` parameter. Five tools migrated to `createSwarmTool` wrapper.
933
+ - **`curator_analyze` tool**: Architect can now explicitly trigger phase analysis and apply curator recommendations.
934
+ - **Watchdog system**: `scope_guard` (blocks out-of-scope writes), `delegation_ledger` (tracks per-session tool calls), and loop-detector escalation.
935
+ - **Self-correcting workflow**: `self_review` advisory hook after task transitions; `checkStaleImports` heuristic for unused import detection.
936
+ - **Knowledge memory tools**: `knowledge_recall`, `knowledge_add`, `knowledge_remove` — any agent can now directly access the persistent knowledge base.
950
937
 
951
- ### v6.29.2Multi-Language Incremental Verify + Slop-Detector Hardening
938
+ ### v6.30.1Bug Fixes
952
939
 
953
- This release adds multi-language typecheck support and hardens detection of low-quality AI-generated code.
940
+ - **Package manager detection**: `incremental_verify` now detects bun/npm/pnpm/yarn from lockfiles instead of always using `bun`.
941
+ - **spawnAsync OOM fix**: 512KB output cap prevents infinite-output commands from OOM-crashing.
942
+ - **Windows spawn fix**: `npx.cmd`, `npm.cmd`, `pnpm.cmd`, `yarn.cmd` resolved correctly on Windows.
943
+ - **Curator config fix**: `applyCuratorKnowledgeUpdates` now receives fully-populated `KnowledgeConfig`.
944
+ - **Rehydration race guard**: Concurrent `loadSnapshot` calls no longer silently drop workflow state.
954
945
 
955
- - **Multi-language incremental_verify**: Post-coder typecheck now supports TypeScript/JavaScript, Go, Rust, and C#. Runs language-appropriate build/typecheck commands per task for faster feedback.
956
- - **Slop-detector hardening**: Enhanced detection of AI-generated placeholder code with multi-language heuristics (comments like `// TODO`, `// FIXME`, `// HACK`, language-specific patterns for Go/Rust/C#/Python). Advisory warnings injected into coder context when slop patterns detected.
957
- - **CODEBASE REALITY CHECK**: Architect dispatches Explorer before planning to verify current state of referenced items. Produces a CODEBASE REALITY REPORT with statuses: NOT STARTED, PARTIALLY DONE, ALREADY COMPLETE, or ASSUMPTION INCORRECT. Skipped for greenfield projects.
958
- - **Evidence schema fix**: Evidence bundles now correctly validate against schema; invalid entries are filtered.
959
- - **Curator/docs alignment**: Curator health check in `/swarm diagnose` reports curator.enabled status and validates curator-summary.json.
946
+ ### v6.29.4 Cross-Task Regression Sweep
960
947
 
961
- ### v6.29.1 Advisory Hook Message Injection
948
+ - **Regression sweep**: Architect dispatches `scope:"graph"` test runs after each task to catch cross-task regressions (found 15 in RAGAPPv2 retrospective).
949
+ - **Curator data pipeline**: Curator outputs now visible to the architect via advisory injection.
950
+ - **Full-suite opt-in**: Explicit flag unlocks full `bun test` execution when needed.
962
951
 
963
- This release improves how advisory warnings are injected into agent context.
952
+ ### v6.29.3 Curator Visibility + Documentation Refresh
953
+
954
+ - **Curator status in diagnose**: `/swarm diagnose` now reports whether Curator is enabled/disabled and validates `curator-summary.json`.
955
+ - **README and config docs refreshed**: Updated `.swarm/` directory tree, Curator configuration options, and drift report artifacts.
956
+
957
+ ### v6.29.2 — Multi-Language Incremental Verify + Slop-Detector Hardening
958
+
959
+ - **Multi-language incremental_verify**: Post-coder typecheck supports TypeScript/JavaScript, Go, Rust, and C#.
960
+ - **Slop-detector hardening**: Multi-language heuristics for placeholder code detection across Go/Rust/C#/Python.
961
+ - **CODEBASE REALITY CHECK**: Explorer verifies referenced items before planning (NOT STARTED / PARTIALLY DONE / ALREADY COMPLETE / ASSUMPTION INCORRECT).
962
+ - **Evidence schema fix**: Evidence bundles now correctly validate against schema.
963
+
964
+ ### v6.29.1 — Advisory Hook Message Injection
964
965
 
965
- - **Advisory hook message injection**: Enhanced message formatting for self-coding detection, partial gate tracking, batch detection, and scope violation warnings. Messages now include structured context for faster resolution.
966
+ - **Advisory hook message injection**: Enhanced message formatting for self-coding detection, partial gate tracking, batch detection, and scope violation warnings.
966
967
 
967
- ### v6.23 through v6.28 — Stability and Incremental Improvements
968
+ ### v6.26 through v6.28 — Session Durability + Turbo Mode
968
969
 
969
- Subsequent releases focused on stability hardening, incremental_verify scaffolding, and tooling improvements across the pipeline. Key areas: pre_check_batch parallelization, evidence bundle validation, and diagnostics tooling.
970
+ - **Turbo Mode**: Accelerated task delegation for faster pipeline execution.
971
+ - **Session durability**: Directory-based evidence writes, task ID recovery from `plan.json` for cold/resumed sessions.
972
+ - **Gate recovery fix** (v6.26.1): `update_task_status(completed)` no longer blocks pure-verification tasks without a prior coder delegation.
970
973
 
971
974
  ### v6.22 — Curator Background Analysis + Session State Persistence
972
975
 
@@ -1068,33 +1071,16 @@ This release adds runtime detection hooks to catch and warn about architect work
1068
1071
 
1069
1072
  These hooks are advisory (warnings only) and help maintain workflow discipline during long sessions.
1070
1073
 
1071
- ---
1072
-
1073
- ## v6.19 Features
1074
-
1075
- ### Critic Sounding Board
1076
- Before escalating to the user, the Architect consults the critic in SOUNDING_BOARD mode. The critic returns one of four verdicts: UNNECESSARY, REPHRASE, APPROVED, or RESOLVE.
1077
-
1078
- ### Escalation Discipline
1079
- Three-tier escalation hierarchy ensures systematic problem resolution:
1080
- 1. **Tier 1**: Self-resolve using existing context
1081
- 2. **Tier 2**: Critic consultation via sounding board
1082
- 3. **Tier 3**: User escalation (requires critic APPROVED)
1074
+ ### v6.19 — Critic Sounding Board + Complexity-Scaled Review
1083
1075
 
1084
- ### Retry Circuit Breaker
1085
- After 3 coder rejections, the Architect intervenes to simplify the approach rather than adding more logic.
1076
+ - **Critic sounding board**: Before escalating to the user, the Architect consults the critic in SOUNDING_BOARD mode. Returns: UNNECESSARY, REPHRASE, APPROVED, or RESOLVE.
1077
+ - **Escalation discipline**: Three-tier hierarchy self-resolve critic consult user escalation (requires critic APPROVED).
1078
+ - **Retry circuit breaker**: After 3 coder rejections, the Architect simplifies the approach instead of adding more logic.
1079
+ - **Intent reconstruction**: Reviewer reconstructs developer intent from task specs and diffs before evaluating changes.
1080
+ - **Complexity-scaled review**: TRIVIAL → Tier 1 only; MODERATE → Tiers 1–2; COMPLEX → all three tiers.
1081
+ - **`meta.summary` convention**: Agents include one-line summaries in state events for downstream agent consumption.
1086
1082
 
1087
- ### Intent Reconstruction
1088
- The mega-reviewer reconstructs developer intent from task specs and diffs before evaluating changes.
1089
-
1090
- ### Complexity-Scaled Review
1091
- Changes classified as TRIVIAL, MODERATE, or COMPLEX receive appropriate review depth:
1092
- - TRIVIAL → Tier 1 only
1093
- - MODERATE → Tiers 1-2
1094
- - COMPLEX → All three tiers
1095
-
1096
- ### meta.summary Convention
1097
- Agents include one-line summaries in state events for downstream consumption by other agents.
1083
+ </details>
1098
1084
 
1099
1085
  ---
1100
1086
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.31.3",
3
+ "version": "6.31.4",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",