oh-my-claude-sisyphus 3.5.8 → 3.6.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 (399) hide show
  1. package/agents/executor-high.md +2 -0
  2. package/agents/executor-low.md +2 -0
  3. package/agents/executor.md +2 -0
  4. package/agents/templates/base-agent.md +9 -0
  5. package/commands/cancel.md +8 -8
  6. package/commands/omc-setup.md +3 -3
  7. package/commands/release.md +1 -1
  8. package/commands/swarm.md +350 -148
  9. package/dist/__tests__/analytics/transcript-scanner.test.js +69 -27
  10. package/dist/__tests__/analytics/transcript-scanner.test.js.map +1 -1
  11. package/dist/__tests__/hooks.test.js +10 -9
  12. package/dist/__tests__/hooks.test.js.map +1 -1
  13. package/dist/__tests__/installer.test.js +2 -1
  14. package/dist/__tests__/installer.test.js.map +1 -1
  15. package/dist/agents/preamble.d.ts +14 -0
  16. package/dist/agents/preamble.d.ts.map +1 -0
  17. package/dist/agents/preamble.js +26 -0
  18. package/dist/agents/preamble.js.map +1 -0
  19. package/dist/analytics/session-manager.d.ts +24 -0
  20. package/dist/analytics/session-manager.d.ts.map +1 -1
  21. package/dist/analytics/session-manager.js +98 -9
  22. package/dist/analytics/session-manager.js.map +1 -1
  23. package/dist/analytics/transcript-scanner.d.ts +9 -8
  24. package/dist/analytics/transcript-scanner.d.ts.map +1 -1
  25. package/dist/analytics/transcript-scanner.js +146 -16
  26. package/dist/analytics/transcript-scanner.js.map +1 -1
  27. package/dist/cli/analytics.js +0 -0
  28. package/dist/cli/index.js +0 -0
  29. package/dist/hooks/autopilot/__tests__/cancel.test.js +14 -4
  30. package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
  31. package/dist/hooks/autopilot/__tests__/state.test.js +1 -0
  32. package/dist/hooks/autopilot/__tests__/state.test.js.map +1 -1
  33. package/dist/hooks/autopilot/__tests__/summary.test.js +38 -3
  34. package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -1
  35. package/dist/hooks/autopilot/state.d.ts +1 -1
  36. package/dist/hooks/autopilot/state.d.ts.map +1 -1
  37. package/dist/hooks/autopilot/state.js +15 -8
  38. package/dist/hooks/autopilot/state.js.map +1 -1
  39. package/dist/hooks/empty-message-sanitizer/__tests__/index.test.d.ts +2 -0
  40. package/dist/hooks/empty-message-sanitizer/__tests__/index.test.d.ts.map +1 -0
  41. package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js +416 -0
  42. package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js.map +1 -0
  43. package/dist/hooks/index.d.ts +2 -0
  44. package/dist/hooks/index.d.ts.map +1 -1
  45. package/dist/hooks/index.js +7 -0
  46. package/dist/hooks/index.js.map +1 -1
  47. package/dist/hooks/keyword-detector/__tests__/index.test.d.ts +2 -0
  48. package/dist/hooks/keyword-detector/__tests__/index.test.d.ts.map +1 -0
  49. package/dist/hooks/keyword-detector/__tests__/index.test.js +427 -0
  50. package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -0
  51. package/dist/hooks/mode-registry/index.d.ts +135 -0
  52. package/dist/hooks/mode-registry/index.d.ts.map +1 -0
  53. package/dist/hooks/mode-registry/index.js +445 -0
  54. package/dist/hooks/mode-registry/index.js.map +1 -0
  55. package/dist/hooks/mode-registry/types.d.ts +31 -0
  56. package/dist/hooks/mode-registry/types.d.ts.map +1 -0
  57. package/dist/hooks/mode-registry/types.js +7 -0
  58. package/dist/hooks/mode-registry/types.js.map +1 -0
  59. package/dist/hooks/ralph/loop.js +6 -6
  60. package/dist/hooks/ralph/loop.js.map +1 -1
  61. package/dist/hooks/swarm/__tests__/claiming.test.d.ts +2 -0
  62. package/dist/hooks/swarm/__tests__/claiming.test.d.ts.map +1 -0
  63. package/dist/hooks/swarm/__tests__/claiming.test.js +170 -0
  64. package/dist/hooks/swarm/__tests__/claiming.test.js.map +1 -0
  65. package/dist/hooks/swarm/__tests__/index.test.d.ts +2 -0
  66. package/dist/hooks/swarm/__tests__/index.test.d.ts.map +1 -0
  67. package/dist/hooks/swarm/__tests__/index.test.js +157 -0
  68. package/dist/hooks/swarm/__tests__/index.test.js.map +1 -0
  69. package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts +2 -0
  70. package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts.map +1 -0
  71. package/dist/hooks/swarm/__tests__/mode-registry.test.js +177 -0
  72. package/dist/hooks/swarm/__tests__/mode-registry.test.js.map +1 -0
  73. package/dist/hooks/swarm/claiming.d.ts +101 -0
  74. package/dist/hooks/swarm/claiming.d.ts.map +1 -0
  75. package/dist/hooks/swarm/claiming.js +460 -0
  76. package/dist/hooks/swarm/claiming.js.map +1 -0
  77. package/dist/hooks/swarm/index.d.ts +221 -0
  78. package/dist/hooks/swarm/index.d.ts.map +1 -0
  79. package/dist/hooks/swarm/index.js +413 -0
  80. package/dist/hooks/swarm/index.js.map +1 -0
  81. package/dist/hooks/swarm/state.d.ts +94 -0
  82. package/dist/hooks/swarm/state.d.ts.map +1 -0
  83. package/dist/hooks/swarm/state.js +530 -0
  84. package/dist/hooks/swarm/state.js.map +1 -0
  85. package/dist/hooks/swarm/types.d.ts +116 -0
  86. package/dist/hooks/swarm/types.d.ts.map +1 -0
  87. package/dist/hooks/swarm/types.js +22 -0
  88. package/dist/hooks/swarm/types.js.map +1 -0
  89. package/dist/hooks/think-mode/__tests__/index.test.d.ts +2 -0
  90. package/dist/hooks/think-mode/__tests__/index.test.d.ts.map +1 -0
  91. package/dist/hooks/think-mode/__tests__/index.test.js +556 -0
  92. package/dist/hooks/think-mode/__tests__/index.test.js.map +1 -0
  93. package/dist/hooks/ultrapilot/decomposer.d.ts +141 -0
  94. package/dist/hooks/ultrapilot/decomposer.d.ts.map +1 -0
  95. package/dist/hooks/ultrapilot/decomposer.js +377 -0
  96. package/dist/hooks/ultrapilot/decomposer.js.map +1 -0
  97. package/dist/hooks/ultrapilot/index.d.ts +31 -0
  98. package/dist/hooks/ultrapilot/index.d.ts.map +1 -1
  99. package/dist/hooks/ultrapilot/index.js +43 -2
  100. package/dist/hooks/ultrapilot/index.js.map +1 -1
  101. package/dist/hooks/ultrapilot/state.d.ts +1 -1
  102. package/dist/hooks/ultrapilot/state.d.ts.map +1 -1
  103. package/dist/hooks/ultrapilot/state.js +7 -0
  104. package/dist/hooks/ultrapilot/state.js.map +1 -1
  105. package/dist/hooks/ultraqa/index.js +5 -5
  106. package/dist/hooks/ultraqa/index.js.map +1 -1
  107. package/dist/hooks/ultrawork/index.js +3 -3
  108. package/dist/hooks/ultrawork/index.js.map +1 -1
  109. package/dist/installer/index.d.ts.map +1 -1
  110. package/dist/installer/index.js +8 -0
  111. package/dist/installer/index.js.map +1 -1
  112. package/package.json +3 -1
  113. package/skills/autopilot/SKILL.md +18 -0
  114. package/skills/cancel/SKILL.md +166 -141
  115. package/skills/ecomode/SKILL.md +14 -0
  116. package/skills/omc-setup/SKILL.md +27 -3
  117. package/skills/pipeline/SKILL.md +13 -0
  118. package/skills/ralph/SKILL.md +22 -1
  119. package/skills/release/SKILL.md +1 -1
  120. package/skills/swarm/SKILL.md +521 -197
  121. package/skills/ultrapilot/SKILL.md +82 -13
  122. package/skills/ultraqa/SKILL.md +13 -0
  123. package/skills/ultrawork/SKILL.md +14 -0
  124. package/dist/__tests__/analytics/analytics-summary.test.d.ts +0 -2
  125. package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +0 -1
  126. package/dist/__tests__/analytics/analytics-summary.test.js +0 -267
  127. package/dist/__tests__/analytics/analytics-summary.test.js.map +0 -1
  128. package/dist/__tests__/analytics/cost-estimator.test.d.ts +0 -2
  129. package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +0 -1
  130. package/dist/__tests__/analytics/cost-estimator.test.js +0 -212
  131. package/dist/__tests__/analytics/cost-estimator.test.js.map +0 -1
  132. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +0 -7
  133. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +0 -1
  134. package/dist/__tests__/hooks/auto-slash-command/executor.test.js +0 -374
  135. package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +0 -1
  136. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +0 -2
  137. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +0 -1
  138. package/dist/__tests__/hud/auto-tracking.integration.test.js +0 -12
  139. package/dist/__tests__/hud/auto-tracking.integration.test.js.map +0 -1
  140. package/dist/__tests__/learned-skills/config.test.d.ts +0 -2
  141. package/dist/__tests__/learned-skills/config.test.d.ts.map +0 -1
  142. package/dist/__tests__/learned-skills/config.test.js +0 -37
  143. package/dist/__tests__/learned-skills/config.test.js.map +0 -1
  144. package/dist/__tests__/learned-skills/detector.test.d.ts +0 -2
  145. package/dist/__tests__/learned-skills/detector.test.d.ts.map +0 -1
  146. package/dist/__tests__/learned-skills/detector.test.js +0 -99
  147. package/dist/__tests__/learned-skills/detector.test.js.map +0 -1
  148. package/dist/__tests__/learned-skills/finder.test.d.ts +0 -2
  149. package/dist/__tests__/learned-skills/finder.test.d.ts.map +0 -1
  150. package/dist/__tests__/learned-skills/finder.test.js +0 -59
  151. package/dist/__tests__/learned-skills/finder.test.js.map +0 -1
  152. package/dist/__tests__/learned-skills/loader.test.d.ts +0 -2
  153. package/dist/__tests__/learned-skills/loader.test.d.ts.map +0 -1
  154. package/dist/__tests__/learned-skills/loader.test.js +0 -69
  155. package/dist/__tests__/learned-skills/loader.test.js.map +0 -1
  156. package/dist/__tests__/learned-skills/parser.test.d.ts +0 -2
  157. package/dist/__tests__/learned-skills/parser.test.d.ts.map +0 -1
  158. package/dist/__tests__/learned-skills/parser.test.js +0 -81
  159. package/dist/__tests__/learned-skills/parser.test.js.map +0 -1
  160. package/dist/__tests__/learned-skills/validator.test.d.ts +0 -2
  161. package/dist/__tests__/learned-skills/validator.test.d.ts.map +0 -1
  162. package/dist/__tests__/learned-skills/validator.test.js +0 -85
  163. package/dist/__tests__/learned-skills/validator.test.js.map +0 -1
  164. package/dist/agents/document-writer.d.ts +0 -11
  165. package/dist/agents/document-writer.d.ts.map +0 -1
  166. package/dist/agents/document-writer.js +0 -209
  167. package/dist/agents/document-writer.js.map +0 -1
  168. package/dist/agents/frontend-engineer.d.ts +0 -11
  169. package/dist/agents/frontend-engineer.d.ts.map +0 -1
  170. package/dist/agents/frontend-engineer.js +0 -115
  171. package/dist/agents/frontend-engineer.js.map +0 -1
  172. package/dist/agents/librarian.d.ts +0 -12
  173. package/dist/agents/librarian.d.ts.map +0 -1
  174. package/dist/agents/librarian.js +0 -103
  175. package/dist/agents/librarian.js.map +0 -1
  176. package/dist/agents/metis.d.ts +0 -12
  177. package/dist/agents/metis.d.ts.map +0 -1
  178. package/dist/agents/metis.js +0 -117
  179. package/dist/agents/metis.js.map +0 -1
  180. package/dist/agents/momus.d.ts +0 -12
  181. package/dist/agents/momus.d.ts.map +0 -1
  182. package/dist/agents/momus.js +0 -128
  183. package/dist/agents/momus.js.map +0 -1
  184. package/dist/agents/multimodal-looker.d.ts +0 -11
  185. package/dist/agents/multimodal-looker.d.ts.map +0 -1
  186. package/dist/agents/multimodal-looker.js +0 -70
  187. package/dist/agents/multimodal-looker.js.map +0 -1
  188. package/dist/agents/oracle.d.ts +0 -13
  189. package/dist/agents/oracle.d.ts.map +0 -1
  190. package/dist/agents/oracle.js +0 -191
  191. package/dist/agents/oracle.js.map +0 -1
  192. package/dist/agents/orchestrator-sisyphus.d.ts +0 -11
  193. package/dist/agents/orchestrator-sisyphus.d.ts.map +0 -1
  194. package/dist/agents/orchestrator-sisyphus.js +0 -115
  195. package/dist/agents/orchestrator-sisyphus.js.map +0 -1
  196. package/dist/agents/prometheus.d.ts +0 -12
  197. package/dist/agents/prometheus.d.ts.map +0 -1
  198. package/dist/agents/prometheus.js +0 -195
  199. package/dist/agents/prometheus.js.map +0 -1
  200. package/dist/agents/sisyphus-junior.d.ts +0 -12
  201. package/dist/agents/sisyphus-junior.d.ts.map +0 -1
  202. package/dist/agents/sisyphus-junior.js +0 -93
  203. package/dist/agents/sisyphus-junior.js.map +0 -1
  204. package/dist/cli/components/CostDashboard.d.ts +0 -15
  205. package/dist/cli/components/CostDashboard.d.ts.map +0 -1
  206. package/dist/cli/components/CostDashboard.js +0 -15
  207. package/dist/cli/components/CostDashboard.js.map +0 -1
  208. package/dist/cli/components/LiveStats.d.ts +0 -16
  209. package/dist/cli/components/LiveStats.d.ts.map +0 -1
  210. package/dist/cli/components/LiveStats.js +0 -16
  211. package/dist/cli/components/LiveStats.js.map +0 -1
  212. package/dist/cli/components/SessionBrowser.d.ts +0 -14
  213. package/dist/cli/components/SessionBrowser.d.ts.map +0 -1
  214. package/dist/cli/components/SessionBrowser.js +0 -14
  215. package/dist/cli/components/SessionBrowser.js.map +0 -1
  216. package/dist/cli/tui.d.ts +0 -21
  217. package/dist/cli/tui.d.ts.map +0 -1
  218. package/dist/cli/tui.js +0 -21
  219. package/dist/cli/tui.js.map +0 -1
  220. package/dist/hooks/autopilot/signals.d.ts +0 -20
  221. package/dist/hooks/autopilot/signals.d.ts.map +0 -1
  222. package/dist/hooks/autopilot/signals.js +0 -75
  223. package/dist/hooks/autopilot/signals.js.map +0 -1
  224. package/dist/hooks/autopilot/summary.d.ts +0 -27
  225. package/dist/hooks/autopilot/summary.d.ts.map +0 -1
  226. package/dist/hooks/autopilot/summary.js +0 -160
  227. package/dist/hooks/autopilot/summary.js.map +0 -1
  228. package/dist/hooks/autopilot/transition.d.ts +0 -39
  229. package/dist/hooks/autopilot/transition.d.ts.map +0 -1
  230. package/dist/hooks/autopilot/transition.js +0 -216
  231. package/dist/hooks/autopilot/transition.js.map +0 -1
  232. package/dist/hooks/context-window-limit-recovery/constants.d.ts +0 -28
  233. package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +0 -1
  234. package/dist/hooks/context-window-limit-recovery/constants.js +0 -85
  235. package/dist/hooks/context-window-limit-recovery/constants.js.map +0 -1
  236. package/dist/hooks/context-window-limit-recovery/index.d.ts +0 -62
  237. package/dist/hooks/context-window-limit-recovery/index.d.ts.map +0 -1
  238. package/dist/hooks/context-window-limit-recovery/index.js +0 -201
  239. package/dist/hooks/context-window-limit-recovery/index.js.map +0 -1
  240. package/dist/hooks/context-window-limit-recovery/parser.d.ts +0 -31
  241. package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +0 -1
  242. package/dist/hooks/context-window-limit-recovery/parser.js +0 -241
  243. package/dist/hooks/context-window-limit-recovery/parser.js.map +0 -1
  244. package/dist/hooks/context-window-limit-recovery/types.d.ts +0 -84
  245. package/dist/hooks/context-window-limit-recovery/types.d.ts.map +0 -1
  246. package/dist/hooks/context-window-limit-recovery/types.js +0 -34
  247. package/dist/hooks/context-window-limit-recovery/types.js.map +0 -1
  248. package/dist/hooks/edit-error-recovery/index.d.ts +0 -62
  249. package/dist/hooks/edit-error-recovery/index.d.ts.map +0 -1
  250. package/dist/hooks/edit-error-recovery/index.js +0 -89
  251. package/dist/hooks/edit-error-recovery/index.js.map +0 -1
  252. package/dist/hooks/learned-skills/config.d.ts +0 -53
  253. package/dist/hooks/learned-skills/config.d.ts.map +0 -1
  254. package/dist/hooks/learned-skills/config.js +0 -103
  255. package/dist/hooks/learned-skills/config.js.map +0 -1
  256. package/dist/hooks/learned-skills/constants.d.ts +0 -24
  257. package/dist/hooks/learned-skills/constants.d.ts.map +0 -1
  258. package/dist/hooks/learned-skills/constants.js +0 -26
  259. package/dist/hooks/learned-skills/constants.js.map +0 -1
  260. package/dist/hooks/learned-skills/detection-hook.d.ts +0 -39
  261. package/dist/hooks/learned-skills/detection-hook.d.ts.map +0 -1
  262. package/dist/hooks/learned-skills/detection-hook.js +0 -83
  263. package/dist/hooks/learned-skills/detection-hook.js.map +0 -1
  264. package/dist/hooks/learned-skills/detector.d.ts +0 -30
  265. package/dist/hooks/learned-skills/detector.d.ts.map +0 -1
  266. package/dist/hooks/learned-skills/detector.js +0 -150
  267. package/dist/hooks/learned-skills/detector.js.map +0 -1
  268. package/dist/hooks/learned-skills/finder.d.ts +0 -21
  269. package/dist/hooks/learned-skills/finder.d.ts.map +0 -1
  270. package/dist/hooks/learned-skills/finder.js +0 -117
  271. package/dist/hooks/learned-skills/finder.js.map +0 -1
  272. package/dist/hooks/learned-skills/index.d.ts +0 -62
  273. package/dist/hooks/learned-skills/index.d.ts.map +0 -1
  274. package/dist/hooks/learned-skills/index.js +0 -137
  275. package/dist/hooks/learned-skills/index.js.map +0 -1
  276. package/dist/hooks/learned-skills/loader.d.ts +0 -20
  277. package/dist/hooks/learned-skills/loader.d.ts.map +0 -1
  278. package/dist/hooks/learned-skills/loader.js +0 -107
  279. package/dist/hooks/learned-skills/loader.js.map +0 -1
  280. package/dist/hooks/learned-skills/parser.d.ts +0 -21
  281. package/dist/hooks/learned-skills/parser.d.ts.map +0 -1
  282. package/dist/hooks/learned-skills/parser.js +0 -190
  283. package/dist/hooks/learned-skills/parser.js.map +0 -1
  284. package/dist/hooks/learned-skills/promotion.d.ts +0 -29
  285. package/dist/hooks/learned-skills/promotion.d.ts.map +0 -1
  286. package/dist/hooks/learned-skills/promotion.js +0 -87
  287. package/dist/hooks/learned-skills/promotion.js.map +0 -1
  288. package/dist/hooks/learned-skills/types.d.ts +0 -109
  289. package/dist/hooks/learned-skills/types.d.ts.map +0 -1
  290. package/dist/hooks/learned-skills/types.js +0 -8
  291. package/dist/hooks/learned-skills/types.js.map +0 -1
  292. package/dist/hooks/learned-skills/validator.d.ts +0 -15
  293. package/dist/hooks/learned-skills/validator.d.ts.map +0 -1
  294. package/dist/hooks/learned-skills/validator.js +0 -87
  295. package/dist/hooks/learned-skills/validator.js.map +0 -1
  296. package/dist/hooks/learned-skills/writer.d.ts +0 -27
  297. package/dist/hooks/learned-skills/writer.d.ts.map +0 -1
  298. package/dist/hooks/learned-skills/writer.js +0 -126
  299. package/dist/hooks/learned-skills/writer.js.map +0 -1
  300. package/dist/hooks/mnemosyne/config.d.ts +0 -53
  301. package/dist/hooks/mnemosyne/config.d.ts.map +0 -1
  302. package/dist/hooks/mnemosyne/config.js +0 -103
  303. package/dist/hooks/mnemosyne/config.js.map +0 -1
  304. package/dist/hooks/mnemosyne/constants.d.ts +0 -24
  305. package/dist/hooks/mnemosyne/constants.d.ts.map +0 -1
  306. package/dist/hooks/mnemosyne/constants.js +0 -26
  307. package/dist/hooks/mnemosyne/constants.js.map +0 -1
  308. package/dist/hooks/mnemosyne/detection-hook.d.ts +0 -39
  309. package/dist/hooks/mnemosyne/detection-hook.d.ts.map +0 -1
  310. package/dist/hooks/mnemosyne/detection-hook.js +0 -83
  311. package/dist/hooks/mnemosyne/detection-hook.js.map +0 -1
  312. package/dist/hooks/mnemosyne/detector.d.ts +0 -30
  313. package/dist/hooks/mnemosyne/detector.d.ts.map +0 -1
  314. package/dist/hooks/mnemosyne/detector.js +0 -150
  315. package/dist/hooks/mnemosyne/detector.js.map +0 -1
  316. package/dist/hooks/mnemosyne/finder.d.ts +0 -21
  317. package/dist/hooks/mnemosyne/finder.d.ts.map +0 -1
  318. package/dist/hooks/mnemosyne/finder.js +0 -117
  319. package/dist/hooks/mnemosyne/finder.js.map +0 -1
  320. package/dist/hooks/mnemosyne/index.d.ts +0 -62
  321. package/dist/hooks/mnemosyne/index.d.ts.map +0 -1
  322. package/dist/hooks/mnemosyne/index.js +0 -137
  323. package/dist/hooks/mnemosyne/index.js.map +0 -1
  324. package/dist/hooks/mnemosyne/loader.d.ts +0 -20
  325. package/dist/hooks/mnemosyne/loader.d.ts.map +0 -1
  326. package/dist/hooks/mnemosyne/loader.js +0 -113
  327. package/dist/hooks/mnemosyne/loader.js.map +0 -1
  328. package/dist/hooks/mnemosyne/parser.d.ts +0 -21
  329. package/dist/hooks/mnemosyne/parser.d.ts.map +0 -1
  330. package/dist/hooks/mnemosyne/parser.js +0 -190
  331. package/dist/hooks/mnemosyne/parser.js.map +0 -1
  332. package/dist/hooks/mnemosyne/promotion.d.ts +0 -29
  333. package/dist/hooks/mnemosyne/promotion.d.ts.map +0 -1
  334. package/dist/hooks/mnemosyne/promotion.js +0 -87
  335. package/dist/hooks/mnemosyne/promotion.js.map +0 -1
  336. package/dist/hooks/mnemosyne/types.d.ts +0 -109
  337. package/dist/hooks/mnemosyne/types.d.ts.map +0 -1
  338. package/dist/hooks/mnemosyne/types.js +0 -8
  339. package/dist/hooks/mnemosyne/types.js.map +0 -1
  340. package/dist/hooks/mnemosyne/validator.d.ts +0 -15
  341. package/dist/hooks/mnemosyne/validator.d.ts.map +0 -1
  342. package/dist/hooks/mnemosyne/validator.js +0 -87
  343. package/dist/hooks/mnemosyne/validator.js.map +0 -1
  344. package/dist/hooks/mnemosyne/writer.d.ts +0 -27
  345. package/dist/hooks/mnemosyne/writer.d.ts.map +0 -1
  346. package/dist/hooks/mnemosyne/writer.js +0 -126
  347. package/dist/hooks/mnemosyne/writer.js.map +0 -1
  348. package/dist/hooks/ralph-loop/index.d.ts +0 -116
  349. package/dist/hooks/ralph-loop/index.d.ts.map +0 -1
  350. package/dist/hooks/ralph-loop/index.js +0 -322
  351. package/dist/hooks/ralph-loop/index.js.map +0 -1
  352. package/dist/hooks/ralph-prd/index.d.ts +0 -130
  353. package/dist/hooks/ralph-prd/index.d.ts.map +0 -1
  354. package/dist/hooks/ralph-prd/index.js +0 -310
  355. package/dist/hooks/ralph-prd/index.js.map +0 -1
  356. package/dist/hooks/ralph-progress/index.d.ts +0 -102
  357. package/dist/hooks/ralph-progress/index.d.ts.map +0 -1
  358. package/dist/hooks/ralph-progress/index.js +0 -408
  359. package/dist/hooks/ralph-progress/index.js.map +0 -1
  360. package/dist/hooks/ralph-verifier/index.d.ts +0 -72
  361. package/dist/hooks/ralph-verifier/index.d.ts.map +0 -1
  362. package/dist/hooks/ralph-verifier/index.js +0 -223
  363. package/dist/hooks/ralph-verifier/index.js.map +0 -1
  364. package/dist/hooks/session-recovery/constants.d.ts +0 -56
  365. package/dist/hooks/session-recovery/constants.d.ts.map +0 -1
  366. package/dist/hooks/session-recovery/constants.js +0 -78
  367. package/dist/hooks/session-recovery/constants.js.map +0 -1
  368. package/dist/hooks/session-recovery/index.d.ts +0 -53
  369. package/dist/hooks/session-recovery/index.d.ts.map +0 -1
  370. package/dist/hooks/session-recovery/index.js +0 -321
  371. package/dist/hooks/session-recovery/index.js.map +0 -1
  372. package/dist/hooks/session-recovery/storage.d.ts +0 -76
  373. package/dist/hooks/session-recovery/storage.d.ts.map +0 -1
  374. package/dist/hooks/session-recovery/storage.js +0 -383
  375. package/dist/hooks/session-recovery/storage.js.map +0 -1
  376. package/dist/hooks/session-recovery/types.d.ts +0 -145
  377. package/dist/hooks/session-recovery/types.d.ts.map +0 -1
  378. package/dist/hooks/session-recovery/types.js +0 -8
  379. package/dist/hooks/session-recovery/types.js.map +0 -1
  380. package/dist/hooks/sisyphus-orchestrator/constants.d.ts +0 -23
  381. package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +0 -1
  382. package/dist/hooks/sisyphus-orchestrator/constants.js +0 -142
  383. package/dist/hooks/sisyphus-orchestrator/constants.js.map +0 -1
  384. package/dist/hooks/sisyphus-orchestrator/index.d.ts +0 -113
  385. package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +0 -1
  386. package/dist/hooks/sisyphus-orchestrator/index.js +0 -309
  387. package/dist/hooks/sisyphus-orchestrator/index.js.map +0 -1
  388. package/dist/hooks/ultraqa-loop/index.d.ts +0 -94
  389. package/dist/hooks/ultraqa-loop/index.d.ts.map +0 -1
  390. package/dist/hooks/ultraqa-loop/index.js +0 -216
  391. package/dist/hooks/ultraqa-loop/index.js.map +0 -1
  392. package/dist/hooks/ultrawork-state/index.d.ts +0 -62
  393. package/dist/hooks/ultrawork-state/index.d.ts.map +0 -1
  394. package/dist/hooks/ultrawork-state/index.js +0 -208
  395. package/dist/hooks/ultrawork-state/index.js.map +0 -1
  396. package/dist/hud/sisyphus-state.d.ts +0 -31
  397. package/dist/hud/sisyphus-state.d.ts.map +0 -1
  398. package/dist/hud/sisyphus-state.js +0 -163
  399. package/dist/hud/sisyphus-state.js.map +0 -1
