opencode-swarm 6.22.13 → 6.22.14

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/dist/index.js CHANGED
@@ -39065,8 +39065,8 @@ BATCHING DETECTION \u2014 you are batching if your coder delegation contains ANY
39065
39065
 
39066
39066
  WHY: Each coder task goes through the FULL QA gate (Stage A + Stage B).
39067
39067
  If you batch 3 tasks into 1 coder call, the QA gate runs once on the combined diff.
39068
- The reviewer cannot distinguish which changes belong to which requirement.
39069
- The test_engineer cannot write targeted tests for each behavior.
39068
+ The {{AGENT_PREFIX}}reviewer cannot distinguish which changes belong to which requirement.
39069
+ The {{AGENT_PREFIX}}test_engineer cannot write targeted tests for each behavior.
39070
39070
  A failure in one part blocks the entire batch, wasting all the work.
39071
39071
 
39072
39072
  SPLIT RULE: If your delegation draft has "and" in the TASK line, split it.
@@ -39083,7 +39083,7 @@ Two small delegations with two QA gates > one large delegation with one QA gate.
39083
39083
  \u2717 "I'll do the simple parts, coder does the hard parts" \u2192 ALL parts go to coder. You are not a coder.
39084
39084
  FAILURE COUNTING \u2014 increment the counter when:
39085
39085
  - Coder submits code that fails any tool gate or pre_check_batch (gates_passed === false)
39086
- - Coder submits code REJECTED by reviewer after being given the rejection reason
39086
+ - Coder submits code REJECTED by {{AGENT_PREFIX}}reviewer after being given the rejection reason
39087
39087
  - Print "Coder attempt [N/{{QA_RETRY_LIMIT}}] on task [X.Y]" at every retry
39088
39088
  - Reaching {{QA_RETRY_LIMIT}}: escalate to user with full failure history before writing code yourself
39089
39089
  If you catch yourself reaching for a code editing tool: STOP. Delegate to {{AGENT_PREFIX}}coder.
@@ -39134,7 +39134,7 @@ Two small delegations with two QA gates > one large delegation with one QA gate.
39134
39134
  LOW: do NOT consume directly. Either re-delegate to SME with specific query, OR flag to user as UNVERIFIED.
39135
39135
  Never silently consume LOW-confidence result as verified.
39136
39136
  7. **TIERED QA GATE** \u2014 Execute AFTER every coder task. Pipeline determined by change tier:
39137
- NOTE: These gates are enforced by runtime hooks. If you skip the reviewer delegation,
39137
+ NOTE: These gates are enforced by runtime hooks. If you skip the {{AGENT_PREFIX}}reviewer delegation,
39138
39138
  the next coder delegation will be BLOCKED by the plugin. This is not a suggestion \u2014
39139
39139
  it is a hard enforcement mechanism.
39140
39140
 
@@ -39149,23 +39149,23 @@ TIER 0 \u2014 METADATA
39149
39149
 
39150
39150
  TIER 1 \u2014 DOCUMENTATION
39151
39151
  Match: *.md outside .swarm/, comments-only, prompt text, README, CHANGELOG
39152
- Pipeline: Stage A. Stage B = reviewer\xD71 (gen). No security/test_engineer/adversarial.
39153
- Rationale: Non-executable; reviewer validates.
39152
+ Pipeline: Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD71 (gen). No security/{{AGENT_PREFIX}}test_engineer/adversarial.
39153
+ Rationale: Non-executable; {{AGENT_PREFIX}}reviewer validates.
39154
39154
 
39155
39155
  TIER 2 \u2014 STANDARD CODE
39156
39156
  Match: src/ files not Tier 3, test files, config, package.json
39157
- Pipeline: Full Stage A. Stage B = reviewer\xD71 + test_engineer\xD71 (verification).
39157
+ Pipeline: Full Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD71 + {{AGENT_PREFIX}}test_engineer\xD71 (verification).
39158
39158
  Rationale: Default for executables; review catches regressions.
39159
39159
 
39160
39160
  TIER 3 \u2014 CRITICAL
39161
39161
  Match: architect*.ts, delegation*.ts, guardrails*.ts, adversarial*.ts, sanitiz*.ts, auth*, permission*, crypto*, secret*, security files
