opencodekit 0.21.9 → 0.22.0

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 (165) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -499
  3. package/dist/template/.opencode/README.md +1 -1
  4. package/dist/template/.opencode/agent/build.md +56 -396
  5. package/dist/template/.opencode/agent/explore.md +15 -16
  6. package/dist/template/.opencode/agent/general.md +2 -2
  7. package/dist/template/.opencode/agent/plan.md +3 -3
  8. package/dist/template/.opencode/agent/review.md +2 -3
  9. package/dist/template/.opencode/agent/scout.md +34 -16
  10. package/dist/template/.opencode/agent/vision.md +0 -1
  11. package/dist/template/.opencode/command/clarify.md +48 -0
  12. package/dist/template/.opencode/command/commit.md +53 -0
  13. package/dist/template/.opencode/command/design.md +4 -4
  14. package/dist/template/.opencode/command/fix.md +56 -0
  15. package/dist/template/.opencode/command/improve-architecture.md +55 -0
  16. package/dist/template/.opencode/command/init.md +88 -68
  17. package/dist/template/.opencode/command/refactor.md +66 -0
  18. package/dist/template/.opencode/command/review-codebase.md +1 -1
  19. package/dist/template/.opencode/command/ship.md +1 -1
  20. package/dist/template/.opencode/command/test.md +66 -0
  21. package/dist/template/.opencode/dcp.jsonc +29 -46
  22. package/dist/template/.opencode/memory/README.md +3 -5
  23. package/dist/template/.opencode/memory/_templates/adr.md +45 -0
  24. package/dist/template/.opencode/memory/project/gotchas.md +1 -1
  25. package/dist/template/.opencode/memory/project/user.md +1 -2
  26. package/dist/template/.opencode/memory/session-context.md +1 -1
  27. package/dist/template/.opencode/opencode.json +10 -332
  28. package/dist/template/.opencode/plugin/README.md +1 -1
  29. package/dist/template/.opencode/plugin/guard.ts +62 -0
  30. package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
  31. package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
  32. package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
  33. package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
  34. package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
  35. package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
  36. package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
  37. package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
  38. package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
  39. package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
  40. package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
  41. package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
  42. package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
  43. package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
  44. package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
  45. package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
  46. package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
  47. package/dist/template/.opencode/plugin/memory.ts +7 -17
  48. package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
  49. package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
  50. package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
  51. package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
  52. package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
  53. package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
  54. package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
  55. package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
  56. package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
  57. package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
  58. package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
  59. package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
  60. package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
  61. package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
  62. package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
  63. package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
  64. package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
  65. package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
  66. package/dist/template/.opencode/tool/context7.ts +1 -1
  67. package/dist/template/.opencode/tool/grepsearch.ts +1 -1
  68. package/package.json +1 -1
  69. package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
  70. package/dist/template/.opencode/agent/painter.md +0 -83
  71. package/dist/template/.opencode/command/compound.md +0 -240
  72. package/dist/template/.opencode/command/curate.md +0 -299
  73. package/dist/template/.opencode/command/handoff.md +0 -149
  74. package/dist/template/.opencode/command/health.md +0 -356
  75. package/dist/template/.opencode/command/init-context.md +0 -297
  76. package/dist/template/.opencode/command/init-user.md +0 -125
  77. package/dist/template/.opencode/command/iterate.md +0 -200
  78. package/dist/template/.opencode/command/lfg.md +0 -173
  79. package/dist/template/.opencode/command/resume.md +0 -78
  80. package/dist/template/.opencode/command/status.md +0 -126
  81. package/dist/template/.opencode/command/ui-slop-check.md +0 -169
  82. package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
  83. package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
  84. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
  85. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
  86. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
  87. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
  88. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -253
  89. package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
  90. package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
  91. package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
  92. package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
  93. package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
  94. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
  95. package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
  96. package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
  97. package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
  98. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
  99. package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
  100. package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
  101. package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
  102. package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
  103. package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
  104. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
  105. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
  106. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
  107. package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
  108. package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
  109. package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
  110. package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
  111. package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
  112. package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
  113. package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
  114. package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
  115. package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
  116. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
  117. package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
  118. package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
  119. package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
  120. package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
  121. package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
  122. package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
  123. package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
  124. package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
  125. package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
  126. package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
  127. package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
  128. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
  129. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
  130. package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
  131. package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
  132. package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
  133. package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
  134. package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
  135. package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
  136. package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
  137. package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
  138. package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
  139. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
  140. package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
  141. package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
  142. package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
  143. package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
  144. package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
  145. package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
  146. package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
  147. package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
  148. package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
  149. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
  150. package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
  151. package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
  152. package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
  153. package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
  154. package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
  155. package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
  156. package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
  157. package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
  158. package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
  159. package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
  160. /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
  161. /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
  162. /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
  163. /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
  164. /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
  165. /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
