@cluesmith/codev 2.0.0-rc.7 → 2.0.0-rc.70

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 (456) hide show
  1. package/bin/af.js +2 -2
  2. package/bin/consult.js +1 -1
  3. package/bin/porch.js +6 -35
  4. package/dashboard/dist/assets/index-C7FtNK6Y.css +32 -0
  5. package/dashboard/dist/assets/index-CDAINZKT.js +131 -0
  6. package/dashboard/dist/assets/index-CDAINZKT.js.map +1 -0
  7. package/dashboard/dist/index.html +14 -0
  8. package/dist/agent-farm/cli.d.ts.map +1 -1
  9. package/dist/agent-farm/cli.js +173 -118
  10. package/dist/agent-farm/cli.js.map +1 -1
  11. package/dist/agent-farm/commands/architect.d.ts +3 -3
  12. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  13. package/dist/agent-farm/commands/architect.js +20 -147
  14. package/dist/agent-farm/commands/architect.js.map +1 -1
  15. package/dist/agent-farm/commands/attach.d.ts +13 -0
  16. package/dist/agent-farm/commands/attach.d.ts.map +1 -0
  17. package/dist/agent-farm/commands/attach.js +144 -0
  18. package/dist/agent-farm/commands/attach.js.map +1 -0
  19. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  20. package/dist/agent-farm/commands/cleanup.js +35 -19
  21. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  22. package/dist/agent-farm/commands/consult.d.ts +3 -4
  23. package/dist/agent-farm/commands/consult.d.ts.map +1 -1
  24. package/dist/agent-farm/commands/consult.js +27 -37
  25. package/dist/agent-farm/commands/consult.js.map +1 -1
  26. package/dist/agent-farm/commands/index.d.ts +2 -2
  27. package/dist/agent-farm/commands/index.d.ts.map +1 -1
  28. package/dist/agent-farm/commands/index.js +2 -2
  29. package/dist/agent-farm/commands/index.js.map +1 -1
  30. package/dist/agent-farm/commands/open.d.ts +4 -2
  31. package/dist/agent-farm/commands/open.d.ts.map +1 -1
  32. package/dist/agent-farm/commands/open.js +33 -83
  33. package/dist/agent-farm/commands/open.js.map +1 -1
  34. package/dist/agent-farm/commands/send.d.ts +1 -1
  35. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  36. package/dist/agent-farm/commands/send.js +60 -79
  37. package/dist/agent-farm/commands/send.js.map +1 -1
  38. package/dist/agent-farm/commands/shell.d.ts +15 -0
  39. package/dist/agent-farm/commands/shell.d.ts.map +1 -0
  40. package/dist/agent-farm/commands/shell.js +50 -0
  41. package/dist/agent-farm/commands/shell.js.map +1 -0
  42. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  43. package/dist/agent-farm/commands/spawn.js +597 -281
  44. package/dist/agent-farm/commands/spawn.js.map +1 -1
  45. package/dist/agent-farm/commands/start.d.ts +10 -20
  46. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  47. package/dist/agent-farm/commands/start.js +45 -491
  48. package/dist/agent-farm/commands/start.js.map +1 -1
  49. package/dist/agent-farm/commands/status.d.ts +2 -0
  50. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/status.js +75 -24
  52. package/dist/agent-farm/commands/status.js.map +1 -1
  53. package/dist/agent-farm/commands/stop.d.ts +6 -0
  54. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  55. package/dist/agent-farm/commands/stop.js +49 -109
  56. package/dist/agent-farm/commands/stop.js.map +1 -1
  57. package/dist/agent-farm/commands/tower-cloud.d.ts +48 -0
  58. package/dist/agent-farm/commands/tower-cloud.d.ts.map +1 -0
  59. package/dist/agent-farm/commands/tower-cloud.js +334 -0
  60. package/dist/agent-farm/commands/tower-cloud.js.map +1 -0
  61. package/dist/agent-farm/commands/tower.d.ts +9 -0
  62. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  63. package/dist/agent-farm/commands/tower.js +59 -19
  64. package/dist/agent-farm/commands/tower.js.map +1 -1
  65. package/dist/agent-farm/db/index.d.ts +6 -2
  66. package/dist/agent-farm/db/index.d.ts.map +1 -1
  67. package/dist/agent-farm/db/index.js +246 -18
  68. package/dist/agent-farm/db/index.js.map +1 -1
  69. package/dist/agent-farm/db/migrate.d.ts +0 -4
  70. package/dist/agent-farm/db/migrate.d.ts.map +1 -1
  71. package/dist/agent-farm/db/migrate.js +6 -55
  72. package/dist/agent-farm/db/migrate.js.map +1 -1
  73. package/dist/agent-farm/db/schema.d.ts +3 -3
  74. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  75. package/dist/agent-farm/db/schema.js +25 -19
  76. package/dist/agent-farm/db/schema.js.map +1 -1
  77. package/dist/agent-farm/db/types.d.ts +3 -13
  78. package/dist/agent-farm/db/types.d.ts.map +1 -1
  79. package/dist/agent-farm/db/types.js +3 -11
  80. package/dist/agent-farm/db/types.js.map +1 -1
  81. package/dist/agent-farm/hq-connector.d.ts +2 -6
  82. package/dist/agent-farm/hq-connector.d.ts.map +1 -1
  83. package/dist/agent-farm/hq-connector.js +2 -17
  84. package/dist/agent-farm/hq-connector.js.map +1 -1
  85. package/dist/agent-farm/lib/cloud-config.d.ts +59 -0
  86. package/dist/agent-farm/lib/cloud-config.d.ts.map +1 -0
  87. package/dist/agent-farm/lib/cloud-config.js +143 -0
  88. package/dist/agent-farm/lib/cloud-config.js.map +1 -0
  89. package/dist/agent-farm/lib/tower-client.d.ts +163 -0
  90. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -0
  91. package/dist/agent-farm/lib/tower-client.js +233 -0
  92. package/dist/agent-farm/lib/tower-client.js.map +1 -0
  93. package/dist/agent-farm/lib/tunnel-client.d.ts +117 -0
  94. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -0
  95. package/dist/agent-farm/lib/tunnel-client.js +504 -0
  96. package/dist/agent-farm/lib/tunnel-client.js.map +1 -0
  97. package/dist/agent-farm/servers/tower-server.js +2650 -185
  98. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  99. package/dist/agent-farm/state.d.ts +6 -12
  100. package/dist/agent-farm/state.d.ts.map +1 -1
  101. package/dist/agent-farm/state.js +34 -49
  102. package/dist/agent-farm/state.js.map +1 -1
  103. package/dist/agent-farm/types.d.ts +49 -26
  104. package/dist/agent-farm/types.d.ts.map +1 -1
  105. package/dist/agent-farm/utils/config.d.ts +0 -5
  106. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  107. package/dist/agent-farm/utils/config.js +12 -44
  108. package/dist/agent-farm/utils/config.js.map +1 -1
  109. package/dist/agent-farm/utils/deps.d.ts.map +1 -1
  110. package/dist/agent-farm/utils/deps.js +0 -32
  111. package/dist/agent-farm/utils/deps.js.map +1 -1
  112. package/dist/agent-farm/utils/file-tabs.d.ts +27 -0
  113. package/dist/agent-farm/utils/file-tabs.d.ts.map +1 -0
  114. package/dist/agent-farm/utils/file-tabs.js +46 -0
  115. package/dist/agent-farm/utils/file-tabs.js.map +1 -0
  116. package/dist/agent-farm/utils/gate-status.d.ts +16 -0
  117. package/dist/agent-farm/utils/gate-status.d.ts.map +1 -0
  118. package/dist/agent-farm/utils/gate-status.js +79 -0
  119. package/dist/agent-farm/utils/gate-status.js.map +1 -0
  120. package/dist/agent-farm/utils/gate-watcher.d.ts +38 -0
  121. package/dist/agent-farm/utils/gate-watcher.d.ts.map +1 -0
  122. package/dist/agent-farm/utils/gate-watcher.js +122 -0
  123. package/dist/agent-farm/utils/gate-watcher.js.map +1 -0
  124. package/dist/agent-farm/utils/index.d.ts +0 -1
  125. package/dist/agent-farm/utils/index.d.ts.map +1 -1
  126. package/dist/agent-farm/utils/index.js +0 -1
  127. package/dist/agent-farm/utils/index.js.map +1 -1
  128. package/dist/agent-farm/utils/notifications.d.ts +30 -0
  129. package/dist/agent-farm/utils/notifications.d.ts.map +1 -0
  130. package/dist/agent-farm/utils/notifications.js +121 -0
  131. package/dist/agent-farm/utils/notifications.js.map +1 -0
  132. package/dist/agent-farm/utils/server-utils.d.ts +5 -5
  133. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  134. package/dist/agent-farm/utils/server-utils.js +5 -16
  135. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  136. package/dist/agent-farm/utils/session.d.ts +32 -0
  137. package/dist/agent-farm/utils/session.d.ts.map +1 -0
  138. package/dist/agent-farm/utils/session.js +57 -0
  139. package/dist/agent-farm/utils/session.js.map +1 -0
  140. package/dist/agent-farm/utils/shell.d.ts +9 -22
  141. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  142. package/dist/agent-farm/utils/shell.js +34 -34
  143. package/dist/agent-farm/utils/shell.js.map +1 -1
  144. package/dist/cli.d.ts.map +1 -1
  145. package/dist/cli.js +11 -54
  146. package/dist/cli.js.map +1 -1
  147. package/dist/commands/adopt.d.ts.map +1 -1
  148. package/dist/commands/adopt.js +49 -4
  149. package/dist/commands/adopt.js.map +1 -1
  150. package/dist/commands/consult/index.d.ts +13 -2
  151. package/dist/commands/consult/index.d.ts.map +1 -1
  152. package/dist/commands/consult/index.js +245 -29
  153. package/dist/commands/consult/index.js.map +1 -1
  154. package/dist/commands/doctor.d.ts.map +1 -1
  155. package/dist/commands/doctor.js +96 -79
  156. package/dist/commands/doctor.js.map +1 -1
  157. package/dist/commands/init.d.ts.map +1 -1
  158. package/dist/commands/init.js +41 -2
  159. package/dist/commands/init.js.map +1 -1
  160. package/dist/commands/porch/build-counter.d.ts +5 -0
  161. package/dist/commands/porch/build-counter.d.ts.map +1 -0
  162. package/dist/commands/porch/build-counter.js +5 -0
  163. package/dist/commands/porch/build-counter.js.map +1 -0
  164. package/dist/commands/porch/checks.d.ts +17 -29
  165. package/dist/commands/porch/checks.d.ts.map +1 -1
  166. package/dist/commands/porch/checks.js +96 -144
  167. package/dist/commands/porch/checks.js.map +1 -1
  168. package/dist/commands/porch/index.d.ts +25 -43
  169. package/dist/commands/porch/index.d.ts.map +1 -1
  170. package/dist/commands/porch/index.js +463 -1116
  171. package/dist/commands/porch/index.js.map +1 -1
  172. package/dist/commands/porch/next.d.ts +22 -0
  173. package/dist/commands/porch/next.d.ts.map +1 -0
  174. package/dist/commands/porch/next.js +571 -0
  175. package/dist/commands/porch/next.js.map +1 -0
  176. package/dist/commands/porch/plan.d.ts +70 -0
  177. package/dist/commands/porch/plan.d.ts.map +1 -0
  178. package/dist/commands/porch/plan.js +190 -0
  179. package/dist/commands/porch/plan.js.map +1 -0
  180. package/dist/commands/porch/prompts.d.ts +19 -0
  181. package/dist/commands/porch/prompts.d.ts.map +1 -0
  182. package/dist/commands/porch/prompts.js +277 -0
  183. package/dist/commands/porch/prompts.js.map +1 -0
  184. package/dist/commands/porch/protocol.d.ts +59 -0
  185. package/dist/commands/porch/protocol.d.ts.map +1 -0
  186. package/dist/commands/porch/protocol.js +294 -0
  187. package/dist/commands/porch/protocol.js.map +1 -0
  188. package/dist/commands/porch/state.d.ts +36 -107
  189. package/dist/commands/porch/state.d.ts.map +1 -1
  190. package/dist/commands/porch/state.js +120 -699
  191. package/dist/commands/porch/state.js.map +1 -1
  192. package/dist/commands/porch/types.d.ts +99 -164
  193. package/dist/commands/porch/types.d.ts.map +1 -1
  194. package/dist/commands/porch/types.js +2 -1
  195. package/dist/commands/porch/types.js.map +1 -1
  196. package/dist/commands/porch/verdict.d.ts +31 -0
  197. package/dist/commands/porch/verdict.d.ts.map +1 -0
  198. package/dist/commands/porch/verdict.js +59 -0
  199. package/dist/commands/porch/verdict.js.map +1 -0
  200. package/dist/commands/update.d.ts.map +1 -1
  201. package/dist/commands/update.js +31 -0
  202. package/dist/commands/update.js.map +1 -1
  203. package/dist/lib/scaffold.d.ts +37 -0
  204. package/dist/lib/scaffold.d.ts.map +1 -1
  205. package/dist/lib/scaffold.js +114 -0
  206. package/dist/lib/scaffold.js.map +1 -1
  207. package/dist/terminal/index.d.ts +8 -0
  208. package/dist/terminal/index.d.ts.map +1 -0
  209. package/dist/terminal/index.js +5 -0
  210. package/dist/terminal/index.js.map +1 -0
  211. package/dist/terminal/pty-manager.d.ts +69 -0
  212. package/dist/terminal/pty-manager.d.ts.map +1 -0
  213. package/dist/terminal/pty-manager.js +377 -0
  214. package/dist/terminal/pty-manager.js.map +1 -0
  215. package/dist/terminal/pty-session.d.ts +104 -0
  216. package/dist/terminal/pty-session.d.ts.map +1 -0
  217. package/dist/terminal/pty-session.js +327 -0
  218. package/dist/terminal/pty-session.js.map +1 -0
  219. package/dist/terminal/ring-buffer.d.ts +34 -0
  220. package/dist/terminal/ring-buffer.d.ts.map +1 -0
  221. package/dist/terminal/ring-buffer.js +94 -0
  222. package/dist/terminal/ring-buffer.js.map +1 -0
  223. package/dist/terminal/session-manager.d.ts +115 -0
  224. package/dist/terminal/session-manager.d.ts.map +1 -0
  225. package/dist/terminal/session-manager.js +582 -0
  226. package/dist/terminal/session-manager.js.map +1 -0
  227. package/dist/terminal/shepherd-client.d.ts +58 -0
  228. package/dist/terminal/shepherd-client.d.ts.map +1 -0
  229. package/dist/terminal/shepherd-client.js +212 -0
  230. package/dist/terminal/shepherd-client.js.map +1 -0
  231. package/dist/terminal/shepherd-main.d.ts +19 -0
  232. package/dist/terminal/shepherd-main.d.ts.map +1 -0
  233. package/dist/terminal/shepherd-main.js +153 -0
  234. package/dist/terminal/shepherd-main.js.map +1 -0
  235. package/dist/terminal/shepherd-process.d.ts +75 -0
  236. package/dist/terminal/shepherd-process.d.ts.map +1 -0
  237. package/dist/terminal/shepherd-process.js +279 -0
  238. package/dist/terminal/shepherd-process.js.map +1 -0
  239. package/dist/terminal/shepherd-protocol.d.ts +115 -0
  240. package/dist/terminal/shepherd-protocol.d.ts.map +1 -0
  241. package/dist/terminal/shepherd-protocol.js +214 -0
  242. package/dist/terminal/shepherd-protocol.js.map +1 -0
  243. package/dist/terminal/shepherd-replay-buffer.d.ts +38 -0
  244. package/dist/terminal/shepherd-replay-buffer.d.ts.map +1 -0
  245. package/dist/terminal/shepherd-replay-buffer.js +94 -0
  246. package/dist/terminal/shepherd-replay-buffer.js.map +1 -0
  247. package/dist/terminal/ws-protocol.d.ts +27 -0
  248. package/dist/terminal/ws-protocol.d.ts.map +1 -0
  249. package/dist/terminal/ws-protocol.js +44 -0
  250. package/dist/terminal/ws-protocol.js.map +1 -0
  251. package/package.json +19 -5
  252. package/skeleton/.claude/skills/af/SKILL.md +89 -0
  253. package/skeleton/.claude/skills/codev/SKILL.md +41 -0
  254. package/skeleton/.claude/skills/consult/SKILL.md +81 -0
  255. package/skeleton/.claude/skills/generate-image/SKILL.md +56 -0
  256. package/skeleton/DEPENDENCIES.md +4 -62
  257. package/skeleton/builders.md +1 -1
  258. package/skeleton/consult-types/impl-review.md +18 -9
  259. package/skeleton/consult-types/integration-review.md +1 -1
  260. package/skeleton/consult-types/plan-review.md +1 -1
  261. package/skeleton/consult-types/pr-ready.md +1 -1
  262. package/skeleton/consult-types/spec-review.md +1 -1
  263. package/skeleton/porch/prompts/defend.md +1 -1
  264. package/skeleton/porch/prompts/evaluate.md +2 -2
  265. package/skeleton/porch/prompts/implement.md +1 -1
  266. package/skeleton/porch/prompts/plan.md +1 -1
  267. package/skeleton/porch/prompts/review.md +4 -4
  268. package/skeleton/porch/prompts/specify.md +1 -1
  269. package/skeleton/porch/prompts/understand.md +2 -2
  270. package/skeleton/protocol-schema.json +282 -0
  271. package/skeleton/protocols/bugfix/builder-prompt.md +54 -0
  272. package/skeleton/protocols/bugfix/prompts/fix.md +77 -0
  273. package/skeleton/protocols/bugfix/prompts/investigate.md +77 -0
  274. package/skeleton/protocols/bugfix/prompts/pr.md +84 -0
  275. package/skeleton/protocols/bugfix/protocol.json +20 -33
  276. package/skeleton/protocols/experiment/builder-prompt.md +52 -0
  277. package/skeleton/protocols/experiment/protocol.json +101 -0
  278. package/skeleton/protocols/experiment/protocol.md +3 -3
  279. package/skeleton/protocols/experiment/templates/notes.md +1 -1
  280. package/skeleton/protocols/maintain/builder-prompt.md +46 -0
  281. package/skeleton/protocols/maintain/prompts/audit.md +111 -0
  282. package/skeleton/protocols/maintain/prompts/clean.md +91 -0
  283. package/skeleton/protocols/maintain/prompts/sync.md +113 -0
  284. package/skeleton/protocols/maintain/prompts/verify.md +110 -0
  285. package/skeleton/protocols/maintain/protocol.json +141 -0
  286. package/skeleton/protocols/maintain/protocol.md +17 -11
  287. package/skeleton/protocols/protocol-schema.json +54 -1
  288. package/skeleton/protocols/spir/builder-prompt.md +59 -0
  289. package/skeleton/protocols/spir/prompts/implement.md +208 -0
  290. package/skeleton/protocols/{spider → spir}/prompts/plan.md +6 -70
  291. package/skeleton/protocols/{spider → spir}/prompts/review.md +20 -39
  292. package/skeleton/protocols/{spider → spir}/prompts/specify.md +33 -61
  293. package/skeleton/protocols/spir/protocol.json +156 -0
  294. package/skeleton/protocols/{spider → spir}/protocol.md +35 -21
  295. package/skeleton/protocols/{spider → spir}/templates/plan.md +14 -0
  296. package/skeleton/protocols/spir/templates/review.md +89 -0
  297. package/skeleton/protocols/tick/builder-prompt.md +56 -0
  298. package/skeleton/protocols/tick/protocol.json +7 -2
  299. package/skeleton/protocols/tick/protocol.md +18 -18
  300. package/skeleton/protocols/tick/templates/review.md +1 -1
  301. package/skeleton/resources/commands/agent-farm.md +63 -46
  302. package/skeleton/resources/commands/codev.md +0 -2
  303. package/skeleton/resources/commands/overview.md +7 -17
  304. package/skeleton/resources/workflow-reference.md +4 -4
  305. package/skeleton/roles/architect.md +152 -315
  306. package/skeleton/roles/builder.md +110 -218
  307. package/skeleton/roles/consultant.md +6 -6
  308. package/skeleton/templates/AGENTS.md +2 -2
  309. package/skeleton/templates/CLAUDE.md +2 -2
  310. package/skeleton/templates/cheatsheet.md +7 -5
  311. package/skeleton/templates/projectlist.md +1 -1
  312. package/templates/dashboard/index.html +17 -43
  313. package/templates/dashboard/js/dialogs.js +7 -7
  314. package/templates/dashboard/js/files.js +2 -2
  315. package/templates/dashboard/js/main.js +4 -4
  316. package/templates/dashboard/js/projects.js +3 -3
  317. package/templates/dashboard/js/tabs.js +1 -1
  318. package/templates/dashboard/js/utils.js +22 -87
  319. package/templates/open.html +26 -0
  320. package/templates/tower.html +642 -36
  321. package/dist/agent-farm/commands/kickoff.d.ts +0 -20
  322. package/dist/agent-farm/commands/kickoff.d.ts.map +0 -1
  323. package/dist/agent-farm/commands/kickoff.js +0 -337
  324. package/dist/agent-farm/commands/kickoff.js.map +0 -1
  325. package/dist/agent-farm/commands/rename.d.ts +0 -13
  326. package/dist/agent-farm/commands/rename.d.ts.map +0 -1
  327. package/dist/agent-farm/commands/rename.js +0 -33
  328. package/dist/agent-farm/commands/rename.js.map +0 -1
  329. package/dist/agent-farm/commands/tutorial.d.ts +0 -10
  330. package/dist/agent-farm/commands/tutorial.d.ts.map +0 -1
  331. package/dist/agent-farm/commands/tutorial.js +0 -49
  332. package/dist/agent-farm/commands/tutorial.js.map +0 -1
  333. package/dist/agent-farm/commands/util.d.ts +0 -15
  334. package/dist/agent-farm/commands/util.d.ts.map +0 -1
  335. package/dist/agent-farm/commands/util.js +0 -108
  336. package/dist/agent-farm/commands/util.js.map +0 -1
  337. package/dist/agent-farm/servers/dashboard-server.d.ts +0 -7
  338. package/dist/agent-farm/servers/dashboard-server.d.ts.map +0 -1
  339. package/dist/agent-farm/servers/dashboard-server.js +0 -1872
  340. package/dist/agent-farm/servers/dashboard-server.js.map +0 -1
  341. package/dist/agent-farm/servers/open-server.d.ts +0 -7
  342. package/dist/agent-farm/servers/open-server.d.ts.map +0 -1
  343. package/dist/agent-farm/servers/open-server.js +0 -315
  344. package/dist/agent-farm/servers/open-server.js.map +0 -1
  345. package/dist/agent-farm/tutorial/index.d.ts +0 -8
  346. package/dist/agent-farm/tutorial/index.d.ts.map +0 -1
  347. package/dist/agent-farm/tutorial/index.js +0 -8
  348. package/dist/agent-farm/tutorial/index.js.map +0 -1
  349. package/dist/agent-farm/tutorial/prompts.d.ts +0 -57
  350. package/dist/agent-farm/tutorial/prompts.d.ts.map +0 -1
  351. package/dist/agent-farm/tutorial/prompts.js +0 -147
  352. package/dist/agent-farm/tutorial/prompts.js.map +0 -1
  353. package/dist/agent-farm/tutorial/runner.d.ts +0 -52
  354. package/dist/agent-farm/tutorial/runner.d.ts.map +0 -1
  355. package/dist/agent-farm/tutorial/runner.js +0 -204
  356. package/dist/agent-farm/tutorial/runner.js.map +0 -1
  357. package/dist/agent-farm/tutorial/state.d.ts +0 -26
  358. package/dist/agent-farm/tutorial/state.d.ts.map +0 -1
  359. package/dist/agent-farm/tutorial/state.js +0 -89
  360. package/dist/agent-farm/tutorial/state.js.map +0 -1
  361. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +0 -7
  362. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +0 -1
  363. package/dist/agent-farm/tutorial/steps/first-spec.js +0 -136
  364. package/dist/agent-farm/tutorial/steps/first-spec.js.map +0 -1
  365. package/dist/agent-farm/tutorial/steps/implementation.d.ts +0 -7
  366. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +0 -1
  367. package/dist/agent-farm/tutorial/steps/implementation.js +0 -76
  368. package/dist/agent-farm/tutorial/steps/implementation.js.map +0 -1
  369. package/dist/agent-farm/tutorial/steps/index.d.ts +0 -10
  370. package/dist/agent-farm/tutorial/steps/index.d.ts.map +0 -1
  371. package/dist/agent-farm/tutorial/steps/index.js +0 -10
  372. package/dist/agent-farm/tutorial/steps/index.js.map +0 -1
  373. package/dist/agent-farm/tutorial/steps/planning.d.ts +0 -7
  374. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +0 -1
  375. package/dist/agent-farm/tutorial/steps/planning.js +0 -143
  376. package/dist/agent-farm/tutorial/steps/planning.js.map +0 -1
  377. package/dist/agent-farm/tutorial/steps/review.d.ts +0 -7
  378. package/dist/agent-farm/tutorial/steps/review.d.ts.map +0 -1
  379. package/dist/agent-farm/tutorial/steps/review.js +0 -78
  380. package/dist/agent-farm/tutorial/steps/review.js.map +0 -1
  381. package/dist/agent-farm/tutorial/steps/setup.d.ts +0 -7
  382. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +0 -1
  383. package/dist/agent-farm/tutorial/steps/setup.js +0 -126
  384. package/dist/agent-farm/tutorial/steps/setup.js.map +0 -1
  385. package/dist/agent-farm/tutorial/steps/welcome.d.ts +0 -7
  386. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +0 -1
  387. package/dist/agent-farm/tutorial/steps/welcome.js +0 -50
  388. package/dist/agent-farm/tutorial/steps/welcome.js.map +0 -1
  389. package/dist/agent-farm/utils/orphan-handler.d.ts +0 -27
  390. package/dist/agent-farm/utils/orphan-handler.d.ts.map +0 -1
  391. package/dist/agent-farm/utils/orphan-handler.js +0 -149
  392. package/dist/agent-farm/utils/orphan-handler.js.map +0 -1
  393. package/dist/agent-farm/utils/port-registry.d.ts +0 -58
  394. package/dist/agent-farm/utils/port-registry.d.ts.map +0 -1
  395. package/dist/agent-farm/utils/port-registry.js +0 -166
  396. package/dist/agent-farm/utils/port-registry.js.map +0 -1
  397. package/dist/agent-farm/utils/terminal-ports.d.ts +0 -18
  398. package/dist/agent-farm/utils/terminal-ports.d.ts.map +0 -1
  399. package/dist/agent-farm/utils/terminal-ports.js +0 -35
  400. package/dist/agent-farm/utils/terminal-ports.js.map +0 -1
  401. package/dist/commands/pcheck/cache.d.ts +0 -48
  402. package/dist/commands/pcheck/cache.d.ts.map +0 -1
  403. package/dist/commands/pcheck/cache.js +0 -170
  404. package/dist/commands/pcheck/cache.js.map +0 -1
  405. package/dist/commands/pcheck/evaluator.d.ts +0 -15
  406. package/dist/commands/pcheck/evaluator.d.ts.map +0 -1
  407. package/dist/commands/pcheck/evaluator.js +0 -246
  408. package/dist/commands/pcheck/evaluator.js.map +0 -1
  409. package/dist/commands/pcheck/index.d.ts +0 -12
  410. package/dist/commands/pcheck/index.d.ts.map +0 -1
  411. package/dist/commands/pcheck/index.js +0 -249
  412. package/dist/commands/pcheck/index.js.map +0 -1
  413. package/dist/commands/pcheck/parser.d.ts +0 -39
  414. package/dist/commands/pcheck/parser.d.ts.map +0 -1
  415. package/dist/commands/pcheck/parser.js +0 -155
  416. package/dist/commands/pcheck/parser.js.map +0 -1
  417. package/dist/commands/pcheck/types.d.ts +0 -82
  418. package/dist/commands/pcheck/types.d.ts.map +0 -1
  419. package/dist/commands/pcheck/types.js +0 -5
  420. package/dist/commands/pcheck/types.js.map +0 -1
  421. package/dist/commands/porch/consultation.d.ts +0 -56
  422. package/dist/commands/porch/consultation.d.ts.map +0 -1
  423. package/dist/commands/porch/consultation.js +0 -330
  424. package/dist/commands/porch/consultation.js.map +0 -1
  425. package/dist/commands/porch/notifications.d.ts +0 -99
  426. package/dist/commands/porch/notifications.d.ts.map +0 -1
  427. package/dist/commands/porch/notifications.js +0 -223
  428. package/dist/commands/porch/notifications.js.map +0 -1
  429. package/dist/commands/porch/plan-parser.d.ts +0 -38
  430. package/dist/commands/porch/plan-parser.d.ts.map +0 -1
  431. package/dist/commands/porch/plan-parser.js +0 -166
  432. package/dist/commands/porch/plan-parser.js.map +0 -1
  433. package/dist/commands/porch/protocol-loader.d.ts +0 -46
  434. package/dist/commands/porch/protocol-loader.d.ts.map +0 -1
  435. package/dist/commands/porch/protocol-loader.js +0 -253
  436. package/dist/commands/porch/protocol-loader.js.map +0 -1
  437. package/dist/commands/porch/signal-parser.d.ts +0 -88
  438. package/dist/commands/porch/signal-parser.d.ts.map +0 -1
  439. package/dist/commands/porch/signal-parser.js +0 -148
  440. package/dist/commands/porch/signal-parser.js.map +0 -1
  441. package/dist/commands/tower.d.ts +0 -16
  442. package/dist/commands/tower.d.ts.map +0 -1
  443. package/dist/commands/tower.js +0 -21
  444. package/dist/commands/tower.js.map +0 -1
  445. package/skeleton/config.json +0 -7
  446. package/skeleton/porch/protocols/bugfix.json +0 -85
  447. package/skeleton/porch/protocols/spider.json +0 -135
  448. package/skeleton/porch/protocols/tick.json +0 -76
  449. package/skeleton/protocols/spider/prompts/defend.md +0 -215
  450. package/skeleton/protocols/spider/prompts/evaluate.md +0 -241
  451. package/skeleton/protocols/spider/prompts/implement.md +0 -149
  452. package/skeleton/protocols/spider/protocol.json +0 -210
  453. package/skeleton/protocols/spider/templates/review.md +0 -207
  454. package/templates/dashboard/css/activity.css +0 -151
  455. package/templates/dashboard/js/activity.js +0 -112
  456. /package/skeleton/protocols/{spider → spir}/templates/spec.md +0 -0