39162
- Pipeline: Full Stage A. Stage B = reviewer\xD72 + test_engineer\xD72.
39162
+ Pipeline: Full Stage A. Stage B = {{AGENT_PREFIX}}reviewer\xD72 + {{AGENT_PREFIX}}test_engineer\xD72.
39163
39163
  Rationale: Security paths need adversarial review.
39164
39164
 
39165
39165
  CLASSIFICATION RULES:
39166
39166
  - Multi-tier \u2192 use HIGHEST tier.
39167
39167
  - Format: "Classification: TIER {N} \u2014 {label}"
39168
- - Reviewer flags risk \u2192 escalate. Run delta, not current tier. Tier 3 is ceiling.
39168
+ - {{AGENT_PREFIX}}reviewer flags risk \u2192 escalate. Run delta, not current tier. Tier 3 is ceiling.
39169
39169
  - Do NOT downgrade after entering pipeline.
39170
39170
  - Misclassification = GATE_DELEGATION_BYPASS.
39171
39171
 
@@ -39185,8 +39185,8 @@ A task is complete ONLY when BOTH stages pass.
39185
39185
 
39186
39186
  6f. **GATE AUTHORITY** \u2014 You do NOT have authority to judge task completion.
39187
39187
  Task completion is determined EXCLUSIVELY by gate agent output:
39188
- - reviewer returns APPROVED
39189
- - test_engineer returns PASS
39188
+ - {{AGENT_PREFIX}}reviewer returns APPROVED
39189
+ - {{AGENT_PREFIX}}test_engineer returns PASS
39190
39190
  - pre_check_batch returns gates_passed: true
39191
39191
 
39192
39192
  Your role is to DELEGATE to gate agents and RECORD their verdicts.
@@ -39231,7 +39231,7 @@ You may NOT write to plan.md/plan.json to change task completion status or phase
39231
39231
  "I'll just mark it done directly" is a bypass \u2014 equivalent to GATE_DELEGATION_BYPASS.
39232
39232
 
39233
39233
  6i. **DELEGATION DISCIPLINE**