package/commands/swarm.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: N coordinated agents with atomic task claiming from shared pool
2
+ description: N coordinated agents on shared task list with SQLite-based atomic claiming
3
3
  aliases: [swarm-agents]
4
4
  ---
5
5
 
@@ -7,7 +7,7 @@ aliases: [swarm-agents]
7
7
 
8
8
  [SWARM MODE ACTIVATED]
9
9
 
10
- Spawn N coordinated agents working on a shared task list with atomic claiming. Like a dev team tackling multiple files in parallel.
10
+ Spawn N coordinated agents working on a shared task list with SQLite-based atomic claiming. Like a dev team tackling multiple files in parallel—fast, reliable, and with full fault tolerance.
11
11
 
12
12
  ## User's Request
13
13
 
@@ -22,22 +22,22 @@ Spawn N coordinated agents working on a shared task list with atomic claiming. L
22
22
  ### Parameters
23
23
 
24
24
  - **N** - Number of agents (1-5, enforced by Claude Code limit)
25
- - **agent-type** - Agent to spawn (executor, build-fixer, designer, etc.)
25
+ - **agent-type** - Agent to spawn (e.g., executor, build-fixer, architect)
26
26
  - **task** - High-level task to decompose and distribute
27
27
 
28
28
  ### Examples
29
29
 