@@ -0,0 +1,77 @@
1
+ # INVESTIGATE Phase Prompt
2
+
3
+ You are executing the **INVESTIGATE** phase of the BUGFIX protocol.
4
+
5
+ ## Your Goal
6
+
7
+ Understand the bug, reproduce it, identify the root cause, and assess whether it's fixable within BUGFIX scope (< 300 LOC).
8
+
9
+ ## Context
10
+
11
+ - **Issue**: #{{issue.number}} — {{issue.title}}
12
+ - **Current State**: {{current_state}}
13
+
14
+ ## Process
15
+
16
+ ### 1. Read the Issue
17
+
18
+ Read the full issue description. Identify:
19
+ - What is the expected behavior?
20
+ - What is the actual behavior?
21
+ - Are there reproduction steps?
22
+ - Are there error messages or screenshots?
23
+
24
+ ### 2. Reproduce the Bug
25
+
26
+ Before fixing anything, confirm the bug exists:
27
+ - Follow the reproduction steps from the issue
28
+ - If no steps are given, infer them from the description
29
+ - Document the exact reproduction steps you used
30
+ - If you **cannot** reproduce, signal `BLOCKED` with details
31
+
32
+ ### 3. Identify Root Cause
33
+
34
+ Trace the bug to its source:
35
+ - Read the relevant code paths
36
+ - Use grep/search to find related code
37
+ - Identify the exact file(s) and line(s) causing the issue
38
+ - Understand **why** the bug occurs, not just **where**
39
+
40
+ ### 4. Assess Complexity
41
+
42
+ Determine if this is BUGFIX-appropriate:
43
+ - **< 300 LOC change**: Proceed with BUGFIX
44
+ - **> 300 LOC or architectural**: Signal `TOO_COMPLEX` to escalate
45
+
46
+ Consider:
47
+ - How many files need to change?
48
+ - Does it require new abstractions or refactoring?
49
+ - Are there cascading effects?
50
+
51
+ ## Output
52
+
53
+ By the end of this phase, you should know:
54
+ 1. The exact root cause
55
+ 2. Which files need to change
56
+ 3. The approximate size of the fix
57
+ 4. Whether it's BUGFIX-appropriate
58
+
59
+ ## Signals
60
+
61
+ When investigation is complete:
62
+
63
+ ```
64
+ <signal>PHASE_COMPLETE</signal>
65
+ ```
66
+
67
+ If the bug is too complex for BUGFIX:
68
+
69
+ ```
70
+ <signal>TOO_COMPLEX</signal>
71
+ ```
72
+
73
+ If you're blocked (can't reproduce, missing context, etc.):
74
+
75
+ ```
76
+ <signal>BLOCKED:reason goes here</signal>
77
+ ```
@@ -0,0 +1,84 @@
1
+ # PR Phase Prompt
2
+
3
+ You are executing the **PR** phase of the BUGFIX protocol.
4
+
5
+ ## Your Goal
6
+
7
+ Create a pull request, run CMAP review, and address feedback.
8
+
9
+ ## Context
10
+
11
+ - **Issue**: #{{issue.number}} — {{issue.title}}
12
+ - **Current State**: {{current_state}}
13
+
14
+ ## Process
15
+
16
+ ### 1. Create the Pull Request
17
+
18
+ Create a PR that links to the issue:
19
+
20
+ ```bash
21
+ gh pr create --title "Fix #{{issue.number}}: <brief description>" --body "$(cat <<'EOF'
22
+ ## Summary
23
+
24
+ <1-2 sentence description of the bug and fix>
25
+
26
+ Fixes #{{issue.number}}
27
+
28
+ ## Root Cause
29
+
30
+ <Brief explanation of why the bug occurred>
31
+
32
+ ## Fix
33
+
34
+ <Brief explanation of what was changed>
35
+
36
+ ## Test Plan
37
+
38
+ - [ ] Regression test added
39
+ - [ ] Build passes
40
+ - [ ] All tests pass
41
+ EOF
42
+ )"
43
+ ```
44
+
45
+ ### 2. Run CMAP Review
46
+
47
+ Run 3-way parallel consultation on the PR:
48
+
49
+ ```bash
50
+ consult --model gemini pr <PR_NUMBER> &
51
+ consult --model codex pr <PR_NUMBER> &
52
+ consult --model claude pr <PR_NUMBER> &
53
+ ```
54
+
55
+ All three should run in the background (`run_in_background: true`).
56
+
57
+ ### 3. Address Feedback
58
+
59
+ Review the consultation results:
60
+ - Fix any issues identified by reviewers
61
+ - Push updates to the PR branch
62
+ - Re-run CMAP if substantial changes were made
63
+
64
+ ### 4. Notify Architect
65
+
66
+ After CMAP review is complete and feedback is addressed, notify the architect:
67
+
68
+ ```bash
69
+ af send architect "PR #<number> ready for review (fixes issue #{{issue.number}})"
70
+ ```
71
+
72
+ ## Signals
73
+
74
+ When PR is created and reviews are complete:
75
+
76
+ ```
77
+ <signal>PHASE_COMPLETE</signal>
78
+ ```
79
+
80
+ If you're blocked:
81
+
82
+ ```
83
+ <signal>BLOCKED:reason goes here</signal>
84
+ ```
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "$schema": "../../protocol-schema.json",
3
3
  "name": "bugfix",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "description": "Lightweight protocol for minor bugfixes using GitHub Issues",