39234
- When delegating to gate agents (reviewer, test_engineer, critic), your message MUST contain ONLY:
39234
+ When delegating to gate agents ({{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}test_engineer, {{AGENT_PREFIX}}critic), your message MUST contain ONLY:
39235
39235
  - What to review/test/analyze
39236
39236
  - Acceptance criteria
39237
39237
  - Technical context (files changed, requirements)
@@ -39249,13 +39249,13 @@ Delegation is a handoff, not a negotiation. State facts, let agents decide.
39249
39249
  <!-- BEHAVIORAL_GUIDANCE_START -->
39250
39250
  PARTIAL GATE RATIONALIZATIONS \u2014 automated gates \u2260 agent review. Running SOME gates is NOT compliance:
39251
39251
  \u2717 "I ran pre_check_batch so the code is verified" \u2192 pre_check_batch does NOT replace {{AGENT_PREFIX}}reviewer or {{AGENT_PREFIX}}test_engineer
39252
- \u2717 "syntax_check passed, good enough" \u2192 syntax_check catches syntax. Reviewer catches logic. Test_engineer catches behavior. All three are required.
39252
+ \u2717 "syntax_check passed, good enough" \u2192 syntax_check catches syntax. {{AGENT_PREFIX}}reviewer catches logic. {{AGENT_PREFIX}}test_engineer catches behavior. All three are required.
39253
39253
  \u2717 "The mechanical gates passed, skip the agent gates" \u2192 automated tools miss logic errors, security flaws, and edge cases that agent review catches
39254
39254
  \u2717 "It's Phase 6+, the codebase is stable now" \u2192 complacency after successful phases is the #1 predictor of shipped bugs. Phase 6 needs MORE review, not less.
39255
39255
  \u2717 "I'll just run the fast gates" \u2192 speed of a gate does not determine whether it is required
39256
39256
  \u2717 "5 phases passed clean, this one will be fine" \u2192 past success does not predict future correctness
39257
39257
 
39258
- Running syntax_check + pre_check_batch without reviewer + test_engineer is a PARTIAL GATE VIOLATION.
39258
+ Running syntax_check + pre_check_batch without {{AGENT_PREFIX}}reviewer + {{AGENT_PREFIX}}test_engineer is a PARTIAL GATE VIOLATION.
39259
39259
  It is the same severity as skipping all gates. The QA gate is ALL steps or NONE.
39260
39260
  <!-- BEHAVIORAL_GUIDANCE_END -->
39261
39261
 
@@ -39695,8 +39695,8 @@ All other gates: failure \u2192 return to coder. No self-fixes. No workarounds.
39695
39695
  - sast_scan (static security analysis)
39696
39696
  - quality_budget (maintainability metrics)
39697
39697
  \u2192 Returns { gates_passed, lint, secretscan, sast_scan, quality_budget, total_duration_ms }
39698
- \u2192 If gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to @coder with specific tool failures. Do NOT call @reviewer.
39699
- \u2192 If gates_passed === true: proceed to @reviewer.
39698
+ \u2192 If gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to {{AGENT_PREFIX}}coder with specific tool failures. Do NOT call {{AGENT_PREFIX}}reviewer.
39699
+ \u2192 If gates_passed === true: proceed to {{AGENT_PREFIX}}reviewer.
39700
39700
  \u2192 REQUIRED: Print "pre_check_batch: [PASS \u2014 all gates passed | FAIL \u2014 [gate]: [details]]"
39701
39701
 
39702
39702
  \u26A0\uFE0F pre_check_batch SCOPE BOUNDARY:
@@ -39712,7 +39712,7 @@ pre_check_batch does NOT run and does NOT replace:
39712
39712
  gates_passed: true means "automated static checks passed."
39713
39713
  It does NOT mean "code is reviewed." It does NOT mean "code is tested."
39714
39714
  After pre_check_batch passes, you MUST STILL delegate to {{AGENT_PREFIX}}reviewer.
39715
- Treating pre_check_batch as a substitute for reviewer is a PROCESS VIOLATION.
39715
+ Treating pre_check_batch as a substitute for {{AGENT_PREFIX}}reviewer is a PROCESS VIOLATION.
39716
39716
 
39717
39717
  5j. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) \u2192 coder retry. REJECTED ({{QA_RETRY_LIMIT}}) \u2192 escalate.
39718
39718
  \u2192 REQUIRED: Print "reviewer: [APPROVED | REJECTED \u2014 reason]"
@@ -39722,7 +39722,7 @@ Treating pre_check_batch as a substitute for reviewer is a PROCESS VIOLATION.
39722
39722
  5l. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL \u2192 coder retry from 5g.
39723
39723
  \u2192 REQUIRED: Print "testengineer-verification: [PASS N/N | FAIL \u2014 details]"
39724
39724
  {{ADVERSARIAL_TEST_STEP}}
39725
- 5n. COVERAGE CHECK: If test_engineer reports coverage < 70% \u2192 delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
39725
+ 5n. COVERAGE CHECK: If {{AGENT_PREFIX}}test_engineer reports coverage < 70% \u2192 delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
39726
39726
 
39727
39727
  PRE-COMMIT RULE \u2014 Before ANY commit or push:
39728
39728
  You MUST answer YES to ALL of the following:
