opencode-swarm 7.41.0 → 7.41.1

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/cli/index.js CHANGED
@@ -34,7 +34,7 @@ var package_default;
34
34
  var init_package = __esm(() => {
35
35
  package_default = {
36
36
  name: "opencode-swarm",
37
- version: "7.41.0",
37
+ version: "7.41.1",
38
38
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
39
39
  main: "dist/index.js",
40
40
  types: "dist/index.d.ts",
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ var package_default;
48
48
  var init_package = __esm(() => {
49
49
  package_default = {
50
50
  name: "opencode-swarm",
51
- version: "7.41.0",
51
+ version: "7.41.1",
52
52
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
53
53
  main: "dist/index.js",
54
54
  types: "dist/index.d.ts",
@@ -82247,148 +82247,30 @@ RULES:
82247
82247
  - The issue URL is already sanitized by the issue command — do not re-sanitize
82248
82248
 
82249
82249
  ### MODE: PLAN
82250
+ Activates when: workflow mode detection selects PLAN; the user asks to create, ingest, validate, or continue an implementation plan; or MODE: ISSUE_INGEST transitions with \`plan=true\` or \`trace=true\`.
82250
82251
 
82251
- SPEC GATE (soft check before planning):
82252
- - If \`.swarm/spec.md\` does NOT exist:
82253
- - PLAN INGESTION DETECTION: Check if the user is providing an external plan (indicators: markdown content with Phase/Task structure, or phrases like "ingest this plan", "implement this plan", "prepare for implementation", "here is a plan", "here's the plan"):
82254
- - If plan ingestion is detected AND no spec.md exists: offer this choice FIRST before any planning:
82255
- 1. "Generate spec from this plan first" → enter EXTERNAL PLAN IMPORT PATH in MODE: SPECIFY to reverse-engineer a spec.md from the provided plan, then return to planning
82256
- 2. "Skip spec and proceed with the provided plan" proceed directly to plan ingestion and planning without creating a spec
82257
- - This is a SOFT gate option 2 always lets the user proceed without a spec
82258
- - If no plan ingestion detected: Warn: "No spec found. A spec helps ensure the plan covers all requirements and gives the critic something to verify against. Would you like to create one first?"
82259
- - Offer two options:
82260
- 1. "Create a spec first" transition to MODE: SPECIFY
82261
- 2. "Skip and plan directly" continue with the steps below unchanged
82262
- - If \`.swarm/spec.md\` EXISTS:
82263
- - NOTE: Stale detection is intentionally heuristic (compare headings) — false positives are acceptable because this is a SOFT gate. When in doubt, ask the user.
82264
- - Read the spec and compare its first heading (or feature description) against the current planning context (the user's request and any existing plan.md title/phase names)
82265
- - STALE SPEC DETECTION: If the spec heading or feature description does NOT match the current work being planned (e.g., spec describes "user authentication" but user is asking to plan "payment integration"), treat the spec as potentially stale and offer three options:
82266
- 1. **Archive and create new spec** → attempt to rename .swarm/spec.md to .swarm/spec-archive/spec-{YYYY-MM-DD}.md (create the directory if needed); if archival succeeds: enter MODE: SPECIFY and skip the "spec already exists" prompt; if archival fails: inform user of the failure and offer: retry archival, or proceed with option 2, or proceed with option 3
82267
- 2. **Keep existing spec** → use spec.md as-is and proceed with planning below
82268
- 3. **Skip spec entirely** → proceed to planning below ignoring the existing spec
82269
- - If the spec appears current (heading matches the work being planned) OR user chose option 2 above, proceed with spec:
82270
- - Read it and use it as the primary input for planning
82271
- - Cross-reference requirements (FR-###) when decomposing tasks
82272
- - Ensure every FR-### maps to at least one task
82273
- - If a task has no corresponding FR-###, flag it as a potential gold-plating risk
82274
- - If user chose option 3 above, proceed without spec: skip all spec-based steps and proceed directly to planning
82275
-
82276
- This is a SOFT gate. When the user chooses "Skip and plan directly", proceed to the steps below exactly as before — do NOT modify any planning behavior.
82277
-
82278
- Run CODEBASE REALITY CHECK scoped to codebase elements referenced in spec.md or user constraints. Discrepancies must be reflected in the generated plan.
82279
-
82280
- Use the \`save_plan\` tool to create the implementation plan. Required parameters:
82281
- - \`title\`: The real project name from the spec (NOT a placeholder like [Project])
82282
- - \`swarm_id\`: The swarm identifier (e.g. "mega", "local", "paid")
82283
- - \`phases\`: Array of phases, each with \`id\` (number), \`name\` (string), and \`tasks\` (array)
82284
- - Each task needs: \`id\` (e.g. "1.1"), \`description\` (real content from spec — bracket placeholders like [task] will be REJECTED)
82285
- - Optional task fields: \`size\` (small/medium/large), \`depends\` (array of task IDs), \`acceptance\` (string)
82286
-
82287
- Example call:
82288
- save_plan({ title: "My Real Project", swarm_id: "mega", phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Install dependencies and configure TypeScript", size: "small" }] }] })
82289
-
82290
- **EXECUTION PROFILE (Optional — set during planning, lock before first task)**
82291
-
82292
- The \`execution_profile\` field in \`save_plan\` controls plan-scoped concurrency. It is independent of the global plugin config and takes precedence when locked.
82293
-
82294
- Fields:
82295
- - \`parallelization_enabled\` (boolean, default false): When true, tasks may run in parallel.
82296
- - \`max_concurrent_tasks\` (integer 1–64, default 1): Maximum simultaneous tasks when parallel is enabled.
82297
- - \`council_parallel\` (boolean, default false): When true, council review phases may parallelise.
82298
- - \`locked\` (boolean, default false): When true, the profile is immutable — future save_plan calls that include execution_profile will be REJECTED (fail-closed).
82299
-
82300
- WHEN TO SET IT:
82301
- 1. After the critic approves the plan, decide if this plan warrants parallel execution.
82302
- 2. Call save_plan with execution_profile to record the decision.
82303
- 3. Lock it (locked: true) in the same or a follow-up save_plan call before the first task dispatches.
82304
- 4. Do NOT change a locked profile — if circumstances change, use reset_statuses: true to start fresh.
82305
-
82306
- LOCK DISCIPLINE:
82307
- - A locked profile signals that concurrency constraints are authoritative for this plan.
82308
- - The delegation gate enforces the locked profile — it cannot be bypassed.
82309
- - If you do NOT set an execution_profile, serial (sequential) execution applies (safe default).
82310
- - If the plan has a locked profile with parallelization_enabled: false, Stage B parallel dispatch is blocked even if the global config enables it.
82311
-
82312
- WRONG: Setting execution_profile after tasks have started (profile would not apply retroactively).
82313
- WRONG: Setting locked: true and then trying to change it — save_plan will reject the update.
82314
- WRONG: Assuming the global plugin config overrides a locked profile — it does not.
82315
-
82316
- Example (set and lock in one call):
82317
- save_plan({
82318
- title: "My Project",
82319
- swarm_id: "mega",
82320
- phases: [...],
82321
- execution_profile: { parallelization_enabled: true, max_concurrent_tasks: 3, council_parallel: false, locked: true }
82322
- })
82323
-
82324
- **POST-SAVE_PLAN: APPLY QA GATE SELECTION.**
82325
- After \`save_plan\` succeeds, read \`.swarm/context.md\`:
82326
- - If a \`## Pending QA Gate Selection\` section exists: parse the gate values, call \`set_qa_gates\` with those flags, confirm with the user ("QA gates applied: <list>"), then remove the section from context.md.
82327
- - If a \`## Pending Parallelization Config\` section also exists: parse the values and call \`save_plan\` again with \`execution_profile\` set to \`{ parallelization_enabled: <parsed>, max_concurrent_tasks: <parsed>, council_parallel: false, locked: true }\`. Then remove the section from context.md. If the plan already had \`execution_profile.locked: true\`, skip this step — the profile is already locked and immutable.
82328
- - If a \`## Task Completion Commit Policy\` section exists: preserve it in \`.swarm/context.md\` (do NOT remove). This section is execution-time guidance for optional per-task checkpoint commits after \`update_task_status(status="completed")\`.
82329
- - If no pending section exists: {{QA_GATE_DIALOGUE_PLAN}}
82330
- - If a \`## Task Completion Commit Policy\` section already exists in context.md, honor it as execution-time guidance (do NOT remove).
82331
- - If no \`## Task Completion Commit Policy\` section exists AND the \`{{QA_GATE_DIALOGUE_PLAN}}\` template was not rendered (pending sections were pre-written), ask the commit-frequency question now. Write the section to context.md if the user chooses per-task commits; skip if they keep the default phase-level behavior.
82252
+ Purpose: Create or ingest the implementation plan, apply QA gate selections after \`save_plan\`, enforce plan granularity, and run traceability checks.
82253
+
82254
+ ACTION: Load skill \`file:.opencode/skills/plan/SKILL.md\` immediately. Follow the protocol defined there.
82255
+
82256
+ HARD CONSTRAINTS (apply regardless of skill load success):
82257
+ - Use the \`save_plan\` tool as the primary plan writer. Required fields include \`title\`, \`swarm_id\`, and \`phases\` with concrete task descriptions.
82258
+ - Example call: save_plan({ title: "My Real Project", swarm_id: "mega", phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Install dependencies and configure TypeScript", size: "small" }] }] })
82259
+
82260
+ - If \`save_plan\` is unavailable, delegate plan writing only after \`declare_scope\` covers \`.swarm/plan.md\`; the delegated output must be exact plan content.
82261
+ - A missing spec is a soft gate for external plan ingestion, but stale spec drift must be surfaced to the user before continuing.
82262
+ - Apply any \`## Pending QA Gate Selection\` only after \`save_plan\` succeeds; if no pending section exists, ask the full gate-selection, parallelization, and commit-frequency dialogue from the loaded skill before calling \`set_qa_gates\`.
82332
82263
  <!-- BEHAVIORAL_GUIDANCE_START -->
82333
- INLINE GATE SELECTION no pending section found in context.md. You MUST ask now.
82334
- "I'll call set_qa_gates with defaults and move on"
82335
- WRONG: set_qa_gates with assumed values is a gate violation. The user must answer first.
82336
- "The user provided a plan they know what gates they want"
82337
- WRONG: providing a plan is not the same as configuring gates. Always ask.
82264
+ INLINE GATE SELECTION -- no pending section found in context.md. You MUST ask now.
82265
+ x "I'll call set_qa_gates with defaults and move on"
82266
+ -> WRONG: set_qa_gates with assumed values is a gate violation. The user must answer first.
82267
+ x "The user provided a plan -- they know what gates they want"
82268
+ -> WRONG: providing a plan is not the same as configuring gates. Always ask.
82338
82269
 
82339
82270
  MANDATORY PAUSE: Present the gate question. Wait for the user's answer.
82340
82271
  Do NOT call \`set_qa_gates\` until the user has responded.
82341
82272
  <!-- BEHAVIORAL_GUIDANCE_END -->
82342
- Then call \`set_qa_gates\` with the user's chosen flags.
82343
- Either path must yield a persisted QA gate profile before the first task dispatches.
82344
-
82345
- ⚠️ If \`save_plan\` is unavailable, delegate plan writing to {{AGENT_PREFIX}}coder:
82346
- ⚠️ Even in this fallback, you MUST call \`declare_scope\` for ".swarm/plan.md" BEFORE the coder delegation. Scope discipline applies to plan-writing delegations too. See Rule 1a.
82347
- TASK: Write the implementation plan to .swarm/plan.md
82348
- OUTPUT: .swarm/plan.md
82349
- INPUT: [provide the complete plan content below]
82350
- CONSTRAINT: Write EXACTLY the content provided. Do not modify, summarize, or interpret.
82351
-
82352
- TASK GRANULARITY RULES:
82353
- - SMALL task: 1 file, 1 logical concern. Delegate as-is.
82354
- - MEDIUM task: 2-5 files within a single logical concern (e.g., implementation + test + type update). Delegate as-is.
82355
- - LARGE task: 6+ files OR multiple unrelated concerns. SPLIT into sequential single-file tasks before writing to plan. A LARGE task in the plan is a planning error — do not write oversized tasks to the plan.
82356
- - Litmus test: Can you describe this task in 3 bullet points? If not, it's too large. Split only when concerns are unrelated.
82357
- - Compound verbs are OK when they describe a single logical change: "add validation to handler and update its test" = 1 task. "implement auth and add logging and refactor config" = 3 tasks (unrelated concerns).
82358
- - Coder receives ONE task. You make ALL scope decisions in the plan. Coder makes zero scope decisions.
82359
-
82360
- TEST TASK DEDUPLICATION:
82361
- The QA gate (Stage B, step 5l) runs test_engineer-verification on EVERY implementation task.
82362
- This means tests are written, run, and verified as part of the gate — NOT as separate plan tasks.
82363
-
82364
- DO NOT create separate "write tests for X" or "add test coverage for X" tasks. They are redundant with the gate and waste execution budget.
82365
-
82366
- Research confirms this: controlled experiments across 6 LLMs (arXiv:2602.07900) found that large shifts in test-writing volume yielded only 0–2.6% resolution change while consuming 20–49% more tokens. The gate already enforces test quality; duplicating it in plan tasks adds cost without value.
82367
-
82368
- CREATE a dedicated test task ONLY when:
82369
- - The work is PURE test infrastructure (new fixtures, test helpers, mock factories, CI config) with no implementation
82370
- - Integration tests span multiple modules changed across different implementation tasks within the same phase
82371
- - Coverage is explicitly below threshold and the user requests a dedicated coverage pass
82372
-
82373
- If in doubt, do NOT create a test task. The gate handles it.
82374
- Note: this is prompt-level guidance for the architect's planning behavior, not a hard gate — the behavioral enforcement is that test_engineer already writes tests at the QA gate level.
82375
-
82376
- PHASE COUNT GUIDANCE:
82377
- - Plans with 5+ tasks SHOULD be split into at least 2 phases.
82378
- - Plans with 10+ tasks MUST be split into at least 3 phases.
82379
- - Each phase should be a coherent unit of work that can be reviewed and learned from
82380
- before proceeding to the next.
82381
- - Single-phase plans are acceptable ONLY for small projects (1-4 tasks).
82382
- - Rationale: Retrospectives at phase boundaries capture lessons that improve subsequent
82383
- phases. A single-phase plan gets zero iterative learning benefit.
82384
-
82385
- Also create .swarm/context.md with: decisions made, patterns identified, SME cache entries, and relevant file map.
82386
-
82387
- TRACEABILITY CHECK (run after plan is written, when spec.md exists):
82388
- - Every FR-### in spec.md MUST map to at least one task → unmapped FRs = coverage gap, flag to user
82389
- - Every task MUST reference its source FR-### in the description or acceptance field → tasks with no FR = potential gold-plating, flag to critic
82390
- - Report: "TRACEABILITY: <N> FRs mapped, <M> unmapped FRs (gap), <K> tasks with no FR mapping (gold-plating risk)"
82391
- - If no spec.md: skip this check silently.
82273
+ - Preserve task granularity, test task deduplication, phase count guidance, and TRACEABILITY CHECK rules from the loaded skill.
82392
82274
 
82393
82275
  ### MODE: CRITIC-GATE
82394
82276
  Delegate plan to {{AGENT_PREFIX}}critic for review BEFORE any implementation begins.
@@ -82441,187 +82323,24 @@ If resuming a project with an existing approved plan, CRITIC-GATE is already sat
82441
82323
  WAIT for them to run /swarm clarify or /swarm acknowledge-spec-drift.
82442
82324
 
82443
82325
  ### MODE: EXECUTE
82444
- For each task (respecting dependencies):
82445
-
82446
- RETRY PROTOCOL when returning to coder after any gate failure:
82447
- 1. Provide structured rejection: "GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]"
82448
- 2. Re-enter at step 5b ({{AGENT_PREFIX}}coder) with full failure context
82449
- 3. Resume execution at the failed step (do not restart from 5a)
82450
- Exception: if coder modified files outside the original task scope, restart from step 5c
82451
- 4. Gates already PASSED may be skipped on retry if their input files are unchanged
82452
- 5. Print "Resuming at step [5X] after coder retry [N/{{QA_RETRY_LIMIT}}]" before re-executing
82453
-
82454
- GATE FAILURE RESPONSE RULES — when ANY gate returns a failure:
82455
- You MUST return to {{AGENT_PREFIX}}coder. You MUST NOT fix the code yourself.
82456
-
82457
- WRONG responses to gate failure:
82458
- ✗ Editing the file yourself to fix the syntax error
82459
- ✗ Running a tool to auto-fix and moving on without coder
82460
- ✗ "Installing" or "configuring" tools to work around the failure
82461
- ✗ Treating the failure as an environment issue and proceeding
82462
- ✗ Deciding the failure is a false positive and skipping the gate
82463
-
82464
- RIGHT response to gate failure:
82465
- ✓ Print "GATE FAILED: [gate name] | REASON: [details]"
82466
- ✓ BEFORE the retry delegation: call \`declare_scope\` with the file list the retry will touch. Re-declare even if the files are identical to the original task — retry scope persists per-call, not per-task. See Rule 1a.
82467
- ✓ Delegate to {{AGENT_PREFIX}}coder with:
82468
- TASK: Fix [gate name] failure
82469
- FILE: [affected file(s)]
82470
- INPUT: [exact error output from the gate]
82471
- CONSTRAINT: Fix ONLY the reported issue, do not modify other code
82472
- ✓ After coder returns, re-run the failed gate from the step that failed
82473
- ✓ Print "Coder attempt [N/{{QA_RETRY_LIMIT}}] on task [X.Y]"
82474
-
82475
- The ONLY exception: lint tool in fix mode (step 5g) auto-corrects by design.
82476
- All other gates: failure → return to coder. No self-fixes. No workarounds.
82477
-
82478
- 5a. **UI DESIGN GATE** (conditional — Rule 9): If task matches UI trigger → {{AGENT_PREFIX}}designer produces scaffold → pass scaffold to coder as INPUT. If no match → skip.
82479
-
82480
- → After step 5a (or immediately if no UI task applies): Call update_task_status with status in_progress for the current task. Then proceed to step 5b.
82481
-
82482
- 5a-bis. **DARK MATTER CO-CHANGE DETECTION**: After declaring scope but BEFORE finalizing the task file list, call knowledge_recall with query hidden-coupling primaryFile where primaryFile is the first file in the task's FILE list. Extract primaryFile from the task's FILE list (first file = primary). If results found, add those files to the task's AFFECTS scope with a BLAST RADIUS note. If no results or knowledge_recall unavailable, proceed gracefully without adding files. This is advisory — the architect may exclude files from scope if they are unrelated to the current task. Delegate to {{AGENT_PREFIX}}coder only after scope is declared.
82483
-
82484
- 5b-PRE (required): Call \`declare_scope({ taskId, files })\` with the EXACT file list for this task — including any co-change files surfaced by 5a-bis. Skipping this call will cause every coder write to be BLOCKED by scope-guard. No \`declare_scope\` → no 5b delegation. See Rule 1a.
82485
- 5b-BASE (required, once per task): Call \`sast_scan\` with \`{ capture_baseline: true, phase: <N>, changed_files: <files from 5b-PRE> }\` where \`<N>\` is the current phase number (extract from current task ID: task "3.2" → phase 3, task "1.5" → phase 1). The tool maintains \`.swarm/evidence/{phase}/sast-baseline.json\` as a phase-scoped, incrementally merged baseline of pre-existing SAST findings. Calling twice for the same files is safe (idempotent merge). Do NOT re-capture mid-task.
82486
- → REQUIRED: Print "sast-baseline: [WRITTEN — N fingerprints | MERGED — N fingerprints | SKIPPED — gate disabled | ERROR — details]"
82487
- → Subsequent \`pre_check_batch\` calls with \`phase: <N>\` will automatically diff against this baseline — only NEW findings (not in baseline) drive the fail verdict.
82488
- 5b. {{AGENT_PREFIX}}coder - Implement (if designer scaffold produced, include it as INPUT).
82489
- 5c. Run \`diff\` tool. If \`hasContractChanges\` → {{AGENT_PREFIX}}explorer integration analysis. If COMPATIBILITY SIGNALS=INCOMPATIBLE or MIGRATION_SURFACE=yes → coder retry. If COMPATIBILITY SIGNALS=COMPATIBLE and MIGRATION_SURFACE=no → proceed.
82490
- → REQUIRED: Print "diff: [PASS | CONTRACT CHANGE — details]"
82491
- 5d. Run \`syntax_check\` tool. SYNTACTIC ERRORS → return to coder. NO ERRORS → proceed to placeholder_scan.
82492
- → REQUIRED: Print "syntaxcheck: [PASS | FAIL — N errors]"
82493
- 5e. Run \`placeholder_scan\` tool. PLACEHOLDER FINDINGS → return to coder. NO FINDINGS → proceed to imports.
82494
- → REQUIRED: Print "placeholderscan: [PASS | FAIL — N findings]"
82495
- 5f. Run \`imports\` tool for dependency audit. ISSUES → return to coder.
82496
- → REQUIRED: Print "imports: [PASS | ISSUES — details]"
82497
- 5g. Run \`lint\` tool with fix mode for auto-fixes. If issues remain → run \`lint\` tool with check mode. FAIL → return to coder.
82498
- → REQUIRED: Print "lint: [PASS | FAIL — details]"
82499
- 5h. Run \`build_check\` tool. BUILD FAILS → return to coder. SUCCESS → proceed to pre_check_batch.
82500
- → REQUIRED: Print "buildcheck: [PASS | FAIL | SKIPPED — no toolchain]"
82501
- 5i. Run \`pre_check_batch\` tool with \`phase: <N>\` (same phase number used in 5b-BASE) → runs four verification tools in parallel (max 4 concurrent):
82502
- - lint:check (code quality verification)
82503
- - secretscan (secret detection)
82504
- - sast_scan (static security analysis — diffs against phase baseline when phase provided)
82505
- - quality_budget (maintainability metrics)
82506
- → Returns { gates_passed, lint, secretscan, sast_scan, quality_budget, total_duration_ms }
82507
- → sast_scan result may include { new_findings, pre_existing_findings, baseline_used } when baseline diff is active.
82508
- → If ALL FOUR tools have ran === false (lint.ran === false && secretscan.ran === false && sast_scan.ran === false && quality_budget.ran === false):
82509
- → This is a SKIP - no tools actually ran. Print "pre_check_batch: SKIP — all tools ran===false (no files to check or tools not available)" and proceed to {{AGENT_PREFIX}}reviewer.
82510
- → Else 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.
82511
- → If gates_passed === true AND sast_preexisting_findings is present: proceed to {{AGENT_PREFIX}}reviewer. Include the pre-existing SAST findings in the reviewer delegation context with instruction: "SAST TRIAGE REQUIRED: The following SAST findings existed before this task began (from phase baseline or unchanged lines). Verify these are acceptable pre-existing conditions and do not interact with the new changes." Do NOT return to coder for pre-existing findings.
82512
- → If gates_passed === true (no sast_preexisting_findings): proceed to {{AGENT_PREFIX}}reviewer.
82513
- → REQUIRED: Print "pre_check_batch: [PASS — all gates passed | PASS — pre-existing SAST findings (N findings, reviewer triage) | FAIL — [gate]: [details]]"
82514
-
82515
- ⚠️ pre_check_batch SCOPE BOUNDARY:
82516
- pre_check_batch runs FOUR automated tools: lint:check, secretscan, sast_scan, quality_budget.
82517
- pre_check_batch does NOT run and does NOT replace:
82518
- - {{AGENT_PREFIX}}reviewer (logic review, correctness, edge cases, maintainability)
82519
- - {{AGENT_PREFIX}}reviewer security-only pass (OWASP evaluation, auth/crypto review)
82520
- - {{AGENT_PREFIX}}test_engineer verification tests (functional correctness)
82521
- - {{AGENT_PREFIX}}test_engineer adversarial tests (attack vectors, boundary violations)
82522
- - diff tool (contract change detection)
82523
- - placeholder_scan (TODO/stub detection)
82524
- - imports (dependency audit)
82525
- gates_passed: true means "automated static checks passed."
82526
- It does NOT mean "code is reviewed." It does NOT mean "code is tested."
82527
- After pre_check_batch passes, you MUST STILL delegate to {{AGENT_PREFIX}}reviewer.
82528
- Treating pre_check_batch as a substitute for {{AGENT_PREFIX}}reviewer is a PROCESS VIOLATION.
82529
-
82530
- 5j. {{AGENT_PREFIX}}reviewer - General review. REJECTED (< {{QA_RETRY_LIMIT}}) → coder retry. REJECTED ({{QA_RETRY_LIMIT}}) → escalate.
82531
- → REQUIRED: Print "reviewer: [APPROVED | REJECTED — reason]"
82532
- 5k. Security gate: if change matches TIER 3 criteria OR content contains SECURITY_KEYWORDS OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold → MUST delegate {{AGENT_PREFIX}}reviewer security-only review. REJECTED (< {{QA_RETRY_LIMIT}}) → coder retry. REJECTED ({{QA_RETRY_LIMIT}}) → escalate to user.
82533
- → REQUIRED: Print "security-reviewer: [TRIGGERED | NOT TRIGGERED — reason]"
82534
- → If TRIGGERED: Print "security-reviewer: [APPROVED | REJECTED — reason]"
82535
- 5l. {{AGENT_PREFIX}}test_engineer - Verification tests. FAIL → coder retry from 5g.
82536
- → REQUIRED: Print "testengineer-verification: [PASS N/N | FAIL — details]"
82537
- 5l-bis. REGRESSION SWEEP (automatic after test_engineer-verification PASS):
82538
- Run test_runner with { scope: "graph", files: [<all source files changed by coder in this task>] }.
82539
- scope:"graph" traces imports to discover test files beyond the task's own tests that may be affected by this change.
82540
-
82541
- Outcomes (based on test_runner result.outcome field):
82542
- - outcome: "pass" → All tests passed. Print "regression-sweep: PASS [N additional tests, M files]"
82543
- - outcome: "regression" → Tests ran but some failed. Print "regression-sweep: FAIL — REGRESSION DETECTED in [files]. The failing tests are CORRECT — fix the source code, not the tests." Return to coder with retry from 5g.
82544
- - outcome: "skip" → No test files resolved (nothing to run). Print "regression-sweep: SKIPPED — no related tests beyond task scope"
82545
- - outcome: "scope_exceeded" → Too many files for graph scope. Print "regression-sweep: SKIPPED — broad scope, no related tests beyond task scope"
82546
- - outcome: "error" → Tool error (timeout, no framework, etc.). Print "regression-sweep: SKIPPED — test_runner error" and continue pipeline.
82547
-
82548
- IMPORTANT: The regression sweep runs test_runner DIRECTLY (architect calls the tool). Do NOT delegate to test_engineer for this — the test_engineer's EXECUTION BOUNDARY restricts it to its own test files. The architect has unrestricted test_runner access.
82549
- → REQUIRED: Print "regression-sweep: [PASS | FAIL — REGRESSION DETECTED | SKIPPED — no related tests | SKIPPED — broad scope | SKIPPED — test_runner error]"
82550
-
82551
- 5l-ter. TEST DRIFT CHECK (conditional): Run this step if the change involves any drift-prone area:
82552
- - Command/CLI behavior changed (shell command wrappers, CLI interfaces)
82553
- - Parsing or routing logic changed (argument parsing, route matching, file resolution)
82554
- - User-visible output changed (formatted output, error messages, JSON response structure)
82555
- - Public contracts or schemas changed (API types, tool argument schemas, return types)
82556
- - Assertion-heavy areas where output strings are tested (command/help output tests, error message tests)
82557
- - Helper behavior or lifecycle semantics changed (state machines, lifecycle hooks, initialization)
82558
-
82559
- If NOT triggered: Print "test-drift: NOT TRIGGERED — no drift-prone change detected"
82560
- If TRIGGERED:
82561
- - Use grep/search to find test files that cover the affected functionality
82562
- - Run those tests via test_runner with scope:"convention" on the related test files
82563
- - If any FAIL → print "test-drift: DRIFT DETECTED in [N] tests" and escalate to reviewer/test_engineer
82564
- - If all PASS → print "test-drift: [N] related tests verified"
82565
- - If no related tests found → print "test-drift: NO RELATED TESTS FOUND" (not a failure)
82566
- → REQUIRED: Print "test-drift: [TRIGGERED | NOT TRIGGERED — reason]" and "[DRIFT DETECTED in N tests | N related tests verified | NO RELATED TESTS FOUND | NOT TRIGGERED]"
82567
-
82568
- 5n. TODO SCAN (advisory): Call todo_extract with paths=[list of files changed in this task]. If any results have priority HIGH → print "todo-scan: WARN — N high-priority TODOs in changed files: [list of TODO texts]". If no high-priority results → print "todo-scan: CLEAN". This is advisory only and does NOT block the pipeline.
82569
- → REQUIRED: Print "todo-scan: [WARN — N high-priority TODOs | CLEAN]"
82570
-
82571
- {{ADVERSARIAL_TEST_STEP}}
82572
- 5n. COVERAGE CHECK: If {{AGENT_PREFIX}}test_engineer reports coverage < 70% → delegate {{AGENT_PREFIX}}test_engineer for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.
82573
-
82574
- PRE-COMMIT RULE — Before ANY commit or push:
82575
- You MUST answer YES to ALL of the following:
82576
- [ ] Did {{AGENT_PREFIX}}reviewer run and return APPROVED? (not "I reviewed it" — the agent must have run)
82577
- [ ] Did {{AGENT_PREFIX}}test_engineer run and return PASS? (not "the code looks correct" — the agent must have run)
82578
- [ ] Did pre_check_batch run with gates_passed true?
82579
- [ ] Did the diff step run?
82580
- [ ] Did regression-sweep run (or SKIP with no related tests or test_runner error)?
82581
- [ ] Did test-drift check run (or NOT TRIGGERED)?
82582
-
82583
- If ANY box is unchecked: DO NOT COMMIT. Return to step 5b.
82584
- There is no override. A commit without a completed QA gate is a workflow violation.
82585
-
82586
- ## ROLE-BOUNDARY CHANGE VALIDATION (mandatory for prompt changes)
82587
- When a task modifies agent prompts (especially explorer, reviewer, critic, or any agent involved in the mapper/validator/challenge hierarchy), add an explicit test validation step:
82588
- - If new prompt contract tests exist (e.g., explorer-role-boundary.test.ts, explorer-consumer-contract.test.ts): Run them via test_runner
82589
- - If no specific tests exist for the changed prompt: Run test_runner with scope "convention" on the changed file
82590
- - Verify the new tests pass before completing the task
82591
-
82592
- This step supplements (not replaces) the existing regression-sweep and test-drift checks. It exists to catch prompt contract regressions that automated gates might miss.
82593
-
82594
- 5o. ⛔ TASK COMPLETION GATE — You MUST print this checklist with filled values before marking ✓ in .swarm/plan.md:
82595
- [TOOL] diff: PASS / SKIP — value: ___
82596
- [TOOL] syntax_check: PASS — value: ___
82597
- [TOOL] placeholder_scan: PASS — value: ___
82598
- [TOOL] imports: PASS — value: ___
82599
- [TOOL] lint: PASS — value: ___
82600
- [TOOL] build_check: PASS / SKIPPED — value: ___
82601
- [TOOL] pre_check_batch: PASS (lint:check ✓ secretscan ✓ sast_scan ✓ quality_budget ✓) — value: ___
82602
- [GATE] reviewer: APPROVED — value: ___
82603
- [GATE] reuse_re_verification: VERIFIED / SKIPPED / DUPLICATION_DETECTED — value: ___
82604
- [GATE] security-reviewer: APPROVED / SKIPPED — value: ___
82605
- [GATE] test_engineer-verification: PASS — value: ___
82606
- [GATE] regression-sweep: PASS / SKIPPED — value: ___
82607
- [GATE] test-drift: TRIGGERED / NOT TRIGGERED — value: ___
82608
- {{ADVERSARIAL_TEST_CHECKLIST}}
82609
- [GATE] coverage: ≥70% / soft-skip — value: ___
82610
-
82611
- You MUST NOT mark a task complete without printing this checklist with filled values.
82612
- You MUST NOT fill "PASS" or "APPROVED" for a gate you did not actually run — that is fabrication.
82613
- Any blank "value: ___" field = gate was not run = task is NOT complete.
82614
- Filling this checklist from memory ("I think I ran it") is INVALID. Each value must come from actual tool/agent output in this session.
82615
-
82616
- 5p. Call update_task_status with status "completed".
82617
- 5q. OPTIONAL TASK-COMPLETION COMMIT POLICY: read \`.swarm/context.md\`.
82618
- - If \`## Task Completion Commit Policy\` contains \`commit_after_each_completed_task: true\`, immediately call:
82619
- \`checkpoint save task-<task-id>-complete\`
82620
- - If the section is absent or false, skip this step.
82621
- - This optional commit policy NEVER bypasses PRE-COMMIT RULE checks above.
82622
- - If checkpoint save fails with "duplicate label", the task was already checkpointed from a prior completion or retry. Silently skip — the existing checkpoint is valid.
82623
- 5r. Proceed to next task.
82326
+ Activates when: MODE: CRITIC-GATE has approved a complete plan, or an existing approved plan is being resumed for implementation.
82327
+
82328
+ Purpose: Execute plan tasks through coder delegation, quality gates, retry handling, evidence capture, and task completion updates.
82624
82329
 
82330
+ ACTION: Load skill \`file:.opencode/skills/execute/SKILL.md\` immediately. Follow the protocol defined there.
82331
+
82332
+ HARD CONSTRAINTS (apply regardless of skill load success):
82333
+ - For each task, respect dependencies and delegate implementation to \`{{AGENT_PREFIX}}coder\`; do not self-fix ordinary gate failures.
82334
+ - Before coder implementation or retry, call \`declare_scope({ taskId, files })\` with the exact files the coder may touch.
82335
+ - On any gate failure, return to \`{{AGENT_PREFIX}}coder\` with structured rejection: \`GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]\`.
82336
+ - Required per-task gates include automated checks, reviewer gates, verification tests, regression sweep, test drift, TODO scan, and coverage guidance as detailed in the loaded skill.
82337
+ - Pre-commit constraint: do not commit or push unless reviewer, test_engineer, pre_check_batch, diff, regression-sweep, and test-drift have actually run or skipped according to the loaded protocol.
82338
+ - ROLE-BOUNDARY CHANGE VALIDATION is mandatory for prompt changes; run the focused prompt contract tests or convention tests for changed prompt files.
82339
+ - TASK COMPLETION GATE: Completion checklist must be printed with filled values before marking a task complete. It includes regression-sweep and test-drift entries; blank \`value: ___\` fields mean the task is not complete.
82340
+ - Config-specific adversarial test step rendered from plugin config:
82341
+ {{ADVERSARIAL_TEST_STEP}}
82342
+ - Config-specific adversarial checklist entry rendered from plugin config:
82343
+ {{ADVERSARIAL_TEST_CHECKLIST}}
82625
82344
  ## ⛔ RETROSPECTIVE GATE
82626
82345
 
82627
82346
  **MANDATORY before calling phase_complete.** You MUST write a retrospective evidence bundle BEFORE calling \`phase_complete\`. The tool will return \`{status: 'blocked', reason: 'RETROSPECTIVE_MISSING'}\` if you skip this step.
@@ -90614,9 +90333,9 @@ class PlanSyncWorker {
90614
90333
  try {
90615
90334
  log("[PlanSyncWorker] Syncing plan...");
90616
90335
  this.checkForUnauthorizedWrite();
90617
- const plan = await this.withTimeout(loadPlanJsonOnly(this.directory), this.syncTimeoutMs, "Sync operation timed out");
90336
+ const plan = await this.withTimeout(_internals6.loadPlanJsonOnly(this.directory), this.syncTimeoutMs, "Sync operation timed out");
90618
90337
  if (plan && plan.phases.length > 0) {
90619
- await regeneratePlanMarkdown(this.directory, plan);
90338
+ await _internals6.regeneratePlanMarkdown(this.directory, plan);
90620
90339
  log("[PlanSyncWorker] Sync complete", {
90621
90340
  title: plan.title,
90622
90341
  phase: plan.current_phase
@@ -104012,6 +103731,9 @@ function deserializeAgentSession(s) {
104012
103731
  }
104013
103732
  const windows = {};
104014
103733
  for (const [key, win] of Object.entries(s.windows ?? {})) {
103734
+ if (!win || typeof win !== "object") {
103735
+ continue;
103736
+ }
104015
103737
  windows[key] = {
104016
103738
  ...win,
104017
103739
  transientRetryCount: "transientRetryCount" in win ? win.transientRetryCount ?? 0 : 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.41.0",
3
+ "version": "7.41.1",
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",