30
- ```
30
+ ```bash
31
31
  /oh-my-claudecode:swarm 5:executor "fix all TypeScript errors"
32
32
  /oh-my-claudecode:swarm 3:build-fixer "fix build errors in src/"
33
33
  /oh-my-claudecode:swarm 4:designer "implement responsive layouts for all components"
34
34
  /oh-my-claudecode:swarm 2:architect "analyze and document all API endpoints"
35
35
  ```
36
36
 
37
- ## How It Works
37
+ ## Architecture
38
38
 
39
39
  ```
40
- User: /swarm 5:executor "fix all TypeScript errors"
40
+ User: "/swarm 5:executor fix all TypeScript errors"
41
41
  |
42
42
  v
43
43
  [SWARM ORCHESTRATOR]
@@ -50,14 +50,29 @@ User: /swarm 5:executor "fix all TypeScript errors"
50
50
  +--+--+--+--+
51
51
  |
52
52
  v
53
- [SHARED TASK LIST]
54
- - Fix a.ts (claimed E1)
55
- - Fix b.ts (done E2)
56
- - Fix c.ts (claimed E3)
57
- - Fix d.ts (pending)
58
- ...
53
+ [SQLITE DATABASE]
54
+ ┌─────────────────────┐
55
+ tasks table │
56
+ ├─────────────────────┤
57
+ id, description │
58
+ │ status (pending, │
59
+ │ claimed, done, │
60
+ │ failed) │
61
+ │ claimed_by, claimed_at
62
+ │ completed_at, result│
63
+ │ error │
64
+ ├─────────────────────┤
65
+ │ heartbeats table │
66
+ │ (agent monitoring) │
67
+ └─────────────────────┘
59
68
  ```
60
69
 
70
+ **Key Features:**
71
+ - SQLite transactions ensure only one agent can claim a task
72
+ - Lease-based ownership with automatic timeout and recovery
73
+ - Heartbeat monitoring for detecting dead agents
74
+ - Full ACID compliance for task state
75
+
61
76
  ## Workflow
62
77
 
63
78
  ### 1. Parse Input
@@ -67,161 +82,329 @@ From `{{ARGUMENTS}}`, extract:
67
82
  - agent-type (executor, build-fixer, etc.)
68
83
  - task description
69
84
 
70
- ### 2. Create Task List
71
-
72
- 1. Analyze codebase based on task
73
- 2. Break into file-specific subtasks
74
- 3. Initialize `.omc/state/swarm-tasks.json` with all subtasks
75
- 4. Each task gets: id, file, description, status, owner, timestamp
85
+ ### 2. Create Task Pool
86
+ - Analyze codebase based on task
87
+ - Break into file-specific subtasks
88
+ - Initialize SQLite database with task pool
89
+ - Each task gets: id, description, status (pending), and metadata columns
76
90
 
77
91
  ### 3. Spawn Agents
78
-
79
- Launch N agents via Task tool:
92
+ - Launch N agents via Task tool
80
93
  - Set `run_in_background: true` for all
81
- - Each agent receives:
82
- - Reference to shared task list
83
- - Claiming protocol instructions
84
- - Completion criteria
94
+ - Each agent connects to the SQLite database
95
+ - Agents enter claiming loop automatically
96
+
97
+ **Important:** Use worker preamble when spawning agents to prevent sub-agent recursion:
85
98
 
86
- ### 4. Task Claiming Protocol
99
+ ```typescript
100
+ import { wrapWithPreamble } from '../agents/preamble.js';
87
101
 
