swarm-engine 1.0.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 (431) hide show
  1. package/AGENTS.md +72 -0
  2. package/CLAUDE.md +89 -0
  3. package/LICENSE +21 -0
  4. package/README.md +235 -0
  5. package/agents/accessibility-reviewer.md +118 -0
  6. package/agents/api-contract-reviewer.md +99 -0
  7. package/agents/concurrency-reviewer.md +111 -0
  8. package/agents/data-integrity-reviewer.md +103 -0
  9. package/agents/debugger.md +99 -0
  10. package/agents/dependency-reviewer.md +115 -0
  11. package/agents/devils-advocate.md +94 -0
  12. package/agents/documentation-reviewer.md +114 -0
  13. package/agents/documenter.md +78 -0
  14. package/agents/error-handling-reviewer.md +113 -0
  15. package/agents/grounding.md +99 -0
  16. package/agents/guardian.md +87 -0
  17. package/agents/implementer.md +141 -0
  18. package/agents/integrator.md +95 -0
  19. package/agents/judge.md +79 -0
  20. package/agents/librarian.md +90 -0
  21. package/agents/orchestrator.md +331 -0
  22. package/agents/performance-reviewer.md +93 -0
  23. package/agents/planner.md +106 -0
  24. package/agents/refactorer.md +92 -0
  25. package/agents/researcher.md +97 -0
  26. package/agents/reviewer.md +117 -0
  27. package/agents/security-reviewer.md +107 -0
  28. package/agents/sentinel.md +92 -0
  29. package/agents/tester.md +93 -0
  30. package/agents/testing-reviewer.md +112 -0
  31. package/commands/diff-review.md +64 -0
  32. package/commands/fix-pr.md +78 -0
  33. package/commands/red-team.md +82 -0
  34. package/commands/research.md +59 -0
  35. package/commands/resume.md +80 -0
  36. package/commands/review-cycle.md +123 -0
  37. package/commands/swarm-setup.md +28 -0
  38. package/commands/swarm.md +126 -0
  39. package/commands/tdd.md +91 -0
  40. package/dist/cli/bin.d.ts +3 -0
  41. package/dist/cli/bin.d.ts.map +1 -0
  42. package/dist/cli/bin.js +3 -0
  43. package/dist/cli/bin.js.map +1 -0
  44. package/dist/cli/commands/acp.d.ts +3 -0
  45. package/dist/cli/commands/acp.d.ts.map +1 -0
  46. package/dist/cli/commands/acp.js +29 -0
  47. package/dist/cli/commands/acp.js.map +1 -0
  48. package/dist/cli/commands/agents.d.ts +3 -0
  49. package/dist/cli/commands/agents.d.ts.map +1 -0
  50. package/dist/cli/commands/agents.js +344 -0
  51. package/dist/cli/commands/agents.js.map +1 -0
  52. package/dist/cli/commands/backends.d.ts +3 -0
  53. package/dist/cli/commands/backends.d.ts.map +1 -0
  54. package/dist/cli/commands/backends.js +22 -0
  55. package/dist/cli/commands/backends.js.map +1 -0
  56. package/dist/cli/commands/completions.d.ts +3 -0
  57. package/dist/cli/commands/completions.d.ts.map +1 -0
  58. package/dist/cli/commands/completions.js +85 -0
  59. package/dist/cli/commands/completions.js.map +1 -0
  60. package/dist/cli/commands/compound.d.ts +3 -0
  61. package/dist/cli/commands/compound.d.ts.map +1 -0
  62. package/dist/cli/commands/compound.js +119 -0
  63. package/dist/cli/commands/compound.js.map +1 -0
  64. package/dist/cli/commands/configure.d.ts +3 -0
  65. package/dist/cli/commands/configure.d.ts.map +1 -0
  66. package/dist/cli/commands/configure.js +151 -0
  67. package/dist/cli/commands/configure.js.map +1 -0
  68. package/dist/cli/commands/convert.d.ts +15 -0
  69. package/dist/cli/commands/convert.d.ts.map +1 -0
  70. package/dist/cli/commands/convert.js +218 -0
  71. package/dist/cli/commands/convert.js.map +1 -0
  72. package/dist/cli/commands/doctor.d.ts +3 -0
  73. package/dist/cli/commands/doctor.d.ts.map +1 -0
  74. package/dist/cli/commands/doctor.js +96 -0
  75. package/dist/cli/commands/doctor.js.map +1 -0
  76. package/dist/cli/commands/init.d.ts +3 -0
  77. package/dist/cli/commands/init.d.ts.map +1 -0
  78. package/dist/cli/commands/init.js +154 -0
  79. package/dist/cli/commands/init.js.map +1 -0
  80. package/dist/cli/commands/learn.d.ts +3 -0
  81. package/dist/cli/commands/learn.d.ts.map +1 -0
  82. package/dist/cli/commands/learn.js +163 -0
  83. package/dist/cli/commands/learn.js.map +1 -0
  84. package/dist/cli/commands/mcp.d.ts +3 -0
  85. package/dist/cli/commands/mcp.d.ts.map +1 -0
  86. package/dist/cli/commands/mcp.js +89 -0
  87. package/dist/cli/commands/mcp.js.map +1 -0
  88. package/dist/cli/commands/memory.d.ts +3 -0
  89. package/dist/cli/commands/memory.d.ts.map +1 -0
  90. package/dist/cli/commands/memory.js +134 -0
  91. package/dist/cli/commands/memory.js.map +1 -0
  92. package/dist/cli/commands/orchestrate.d.ts +3 -0
  93. package/dist/cli/commands/orchestrate.d.ts.map +1 -0
  94. package/dist/cli/commands/orchestrate.js +237 -0
  95. package/dist/cli/commands/orchestrate.js.map +1 -0
  96. package/dist/cli/commands/patterns.d.ts +3 -0
  97. package/dist/cli/commands/patterns.d.ts.map +1 -0
  98. package/dist/cli/commands/patterns.js +25 -0
  99. package/dist/cli/commands/patterns.js.map +1 -0
  100. package/dist/cli/commands/plan.d.ts +3 -0
  101. package/dist/cli/commands/plan.d.ts.map +1 -0
  102. package/dist/cli/commands/plan.js +77 -0
  103. package/dist/cli/commands/plan.js.map +1 -0
  104. package/dist/cli/commands/plugin.d.ts +3 -0
  105. package/dist/cli/commands/plugin.d.ts.map +1 -0
  106. package/dist/cli/commands/plugin.js +124 -0
  107. package/dist/cli/commands/plugin.js.map +1 -0
  108. package/dist/cli/commands/resume.d.ts +3 -0
  109. package/dist/cli/commands/resume.d.ts.map +1 -0
  110. package/dist/cli/commands/resume.js +55 -0
  111. package/dist/cli/commands/resume.js.map +1 -0
  112. package/dist/cli/commands/run.d.ts +3 -0
  113. package/dist/cli/commands/run.d.ts.map +1 -0
  114. package/dist/cli/commands/run.js +78 -0
  115. package/dist/cli/commands/run.js.map +1 -0
  116. package/dist/cli/commands/share.d.ts +3 -0
  117. package/dist/cli/commands/share.d.ts.map +1 -0
  118. package/dist/cli/commands/share.js +34 -0
  119. package/dist/cli/commands/share.js.map +1 -0
  120. package/dist/cli/commands/status.d.ts +3 -0
  121. package/dist/cli/commands/status.d.ts.map +1 -0
  122. package/dist/cli/commands/status.js +148 -0
  123. package/dist/cli/commands/status.js.map +1 -0
  124. package/dist/cli/commands/template.d.ts +3 -0
  125. package/dist/cli/commands/template.d.ts.map +1 -0
  126. package/dist/cli/commands/template.js +213 -0
  127. package/dist/cli/commands/template.js.map +1 -0
  128. package/dist/cli/commands/vault.d.ts +3 -0
  129. package/dist/cli/commands/vault.d.ts.map +1 -0
  130. package/dist/cli/commands/vault.js +402 -0
  131. package/dist/cli/commands/vault.js.map +1 -0
  132. package/dist/cli/commands/verify.d.ts +3 -0
  133. package/dist/cli/commands/verify.d.ts.map +1 -0
  134. package/dist/cli/commands/verify.js +38 -0
  135. package/dist/cli/commands/verify.js.map +1 -0
  136. package/dist/cli/commands/version.d.ts +3 -0
  137. package/dist/cli/commands/version.d.ts.map +1 -0
  138. package/dist/cli/commands/version.js +19 -0
  139. package/dist/cli/commands/version.js.map +1 -0
  140. package/dist/cli/commands/watch.d.ts +3 -0
  141. package/dist/cli/commands/watch.d.ts.map +1 -0
  142. package/dist/cli/commands/watch.js +179 -0
  143. package/dist/cli/commands/watch.js.map +1 -0
  144. package/dist/cli/index.d.ts +3 -0
  145. package/dist/cli/index.d.ts.map +1 -0
  146. package/dist/cli/index.js +118 -0
  147. package/dist/cli/index.js.map +1 -0
  148. package/dist/core/checkpoint.d.ts +35 -0
  149. package/dist/core/checkpoint.d.ts.map +1 -0
  150. package/dist/core/checkpoint.js +80 -0
  151. package/dist/core/checkpoint.js.map +1 -0
  152. package/dist/core/event-bus.d.ts +41 -0
  153. package/dist/core/event-bus.d.ts.map +1 -0
  154. package/dist/core/event-bus.js +115 -0
  155. package/dist/core/event-bus.js.map +1 -0
  156. package/dist/core/lifecycle.d.ts +30 -0
  157. package/dist/core/lifecycle.d.ts.map +1 -0
  158. package/dist/core/lifecycle.js +72 -0
  159. package/dist/core/lifecycle.js.map +1 -0
  160. package/dist/core/patterns.d.ts +43 -0
  161. package/dist/core/patterns.d.ts.map +1 -0
  162. package/dist/core/patterns.js +372 -0
  163. package/dist/core/patterns.js.map +1 -0
  164. package/dist/core/permissions.d.ts +40 -0
  165. package/dist/core/permissions.d.ts.map +1 -0
  166. package/dist/core/permissions.js +113 -0
  167. package/dist/core/permissions.js.map +1 -0
  168. package/dist/core/registry.d.ts +80 -0
  169. package/dist/core/registry.d.ts.map +1 -0
  170. package/dist/core/registry.js +308 -0
  171. package/dist/core/registry.js.map +1 -0
  172. package/dist/core/snapshots.d.ts +20 -0
  173. package/dist/core/snapshots.d.ts.map +1 -0
  174. package/dist/core/snapshots.js +73 -0
  175. package/dist/core/snapshots.js.map +1 -0
  176. package/dist/core/types.d.ts +168 -0
  177. package/dist/core/types.d.ts.map +1 -0
  178. package/dist/core/types.js +33 -0
  179. package/dist/core/types.js.map +1 -0
  180. package/dist/hooks/cli.d.ts +11 -0
  181. package/dist/hooks/cli.d.ts.map +1 -0
  182. package/dist/hooks/cli.js +32 -0
  183. package/dist/hooks/cli.js.map +1 -0
  184. package/dist/hooks/index.d.ts +23 -0
  185. package/dist/hooks/index.d.ts.map +1 -0
  186. package/dist/hooks/index.js +58 -0
  187. package/dist/hooks/index.js.map +1 -0
  188. package/dist/index.d.ts +82 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +49 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/memory/index.d.ts +105 -0
  193. package/dist/memory/index.d.ts.map +1 -0
  194. package/dist/memory/index.js +298 -0
  195. package/dist/memory/index.js.map +1 -0
  196. package/dist/memory/schema.d.ts +6 -0
  197. package/dist/memory/schema.d.ts.map +1 -0
  198. package/dist/memory/schema.js +71 -0
  199. package/dist/memory/schema.js.map +1 -0
  200. package/dist/plugin/index.d.ts +6 -0
  201. package/dist/plugin/index.d.ts.map +1 -0
  202. package/dist/plugin/index.js +182 -0
  203. package/dist/plugin/index.js.map +1 -0
  204. package/dist/runtime/acp.d.ts +41 -0
  205. package/dist/runtime/acp.d.ts.map +1 -0
  206. package/dist/runtime/acp.js +137 -0
  207. package/dist/runtime/acp.js.map +1 -0
  208. package/dist/runtime/adaptive.d.ts +34 -0
  209. package/dist/runtime/adaptive.d.ts.map +1 -0
  210. package/dist/runtime/adaptive.js +229 -0
  211. package/dist/runtime/adaptive.js.map +1 -0
  212. package/dist/runtime/autonomy.d.ts +21 -0
  213. package/dist/runtime/autonomy.d.ts.map +1 -0
  214. package/dist/runtime/autonomy.js +74 -0
  215. package/dist/runtime/autonomy.js.map +1 -0
  216. package/dist/runtime/backends/claude.d.ts +9 -0
  217. package/dist/runtime/backends/claude.d.ts.map +1 -0
  218. package/dist/runtime/backends/claude.js +134 -0
  219. package/dist/runtime/backends/claude.js.map +1 -0
  220. package/dist/runtime/backends/codex.d.ts +9 -0
  221. package/dist/runtime/backends/codex.d.ts.map +1 -0
  222. package/dist/runtime/backends/codex.js +132 -0
  223. package/dist/runtime/backends/codex.js.map +1 -0
  224. package/dist/runtime/backends/gemini.d.ts +9 -0
  225. package/dist/runtime/backends/gemini.d.ts.map +1 -0
  226. package/dist/runtime/backends/gemini.js +103 -0
  227. package/dist/runtime/backends/gemini.js.map +1 -0
  228. package/dist/runtime/backends/index.d.ts +17 -0
  229. package/dist/runtime/backends/index.d.ts.map +1 -0
  230. package/dist/runtime/backends/index.js +39 -0
  231. package/dist/runtime/backends/index.js.map +1 -0
  232. package/dist/runtime/backends/mock.d.ts +21 -0
  233. package/dist/runtime/backends/mock.d.ts.map +1 -0
  234. package/dist/runtime/backends/mock.js +46 -0
  235. package/dist/runtime/backends/mock.js.map +1 -0
  236. package/dist/runtime/backends/types.d.ts +34 -0
  237. package/dist/runtime/backends/types.d.ts.map +1 -0
  238. package/dist/runtime/backends/types.js +2 -0
  239. package/dist/runtime/backends/types.js.map +1 -0
  240. package/dist/runtime/backends/vercel-ai.d.ts +14 -0
  241. package/dist/runtime/backends/vercel-ai.d.ts.map +1 -0
  242. package/dist/runtime/backends/vercel-ai.js +137 -0
  243. package/dist/runtime/backends/vercel-ai.js.map +1 -0
  244. package/dist/runtime/cache-optimizer.d.ts +37 -0
  245. package/dist/runtime/cache-optimizer.d.ts.map +1 -0
  246. package/dist/runtime/cache-optimizer.js +54 -0
  247. package/dist/runtime/cache-optimizer.js.map +1 -0
  248. package/dist/runtime/cascade.d.ts +26 -0
  249. package/dist/runtime/cascade.d.ts.map +1 -0
  250. package/dist/runtime/cascade.js +54 -0
  251. package/dist/runtime/cascade.js.map +1 -0
  252. package/dist/runtime/chunker.d.ts +36 -0
  253. package/dist/runtime/chunker.d.ts.map +1 -0
  254. package/dist/runtime/chunker.js +210 -0
  255. package/dist/runtime/chunker.js.map +1 -0
  256. package/dist/runtime/compaction.d.ts +22 -0
  257. package/dist/runtime/compaction.d.ts.map +1 -0
  258. package/dist/runtime/compaction.js +36 -0
  259. package/dist/runtime/compaction.js.map +1 -0
  260. package/dist/runtime/compounder.d.ts +66 -0
  261. package/dist/runtime/compounder.d.ts.map +1 -0
  262. package/dist/runtime/compounder.js +276 -0
  263. package/dist/runtime/compounder.js.map +1 -0
  264. package/dist/runtime/cost-model.d.ts +24 -0
  265. package/dist/runtime/cost-model.d.ts.map +1 -0
  266. package/dist/runtime/cost-model.js +120 -0
  267. package/dist/runtime/cost-model.js.map +1 -0
  268. package/dist/runtime/distiller.d.ts +21 -0
  269. package/dist/runtime/distiller.d.ts.map +1 -0
  270. package/dist/runtime/distiller.js +70 -0
  271. package/dist/runtime/distiller.js.map +1 -0
  272. package/dist/runtime/engine.d.ts +123 -0
  273. package/dist/runtime/engine.d.ts.map +1 -0
  274. package/dist/runtime/engine.js +969 -0
  275. package/dist/runtime/engine.js.map +1 -0
  276. package/dist/runtime/executor.d.ts +71 -0
  277. package/dist/runtime/executor.d.ts.map +1 -0
  278. package/dist/runtime/executor.js +283 -0
  279. package/dist/runtime/executor.js.map +1 -0
  280. package/dist/runtime/heuristics.d.ts +33 -0
  281. package/dist/runtime/heuristics.d.ts.map +1 -0
  282. package/dist/runtime/heuristics.js +188 -0
  283. package/dist/runtime/heuristics.js.map +1 -0
  284. package/dist/runtime/living-spec.d.ts +34 -0
  285. package/dist/runtime/living-spec.d.ts.map +1 -0
  286. package/dist/runtime/living-spec.js +91 -0
  287. package/dist/runtime/living-spec.js.map +1 -0
  288. package/dist/runtime/lsp.d.ts +50 -0
  289. package/dist/runtime/lsp.d.ts.map +1 -0
  290. package/dist/runtime/lsp.js +110 -0
  291. package/dist/runtime/lsp.js.map +1 -0
  292. package/dist/runtime/mcp.d.ts +27 -0
  293. package/dist/runtime/mcp.d.ts.map +1 -0
  294. package/dist/runtime/mcp.js +154 -0
  295. package/dist/runtime/mcp.js.map +1 -0
  296. package/dist/runtime/model-router.d.ts +22 -0
  297. package/dist/runtime/model-router.d.ts.map +1 -0
  298. package/dist/runtime/model-router.js +94 -0
  299. package/dist/runtime/model-router.js.map +1 -0
  300. package/dist/runtime/panes.d.ts +76 -0
  301. package/dist/runtime/panes.d.ts.map +1 -0
  302. package/dist/runtime/panes.js +279 -0
  303. package/dist/runtime/panes.js.map +1 -0
  304. package/dist/runtime/plan-search.d.ts +41 -0
  305. package/dist/runtime/plan-search.d.ts.map +1 -0
  306. package/dist/runtime/plan-search.js +140 -0
  307. package/dist/runtime/plan-search.js.map +1 -0
  308. package/dist/runtime/plugins.d.ts +59 -0
  309. package/dist/runtime/plugins.d.ts.map +1 -0
  310. package/dist/runtime/plugins.js +121 -0
  311. package/dist/runtime/plugins.js.map +1 -0
  312. package/dist/runtime/reflexion.d.ts +22 -0
  313. package/dist/runtime/reflexion.d.ts.map +1 -0
  314. package/dist/runtime/reflexion.js +85 -0
  315. package/dist/runtime/reflexion.js.map +1 -0
  316. package/dist/runtime/review-schema.d.ts +75 -0
  317. package/dist/runtime/review-schema.d.ts.map +1 -0
  318. package/dist/runtime/review-schema.js +223 -0
  319. package/dist/runtime/review-schema.js.map +1 -0
  320. package/dist/runtime/rewriter.d.ts +8 -0
  321. package/dist/runtime/rewriter.d.ts.map +1 -0
  322. package/dist/runtime/rewriter.js +81 -0
  323. package/dist/runtime/rewriter.js.map +1 -0
  324. package/dist/runtime/sharing.d.ts +15 -0
  325. package/dist/runtime/sharing.d.ts.map +1 -0
  326. package/dist/runtime/sharing.js +48 -0
  327. package/dist/runtime/sharing.js.map +1 -0
  328. package/dist/runtime/stats.d.ts +53 -0
  329. package/dist/runtime/stats.d.ts.map +1 -0
  330. package/dist/runtime/stats.js +160 -0
  331. package/dist/runtime/stats.js.map +1 -0
  332. package/dist/runtime/templates.d.ts +77 -0
  333. package/dist/runtime/templates.d.ts.map +1 -0
  334. package/dist/runtime/templates.js +221 -0
  335. package/dist/runtime/templates.js.map +1 -0
  336. package/dist/runtime/traces.d.ts +60 -0
  337. package/dist/runtime/traces.d.ts.map +1 -0
  338. package/dist/runtime/traces.js +166 -0
  339. package/dist/runtime/traces.js.map +1 -0
  340. package/dist/runtime/verifier.d.ts +54 -0
  341. package/dist/runtime/verifier.d.ts.map +1 -0
  342. package/dist/runtime/verifier.js +172 -0
  343. package/dist/runtime/verifier.js.map +1 -0
  344. package/dist/runtime/worktree.d.ts +24 -0
  345. package/dist/runtime/worktree.d.ts.map +1 -0
  346. package/dist/runtime/worktree.js +82 -0
  347. package/dist/runtime/worktree.js.map +1 -0
  348. package/dist/tui/dashboard.d.ts +65 -0
  349. package/dist/tui/dashboard.d.ts.map +1 -0
  350. package/dist/tui/dashboard.js +496 -0
  351. package/dist/tui/dashboard.js.map +1 -0
  352. package/dist/tui/progress.d.ts +32 -0
  353. package/dist/tui/progress.d.ts.map +1 -0
  354. package/dist/tui/progress.js +257 -0
  355. package/dist/tui/progress.js.map +1 -0
  356. package/dist/tui/renderer.d.ts +72 -0
  357. package/dist/tui/renderer.d.ts.map +1 -0
  358. package/dist/tui/renderer.js +205 -0
  359. package/dist/tui/renderer.js.map +1 -0
  360. package/dist/utils/compact-format.d.ts +35 -0
  361. package/dist/utils/compact-format.d.ts.map +1 -0
  362. package/dist/utils/compact-format.js +106 -0
  363. package/dist/utils/compact-format.js.map +1 -0
  364. package/dist/utils/config.d.ts +73 -0
  365. package/dist/utils/config.d.ts.map +1 -0
  366. package/dist/utils/config.js +70 -0
  367. package/dist/utils/config.js.map +1 -0
  368. package/dist/utils/env.d.ts +6 -0
  369. package/dist/utils/env.d.ts.map +1 -0
  370. package/dist/utils/env.js +28 -0
  371. package/dist/utils/env.js.map +1 -0
  372. package/dist/utils/errors.d.ts +14 -0
  373. package/dist/utils/errors.d.ts.map +1 -0
  374. package/dist/utils/errors.js +120 -0
  375. package/dist/utils/errors.js.map +1 -0
  376. package/dist/utils/logger.d.ts +14 -0
  377. package/dist/utils/logger.d.ts.map +1 -0
  378. package/dist/utils/logger.js +56 -0
  379. package/dist/utils/logger.js.map +1 -0
  380. package/dist/utils/output.d.ts +10 -0
  381. package/dist/utils/output.d.ts.map +1 -0
  382. package/dist/utils/output.js +26 -0
  383. package/dist/utils/output.js.map +1 -0
  384. package/dist/utils/paths.d.ts +7 -0
  385. package/dist/utils/paths.d.ts.map +1 -0
  386. package/dist/utils/paths.js +16 -0
  387. package/dist/utils/paths.js.map +1 -0
  388. package/dist/utils/project-config.d.ts +18 -0
  389. package/dist/utils/project-config.d.ts.map +1 -0
  390. package/dist/utils/project-config.js +46 -0
  391. package/dist/utils/project-config.js.map +1 -0
  392. package/dist/utils/redact.d.ts +5 -0
  393. package/dist/utils/redact.d.ts.map +1 -0
  394. package/dist/utils/redact.js +25 -0
  395. package/dist/utils/redact.js.map +1 -0
  396. package/dist/utils/schemas.d.ts +109 -0
  397. package/dist/utils/schemas.d.ts.map +1 -0
  398. package/dist/utils/schemas.js +63 -0
  399. package/dist/utils/schemas.js.map +1 -0
  400. package/dist/utils/terminal.d.ts +33 -0
  401. package/dist/utils/terminal.d.ts.map +1 -0
  402. package/dist/utils/terminal.js +82 -0
  403. package/dist/utils/terminal.js.map +1 -0
  404. package/dist/utils/tokens.d.ts +9 -0
  405. package/dist/utils/tokens.d.ts.map +1 -0
  406. package/dist/utils/tokens.js +11 -0
  407. package/dist/utils/tokens.js.map +1 -0
  408. package/package.json +71 -0
  409. package/skills/design-system/SKILL.md +195 -0
  410. package/skills/orchestration-patterns/SKILL.md +81 -0
  411. package/skills/orchestration-patterns/examples/example-workflows.md +290 -0
  412. package/skills/orchestration-patterns/references/adversarial.md +51 -0
  413. package/skills/orchestration-patterns/references/batch.md +63 -0
  414. package/skills/orchestration-patterns/references/chaos.md +43 -0
  415. package/skills/orchestration-patterns/references/competitive.md +84 -0
  416. package/skills/orchestration-patterns/references/debate.md +44 -0
  417. package/skills/orchestration-patterns/references/emergence.md +50 -0
  418. package/skills/orchestration-patterns/references/fan-out-fan-in.md +74 -0
  419. package/skills/orchestration-patterns/references/iterative.md +99 -0
  420. package/skills/orchestration-patterns/references/pipeline.md +72 -0
  421. package/skills/swarm-output-style/SKILL.md +85 -0
  422. package/templates/add-endpoint.yml +44 -0
  423. package/templates/add-feature.yml +30 -0
  424. package/templates/agent-template.md +73 -0
  425. package/templates/bug-fix.yml +31 -0
  426. package/templates/explore.yml +21 -0
  427. package/templates/fix-pr.yml +30 -0
  428. package/templates/migration.yml +36 -0
  429. package/templates/refactor.yml +35 -0
  430. package/templates/security-audit.yml +27 -0
  431. package/templates/workflow-template.md +63 -0
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: design-system
3
+ description: |
4
+ Project design system for consistent, high-quality UI across all implementations.
5
+ TRIGGER when: building any frontend, UI, web page, component, dashboard, form, or
6
+ user-facing interface. Also triggers on: "style", "design", "layout", "theme",
7
+ "CSS", "component", "page", "responsive".
8
+ DO NOT TRIGGER for: backend code, scripts, CLI tools, documentation.
9
+ ---
10
+
11
+ # Design System
12
+
13
+ This is the project's visual identity. Follow it exactly. Do not deviate.
14
+
15
+ ## Aesthetic: Clean, Light, Spacious
16
+
17
+ Inspired by Vercel and Stripe — precision engineering expressed visually. Every pixel is intentional. Nothing decorative. Nothing gratuitous.
18
+
19
+ **The feel:** Calm authority. Like a well-designed instrument — everything exactly where it should be, nothing extra.
20
+
21
+ ## Typography
22
+
23
+ **Font stack (in order of preference):**
24
+ - Headings: `'Geist', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif`
25
+ - Body: `'Geist', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif`
26
+ - Code/monospace: `'Geist Mono', 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace`
27
+
28
+ **Scale:**
29
+ ```
30
+ --text-xs: 0.75rem / 12px
31
+ --text-sm: 0.875rem / 14px
32
+ --text-base: 1rem / 16px
33
+ --text-lg: 1.125rem / 18px
34
+ --text-xl: 1.25rem / 20px
35
+ --text-2xl: 1.5rem / 24px
36
+ --text-3xl: 1.875rem / 30px
37
+ --text-4xl: 2.25rem / 36px
38
+ ```
39
+
40
+ **Rules:**
41
+ - Body text: 16px, line-height 1.6, `--color-text-secondary` for most text
42
+ - Headings: semibold (600), tight letter-spacing (-0.02em), `--color-text-primary`
43
+ - Labels/captions: 12-14px, uppercase tracking (0.05em), `--color-text-tertiary`
44
+ - Never bold body text. Use weight only for headings and emphasis.
45
+ - Maximum line width: 65ch for prose, 80ch for code
46
+
47
+ ## Color
48
+
49
+ **Light mode (default):**
50
+ ```
51
+ --color-bg: #ffffff
52
+ --color-bg-subtle: #fafafa
53
+ --color-bg-muted: #f4f4f5
54
+ --color-bg-elevated: #ffffff (with shadow)
55
+
56
+ --color-border: #e4e4e7
57
+ --color-border-subtle: #f4f4f5
58
+
59
+ --color-text-primary: #09090b
60
+ --color-text-secondary: #3f3f46
61
+ --color-text-tertiary: #a1a1aa
62
+
63
+ --color-accent: #18181b (near-black — the Vercel approach)
64
+ --color-accent-hover: #27272a
65
+
66
+ --color-success: #22c55e
67
+ --color-warning: #f59e0b
68
+ --color-error: #ef4444
69
+ --color-info: #3b82f6
70
+ ```
71
+
72
+ **Dark mode:**
73
+ ```
74
+ --color-bg: #09090b
75
+ --color-bg-subtle: #18181b
76
+ --color-bg-muted: #27272a
77
+ --color-bg-elevated: #18181b (with subtle border)
78
+
79
+ --color-border: #27272a
80
+ --color-border-subtle: #1c1c1e
81
+
82
+ --color-text-primary: #fafafa
83
+ --color-text-secondary: #a1a1aa
84
+ --color-text-tertiary: #71717a
85
+
86
+ --color-accent: #fafafa (near-white)
87
+ --color-accent-hover: #e4e4e7
88
+ ```
89
+
90
+ **Rules:**
91
+ - No gradients unless they serve a specific purpose
92
+ - No colored backgrounds for sections — use whitespace to separate
93
+ - Accent color is near-black (light) or near-white (dark) — let the content be the color
94
+ - Status colors (success/warning/error) used sparingly, only for actual status
95
+ - Never use blue for links — use `--color-text-primary` with underline on hover
96
+
97
+ ## Spacing
98
+
99
+ **Scale (8px base):**
100
+ ```
101
+ --space-1: 0.25rem / 4px
102
+ --space-2: 0.5rem / 8px
103
+ --space-3: 0.75rem / 12px
104
+ --space-4: 1rem / 16px
105
+ --space-5: 1.25rem / 20px
106
+ --space-6: 1.5rem / 24px
107
+ --space-8: 2rem / 32px
108
+ --space-10: 2.5rem / 40px
109
+ --space-12: 3rem / 48px
110
+ --space-16: 4rem / 64px
111
+ --space-20: 5rem / 80px
112
+ --space-24: 6rem / 96px
113
+ ```
114
+
115
+ **Rules:**
116
+ - Page padding: `--space-6` minimum on mobile, `--space-16` on desktop
117
+ - Section spacing: `--space-16` to `--space-24` between major sections
118
+ - Card padding: `--space-6` to `--space-8`
119
+ - Generous whitespace always. When in doubt, add more space.
120
+ - Consistent rhythm — pick a spacing value and repeat it. Don't use 7 different margins.
121
+
122
+ ## Layout
123
+
124
+ **Grid:** 12-column on desktop, single column on mobile. Max content width: 1200px.
125
+
126
+ **Rules:**
127
+ - Left-aligned content, not centered (unless it's a hero/landing)
128
+ - No card grids where a simple list would do
129
+ - Navigation: top bar or left sidebar, never both
130
+ - Content hierarchy through typography and spacing, not boxes and borders
131
+ - Forms: single column, full-width inputs, clear labels above (not inline)
132
+ - Tables: clean, minimal borders (top/bottom only or none), generous row padding
133
+
134
+ ## Components
135
+
136
+ **Buttons:**
137
+ - Primary: `--color-accent` bg, white text, no border, subtle hover darkening
138
+ - Secondary: transparent bg, `--color-border` border, text color matches border
139
+ - Size: 36px height default, 14px font, `--space-4` horizontal padding
140
+ - Border-radius: 6px (not fully rounded — that's a fad)
141
+ - No shadows on buttons. No gradients.
142
+
143
+ **Inputs:**
144
+ - Height: 40px
145
+ - Border: 1px `--color-border`
146
+ - Border-radius: 6px
147
+ - Focus: 2px ring in `--color-accent` with 2px offset
148
+ - Background: `--color-bg` (not gray)
149
+ - Placeholder text: `--color-text-tertiary`
150
+
151
+ **Cards:**
152
+ - Background: `--color-bg-elevated`
153
+ - Border: 1px `--color-border-subtle` OR shadow, never both
154
+ - Shadow (if used): `0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06)`
155
+ - Border-radius: 8px
156
+ - No colored headers. No icons in corners.
157
+
158
+ **Tables:**
159
+ - No zebra striping
160
+ - Header: semibold, `--color-text-tertiary`, uppercase 12px with tracking
161
+ - Rows: `--color-border-subtle` bottom border only
162
+ - Cell padding: `--space-3` vertical, `--space-4` horizontal
163
+ - Align numbers right, text left
164
+
165
+ ## Animations
166
+
167
+ - Duration: 150ms for micro-interactions, 300ms for layout changes
168
+ - Easing: `cubic-bezier(0.4, 0, 0.2, 1)` (Material standard)
169
+ - What to animate: opacity, transform (translate/scale), color, border-color
170
+ - What NOT to animate: width, height, margin, padding (causes layout thrash)
171
+ - Page transitions: fade (opacity 0→1, 150ms)
172
+ - No bouncing, no elastic, no spring physics unless it's a playful context
173
+
174
+ ## Anti-Patterns (NEVER do these)
175
+
176
+ - Colored section backgrounds (the "alternating gray/white sections" pattern)
177
+ - Hero sections with stock imagery or abstract gradients
178
+ - Card grids with icons and 3 bullet points (the "SaaS features" pattern)
179
+ - Rounded pill buttons on everything
180
+ - Drop shadows on everything
181
+ - "Glass morphism" / frosted glass on cards
182
+ - Centering everything — left-align by default
183
+ - Using 5+ font weights — stick to regular (400) and semibold (600)
184
+ - Purple-to-blue gradients (the universal AI slop gradient)
185
+ - Emoji as design elements in professional interfaces
186
+
187
+ ## Implementation
188
+
189
+ When building a new page or component:
190
+ 1. Check if the project has an existing CSS/design system — use it
191
+ 2. If starting fresh, implement these tokens as CSS custom properties
192
+ 3. Use Tailwind if the project uses it — but follow THIS system's values, not Tailwind defaults
193
+ 4. Semantic HTML first, styling second
194
+ 5. Mobile-first responsive design
195
+ 6. Support both light and dark mode via `prefers-color-scheme`
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: orchestration-patterns
3
+ description: |
4
+ Knowledge about swarm orchestration patterns for coordinating parallel sub-agents.
5
+ TRIGGER when: user mentions "orchestrate", "parallel agents", "fan-out", "swarm",
6
+ "dispatch agents", "agent coordination", "concurrent", "multi-agent", "batch migration",
7
+ "red-team", "debate", "chaos", "emergence", "adversarial", "brownian", "builder breaker",
8
+ "ambient", "background", "discover", "hypothesis", "experiment", "grounding",
9
+ "reality check", "human role",
10
+ or asks how to break a task into parallel work.
11
+ DO NOT TRIGGER for simple tasks that don't need orchestration.
12
+ ---
13
+
14
+ # Swarm Orchestration Patterns
15
+
16
+ ## Quick Reference
17
+
18
+ ### When to Orchestrate
19
+ Use orchestration when a task has **3+ independent work units** that can run concurrently.
20
+ Do NOT orchestrate simple, linear tasks — the overhead isn't worth it.
21
+
22
+ ### Pattern Selection
23
+
24
+ | Pattern | When to Use | Example |
25
+ |---------|------------|---------|
26
+ | **Fan-out/Fan-in** | N independent tasks, aggregate results | Research 5 different aspects of a system |
27
+ | **Pipeline** | Sequential dependencies, each step feeds the next | Parse → Transform → Validate → Write |
28
+ | **Hybrid** | Research first, then implement, then review | Most feature development |
29
+ | **Review Cycle** | Implementation needs quality gates | Security-sensitive changes |
30
+ | **Batch** | Same operation on many targets | Migrate 20 files to new format |
31
+ | **Competitive** | Optimal approach is uncertain | Spike: try 2 approaches, pick best |
32
+ | **Iterative** | Quality gate required before shipping | Security-sensitive changes, complex logic |
33
+ | **Adversarial** | Need to verify robustness, security-critical code | /red-team: build + break simultaneously |
34
+ | **Debate** | Uncertain code quality, need multi-perspective consensus | /debate: multi-round argumentation |
35
+ | **Chaos** | Broad improvements with no specific requirements | /chaos: brownian ratchet, CI filters |
36
+ | **Emergence** | Experimental — can agents self-organize? | /emergence: identical agents, no roles |
37
+
38
+ ### Model Routing
39
+
40
+ | Task | Model | Rationale |
41
+ |------|-------|-----------|
42
+ | File search, listing, simple greps | haiku | Fast, cheap, sufficient for pattern matching |
43
+ | Documentation writing | haiku | Straightforward content generation |
44
+ | Codebase exploration, tracing flows | sonnet | Needs comprehension but not generation |
45
+ | Convention review | sonnet | Pattern matching against existing style |
46
+ | Code implementation | opus | Writing correct code requires deep reasoning |
47
+ | Security review | opus | Must catch subtle vulnerabilities |
48
+ | Correctness review | opus | Must reason about edge cases and logic |
49
+ | Debugging | opus | Root cause analysis requires deep understanding |
50
+ | Architecture decisions | opus | Complex trade-off reasoning |
51
+ | Test writing (complex) | opus | Must understand code deeply to test it well |
52
+
53
+ ### Dispatch Checklist
54
+ Before dispatching a sub-agent, verify your prompt includes:
55
+ - [ ] Specific file paths and line numbers to focus on
56
+ - [ ] Relevant context from prior phases
57
+ - [ ] Clear success criteria
58
+ - [ ] Project conventions (from CLAUDE.md if present)
59
+ - [ ] Scope boundaries (what NOT to touch)
60
+ - [ ] Scratchpad path included for cross-agent communication
61
+ - [ ] Self-assessment fields (Confidence, Blockers, Files touched) requested in output
62
+ - [ ] Agent spawned as team member (team_name, name, run_in_background: true)
63
+
64
+ ### Anti-Patterns to Avoid
65
+ 1. **Over-orchestration**: Don't use 5 agents for a 10-line change
66
+ 2. **Starving context**: Sub-agents can't ask questions — give them everything
67
+ 3. **File conflicts**: Two agents editing the same file = merge hell
68
+ 4. **Model waste**: Don't use opus for file search or documentation
69
+ 5. **Sequential disguised as parallel**: If B depends on A's output, don't pretend they're parallel
70
+
71
+ ### Cost Estimation Reference
72
+
73
+ | Model | Typical per-agent cost | Use for |
74
+ |-------|----------------------|---------|
75
+ | haiku | ~$0.02 | File search, documentation, simple greps |
76
+ | sonnet | ~$0.08 | Research, exploration, convention review |
77
+ | opus | ~$0.40 | Implementation, security review, debugging, testing |
78
+
79
+ Include estimated cost in every orchestration plan: sum of (agent count × per-model cost).
80
+
81
+ For detailed pattern documentation, see the references/ directory.
@@ -0,0 +1,290 @@
1
+ # Example Orchestration Workflows
2
+
3
+ ## Example 1: Feature Development (Hybrid Pattern)
4
+
5
+ **Task**: "Add WebSocket support to the notification system"
6
+
7
+ ```
8
+ Phase 1: Research (parallel, 3 agents, sonnet)
9
+ ├── Researcher A: Current notification architecture (models, routes, services)
10
+ ├── Researcher B: Existing WebSocket patterns in codebase (if any)
11
+ └── Researcher C: Test infrastructure and patterns for async code
12
+
13
+ Phase 2: Architecture (sequential, 1 agent, opus)
14
+ └── Orchestrator synthesizes research → proposes WebSocket architecture
15
+
16
+ Phase 3: Implementation (parallel, 2 agents, opus)
17
+ ├── Implementer A: WebSocket server + connection manager
18
+ └── Implementer B: Client notification handlers + event types
19
+
20
+ Phase 4: Testing (parallel, 2 agents, opus)
21
+ ├── Tester A: Unit tests for WebSocket server
22
+ └── Tester B: Integration tests for notification flow
23
+
24
+ Phase 5: Review (parallel, 2 agents, opus)
25
+ ├── Reviewer A: Correctness + error handling review
26
+ └── Reviewer B: Security review (auth, connection limits, data exposure)
27
+
28
+ Result: 10 sub-agents, 5 phases, ~4 parallel dispatches
29
+ ```
30
+
31
+ ## Example 2: Bug Investigation (Pipeline + Fan-out)
32
+
33
+ **Task**: "Users report intermittent 500 errors on /api/workflows"
34
+
35
+ ```
36
+ Phase 1: Research (parallel, 3 agents, sonnet)
37
+ ├── Researcher A: Recent changes to workflow endpoints (git log)
38
+ ├── Researcher B: Error handling and logging in workflow routes
39
+ └── Researcher C: Database queries and connection patterns in workflows
40
+
41
+ Phase 2: Diagnosis (sequential, 1 agent, opus)
42
+ └── Debugger: Synthesize research, form hypotheses, trace root cause
43
+
44
+ Phase 3: Fix (sequential, 1 agent, opus)
45
+ └── Implementer: Apply minimal fix based on diagnosis
46
+
47
+ Phase 4: Verify (parallel, 2 agents, opus)
48
+ ├── Tester: Write regression test, run test suite
49
+ └── Reviewer: Review fix for correctness and side effects
50
+
51
+ Result: 7 sub-agents, 4 phases
52
+ ```
53
+
54
+ ## Example 3: Code Migration (Batch Pattern)
55
+
56
+ **Task**: "Migrate all 15 connector plugins from sync to async"
57
+
58
+ ```
59
+ Phase 1: Research (parallel, 2 agents, sonnet)
60
+ ├── Researcher A: Current sync connector interface and patterns
61
+ └── Researcher B: Target async interface and migration requirements
62
+
63
+ Phase 2: Template (sequential, 1 agent, opus)
64
+ └── Create migration template based on research
65
+
66
+ Phase 3: Batch Migration (parallel, 15 agents, opus, worktree isolation)
67
+ ├── Implementer 1: Migrate connector_s3.py
68
+ ├── Implementer 2: Migrate connector_gcs.py
69
+ ├── ...
70
+ └── Implementer 15: Migrate connector_azure.py
71
+
72
+ Phase 4: Integration (sequential, 1 agent, opus)
73
+ └── Verify all connectors work together, run integration tests
74
+
75
+ Result: 19 sub-agents, 4 phases, each migration gets its own PR
76
+ ```
77
+
78
+ ## Example 4: Multi-Angle Research (Fan-out/Fan-in)
79
+
80
+ **Task**: "How does our auth system work end-to-end?"
81
+
82
+ ```
83
+ Phase 1: Research (parallel, 4 agents, sonnet)
84
+ ├── Researcher A: Authentication entry points (login, OAuth, API keys)
85
+ ├── Researcher B: Token lifecycle (creation, refresh, revocation)
86
+ ├── Researcher C: Authorization middleware and permission checks
87
+ └── Researcher D: Session management and storage
88
+
89
+ Phase 2: Synthesis (sequential, orchestrator)
90
+ └── Merge all findings into comprehensive auth system documentation
91
+
92
+ Result: 4 sub-agents, 2 phases, produces architecture doc
93
+ ```
94
+
95
+ ## Example 5: PR Review (Fan-out/Fan-in)
96
+
97
+ **Task**: "Review PR #142 thoroughly"
98
+
99
+ ```
100
+ Phase 1: Context (parallel, 2 agents, sonnet)
101
+ ├── Researcher A: Understand PR scope from diff and commits
102
+ └── Researcher B: Read related CLAUDE.md and project conventions
103
+
104
+ Phase 2: Review (parallel, 3 agents, opus)
105
+ ├── Reviewer A: Correctness — bugs, logic errors, edge cases
106
+ ├── Reviewer B: Security — vulnerabilities, data exposure, auth
107
+ └── Reviewer C: Quality — patterns, naming, complexity, tests
108
+
109
+ Phase 3: Aggregate (sequential, orchestrator)
110
+ └── Prioritize findings: Critical > Important > Suggestions > Strengths
111
+
112
+ Result: 5 sub-agents, 3 phases
113
+ ```
114
+
115
+ ## Example 6: Design Spike (Competitive Pattern)
116
+
117
+ **Task**: "Should we use WebSockets or Server-Sent Events for real-time updates?"
118
+
119
+ ```
120
+ Phase 1: Research (parallel, 2 agents, sonnet)
121
+ ├── Researcher A: WebSocket patterns, complexity, browser support
122
+ └── Researcher B: SSE patterns, complexity, browser support
123
+
124
+ Phase 2: Implement (parallel, 2 agents, opus, worktree isolation)
125
+ ├── Implementer A: WebSocket implementation
126
+ └── Implementer B: SSE implementation
127
+
128
+ Phase 3: Evaluate (parallel, 2 agents, opus)
129
+ ├── Reviewer A: Review WebSocket approach
130
+ └── Reviewer B: Review SSE approach
131
+
132
+ Phase 4: Select (sequential)
133
+ └── Present comparison table, user picks
134
+
135
+ Result: 6 sub-agents, 4 phases, 2 working prototypes to compare
136
+ ```
137
+
138
+ ## Example 7: Iterative Quality Gate (Iterative Pattern)
139
+
140
+ **Task**: "Implement the payment processing module — must pass security review"
141
+
142
+ ```
143
+ Phase 1: Research (parallel, 2 agents, sonnet)
144
+ ├── Researcher A: Payment processing patterns in codebase
145
+ └── Researcher B: Security requirements and compliance constraints
146
+
147
+ Phase 2: Implement (sequential, 1 agent, opus)
148
+ └── Implementer: Build payment module based on research
149
+
150
+ Phase 3-4: Review-Fix Loop (max 3 iterations)
151
+ ├── Iteration 1:
152
+ │ ├── Review: 2 critical (SQL injection, missing auth check)
153
+ │ └── Fix: Parameterized queries, added auth middleware
154
+ ├── Iteration 2:
155
+ │ ├── Review: 1 important (insufficient input validation)
156
+ │ └── Fix: Added validation layer
157
+ └── Iteration 3:
158
+ └── Review: PASS (0 critical, 0 important)
159
+
160
+ Result: 7+ sub-agents, 4+ phases, guaranteed quality gate
161
+ ```
162
+
163
+ ## Example 8: Test-Driven Development (TDD Pattern)
164
+
165
+ **Task**: "Add rate limiting to the API gateway"
166
+
167
+ ```
168
+ Phase 1: Research (parallel, 2 agents, sonnet)
169
+ ├── Researcher A: Current API gateway middleware stack
170
+ └── Researcher B: Test infrastructure and patterns
171
+
172
+ Phase 2: Write Failing Tests (sequential, 1 agent, opus)
173
+ └── Tester: Write rate limit tests (per-user, per-endpoint, burst)
174
+ Tests run: 5 new tests, all RED ✗
175
+
176
+ Phase 3: Implement (sequential, 1 agent, opus)
177
+ └── Implementer: Implement rate limiter to pass tests
178
+ Tests run: 5 new tests, all GREEN ✓
179
+
180
+ Phase 4: Review (parallel, 2 agents)
181
+ ├── Reviewer A (opus): Correctness + edge cases
182
+ └── Reviewer B (sonnet): Convention compliance
183
+
184
+ Result: 6 sub-agents, 4 phases, test-first guarantee
185
+ ```
186
+
187
+ ## Example 9: Fix PR Review Comments (Fan-out Pattern)
188
+
189
+ **Task**: "Fix the 8 review comments on PR #142"
190
+
191
+ ```
192
+ Phase 1: Gather (sequential, orchestrator)
193
+ └── Fetch PR comments via gh, group by file
194
+
195
+ Phase 2: Fix (parallel, 3 agents, opus)
196
+ ├── Implementer A: Fix 3 comments in src/auth/ files
197
+ ├── Implementer B: Fix 3 comments in src/api/ files
198
+ └── Implementer C: Fix 2 comments in src/models/ files
199
+
200
+ Phase 3: Verify (parallel, 2 agents)
201
+ ├── Tester: Run test suite
202
+ └── Reviewer: Verify each comment was properly addressed
203
+
204
+ Result: 5 sub-agents, 3 phases, systematic comment resolution
205
+ ```
206
+
207
+ ## Example 10: Adversarial Red Team (Adversarial Pattern)
208
+
209
+ **Task**: "Implement payment processing with security hardening"
210
+
211
+ ```
212
+ Phase 1: Research (parallel, 2 agents, sonnet)
213
+ ├── Researcher A: Payment processing patterns
214
+ └── Researcher B: Common payment security vulnerabilities
215
+
216
+ Phase 2: Build (sequential, 1 agent, opus)
217
+ └── Builder: Implement payment module
218
+
219
+ Phase 3: Break (parallel, 3 agents, opus)
220
+ ├── Breaker A: Edge cases (null amounts, negative, overflow)
221
+ ├── Breaker B: Security attacks (injection, auth bypass)
222
+ └── Breaker C: Mutation testing (flip conditions, remove checks)
223
+
224
+ Phase 4: Harden (sequential, 1 agent, opus)
225
+ └── Hardener: Fix all Critical findings from breakers
226
+
227
+ Result: 7 sub-agents, 4 phases, adversarially-hardened code
228
+ ```
229
+
230
+ ## Example 11: Multi-Agent Debate (Debate Pattern)
231
+
232
+ **Task**: "Review the new caching layer for production readiness"
233
+
234
+ ```
235
+ Phase 1: Independent Review (parallel, 3 agents)
236
+ ├── Reviewer Alpha (opus): Correctness + logic
237
+ ├── Reviewer Beta (opus): Architecture + performance
238
+ └── Reviewer Gamma (sonnet): Conventions + tests
239
+
240
+ Phase 2: Debate Round (parallel, 3 agents)
241
+ ├── Debater Alpha: Responds to Beta+Gamma findings
242
+ ├── Debater Beta: Responds to Alpha+Gamma findings
243
+ └── Debater Gamma: Responds to Alpha+Beta findings
244
+
245
+ Phase 3: Verdict (sequential)
246
+ └── Aggregate: consensus rules, confidence-weighted
247
+
248
+ Result: 6 sub-agents, 3 phases, high-confidence verdict
249
+ ```
250
+
251
+ ## Example 12: Brownian Ratchet (Chaos Pattern)
252
+
253
+ **Task**: "Improve test coverage across src/utils/"
254
+
255
+ ```
256
+ Phase 1: Decompose (sequential)
257
+ └── Break into 4 overlapping focus areas
258
+
259
+ Phase 2: Swarm (parallel, 4 agents, opus, worktree isolation)
260
+ ├── Chaos 1: Focus on string utilities
261
+ ├── Chaos 2: Focus on date/time utilities
262
+ ├── Chaos 3: Focus on validation utilities
263
+ └── Chaos 4: Focus on error handling utilities
264
+
265
+ Phase 3: Ratchet (sequential)
266
+ ├── Chaos 1: tests pass → merge
267
+ ├── Chaos 2: tests pass → merge
268
+ ├── Chaos 3: tests fail → discard
269
+ └── Chaos 4: tests pass → merge
270
+
271
+ Result: 4 agents, 3 merged, 1 discarded, net +47 tests
272
+ ```
273
+
274
+ ## Example 13: Self-Organizing Agents (Emergence Pattern)
275
+
276
+ **Task**: "Build a notification system"
277
+
278
+ ```
279
+ Phase 1: Spawn (parallel, 5 identical general-purpose agents, opus)
280
+ ├── Agent 1 → emerged as: researcher (explored existing code)
281
+ ├── Agent 2 → emerged as: planner (wrote design doc)
282
+ ├── Agent 3 → emerged as: implementer (wrote notification service)
283
+ ├── Agent 4 → emerged as: tester (wrote test suite)
284
+ └── Agent 5 → emerged as: reviewer (reviewed agent 3's code)
285
+
286
+ Phase 2: Observe
287
+ └── All agents self-organized via scratchpad coordination
288
+
289
+ Result: 5 agents, no pre-assigned roles, emergent specialization
290
+ ```
@@ -0,0 +1,51 @@
1
+ # Adversarial / Red Team Pattern
2
+
3
+ ## Overview
4
+ Builder and breaker agents work simultaneously. One implements, the other tries to destroy. The code that survives both is genuinely robust.
5
+
6
+ ## When to Use
7
+ - Security-critical features (auth, payments, data handling)
8
+ - Code that must handle adversarial inputs
9
+ - Features where edge case coverage is critical
10
+ - Any code where "it works in the happy path" isn't enough
11
+
12
+ ## Architecture
13
+ ```
14
+ ┌─── Builder (implement) ───┐
15
+ │ │
16
+ User Task ─→ Plan ─┤ ├─→ Harden ─→ Result
17
+ │ │
18
+ └─── Breakers (3 parallel) ──┘
19
+ - Edge cases
20
+ - Security attacks
21
+ - Mutation testing
22
+ ```
23
+
24
+ ## Implementation
25
+ ```
26
+ # Setup
27
+ TeamCreate(team_name="red-team")
28
+
29
+ # Phase 1: Build
30
+ Agent(name="builder", team_name="red-team", run_in_background=True,
31
+ prompt="Implement: ...", model="opus")
32
+
33
+ # Phase 2: Break (parallel)
34
+ Agent(name="breaker-edges", team_name="red-team", run_in_background=True,
35
+ prompt="Find edge cases: ...", model="opus")
36
+ Agent(name="breaker-security", team_name="red-team", run_in_background=True,
37
+ prompt="Attack security: ...", model="opus")
38
+ Agent(name="breaker-mutations", team_name="red-team", run_in_background=True,
39
+ prompt="Mutation test: ...", model="opus")
40
+
41
+ # Phase 3: Harden
42
+ Agent(name="hardener", team_name="red-team", run_in_background=True,
43
+ prompt="Fix critical findings: ...", model="opus")
44
+
45
+ # Shutdown all, TeamDelete
46
+ ```
47
+
48
+ ## Pitfalls
49
+ - **Breakers too aggressive**: Finding 50 theoretical issues when 3 are real. Focus on Critical/Important only.
50
+ - **Builder demoralized**: The builder's code gets torn apart. Frame it as strengthening, not criticism.
51
+ - **False positives**: Breakers may flag things that aren't actually vulnerabilities. Harden only confirmed issues.
@@ -0,0 +1,63 @@
1
+ # Batch Pattern
2
+
3
+ ## Overview
4
+ Apply the same operation to N independent targets simultaneously. Each agent gets the same instructions but different scope.
5
+
6
+ ## When to Use
7
+ - Migrating many files to a new format
8
+ - Applying the same refactor across multiple modules
9
+ - Running the same analysis on multiple components
10
+ - Any "for each X, do Y" task where X's are independent
11
+
12
+ ## Architecture
13
+ ```
14
+ ┌─── Agent(target=file1.py) ───┐
15
+ │ │
16
+ Template ─→ Plan ─→┼─── Agent(target=file2.py) ───┼─→ Summary
17
+ │ │
18
+ └─── Agent(target=file3.py) ───┘
19
+ ```
20
+
21
+ ## Implementation
22
+
23
+ ```
24
+ # Define the template once
25
+ template = """
26
+ Migrate {target} from v1 to v2 API format:
27
+ 1. Replace `client.get()` with `client.request(method="GET")`
28
+ 2. Add error handling wrapper
29
+ 3. Update imports
30
+ 4. Run tests for this module
31
+ """
32
+
33
+ # Setup
34
+ TeamCreate(team_name="batch-team")
35
+ for target in targets:
36
+ TaskCreate(subject=f"Migrate {target}", description="...")
37
+
38
+ # Dispatch one agent per target, all as teammates in parallel
39
+ agents = []
40
+ for i, target in enumerate(targets):
41
+ name = f"migrator-{i}"
42
+ agents.append(name)
43
+ Agent(name=name, team_name="batch-team", run_in_background=True,
44
+ prompt=template.format(target=target), model="sonnet", isolation="worktree")
45
+
46
+ # After all complete, shutdown each teammate
47
+ for name in agents:
48
+ SendMessage(to=name, message="shutdown_request")
49
+ TeamDelete(team_name="batch-team")
50
+ ```
51
+
52
+ ## Worktree Isolation
53
+ For batch operations that modify files, use `isolation: "worktree"` so each agent works on its own copy. This avoids merge conflicts and lets each agent's changes be reviewed independently (each opens a separate PR).
54
+
55
+ ## Sizing Guidelines
56
+ - **Sweet spot**: 5-15 units per batch
57
+ - **Too few** (< 3): Just do it sequentially, overhead isn't worth it
58
+ - **Too many** (> 20): Token costs add up fast, consider batching in waves
59
+
60
+ ## Pitfalls
61
+ - **Shared dependencies**: If targets import from a common module being changed, conflicts arise
62
+ - **Template rigidity**: Some targets may need special handling — allow escape hatches
63
+ - **Cost**: N agents = N × token cost. Budget accordingly.