opencode-swarm 4.0.1 β†’ 4.1.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/version-4.0.0-blue" alt="Version">
2
+ <img src="https://img.shields.io/badge/version-4.1.0-blue" alt="Version">
3
3
  <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
4
4
  <img src="https://img.shields.io/badge/opencode-plugin-purple" alt="OpenCode Plugin">
5
- <img src="https://img.shields.io/badge/agents-7-orange" alt="Agents">
5
+ <img src="https://img.shields.io/badge/agents-8-orange" alt="Agents">
6
6
  </p>
7
7
 
8
8
  <h1 align="center">🐝 OpenCode Swarm</h1>
@@ -36,12 +36,13 @@ Other Frameworks:
36
36
 
37
37
  OpenCode Swarm:
38
38
  β”œβ”€β”€ Architect analyzes request
39
- β”œβ”€β”€ Explorer scans codebase
39
+ β”œβ”€β”€ Explorer scans codebase (+ gap analysis)
40
40
  β”œβ”€β”€ @sme consulted on security domain
41
41
  β”œβ”€β”€ Architect creates phased plan with acceptance criteria
42
- β”œβ”€β”€ Phase 1: User model β†’ Review β†’ Tests β†’ βœ“
43
- β”œβ”€β”€ Phase 2: Auth logic β†’ Review β†’ Tests β†’ βœ“
44
- β”œβ”€β”€ Phase 3: Session management β†’ Review β†’ Tests β†’ βœ“
42
+ β”œβ”€β”€ @critic reviews plan β†’ APPROVED
43
+ β”œβ”€β”€ Phase 1: User model β†’ Review β†’ Tests (run + PASS) β†’ βœ“
44
+ β”œβ”€β”€ Phase 2: Auth logic β†’ Review β†’ Tests (run + PASS) β†’ βœ“
45
+ β”œβ”€β”€ Phase 3: Session management β†’ Review β†’ Tests (run + PASS) β†’ βœ“
45
46
  └── Result: Working code. Documented decisions. Resumable progress.