102
+ const prompt = wrapWithPreamble(`Your task: ${taskDescription}`);
103
+ ```
104
+
105
+ ### 4. Task Claiming Protocol (SQLite Transactional)
88
106
  Each agent follows this loop:
89
107
 
90
108
  ```
91
109
  LOOP:
92
- 1. Read swarm-tasks.json
93
- 2. Find first task with status="pending"
94
- 3. Atomically claim task (set status="claimed", add owner, timestamp)
95
- 4. Execute task
96
- 5. Mark task as "done"
97
- 6. GOTO LOOP (until no pending tasks)
110
+ 1. Call claimTask(agentId)
111
+ 2. SQLite transaction:
112
+ - Find first pending task
113
+ - UPDATE status='claimed', claimed_by=agentId, claimed_at=now
114
+ - INSERT/UPDATE heartbeat record
115
+ - Atomically commit (only one agent succeeds)
116
+ 3. Execute task
117
+ 4. Call completeTask(agentId, taskId, result) or failTask()
118
+ 5. GOTO LOOP (until hasPendingWork() returns false)
119
+ ```
120
+
121
+ **Atomic Claiming Details:**
122
+ - SQLite `IMMEDIATE` transaction prevents race conditions
123
+ - Only agent updating the row successfully gets the task
124
+ - Heartbeat automatically updated on claim
125
+ - If claim fails (already claimed), agent retries with next task
126
+ - Lease Timeout: 5 minutes per task
127
+ - If timeout exceeded + no heartbeat, cleanupStaleClaims releases task back to pending
128
+
129
+ ### 5. Heartbeat Protocol
130
+ - Agents call `heartbeat(agentId)` every 60 seconds (or custom interval)
131
+ - Heartbeat records: agent_id, last_heartbeat timestamp, current_task_id
132
+ - Orchestrator runs cleanupStaleClaims every 60 seconds
133
+ - If heartbeat is stale (>5 minutes old) and task claimed, task auto-releases
134
+
135
+ ### 6. Progress Tracking
136
+ - Orchestrator monitors via TaskOutput
137
+ - Shows live progress: pending/claimed/done/failed counts
138
+ - Active agent count via getActiveAgents()
139
+ - Reports which agent is working on which task via getAgentTasks()
140
+ - Detects idle agents (all tasks claimed by others)
141
+
142
+ ### 7. Completion
143
+ Exit when ANY of:
144
+ - isSwarmComplete() returns true (all tasks done or failed)
145
+ - All agents idle (no pending tasks, no claimed tasks)
146
+ - User cancels via `/oh-my-claudecode:cancel`
147
+
148
+ ## Storage
149
+
150
+ ### SQLite Database (`.omc/state/swarm.db`)
151
+
152
+ The swarm uses a single SQLite database stored at `.omc/state/swarm.db`. This provides:
153
+ - **ACID compliance** - All task state transitions are atomic
154
+ - **Concurrent access** - Multiple agents query/update safely
155
+ - **Persistence** - State survives agent crashes
156
+ - **Query efficiency** - Fast status lookups and filtering
157
+
158
+ #### `tasks` Table Schema
159
+ ```sql
160
+ CREATE TABLE tasks (
161
+ id TEXT PRIMARY KEY,
162
+ description TEXT NOT NULL,
163
+ status TEXT NOT NULL DEFAULT 'pending',
164
+ -- pending: waiting to be claimed
165
+ -- claimed: claimed by an agent, in progress
166
+ -- done: completed successfully
167
+ -- failed: completed with error
168
+ claimed_by TEXT, -- agent ID that claimed this task
169
+ claimed_at INTEGER, -- Unix timestamp when claimed
170
+ completed_at INTEGER, -- Unix timestamp when completed
171
+ result TEXT, -- Optional result/output from task
172
+ error TEXT -- Error message if task failed
173
+ );
174
+ ```
175
+
176
+ #### `heartbeats` Table Schema
177
+ ```sql
178
+ CREATE TABLE heartbeats (
179
+ agent_id TEXT PRIMARY KEY,
180
+ last_heartbeat INTEGER NOT NULL, -- Unix timestamp of last heartbeat
181
+ current_task_id TEXT -- Task agent is currently working on
182
+ );
98
183
  ```
99
184
 
100
- **Atomic Claiming:**
101
- - Read current task status
102
- - If "pending", claim it (set owner, timeout)
103
- - If already claimed, try next task
104
- - Timeout: 5 minutes per task
105
- - Timed-out tasks auto-release to "pending"
106
-
107
- ### 5. Progress Tracking
108
-
109
- Orchestrator monitors via TaskOutput:
110
- - Shows live stats: claimed/done/pending counts
111
- - Reports which agent is working on which file
112
- - Detects idle agents (no pending tasks)
113
-
114
- ### 6. Completion
115
-
116
- Exit when:
117
- - All tasks marked "done"
118
- - All agents idle (no pending tasks)
119
- - User cancels via `/cancel`
120
-
121
- ## State Files
122
-
123
- ### `.omc/swarm-state.json`
124
- Session-level state:
125
-
126
- ```json
127
- {
128
- "session_id": "swarm-20260124-143022",
129
- "agent_count": 5,
130
- "agent_type": "executor",
131
- "task_description": "fix all TypeScript errors",
132
- "status": "active",
133
- "started_at": "2026-01-24T14:30:22Z",
134
- "agents": [
135
- {"id": "agent-1", "background_task_id": "task_abc", "status": "working"},
136
- {"id": "agent-2", "background_task_id": "task_def", "status": "working"}
137
- ]
185
+ #### `swarm_session` Table Schema
186
+ ```sql
187
+ CREATE TABLE swarm_session (
188
+ id INTEGER PRIMARY KEY CHECK (id = 1),
189
+ session_id TEXT NOT NULL,
190
+ active INTEGER NOT NULL DEFAULT 1,
191
+ agent_count INTEGER NOT NULL,
192
+ started_at INTEGER NOT NULL,
193
+ completed_at INTEGER
194
+ );
195
+ ```
196
+
197
+ ## Task Claiming Protocol (Detailed)
198
+
199
+ ### Atomic Claim Operation with SQLite
200
+
201
+ The core strength of the implementation is transactional atomicity:
202
+
203
+ ```typescript
204
+ function claimTask(agentId: string): ClaimResult {
205
+ // Transaction ensures only ONE agent succeeds
206
+ const claimTransaction = db.transaction(() => {
207
+ // Step 1: Find first pending task
208
+ const task = db.prepare(
209
+ 'SELECT id, description FROM tasks WHERE status = "pending" ORDER BY id LIMIT 1'
210
+ ).get();
211
+
212
+ if (!task) {
213
+ return { success: false, reason: 'No pending tasks' };
214
+ }
215
+
216
+ // Step 2: Attempt claim (will only succeed if status is still 'pending')
217
+ const result = db.prepare(
218
+ 'UPDATE tasks SET status = "claimed", claimed_by = ?, claimed_at = ? WHERE id = ? AND status = "pending"'
219
+ ).run(agentId, Date.now(), task.id);
220
+
221
+ if (result.changes === 0) {
222
+ // Another agent claimed it between SELECT and UPDATE - try next
223
+ return { success: false, reason: 'Task was claimed by another agent' };
224
+ }
225
+
226
+ // Step 3: Update heartbeat to show we're alive and working
227
+ db.prepare(
228
+ 'INSERT OR REPLACE INTO heartbeats (agent_id, last_heartbeat, current_task_id) VALUES (?, ?, ?)'
229
+ ).run(agentId, Date.now(), task.id);
230
+
231
+ return { success: true, taskId: task.id, description: task.description };
232
+ });
233
+
234
+ return claimTransaction(); // Atomic execution
138
235
  }
139
236
  ```
140
237
 
141
- ### `.omc/state/swarm-tasks.json`
142
- Shared task list:
143
-
144
- ```json
145
- {
146
- "tasks": [
147
- {
148
- "id": "task-001",
149
- "file": "src/utils/validation.ts",
150
- "description": "Fix type errors in validation helpers",
151
- "status": "claimed",
152
- "owner": "agent-1",
153
- "claimed_at": "2026-01-24T14:30:25Z",
154
- "timeout_at": "2026-01-24T14:35:25Z"
155
- },
156
- {
157
- "id": "task-002",
158
- "file": "src/components/Header.tsx",
159
- "description": "Fix missing prop types",
160
- "status": "done",
161
- "owner": "agent-2",
162
- "claimed_at": "2026-01-24T14:30:26Z",
163
- "completed_at": "2026-01-24T14:32:15Z"
164
- },
165
- {
166
- "id": "task-003",
167
- "file": "src/api/client.ts",
168
- "description": "Add return type annotations",
169
- "status": "pending",
170
- "owner": null
238
+ **Why SQLite Transactions Work:**
239
+ - `db.transaction()` uses `IMMEDIATE` locking
240
+ - Prevents other agents from modifying rows between SELECT and UPDATE
241
+ - All-or-nothing atomicity: claim succeeds completely or fails completely
242
+ - No race conditions, no lost updates
243
+
244
+ ### Lease Timeout & Auto-Release
245
+
246
+ Tasks are automatically released if claimed too long without heartbeat:
247
+
248
+ ```typescript
249
+ function cleanupStaleClaims(leaseTimeout: number = 5 * 60 * 1000) {
250
+ // Default 5-minute timeout
251
+ const cutoffTime = Date.now() - leaseTimeout;
252
+
253
+ const cleanupTransaction = db.transaction(() => {
254
+ // Find claimed tasks where:
255
+ // 1. Claimed longer than timeout, OR
256
+ // 2. Agent hasn't sent heartbeat in that time
257
+ const staleTasks = db.prepare(`
258
+ SELECT t.id
259
+ FROM tasks t
260
+ LEFT JOIN heartbeats h ON t.claimed_by = h.agent_id
261
+ WHERE t.status = 'claimed'
262
+ AND t.claimed_at < ?
263
+ AND (h.last_heartbeat IS NULL OR h.last_heartbeat < ?)
264
+ `).all(cutoffTime, cutoffTime);
265
+
266
+ // Release each stale task back to pending
267
+ for (const staleTask of staleTasks) {
268
+ db.prepare('UPDATE tasks SET status = "pending", claimed_by = NULL, claimed_at = NULL WHERE id = ?')
269
+ .run(staleTask.id);
171
270
  }
172
- ],
173
- "stats": {
174
- "total": 15,
175
- "pending": 8,
176
- "claimed": 5,
177
- "done": 2
178
- }
271
+
272
+ return staleTasks.length;
273
+ });
274
+
275
+ return cleanupTransaction();
179
276
  }