6
+ "input": {
7
+ "type": "github-issue",
8
+ "required": false,
9
+ "default_for": ["--issue", "-i"]
10
+ },
11
+ "hooks": {
12
+ "pre-spawn": {
13
+ "collision-check": true,
14
+ "comment-on-issue": "On it! Working on a fix now."
15
+ }
16
+ },
6
17
  "phases": [
7
18
  {
8
19
  "id": "investigate",
@@ -32,6 +43,11 @@
32
43
  "commit"
33
44
  ],
34
45
  "checks": {
46
+ "regression_test": {
47
+ "description": "A regression test MUST be added unless explicitly justified. No fix without a test.",
48
+ "required": true,
49
+ "skip_requires_justification": true
50
+ },
35
51
  "build": {
36
52
  "command": "npm run build",
37
53
  "on_fail": "retry",
@@ -65,37 +81,7 @@
65
81
  "max_rounds": 1
66
82
  },
67
83
  "transition": {
68
- "on_complete": "review"
69
- }
70
- },
71
- {
72
- "id": "review",
73
- "name": "Review",
74
- "description": "Address review feedback",
75
- "type": "once",
76
- "steps": [
77
- "address_feedback",
78
- "update_pr"
79
- ],
80
- "transition": {
81
- "on_complete": "merge"
82
- }
83
- },
84
- {
85
- "id": "merge",
86
- "name": "Merge",
87
- "description": "Merge the fix and close the issue",
88
- "type": "once",
89
- "steps": [
90
- "merge_pr",
91
- "verify_main",
92
- "close_issue"
93
- ],
94
- "gate": {
95
- "name": "merge-approval",
96
- "description": "Architect approves merge",
97
- "requires": ["review_complete", "tests_pass"],
98
- "next": null
84
+ "on_complete": null
99
85
  }
100
86
  }
101
87
  ],
