opencode-swarm 6.13.1 → 6.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -310,6 +310,8 @@ Per-agent overrides:
310
310
  | build_check | Runs your project's native build/typecheck |
311
311
  | quality_budget | Enforces complexity, duplication, and test ratio limits |
312
312
  | pre_check_batch | Runs lint, secretscan, SAST, and quality budget in parallel (~15s vs ~60s sequential) |
313
+ | phase_complete | Enforces phase completion, verifies required agents, requires a valid retrospective evidence bundle, logs events, and resets state |
314
+
313
315
 
314
316
  All tools run locally. No Docker, no network calls, no external APIs.
315
317
 
@@ -586,11 +588,30 @@ The following tools can be assigned to agents via overrides:
586
588
  | `symbols` | Extract exported symbols |
587
589
  | `test_runner` | Run project tests |
588
590
  | `todo_extract` | Extract TODO/FIXME comments |
591
+ | `phase_complete` | Enforces phase completion, verifies required agents, logs events, resets state |
589
592
 
590
593
  ---
591
594
 
592
595
  ## Recent Changes
593
596
 
597
+ ### v6.13.2 — Pipeline Enforcement
598
+
599
+ This release adds enforcement-layer tooling and self-healing guardrails:
600
+
601
+ - **`phase_complete` tool**: Verifies all required agents were dispatched before a phase closes; emits events to `.swarm/events.jsonl`; configurable `enforce`/`warn` policy
602
+ - **Summarization loop fix**: `exempt_tools` config prevents `retrieve_summary` and `task` outputs from being re-summarized (fixes Issue #8)
603
+ - **Same-model adversarial detection**: Warns when coder and reviewer share the same model; `warn`/`gate`/`ignore` policy
604
+ - **Architect test guardrail (HF-1b)**: Prevents architect from running full `bun test` suite — must target specific files one at a time
605
+ - **Docs**: `docs/swarm-briefing.md` (LLM pipeline briefing), Task Field Reference in `docs/planning.md`
606
+
607
+ ### v6.13.1 — Consolidation & Defaults Fix
608
+
609
+ - **`consolidateSystemMessages`**: Merges multiple system messages into one at index 0
610
+ - **Test isolation helpers**: `createIsolatedTestEnv` and `assertSafeForWrite`
611
+ - **Coder self-verify guardrail (HF-1)**: Coder and test_engineer agents blocked from running build/test/lint
612
+ - **`/swarm` template fix**: `{{arguments}}` → `$ARGUMENTS`
613
+ - **DEFAULT_MODELS update**: `claude-sonnet-4-5` → `claude-sonnet-4-20250514`, `gemini-2.0-flash` → `gemini-2.5-flash`
614
+
594
615
  ### v6.13.0 — Context Efficiency
595
616
 
596
617
  This release focuses on reducing context usage and improving mode-conditional behavior:
@@ -650,6 +671,8 @@ Upcoming: v6.14 focuses on further context optimization and agent coordination i
650
671
  - [Design Rationale](docs/design-rationale.md)
651
672
  - [Installation Guide](docs/installation.md)
652
673
  - [Linux + Docker Desktop Install Guide](docs/installation-linux-docker.md)
674
+ - [Pre-Swarm Planning Guide](docs/planning.md)
675
+ - [Swarm Briefing for LLMs](docs/swarm-briefing.md)
653
676
 
654
677
  ---
655
678
 
@@ -191,6 +191,30 @@ export declare const RetrospectiveEvidenceSchema: z.ZodObject<{
191
191
  }>;
192
192
  top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
193
193
  lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
194
+ user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
195
+ directive: z.ZodString;
196
+ category: z.ZodEnum<{
197
+ tooling: "tooling";
198
+ code_style: "code_style";
199
+ architecture: "architecture";
200
+ process: "process";
201
+ other: "other";
202
+ }>;
203
+ scope: z.ZodEnum<{
204
+ project: "project";
205
+ session: "session";
206
+ global: "global";
207
+ }>;
208
+ }, z.core.$strip>>>;
209
+ approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
210
+ approach: z.ZodString;
211
+ result: z.ZodEnum<{
212
+ success: "success";
213
+ failure: "failure";
214
+ partial: "partial";
215
+ }>;
216
+ abandoned_reason: z.ZodOptional<z.ZodString>;
217
+ }, z.core.$strip>>>;
194
218
  }, z.core.$strip>;