180
277
  ```
181
278
 
182
- ## Agent Instructions Template
279
+ **How Recovery Works:**
280
+ 1. Orchestrator calls cleanupStaleClaims() every 60 seconds
281
+ 2. If agent hasn't sent heartbeat in 5 minutes, task is auto-released
282
+ 3. Another agent picks up the orphaned task
283
+ 4. Original agent can continue working (it doesn't know it was released)
284
+ 5. When original agent tries to mark task as done, verification fails safely
285
+
286
+ ## API Reference
287
+
288
+ ### Core API Functions
289
+
290
+ #### `startSwarm(config: SwarmConfig): Promise<boolean>`
291
+ Initialize the swarm with task pool and start cleanup timer.
292
+
293
+ #### `stopSwarm(deleteDatabase?: boolean): boolean`
294
+ Stop the swarm and optionally delete the database.
295
+
296
+ #### `claimTask(agentId: string): ClaimResult`
297
+ Claim the next pending task. Returns `{ success, taskId, description, reason }`.
298
+
299
+ #### `completeTask(agentId: string, taskId: string, result?: string): boolean`
300
+ Mark a task as done. Only succeeds if agent still owns the task.
183
301
 
184
- Each spawned agent receives:
302
+ #### `failTask(agentId: string, taskId: string, error: string): boolean`
303
+ Mark a task as failed with error details.
185
304
 
186
- ```markdown
187
- You are agent {id} in a swarm of {N} {agent-type} agents.
305
+ #### `heartbeat(agentId: string): boolean`
306
+ Send a heartbeat to indicate agent is alive. Call every 60 seconds during long-running tasks.
188
307
 