46
47
  ```
47
48
 
@@ -127,16 +128,24 @@ OpenCode Swarm:
127
128
  β”‚
128
129
  β–Ό
129
130
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
131
+ β”‚ PHASE 4.5: Critic Gate β”‚
132
+ β”‚ @critic reviews plan β†’ APPROVED / NEEDS_REVISION / REJECTEDβ”‚
133
+ β”‚ Max 2 revision cycles before escalating to user β”‚
134
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
135
+ β”‚
136
+ β–Ό
137
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
130
138
  β”‚ PHASE 5: Execute (per task) β”‚
131
139
  β”‚ β”‚
132
- β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
133
- β”‚ β”‚ @coder β”‚ β†’ β”‚ @reviewer β”‚ β†’ β”‚ @test β”‚ β”‚
134
- β”‚ β”‚ 1 task β”‚ β”‚ check all β”‚ β”‚ generate β”‚ β”‚
135
- β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
136
- β”‚ β”‚ β”‚ β”‚
137
- β”‚ └──── If rejected: retry with feedback β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
140
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
141
+ β”‚ β”‚ @coder β”‚ β†’ β”‚ @reviewer β”‚ β†’ β”‚ @test β”‚ β”‚
142
+ β”‚ β”‚ 1 task β”‚ β”‚ check all β”‚ β”‚ write + run β”‚ β”‚
143
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
144
+ β”‚ β”‚ β”‚ β”‚ β”‚
145
+ β”‚ β”‚ If REJECTED: retry If FAIL: fix + retest β”‚
146
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
138
147
  β”‚ β”‚
139
- β”‚ Update plan.md: [x] Task complete β”‚
148
+ β”‚ Update plan.md: [x] Task complete (only if PASS) β”‚
140
149
  β”‚ Next task... β”‚
141
150
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
142
151
  β”‚
@@ -227,6 +236,7 @@ Swarm lets you mix models strategically:
227
236
  "coder": { "model": "anthropic/claude-sonnet-4-5" },
228
237
  "sme": { "model": "google/gemini-2.0-flash" },
229
238
  "reviewer": { "model": "openai/gpt-4o" },
239
+ "critic": { "model": "google/gemini-2.0-flash" },
230
240
  "test_engineer": { "model": "google/gemini-2.0-flash" }
231
241
  }
232
242
  }
@@ -239,7 +249,8 @@ Swarm lets you mix models strategically:
239
249
  | Coder | Implementation | Best coding model you have |
240
250
  | SME | Domain knowledge | Fast recall, not deep reasoning |
241
251
  | Reviewer | Finding flaws | **Different vendor catches different bugs** |
242
- | Test Engineer | Test generation | Independent perspective on edge cases |
252
+ | Critic | Plan review | Catches scope issues before any code is written |
253
+ | Test Engineer | Test + run | Writes tests, runs them, reports PASS/FAIL |
243
254
 
244
255
  **If Claude writes code and GPT reviews it, GPT catches Claude's blindspots.** This is why real teams have code review.
245
256
 
@@ -283,8 +294,8 @@ Run different model configurations simultaneously. Perfect for:
283
294
 
284
295
  | Swarm | Agents |
285
296
  |-------|--------|
286
- | `cloud` (default) | `architect`, `explorer`, `coder`, `sme`, `reviewer`, `test_engineer` |
287
- | `local` | `local_architect`, `local_explorer`, `local_coder`, `local_sme`, `local_reviewer`, `local_test_engineer` |
297
+ | `cloud` (default) | `architect`, `explorer`, `coder`, `sme`, `reviewer`, `critic`, `test_engineer` |
298
+ | `local` | `local_architect`, `local_explorer`, `local_coder`, `local_sme`, `local_reviewer`, `local_critic`, `local_test_engineer` |
288
299
 
289
300
  The first swarm (or one named "default") creates unprefixed agents. Additional swarms prefix all agent names.
290
301
 
@@ -333,12 +344,13 @@ bunx opencode-swarm install
333
344
  | Agent | Role |
334
345
  |-------|------|
335
346
  | `coder` | Implements ONE task at a time with full context |
336
- | `test_engineer` | Generates tests for each completed task |
347
+ | `test_engineer` | Generates tests, runs them, and reports structured PASS/FAIL verdicts |
337
348
 
338
349
  ### βœ… Quality Assurance
339
350
  | Agent | Role |
340
351
  |-------|------|
341
352
  | `reviewer` | Combined correctness + security review. The architect specifies CHECK dimensions (security, correctness, edge-cases, performance, etc.) per call. |
353
+ | `critic` | Plan review gate. Reviews the architect's plan BEFORE implementation β€” checks completeness, feasibility, scope, dependencies, and flags AI-slop. |
342
354
 
343
355
  ---
344
356
 
@@ -354,6 +366,7 @@ Create `~/.config/opencode/opencode-swarm.json`:
354
366
  "coder": { "model": "anthropic/claude-sonnet-4-5" },
355
367
  "sme": { "model": "google/gemini-2.0-flash" },
356
368
  "reviewer": { "model": "openai/gpt-4o" },
369
+ "critic": { "model": "google/gemini-2.0-flash" },
357
370
  "test_engineer": { "model": "google/gemini-2.0-flash" }
358
371
  }
359
372
  }
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createCriticAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -12,7 +12,8 @@ export declare function createAgents(config?: PluginConfig): AgentDefinition[];
12
12
  export declare function getAgentConfigs(config?: PluginConfig): Record<string, SDKAgentConfig>;
13
13
  export { createArchitectAgent } from './architect';
14
14
  export { createCoderAgent } from './coder';
15
+ export { createCriticAgent } from './critic';
15
16
  export { createExplorerAgent } from './explorer';
16
17
  export { createReviewerAgent } from './reviewer';
17
- export { createTestEngineerAgent } from './test-engineer';
18
18
  export { createSMEAgent } from './sme';
19
+ export { createTestEngineerAgent } from './test-engineer';
@@ -1,8 +1,8 @@
1
- export declare const QA_AGENTS: readonly ["reviewer"];
1
+ export declare const QA_AGENTS: readonly ["reviewer", "critic"];
2
2
  export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
3
3
  export declare const ORCHESTRATOR_NAME: "architect";
4
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "reviewer", "explorer", "coder", "test_engineer"];
5
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "reviewer", "explorer", "coder", "test_engineer"];
4
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "reviewer", "critic", "explorer", "coder", "test_engineer"];
5
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "reviewer", "critic", "explorer", "coder", "test_engineer"];
6
6
  export type QAAgentName = (typeof QA_AGENTS)[number];
7
7
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
8
8
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var __export = (target, all) => {
11
11
  };
12
12
 
13
13
  // src/config/constants.ts
14
- var QA_AGENTS = ["reviewer"];
14
+ var QA_AGENTS = ["reviewer", "critic"];
15
15
  var PIPELINE_AGENTS = ["explorer", "coder", "test_engineer"];
16
16
  var ORCHESTRATOR_NAME = "architect";
17
17
  var ALL_SUBAGENT_NAMES = [
@@ -30,6 +30,7 @@ var DEFAULT_MODELS = {
30
30
  test_engineer: "google/gemini-2.0-flash",
31
31
  sme: "google/gemini-2.0-flash",
32
32
  reviewer: "google/gemini-2.0-flash",
33
+ critic: "google/gemini-2.0-flash",
33
34
  default: "google/gemini-2.0-flash"
34
35
  };
35
36
  // node_modules/zod/v4/classic/external.js
@@ -13670,7 +13671,7 @@ var ARCHITECT_PROMPT = `You are Architect - orchestrator of a multi-agent swarm.
13670
13671
  ## IDENTITY