195
219
  export type RetrospectiveEvidence = z.infer<typeof RetrospectiveEvidenceSchema>;
196
220
  export declare const SyntaxEvidenceSchema: z.ZodObject<{
@@ -242,9 +266,9 @@ export declare const PlaceholderEvidenceSchema: z.ZodObject<{
242
266
  line: z.ZodNumber;
243
267
  kind: z.ZodEnum<{
244
268
  string: "string";
269
+ other: "other";
245
270
  comment: "comment";
246
271
  function_body: "function_body";
247
- other: "other";
248
272
  }>;
249
273
  excerpt: z.ZodString;
250
274
  rule_id: z.ZodString;
@@ -535,6 +559,30 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
535
559
  }>;
536
560
  top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
537
561
  lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
562
+ user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
563
+ directive: z.ZodString;
564
+ category: z.ZodEnum<{
565
+ tooling: "tooling";
566
+ code_style: "code_style";
567
+ architecture: "architecture";
568
+ process: "process";
569
+ other: "other";
570
+ }>;
571
+ scope: z.ZodEnum<{
572
+ project: "project";
573
+ session: "session";
574
+ global: "global";
575
+ }>;
576
+ }, z.core.$strip>>>;
577
+ approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
578
+ approach: z.ZodString;
579
+ result: z.ZodEnum<{
580
+ success: "success";
581
+ failure: "failure";
582
+ partial: "partial";
583
+ }>;
584
+ abandoned_reason: z.ZodOptional<z.ZodString>;
585
+ }, z.core.$strip>>>;
538
586
  }, z.core.$strip>, z.ZodObject<{
539
587
  task_id: z.ZodString;
540
588
  timestamp: z.ZodString;
@@ -582,9 +630,9 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
582
630
  line: z.ZodNumber;
583
631
  kind: z.ZodEnum<{
584
632
  string: "string";
633
+ other: "other";
585
634
  comment: "comment";
586
635
  function_body: "function_body";
587
- other: "other";
588
636
  }>;
589
637
  excerpt: z.ZodString;
590
638
  rule_id: z.ZodString;
@@ -870,6 +918,30 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
870
918
  }>;
871
919
  top_rejection_reasons: z.ZodDefault<z.ZodArray<z.ZodString>>;
872
920
  lessons_learned: z.ZodDefault<z.ZodArray<z.ZodString>>;