189
- **Your Task:** {task_description}
308
+ #### `cleanupStaleClaims(leaseTimeout?: number): number`
309
+ Manually trigger cleanup of expired claims. Called automatically every 60 seconds.
190
310
 
191
- **Shared Task List:** .omc/state/swarm-tasks.json
311
+ #### `hasPendingWork(): boolean`
312
+ Check if there are unclaimed tasks available.
192
313
 
193
- **Your Loop:**
194
- 1. Read swarm-tasks.json
195
- 2. Find first task with status="pending"
196
- 3. Claim it atomically (set status="claimed", owner="{id}", timeout)
197
- 4. Execute the task
198
- 5. Mark status="done", set completed_at
199
- 6. Repeat until no pending tasks
314
+ #### `isSwarmComplete(): boolean`
315
+ Check if all tasks are done or failed.
200
316
 
201
- **Claiming Protocol:**
202
- - Read file, check status="pending"
203
- - Update status="claimed", add your ID
204
- - Set timeout_at = now + 5 minutes
205
- - Write file back
206
- - If file changed between read/write, retry
317
+ #### `getSwarmStats(): SwarmStats | null`
318
+ Get task counts and timing info.
207
319
 
208
- **Completion:**
209
- When no pending tasks remain, exit cleanly.
320
+ ### Configuration (SwarmConfig)
321
+
322
+ ```typescript
323
+ interface SwarmConfig {
324
+ agentCount: number; // Number of agents (1-5)
325
+ tasks: string[]; // Task descriptions
326
+ agentType?: string; // Agent type (default: 'executor')
327
+ leaseTimeout?: number; // Milliseconds (default: 5 min)
328
+ heartbeatInterval?: number; // Milliseconds (default: 60 sec)
329
+ cwd?: string; // Working directory
330
+ }
210
331
  ```