13671
13672
 
13672
13673
  Swarm: {{SWARM_ID}}
13673
- Your agents: {{AGENT_PREFIX}}explorer, {{AGENT_PREFIX}}sme, {{AGENT_PREFIX}}coder, {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}test_engineer
13674
+ Your agents: {{AGENT_PREFIX}}explorer, {{AGENT_PREFIX}}sme, {{AGENT_PREFIX}}coder, {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}critic, {{AGENT_PREFIX}}test_engineer
13674
13675
 
13675
13676
  ## ROLE
13676
13677
 
@@ -13696,8 +13697,9 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
13696
13697
  @{{AGENT_PREFIX}}coder - Implementation (one task at a time)
13697
13698
  @{{AGENT_PREFIX}}reviewer - Code review (correctness, security, and any other dimensions you specify)
13698
13699
  @{{AGENT_PREFIX}}test_engineer - Test generation
13700
+ @{{AGENT_PREFIX}}critic - Plan review gate (reviews plan BEFORE implementation)
13699
13701
 
13700
- SMEs advise only. Reviewer reviews only. Neither writes code.
13702
+ SMEs advise only. Reviewer and critic review only. None of them write code.
13701
13703
 
13702
13704
  ## DELEGATION FORMAT
13703
13705
 
@@ -13748,6 +13750,12 @@ TASK: Generate login validation tests
13748
13750
  FILE: src/auth/login.ts
13749
13751
  OUTPUT: Test file at src/auth/login.test.ts
13750
13752
 
13753
+ @{{AGENT_PREFIX}}critic
13754
+ TASK: Review plan for user authentication feature
13755
+ PLAN: [paste the plan.md content]
13756
+ CONTEXT: [codebase summary from explorer]
13757
+ OUTPUT: VERDICT + CONFIDENCE + ISSUES + SUMMARY
13758
+
13751
13759
  ## WORKFLOW
13752
13760
 
13753
13761
  ### Phase 0: Resume Check