921
+ user_directives: z.ZodDefault<z.ZodArray<z.ZodObject<{
922
+ directive: z.ZodString;
923
+ category: z.ZodEnum<{
924
+ tooling: "tooling";
925
+ code_style: "code_style";
926
+ architecture: "architecture";
927
+ process: "process";
928
+ other: "other";
929
+ }>;
930
+ scope: z.ZodEnum<{
931
+ project: "project";
932
+ session: "session";
933
+ global: "global";
934
+ }>;
935
+ }, z.core.$strip>>>;
936
+ approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
937
+ approach: z.ZodString;
938
+ result: z.ZodEnum<{
939
+ success: "success";
940
+ failure: "failure";
941
+ partial: "partial";
942
+ }>;
943
+ abandoned_reason: z.ZodOptional<z.ZodString>;
944
+ }, z.core.$strip>>>;
873
945
  }, z.core.$strip>, z.ZodObject<{
874
946
  task_id: z.ZodString;
875
947
  timestamp: z.ZodString;
@@ -917,9 +989,9 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
917
989
  line: z.ZodNumber;
918
990
  kind: z.ZodEnum<{
919
991
  string: "string";
992
+ other: "other";
920
993
  comment: "comment";
921
994
  function_body: "function_body";
922
- other: "other";
923
995
  }>;
924
996
  excerpt: z.ZodString;
925
997
  rule_id: z.ZodString;
@@ -5,5 +5,5 @@ export { ApprovalEvidenceSchema, BaseEvidenceSchema, DiffEvidenceSchema, EVIDENC
5
5
  export { loadAgentPrompt, loadPluginConfig, loadPluginConfigWithMeta, } from './loader';
6
6
  export type { MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskStatus, } from './plan-schema';
7
7
  export { MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
8
- export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, PipelineConfig, PluginConfig, SwarmConfig, } from './schema';
9
- export { AgentOverrideConfigSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, PipelineConfigSchema, PluginConfigSchema, SwarmConfigSchema, } from './schema';
8
+ export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, PhaseCompleteConfig, PipelineConfig, PluginConfig, SwarmConfig, } from './schema';
9
+ export { AgentOverrideConfigSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, PhaseCompleteConfigSchema, PipelineConfigSchema, PluginConfigSchema, SwarmConfigSchema, } from './schema';
@@ -190,12 +190,27 @@ export declare const PipelineConfigSchema: z.ZodObject<{
190
190
  parallel_precheck: z.ZodDefault<z.ZodBoolean>;
191
191
  }, z.core.$strip>;
192
192
  export type PipelineConfig = z.infer<typeof PipelineConfigSchema>;
193
+ export declare const PhaseCompleteConfigSchema: z.ZodObject<{
194
+ enabled: z.ZodDefault<z.ZodBoolean>;
195
+ required_agents: z.ZodDefault<z.ZodArray<z.ZodEnum<{
196
+ reviewer: "reviewer";
197
+ coder: "coder";
198
+ test_engineer: "test_engineer";
199
+ }>>>;
200
+ require_docs: z.ZodDefault<z.ZodBoolean>;
201
+ policy: z.ZodDefault<z.ZodEnum<{
202
+ enforce: "enforce";
203
+ warn: "warn";
204
+ }>>;
205
+ }, z.core.$strip>;
206
+ export type PhaseCompleteConfig = z.infer<typeof PhaseCompleteConfigSchema>;
193
207
  export declare const SummaryConfigSchema: z.ZodObject<{
194
208
  enabled: z.ZodDefault<z.ZodBoolean>;
195
209
  threshold_bytes: z.ZodDefault<z.ZodNumber>;
196
210
  max_summary_chars: z.ZodDefault<z.ZodNumber>;
197
211
  max_stored_bytes: z.ZodDefault<z.ZodNumber>;
198
212
  retention_days: z.ZodDefault<z.ZodNumber>;
213
+ exempt_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
199
214
  }, z.core.$strip>;
200
215
  export type SummaryConfig = z.infer<typeof SummaryConfigSchema>;
201
216
  export declare const ReviewPassesConfigSchema: z.ZodObject<{
@@ -203,6 +218,16 @@ export declare const ReviewPassesConfigSchema: z.ZodObject<{
203
218
  security_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
204
219
  }, z.core.$strip>;
205
220
  export type ReviewPassesConfig = z.infer<typeof ReviewPassesConfigSchema>;
221
+ export declare const AdversarialDetectionConfigSchema: z.ZodObject<{
222
+ enabled: z.ZodDefault<z.ZodBoolean>;
223
+ policy: z.ZodDefault<z.ZodEnum<{
224
+ warn: "warn";
225
+ gate: "gate";
226
+ ignore: "ignore";
227
+ }>>;
228
+ pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
229
+ }, z.core.$strip>;
230
+ export type AdversarialDetectionConfig = z.infer<typeof AdversarialDetectionConfigSchema>;
206
231
  export declare const IntegrationAnalysisConfigSchema: z.ZodObject<{
207
232
  enabled: z.ZodDefault<z.ZodBoolean>;
208
233
  }, z.core.$strip>;
@@ -367,6 +392,19 @@ export declare const PluginConfigSchema: z.ZodObject<{
367
392
  pipeline: z.ZodOptional<z.ZodObject<{
368
393
  parallel_precheck: z.ZodDefault<z.ZodBoolean>;
369
394
  }, z.core.$strip>>;
395
+ phase_complete: z.ZodOptional<z.ZodObject<{
396
+ enabled: z.ZodDefault<z.ZodBoolean>;
397
+ required_agents: z.ZodDefault<z.ZodArray<z.ZodEnum<{
398
+ reviewer: "reviewer";
399
+ coder: "coder";
400
+ test_engineer: "test_engineer";
401
+ }>>>;
402
+ require_docs: z.ZodDefault<z.ZodBoolean>;
403
+ policy: z.ZodDefault<z.ZodEnum<{
404
+ enforce: "enforce";
405
+ warn: "warn";
406
+ }>>;
407
+ }, z.core.$strip>>;
370
408
  qa_retry_limit: z.ZodDefault<z.ZodNumber>;
371
409
  inject_phase_reminders: z.ZodDefault<z.ZodBoolean>;
372
410
  hooks: z.ZodOptional<z.ZodObject<{
@@ -479,11 +517,21 @@ export declare const PluginConfigSchema: z.ZodObject<{
479
517
  max_summary_chars: z.ZodDefault<z.ZodNumber>;
480
518
  max_stored_bytes: z.ZodDefault<z.ZodNumber>;
481
519
  retention_days: z.ZodDefault<z.ZodNumber>;
520
+ exempt_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
482
521
  }, z.core.$strip>>;
483
522
  review_passes: z.ZodOptional<z.ZodObject<{
484
523
  always_security_review: z.ZodDefault<z.ZodBoolean>;
485
524
  security_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
486
525
  }, z.core.$strip>>;
526
+ adversarial_detection: z.ZodOptional<z.ZodObject<{
527
+ enabled: z.ZodDefault<z.ZodBoolean>;
528
+ policy: z.ZodDefault<z.ZodEnum<{
529
+ warn: "warn";
530
+ gate: "gate";
531
+ ignore: "ignore";
532
+ }>>;
533
+ pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
534
+ }, z.core.$strip>>;
487
535
  integration_analysis: z.ZodOptional<z.ZodObject<{
488
536
  enabled: z.ZodDefault<z.ZodBoolean>;
489
537
  }, z.core.$strip>>;
@@ -0,0 +1,15 @@
1
+ import type { PluginConfig } from '../config';
2
+ /**
3
+ * Resolve the model for a given agent by checking config overrides,
4
+ * swarm configurations, and falling back to defaults.
5
+ */
6
+ export declare function resolveAgentModel(agentName: string, config: PluginConfig): string;
7
+ /**
8
+ * Detect if two agents share the same model (adversarial pair).
9
+ * Returns the shared model string if matched, null otherwise.
10
+ */
11
+ export declare function detectAdversarialPair(agentA: string, agentB: string, config: PluginConfig): string | null;
12
+ /**
13
+ * Format an adversarial warning message based on policy.
14
+ */
15
+ export declare function formatAdversarialWarning(agentA: string, agentB: string, sharedModel: string, policy: string): string;
@@ -6,6 +6,13 @@
6
6
  * Reads plan.md and injects phase context into the system prompt.
7
7
  */
8
8
  import type { PluginConfig } from '../config';
9
+ /**
10
+ * Build a retrospective injection string for the architect system message.
11
+ * Tier 1: direct phase-scoped lookup for same-plan previous phase.
12
+ * Tier 2: cross-project historical lessons (Phase 1 only).
13
+ * Returns null if no valid retrospective found.
14
+ */
15
+ export declare function buildRetroInjection(directory: string, currentPhaseNumber: number, currentPlanTitle?: string): Promise<string | null>;
9
16
  /**
10
17
  * Creates the experimental.chat.system.transform hook for system enhancement.
11
18
  */