@@ -105,7 +91,7 @@
105
91
  "transitions_to": "next_phase"
106
92
  },
107
93
  "TOO_COMPLEX": {
108
- "description": "Bug is too complex for BUGFIX, escalate to SPIDER",
94
+ "description": "Bug is too complex for BUGFIX, escalate to SPIR",
109
95
  "transitions_to": "escalate"
110
96
  },
111
97
  "BLOCKED": {
@@ -114,6 +100,7 @@
114
100
  }
115
101
  },
116
102
  "defaults": {
103
+ "mode": "strict",
117
104
  "consultation": {
118
105
  "enabled": true,
119
106
  "models": ["gemini", "codex"],
@@ -0,0 +1,52 @@
1
+ # {{protocol_name}} Builder ({{mode}} mode)
2
+
3
+ You are executing a disciplined experiment.
4
+
5
+ {{#if mode_soft}}
6
+ ## Mode: SOFT
7
+ You are running in SOFT mode. This means:
8
+ - You follow the EXPERIMENT protocol yourself (no porch orchestration)
9
+ - The architect monitors your work and verifies you're adhering to the protocol
10
+ - Document your findings thoroughly
11
+ {{/if}}
12
+
13
+ {{#if mode_strict}}
14
+ ## Mode: STRICT
15
+ You are running in STRICT mode. This means:
16
+ - Porch orchestrates your work
17
+ - Run: `porch next` to get your next tasks
18
+ - Follow porch signals and gate approvals
19
+
20
+ ### ABSOLUTE RESTRICTIONS (STRICT MODE)
21
+ - **NEVER edit `status.yaml` directly** — only porch commands may modify project state
22
+ - **NEVER call `porch approve` without explicit human approval** — only run it after the architect says to
23
+ - **NEVER skip the 3-way review** — always follow porch next → porch done cycle
24
+ {{/if}}
25
+
26
+ ## Protocol
27
+ Follow the EXPERIMENT protocol: `codev/protocols/experiment/protocol.md`
28
+
29
+ ## EXPERIMENT Overview
30
+ The EXPERIMENT protocol ensures disciplined experimentation:
31
+
32
+ 1. **Hypothesis Phase**: Define what you're testing and success criteria
33
+ 2. **Design Phase**: Plan the experiment approach
34
+ 3. **Execute Phase**: Run the experiment and gather data
35
+ 4. **Analyze Phase**: Evaluate results and draw conclusions
36
+
37
+ {{#if task}}
38
+ ## Experiment Focus
39
+ {{task_text}}
40
+ {{/if}}
41
+
42
+ ## Key Principles
43
+ - Start with a clear, falsifiable hypothesis
44
+ - Define success/failure criteria upfront
45
+ - Keep scope minimal for quick iteration
46
+ - Document findings regardless of outcome
47
+ - Separate experiment artifacts from production code
48
+
49
+ ## Getting Started
50
+ 1. Read the EXPERIMENT protocol document
51
+ 2. Define your hypothesis clearly
52
+ 3. Follow the phases in order
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "../../protocol-schema.json",
3
+ "name": "experiment",
4
+ "version": "1.0.0",
5
+ "description": "Disciplined experimentation with hypothesis testing",
6
+ "input": {
7
+ "type": "none",
8
+ "required": false,
9
+ "default_for": []
10
+ },
11
+ "hooks": {
12
+ "pre-spawn": {}
13
+ },
14
+ "phases": [
15
+ {
16
+ "id": "hypothesis",
17
+ "name": "Hypothesis",
18
+ "description": "Define the hypothesis and success criteria",
19
+ "type": "once",
20
+ "steps": [
21
+ "define_hypothesis",
22
+ "define_success_criteria",
23
+ "define_scope",
24
+ "create_experiment_doc"
25
+ ],
26
+ "transition": {
27
+ "on_complete": "design"
28
+ }
29
+ },
30
+ {
31
+ "id": "design",
32
+ "name": "Design",
33
+ "description": "Design the experiment approach",
34
+ "type": "once",
35
+ "steps": [
36
+ "choose_approach",
37
+ "identify_dependencies",
38
+ "plan_implementation",
39
+ "define_measurements"
40
+ ],
41
+ "transition": {
42
+ "on_complete": "execute"
43
+ }
44
+ },
45
+ {
46
+ "id": "execute",
47
+ "name": "Execute",
48
+ "description": "Run the experiment",
49
+ "type": "once",
50
+ "steps": [
51
+ "implement_prototype",
52
+ "gather_data",
53
+ "document_findings"
54
+ ],
55
+ "transition": {
56
+ "on_complete": "analyze"
57
+ }
58
+ },
59
+ {
60
+ "id": "analyze",
61
+ "name": "Analyze",
62
+ "description": "Analyze results and draw conclusions",
63
+ "type": "once",
64
+ "steps": [
65
+ "analyze_data",
66
+ "evaluate_hypothesis",
67
+ "document_conclusions",
68
+ "recommend_next_steps"
69
+ ],
70
+ "gate": {
71
+ "name": "experiment-complete",
72
+ "description": "Experiment complete",
73
+ "requires": ["conclusions_documented"],
74
+ "next": null
75
+ }
76
+ }
77
+ ],
78
+ "signals": {
79
+ "PHASE_COMPLETE": {
80
+ "description": "Signal current phase is complete",
81
+ "transitions_to": "next_phase"
82
+ },
83
+ "BLOCKED": {
84
+ "description": "Signal experiment is blocked",
85
+ "requires": "reason"
86
+ },
87
+ "HYPOTHESIS_REJECTED": {
88
+ "description": "Signal hypothesis was disproven",
89
+ "transitions_to": "analyze"
90
+ }
91
+ },
92
+ "defaults": {
93
+ "mode": "soft",
94
+ "consultation": {
95
+ "enabled": false,
96
+ "models": [],
97
+ "parallel": false
98
+ },
99
+ "checks": {}
100
+ }
101
+ }
@@ -10,7 +10,7 @@ Disciplined experimentation: Each experiment gets its own directory with `notes.
10
10
 
11
11
  **Use for**: Testing approaches, evaluating models, prototyping, proof-of-concept work, research spikes
12
12
 
13
- **Skip for**: Production code (use SPIDER), simple one-off scripts, well-understood implementations (use TICK)
13
+ **Skip for**: Production code (use SPIR), simple one-off scripts, well-understood implementations (use TICK)
14
14
 
15
15
  ## Structure
16
16
 
@@ -141,7 +141,7 @@ What should be done based on findings?
141
141
 
142
142
  ## Integration with Other Protocols
143
143
 
144
- ### Experiment → SPIDER
144
+ ### Experiment → SPIR
145
145
  When an experiment validates an approach for production use:
146
146
 
147
147
  1. Create a specification referencing the experiment
@@ -225,5 +225,5 @@ Determine if Redis caching improves API response times for repeated queries.
225
225
  - Memory usage: 50MB for 10k cached responses
226
226
 
227
227
  ## Next Steps
228
- Create SPIDER spec for production caching implementation.
228
+ Create SPIR spec for production caching implementation.
229
229
  ```
@@ -88,7 +88,7 @@ Based on these findings:
88
88
 
89
89
  1. **Immediate**: What should happen right after this experiment?
90
90
  2. **Follow-up experiments**: What new questions emerged?
91
- 3. **Production path**: If validated, what's needed for production? (SPIDER spec?)
91
+ 3. **Production path**: If validated, what's needed for production? (SPIR spec?)
92
92
 
93
93
  ## References
94
94
 
@@ -0,0 +1,46 @@
1
+ # {{protocol_name}} Builder ({{mode}} mode)
2
+
3
+ You are executing the MAINTAIN protocol to clean up and synchronize the codebase.
4
+
5
+ {{#if mode_soft}}
6
+ ## Mode: SOFT
7
+ You are running in SOFT mode. This means:
8
+ - You follow the MAINTAIN protocol yourself (no porch orchestration)
9
+ - The architect monitors your work and verifies you're adhering to the protocol
10
+ - Work through each phase methodically
11
+ {{/if}}
12
+
13
+ {{#if mode_strict}}
14
+ ## Mode: STRICT
15
+ You are running in STRICT mode. This means:
16
+ - Porch orchestrates your work
17
+ - Run: `porch next` to get your next tasks
18
+ - Follow porch signals and gate approvals
19
+
20
+ ### ABSOLUTE RESTRICTIONS (STRICT MODE)
21
+ - **NEVER edit `status.yaml` directly** — only porch commands may modify project state
22
+ - **NEVER call `porch approve` without explicit human approval** — only run it after the architect says to
23
+ - **NEVER skip the 3-way review** — always follow porch next → porch done cycle
24
+ {{/if}}
25
+
26
+ ## Protocol
27
+ Follow the MAINTAIN protocol: `codev/protocols/maintain/protocol.md`
28
+
29
+ ## MAINTAIN Overview
30
+ The MAINTAIN protocol handles codebase hygiene:
31
+
32
+ 1. **Audit Phase**: Scan for dead code, unused dependencies, stale docs
33
+ 2. **Clean Phase**: Remove identified cruft, verify build
34
+ 3. **Sync Phase**: Update documentation (arch.md, lessons-learned.md, CLAUDE.md)
35
+ 4. **Verify Phase**: Run full test suite, confirm health
36
+
37
+ ## Key Rules
38
+ - Use soft deletion (move to `codev/maintain/.trash/`)
39
+ - Always verify build passes after removals
40
+ - Update documentation to match current architecture
41
+ - Don't remove anything actively used
42
+
43
+ ## Getting Started
44
+ 1. Read the MAINTAIN protocol document
45
+ 2. Start with the Audit phase
46
+ 3. Document all changes made
@@ -0,0 +1,111 @@
1
+ # AUDIT Phase Prompt
2
+
3
+ You are executing the **AUDIT** phase of the MAINTAIN protocol.
4
+
5
+ ## Your Goal
6
+
7
+ Analyze the codebase to identify dead code, unused dependencies, and stale documentation.
8
+
9
+ ## Context
10
+
11
+ - **Current State**: {{current_state}}
12
+
13
+ ## Process
14
+
15
+ ### 1. Determine Base Commit
16
+
17
+ Find the last maintenance run:
18
+ ```bash
19
+ ls codev/maintain/
20
+ ```
21
+
22
+ If previous runs exist, note the base commit to focus on changes since then.
23
+
24
+ ### 2. Scan for Dead Code
25
+
26
+ Run static analysis tools:
27
+
28
+ ```bash
29
+ # TypeScript/JavaScript
30
+ npx ts-prune 2>/dev/null || echo "ts-prune not available"
31
+ npx depcheck 2>/dev/null || echo "depcheck not available"
32
+
33
+ # Check for unused exports
34
+ grep -r "export " --include="*.ts" --include="*.tsx" | head -50
35
+ ```
36
+
37
+ ### 3. Scan for Unused Dependencies
38
+
39
+ Check package.json for unused dependencies:
40
+ ```bash
41
+ cat package.json | grep -A100 '"dependencies"' | head -50
42
+ ```
43
+
44
+ Cross-reference with actual imports in the codebase.
45
+
46
+ ### 4. Scan for Stale Documentation
47
+
48
+ Check for references to deleted files/functions:
49
+ ```bash
50
+ # Recent changes
51
+ git log --oneline -20
52
+
53
+ # Check if arch.md references exist
54
+ grep -E "src/|packages/" codev/resources/arch.md | head -20
55
+ ```
56
+
57
+ ### 5. Create Audit Report
58
+
59
+ Create a maintenance run file: `codev/maintain/NNNN.md`
60
+
61
+ Document:
62
+ - Dead code identified (with file paths)
63
+ - Unused dependencies
64
+ - Stale documentation references
65
+ - Recommended actions
66
+
67
+ Use the template structure:
68
+ ```markdown
69
+ # Maintenance Run NNNN
70
+
71
+ **Date**: YYYY-MM-DD
72
+ **Base Commit**: <commit-hash>
73
+
74
+ ## Dead Code Identified
75
+
76
+ | File | Item | Reason |
77
+ |------|------|--------|
78
+ | path/to/file.ts | unusedFunction() | Not imported anywhere |
79
+
80
+ ## Unused Dependencies
81
+
82
+ | Package | Reason |
83
+ |---------|--------|
84
+ | some-pkg | Not imported |
85
+
86
+ ## Stale Documentation
87
+
88
+ | Document | Issue |
89
+ |----------|-------|
90
+ | arch.md | References deleted module |
91
+
92
+ ## Recommended Actions
93
+
94
+ 1. Remove X
95
+ 2. Update Y
96
+ 3. ...
97
+ ```
98
+
99
+ ## Signals
100
+
101
+ When audit report is complete:
102
+
103
+ ```
104
+ <signal>PHASE_COMPLETE</signal>
105
+ ```
106
+
107
+ If blocked:
108
+
109
+ ```
110
+ <signal>BLOCKED:reason</signal>
111
+ ```
@@ -0,0 +1,91 @@
1
+ # CLEAN Phase Prompt
2
+
3
+ You are executing the **CLEAN** phase of the MAINTAIN protocol.
4
+
5
+ ## Your Goal
6
+
7
+ Remove the dead code and unused dependencies identified in the audit phase.
8
+
9
+ ## Context
10
+
11
+ - **Current State**: {{current_state}}
12
+
13
+ ## Prerequisites
14
+
15
+ Read the audit report from the previous phase:
16
+ ```bash
17
+ ls -la codev/maintain/
18
+ cat codev/maintain/*.md | tail -100
19
+ ```
20
+
21
+ ## Process
22
+
23
+ ### 1. Remove Dead Code
24
+
25
+ For each item identified in the audit:
26
+
27
+ 1. Verify it's truly unused (double-check with grep)
28
+ 2. Use `git rm` for tracked files
29
+ 3. For untracked files, move to `.trash/` before deleting
30
+
31
+ **CRITICAL**: Use soft deletion first:
32
+ ```bash
33
+ mkdir -p codev/maintain/.trash/$(date +%Y-%m-%d)
34
+ mv path/to/file codev/maintain/.trash/$(date +%Y-%m-%d)/
35
+ ```
36
+
37
+ ### 2. Remove Unused Dependencies
38
+
39
+ ```bash
40
+ # Remove from package.json
41
+ npm uninstall <package-name>
42
+ ```
43
+
44
+ ### 3. Verify Build After Each Removal
45
+
46
+ After each significant removal:
47
+ ```bash
48
+ npm run build
49
+ npm test -- --exclude='**/e2e/**'
50
+ ```
51
+
52
+ If build fails, revert the change and investigate.
53
+
54
+ ### 4. Commit Changes
55
+
56
+ Make atomic commits for each logical change:
57
+ ```bash
58
+ git add <specific-files>
59
+ git commit -m "[Maintain] Remove unused X"
60
+ ```
61
+
62
+ **NEVER use `git add -A` or `git add .`**
63
+
64
+ ## Important Rules
65
+
66
+ 1. **One removal at a time** - Don't batch unrelated changes
67
+ 2. **Verify after each removal** - Build must pass
68
+ 3. **Document what was removed** - Update the maintenance run file
69
+ 4. **Soft delete first** - Move to .trash/ before permanent deletion
70
+ 5. **Check for side effects** - Grep for references before removing
71
+
72
+ ## Output
73
+
74
+ Update the maintenance run file with:
75
+ - What was removed
76
+ - Build/test status after removal
77
+ - Any issues encountered
78
+
79
+ ## Signals
80
+
81
+ When all dead code is removed and build passes:
82
+
83
+ ```
84
+ <signal>PHASE_COMPLETE</signal>
85
+ ```
86
+
87
+ If blocked:
88
+
89
+ ```
90
+ <signal>BLOCKED:reason</signal>
91
+ ```