@@ -1,186 +0,0 @@
1
- # Swarm Launch Flow - PARL Pattern (7 Steps)
2
-
3
- ## Step 0: Task Analysis (Anti-Serial-Collapse + Dependency Graph)
4
-
5
- Analyze the user's actual task to determine optimal swarm strategy:
6
-
7
- ```typescript
8
- // 1. Classify the task and build dependency graph
9
- const analysis = await swarm({
10
- operation: "plan",
11
- operation: "analyze",
12
- task: "<user's request from input>",
13
- files: "<detected files from glob/grep>",
14
- });
15
-
16
- // Returns:
17
- // - type: "search" | "batch" | "writing" | "sequential" | "mixed"
18
- // - recommended_agents: number
19
- // - phases: [{ name, role, agent_count, dependencies }]
20
- // - coupling: "high" | "medium" | "low"
21
- // - confidence: "high" | "medium" | "low"
22
- // - dependency_graph: { nodes, edges, critical_path, parallelizable_groups }
23
-
24
- const plan = JSON.parse(analysis);
25
-
26
- // 2. Check for serial collapse
27
- const check = await swarm({
28
- operation: "plan",
29
- operation: "check",
30
- task: "<user's request>",
31
- files: String(plan.file_count),
32
- recommended_agents: plan.classification.recommended_agents,
33
- });
34
-
35
- // If serial collapse detected, force parallelization
36
- if (check.serial_collapse_detected) {
37
- console.log(`⚠️ Serial collapse detected: ${check.warning_signs.join(", ")}`);
38
- console.log(`✓ Adjusting to ${check.suggested_agents} agents`);
39
- }
40
-
41
- // 3. Use dependency graph for spawn ordering
42
- const { parallelizable_groups, critical_path } = plan.dependency_graph;
43
- console.log(`Critical path: ${critical_path.join(" → ")}`);
44
- console.log(`Parallel groups: ${parallelizable_groups.length}`);
45
- ```
46
-
47
- ## Step 1: Session Setup (Push Beads to Todos)
48
-
49
- Make Beads tasks visible to subagents:
50
-
51
- ```typescript
52
- // Push Beads to OpenCode todos (subagents see via todoread)
53
- await swarm({ operation: "sync", operation: "push", filter: "open" });
54
-
55
- // Check for existing swarm state
56
- const status = await swarm({
57
- operation: "monitor",
58
- operation: "status",
59
- team_name: "plan-implementation",
60
- });
61
- const stats = JSON.parse(status).summary;
62
-
63
- if (stats.total_workers > 0) {
64
- console.log(`Found existing swarm with ${stats.total_workers} workers`);
65
- // Render current progress
66
- const ui = await swarm({
67
- operation: "monitor",
68
- operation: "render_block",
69
- team_name: "plan-implementation",
70
- });
71
- console.log(ui);
72
- }
73
- ```
74
-
75
- ## Step 2: Create Delegation Packets
76
-
77
- For each task, create a delegation packet:
78
-
79
- ```typescript
80
- swarm({
81
- operation: "delegate",
82
- bead_id: "task-1",
83
- title: "Implement auth service",
84
- expected_outcome: "Auth service with JWT tokens, tests pass",
85
- required_tools: "read, grep, lsp, edit, bash",
86
- must_do: "LSP before edits, run npm test after changes",
87
- must_not_do: "No new dependencies, don't edit config files",
88
- acceptance_checks: "typecheck: npm run typecheck, lint: npm run lint, test: npm test",
89
- context: "See .beads/artifacts/task-1/spec.md for requirements",
90
- write: true,
91
- });
92
- ```
93
-
94
- ## Step 3: Spawn Worker Agents (Using Dependency Groups)
95
-
96
- Use parallelizable_groups from dependency graph for proper ordering:
97
-
98
- ```typescript
99
- // Spawn workers in dependency order
100
- for (const group of plan.dependency_graph.parallelizable_groups) {
101
- // All tasks in this group can run in parallel
102
- const spawnPromises = group.map((taskId) => {
103
- const node = plan.dependency_graph.nodes.find((n) => n.id === taskId);
104
- return Task({
105
- subagent_type: "general",
106
- description: `Execute ${taskId}`,
107
- prompt: `Execute bead ${taskId}: ${node.content}
108
-
109
- Read delegation packet at: .beads/artifacts/${taskId}/delegation.md
110
-
111
- Files: ${node.assignedFiles.join(", ")}
112
- Phase: ${node.phase}
113
- Worker: ${node.worker}
114
- Team: plan-implementation
115
-
116
- Requirements:
117
- 1. Follow all MUST DO constraints
118
- 2. Avoid all MUST NOT DO items
119
- 3. Run acceptance checks before claiming done
120
- 4. Report progress via swarm monitor`,
121
- });
122
- });
123
-
124
- // Wait for parallel group to complete before starting next
125
- await Promise.all(spawnPromises);
126
- }
127
- ```
128
-
129
- ## Step 4: Monitor Progress (Real-time TUI + Persistence)
130
-
131
- Monitor with beautiful block UI, progress tracking, and auto-persistence:
132
-
133
- ```typescript
134
- let allComplete = false;
135
- while (!allComplete) {
136
- // Option A: Render beautiful TUI block
137
- const ui = await swarm({
138
- operation: "monitor",
139
- operation: "render_block",
140
- team_name: "plan-implementation",
141
- });
142
- console.log(ui); // Markdown block with tables, emojis, progress
143
-
144
- // Option B: Get detailed status
145
- const status = await swarm({
146
- operation: "monitor",
147
- operation: "status",
148
- team_name: "plan-implementation",
149
- });
150
- const stats = JSON.parse(status).summary;
151
- // Returns: total_workers, completed, working, errors, messages
152
-
153
- // Check completion
154
- allComplete = stats.completed === stats.total_workers;
155
-
156
- if (!allComplete) {
157
- // Wait before checking again
158
- await new Promise((r) => setTimeout(r, 2000)); // Wait 2s
159
- }
160
- }
161
- ```
162
-
163
- ## Step 5: Synthesize Results
164
-
165
- When all workers complete:
166
-
167
- ```typescript
168
- // 1. Get final status
169
- const finalStatus = await swarm({
170
- operation: "monitor",
171
- operation: "status",
172
- team_name: "plan-implementation",
173
- });
174
-
175
- // 2. Run full verification
176
- await bash("npm run typecheck && npm run lint && npm test");
177
-
178
- // 3. Pull completed todos back to Beads
179
- await swarm({ operation: "sync", operation: "pull" });
180
-
181
- // 4. Clear swarm data
182
- await swarm({ operation: "monitor", operation: "clear", team_name: "plan-implementation" });
183
-
184
- // 5. Close parent bead
185
- await bash("br close parent-task --reason 'Swarm completed all subtasks'");
186
- ```
@@ -1,172 +0,0 @@
1
- # Reconciler Agent Pattern (Self-Healing)
2
-
3
- The reconciler is the key to scaling beyond 50+ agents. Without reconciliation, broken builds cascade and the swarm collapses. The reconciler provides **continuous self-healing** by watching for failures and spawning targeted fix tasks.
4
-
5
- ## When to Use Reconciler
6
-
7
- - **50+ agents** running in parallel → **REQUIRED**
8
- - **10-50 agents** → Recommended
9
- - **<10 agents** → Optional (leader can handle)
10
-
11
- ## Reconciler Responsibilities
12
-
13
- 1. **Watch CI/Build Status**: Monitor build gates continuously
14
- 2. **Detect Failures**: Identify which worker caused the failure
15
- 3. **Analyze Root Cause**: Determine if it's a merge conflict, test failure, or type error
16
- 4. **Spawn Fix Tasks**: Create targeted fix tasks with context about what failed
17
- 5. **Verify Fix**: Wait for fix to pass gates before continuing
18
-
19
- ## Reconciler vs Leader
20
-
21
- | Aspect | Leader | Reconciler |
22
- | -------------- | ----------------------------- | ----------------------------- |
23
- | Focus | Orchestration, spawning | Recovery, fixing |
24
- | Runs | At swarm start, between waves | Continuously during execution |
25
- | On failure | Spawns workers | Spawns fix tasks |
26
- | Failure impact | Can't start work | Wave can't complete |
27
-
28
- ## Implementing Reconciler
29
-
30
- The reconciler runs in a loop during swarm execution:
31
-
32
- ```typescript
33
- // Reconciler runs in background during swarm execution
34
- async function runReconciler(teamName: string, buildCommand: string) {
35
- while (swarmActive) {
36
- // 1. Check build status
37
- const status = await swarm({
38
- operation: "monitor",
39
- operation: "status",
40
- team_name: teamName,
41
- });
42
- const stats = JSON.parse(status).summary;
43
-
44
- // 2. If there are errors, investigate
45
- if (stats.errors > 0) {
46
- // 3. Get error details
47
- const errors = await getWorkerErrors(teamName);
48
-
49
- for (const error of errors) {
50
- // 4. Analyze root cause
51
- const cause = await analyzeError(error);
52
-
53
- // 5. Spawn fix task
54
- const fixBead = await br create({
55
- title: `Fix: ${cause.summary}`,
56
- type: "bug",
57
- description: `Detected by reconciler: ${error.message}. Root cause: ${cause.rootCause}. Suggested fix: ${cause.suggestion}`,
58
- });
59
-
60
- // 6. Assign to targeted worker
61
- await Task({
62
- subagent_type: "general",
63
- description: `Fix ${error.worker}`,
64
- prompt: `Fix the error in ${error.file}.
65
-
66
- Error: ${error.message}
67
- Root cause: ${cause.rootCause}
68
- Suggested fix: ${cause.suggestion}
69
-
70
- Run: ${buildCommand}
71
- Verify: npm run typecheck && npm run lint`,
72
- });
73
- }
74
- }
75
-
76
- // Wait before next check
77
- await sleep(30000); // Check every 30 seconds
78
- }
79
- }
80
- ```
81
-
82
- ## Error Analysis Patterns
83
-
84
- The reconciler categorizes errors:
85
-
86
- | Error Type | Detection | Fix Strategy |
87
- | -------------- | -------------------------------- | ---------------------------- |
88
- | Merge conflict | "CONFLICT" in output, git status | Re-base, resolve, force push |
89
- | Type error | "typecheck failed" | Fix types, run typecheck |
90
- | Test failure | "test failed", "expect" mismatch | Fix test or implementation |
91
- | Lint error | "lint failed", formatting issues | Run lint:fix |
92
- | Build error | "build failed", bundler errors | Fix imports, dependencies |
93
-
94
- ## Spawning Fix Tasks
95
-
96
- When the reconciler spawns a fix task, it includes:
97
-
98
- ```typescript
99
- // Create fix task with full context
100
- await br create({
101
- title: `Fix: ${error.type} in ${error.file}`,
102
- type: "bug",
103
- description: `## Error Detected
104
- - Worker: ${error.worker}
105
- - File: ${error.file}
106
- - Error: ${error.message}
107
- - Timestamp: ${error.timestamp}
108
-
109
- ## Root Cause Analysis
110
- ${cause.explanation}
111
-
112
- ## Suggested Fix
113
- ${cause.suggestion}
114
-
115
- ## Verification
116
- Run: ${buildCommand}
117
- Must pass before wave can complete.`,
118
- });
119
- ```
120
-
121
- ## Reconciler in Wave Execution
122
-
123
- Add reconciler monitoring to each wave:
124
-
125
- ```typescript
126
- // Execute wave with reconciler
127
- async function executeWaveWithReconciler(wave, teamName) {
128
- // Start reconciler in background
129
- const reconciler = runReconciler(teamName, "npm run typecheck && npm run lint");
130
-
131
- // Execute workers in this wave
132
- await Promise.all(wave.tasks.map(spawnWorker));
133
-
134
- // Wait for all workers + reconciler to complete
135
- await reconciler;
136
-
137
- // Verify wave output before proceeding
138
- await bash("npm run typecheck && npm run lint");
139
- }
140
- ```
141
-
142
- ## Example: Full Swarm with Reconciler
143
-
144
- ```typescript
145
- // Full swarm execution with reconciler
146
- async function runSwarmWithReconciler(tasks, teamName) {
147
- // 1. Analyze and create waves
148
- const waves = createWaves(tasks);
149
-
150
- // 2. Execute each wave with reconciler
151
- for (const wave of waves) {
152
- console.log(`Executing wave ${wave.number} with ${wave.tasks.length} tasks`);
153
-
154
- // Start reconciler for this wave
155
- const reconcilerPromise = runReconciler(teamName, "npm run typecheck && npm run lint");
156
-
157
- // Spawn workers
158
- await Promise.all(wave.tasks.map((task) => spawnWorker(task, teamName)));
159
-
160
- // Wait for reconciler to finish fixing any errors
161
- await reconcilerPromise;
162
-
163
- // Verify wave output
164
- const result = await bash("npm run typecheck && npm run lint");
165
- if (!result.success) {
166
- throw new Error(`Wave ${wave.number} failed gates`);
167
- }
168
-
169
- console.log(`Wave ${wave.number} complete`);
170
- }
171
- }
172
- ```
@@ -1,78 +0,0 @@
1
- # Tier Enforcement (Longshot Pattern)
2
-
3
- For multi-agent execution at scale (10+ agents), enforce explicit tier hierarchy. This is the Longshot pattern that enabled 200 agents to build Minecraft.
4
-
5
- ## Tier System
6
-
7
- | Tier | Role | Swarm Equivalent | Responsibility |
8
- | --------------- | --------------------- | ---------------- | -------------------------------------------------------------- |
9
- | **planner** | Lead orchestrator | Build agent | Analyzes scope, decomposes into sub-tasks, coordinates workers |
10
- | **sub-planner** | Mid-level coordinator | N/A | Takes planner output, further decomposes, assigns to workers |
11
- | **worker** | Execution agent | Worker agents | Executes assigned work, reports progress |
12
-
13
- ## When Tiers Are Required
14
-
15
- - **<10 agents**: Optional - flat decomposition works
16
- - **10-50 agents**: Recommended - planner + workers
17
- - **50+ agents**: Required - planner + sub-planners + workers
18
-
19
- ## Enforcing Tier Boundaries
20
-
21
- The swarm leader enforces tier boundaries:
22
-
23
- ```typescript
24
- // Tier enforcement in swarm execution
25
- async function enforceTiers(waves, tierConfig) {
26
- // Wave 1: Planner tasks only
27
- const planners = waves.filter((w) => w.tier === "planner");
28
- await executeWave(planners);
29
-
30
- // Wave 2: Sub-planner tasks (if any)
31
- const subPlanners = waves.filter((w) => w.tier === "sub-planner");
32
- await executeWave(subPlanners);
33
-
34
- // Wave 3+: Worker tasks
35
- const workers = waves.filter((w) => w.tier === "worker");
36
- await executeWave(workers);
37
- }
38
- ```
39
-
40
- ## Handoff Contracts Between Tiers
41
-
42
- Each tier must declare handoff contracts:
43
-
44
- ```typescript
45
- // Planner declares what it produces for sub-planners
46
- const plannerHandoff = {
47
- produces: [
48
- { artifact: "docs/auth-design.md", format: "markdown" },
49
- { artifact: "tasks/auth-tasks.json", format: "json" },
50
- ],
51
- consumedBy: ["sub-planner-auth"],
52
- };
53
-
54
- // Worker declares what it consumes from sub-planners
55
- const workerHandoff = {
56
- consumes: [{ artifact: "tasks/auth-tasks.json", format: "json" }],
57
- produces: [{ artifact: "src/auth/service.ts", format: "typescript" }],
58
- };
59
- ```
60
-
61
- ## Anti-Pattern: Flat Decomposition at Scale
62
-
63
- Without tiers, 20 agents get 20 flat tasks → chaos:
64
-
65
- - Workers step on each other
66
- - No coordination between related work
67
- - Merge conflicts everywhere
68
- - No clear ownership
69
-
70
- With tiers (Longshot pattern):
71
-
72
- ```
73
- Lead Planner → Sub-planner A → Worker 1, 2, 3
74
- → Sub-planner B → Worker 4, 5, 6
75
- Sub-planner C → Worker 7, 8, 9
76
- ```
77
-
78
- This mirrors real engineering orgs: lead → tech lead → IC. The architecture is the differentiator.
@@ -1,134 +0,0 @@
1
- # Tmux Integration (Visual Swarm Monitoring)
2
-
3
- Enable real-time visualization of swarm workers in separate tmux panes.
4
-
5
- ## Setup
6
-
7
- 1. Start OpenCode inside tmux:
8
-
9
- ```bash
10
- tmux new -s opencode
11
- opencode
12
- ```
13
-
14
- 2. The tmux tool auto-detects when running inside tmux and uses these defaults:
15
- - Layout: `main-vertical` (leader left, workers right)
16
- - Main pane size: 60%
17
- - Auto-cleanup: enabled
18
-
19
- ## Detecting Tmux
20
-
21
- ```typescript
22
- // Check if running inside tmux
23
- const status = await tmux({ operation: "detect" });
24
- const { available, inside_session } = JSON.parse(status);
25
-
26
- if (!inside_session) {
27
- console.log("Tip: Run inside tmux for visual swarm monitoring");
28
- console.log("Start with: tmux new -s opencode");
29
- }
30
- ```
31
-
32
- ## Spawning Worker Panes
33
-
34
- When spawning workers, create visual panes:
35
-
36
- ```typescript
37
- // Before spawning worker via Task tool
38
- if (inside_session) {
39
- // Create pane for this worker
40
- const pane = await tmux({
41
- operation: "spawn",
42
- worker_id: "worker-1",
43
- title: "Explorer: auth.ts",
44
- size: 40, // 40% width
45
- });
46
-
47
- const { pane_id } = JSON.parse(pane);
48
-
49
- // Send command to pane (optional - for visual feedback)
50
- await tmux({
51
- operation: "send",
52
- pane_id,
53
- command: `echo "🔍 Worker-1: Exploring auth.ts..."`,
54
- });
55
- }
56
-
57
- // Spawn the actual worker
58
- await Task({
59
- subagent_type: "general",
60
- description: "Execute worker-1",
61
- prompt: `...`,
62
- });
63
- ```
64
-
65
- ## Layout Options
66
-
67
- | Layout | Description | Best For |
68
- | ----------------- | ------------------------------------- | ----------------------------- |
69
- | `main-vertical` | Main pane left, workers stacked right | Default, good for 2-4 workers |
70
- | `main-horizontal` | Main pane top, workers below | Wide monitors |
71
- | `tiled` | Equal grid for all panes | Many workers (5+) |
72
- | `even-horizontal` | Equal width columns | 2-3 workers |
73
- | `even-vertical` | Equal height rows | 2-3 workers |
74
-
75
- ```typescript
76
- // Change layout dynamically
77
- await tmux({
78
- operation: "layout",
79
- layout: "tiled", // When many workers spawn
80
- });
81
- ```
82
-
83
- ## Monitoring Worker Output
84
-
85
- ```typescript
86
- // Capture output from a worker's pane
87
- const output = await tmux({
88
- operation: "capture",
89
- pane_id: "%5",
90
- });
91
-
92
- // Check what the worker is doing
93
- console.log(JSON.parse(output).output);
94
- ```
95
-
96
- ## Cleanup
97
-
98
- ```typescript
99
- // Kill specific pane when worker completes
100
- await tmux({
101
- operation: "kill",
102
- pane_id: "%5",
103
- });
104
-
105
- // Or cleanup all spawned panes at end of swarm
106
- await tmux({
107
- operation: "cleanup",
108
- });
109
- ```
110
-
111
- ## User Commands
112
-
113
- | Action | Keys |
114
- | ----------------------- | ------------- |
115
- | Switch to next pane | `Ctrl+B →` |
116
- | Switch to previous pane | `Ctrl+B ←` |
117
- | Zoom current pane | `Ctrl+B z` |
118
- | Detach (keep running) | `Ctrl+B d` |
119
- | Reattach | `tmux attach` |
120
- | List all panes | `Ctrl+B w` |
121
-
122
- ## Watch Command
123
-
124
- Use `/swarm-watch` for real-time progress monitoring:
125
-
126
- ```bash
127
- /swarm-watch my-swarm-team
128
- ```
129
-
130
- This renders the beautiful TUI block and shows:
131
-
132
- - Worker progress percentages
133
- - Current files being worked on
134
- - Completion status