@@ -39816,9 +39816,9 @@ CATASTROPHIC VIOLATION CHECK \u2014 ask yourself at EVERY phase boundary (MODE:
39816
39816
  "Have I delegated to {{AGENT_PREFIX}}reviewer at least once this phase?"
39817
39817
  If the answer is NO: you have a catastrophic process violation.
39818
39818
  STOP. Do not proceed to the next phase. Inform the user:
39819
- "\u26D4 PROCESS VIOLATION: Phase [N] completed with zero reviewer delegations.
39819
+ "\u26D4 PROCESS VIOLATION: Phase [N] completed with zero {{AGENT_PREFIX}}reviewer delegations.
39820
39820
  All code changes in this phase are unreviewed. Recommend retrospective review before proceeding."
39821
- This is not optional. Zero reviewer calls in a phase is always a violation.
39821
+ This is not optional. Zero {{AGENT_PREFIX}}reviewer calls in a phase is always a violation.
39822
39822
  There is no project where code ships without review.
39823
39823
 
39824
39824
  ### Blockers
@@ -39863,8 +39863,8 @@ When writing output consumed by other agents, prefix with:
39863
39863
  [FOR: agent1, agent2] \u2014 relevant to specific agents
39864
39864
  [FOR: ALL] \u2014 relevant to all agents
39865
39865
  Examples:
39866
- [FOR: reviewer, test_engineer] "Added validation \u2014 needs safety check"
39867
- [FOR: architect] "Research: Tree-sitter supports TypeScript AST"
39866
+ [FOR: {{AGENT_PREFIX}}reviewer, {{AGENT_PREFIX}}test_engineer] "Added validation \u2014 needs safety check"
39867
+ [FOR: {{AGENT_PREFIX}}architect] "Research: Tree-sitter supports TypeScript AST"
39868
39868
  [FOR: ALL] "Breaking change: StateManager renamed"
39869
39869
  This tag is informational in v6.19; v6.20 will use for context filtering.
39870
39870
  `;
@@ -49814,6 +49814,14 @@ function rankCandidates(candidates, config3) {
49814
49814
 
49815
49815
  // src/hooks/system-enhancer.ts
49816
49816
  init_utils2();
49817
+ function extractAgentPrefix(fullAgentName) {
49818
+ if (!fullAgentName)
49819
+ return "";
49820
+ const baseName = stripKnownSwarmPrefix(fullAgentName);
49821
+ if (baseName.length >= fullAgentName.length)
49822
+ return "";
49823
+ return fullAgentName.substring(0, fullAgentName.length - baseName.length);
49824
+ }
49817
49825
  function estimateContentType(text) {
49818
49826
  if (text.includes("```") || text.includes("function ") || text.includes("const ")) {
49819
49827
  return "code";
@@ -50153,10 +50161,12 @@ ${handoffBlock}`);
50153
50161
  const activeAgent_hf1 = swarmState.activeAgent.get(_input.sessionID ?? "");
50154
50162
  const baseRole = activeAgent_hf1 ? stripKnownSwarmPrefix(activeAgent_hf1) : null;
50155
50163
  if (baseRole === "coder" || baseRole === "test_engineer") {
50156
- tryInject("[SWARM CONFIG] You must NOT run build, test, lint, or type-check commands (npm run build, bun test, npx tsc, eslint, etc.). Make ONLY the code changes specified in your task. Verification is handled by the reviewer agent \u2014 do not self-verify. If your task explicitly asks you to run a specific command, that is the only exception.");
50164
+ const hf1Prefix = extractAgentPrefix(activeAgent_hf1);
50165
+ tryInject(`[SWARM CONFIG] You must NOT run build, test, lint, or type-check commands (npm run build, bun test, npx tsc, eslint, etc.). Make ONLY the code changes specified in your task. Verification is handled by the ${hf1Prefix}reviewer agent \u2014 do not self-verify. If your task explicitly asks you to run a specific command, that is the only exception.`);
50157
50166
  }
50158
50167
  if (baseRole === "architect" || baseRole === null) {
50159
- tryInject("[SWARM CONFIG] You must NEVER run the full test suite or batch test files. If you need to verify changes, run ONLY the specific test files for code YOU modified in this session \u2014 one file at a time, strictly serial. Do not run tests from directories or files unrelated to your changes. Do not run bun test without an explicit file path. When possible, delegate test execution to the test_engineer agent instead of running tests yourself.");
50168
+ const hf1Prefix = extractAgentPrefix(activeAgent_hf1);
50169
+ tryInject(`[SWARM CONFIG] You must NEVER run the full test suite or batch test files. If you need to verify changes, run ONLY the specific test files for code YOU modified in this session \u2014 one file at a time, strictly serial. Do not run tests from directories or files unrelated to your changes. Do not run bun test without an explicit file path. When possible, delegate test execution to the ${hf1Prefix}test_engineer agent instead of running tests yourself.`);
50160
50170
  }
50161
50171
  if (config3.adversarial_detection?.enabled !== false) {
50162
50172
  const activeAgent_adv = swarmState.activeAgent.get(_input.sessionID ?? "");
@@ -50185,7 +50195,8 @@ ${handoffBlock}`);
50185
50195
  const isArchitectForPreflight = !activeAgent_preflight || stripKnownSwarmPrefix(activeAgent_preflight) === "architect";
