@iloom/cli 0.9.2 → 0.10.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 (220) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +159 -40
  3. package/dist/{BranchNamingService-K6XNWQ6C.js → BranchNamingService-ECJHBB67.js} +2 -2
  4. package/dist/ClaudeContextManager-QXX6ZFST.js +14 -0
  5. package/dist/ClaudeService-NJNK2SUH.js +13 -0
  6. package/dist/{GitHubService-TGWJN4V4.js → GitHubService-MEHKHUQP.js} +4 -4
  7. package/dist/IssueTrackerFactory-NG53YX5S.js +14 -0
  8. package/dist/{LoomLauncher-73NXL2CL.js → LoomLauncher-L64HHS3T.js} +9 -9
  9. package/dist/{MetadataManager-W3C54UYT.js → MetadataManager-5QZSTKNN.js} +2 -2
  10. package/dist/{ProjectCapabilityDetector-N5L7T4IY.js → ProjectCapabilityDetector-5KSYUTBJ.js} +3 -3
  11. package/dist/{PromptTemplateManager-36YLQRHP.js → PromptTemplateManager-DULSVRRE.js} +2 -2
  12. package/dist/README.md +159 -40
  13. package/dist/{SettingsManager-AW3JTJHD.js → SettingsManager-BQDQA3FK.js} +4 -2
  14. package/dist/agents/iloom-artifact-reviewer.md +11 -0
  15. package/dist/agents/iloom-code-reviewer.md +14 -0
  16. package/dist/agents/iloom-issue-analyze-and-plan.md +55 -12
  17. package/dist/agents/iloom-issue-analyzer.md +49 -6
  18. package/dist/agents/iloom-issue-complexity-evaluator.md +47 -6
  19. package/dist/agents/iloom-issue-enhancer.md +86 -7
  20. package/dist/agents/iloom-issue-implementer.md +48 -7
  21. package/dist/agents/iloom-issue-planner.md +115 -62
  22. package/dist/{build-THZI572G.js → build-5GO3XW26.js} +9 -9
  23. package/dist/{chunk-NUACL52E.js → chunk-3D7WQM7I.js} +2 -2
  24. package/dist/chunk-4232AHNQ.js +35 -0
  25. package/dist/chunk-4232AHNQ.js.map +1 -0
  26. package/dist/{chunk-QN47QVBX.js → chunk-4WJNIR5O.js} +1 -1
  27. package/dist/chunk-4WJNIR5O.js.map +1 -0
  28. package/dist/{chunk-A7NJF73J.js → chunk-5MWV33NN.js} +4 -4
  29. package/dist/{chunk-3I4ONZRT.js → chunk-6EU6TCF6.js} +10 -10
  30. package/dist/chunk-6EU6TCF6.js.map +1 -0
  31. package/dist/{chunk-CWRI4JC3.js → chunk-FB47TIJG.js} +29 -11
  32. package/dist/chunk-FB47TIJG.js.map +1 -0
  33. package/dist/chunk-HEXKPKCK.js +1396 -0
  34. package/dist/chunk-HEXKPKCK.js.map +1 -0
  35. package/dist/{chunk-KAYXR544.js → chunk-J5S7DFYC.js} +2 -2
  36. package/dist/{chunk-ULSWCPQG.js → chunk-JO2LZ6EQ.js} +476 -5
  37. package/dist/chunk-JO2LZ6EQ.js.map +1 -0
  38. package/dist/{chunk-KBEIQP4G.js → chunk-KB64WNBZ.js} +43 -3
  39. package/dist/chunk-KB64WNBZ.js.map +1 -0
  40. package/dist/{chunk-OFDN5NKS.js → chunk-KXDRI47U.js} +69 -12
  41. package/dist/chunk-KXDRI47U.js.map +1 -0
  42. package/dist/{chunk-R4YWBGY6.js → chunk-LXLMMXXY.js} +54 -14
  43. package/dist/chunk-LXLMMXXY.js.map +1 -0
  44. package/dist/{chunk-AR5QKYNE.js → chunk-MNHZB4Z2.js} +4 -4
  45. package/dist/{chunk-TL72BGP6.js → chunk-MORRVYPT.js} +2 -2
  46. package/dist/{chunk-KJTVU3HZ.js → chunk-NRSWLOAZ.js} +8 -8
  47. package/dist/chunk-NRSWLOAZ.js.map +1 -0
  48. package/dist/{chunk-FO5GGFOV.js → chunk-ONQYPICO.js} +13 -5
  49. package/dist/chunk-ONQYPICO.js.map +1 -0
  50. package/dist/{chunk-7ZEHSSUP.js → chunk-P4O6EH46.js} +4 -4
  51. package/dist/chunk-QZWEJVWV.js +207 -0
  52. package/dist/chunk-QZWEJVWV.js.map +1 -0
  53. package/dist/chunk-RSYT7MVI.js +202 -0
  54. package/dist/chunk-RSYT7MVI.js.map +1 -0
  55. package/dist/{chunk-Z2TWEXR7.js → chunk-RYWFS37M.js} +6 -6
  56. package/dist/chunk-RYWFS37M.js.map +1 -0
  57. package/dist/{chunk-B7U6OKUR.js → chunk-SF2P22EE.js} +11 -3
  58. package/dist/chunk-SF2P22EE.js.map +1 -0
  59. package/dist/{chunk-6IIL5M2L.js → chunk-SN3SQCFK.js} +10 -8
  60. package/dist/{chunk-6IIL5M2L.js.map → chunk-SN3SQCFK.js.map} +1 -1
  61. package/dist/{chunk-SOSQILHO.js → chunk-UD3WJDIV.js} +92 -82
  62. package/dist/chunk-UD3WJDIV.js.map +1 -0
  63. package/dist/{chunk-KXGQYLFZ.js → chunk-UKBAJ2QQ.js} +61 -7
  64. package/dist/chunk-UKBAJ2QQ.js.map +1 -0
  65. package/dist/{chunk-W6DP5RVR.js → chunk-UVD4CZKS.js} +3 -3
  66. package/dist/chunk-UWGVCXRF.js +207 -0
  67. package/dist/chunk-UWGVCXRF.js.map +1 -0
  68. package/dist/{chunk-NWMORW3U.js → chunk-VECNX6VX.js} +2 -2
  69. package/dist/{chunk-4CO6KG5S.js → chunk-VG45TUYK.js} +53 -7
  70. package/dist/{chunk-4CO6KG5S.js.map → chunk-VG45TUYK.js.map} +1 -1
  71. package/dist/{chunk-TC7APDKU.js → chunk-VGGST52X.js} +2 -2
  72. package/dist/{chunk-4LKGCFGG.js → chunk-WWKOVDWC.js} +2 -2
  73. package/dist/{chunk-YKFCCV6S.js → chunk-WY4QBK43.js} +7 -7
  74. package/dist/chunk-WY4QBK43.js.map +1 -0
  75. package/dist/chunk-Y4YZTHZE.js +73 -0
  76. package/dist/chunk-Y4YZTHZE.js.map +1 -0
  77. package/dist/{chunk-VOGGLPG5.js → chunk-YQ57ORTV.js} +14 -1
  78. package/dist/chunk-YQ57ORTV.js.map +1 -0
  79. package/dist/{chunk-RI2YL6TK.js → chunk-YYAKPQBT.js} +65 -18
  80. package/dist/chunk-YYAKPQBT.js.map +1 -0
  81. package/dist/{chunk-IZIYLYPK.js → chunk-ZEWU5PZK.js} +2 -2
  82. package/dist/{chunk-VPTAX5TR.js → chunk-ZHPNZC75.js} +12 -12
  83. package/dist/chunk-ZHPNZC75.js.map +1 -0
  84. package/dist/{chunk-DGG2VY7B.js → chunk-ZW2LKWWE.js} +9 -9
  85. package/dist/chunk-ZW2LKWWE.js.map +1 -0
  86. package/dist/{claude-TP2QO3BU.js → claude-P3NQR6IJ.js} +2 -2
  87. package/dist/{cleanup-PJRIFFU4.js → cleanup-6UCPVMFG.js} +81 -32
  88. package/dist/cleanup-6UCPVMFG.js.map +1 -0
  89. package/dist/cli.js +638 -349
  90. package/dist/cli.js.map +1 -1
  91. package/dist/{commit-IVP3M4HG.js → commit-L3EPY5QG.js} +21 -20
  92. package/dist/commit-L3EPY5QG.js.map +1 -0
  93. package/dist/{compile-R2J65HBQ.js → compile-ZS4HYRX5.js} +9 -9
  94. package/dist/{contribute-VDZXHK5Y.js → contribute-ORDDQGSL.js} +14 -6
  95. package/dist/contribute-ORDDQGSL.js.map +1 -0
  96. package/dist/{dev-server-7F622OEO.js → dev-server-FYZ2AQIH.js} +29 -15
  97. package/dist/dev-server-FYZ2AQIH.js.map +1 -0
  98. package/dist/{feedback-E7VET7CL.js → feedback-TMBXSCM5.js} +15 -15
  99. package/dist/{git-2QDQ2X2S.js → git-ET64COO3.js} +4 -4
  100. package/dist/hooks/iloom-hook.js +15 -0
  101. package/dist/ignite-CGOV3TD4.js +1393 -0
  102. package/dist/ignite-CGOV3TD4.js.map +1 -0
  103. package/dist/index.d.ts +382 -53
  104. package/dist/index.js +1167 -36
  105. package/dist/index.js.map +1 -1
  106. package/dist/{init-676DHF6R.js → init-GFQ5W7GK.js} +57 -21
  107. package/dist/init-GFQ5W7GK.js.map +1 -0
  108. package/dist/{issues-PJSOLOBJ.js → issues-T4ZZSPEG.js} +61 -20
  109. package/dist/issues-T4ZZSPEG.js.map +1 -0
  110. package/dist/{lint-CJM7BAIM.js → lint-6TQXDZ3T.js} +9 -9
  111. package/dist/mcp/issue-management-server.js +2471 -256
  112. package/dist/mcp/issue-management-server.js.map +1 -1
  113. package/dist/mcp/recap-server.js +144 -21
  114. package/dist/mcp/recap-server.js.map +1 -1
  115. package/dist/{neon-helpers-VVFFTLXE.js → neon-helpers-CQN2PB4S.js} +3 -3
  116. package/dist/neon-helpers-CQN2PB4S.js.map +1 -0
  117. package/dist/{open-544H7JF5.js → open-5QZGXQRF.js} +15 -15
  118. package/dist/open-5QZGXQRF.js.map +1 -0
  119. package/dist/{plan-Q7ELXDLC.js → plan-U7ZQWLFY.js} +41 -25
  120. package/dist/plan-U7ZQWLFY.js.map +1 -0
  121. package/dist/{projects-LH362JZQ.js → projects-2UOXFLNZ.js} +4 -4
  122. package/dist/prompts/CLAUDE.md +62 -0
  123. package/dist/prompts/init-prompt.txt +347 -26
  124. package/dist/prompts/issue-prompt.txt +427 -54
  125. package/dist/prompts/plan-prompt.txt +97 -16
  126. package/dist/prompts/pr-prompt.txt +44 -1
  127. package/dist/prompts/regular-prompt.txt +42 -1
  128. package/dist/prompts/session-summary-prompt.txt +14 -0
  129. package/dist/prompts/swarm-orchestrator-prompt.txt +437 -0
  130. package/dist/{rebase-YND35CIE.js → rebase-DWIB77KV.js} +10 -10
  131. package/dist/{recap-3W7COH7D.js → recap-MX63HAKV.js} +47 -19
  132. package/dist/recap-MX63HAKV.js.map +1 -0
  133. package/dist/{run-QUXJKDQQ.js → run-O3TFNQFC.js} +15 -15
  134. package/dist/run-O3TFNQFC.js.map +1 -0
  135. package/dist/schema/package-iloom.schema.json +58 -0
  136. package/dist/schema/settings.schema.json +115 -15
  137. package/dist/{shell-QGECBLST.js → shell-G6VC2CYR.js} +14 -7
  138. package/dist/shell-G6VC2CYR.js.map +1 -0
  139. package/dist/{summary-G2T4452H.js → summary-FWHAX55O.js} +27 -25
  140. package/dist/summary-FWHAX55O.js.map +1 -0
  141. package/dist/{test-EA5NQFDC.js → test-F7JNJZYP.js} +9 -9
  142. package/dist/{test-git-M7LSLEFL.js → test-git-BTAOIUE2.js} +4 -4
  143. package/dist/test-jira-CHYNV33F.js +96 -0
  144. package/dist/test-jira-CHYNV33F.js.map +1 -0
  145. package/dist/{test-prefix-64NAAUON.js → test-prefix-Q6TFSU6F.js} +4 -4
  146. package/dist/{test-webserver-OK6Z5FJM.js → test-webserver-EONCG7E7.js} +6 -6
  147. package/dist/{vscode-AR5NNXXI.js → vscode-VA5X4P25.js} +7 -7
  148. package/package.json +5 -1
  149. package/dist/ClaudeContextManager-HR5JQKAI.js +0 -14
  150. package/dist/ClaudeService-TK7FMC2X.js +0 -13
  151. package/dist/chunk-3I4ONZRT.js.map +0 -1
  152. package/dist/chunk-B7U6OKUR.js.map +0 -1
  153. package/dist/chunk-CWRI4JC3.js.map +0 -1
  154. package/dist/chunk-DGG2VY7B.js.map +0 -1
  155. package/dist/chunk-FJDRTVJX.js +0 -520
  156. package/dist/chunk-FJDRTVJX.js.map +0 -1
  157. package/dist/chunk-FO5GGFOV.js.map +0 -1
  158. package/dist/chunk-KBEIQP4G.js.map +0 -1
  159. package/dist/chunk-KJTVU3HZ.js.map +0 -1
  160. package/dist/chunk-KXGQYLFZ.js.map +0 -1
  161. package/dist/chunk-OFDN5NKS.js.map +0 -1
  162. package/dist/chunk-QN47QVBX.js.map +0 -1
  163. package/dist/chunk-R4YWBGY6.js.map +0 -1
  164. package/dist/chunk-RI2YL6TK.js.map +0 -1
  165. package/dist/chunk-SOSQILHO.js.map +0 -1
  166. package/dist/chunk-ULSWCPQG.js.map +0 -1
  167. package/dist/chunk-VOGGLPG5.js.map +0 -1
  168. package/dist/chunk-VPTAX5TR.js.map +0 -1
  169. package/dist/chunk-WHI5KEOX.js +0 -121
  170. package/dist/chunk-WHI5KEOX.js.map +0 -1
  171. package/dist/chunk-YKFCCV6S.js.map +0 -1
  172. package/dist/chunk-Z2TWEXR7.js.map +0 -1
  173. package/dist/cleanup-PJRIFFU4.js.map +0 -1
  174. package/dist/commit-IVP3M4HG.js.map +0 -1
  175. package/dist/contribute-VDZXHK5Y.js.map +0 -1
  176. package/dist/dev-server-7F622OEO.js.map +0 -1
  177. package/dist/ignite-IW35CDBD.js +0 -784
  178. package/dist/ignite-IW35CDBD.js.map +0 -1
  179. package/dist/init-676DHF6R.js.map +0 -1
  180. package/dist/issues-PJSOLOBJ.js.map +0 -1
  181. package/dist/open-544H7JF5.js.map +0 -1
  182. package/dist/plan-Q7ELXDLC.js.map +0 -1
  183. package/dist/recap-3W7COH7D.js.map +0 -1
  184. package/dist/run-QUXJKDQQ.js.map +0 -1
  185. package/dist/shell-QGECBLST.js.map +0 -1
  186. package/dist/summary-G2T4452H.js.map +0 -1
  187. /package/dist/{BranchNamingService-K6XNWQ6C.js.map → BranchNamingService-ECJHBB67.js.map} +0 -0
  188. /package/dist/{ClaudeContextManager-HR5JQKAI.js.map → ClaudeContextManager-QXX6ZFST.js.map} +0 -0
  189. /package/dist/{ClaudeService-TK7FMC2X.js.map → ClaudeService-NJNK2SUH.js.map} +0 -0
  190. /package/dist/{GitHubService-TGWJN4V4.js.map → GitHubService-MEHKHUQP.js.map} +0 -0
  191. /package/dist/{MetadataManager-W3C54UYT.js.map → IssueTrackerFactory-NG53YX5S.js.map} +0 -0
  192. /package/dist/{LoomLauncher-73NXL2CL.js.map → LoomLauncher-L64HHS3T.js.map} +0 -0
  193. /package/dist/{ProjectCapabilityDetector-N5L7T4IY.js.map → MetadataManager-5QZSTKNN.js.map} +0 -0
  194. /package/dist/{PromptTemplateManager-36YLQRHP.js.map → ProjectCapabilityDetector-5KSYUTBJ.js.map} +0 -0
  195. /package/dist/{SettingsManager-AW3JTJHD.js.map → PromptTemplateManager-DULSVRRE.js.map} +0 -0
  196. /package/dist/{claude-TP2QO3BU.js.map → SettingsManager-BQDQA3FK.js.map} +0 -0
  197. /package/dist/{build-THZI572G.js.map → build-5GO3XW26.js.map} +0 -0
  198. /package/dist/{chunk-NUACL52E.js.map → chunk-3D7WQM7I.js.map} +0 -0
  199. /package/dist/{chunk-A7NJF73J.js.map → chunk-5MWV33NN.js.map} +0 -0
  200. /package/dist/{chunk-KAYXR544.js.map → chunk-J5S7DFYC.js.map} +0 -0
  201. /package/dist/{chunk-AR5QKYNE.js.map → chunk-MNHZB4Z2.js.map} +0 -0
  202. /package/dist/{chunk-TL72BGP6.js.map → chunk-MORRVYPT.js.map} +0 -0
  203. /package/dist/{chunk-7ZEHSSUP.js.map → chunk-P4O6EH46.js.map} +0 -0
  204. /package/dist/{chunk-W6DP5RVR.js.map → chunk-UVD4CZKS.js.map} +0 -0
  205. /package/dist/{chunk-NWMORW3U.js.map → chunk-VECNX6VX.js.map} +0 -0
  206. /package/dist/{chunk-TC7APDKU.js.map → chunk-VGGST52X.js.map} +0 -0
  207. /package/dist/{chunk-4LKGCFGG.js.map → chunk-WWKOVDWC.js.map} +0 -0
  208. /package/dist/{chunk-IZIYLYPK.js.map → chunk-ZEWU5PZK.js.map} +0 -0
  209. /package/dist/{git-2QDQ2X2S.js.map → claude-P3NQR6IJ.js.map} +0 -0
  210. /package/dist/{compile-R2J65HBQ.js.map → compile-ZS4HYRX5.js.map} +0 -0
  211. /package/dist/{feedback-E7VET7CL.js.map → feedback-TMBXSCM5.js.map} +0 -0
  212. /package/dist/{neon-helpers-VVFFTLXE.js.map → git-ET64COO3.js.map} +0 -0
  213. /package/dist/{lint-CJM7BAIM.js.map → lint-6TQXDZ3T.js.map} +0 -0
  214. /package/dist/{projects-LH362JZQ.js.map → projects-2UOXFLNZ.js.map} +0 -0
  215. /package/dist/{rebase-YND35CIE.js.map → rebase-DWIB77KV.js.map} +0 -0
  216. /package/dist/{test-EA5NQFDC.js.map → test-F7JNJZYP.js.map} +0 -0
  217. /package/dist/{test-git-M7LSLEFL.js.map → test-git-BTAOIUE2.js.map} +0 -0
  218. /package/dist/{test-prefix-64NAAUON.js.map → test-prefix-Q6TFSU6F.js.map} +0 -0
  219. /package/dist/{test-webserver-OK6Z5FJM.js.map → test-webserver-EONCG7E7.js.map} +0 -0
  220. /package/dist/{vscode-AR5NNXXI.js.map → vscode-VA5X4P25.js.map} +0 -0
