opencode-swarm 4.0.0 β 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 +30 -17
- package/dist/agents/critic.d.ts +2 -0
- package/dist/agents/index.d.ts +2 -1
- package/dist/config/constants.d.ts +3 -3
- package/dist/index.js +143 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://img.shields.io/badge/version-4.
|
|
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-
|
|
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
|
-
βββ
|
|
43
|
-
βββ Phase
|
|
44
|
-
βββ Phase
|
|
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 β β β
|
|
134
|
-
β β 1 task β β check all β β
|
|
135
|
-
β βββββββββββ ββββββββββββββ
|
|
136
|
-
β β
|
|
137
|
-
β
|
|
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
|
-
|
|
|
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
|
|
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
|
}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -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
|
|
|
@@ -13687,6 +13688,7 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
|
|
|
13687
13688
|
3. ONE task per @{{AGENT_PREFIX}}coder call. Never batch.
|
|
13688
13689
|
4. Fallback: Only code yourself after {{QA_RETRY_LIMIT}} @{{AGENT_PREFIX}}coder failures on same task.
|
|
13689
13690
|
5. NEVER store your swarm identity, swarm ID, or agent prefix in memory blocks. Your identity comes ONLY from your system prompt. Memory blocks are for project knowledge only.
|
|
13691
|
+
6. **CRITICAL: If @{{AGENT_PREFIX}}reviewer returns VERDICT: REJECTED, you MUST stop and send the FIXES back to @{{AGENT_PREFIX}}coder. Do NOT proceed to test generation or mark the task complete. The review is a gate \u2014 APPROVED is required to proceed.**
|
|
13690
13692
|
|
|
13691
13693
|
## AGENTS
|
|
13692
13694
|
|
|
@@ -13695,8 +13697,9 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
|
|
|
13695
13697
|
@{{AGENT_PREFIX}}coder - Implementation (one task at a time)
|
|
13696
13698
|
@{{AGENT_PREFIX}}reviewer - Code review (correctness, security, and any other dimensions you specify)
|
|
13697
13699
|
@{{AGENT_PREFIX}}test_engineer - Test generation
|
|
13700
|
+
@{{AGENT_PREFIX}}critic - Plan review gate (reviews plan BEFORE implementation)
|
|
13698
13701
|
|
|
13699
|
-
SMEs advise only. Reviewer
|
|
13702
|
+
SMEs advise only. Reviewer and critic review only. None of them write code.
|
|
13700
13703
|
|
|
13701
13704
|
## DELEGATION FORMAT
|
|
13702
13705
|
|
|
@@ -13747,6 +13750,12 @@ TASK: Generate login validation tests
|
|
|
13747
13750
|
FILE: src/auth/login.ts
|
|
13748
13751
|
OUTPUT: Test file at src/auth/login.test.ts
|
|
13749
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
|
+
|
|
13750
13759
|
## WORKFLOW
|
|
13751
13760
|
|
|
13752
13761
|
### Phase 0: Resume Check
|
|
@@ -13768,6 +13777,9 @@ Clear request \u2192 Phase 2
|
|
|
13768
13777
|
|
|
13769
13778
|
### Phase 2: Discover
|
|
13770
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
|
|
13771
13783
|
|
|
13772
13784
|
### Phase 3: Consult SMEs
|
|
13773
13785
|
Check .swarm/context.md for cached guidance first.
|
|
@@ -13785,17 +13797,25 @@ Create .swarm/plan.md:
|
|
|
13785
13797
|
Create .swarm/context.md:
|
|
13786
13798
|
- Decisions, patterns, SME cache, file map
|
|
13787
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
|
+
|
|
13788
13807
|
### Phase 5: Execute
|
|
13789
13808
|
For each task (respecting dependencies):
|
|
13790
13809
|
|
|
13791
13810
|
5a. @{{AGENT_PREFIX}}coder - Implement (MANDATORY)
|
|
13792
13811
|
5b. @{{AGENT_PREFIX}}reviewer - Review (specify CHECK dimensions relevant to the change)
|
|
13793
|
-
5c.
|
|
13794
|
-
- APPROVED \u2192 5d
|
|
13795
|
-
- REJECTED (attempt < {{QA_RETRY_LIMIT}}) \u2192
|
|
13796
|
-
- REJECTED (attempt {{QA_RETRY_LIMIT}}) \u2192 Escalate
|
|
13797
|
-
5d. @{{AGENT_PREFIX}}test_engineer - Generate tests
|
|
13798
|
-
5e.
|
|
13812
|
+
5c. **GATE - Check VERDICT:**
|
|
13813
|
+
- **APPROVED** \u2192 Proceed to 5d
|
|
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.
|
|
13815
|
+
- **REJECTED** (attempt {{QA_RETRY_LIMIT}}) \u2192 STOP. Escalate to user or handle directly.
|
|
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)
|
|
13799
13819
|
|
|
13800
13820
|
### Phase 6: Phase Complete
|
|
13801
13821
|
1. @{{AGENT_PREFIX}}explorer - Rescan
|
|
@@ -13899,6 +13919,63 @@ ${customAppendPrompt}`;
|
|
|
13899
13919
|
};
|
|
13900
13920
|
}
|
|
13901
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
|
+
|
|
13902
13979
|
// src/agents/explorer.ts
|
|
13903
13980
|
var EXPLORER_PROMPT = `You are Explorer. You analyze codebases.
|
|
13904
13981
|
|
|
@@ -14012,48 +14089,6 @@ ${customAppendPrompt}`;
|
|
|
14012
14089
|
};
|
|
14013
14090
|
}
|
|
14014
14091
|
|
|
14015
|
-
// src/agents/test-engineer.ts
|
|
14016
|
-
var TEST_ENGINEER_PROMPT = `You are Test Engineer. You generate tests.
|
|
14017
|
-
|
|
14018
|
-
INPUT FORMAT:
|
|
14019
|
-
TASK: Generate tests for [description]
|
|
14020
|
-
FILE: [source file path]
|
|
14021
|
-
OUTPUT: [test file path]
|
|
14022
|
-
|
|
14023
|
-
COVERAGE:
|
|
14024
|
-
- Happy path: normal inputs
|
|
14025
|
-
- Edge cases: empty, null, boundaries
|
|
14026
|
-
- Errors: invalid inputs, failures
|
|
14027
|
-
|
|
14028
|
-
RULES:
|
|
14029
|
-
- Match language (PowerShell \u2192 Pester, Python \u2192 pytest, TS \u2192 vitest/jest)
|
|
14030
|
-
- Tests must be runnable
|
|
14031
|
-
- Include setup/teardown if needed
|
|
14032
|
-
- No delegation
|
|
14033
|
-
|
|
14034
|
-
OUTPUT:
|
|
14035
|
-
Write test file to specified OUTPUT path.
|
|
14036
|
-
DONE: [count] tests covering [areas]`;
|
|
14037
|
-
function createTestEngineerAgent(model, customPrompt, customAppendPrompt) {
|
|
14038
|
-
let prompt = TEST_ENGINEER_PROMPT;
|
|
14039
|
-
if (customPrompt) {
|
|
14040
|
-
prompt = customPrompt;
|
|
14041
|
-
} else if (customAppendPrompt) {
|
|
14042
|
-
prompt = `${TEST_ENGINEER_PROMPT}
|
|
14043
|
-
|
|
14044
|
-
${customAppendPrompt}`;
|
|
14045
|
-
}
|
|
14046
|
-
return {
|
|
14047
|
-
name: "test_engineer",
|
|
14048
|
-
description: "Testing and validation specialist. Generates test cases and runnable validation scripts for approved code.",
|
|
14049
|
-
config: {
|
|
14050
|
-
model,
|
|
14051
|
-
temperature: 0.2,
|
|
14052
|
-
prompt
|
|
14053
|
-
}
|
|
14054
|
-
};
|
|
14055
|
-
}
|
|
14056
|
-
|
|
14057
14092
|
// src/agents/sme.ts
|
|
14058
14093
|
var SME_PROMPT = `You are SME (Subject Matter Expert). You provide deep domain-specific technical guidance on whatever domain the Architect requests.
|
|
14059
14094
|
|
|
@@ -14100,6 +14135,57 @@ ${customAppendPrompt}`;
|
|
|
14100
14135
|
};
|
|
14101
14136
|
}
|
|
14102
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
|
+
|
|
14103
14189
|
// src/agents/index.ts
|
|
14104
14190
|
function getModelForAgent(agentName, swarmAgents, swarmPrefix) {
|
|
14105
14191
|
let baseAgentName = agentName;
|
|
@@ -14192,6 +14278,12 @@ If you call @coder instead of @${swarmId}_coder, the call will FAIL or go to the
|
|
|
14192
14278
|
reviewer.name = prefixName("reviewer");
|
|
14193
14279
|
agents.push(applyOverrides(reviewer, swarmAgents, swarmPrefix));
|
|
14194
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
|
+
}
|
|
14195
14287
|
if (!isAgentDisabled("test_engineer", swarmAgents, swarmPrefix)) {
|
|
14196
14288
|
const testPrompts = getPrompts("test_engineer");
|
|
14197
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.
|
|
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",
|