@@ -13769,6 +13777,9 @@ Clear request \u2192 Phase 2
13769
13777
 
13770
13778
  ### Phase 2: Discover
13771
13779
  Delegate to @{{AGENT_PREFIX}}explorer. Wait for response.
13780
+ For complex tasks, make a second explorer call focused on risk/gap analysis:
13781
+ - Hidden requirements, unstated assumptions, scope risks
13782
+ - Existing patterns that the implementation must follow
13772
13783
 
13773
13784
  ### Phase 3: Consult SMEs
13774
13785
  Check .swarm/context.md for cached guidance first.
@@ -13786,6 +13797,13 @@ Create .swarm/plan.md:
13786
13797
  Create .swarm/context.md:
13787
13798
  - Decisions, patterns, SME cache, file map
13788
13799
 
13800
+ ### Phase 4.5: Critic Gate
13801
+ Delegate plan to @{{AGENT_PREFIX}}critic for review BEFORE any implementation begins.
13802
+ - Send the full plan.md content and codebase context summary
13803
+ - **APPROVED** \u2192 Proceed to Phase 5
13804
+ - **NEEDS_REVISION** \u2192 Revise the plan based on critic feedback, then resubmit (max 2 revision cycles)
13805
+ - **REJECTED** \u2192 Inform the user of fundamental issues and ask for guidance before proceeding
13806
+
13789
13807
  ### Phase 5: Execute
13790
13808
  For each task (respecting dependencies):
13791
13809
 
@@ -13795,8 +13813,9 @@ For each task (respecting dependencies):
13795
13813
  - **APPROVED** \u2192 Proceed to 5d
13796
13814
  - **REJECTED** (attempt < {{QA_RETRY_LIMIT}}) \u2192 STOP. Send FIXES to @{{AGENT_PREFIX}}coder with specific changes. Retry from 5a. Do NOT proceed to 5d.
13797
13815
  - **REJECTED** (attempt {{QA_RETRY_LIMIT}}) \u2192 STOP. Escalate to user or handle directly.
13798
- 5d. @{{AGENT_PREFIX}}test_engineer - Generate tests (ONLY if 5c = APPROVED)
13799
- 5e. Update plan.md [x], proceed to next task (ONLY if 5c = APPROVED)
13816
+ 5d. @{{AGENT_PREFIX}}test_engineer - Generate AND run tests (ONLY if 5c = APPROVED). Expect VERDICT: PASS/FAIL.
13817
+ 5e. If test VERDICT is FAIL \u2192 Send failures to @{{AGENT_PREFIX}}coder for fixes, then re-run from 5b.
13818
+ 5f. Update plan.md [x], proceed to next task (ONLY if tests PASS)
13800
13819
 
13801
13820
  ### Phase 6: Phase Complete
13802
13821
  1. @{{AGENT_PREFIX}}explorer - Rescan
