opencode-swarm 5.0.0 → 5.0.2
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 +4 -0
- package/dist/config/schema.d.ts +3 -1
- package/dist/index.js +40 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -508,6 +508,10 @@ Override limits for specific agents that need more (or less) room:
|
|
|
508
508
|
|
|
509
509
|
Profiles merge with base config — only specified fields are overridden.
|
|
510
510
|
|
|
511
|
+
> **Built-in Architect Defaults:** The architect agent automatically receives higher limits
|
|
512
|
+
> (600 tool calls, 90 min duration, 8 consecutive errors, 0.7 warning threshold) without any
|
|
513
|
+
> configuration. These built-in defaults can be overridden via a `profiles.architect` entry.
|
|
514
|
+
|
|
511
515
|
### Disable Guardrails
|
|
512
516
|
|
|
513
517
|
```json
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare const GuardrailsProfileSchema: z.ZodObject<{
|
|
|
45
45
|
warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type GuardrailsProfile = z.infer<typeof GuardrailsProfileSchema>;
|
|
48
|
+
export declare const DEFAULT_ARCHITECT_PROFILE: GuardrailsProfile;
|
|
48
49
|
export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
49
50
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
50
51
|
max_tool_calls: z.ZodDefault<z.ZodNumber>;
|
|
@@ -63,7 +64,8 @@ export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
|
63
64
|
export type GuardrailsConfig = z.infer<typeof GuardrailsConfigSchema>;
|
|
64
65
|
/**
|
|
65
66
|
* Resolve guardrails configuration for a specific agent.
|
|
66
|
-
* Merges the base config with
|
|
67
|
+
* Merges the base config with built-in defaults (for the architect) and
|
|
68
|
+
* any per-agent profile overrides. Merge order: base < built-in < user profile.
|
|
67
69
|
*
|
|
68
70
|
* @param base - The base guardrails configuration
|
|
69
71
|
* @param agentName - Optional agent name to look up profile overrides
|
package/dist/index.js
CHANGED
|
@@ -13623,6 +13623,12 @@ var GuardrailsProfileSchema = exports_external.object({
|
|
|
13623
13623
|
max_consecutive_errors: exports_external.number().min(2).max(20).optional(),
|
|
13624
13624
|
warning_threshold: exports_external.number().min(0.1).max(0.9).optional()
|
|
13625
13625
|
});
|
|
13626
|
+
var DEFAULT_ARCHITECT_PROFILE = {
|
|
13627
|
+
max_tool_calls: 600,
|
|
13628
|
+
max_duration_minutes: 90,
|
|
13629
|
+
max_consecutive_errors: 8,
|
|
13630
|
+
warning_threshold: 0.7
|
|
13631
|
+
};
|
|
13626
13632
|
var GuardrailsConfigSchema = exports_external.object({
|
|
13627
13633
|
enabled: exports_external.boolean().default(true),
|
|
13628
13634
|
max_tool_calls: exports_external.number().min(10).max(1000).default(200),
|
|
@@ -13633,11 +13639,15 @@ var GuardrailsConfigSchema = exports_external.object({
|
|
|
13633
13639
|
profiles: exports_external.record(exports_external.string(), GuardrailsProfileSchema).optional()
|
|
13634
13640
|
});
|
|
13635
13641
|
function resolveGuardrailsConfig(base, agentName) {
|
|
13636
|
-
if (!agentName
|
|
13642
|
+
if (!agentName) {
|
|
13643
|
+
return base;
|
|
13644
|
+
}
|
|
13645
|
+
const builtIn = agentName === ORCHESTRATOR_NAME ? DEFAULT_ARCHITECT_PROFILE : undefined;
|
|
13646
|
+
const userProfile = base.profiles?.[agentName];
|
|
13647
|
+
if (!builtIn && !userProfile) {
|
|
13637
13648
|
return base;
|
|
13638
13649
|
}
|
|
13639
|
-
|
|
13640
|
-
return { ...base, ...profile };
|
|
13650
|
+
return { ...base, ...builtIn, ...userProfile };
|
|
13641
13651
|
}
|
|
13642
13652
|
var PluginConfigSchema = exports_external.object({
|
|
13643
13653
|
agents: exports_external.record(exports_external.string(), AgentOverrideConfigSchema).optional(),
|
|
@@ -13881,21 +13891,21 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
|
|
|
13881
13891
|
|
|
13882
13892
|
## RULES
|
|
13883
13893
|
|
|
13884
|
-
1. DELEGATE all coding to
|
|
13894
|
+
1. DELEGATE all coding to {{AGENT_PREFIX}}coder. You do NOT write code.
|
|
13885
13895
|
2. ONE agent per message. Send, STOP, wait for response.
|
|
13886
|
-
3. ONE task per
|
|
13887
|
-
4. Fallback: Only code yourself after {{QA_RETRY_LIMIT}}
|
|
13896
|
+
3. ONE task per {{AGENT_PREFIX}}coder call. Never batch.
|
|
13897
|
+
4. Fallback: Only code yourself after {{QA_RETRY_LIMIT}} {{AGENT_PREFIX}}coder failures on same task.
|
|
13888
13898
|
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.
|
|
13889
|
-
6. **CRITICAL: If
|
|
13899
|
+
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.**
|
|
13890
13900
|
|
|
13891
13901
|
## AGENTS
|
|
13892
13902
|
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13903
|
+
{{AGENT_PREFIX}}explorer - Codebase analysis
|
|
13904
|
+
{{AGENT_PREFIX}}sme - Domain expertise (any domain \u2014 the SME handles whatever you need: security, python, ios, kubernetes, etc.)
|
|
13905
|
+
{{AGENT_PREFIX}}coder - Implementation (one task at a time)
|
|
13906
|
+
{{AGENT_PREFIX}}reviewer - Code review (correctness, security, and any other dimensions you specify)
|
|
13907
|
+
{{AGENT_PREFIX}}test_engineer - Test generation AND execution (writes tests, runs them, reports PASS/FAIL)
|
|
13908
|
+
{{AGENT_PREFIX}}critic - Plan review gate (reviews plan BEFORE implementation)
|
|
13899
13909
|
|
|
13900
13910
|
SMEs advise only. Reviewer and critic review only. None of them write code.
|
|
13901
13911
|
|
|
@@ -13903,7 +13913,7 @@ SMEs advise only. Reviewer and critic review only. None of them write code.
|
|
|
13903
13913
|
|
|
13904
13914
|
All delegations use this structure:
|
|
13905
13915
|
|
|
13906
|
-
|
|
13916
|
+
{{AGENT_PREFIX}}[agent]
|
|
13907
13917
|
TASK: [single objective]
|
|
13908
13918
|
FILE: [path] (if applicable)
|
|
13909
13919
|
INPUT: [what to analyze/use]
|
|
@@ -13912,43 +13922,43 @@ CONSTRAINT: [what NOT to do]
|
|
|
13912
13922
|
|
|
13913
13923
|
Examples:
|
|
13914
13924
|
|
|
13915
|
-
|
|
13925
|
+
{{AGENT_PREFIX}}explorer
|
|
13916
13926
|
TASK: Analyze codebase for auth implementation
|
|
13917
13927
|
INPUT: Focus on src/auth/, src/middleware/
|
|
13918
13928
|
OUTPUT: Structure, frameworks, key files, relevant domains
|
|
13919
13929
|
|
|
13920
|
-
|
|
13930
|
+
{{AGENT_PREFIX}}sme
|
|
13921
13931
|
TASK: Review auth token patterns
|
|
13922
13932
|
DOMAIN: security
|
|
13923
13933
|
INPUT: src/auth/login.ts uses JWT with RS256
|
|
13924
13934
|
OUTPUT: Security considerations, recommended patterns
|
|
13925
13935
|
CONSTRAINT: Focus on auth only, not general code style
|
|
13926
13936
|
|
|
13927
|
-
|
|
13937
|
+
{{AGENT_PREFIX}}sme
|
|
13928
13938
|
TASK: Advise on state management approach
|
|
13929
13939
|
DOMAIN: ios
|
|
13930
13940
|
INPUT: Building a SwiftUI app with offline-first sync
|
|
13931
13941
|
OUTPUT: Recommended patterns, frameworks, gotchas
|
|
13932
13942
|
|
|
13933
|
-
|
|
13943
|
+
{{AGENT_PREFIX}}coder
|
|
13934
13944
|
TASK: Add input validation to login
|
|
13935
13945
|
FILE: src/auth/login.ts
|
|
13936
13946
|
INPUT: Validate email format, password >= 8 chars
|
|
13937
13947
|
OUTPUT: Modified file
|
|
13938
13948
|
CONSTRAINT: Do not modify other functions
|
|
13939
13949
|
|
|
13940
|
-
|
|
13950
|
+
{{AGENT_PREFIX}}reviewer
|
|
13941
13951
|
TASK: Review login validation
|
|
13942
13952
|
FILE: src/auth/login.ts
|
|
13943
13953
|
CHECK: [security, correctness, edge-cases]
|
|
13944
13954
|
OUTPUT: VERDICT + RISK + ISSUES
|
|
13945
13955
|
|
|
13946
|
-
|
|
13956
|
+
{{AGENT_PREFIX}}test_engineer
|
|
13947
13957
|
TASK: Generate and run login validation tests
|
|
13948
13958
|
FILE: src/auth/login.ts
|
|
13949
13959
|
OUTPUT: Test file at src/auth/login.test.ts + VERDICT: PASS/FAIL with failure details
|
|
13950
13960
|
|
|
13951
|
-
|
|
13961
|
+
{{AGENT_PREFIX}}critic
|
|
13952
13962
|
TASK: Review plan for user authentication feature
|
|
13953
13963
|
PLAN: [paste the plan.md content]
|
|
13954
13964
|
CONTEXT: [codebase summary from explorer]
|
|
@@ -13974,7 +13984,7 @@ Ambiguous request \u2192 Ask up to 3 questions, wait for answers
|
|
|
13974
13984
|
Clear request \u2192 Phase 2
|
|
13975
13985
|
|
|
13976
13986
|
### Phase 2: Discover
|
|
13977
|
-
Delegate to
|
|
13987
|
+
Delegate to {{AGENT_PREFIX}}explorer. Wait for response.
|
|
13978
13988
|
For complex tasks, make a second explorer call focused on risk/gap analysis:
|
|
13979
13989
|
- Hidden requirements, unstated assumptions, scope risks
|
|
13980
13990
|
- Existing patterns that the implementation must follow
|
|
@@ -13982,7 +13992,7 @@ For complex tasks, make a second explorer call focused on risk/gap analysis:
|
|
|
13982
13992
|
### Phase 3: Consult SMEs
|
|
13983
13993
|
Check .swarm/context.md for cached guidance first.
|
|
13984
13994
|
Identify 1-3 relevant domains from the task requirements.
|
|
13985
|
-
Call
|
|
13995
|
+
Call {{AGENT_PREFIX}}sme once per domain, serially. Max 3 SME calls per project phase.
|
|
13986
13996
|
Re-consult if a new domain emerges or if significant changes require fresh evaluation.
|
|
13987
13997
|
Cache guidance in context.md.
|
|
13988
13998
|
|
|
@@ -13996,7 +14006,7 @@ Create .swarm/context.md:
|
|
|
13996
14006
|
- Decisions, patterns, SME cache, file map
|
|
13997
14007
|
|
|
13998
14008
|
### Phase 4.5: Critic Gate
|
|
13999
|
-
Delegate plan to
|
|
14009
|
+
Delegate plan to {{AGENT_PREFIX}}critic for review BEFORE any implementation begins.
|
|
14000
14010
|
- Send the full plan.md content and codebase context summary
|
|
14001
14011
|
- **APPROVED** \u2192 Proceed to Phase 5
|
|
14002
14012
|
- **NEEDS_REVISION** \u2192 Revise the plan based on critic feedback, then resubmit (max 2 revision cycles)
|
|
@@ -14005,18 +14015,18 @@ Delegate plan to @{{AGENT_PREFIX}}critic for review BEFORE any implementation be
|
|
|
14005
14015
|
### Phase 5: Execute
|
|
14006
14016
|
For each task (respecting dependencies):
|
|
14007
14017
|
|
|
14008
|
-
5a.
|
|
14009
|
-
5b.
|
|
14018
|
+
5a. {{AGENT_PREFIX}}coder - Implement (MANDATORY)
|
|
14019
|
+
5b. {{AGENT_PREFIX}}reviewer - Review (specify CHECK dimensions relevant to the change)
|
|
14010
14020
|
5c. **GATE - Check VERDICT:**
|
|
14011
14021
|
- **APPROVED** \u2192 Proceed to 5d
|
|
14012
|
-
- **REJECTED** (attempt < {{QA_RETRY_LIMIT}}) \u2192 STOP. Send FIXES to
|
|
14022
|
+
- **REJECTED** (attempt < {{QA_RETRY_LIMIT}}) \u2192 STOP. Send FIXES to {{AGENT_PREFIX}}coder with specific changes. Retry from 5a. Do NOT proceed to 5d.
|
|
14013
14023
|
- **REJECTED** (attempt {{QA_RETRY_LIMIT}}) \u2192 STOP. Escalate to user or handle directly.
|
|
14014
|
-
5d.
|
|
14015
|
-
5e. If test VERDICT is FAIL \u2192 Send failures to
|
|
14024
|
+
5d. {{AGENT_PREFIX}}test_engineer - Generate AND run tests (ONLY if 5c = APPROVED). Expect VERDICT: PASS/FAIL.
|
|
14025
|
+
5e. If test VERDICT is FAIL \u2192 Send failures to {{AGENT_PREFIX}}coder for fixes, then re-run from 5b.
|
|
14016
14026
|
5f. Update plan.md [x], proceed to next task (ONLY if tests PASS)
|
|
14017
14027
|
|
|
14018
14028
|
### Phase 6: Phase Complete
|
|
14019
|
-
1.
|
|
14029
|
+
1. {{AGENT_PREFIX}}explorer - Rescan
|
|
14020
14030
|
2. Update context.md
|
|
14021
14031
|
3. Summarize to user
|
|
14022
14032
|
4. Ask: "Ready for Phase [N+1]?"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
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",
|