50186
50196
  if (isArchitectForPreflight) {
50187
50197
  if (config3.pipeline?.parallel_precheck !== false) {
50188
- tryInject("[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling @reviewer.");
50198
+ const preflightPrefix = extractAgentPrefix(activeAgent_preflight);
50199
+ tryInject(`[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling ${preflightPrefix}reviewer.`);
50189
50200
  } else {
50190
50201
  tryInject("[SWARM HINT] Parallel pre-check disabled: run lint:check \u2192 secretscan \u2192 sast_scan \u2192 quality_budget sequentially.");
50191
50202
  }
@@ -50533,7 +50544,8 @@ ${handoffBlock}`;
50533
50544
  const activeAgent_preflight_b = swarmState.activeAgent.get(sessionId_preflight_b ?? "");
50534
50545
  const isArchitectForPreflight_b = !activeAgent_preflight_b || stripKnownSwarmPrefix(activeAgent_preflight_b) === "architect";
50535
50546
  if (isArchitectForPreflight_b) {
50536
- const hintText_b = config3.pipeline?.parallel_precheck !== false ? "[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling @reviewer." : "[SWARM HINT] Parallel pre-check disabled: run lint:check \u2192 secretscan \u2192 sast_scan \u2192 quality_budget sequentially.";
50547
+ const preflightPrefix_b = extractAgentPrefix(activeAgent_preflight_b);
50548
+ const hintText_b = config3.pipeline?.parallel_precheck !== false ? `[SWARM HINT] Parallel pre-check enabled: call pre_check_batch(files, directory) after lint --fix and build_check to run lint:check + secretscan + sast_scan + quality_budget concurrently (max 4 parallel). Check gates_passed before calling ${preflightPrefix_b}reviewer.` : "[SWARM HINT] Parallel pre-check disabled: run lint:check \u2192 secretscan \u2192 sast_scan \u2192 quality_budget sequentially.";
50537
50549
  candidates.push({
50538
50550
  id: `candidate-${idCounter++}`,
50539
50551
  kind: "phase",
@@ -53114,7 +53126,7 @@ async function executeDeclareScope(args2, fallbackDir) {
53114
53126
  };
53115
53127
  }
53116
53128
  var declare_scope = createSwarmTool({
53117
- description: "Declare the file scope for the next coder delegation. " + "Sets the list of files the coder is permitted to modify for a specific task. " + "Must be called before delegating to mega_coder to enable scope containment checking.",
53129
+ description: "Declare the file scope for the next coder delegation. " + "Sets the list of files the coder is permitted to modify for a specific task. " + "Must be called before delegating to coder to enable scope containment checking.",
53118
53130
  args: {
53119
53131
  taskId: tool.schema.string().min(1).regex(/^\d+\.\d+(\.\d+)*$/, "Task ID must be in N.M or N.M.P format").describe('Task ID for which scope is being declared, e.g. "1.1", "1.2.3"'),
53120
53132
  files: tool.schema.array(tool.schema.string().min(1).max(4096)).min(1).describe("Array of file paths the coder is permitted to modify"),
@@ -14,7 +14,7 @@ export interface RunMemoryEntry {
14
14
  taskId: string;
15
15
  /** SHA256 hash of taskId + sorted file targets, first 8 chars */
16
16
  taskFingerprint: string;
17
- /** Which agent executed the task (e.g. "mega_coder") */
17
+ /** Which agent executed the task (e.g. "coder") */
18
18
  agent: string;
19
19
  /** Outcome of the task execution */
20
20
  outcome: 'pass' | 'fail' | 'retry' | 'skip';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Declare scope tool for setting the file scope for coder delegations.
3
3
  * Implements FR-010: Declare coder scope before delegation.
4
- * This tool must be called before delegating to mega_coder to enable scope containment checking.
4
+ * This tool must be called before delegating to coder to enable scope containment checking.
5
5
  */
6
6
  import { type ToolDefinition } from '@opencode-ai/plugin/tool';
7
7
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.22.13",
3
+ "version": "6.22.14",
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",