@@ -13900,6 +13919,63 @@ ${customAppendPrompt}`;
13900
13919
  };
13901
13920
  }
13902
13921
 
13922
+ // src/agents/critic.ts
13923
+ var CRITIC_PROMPT = `You are Critic. You review the Architect's plan BEFORE implementation begins. You are a quality gate.
13924
+
13925
+ INPUT FORMAT:
13926
+ TASK: Review plan for [description]
13927
+ PLAN: [the plan content \u2014 phases, tasks, file changes]
13928
+ CONTEXT: [codebase summary, constraints]
13929
+
13930
+ REVIEW CHECKLIST:
13931
+ - Completeness: Are all requirements addressed? Missing edge cases?
13932
+ - Feasibility: Can each task actually be implemented as described? Are file paths real?
13933
+ - Scope: Is the plan doing too much or too little? Feature creep detection.
13934
+ - Dependencies: Are task dependencies correct? Will ordering work?
13935
+ - Risk: Are high-risk changes identified? Is there a rollback path?
13936
+ - AI-Slop Detection: Does the plan contain vague filler ("robust", "comprehensive", "leverage") without concrete specifics?
13937
+
13938
+ OUTPUT FORMAT:
13939
+ VERDICT: APPROVED | NEEDS_REVISION | REJECTED
13940
+ CONFIDENCE: HIGH | MEDIUM | LOW
13941
+ ISSUES: [max 5 issues, each with: severity (CRITICAL/MAJOR/MINOR), description, suggested fix]
13942
+ SUMMARY: [1-2 sentence overall assessment]
13943
+
13944
+ RULES:
13945
+ - Max 5 issues per review (focus on highest impact)
13946
+ - Be specific: reference exact task numbers and descriptions
13947
+ - CRITICAL issues block approval (VERDICT must be NEEDS_REVISION or REJECTED)
13948
+ - MAJOR issues should trigger NEEDS_REVISION
13949
+ - MINOR issues can be noted but don't block APPROVED
13950
+ - No code writing
13951
+ - No delegation
13952
+ - Don't reject for style/formatting \u2014 focus on substance
13953
+ - If the plan is fundamentally sound with only minor concerns, APPROVE it`;
13954
+ function createCriticAgent(model, customPrompt, customAppendPrompt) {
13955
+ let prompt = CRITIC_PROMPT;
13956
+ if (customPrompt) {
13957
+ prompt = customPrompt;
13958
+ } else if (customAppendPrompt) {
13959
+ prompt = `${CRITIC_PROMPT}
13960
+
13961
+ ${customAppendPrompt}`;
13962
+ }
13963
+ return {
13964
+ name: "critic",
13965
+ description: "Plan critic. Reviews the architect's plan before implementation begins \u2014 checks completeness, feasibility, scope, dependencies, and flags AI-slop.",
13966
+ config: {
13967
+ model,
13968
+ temperature: 0.1,
13969
+ prompt,
13970
+ tools: {
13971
+ write: false,
13972
+ edit: false,
13973
+ patch: false
13974
+ }
13975
+ }
13976
+ };
13977
+ }
13978
+
13903
13979
  // src/agents/explorer.ts
13904
13980
  var EXPLORER_PROMPT = `You are Explorer. You analyze codebases.
13905
13981
 
@@ -14013,48 +14089,6 @@ ${customAppendPrompt}`;
14013
14089
  };
14014
14090
  }
14015
14091
 
14016
- // src/agents/test-engineer.ts
14017
- var TEST_ENGINEER_PROMPT = `You are Test Engineer. You generate tests.
14018
-
14019
- INPUT FORMAT:
14020
- TASK: Generate tests for [description]
14021
- FILE: [source file path]
14022
- OUTPUT: [test file path]
14023
-
14024
- COVERAGE:
14025
- - Happy path: normal inputs
14026
- - Edge cases: empty, null, boundaries
14027
- - Errors: invalid inputs, failures
14028
-
14029
- RULES:
14030
- - Match language (PowerShell \u2192 Pester, Python \u2192 pytest, TS \u2192 vitest/jest)
14031
- - Tests must be runnable
14032
- - Include setup/teardown if needed
14033
- - No delegation
14034
-
14035
- OUTPUT:
14036
- Write test file to specified OUTPUT path.
14037
- DONE: [count] tests covering [areas]`;
14038
- function createTestEngineerAgent(model, customPrompt, customAppendPrompt) {
14039
- let prompt = TEST_ENGINEER_PROMPT;
14040
- if (customPrompt) {
14041
- prompt = customPrompt;
14042
- } else if (customAppendPrompt) {
14043
- prompt = `${TEST_ENGINEER_PROMPT}
14044
-
14045
- ${customAppendPrompt}`;
14046
- }
14047
- return {
14048
- name: "test_engineer",
14049
- description: "Testing and validation specialist. Generates test cases and runnable validation scripts for approved code.",
14050
- config: {
14051
- model,
14052
- temperature: 0.2,
14053
- prompt
14054
- }
14055
- };
14056
- }
14057
-
14058
14092
  // src/agents/sme.ts
14059
14093
  var SME_PROMPT = `You are SME (Subject Matter Expert). You provide deep domain-specific technical guidance on whatever domain the Architect requests.
