opencode-swarm-plugin 0.22.0 → 0.23.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.
Files changed (128) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +109 -429
  4. package/dist/agent-mail.d.ts +480 -0
  5. package/dist/agent-mail.d.ts.map +1 -0
  6. package/dist/anti-patterns.d.ts +257 -0
  7. package/dist/anti-patterns.d.ts.map +1 -0
  8. package/dist/beads.d.ts +377 -0
  9. package/dist/beads.d.ts.map +1 -0
  10. package/dist/eval-capture.d.ts +206 -0
  11. package/dist/eval-capture.d.ts.map +1 -0
  12. package/dist/index.d.ts +1299 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +498 -4246
  15. package/dist/learning.d.ts +670 -0
  16. package/dist/learning.d.ts.map +1 -0
  17. package/dist/mandate-promotion.d.ts +93 -0
  18. package/dist/mandate-promotion.d.ts.map +1 -0
  19. package/dist/mandate-storage.d.ts +209 -0
  20. package/dist/mandate-storage.d.ts.map +1 -0
  21. package/dist/mandates.d.ts +230 -0
  22. package/dist/mandates.d.ts.map +1 -0
  23. package/dist/output-guardrails.d.ts +125 -0
  24. package/dist/output-guardrails.d.ts.map +1 -0
  25. package/dist/pattern-maturity.d.ts +246 -0
  26. package/dist/pattern-maturity.d.ts.map +1 -0
  27. package/dist/plugin.d.ts +22 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +493 -4241
  30. package/dist/rate-limiter.d.ts +218 -0
  31. package/dist/rate-limiter.d.ts.map +1 -0
  32. package/dist/repo-crawl.d.ts +146 -0
  33. package/dist/repo-crawl.d.ts.map +1 -0
  34. package/dist/schemas/bead.d.ts +255 -0
  35. package/dist/schemas/bead.d.ts.map +1 -0
  36. package/dist/schemas/evaluation.d.ts +161 -0
  37. package/dist/schemas/evaluation.d.ts.map +1 -0
  38. package/dist/schemas/index.d.ts +34 -0
  39. package/dist/schemas/index.d.ts.map +1 -0
  40. package/dist/schemas/mandate.d.ts +336 -0
  41. package/dist/schemas/mandate.d.ts.map +1 -0
  42. package/dist/schemas/swarm-context.d.ts +131 -0
  43. package/dist/schemas/swarm-context.d.ts.map +1 -0
  44. package/dist/schemas/task.d.ts +188 -0
  45. package/dist/schemas/task.d.ts.map +1 -0
  46. package/dist/skills.d.ts +471 -0
  47. package/dist/skills.d.ts.map +1 -0
  48. package/dist/storage.d.ts +260 -0
  49. package/dist/storage.d.ts.map +1 -0
  50. package/dist/structured.d.ts +196 -0
  51. package/dist/structured.d.ts.map +1 -0
  52. package/dist/swarm-decompose.d.ts +201 -0
  53. package/dist/swarm-decompose.d.ts.map +1 -0
  54. package/dist/swarm-mail.d.ts +240 -0
  55. package/dist/swarm-mail.d.ts.map +1 -0
  56. package/dist/swarm-orchestrate.d.ts +708 -0
  57. package/dist/swarm-orchestrate.d.ts.map +1 -0
  58. package/dist/swarm-prompts.d.ts +292 -0
  59. package/dist/swarm-prompts.d.ts.map +1 -0
  60. package/dist/swarm-strategies.d.ts +100 -0
  61. package/dist/swarm-strategies.d.ts.map +1 -0
  62. package/dist/swarm.d.ts +455 -0
  63. package/dist/swarm.d.ts.map +1 -0
  64. package/dist/tool-availability.d.ts +91 -0
  65. package/dist/tool-availability.d.ts.map +1 -0
  66. package/docs/planning/ADR-001-monorepo-structure.md +171 -0
  67. package/docs/planning/ADR-002-package-extraction.md +393 -0
  68. package/docs/planning/ADR-003-performance-improvements.md +451 -0
  69. package/docs/planning/ADR-004-message-queue-features.md +187 -0
  70. package/docs/planning/ADR-005-devtools-observability.md +202 -0
  71. package/docs/planning/ROADMAP.md +368 -0
  72. package/package.json +13 -24
  73. package/src/agent-mail.ts +1 -1
  74. package/src/beads.ts +1 -2
  75. package/src/index.ts +2 -2
  76. package/src/learning.integration.test.ts +66 -11
  77. package/src/mandate-storage.test.ts +3 -3
  78. package/src/storage.ts +78 -10
  79. package/src/swarm-mail.ts +3 -3
  80. package/src/swarm-orchestrate.ts +7 -7
  81. package/src/tool-availability.ts +1 -1
  82. package/tsconfig.json +1 -1
  83. package/.beads/.local_version +0 -1
  84. package/.beads/README.md +0 -81
  85. package/.beads/analysis/skill-architecture-meta-skills.md +0 -1562
  86. package/.beads/config.yaml +0 -62
  87. package/.beads/issues.jsonl +0 -2197
  88. package/.beads/metadata.json +0 -4
  89. package/.gitattributes +0 -3
  90. package/.github/workflows/ci.yml +0 -30
  91. package/.github/workflows/opencode.yml +0 -31
  92. package/.opencode/skills/tdd/SKILL.md +0 -182
  93. package/INTEGRATION_EXAMPLE.md +0 -66
  94. package/VERIFICATION_QUALITY_PATTERNS.md +0 -565
  95. package/bun.lock +0 -286
  96. package/dist/pglite.data +0 -0
  97. package/dist/pglite.wasm +0 -0
  98. package/src/streams/agent-mail.test.ts +0 -777
  99. package/src/streams/agent-mail.ts +0 -535
  100. package/src/streams/debug.test.ts +0 -500
  101. package/src/streams/debug.ts +0 -727
  102. package/src/streams/effect/ask.integration.test.ts +0 -314
  103. package/src/streams/effect/ask.ts +0 -202
  104. package/src/streams/effect/cursor.integration.test.ts +0 -418
  105. package/src/streams/effect/cursor.ts +0 -288
  106. package/src/streams/effect/deferred.test.ts +0 -357
  107. package/src/streams/effect/deferred.ts +0 -445
  108. package/src/streams/effect/index.ts +0 -17
  109. package/src/streams/effect/layers.ts +0 -73
  110. package/src/streams/effect/lock.test.ts +0 -385
  111. package/src/streams/effect/lock.ts +0 -399
  112. package/src/streams/effect/mailbox.test.ts +0 -260
  113. package/src/streams/effect/mailbox.ts +0 -318
  114. package/src/streams/events.test.ts +0 -924
  115. package/src/streams/events.ts +0 -329
  116. package/src/streams/index.test.ts +0 -229
  117. package/src/streams/index.ts +0 -578
  118. package/src/streams/migrations.test.ts +0 -359
  119. package/src/streams/migrations.ts +0 -362
  120. package/src/streams/projections.test.ts +0 -611
  121. package/src/streams/projections.ts +0 -504
  122. package/src/streams/store.integration.test.ts +0 -658
  123. package/src/streams/store.ts +0 -1075
  124. package/src/streams/swarm-mail.ts +0 -552
  125. package/test-bug-fixes.ts +0 -86
  126. package/vitest.integration.config.ts +0 -19
  127. package/vitest.integration.setup.ts +0 -48
  128. package/workflow-integration-analysis.md +0 -876
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-orchestrate.d.ts","sourceRoot":"","sources":["../src/swarm-orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgiBxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;;;CAuGrB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;CAoFvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAoIzB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CA6E1B,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ezB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJ/B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;CA6CjC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;CAmClC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;CAmB9B,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CAoJ9B,CAAC;AA4BH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyH3B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAgGxB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgMtB,CAAC;AAMH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAc5B,CAAC"}
@@ -0,0 +1,292 @@
1
+ /**
2
+ * Swarm Prompts Module - Prompt templates and generation
3
+ *
4
+ * Provides all prompt templates used for swarm coordination:
5
+ * - Decomposition prompts (basic and strategy-specific)
6
+ * - Subtask agent prompts (V1 and V2)
7
+ * - Evaluation prompts
8
+ *
9
+ * Key responsibilities:
10
+ * - Prompt template definitions
11
+ * - Prompt formatting/generation tools
12
+ * - Template parameter substitution
13
+ */
14
+ /**
15
+ * Prompt for decomposing a task into parallelizable subtasks.
16
+ *
17
+ * Used by swarm_decompose to instruct the agent on how to break down work.
18
+ * The agent responds with a BeadTree that gets validated.
19
+ */
20
+ export declare const DECOMPOSITION_PROMPT = "You are decomposing a task into parallelizable subtasks for a swarm of agents.\n\n## Task\n{task}\n\n{context_section}\n\n## MANDATORY: Beads Issue Tracking\n\n**Every subtask MUST become a bead.** This is non-negotiable.\n\nAfter decomposition, the coordinator will:\n1. Create an epic bead for the overall task\n2. Create child beads for each subtask\n3. Track progress through bead status updates\n4. Close beads with summaries when complete\n\nAgents MUST update their bead status as they work. No silent progress.\n\n## Requirements\n\n1. **Break into 2-{max_subtasks} independent subtasks** that can run in parallel\n2. **Assign files** - each subtask must specify which files it will modify\n3. **No file overlap** - files cannot appear in multiple subtasks (they get exclusive locks)\n4. **Order by dependency** - if subtask B needs subtask A's output, A must come first in the array\n5. **Estimate complexity** - 1 (trivial) to 5 (complex)\n6. **Plan aggressively** - break down more than you think necessary, smaller is better\n\n## Response Format\n\nRespond with a JSON object matching this schema:\n\n```typescript\n{\n epic: {\n title: string, // Epic title for the beads tracker\n description?: string // Brief description of the overall goal\n },\n subtasks: [\n {\n title: string, // What this subtask accomplishes\n description?: string, // Detailed instructions for the agent\n files: string[], // Files this subtask will modify (globs allowed)\n dependencies: number[], // Indices of subtasks this depends on (0-indexed)\n estimated_complexity: 1-5 // Effort estimate\n },\n // ... more subtasks\n ]\n}\n```\n\n## Guidelines\n\n- **Plan aggressively** - when in doubt, split further. 3 small tasks > 1 medium task\n- **Prefer smaller, focused subtasks** over large complex ones\n- **Include test files** in the same subtask as the code they test\n- **Consider shared types** - if multiple files share types, handle that first\n- **Think about imports** - changes to exported APIs affect downstream files\n- **Explicit > implicit** - spell out what each subtask should do, don't assume\n\n## File Assignment Examples\n\n- Schema change: `[\"src/schemas/user.ts\", \"src/schemas/index.ts\"]`\n- Component + test: `[\"src/components/Button.tsx\", \"src/components/Button.test.tsx\"]`\n- API route: `[\"src/app/api/users/route.ts\"]`\n\nNow decompose the task:";
21
+ /**
22
+ * Strategy-specific decomposition prompt template
23
+ */
24
+ export declare const STRATEGY_DECOMPOSITION_PROMPT = "You are decomposing a task into parallelizable subtasks for a swarm of agents.\n\n## Task\n{task}\n\n{strategy_guidelines}\n\n{context_section}\n\n{cass_history}\n\n{skills_context}\n\n## MANDATORY: Beads Issue Tracking\n\n**Every subtask MUST become a bead.** This is non-negotiable.\n\nAfter decomposition, the coordinator will:\n1. Create an epic bead for the overall task\n2. Create child beads for each subtask\n3. Track progress through bead status updates\n4. Close beads with summaries when complete\n\nAgents MUST update their bead status as they work. No silent progress.\n\n## Requirements\n\n1. **Break into 2-{max_subtasks} independent subtasks** that can run in parallel\n2. **Assign files** - each subtask must specify which files it will modify\n3. **No file overlap** - files cannot appear in multiple subtasks (they get exclusive locks)\n4. **Order by dependency** - if subtask B needs subtask A's output, A must come first in the array\n5. **Estimate complexity** - 1 (trivial) to 5 (complex)\n6. **Plan aggressively** - break down more than you think necessary, smaller is better\n\n## Response Format\n\nRespond with a JSON object matching this schema:\n\n```typescript\n{\n epic: {\n title: string, // Epic title for the beads tracker\n description?: string // Brief description of the overall goal\n },\n subtasks: [\n {\n title: string, // What this subtask accomplishes\n description?: string, // Detailed instructions for the agent\n files: string[], // Files this subtask will modify (globs allowed)\n dependencies: number[], // Indices of subtasks this depends on (0-indexed)\n estimated_complexity: 1-5 // Effort estimate\n },\n // ... more subtasks\n ]\n}\n```\n\nNow decompose the task:";
25
+ /**
26
+ * Prompt template for spawned subtask agents.
27
+ *
28
+ * Each agent receives this prompt with their specific subtask details filled in.
29
+ * The prompt establishes context, constraints, and expectations.
30
+ */
31
+ export declare const SUBTASK_PROMPT = "You are a swarm agent working on a subtask of a larger epic.\n\n## Your Identity\n- **Agent Name**: {agent_name}\n- **Bead ID**: {bead_id}\n- **Epic ID**: {epic_id}\n\n## Your Subtask\n**Title**: {subtask_title}\n\n{subtask_description}\n\n## File Scope\nYou have exclusive reservations for these files:\n{file_list}\n\n**CRITICAL**: Only modify files in your reservation. If you need to modify other files, \nsend a message to the coordinator requesting the change.\n\n## Shared Context\n{shared_context}\n\n## MANDATORY: Beads Tracking\n\nYou MUST keep your bead updated as you work:\n\n1. **Your bead is already in_progress** - don't change this unless blocked\n2. **If blocked**: `bd update {bead_id} --status blocked` and message coordinator\n3. **When done**: Use `swarm_complete` - it closes your bead automatically\n4. **Discovered issues**: Create new beads with `bd create \"issue\" -t bug`\n\n**Never work silently.** Your bead status is how the swarm tracks progress.\n\n## MANDATORY: Swarm Mail Communication\n\nYou MUST communicate with other agents:\n\n1. **Report progress** every significant milestone (not just at the end)\n2. **Ask questions** if requirements are unclear - don't guess\n3. **Announce blockers** immediately - don't spin trying to fix alone\n4. **Coordinate on shared concerns** - if you see something affecting other agents, say so\n\nUse Swarm Mail for all communication:\n```\nswarmmail_send(\n to: [\"coordinator\" or specific agent],\n subject: \"Brief subject\",\n body: \"Message content\",\n thread_id: \"{epic_id}\"\n)\n```\n\n## Coordination Protocol\n\n1. **Start**: Your bead is already marked in_progress\n2. **Progress**: Use swarm_progress to report status updates\n3. **Blocked**: Report immediately via Swarm Mail - don't spin\n4. **Complete**: Use swarm_complete when done - it handles:\n - Closing your bead with a summary\n - Releasing file reservations\n - Notifying the coordinator\n\n## Self-Evaluation\n\nBefore calling swarm_complete, evaluate your work:\n- Type safety: Does it compile without errors?\n- No obvious bugs: Did you handle edge cases?\n- Follows patterns: Does it match existing code style?\n- Readable: Would another developer understand it?\n\nIf evaluation fails, fix the issues before completing.\n\n## Planning Your Work\n\nBefore writing code:\n1. **Read the files** you're assigned to understand current state\n2. **Plan your approach** - what changes, in what order?\n3. **Identify risks** - what could go wrong? What dependencies?\n4. **Communicate your plan** via Swarm Mail if non-trivial\n\nBegin work on your subtask now.";
32
+ /**
33
+ * Streamlined subtask prompt (V2) - uses Swarm Mail and beads
34
+ *
35
+ * This is a cleaner version of SUBTASK_PROMPT that's easier to parse.
36
+ * Agents MUST use Swarm Mail for communication and beads for tracking.
37
+ *
38
+ * Supports {error_context} placeholder for retry prompts.
39
+ */
40
+ export declare const SUBTASK_PROMPT_V2 = "You are a swarm agent working on: **{subtask_title}**\n\n## [IDENTITY]\nAgent: (assigned at spawn)\nBead: {bead_id}\nEpic: {epic_id}\n\n## [TASK]\n{subtask_description}\n\n## [FILES]\nReserved (exclusive):\n{file_list}\n\nOnly modify these files. Need others? Message the coordinator.\n\n## [CONTEXT]\n{shared_context}\n\n{compressed_context}\n\n{error_context}\n\n## [MANDATORY: SWARM MAIL INITIALIZATION]\n\n**CRITICAL: YOU MUST INITIALIZE SWARM MAIL BEFORE DOING ANY WORK.**\n\nThis is your FIRST step - before reading files, before planning, before ANY other action.\n\n### Step 1: Initialize (REQUIRED - DO THIS FIRST)\n```\nswarmmail_init(project_path=\"{project_path}\", task_description=\"{bead_id}: {subtask_title}\")\n```\n\n**This registers you with the coordination system and enables:**\n- File reservation tracking\n- Inter-agent communication\n- Progress monitoring\n- Conflict detection\n\n**If you skip this step, your work will not be tracked and swarm_complete will fail.**\n\n## [SWARM MAIL USAGE]\n\nAfter initialization, use Swarm Mail for coordination:\n\n### Check Inbox Regularly\n```\nswarmmail_inbox() # Check for coordinator messages\nswarmmail_read_message(message_id=N) # Read specific message\n```\n\n### Report Progress (REQUIRED - don't work silently)\n```\nswarmmail_send(\n to=[\"coordinator\"],\n subject=\"Progress: {bead_id}\",\n body=\"<what you did, blockers, questions>\",\n thread_id=\"{epic_id}\"\n)\n```\n\n### When Blocked\n```\nswarmmail_send(\n to=[\"coordinator\"],\n subject=\"BLOCKED: {bead_id}\",\n body=\"<blocker description, what you need>\",\n importance=\"high\",\n thread_id=\"{epic_id}\"\n)\nbeads_update(id=\"{bead_id}\", status=\"blocked\")\n```\n\n### Release Files When Done\n```\nswarmmail_release() # Or let swarm_complete handle it\n```\n\n## [OTHER TOOLS]\n### Beads\n- beads_update(id, status) - Mark blocked if stuck\n- beads_create(title, type) - Log new bugs found\n\n### Skills (if available)\n- skills_list() - Discover available skills\n- skills_use(name) - Activate skill for specialized guidance\n\n### Completion (REQUIRED)\n- swarm_complete(project_key, agent_name, bead_id, summary, files_touched)\n\n## [LEARNING]\nAs you work, note reusable patterns, best practices, or domain insights:\n- If you discover something that would help future agents, consider creating a skill\n- Use skills_create to codify patterns for the project\n- Good skills have clear \"when to use\" descriptions with actionable instructions\n- Skills make swarms smarter over time\n\n## [WORKFLOW]\n1. **swarmmail_init** - Initialize session (MANDATORY FIRST STEP)\n2. Read assigned files\n3. Implement changes\n4. **swarmmail_send** - Report progress to coordinator\n5. Verify (typecheck)\n6. **swarm_complete** - Mark done, release reservations\n\n**CRITICAL REQUIREMENTS:**\n- Step 1 (swarmmail_init) is NON-NEGOTIABLE - do it before anything else\n- Never work silently - send progress updates via swarmmail_send every significant milestone\n- If you complete without initializing, swarm_complete will detect this and warn/fail\n\nBegin now.";
41
+ /**
42
+ * Prompt for self-evaluation before completing a subtask.
43
+ *
44
+ * Agents use this to assess their work quality before marking complete.
45
+ */
46
+ export declare const EVALUATION_PROMPT = "Evaluate the work completed for this subtask.\n\n## Subtask\n**Bead ID**: {bead_id}\n**Title**: {subtask_title}\n\n## Files Modified\n{files_touched}\n\n## Evaluation Criteria\n\nFor each criterion, assess passed/failed and provide brief feedback:\n\n1. **type_safe**: Code compiles without TypeScript errors\n2. **no_bugs**: No obvious bugs, edge cases handled\n3. **patterns**: Follows existing codebase patterns and conventions\n4. **readable**: Code is clear and maintainable\n\n## Response Format\n\n```json\n{\n \"passed\": boolean, // Overall pass/fail\n \"criteria\": {\n \"type_safe\": { \"passed\": boolean, \"feedback\": string },\n \"no_bugs\": { \"passed\": boolean, \"feedback\": string },\n \"patterns\": { \"passed\": boolean, \"feedback\": string },\n \"readable\": { \"passed\": boolean, \"feedback\": string }\n },\n \"overall_feedback\": string,\n \"retry_suggestion\": string | null // If failed, what to fix\n}\n```\n\nIf any criterion fails, the overall evaluation fails and retry_suggestion \nshould describe what needs to be fixed.";
47
+ /**
48
+ * Format the V2 subtask prompt for a specific agent
49
+ */
50
+ export declare function formatSubtaskPromptV2(params: {
51
+ bead_id: string;
52
+ epic_id: string;
53
+ subtask_title: string;
54
+ subtask_description: string;
55
+ files: string[];
56
+ shared_context?: string;
57
+ compressed_context?: string;
58
+ error_context?: string;
59
+ project_path?: string;
60
+ recovery_context?: {
61
+ shared_context?: string;
62
+ skills_to_load?: string[];
63
+ coordinator_notes?: string;
64
+ };
65
+ }): string;
66
+ /**
67
+ * Format the subtask prompt for a specific agent
68
+ */
69
+ export declare function formatSubtaskPrompt(params: {
70
+ agent_name: string;
71
+ bead_id: string;
72
+ epic_id: string;
73
+ subtask_title: string;
74
+ subtask_description: string;
75
+ files: string[];
76
+ shared_context?: string;
77
+ }): string;
78
+ /**
79
+ * Format the evaluation prompt
80
+ */
81
+ export declare function formatEvaluationPrompt(params: {
82
+ bead_id: string;
83
+ subtask_title: string;
84
+ files_touched: string[];
85
+ }): string;
86
+ /**
87
+ * Generate subtask prompt for a spawned agent
88
+ */
89
+ export declare const swarm_subtask_prompt: {
90
+ description: string;
91
+ args: {
92
+ agent_name: import("zod").ZodString;
93
+ bead_id: import("zod").ZodString;
94
+ epic_id: import("zod").ZodString;
95
+ subtask_title: import("zod").ZodString;
96
+ subtask_description: import("zod").ZodOptional<import("zod").ZodString>;
97
+ files: import("zod").ZodArray<import("zod").ZodString>;
98
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
99
+ project_path: import("zod").ZodOptional<import("zod").ZodString>;
100
+ };
101
+ execute(args: {
102
+ agent_name: string;
103
+ bead_id: string;
104
+ epic_id: string;
105
+ subtask_title: string;
106
+ files: string[];
107
+ subtask_description?: string | undefined;
108
+ shared_context?: string | undefined;
109
+ project_path?: string | undefined;
110
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
111
+ };
112
+ /**
113
+ * Prepare a subtask for spawning with Task tool (V2 prompt)
114
+ *
115
+ * Generates a streamlined prompt that tells agents to USE Agent Mail and beads.
116
+ * Returns JSON that can be directly used with Task tool.
117
+ */
118
+ export declare const swarm_spawn_subtask: {
119
+ description: string;
120
+ args: {
121
+ bead_id: import("zod").ZodString;
122
+ epic_id: import("zod").ZodString;
123
+ subtask_title: import("zod").ZodString;
124
+ subtask_description: import("zod").ZodOptional<import("zod").ZodString>;
125
+ files: import("zod").ZodArray<import("zod").ZodString>;
126
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
127
+ project_path: import("zod").ZodOptional<import("zod").ZodString>;
128
+ recovery_context: import("zod").ZodOptional<import("zod").ZodObject<{
129
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
130
+ skills_to_load: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
131
+ coordinator_notes: import("zod").ZodOptional<import("zod").ZodString>;
132
+ }, import("zod/v4/core").$strip>>;
133
+ };
134
+ execute(args: {
135
+ bead_id: string;
136
+ epic_id: string;
137
+ subtask_title: string;
138
+ files: string[];
139
+ subtask_description?: string | undefined;
140
+ shared_context?: string | undefined;
141
+ project_path?: string | undefined;
142
+ recovery_context?: {
143
+ shared_context?: string | undefined;
144
+ skills_to_load?: string[] | undefined;
145
+ coordinator_notes?: string | undefined;
146
+ } | undefined;
147
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
148
+ };
149
+ /**
150
+ * Generate self-evaluation prompt
151
+ */
152
+ export declare const swarm_evaluation_prompt: {
153
+ description: string;
154
+ args: {
155
+ bead_id: import("zod").ZodString;
156
+ subtask_title: import("zod").ZodString;
157
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
158
+ };
159
+ execute(args: {
160
+ bead_id: string;
161
+ subtask_title: string;
162
+ files_touched: string[];
163
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
164
+ };
165
+ /**
166
+ * Generate a strategy-specific planning prompt
167
+ *
168
+ * Higher-level than swarm_decompose - includes strategy selection and guidelines.
169
+ * Use this when you want the full planning experience with strategy-specific advice.
170
+ */
171
+ export declare const swarm_plan_prompt: {
172
+ description: string;
173
+ args: {
174
+ task: import("zod").ZodString;
175
+ strategy: import("zod").ZodOptional<import("zod").ZodEnum<{
176
+ "file-based": "file-based";
177
+ "feature-based": "feature-based";
178
+ "risk-based": "risk-based";
179
+ auto: "auto";
180
+ }>>;
181
+ max_subtasks: import("zod").ZodDefault<import("zod").ZodNumber>;
182
+ context: import("zod").ZodOptional<import("zod").ZodString>;
183
+ query_cass: import("zod").ZodOptional<import("zod").ZodBoolean>;
184
+ cass_limit: import("zod").ZodOptional<import("zod").ZodNumber>;
185
+ include_skills: import("zod").ZodOptional<import("zod").ZodBoolean>;
186
+ };
187
+ execute(args: {
188
+ task: string;
189
+ max_subtasks: number;
190
+ strategy?: "file-based" | "feature-based" | "risk-based" | "auto" | undefined;
191
+ context?: string | undefined;
192
+ query_cass?: boolean | undefined;
193
+ cass_limit?: number | undefined;
194
+ include_skills?: boolean | undefined;
195
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
196
+ };
197
+ export declare const promptTools: {
198
+ swarm_subtask_prompt: {
199
+ description: string;
200
+ args: {
201
+ agent_name: import("zod").ZodString;
202
+ bead_id: import("zod").ZodString;
203
+ epic_id: import("zod").ZodString;
204
+ subtask_title: import("zod").ZodString;
205
+ subtask_description: import("zod").ZodOptional<import("zod").ZodString>;
206
+ files: import("zod").ZodArray<import("zod").ZodString>;
207
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
208
+ project_path: import("zod").ZodOptional<import("zod").ZodString>;
209
+ };
210
+ execute(args: {
211
+ agent_name: string;
212
+ bead_id: string;
213
+ epic_id: string;
214
+ subtask_title: string;
215
+ files: string[];
216
+ subtask_description?: string | undefined;
217
+ shared_context?: string | undefined;
218
+ project_path?: string | undefined;
219
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
220
+ };
221
+ swarm_spawn_subtask: {
222
+ description: string;
223
+ args: {
224
+ bead_id: import("zod").ZodString;
225
+ epic_id: import("zod").ZodString;
226
+ subtask_title: import("zod").ZodString;
227
+ subtask_description: import("zod").ZodOptional<import("zod").ZodString>;
228
+ files: import("zod").ZodArray<import("zod").ZodString>;
229
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
230
+ project_path: import("zod").ZodOptional<import("zod").ZodString>;
231
+ recovery_context: import("zod").ZodOptional<import("zod").ZodObject<{
232
+ shared_context: import("zod").ZodOptional<import("zod").ZodString>;
233
+ skills_to_load: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
234
+ coordinator_notes: import("zod").ZodOptional<import("zod").ZodString>;
235
+ }, import("zod/v4/core").$strip>>;
236
+ };
237
+ execute(args: {
238
+ bead_id: string;
239
+ epic_id: string;
240
+ subtask_title: string;
241
+ files: string[];
242
+ subtask_description?: string | undefined;
243
+ shared_context?: string | undefined;
244
+ project_path?: string | undefined;
245
+ recovery_context?: {
246
+ shared_context?: string | undefined;
247
+ skills_to_load?: string[] | undefined;
248
+ coordinator_notes?: string | undefined;
249
+ } | undefined;
250
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
251
+ };
252
+ swarm_evaluation_prompt: {
253
+ description: string;
254
+ args: {
255
+ bead_id: import("zod").ZodString;
256
+ subtask_title: import("zod").ZodString;
257
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
258
+ };
259
+ execute(args: {
260
+ bead_id: string;
261
+ subtask_title: string;
262
+ files_touched: string[];
263
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
264
+ };
265
+ swarm_plan_prompt: {
266
+ description: string;
267
+ args: {
268
+ task: import("zod").ZodString;
269
+ strategy: import("zod").ZodOptional<import("zod").ZodEnum<{
270
+ "file-based": "file-based";
271
+ "feature-based": "feature-based";
272
+ "risk-based": "risk-based";
273
+ auto: "auto";
274
+ }>>;
275
+ max_subtasks: import("zod").ZodDefault<import("zod").ZodNumber>;
276
+ context: import("zod").ZodOptional<import("zod").ZodString>;
277
+ query_cass: import("zod").ZodOptional<import("zod").ZodBoolean>;
278
+ cass_limit: import("zod").ZodOptional<import("zod").ZodNumber>;
279
+ include_skills: import("zod").ZodOptional<import("zod").ZodBoolean>;
280
+ };
281
+ execute(args: {
282
+ task: string;
283
+ max_subtasks: number;
284
+ strategy?: "file-based" | "feature-based" | "risk-based" | "auto" | undefined;
285
+ context?: string | undefined;
286
+ query_cass?: boolean | undefined;
287
+ cass_limit?: number | undefined;
288
+ include_skills?: boolean | undefined;
289
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
290
+ };
291
+ };
292
+ //# sourceMappingURL=swarm-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-prompts.d.ts","sourceRoot":"","sources":["../src/swarm-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,q6EAkET,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,6BAA6B,kxDAyDlB,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,cAAc,gkFAgFK,CAAC;AAEjC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,0iGA+GnB,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8jCAmCU,CAAC;AAMzC;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH,GAAG,MAAM,CAuDT;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAUT;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,GAAG,MAAM,CAMT;AAMD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CAoC/B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0D9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;CAoClC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;CA0I5B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKvB,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Swarm Strategies Module - Strategy selection and guidelines
3
+ *
4
+ * Handles decomposition strategy selection (file-based, feature-based, risk-based, research-based)
5
+ * and provides strategy-specific guidelines for task decomposition.
6
+ *
7
+ * Key responsibilities:
8
+ * - Strategy keyword matching and selection
9
+ * - Strategy definition and description
10
+ * - Anti-pattern warnings
11
+ * - Guidelines formatting for prompts
12
+ */
13
+ import { z } from "zod";
14
+ /**
15
+ * Decomposition strategy types
16
+ */
17
+ export type DecompositionStrategy = "file-based" | "feature-based" | "risk-based" | "research-based" | "auto";
18
+ /**
19
+ * Zod schema for decomposition strategy validation
20
+ */
21
+ export declare const DecompositionStrategySchema: z.ZodEnum<{
22
+ "file-based": "file-based";
23
+ "feature-based": "feature-based";
24
+ "risk-based": "risk-based";
25
+ auto: "auto";
26
+ "research-based": "research-based";
27
+ }>;
28
+ /**
29
+ * Marker words that indicate positive directives
30
+ */
31
+ export declare const POSITIVE_MARKERS: string[];
32
+ /**
33
+ * Marker words that indicate negative directives
34
+ */
35
+ export declare const NEGATIVE_MARKERS: string[];
36
+ /**
37
+ * Strategy definition with keywords, guidelines, and anti-patterns
38
+ */
39
+ export interface StrategyDefinition {
40
+ name: DecompositionStrategy;
41
+ description: string;
42
+ keywords: string[];
43
+ guidelines: string[];
44
+ antiPatterns: string[];
45
+ examples: string[];
46
+ }
47
+ /**
48
+ * Strategy definitions for task decomposition
49
+ */
50
+ export declare const STRATEGIES: Record<Exclude<DecompositionStrategy, "auto">, StrategyDefinition>;
51
+ /**
52
+ * Analyze task description and select best decomposition strategy
53
+ *
54
+ * @param task - Task description
55
+ * @returns Selected strategy with reasoning
56
+ */
57
+ export declare function selectStrategy(task: string): {
58
+ strategy: Exclude<DecompositionStrategy, "auto">;
59
+ confidence: number;
60
+ reasoning: string;
61
+ alternatives: Array<{
62
+ strategy: Exclude<DecompositionStrategy, "auto">;
63
+ score: number;
64
+ }>;
65
+ };
66
+ /**
67
+ * Format strategy-specific guidelines for the decomposition prompt
68
+ */
69
+ export declare function formatStrategyGuidelines(strategy: Exclude<DecompositionStrategy, "auto">): string;
70
+ /**
71
+ * Select the best decomposition strategy for a task
72
+ *
73
+ * Analyzes task description and recommends a strategy with reasoning.
74
+ * Use this before swarm_plan_prompt to understand the recommended approach.
75
+ */
76
+ export declare const swarm_select_strategy: {
77
+ description: string;
78
+ args: {
79
+ task: z.ZodString;
80
+ codebase_context: z.ZodOptional<z.ZodString>;
81
+ };
82
+ execute(args: {
83
+ task: string;
84
+ codebase_context?: string | undefined;
85
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
86
+ };
87
+ export declare const strategyTools: {
88
+ swarm_select_strategy: {
89
+ description: string;
90
+ args: {
91
+ task: z.ZodString;
92
+ codebase_context: z.ZodOptional<z.ZodString>;
93
+ };
94
+ execute(args: {
95
+ task: string;
96
+ codebase_context?: string | undefined;
97
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
98
+ };
99
+ };
100
+ //# sourceMappingURL=swarm-strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-strategies.d.ts","sourceRoot":"","sources":["../src/swarm-strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,MAAM,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;EAMtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAO5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAQ5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,EACtC,kBAAkB,CAgKnB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG;IAC5C,QAAQ,EAAE,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,KAAK,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QACjD,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ,CAoEA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC/C,MAAM,CAmBR;AAMD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;CAqChC,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;CAEzB,CAAC"}