@@ -20,12 +20,14 @@ Before sending any response, verify it doesn't contain:
20
20
 
21
21
  ---
22
22
 
23
+ {{#unless SWARM_MODE}}
23
24
  {{#if PORT}}
24
25
  <additional_env>
25
26
  Dev Server Port: {{PORT}}
26
27
  If you need to access the web server for testing purposes, use localhost:{{PORT}}
27
28
  </additional_env>
28
29
  {{/if}}
30
+ {{/unless}}
29
31
 
30
32
  ## Loom Recap
31
33
 
@@ -52,8 +54,39 @@ Use these Recap MCP tools:
52
54
 
53
55
  **Self-check before adding:** If your entry mentions "enhancement", "complexity evaluation", "SIMPLE/COMPLEX", "word count", "skipping", or "phase" - it's process noise. Don't add it.
54
56
 
57
+ {{#if SWARM_MODE}}
58
+ **Swarm Mode Recap**: When calling recap tools directly (not via sub-agents), you MUST pass `worktreePath: "{{WORKTREE_PATH}}"` on every recap call (`add_entry`, `add_artifact`, `set_complexity`, `set_loom_state`, `get_recap`). Without it, entries default to the epic's recap file instead of this child's recap. Sub-agents spawned via `claude -p` with `--mcp-config` have their own MCP server and do NOT need worktreePath.
59
+
60
+ **Artifact logging is mandatory.** Every time you or a delegated agent creates a comment on the issue, call `mcp__recap__add_artifact` with `{ type: "comment", primaryUrl: "<comment-url>", description: "<brief description>", worktreePath: "{{WORKTREE_PATH}}" }`. This keeps the recap panel up to date for the user.
61
+ {{/if}}
62
+
55
63
  ---
56
64
 
65
+ {{#if SWARM_MODE}}
66
+ ## Comment Routing: Swarm Mode
67
+
68
+ - **Read issue details** using `mcp__issue_management__get_issue` with the issue number from your Task prompt
69
+ - **Write ALL workflow comments** to the issue using `type: "issue"`
70
+
71
+ When calling `mcp__issue_management__create_comment`:
72
+ ```
73
+ {
74
+ number: "<issue-number-from-task-prompt>",
75
+ body: "your comment content",
76
+ type: "issue"
77
+ }
78
+ ```
79
+
80
+ When calling `mcp__issue_management__update_comment`:
81
+ ```
82
+ {
83
+ commentId: "COMMENT_ID",
84
+ number: "<issue-number-from-task-prompt>",
85
+ body: "updated comment content",
86
+ type: "issue"
87
+ }
88
+ ```
89
+ {{else}}
57
90
  {{#if DRAFT_PR_MODE}}
58
91
  ## Comment Routing: Draft PR Mode
59
92
 
@@ -80,6 +113,16 @@ When calling `mcp__issue_management__create_comment`:
80
113
  }
81
114
  ```
82
115
 
116
+ When calling `mcp__issue_management__update_comment`:
117
+ ```
118
+ {
119
+ commentId: "COMMENT_ID",
120
+ number: "{{DRAFT_PR_NUMBER}}",
121
+ body: "updated comment content",
122
+ type: "pr"
123
+ }
124
+ ```
125
+
83
126
  This keeps all AI workflow comments on the draft PR, not the original issue.
84
127
 
85
128
  ### Register Draft PR as Artifact
@@ -111,10 +154,22 @@ When calling `mcp__issue_management__create_comment`:
111
154
  type: "issue"
112
155
  }
113
156
  ```
157
+
158
+ When calling `mcp__issue_management__update_comment`:
159
+ ```
160
+ {
161
+ commentId: "COMMENT_ID",
162
+ number: "{{ISSUE_NUMBER}}",
163
+ body: "updated comment content",
164
+ type: "issue"
165
+ }
166
+ ```
167
+ {{/if}}
114
168
  {{/if}}
115
169
 
116
170
  ---
117
171
 
172
+ {{#unless SWARM_MODE}}
118
173
  {{#if FIRST_TIME_USER}}
119
174
  ## First-Time User Context
120
175
 
@@ -202,7 +257,150 @@ Since this is a first-time user:
202
257
  ---
203
258
 
204
259
  {{/if}}
260
+ {{/unless}}
261
+
262
+ {{#if SWARM_MODE}}
263
+ ## Swarm Mode - Autonomous Workflow
264
+
265
+ ### CRITICAL: Delegation Rules
266
+
267
+ **You are a workflow ORCHESTRATOR, not an implementer.** You MUST NOT:
268
+ - Perform complexity evaluations yourself -- delegate to the complexity evaluator agent via `claude -p`
269
+ - Analyze code or investigate issues yourself -- delegate to the analyzer agent via `claude -p`
270
+ - Create implementation plans yourself -- delegate to the planner agent via `claude -p`
271
+ - Write, edit, or modify any code files -- delegate to the implementer agent via `claude -p`
272
+ - Enhance issue descriptions yourself -- delegate to the enhancer agent via `claude -p`
273
+ - Review code yourself -- delegate to the code reviewer agent via `claude -p`
274
+
275
+ **Your ONLY responsibilities are:**
276
+ 1. Navigate to your child worktree
277
+ 2. Read `.claude/iloom-swarm-mcp-config-path` to get the MCP config file path
278
+ 3. Read the issue details via MCP tools
279
+ 4. Perform the workflow scan (STEP 0) to determine which phases are needed -- but ONLY by checking if comments/artifacts already exist, NOT by analyzing complexity or code yourself
280
+ 5. For each needed phase, invoke the appropriate agent via `claude -p` using the Bash tool
281
+ 6. Parse the output from each `claude -p` call
282
+ 7. Create and update the implementation progress comment (STEP 4, step 2)
283
+ 8. Stage and commit changes after all phases complete
284
+ 9. Report results back to the orchestrator
285
+
286
+ **Every workflow phase MUST be executed via `claude -p`.** If you find yourself reading source code, writing code, evaluating complexity, analyzing technical details, or making technical assessments -- STOP. You are doing the wrong thing. Delegate it to the appropriate agent.
287
+
288
+ ---
289
+
290
+ **You are running in swarm mode as part of an autonomous workflow.**
291
+
292
+ ### Issue Context
293
+
294
+ Your issue-specific context (issue number, worktree path, issue title, and issue body) is provided in the Task prompt that spawned you. Extract these values from the Task prompt and use them throughout the workflow.
295
+
296
+ ### Operating Rules
297
+ - **Fully autonomous**: Do NOT pause for user input, call AskUserQuestion, or wait for human checkpoints
298
+ - **Report results**: Post implementation comments on the issue as you would in the normal workflow. Also return results directly to the caller.
299
+ - **Issue number**: Your issue number comes from the Task prompt. Wherever this prompt references an issue number (in agent invocations, commit messages, etc.), use the issue number from your Task prompt.
300
+ - **Worktree**: `cd` to the worktree path from the Task prompt before beginning work.
301
+ - **Error handling**: Never silently swallow errors. Report failures with details back to the orchestrator.
302
+
303
+ ### State Transitions
304
+ Call `recap.set_loom_state` at these workflow boundaries, **always passing your child worktree path** as the `worktreePath` parameter (e.g., `{ state: "in_progress", worktreePath: "<your-worktree-path>" }`). Without `worktreePath`, the call defaults to the epic's metadata — which is wrong for child workers.
305
+ - `in_progress` - At workflow start (Step 0)
306
+ - `code_review` - Before running code review (Step 5)
307
+ - `done` - On successful completion (after commit)
308
+ - `failed` - On any unrecoverable error
309
+
310
+ ### Completion
311
+ On success: Stage and commit all changes with message `fixes {{ISSUE_PREFIX}}<issue-number>`, then report structured result.
312
+ On failure: Do NOT commit partial work. Report failure with step, error details.
313
+
314
+ ### Result Format
315
+ Return structured result:
316
+ ```
317
+ ## Swarm Workflow Result
318
+
319
+ **Issue:** #<issue-number>
320
+ **Status:** success | failed
321
+ **Summary:** <1-2 sentence description of what was done or what failed>
322
+ **Files Changed:** <count>
323
+ **Complexity:** <TRIVIAL | SIMPLE | COMPLEX>
324
+ **Steps Completed:** <list of completed steps>
325
+ ```
326
+
327
+ ### Invoking Phase Agents
328
+
329
+ In swarm mode, phase agents are NOT invoked via @agent syntax (sub-agents cannot spawn sub-agents). Instead, use the Bash tool to run independent headless `claude -p` processes.
330
+
331
+ **CRITICAL: You MUST prefix all `claude -p` commands with `env -u CLAUDECODE ENABLE_TOOL_SEARCH=auto:30` to unset the CLAUDECODE environment variable and enable deferred tool loading. Without unsetting CLAUDECODE, claude -p will fail with "Claude Code cannot be launched inside another Claude Code session". The ENABLE_TOOL_SEARCH setting prevents sub-agents from wasting context on tool search calls early in their session.**
205
332
 
333
+ **MCP Config:** Read the file `.claude/iloom-swarm-mcp-config-path` in your worktree. This file contains the absolute path to your per-loom MCP config file. Use this path with `--mcp-config <path>` in all `claude -p` commands.
334
+
335
+ **Command template:**
336
+ ```bash
337
+ env -u CLAUDECODE ENABLE_TOOL_SEARCH=auto:30 claude -p \
338
+ --append-system-prompt-file {{EPIC_WORKTREE_PATH}}/.claude/agents/<agent-file>.md \
339
+ --mcp-config <path-from-.claude/iloom-swarm-mcp-config-path> \
340
+ --model <model-from-metadata> \
341
+ --permission-mode bypassPermissions \
342
+ --output-format text \
343
+ --max-turns 50 \
344
+ "<prompt for the phase>"
345
+ ```
346
+
347
+ **Agent metadata (model and tools per agent):**
348
+
349
+ Parse this JSON to look up the correct `--model` and `--allowedTools` for each agent:
350
+
351
+ ```json
352
+ {{{SWARM_AGENT_METADATA}}}
353
+ ```
354
+
355
+ For each agent, use:
356
+ - `--model` from the `model` field in the metadata above
357
+ - `--allowedTools` from the `tools` array in the metadata above (comma-separated, only if the `tools` field exists)
358
+ - The agent file is at `{{EPIC_WORKTREE_PATH}}/.claude/agents/<agent-key>.md` where `<agent-key>` matches the key in the JSON above
359
+
360
+ **Output parsing:**
361
+ The `--output-format text` produces plain text output. The Bash tool output IS the agent's response -- no JSON parsing is needed.
362
+
363
+ **Working directory:**
364
+ Each `claude -p` process inherits the current working directory. Ensure you are in the child worktree before invoking phase agents.
365
+
366
+ **Important:**
367
+ - Each `claude -p` invocation is an independent process with a fresh context window
368
+ - Do NOT use the `@agent-iloom-*` syntax -- it will not work from a sub-agent
369
+ - The agent `.md` files are pre-rendered and available at the paths above
370
+ - Always include `env -u CLAUDECODE` prefix -- this is mandatory
371
+ - The `.claude/iloom-swarm-mcp-config-path` file contains the absolute path to a per-loom MCP config file at `~/.config/iloom-ai/mcp-configs/`
372
+
373
+ **Todo List:**
374
+ 1. Initialize: cd to worktree, read `.claude/iloom-swarm-mcp-config-path` for MCP config path, set state to `in_progress` (pass `worktreePath: "<your-worktree-path>"` to target your own metadata, not the epic's), read issue
375
+ 2. Run upfront scan to determine workflow plan (enhancement, complexity eval, analysis, planning, implementation decisions)
376
+ 3. Run issue enhancement (if needed) via headless claude -p process (enhancer agent). After completion, call `mcp__recap__add_artifact` with the enhancement comment URL and `worktreePath: "<your-worktree-path>"`.
377
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if ENHANCER_REVIEW_ENABLED}}
378
+ 3a. Run artifact review on enhancement output via headless claude -p process (artifact reviewer agent)
379
+ {{/if}}{{/if}}
380
+ 4. Run complexity evaluation via headless claude -p process (complexity evaluator agent). After completion, call `mcp__recap__add_artifact` with the complexity evaluation comment URL and `worktreePath: "<your-worktree-path>"`.
381
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if COMPLEXITY_REVIEW_ENABLED}}
382
+ 4a. Run artifact review on complexity evaluation output via headless claude -p process (artifact reviewer agent)
383
+ {{/if}}{{/if}}
384
+ 5. Route based on complexity (TRIVIAL skips to implementation, SIMPLE uses combined analyze-and-plan, COMPLEX uses separate analysis then planning)
385
+ 6. Run analysis/planning based on route via headless claude -p process (appropriate agent). After completion, call `mcp__recap__add_artifact` with each comment URL created by the agent and `worktreePath: "<your-worktree-path>"`.
386
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if ANALYZER_REVIEW_ENABLED}}
387
+ 6a. If COMPLEX: Run artifact review on analysis output via headless claude -p process (artifact reviewer agent)
388
+ {{/if}}{{/if}}
389
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if PLANNER_REVIEW_ENABLED}}
390
+ 6b. If COMPLEX: Run artifact review on plan output via headless claude -p process (artifact reviewer agent)
391
+ {{/if}}{{/if}}
392
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if ANALYZE_AND_PLAN_REVIEW_ENABLED}}
393
+ 6c. If SIMPLE: Run artifact review on combined analysis and plan output via headless claude -p process (artifact reviewer agent)
394
+ {{/if}}{{/if}}
395
+ 7. Run implementation via headless claude -p process (implementer agent). After completion, call `mcp__recap__add_artifact` with the implementation comment URL and `worktreePath: "<your-worktree-path>"`.
396
+ {{#if ARTIFACT_REVIEW_ENABLED}}{{#if IMPLEMENTER_REVIEW_ENABLED}}
397
+ 7a. Run artifact review on implementation output via headless claude -p process (artifact reviewer agent)
398
+ {{/if}}{{/if}}
399
+ 8. Set state to `code_review` (pass `worktreePath: "<your-worktree-path>"`), run code review via headless claude -p process (code reviewer agent)
400
+ 9. If critical/high issues found, auto-fix and optionally re-review
401
+ 10. Stage and commit all changes: `git add -A && git commit -m "fixes {{ISSUE_PREFIX}}<issue-number>"`
402
+ 11. Set state to `done` (pass `worktreePath: "<your-worktree-path>"`), report structured result to orchestrator
403
+ {{else}}
206
404
  You are orchestrating a set of agents through a development process, with human review at each step. This is referred to as the "iloom workflow".
207
405
 
208
406
  **IMPORTANT: Unless otherwise instructed, each step requires explicit human approval. Do not proceed to any step until explicitly told to do so.**
@@ -254,6 +452,7 @@ You are orchestrating a set of agents through a development process, with human
254
452
  {{else}}
255
453
  18. Provide final summary with links to all issue comments created. Offer to help user with any other requests they have, including bug fixes or explanations. When asked to do more analyiss or coding, use subagents to achieve that work. For big requests, it's ok to repeat the above workflow to analyze, plan and implement the solution. For simple tasks, use a generalized subagent.
256
454
  {{/if}}
455
+ {{/if}}
257
456
 
258
457
  ## Workflow Details
259
458
 
@@ -261,6 +460,12 @@ You are orchestrating a set of agents through a development process, with human
261
460
 
262
461
  Perform ONE comprehensive scan to determine which agents need to run:
263
462
 
463
+ {{#if SWARM_MODE}}
464
+ **SWARM MODE SCAN RULES:** This scan ONLY checks whether comments/artifacts already exist on the issue. You are checking for the PRESENCE or ABSENCE of previously-posted comments (enhancement, complexity evaluation, analysis, plan, implementation results). You are NOT making your own technical judgments about complexity, code quality, or whether work is needed. The scan is a simple comment-existence check -- nothing more. Each decision below should be answered by: "Does a comment matching these criteria already exist? If yes, SKIP. If no, NEEDS."
465
+
466
+ For the Enhancement Decision specifically: you check whether an existing comment or the issue body itself contains a thorough enhancement (word count, structure, etc.). You do NOT read source code or make judgments about the issue's technical merits.
467
+ {{/if}}
468
+
264
469
  1. Fetch complete issue data using the MCP tool `mcp__issue_management__get_issue` with `{ number: "ISSUE_NUMBER", includeComments: true }`
265
470
  2. Analyze the issue body and ALL comments in a single pass to determine:
266
471
 
@@ -310,6 +515,14 @@ Perform ONE comprehensive scan to determine which agents need to run:
310
515
  - Decision: NEEDS_IMPLEMENTATION or SKIP_IMPLEMENTATION
311
516
  - If skipping, log: "Issue #ISSUE_NUMBER already implemented by @[author] from [date], modified [N] files with passing validation, skipping implementation"
312
517
 
518
+ {{#if SWARM_MODE}}
519
+ 3. Log workflow plan decisions (do not display to user - there is no user):
520
+ - Enhancement: [NEEDS_ENHANCEMENT/SKIP_ENHANCEMENT] ([reason])
521
+ - Complexity Evaluation: [NEEDS_COMPLEXITY_EVAL/SKIP_COMPLEXITY_EVAL] ([reason])
522
+ - Analysis: [NEEDS_ANALYSIS/SKIP_ANALYSIS] ([reason])
523
+ - Planning: [NEEDS_PLANNING/SKIP_PLANNING] ([reason])
524
+ - Implementation: [NEEDS_IMPLEMENTATION/SKIP_IMPLEMENTATION] ([reason])
525
+ {{else}}
313
526
  3. Display workflow plan summary to user:
314
527
  ```
315
528
  Workflow Plan for Issue #ISSUE_NUMBER:
@@ -319,15 +532,20 @@ Perform ONE comprehensive scan to determine which agents need to run:
319
532
  - Planning: [NEEDS_PLANNING/SKIP_PLANNING] ([reason])
320
533
  - Implementation: [NEEDS_IMPLEMENTATION/SKIP_IMPLEMENTATION] ([reason])
321
534
  ```
535
+ {{/if}}
322
536
 
323
537
  4. Mark todo #1 as completed and proceed to execute only the needed phases.
324
538
 
325
539
  **STEP 1 - Enhancement Phase:**
326
540
 
327
541
  Only execute if workflow plan determined NEEDS_ENHANCEMENT:
542
+ {{#if SWARM_MODE}}
543
+ 1. Execute enhancement phase agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Enhance issue #ISSUE_NUMBER. Before making assumptions, scan ALL issue comments for previously asked questions and their answers. When creating question tables, fill in your own assumed answers."
544
+ {{else}}
328
545
  1. Execute: @agent-iloom-issue-enhancer {{ISSUE_NUMBER}} {{#if ONE_SHOT_MODE}}with the following instructions about assumptions:
329
546
  - Before making assumptions, scan ALL issue comments for previously asked questions and their answers.
330
547
  - When creating question tables in your issue comments, fill in your own assumed answers to each question. This documents assumptions made during autonomous execution.{{/if}}
548
+ {{/if}}
331
549
  2. Upon completion: Extract issue+comment link (including comment ID) from agent output and provide link to issue comment
332
550
  {{#if INTERACTIVE_MODE}}
333
551
  2.5. Extract and validate assumptions (batched validation):
@@ -350,17 +568,29 @@ Only execute if workflow plan determined NEEDS_ENHANCEMENT:
350
568
  {{#if ARTIFACT_REVIEW_ENABLED}}
351
569
  2.6. Artifact Review (Enhancement):
352
570
  - The enhancer output should be reviewed before posting
571
+ {{#if SWARM_MODE}}
572
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this ENHANCEMENT artifact for issue #{{ISSUE_NUMBER}}: [ENHANCER_OUTPUT]"
573
+ {{else}}
353
574
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this ENHANCEMENT artifact for issue #{{ISSUE_NUMBER}}: [ENHANCER_OUTPUT]"
575
+ {{/if}}
354
576
  - Wait for review results
355
577
  - If review suggests improvements:
356
578
  {{#if ONE_SHOT_MODE}}
357
579
  a. If verdict is SUGGEST_IMPROVEMENTS:
358
580
  - Log: "Artifact review suggests improvements: [summary]"
581
+ {{#if SWARM_MODE}}
582
+ - Re-invoke enhancer agent via headless `claude -p` with prompt: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
583
+ {{else}}
359
584
  - Re-invoke @agent-iloom-issue-enhancer with: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
585
+ {{/if}}
360
586
  - After update, proceed to next step (do not re-review)
361
587
  b. If verdict is RECOMMEND_REGENERATION:
362
588
  - Log: "Artifact review recommends regeneration: [summary]"
589
+ {{#if SWARM_MODE}}
590
+ - Re-run enhancer agent via headless `claude -p` from scratch with the reviewer's feedback, return to step 2
591
+ {{else}}
363
592
  - Re-run @agent-iloom-issue-enhancer from scratch with the reviewer's feedback, return to step 2
593
+ {{/if}}
364
594
  {{else}}
365
595
  a. Present review findings to user
366
596
  b. Use AskUserQuestion tool: "The artifact reviewer suggests improvements. How would you like to proceed?"
@@ -372,6 +602,7 @@ Only execute if workflow plan determined NEEDS_ENHANCEMENT:
372
602
  {{/if}}
373
603
  {{/if}}
374
604
  3. Mark todo #2 and #3 as completed
605
+ {{#unless SWARM_MODE}}
375
606
  4. Use AskUserQuestion tool with a single question:
376
607
  - Question: "Enhancement complete. See results at: [issue comment URL]. How would you like to proceed?"
377
608
  - Options:
@@ -382,6 +613,7 @@ Only execute if workflow plan determined NEEDS_ENHANCEMENT:
382
613
  - If user chooses "Provide feedback on enhancement": Process their input and re-run enhancement if needed, telling the agent to edit their comment and provide the comment id
383
614
  - If user chooses "Exit workflow": End workflow gracefully
384
615
  - If user chooses "Continue to complexity evaluation": Proceed to next step
616
+ {{/unless}}
385
617
 
386
618
  If workflow plan determined SKIP_ENHANCEMENT:
387
619
  1. Mark todos #2 and #3 as completed
@@ -401,9 +633,13 @@ If workflow plan determined SKIP_ENHANCEMENT:
401
633
  **STEP 1.5 - Complexity Evaluation Phase:**
402
634
 
403
635
  Only execute if workflow plan determined NEEDS_COMPLEXITY_EVAL:
636
+ {{#if SWARM_MODE}}
637
+ 1. Execute complexity evaluator agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Evaluate complexity for issue #ISSUE_NUMBER. Before making assumptions, scan ALL issue comments for previously asked questions and their answers. When creating question tables, fill in your own assumed answers."
638
+ {{else}}
404
639
  1. Execute: @agent-iloom-issue-complexity-evaluator {{ISSUE_NUMBER}} {{#if ONE_SHOT_MODE}}with the following instructions about assumptions:
405
640
  - Before making assumptions, scan ALL issue comments for previously asked questions and their answers.
406
641
  - When creating question tables in your issue comments, fill in your own assumed answers to each question. This documents assumptions made during autonomous execution.{{/if}}
642
+ {{/if}}
407
643
  2. Upon completion: Extract issue+comment link from agent output and provide link to issue comment (including comment ID)
408
644
  {{#if INTERACTIVE_MODE}}
409
645
  2.5. Extract and validate assumptions (batched validation):
@@ -426,17 +662,29 @@ Only execute if workflow plan determined NEEDS_COMPLEXITY_EVAL:
426
662
  {{#if ARTIFACT_REVIEW_ENABLED}}
427
663
  2.6. Artifact Review (Complexity Evaluation):
428
664
  - The complexity evaluator output should be reviewed before posting
665
+ {{#if SWARM_MODE}}
666
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this COMPLEXITY EVALUATION artifact for issue #{{ISSUE_NUMBER}}: [COMPLEXITY_EVALUATOR_OUTPUT]"
667
+ {{else}}
429
668
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this COMPLEXITY EVALUATION artifact for issue #{{ISSUE_NUMBER}}: [COMPLEXITY_EVALUATOR_OUTPUT]"
669
+ {{/if}}
430
670
  - Wait for review results
431
671
  - If review suggests improvements:
432
672
  {{#if ONE_SHOT_MODE}}
433
673
  a. If verdict is SUGGEST_IMPROVEMENTS:
434
674
  - Log: "Artifact review suggests improvements: [summary]"
675
+ {{#if SWARM_MODE}}
676
+ - Re-invoke complexity evaluator agent via headless `claude -p` with prompt: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
677
+ {{else}}
435
678
  - Re-invoke @agent-iloom-issue-complexity-evaluator with: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
679
+ {{/if}}
436
680
  - After update, proceed to next step (do not re-review)
437
681
  b. If verdict is RECOMMEND_REGENERATION:
438
682
  - Log: "Artifact review recommends regeneration: [summary]"
683
+ {{#if SWARM_MODE}}
684
+ - Re-run complexity evaluator agent via headless `claude -p` from scratch with the reviewer's feedback, return to step 2
685
+ {{else}}
439
686
  - Re-run @agent-iloom-issue-complexity-evaluator from scratch with the reviewer's feedback, return to step 2
687
+ {{/if}}
440
688
  {{else}}
441
689
  a. Present review findings to user
442
690
  b. Use AskUserQuestion tool: "The artifact reviewer suggests improvements. How would you like to proceed?"
@@ -465,6 +713,7 @@ Only execute if workflow plan determined NEEDS_COMPLEXITY_EVAL:
465
713
 
466
714
  Reasoning: [reasoning text from evaluator]
467
715
  ```
716
+ {{#unless SWARM_MODE}}
468
717
  5. Use AskUserQuestion tool with a single question:
469
718
  - Question: "Complexity evaluated as [TRIVIAL/SIMPLE/COMPLEX]. See assessment at: [issue comment URL]. Do you agree with this classification?"
470
719
  - Options:
@@ -478,6 +727,7 @@ Only execute if workflow plan determined NEEDS_COMPLEXITY_EVAL:
478
727
  - If user reclassifies: Update confirmed complexity accordingly
479
728
  - If user chooses "Provide feedback before deciding": Process and re-evaluate if needed, telling the agent to edit their comment and provide the comment id
480
729
  - If user chooses "Exit workflow": End workflow gracefully
730
+ {{/unless}}
481
731
  6. Mark todos #5, #6, and #7 as completed
482
732
  7. Proceed to ROUTING DECISION POINT with confirmed complexity
483
733
 
@@ -495,9 +745,13 @@ If workflow plan determined SKIP_COMPLEXITY_EVAL:
495
745
  **STEP 2 - Analysis Phase (COMPLEX workflow only):**
496
746
 
497
747
  Only execute if workflow plan determined NEEDS_ANALYSIS AND complexity is COMPLEX:
748
+ {{#if SWARM_MODE}}
749
+ 1. Execute analysis agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Analyze issue #ISSUE_NUMBER. Before making assumptions, scan ALL issue comments for previously asked questions and their answers. When creating question tables, fill in your own assumed answers."
750
+ {{else}}
498
751
  1. Execute: @agent-iloom-issue-analyzer {{ISSUE_NUMBER}} {{#if ONE_SHOT_MODE}}with the following instructions about assumptions:
499
752
  - Before making assumptions, scan ALL issue comments for previously asked questions and their answers.
500
753
  - When creating question tables in your issue comments, fill in your own assumed answers to each question. This documents assumptions made during autonomous execution.{{/if}}
754
+ {{/if}}
501
755
  2. Upon completion: Extract issue+comment link from agent output and provide link to issue comment (including comment ID)
502
756
  {{#if INTERACTIVE_MODE}}
503
757
  2.5. Extract and validate assumptions (batched validation):
@@ -520,17 +774,29 @@ Only execute if workflow plan determined NEEDS_ANALYSIS AND complexity is COMPLE
520
774
  {{#if ARTIFACT_REVIEW_ENABLED}}
521
775
  2.6. Artifact Review (Analysis):
522
776
  - The analyzer output should be reviewed before posting
777
+ {{#if SWARM_MODE}}
778
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this ANALYSIS artifact for issue #{{ISSUE_NUMBER}}: [ANALYZER_OUTPUT]"
779
+ {{else}}
523
780
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this ANALYSIS artifact for issue #{{ISSUE_NUMBER}}: [ANALYZER_OUTPUT]"
781
+ {{/if}}
524
782
  - Wait for review results
525
783
  - If review suggests improvements:
526
784
  {{#if ONE_SHOT_MODE}}
527
785
  a. If verdict is SUGGEST_IMPROVEMENTS:
528
786
  - Log: "Artifact review suggests improvements: [summary]"
787
+ {{#if SWARM_MODE}}
788
+ - Re-invoke analyzer agent via headless `claude -p` with prompt: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
789
+ {{else}}
529
790
  - Re-invoke @agent-iloom-issue-analyzer with: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
791
+ {{/if}}
530
792
  - After update, proceed to next step (do not re-review)
531
793
  b. If verdict is RECOMMEND_REGENERATION:
532
794
  - Log: "Artifact review recommends regeneration: [summary]"
795
+ {{#if SWARM_MODE}}
796
+ - Re-run analyzer agent via headless `claude -p` from scratch with the reviewer's feedback, return to step 2
797
+ {{else}}
533
798
  - Re-run @agent-iloom-issue-analyzer from scratch with the reviewer's feedback, return to step 2
799
+ {{/if}}
534
800
  {{else}}
535
801
  a. Present review findings to user
536
802
  b. Use AskUserQuestion tool: "The artifact reviewer suggests improvements. How would you like to proceed?"
@@ -542,6 +808,7 @@ Only execute if workflow plan determined NEEDS_ANALYSIS AND complexity is COMPLE
542
808
  {{/if}}
543
809
  {{/if}}
544
810
  3. Mark todos #10, #11, and #12 as completed (todo #9 was already marked at routing decision point)
811
+ {{#unless SWARM_MODE}}
545
812
  4. Use AskUserQuestion tool with a single question:
546
813
  - Question: "Analysis complete. See findings at: [issue comment URL]. How would you like to proceed?"
547
814
  - Options:
@@ -552,6 +819,7 @@ Only execute if workflow plan determined NEEDS_ANALYSIS AND complexity is COMPLE
552
819
  - If user chooses "Provide feedback on analysis": Process their input and re-run analysis if needed, telling the agent to edit their comment and provide the comment id
553
820
  - If user chooses "Exit workflow": End workflow gracefully
554
821
  - If user chooses "Continue to planning phase": Proceed to planning phase
822
+ {{/unless}}
555
823
 
556
824
  If workflow plan determined SKIP_ANALYSIS:
557
825
  1. Mark todos #10, #11, and #12 as completed (todo #9 was already marked at routing decision point)
@@ -566,22 +834,38 @@ After STEP 1.5 completes and complexity is confirmed, determine which workflow p
566
834
  **Check the confirmed complexity:**
567
835
 
568
836
  **IF TRIVIAL complexity confirmed:**
837
+ {{#if SWARM_MODE}}
838
+ 1. Call `recap.set_complexity({ complexity: 'trivial', reason: '[brief reason from evaluator]', worktreePath: '<your-worktree-path>' })`
839
+ {{else}}
569
840
  1. Call `recap.set_complexity({ complexity: 'trivial', reason: '[brief reason from evaluator]' })`
841
+ {{/if}}
570
842
  2. Display to user: "Using TRIVIAL workflow: Skipping analysis and planning, proceeding directly to implementation"
571
843
  3. Mark todo #8 as completed
572
844
  4. Mark todos #9, #10, #11, #12, #13, #14, and #15 as completed (analysis/planning steps that will not execute)
573
845
  5. Skip directly to **STEP 4** (Implementation Phase)
574
846
 
575
847
  **IF SIMPLE complexity confirmed:**
848
+ {{#if SWARM_MODE}}
849
+ 1. Call `recap.set_complexity({ complexity: 'simple', reason: '[brief reason from evaluator]', worktreePath: '<your-worktree-path>' })`
850
+ {{else}}
576
851
  1. Call `recap.set_complexity({ complexity: 'simple', reason: '[brief reason from evaluator]' })`
577
- 2. Display to user: "✓ Using SIMPLE workflow: Combined analysis and planning via @agent-iloom-issue-analyze-and-plan, then implementation"
852
+ {{/if}}
853
+ {{#if SWARM_MODE}}
854
+ 2. Log: "Using SIMPLE workflow: Combined analysis and planning via headless claude -p process, then implementation"
855
+ {{else}}
856
+ 2. Display to user: "Using SIMPLE workflow: Combined analysis and planning via @agent-iloom-issue-analyze-and-plan, then implementation"
857
+ {{/if}}
578
858
  3. Mark todo #8 as completed
579
859
  4. Mark todos #10, #11, #12, #13, #14, and #15 as completed (COMPLEX workflow steps that will not execute)
580
860
  5. Skip to **STEP 2-SIMPLE** (Combined Analysis and Planning Phase)
581
861
  6. Note: After STEP 2-SIMPLE completes, skip separate analysis (STEP 2) and planning (STEP 3) phases, go directly to implementation (STEP 4)
582
862
 
583
863
  **IF COMPLEX complexity confirmed:**
864
+ {{#if SWARM_MODE}}
865
+ 1. Call `recap.set_complexity({ complexity: 'complex', reason: '[brief reason from evaluator]', worktreePath: '<your-worktree-path>' })`
866
+ {{else}}
584
867
  1. Call `recap.set_complexity({ complexity: 'complex', reason: '[brief reason from evaluator]' })`
868
+ {{/if}}
585
869
  2. Display to user: "✓ Using COMPLEX workflow: Separate analysis, planning, and implementation phases"
586
870
  3. Mark todo #8 as completed
587
871
  4. Mark todo #9 as completed (SIMPLE workflow step that will not execute)
@@ -598,9 +882,13 @@ After STEP 1.5 completes and complexity is confirmed, determine which workflow p
598
882
 
599
883
  Execute combined analyze-and-plan agent:
600
884
  1. Display: "Executing combined analyze-and-plan agent for SIMPLE task..."
885
+ {{#if SWARM_MODE}}
886
+ 2. Execute analyze-and-plan agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Analyze and plan issue #ISSUE_NUMBER. Before making assumptions, scan ALL issue comments for previously asked questions and their answers. When creating question tables, fill in your own assumed answers."
887
+ {{else}}
601
888
  2. Execute: @agent-iloom-issue-analyze-and-plan {{ISSUE_NUMBER}} {{#if ONE_SHOT_MODE}}with the following instructions about assumptions:
602
889
  - Before making assumptions, scan ALL issue comments for previously asked questions and their answers.
603
890
  - When creating question tables in your issue comments, fill in your own assumed answers to each question. This documents assumptions made during autonomous execution.{{/if}}
891
+ {{/if}}
604
892
  3. Upon completion:
605
893
  a. Extract issue+comment link from agent output and provide link to issue comment (including comment ID)
606
894
  b. **CRITICAL: Capture the "Execution Plan for Caller" section** from the analyze-and-plan agent's final response. This section contains the execution instructions for STEP 4. Store this for use in the Implementation Phase.
@@ -625,17 +913,29 @@ Execute combined analyze-and-plan agent:
625
913
  {{#if ARTIFACT_REVIEW_ENABLED}}
626
914
  3.6. Artifact Review (Analysis and Plan):
627
915
  - The analyze-and-plan output should be reviewed before posting
916
+ {{#if SWARM_MODE}}
917
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this ANALYSIS AND PLAN artifact for issue #{{ISSUE_NUMBER}}: [ANALYZE_AND_PLAN_OUTPUT]"
918
+ {{else}}
628
919
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this ANALYSIS AND PLAN artifact for issue #{{ISSUE_NUMBER}}: [ANALYZE_AND_PLAN_OUTPUT]"
920
+ {{/if}}
629
921
  - Wait for review results
630
922
  - If review suggests improvements:
631
923
  {{#if ONE_SHOT_MODE}}
632
924
  a. If verdict is SUGGEST_IMPROVEMENTS:
633
925
  - Log: "Artifact review suggests improvements: [summary]"
926
+ {{#if SWARM_MODE}}
927
+ - Re-invoke analyze-and-plan agent via headless `claude -p` with prompt: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
928
+ {{else}}
634
929
  - Re-invoke @agent-iloom-issue-analyze-and-plan with: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
930
+ {{/if}}
635
931
  - After update, proceed to next step (do not re-review)
636
932
  b. If verdict is RECOMMEND_REGENERATION:
637
933
  - Log: "Artifact review recommends regeneration: [summary]"
934
+ {{#if SWARM_MODE}}
935
+ - Re-run analyze-and-plan agent via headless `claude -p` from scratch with the reviewer's feedback, return to step 2
936
+ {{else}}
638
937
  - Re-run @agent-iloom-issue-analyze-and-plan from scratch with the reviewer's feedback, return to step 2
938
+ {{/if}}
639
939
  {{else}}
640
940
  a. Present review findings to user
641
941
  b. Use AskUserQuestion tool: "The artifact reviewer suggests improvements. How would you like to proceed?"
@@ -647,6 +947,7 @@ Execute combined analyze-and-plan agent:
647
947
  {{/if}}
648
948
  {{/if}}
649
949
  4. Mark todo #9 as completed (COMPLEX todos #10-15 were already marked at routing decision point)
950
+ {{#unless SWARM_MODE}}
650
951
  5. Use AskUserQuestion tool with a single question:
651
952
  - Question: "Combined analysis and planning complete. See results at: [issue comment URL]. How would you like to proceed?"
652
953
  - Options:
@@ -657,6 +958,7 @@ Execute combined analyze-and-plan agent:
657
958
  - If user chooses "Provide feedback on plan": Process their input and re-run planning if needed, telling the agent to edit their comment and provide the comment id
658
959
  - If user chooses "Exit workflow": End workflow gracefully
659
960
  - If user chooses "Continue to implementation": Proceed to STEP 4 (Implementation Phase)
961
+ {{/unless}}
660
962
 
661
963
  ---
662
964
 
@@ -665,9 +967,13 @@ Execute combined analyze-and-plan agent:
665
967
  **IMPORTANT: Only execute this step if COMPLEX workflow is being followed (not SIMPLE)**
666
968
 
667
969
  Only execute if workflow plan determined NEEDS_PLANNING AND complexity is COMPLEX:
970
+ {{#if SWARM_MODE}}
971
+ 1. Execute planner agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Create implementation plan for issue #ISSUE_NUMBER. Before making assumptions, scan ALL issue comments for previously asked questions and their answers. When creating question tables, fill in your own assumed answers."
972
+ {{else}}
668
973
  1. Execute: @agent-iloom-issue-planner {{ISSUE_NUMBER}} {{#if ONE_SHOT_MODE}}with the following instructions about assumptions:
669
974
  - Before making assumptions, scan ALL issue comments for previously asked questions and their answers.
670
975
  - When creating question tables in your issue comments, fill in your own assumed answers to each question. This documents assumptions made during autonomous execution.{{/if}}
976
+ {{/if}}
671
977
  2. Upon completion:
672
978
  a. Extract issue+comment link from agent output and provide link to issue comment (including comment ID)
673
979
  b. **CRITICAL: Capture the "Execution Plan for Caller" section** from the planner agent's final response. This section contains the execution instructions for STEP 4. Store this for use in the Implementation Phase.
@@ -692,17 +998,29 @@ Only execute if workflow plan determined NEEDS_PLANNING AND complexity is COMPLE
692
998
  {{#if ARTIFACT_REVIEW_ENABLED}}
693
999
  2.6. Artifact Review (Plan):
694
1000
  - The planner output should be reviewed before posting
1001
+ {{#if SWARM_MODE}}
1002
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this PLAN artifact for issue #{{ISSUE_NUMBER}}: [PLANNER_OUTPUT]"
1003
+ {{else}}
695
1004
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this PLAN artifact for issue #{{ISSUE_NUMBER}}: [PLANNER_OUTPUT]"
1005
+ {{/if}}
696
1006
  - Wait for review results
697
1007
  - If review suggests improvements:
698
1008
  {{#if ONE_SHOT_MODE}}
699
1009
  a. If verdict is SUGGEST_IMPROVEMENTS:
700
1010
  - Log: "Artifact review suggests improvements: [summary]"
1011
+ {{#if SWARM_MODE}}
1012
+ - Re-invoke planner agent via headless `claude -p` with prompt: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
1013
+ {{else}}
701
1014
  - Re-invoke @agent-iloom-issue-planner with: "Apply these specific improvements to your existing comment (comment ID: [COMMENT_ID]): [REVIEWER_FEEDBACK]"
1015
+ {{/if}}
702
1016
  - After update, proceed to next step (do not re-review)
703
1017
  b. If verdict is RECOMMEND_REGENERATION:
704
1018
  - Log: "Artifact review recommends regeneration: [summary]"
1019
+ {{#if SWARM_MODE}}
1020
+ - Re-run planner agent via headless `claude -p` from scratch with the reviewer's feedback, return to step 2
1021
+ {{else}}
705
1022
  - Re-run @agent-iloom-issue-planner from scratch with the reviewer's feedback, return to step 2
1023
+ {{/if}}
706
1024
  {{else}}
707
1025
  a. Present review findings to user
708
1026
  b. Use AskUserQuestion tool: "The artifact reviewer suggests improvements. How would you like to proceed?"
@@ -714,6 +1032,7 @@ Only execute if workflow plan determined NEEDS_PLANNING AND complexity is COMPLE
714
1032
  {{/if}}
715
1033
  {{/if}}
716
1034
  3. Mark todos #13, #14, and #15 as completed (todos #9-12 were already marked at routing decision point and analysis phase)
1035
+ {{#unless SWARM_MODE}}
717
1036
  4. Use AskUserQuestion tool with a single question:
718
1037
  - Question: "Planning complete. See implementation plan at: [issue comment URL]. How would you like to proceed?"
719
1038
  - Options:
@@ -724,6 +1043,7 @@ Only execute if workflow plan determined NEEDS_PLANNING AND complexity is COMPLE
724
1043
  - If user chooses "Provide feedback on plan": Process their input and re-run planning if needed, telling the agent to edit their comment and provide the comment id
725
1044
  - If user chooses "Exit workflow": End workflow gracefully
726
1045
  - If user chooses "Continue to implementation": Proceed to STEP 4 (Implementation Phase)
1046
+ {{/unless}}
727
1047
 
728
1048
  If workflow plan determined SKIP_PLANNING AND complexity is COMPLEX:
729
1049
  1. Mark todos #13, #14, and #15 as completed (todos #9-12 were already marked at routing decision point and analysis phase)
@@ -748,7 +1068,11 @@ Only execute if workflow plan determined NEEDS_IMPLEMENTATION:
748
1068
  - [ ] Implementation in progress...
749
1069
  ```
750
1070
  - Store the comment ID
1071
+ {{#if SWARM_MODE}}
1072
+ - Call `mcp__recap__add_artifact` to log the comment (include `worktreePath: "<your-worktree-path>"`)
1073
+ {{else}}
751
1074
  - Call `mcp__recap__add_artifact` to log the comment
1075
+ {{/if}}
752
1076
 
753
1077
  3. **Execute implementation:**
754
1078
 
@@ -760,6 +1084,18 @@ Only execute if workflow plan determined NEEDS_IMPLEMENTATION:
760
1084
 
761
1085
  **CRITICAL: Do NOT pass the entire execution plan to one implementer.**
762
1086
 
1087
+ {{#if SWARM_MODE}}
1088
+ **If line says "Run Step N" (sequential):**
1089
+ - Execute implementer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "You are implementing Step N of the plan in comment [COMMENT_ID] on issue #ISSUE_NUMBER. DO NOT create your own issue comment."
1090
+ - Wait for completion
1091
+ - Update progress comment: `- [x] Step N: [name] - [brief result]`
1092
+
1093
+ **If line says "Run Steps X, Y, Z in parallel":**
1094
+ - Launch MULTIPLE `claude -p` processes in ONE Bash tool call (using `&` and `wait`) - one per step
1095
+ - Each with prompt: "You are implementing Step N of the plan in comment [COMMENT_ID] on issue #ISSUE_NUMBER. DO NOT create your own issue comment."
1096
+ - Wait for ALL to complete
1097
+ - Update progress comment for all completed steps
1098
+ {{else}}
763
1099
  **If line says "Run Step N" (sequential):**
764
1100
  - Launch @agent-iloom-issue-implementer with: "You are implementing Step N. The plan is in comment [COMMENT_ID]. DO NOT create your own issue comment."
765
1101
  - Wait for completion
@@ -770,11 +1106,17 @@ Only execute if workflow plan determined NEEDS_IMPLEMENTATION:
770
1106
  - Each with: "You are implementing Step N. The plan is in comment [COMMENT_ID]. DO NOT create your own issue comment."
771
1107
  - Wait for ALL to complete
772
1108
  - Update progress comment for all completed steps
1109
+ {{/if}}
773
1110
 
774
1111
  **FOR SIMPLE/TRIVIAL workflows (single implementation run):**
775
1112
 
1113
+ {{#if SWARM_MODE}}
1114
+ - Execute ONE implementer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Implement the plan in comment [COMMENT_ID] for issue #ISSUE_NUMBER. DO NOT create your own issue comment."
1115
+ - Wait for completion
1116
+ {{else}}
776
1117
  - Launch ONE @agent-iloom-issue-implementer with: "The plan is in comment [COMMENT_ID]. DO NOT create your own issue comment."
777
1118
  - Wait for completion
1119
+ {{/if}}
778
1120
 
779
1121
  4. **Finalize the progress comment:**
780
1122
  - Update the progress comment to this format:
@@ -810,24 +1152,40 @@ Only execute if workflow plan determined NEEDS_IMPLEMENTATION:
810
1152
 
811
1153
  </details>
812
1154
  ```
1155
+ {{#if SWARM_MODE}}
1156
+ - Call `mcp__recap__add_artifact` again with the same `primaryUrl` but updated `description` reflecting the completed state and `worktreePath: "<your-worktree-path>"` (this replaces the original "in progress" artifact)
1157
+ {{else}}
813
1158
  - Call `mcp__recap__add_artifact` again with the same `primaryUrl` but updated `description` reflecting the completed state (this replaces the original "in progress" artifact)
1159
+ {{/if}}
814
1160
 
815
1161
  5. Mark todo #16 as completed
816
1162
  {{#if IMPLEMENTER_REVIEW_ENABLED}}
817
1163
  {{#if ARTIFACT_REVIEW_ENABLED}}
818
1164
  5.5. Artifact Review (Implementation):
819
1165
  - The implementer output should be reviewed for plan alignment before code review
1166
+ {{#if SWARM_MODE}}
1167
+ - Execute artifact reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Review this IMPLEMENTATION artifact for issue #{{ISSUE_NUMBER}}: [IMPLEMENTER_OUTPUT]. The plan it was executing: [PLAN_CONTENT]"
1168
+ {{else}}
820
1169
  - Invoke: @agent-iloom-artifact-reviewer with context: "Review this IMPLEMENTATION artifact for issue #{{ISSUE_NUMBER}}: [IMPLEMENTER_OUTPUT]. The plan it was executing: [PLAN_CONTENT]"
1170
+ {{/if}}
821
1171
  - Wait for review results
822
1172
  - If review suggests improvements:
823
1173
  {{#if ONE_SHOT_MODE}}
824
1174
  a. If verdict is SUGGEST_IMPROVEMENTS:
825
1175
  - Log: "Artifact review suggests improvements: [summary]"
1176
+ {{#if SWARM_MODE}}
1177
+ - Re-invoke implementer agent via headless `claude -p` with prompt: "Apply these specific improvements to address plan gaps: [REVIEWER_FEEDBACK]"
1178
+ {{else}}
826
1179
  - Re-invoke @agent-iloom-issue-implementer with: "Apply these specific improvements to address plan gaps: [REVIEWER_FEEDBACK]"
1180
+ {{/if}}
827
1181
  - After update, proceed to next step (do not re-review)
828
1182
  b. If verdict is RECOMMEND_REGENERATION:
829
1183
  - Log: "Artifact review recommends regeneration: [summary]"
1184
+ {{#if SWARM_MODE}}
1185
+ - Re-run implementer agent via headless `claude -p` from scratch with the reviewer's feedback
1186
+ {{else}}
830
1187
  - Re-run @agent-iloom-issue-implementer from scratch with the reviewer's feedback
1188
+ {{/if}}
831
1189
  {{else}}
832
1190
  a. Present review findings to user
833
1191
  b. Use AskUserQuestion tool: "The artifact reviewer found plan alignment issues. How would you like to proceed?"
@@ -850,10 +1208,18 @@ If workflow plan determined SKIP_IMPLEMENTATION:
850
1208
 
851
1209
  This section is about reviewing uncommitted code changes for quality, security, and compliance issues.
852
1210
 
1211
+ {{#if SWARM_MODE}}
1212
+ **State transition**: Before running review, call `recap.set_loom_state('code_review')` with `worktreePath: "<your-worktree-path>"`.
1213
+ {{/if}}
1214
+
853
1215
  {{#if REVIEW_ENABLED}}
854
1216
  **Auto-Run Mode**: Review automatically executes after implementation completes. No manual trigger needed.
855
1217
 
1218
+ {{#if SWARM_MODE}}
1219
+ 1. Execute code reviewer agent via headless `claude -p` (see "Invoking Phase Agents" above) with prompt: "Run code review."
1220
+ {{else}}
856
1221
  1. Execute: @agent-iloom-code-reviewer with prompt "Run code review." (foreground, no extra context)
1222
+ {{/if}}
857
1223
  2. Wait for review completion
858
1224
  3. If critical, high, or medium priority issues found:
859
1225
  {{#if ONE_SHOT_MODE}}
@@ -888,6 +1254,7 @@ This is NOT optional - if the reviewer requests Claude Local Review, it must be
888
1254
  5. Mark todos #17 and #18 as completed
889
1255
  6. Proceed to Post-Workflow Help
890
1256
 
1257
+ {{#unless SWARM_MODE}}
891
1258
  {{#if DRAFT_PR_MODE}}
892
1259
  {{#if AUTO_COMMIT_PUSH}}
893
1260
  ---
@@ -903,61 +1270,24 @@ This is NOT optional - if the reviewer requests Claude Local Review, it must be
903
1270
  - If no changes exist, skip to Post-Workflow Help
904
1271
  - If changes exist, proceed with commit
905
1272
 
906
- 2. **Check for placeholder commit on the branch:**
1273
+ 2. **Stage all changes:**
907
1274
  ```bash
908
- git log -1 --format=%s
1275
+ git add -A
909
1276
  ```
910
- - A commit is a **placeholder commit** ONLY if its message starts with `[iloom-placeholder]` OR `[iloom] Temporary`. This is the specific marker that iloom uses when creating placeholder commits to keep draft PRs open.
911
- - Do NOT treat other commit messages (like "initial", "draft", "wip", etc.) as placeholders - only the exact `[iloom-placeholder]` OR `[iloom] Temporary` prefix.
912
- - **IMPORTANT**: We must NOT remove the placeholder from remote first (that would close the PR). Instead, we fix locally then force push to atomically replace it.
913
-
914
- 3. **If PLACEHOLDER COMMIT detected:**
915
-
916
- a. **Reset the placeholder commit locally (keeps changes staged):**
917
- ```bash
918
- git reset --soft HEAD~1
919
- ```
920
- This undoes the placeholder commit but keeps all changes staged.
921
-
922
- b. **Stage any additional implementation changes:**
923
- ```bash
924
- git add -A
925
- ```
926
-
927
- c. **Create the real implementation commit:**
928
- - Generate a commit message summarizing the implementation work
929
- - Include reference to Issue #{{ISSUE_NUMBER}}
930
- - Format: `feat(issue-{{ISSUE_NUMBER}}): [summary of changes]`
931
- ```bash
932
- git commit -m "feat(issue-{{ISSUE_NUMBER}}): [generated summary]"
933
- ```
934
-
935
- d. **Force push to atomically replace the placeholder:**
936
- ```bash
937
- git push --force-with-lease {{GIT_REMOTE}} HEAD
938
- ```
939
- **NOTE**: `--force-with-lease` is safe here because we are replacing our own placeholder commit, not overwriting others' work. This atomically replaces the placeholder on the remote.
940
-
941
- 4. **If NO placeholder commit detected (normal case):**
942
-
943
- a. **Stage all changes:**
944
- ```bash
945
- git add -A
946
- ```
947
1277
 
948
- b. **Create commit with descriptive message:**
949
- - Generate a commit message summarizing the implementation work
950
- - Include reference to Issue #{{ISSUE_NUMBER}}
951
- - Format: `feat(issue-{{ISSUE_NUMBER}}): [summary of changes]`
952
- ```bash
953
- git commit -m "feat(issue-{{ISSUE_NUMBER}}): [generated summary]"
954
- ```
1278
+ 3. **Create commit with descriptive message:**
1279
+ - Generate a commit message summarizing the implementation work
1280
+ - Include reference to Issue #{{ISSUE_NUMBER}}
1281
+ - Format: `feat(issue-{{ISSUE_NUMBER}}): [summary of changes]`
1282
+ ```bash
1283
+ git commit -m "feat(issue-{{ISSUE_NUMBER}}): [generated summary]"
1284
+ ```
955
1285
 
956
- c. **Push to remote:**
957
- ```bash
958
- git push {{GIT_REMOTE}} HEAD
959
- ```
960
- **IMPORTANT**: Do NOT use `--force` or `--force-with-lease` for normal pushes. If the push fails due to non-fast-forward (rejected), stop and notify the user - they may need to pull remote changes first.
1286
+ 4. **Push with force-with-lease:**
1287
+ ```bash
1288
+ git push --force-with-lease {{GIT_REMOTE}} HEAD
1289
+ ```
1290
+ **NOTE**: `--force-with-lease` is always used in draft PR mode because the remote may have the placeholder commit (from `il start`) or previous force-pushed commits. This is safe because the branch is exclusively ours (created by `il start`).
961
1291
 
962
1292
  5. **Check for CI/CD and deployment URLs (after successful push):**
963
1293
 
@@ -990,7 +1320,6 @@ This is NOT optional - if the reviewer requests Claude Local Review, it must be
990
1320
  - If commit fails: Log error, inform user that manual commit is needed
991
1321
  - If push fails: Log error, inform user that manual push is needed (changes are still committed locally)
992
1322
  - Do NOT retry automatically - let user handle conflicts/issues manually
993
- - **Force push safety**: `--force-with-lease` is ONLY allowed for replacing placeholder commits on draft PRs (step 3d). Regular `--force` is still forbidden. For normal pushes (step 4c), if rejected, inform user and stop.
994
1323
 
995
1324
  7. **Notify completion:**
996
1325
  - Log: "Auto-commit and push complete. Changes pushed to draft PR #{{DRAFT_PR_NUMBER}}."
@@ -998,8 +1327,12 @@ This is NOT optional - if the reviewer requests Claude Local Review, it must be
998
1327
 
999
1328
  {{/if}}
1000
1329
  {{/if}}
1330
+ {{/unless}}
1001
1331
  ---
1002
1332
 
1333
+ {{#if SWARM_MODE}}
1334
+ **MANDATORY CHECKPOINT: You MUST complete the code review before committing. After review, stage and commit all changes with `git add -A && git commit -m "fixes {{ISSUE_PREFIX}}<issue-number>"` (using your issue number from invocation arguments). Then set state to `done` and report results.**
1335
+ {{else}}
1003
1336
  {{#if DRAFT_PR_MODE}}
1004
1337
  {{#if AUTO_COMMIT_PUSH}}
1005
1338
  **MANDATORY CHECKPOINT: You MUST complete STEP 5.5 - Auto-Commit and Push before proceeding below. Do NOT skip the auto-commit/push.**
@@ -1009,9 +1342,22 @@ This is NOT optional - if the reviewer requests Claude Local Review, it must be
1009
1342
  {{else}}
1010
1343
  **MANDATORY CHECKPOINT: You MUST complete STEP 5 - Review Phase before proceeding below. Do NOT skip the review.**
1011
1344
  {{/if}}
1345
+ {{/if}}
1012
1346
 
1013
1347
  ---
1014
1348
 
1349
+ {{#if SWARM_MODE}}
1350
+ ## Post-Workflow: Report to Orchestrator
1351
+
1352
+ After committing changes successfully:
1353
+ 1. Call `recap.set_loom_state('done')` with `worktreePath: "<your-worktree-path>"`
1354
+ 2. Return the structured Swarm Workflow Result (see format in preamble above)
1355
+
1356
+ If any step failed unrecoverably:
1357
+ 1. Call `recap.set_loom_state('failed')` with `worktreePath: "<your-worktree-path>"`
1358
+ 2. Return the structured result with status: `failed` and error details
1359
+ 3. Do NOT commit partial work
1360
+ {{else}}
1015
1361
  ## Post-Workflow Help
1016
1362
 
1017
1363
  After completing the implementation phase, tell the user:
@@ -1031,18 +1377,43 @@ When the user requests help, **YOU MUST USE subagents** to preserve your context
1031
1377
  | New features / complex changes | `@agent-iloom-issue-analyze-and-plan` → if approved, `@agent-iloom-issue-implementer` |
1032
1378
  | Deep questions (how/why something works) | `@agent-iloom-issue-analyzer` |
1033
1379
  | Out-of-scope requests | Ask user: help anyway, create new issue, or skip |
1380
+ | Epic decomposition / large task breakdown | Recommend `il plan <epic-number>` then `il start <epic-number>` (see below) |
1034
1381
  | Ready to wrap up | Show Wrapping Up Instructions (see below) |
1035
1382
 
1036
1383
  After handling each request, summarize what was done and confirm you're still available.
1037
1384
 
1038
1385
  Use `recap.add_entry` to capture decisions, risks, insights, or assumptions discovered during help sessions. Do not log status updates or task completions.
1039
1386
 
1387
+ ### Epic Decomposition
1388
+
1389
+ When an epic issue is created or the user wants to break a large task into child issues, recommend they run `il plan <epic-number>` to decompose the epic into child issues with dependency analysis, then `il start <epic-number>` to launch swarm mode for parallel implementation. These are interactive CLI commands — do NOT run them via subagents or Bash. Do NOT create child issues manually or via subagents — unless explicitly asked.
1390
+ {{/if}}
1391
+
1040
1392
  ---
1041
1393
 
1394
+ {{#unless SWARM_MODE}}
1042
1395
  ## Wrapping Up Instructions
1043
1396
 
1044
1397
  When the user says they're done or ready to wrap up, provide these instructions:
1045
1398
 
1399
+ {{#if IS_VSCODE_MODE}}
1400
+ "## Wrapping Up
1401
+
1402
+ To complete the workflow and merge your changes:
1403
+
1404
+ 1. In the iloom Explorer panel, click the **Finish** flag on this loom
1405
+
1406
+ This will automatically detect the current issue and:
1407
+ - Stop any running web servers for this issue
1408
+ - Merge your changes back to the main branch
1409
+ - Clean up the worktree
1410
+ - Delete the database branch (if applicable)
1411
+ - Remove the workspace
1412
+
1413
+ Alternatively, you can exit this Claude session (type `/exit`) and run `iloom finish` from the terminal.
1414
+
1415
+ 2. Once the finish process completes, you can close any IDE windows that were opened specifically for this issue"
1416
+ {{else}}
1046
1417
  "## Wrapping Up
1047
1418
 
1048
1419
  To complete the workflow and merge your changes:
@@ -1060,4 +1431,6 @@ This will automatically detect the current issue and:
1060
1431
  - Delete the database branch (if applicable)
1061
1432
  - Remove the workspace
1062
1433
 
1063
- 3. Once the finish command completes, you can close any terminal or IDE windows that were opened specifically for this issue"
1434
+ 3. Once the finish command completes, you can close any terminal or IDE windows that were opened specifically for this issue"
1435
+ {{/if}}
1436
+ {{/unless}}