14060
14094
 
@@ -14101,6 +14135,57 @@ ${customAppendPrompt}`;
14101
14135
  };
14102
14136
  }
14103
14137
 
14138
+ // src/agents/test-engineer.ts
14139
+ var TEST_ENGINEER_PROMPT = `You are Test Engineer. You generate tests AND run them.
14140
+
14141
+ INPUT FORMAT:
14142
+ TASK: Generate tests for [description]
14143
+ FILE: [source file path]
14144
+ OUTPUT: [test file path]
14145
+
14146
+ COVERAGE:
14147
+ - Happy path: normal inputs
14148
+ - Edge cases: empty, null, boundaries
14149
+ - Errors: invalid inputs, failures
14150
+
14151
+ RULES:
14152
+ - Match language (PowerShell \u2192 Pester, Python \u2192 pytest, TS \u2192 vitest/jest)
14153
+ - Tests must be runnable
14154
+ - Include setup/teardown if needed
14155
+ - No delegation
14156
+
14157
+ WORKFLOW:
14158
+ 1. Write test file to the specified OUTPUT path
14159
+ 2. Run the tests using the appropriate test runner
14160
+ 3. Report results using the output format below
14161
+
14162
+ If tests fail, include the failure output so the architect can send fixes to the coder.
14163
+
14164
+ OUTPUT FORMAT:
14165
+ VERDICT: PASS | FAIL
14166
+ TESTS: [total count] tests, [pass count] passed, [fail count] failed
14167
+ FAILURES: [list of failed test names + error messages, if any]
14168
+ COVERAGE: [areas covered]`;
14169
+ function createTestEngineerAgent(model, customPrompt, customAppendPrompt) {
14170
+ let prompt = TEST_ENGINEER_PROMPT;
14171
+ if (customPrompt) {
14172
+ prompt = customPrompt;
14173
+ } else if (customAppendPrompt) {
14174
+ prompt = `${TEST_ENGINEER_PROMPT}
14175
+
14176
+ ${customAppendPrompt}`;
14177
+ }
14178
+ return {
14179
+ name: "test_engineer",
14180
+ description: "Testing and validation specialist. Generates test cases, runs them, and reports structured PASS/FAIL verdicts.",
14181
+ config: {
14182
+ model,
14183
+ temperature: 0.2,
14184
+ prompt
14185
+ }
14186
+ };
14187
+ }
14188
+
14104
14189
  // src/agents/index.ts
14105
14190
  function getModelForAgent(agentName, swarmAgents, swarmPrefix) {
14106
14191
  let baseAgentName = agentName;
@@ -14193,6 +14278,12 @@ If you call @coder instead of @${swarmId}_coder, the call will FAIL or go to the
14193
14278
  reviewer.name = prefixName("reviewer");
14194
14279
  agents.push(applyOverrides(reviewer, swarmAgents, swarmPrefix));
14195
14280
  }
14281
+ if (!isAgentDisabled("critic", swarmAgents, swarmPrefix)) {
14282
+ const criticPrompts = getPrompts("critic");
14283
+ const critic = createCriticAgent(getModel("critic"), criticPrompts.prompt, criticPrompts.appendPrompt);
14284
+ critic.name = prefixName("critic");
14285
+ agents.push(applyOverrides(critic, swarmAgents, swarmPrefix));
14286
+ }
14196
14287
  if (!isAgentDisabled("test_engineer", swarmAgents, swarmPrefix)) {
14197
14288
  const testPrompts = getPrompts("test_engineer");
14198
14289
  const testEngineer = createTestEngineerAgent(getModel("test_engineer"), testPrompts.prompt, testPrompts.appendPrompt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
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",