211
332
 
212
- ## Constraints
333
+ ### Types
334
+
335
+ ```typescript
336
+ interface SwarmTask {
337
+ id: string;
338
+ description: string;
339
+ status: 'pending' | 'claimed' | 'done' | 'failed';
340
+ claimedBy: string | null;
341
+ claimedAt: number | null;
342
+ completedAt: number | null;
343
+ error?: string;
344
+ result?: string;
345
+ }
213
346
 
214
- - **Max Agents:** 5 (Claude Code background task limit)
215
- - **Claim Timeout:** 5 minutes per task
216
- - **Auto-Release:** Timed-out claims automatically released
217
- - **Heartbeat:** Recommended every 60 seconds
347
+ interface ClaimResult {
348
+ success: boolean;
349
+ taskId: string | null;
350
+ description?: string;
351
+ reason?: string;
352
+ }
218
353
 
219
- ## Error Handling
354
+ interface SwarmStats {
355
+ totalTasks: number;
356
+ pendingTasks: number;
357
+ claimedTasks: number;
358
+ doneTasks: number;
359
+ failedTasks: number;
360
+ activeAgents: number;
361
+ elapsedTime: number;
362
+ }
363
+ ```
220
364
 
221
- - **Agent Crash:** Task auto-releases after timeout
222
- - **State Corruption:** Orchestrator validates and repairs
223
- - **No Pending Tasks:** Agent exits cleanly
224
- - **All Agents Idle:** Orchestrator concludes session
365
+ ## Key Parameters
366
+
367
+ - **Max Agents:** 5 (enforced by Claude Code background task limit)
368
+ - **Lease Timeout:** 5 minutes (default, configurable)
369
+ - Tasks claimed longer than this without heartbeat are auto-released
370
+ - **Heartbeat Interval:** 60 seconds (recommended)
371
+ - Agents should call `heartbeat()` at least this often
372
+ - Prevents false timeout while working on long tasks
373
+ - **Cleanup Interval:** 60 seconds
374
+ - Orchestrator automatically runs `cleanupStaleClaims()` to release orphaned tasks
375
+ - **Database:** SQLite (stored at `.omc/state/swarm.db`)
376
+ - One database per swarm session
377
+ - Survives agent crashes
378
+ - Provides ACID guarantees
379
+
380
+ ## Error Handling & Recovery
381
+
382
+ ### Agent Crash
383
+ - Task is claimed but agent stops sending heartbeats
384
+ - After 5 minutes of no heartbeat, cleanupStaleClaims() releases the task
385
+ - Task returns to 'pending' status for another agent to claim
386
+ - Original agent's incomplete work is safely abandoned
387
+
388
+ ### Task Completion Failure
389
+ - Agent calls `completeTask()` but is no longer the owner (was released)
390
+ - The update silently fails (no agent matches in WHERE clause)
391
+ - Agent can detect this by checking return value
392
+ - Agent should log error and continue to next task
393
+
394
+ ### Database Unavailable
395
+ - `startSwarm()` returns false if database initialization fails
396
+ - `claimTask()` returns `{ success: false, reason: 'Database not initialized' }`
397
+ - Check `isSwarmReady()` before proceeding
398
+
399
+ ### All Agents Idle
400
+ - Orchestrator detects via `getActiveAgents() === 0` or `hasPendingWork() === false`
401
+ - Triggers final cleanup and marks swarm as complete
402
+ - Remaining failed tasks are preserved in database
403
+
404
+ ### No Tasks Available
405
+ - `claimTask()` returns success=false with reason 'No pending tasks available'
406
+ - Agent should check `hasPendingWork()` before looping
407
+ - Safe for agent to exit cleanly when no work remains
225
408
 
226
409
  ## Cancellation
227
410
 
@@ -233,42 +416,61 @@ Use unified cancel command:
233
416
  This:
234
417
  - Stops orchestrator monitoring
235
418
  - Signals all background agents to exit
236
- - Preserves partial progress in swarm-tasks.json
419
+ - Preserves partial progress in database
237
420
  - Marks session as "cancelled"
238
421
 
239
422
  ## Use Cases
240
423
 
241
424
  ### Fix All Type Errors
242
425
  ```
243
- /swarm 5:executor "fix all TypeScript type errors"
426
+ /oh-my-claudecode:swarm 5:executor "fix all TypeScript type errors"
244
427
  ```
245
428
  Spawns 5 executors, each claiming and fixing individual files.
246
429
 
247
430
  ### Implement UI Components
248
431
  ```
249
- /swarm 3:designer "implement Material-UI styling for all components"
432
+ /oh-my-claudecode:swarm 3:designer "implement Material-UI styling for all components"
250
433
  ```
251
434
  Spawns 3 designers, each styling different component files.
252
435
 
253
436
  ### Security Audit
254
437
  ```
255
- /swarm 4:security-reviewer "review all API endpoints for vulnerabilities"
438
+ /oh-my-claudecode:swarm 4:security-reviewer "review all API endpoints for vulnerabilities"
256
439
  ```
257
440
  Spawns 4 security reviewers, each auditing different endpoints.
258
441
 
259
442
  ### Documentation Sprint
260
443
  ```
261
- /swarm 2:writer "add JSDoc comments to all exported functions"
444
+ /oh-my-claudecode:swarm 2:writer "add JSDoc comments to all exported functions"
262
445
  ```
263
446
  Spawns 2 writers, each documenting different modules.
264
447
 
265
- ## Benefits
448
+ ## Benefits of SQLite-Based Implementation
449
+
450
+ ### Atomicity & Safety
451
+ - **Race-Condition Free:** SQLite transactions guarantee only one agent claims each task
452
+ - **No Lost Updates:** ACID compliance means state changes are durable
453
+ - **Orphan Prevention:** Expired claims are automatically released without manual intervention
454
+
455
+ ### Performance
456
+ - **Fast Queries:** Indexed lookups on task status and agent ID
457
+ - **Concurrent Access:** Multiple agents read/write without blocking
458
+ - **Minimal Lock Time:** Transactions are microseconds, not seconds
459
+
460
+ ### Reliability
461
+ - **Crash Recovery:** Database survives agent failures
462
+ - **Automatic Cleanup:** Stale claims don't block progress
463
+ - **Lease-Based:** Time-based expiration prevents indefinite hangs
464
+
465
+ ### Developer Experience
466
+ - **Simple API:** Just `claimTask()`, `completeTask()`, `heartbeat()`
467
+ - **Full Visibility:** Query any task or agent status at any time
468
+ - **Easy Debugging:** SQL queries show exact state without decoding JSON
266
469
 
267
- - **Parallel Execution:** N agents work simultaneously
268
- - **Auto-Balancing:** Fast agents claim more tasks
269
- - **Fault Tolerance:** Timeouts prevent deadlocks
270
- - **Progress Visibility:** Live stats on claimed/done/pending
271
- - **Scalable:** Works for 10s to 100s of subtasks
470
+ ### Scalability
471
+ - **10s to 1000s of Tasks:** SQLite handles easily
472
+ - **Full Task Retention:** Complete history in database for analysis
473
+ - **Extensible Schema:** Add custom columns for task metadata
272
474
 
273
475
  ## Output
274
476