@cluesmith/codev 3.2.4 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (394) hide show
  1. package/dashboard-dist/assets/index-BZRTEMtH.css +32 -0
  2. package/dashboard-dist/assets/{index-BZ1x7x1X.js → index-D3XaKpZW.js} +46 -44
  3. package/dashboard-dist/assets/index-D3XaKpZW.js.map +1 -0
  4. package/dashboard-dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +154 -0
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  9. package/dist/agent-farm/commands/cleanup.js +16 -0
  10. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  11. package/dist/agent-farm/commands/inbox.d.ts +42 -0
  12. package/dist/agent-farm/commands/inbox.d.ts.map +1 -0
  13. package/dist/agent-farm/commands/inbox.js +129 -0
  14. package/dist/agent-farm/commands/inbox.js.map +1 -0
  15. package/dist/agent-farm/commands/interrupt.d.ts +20 -0
  16. package/dist/agent-farm/commands/interrupt.d.ts.map +1 -0
  17. package/dist/agent-farm/commands/interrupt.js +65 -0
  18. package/dist/agent-farm/commands/interrupt.js.map +1 -0
  19. package/dist/agent-farm/commands/reset/constants.d.ts +52 -0
  20. package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -0
  21. package/dist/agent-farm/commands/reset/constants.js +52 -0
  22. package/dist/agent-farm/commands/reset/constants.js.map +1 -0
  23. package/dist/agent-farm/commands/reset/context.d.ts +230 -0
  24. package/dist/agent-farm/commands/reset/context.d.ts.map +1 -0
  25. package/dist/agent-farm/commands/reset/context.js +428 -0
  26. package/dist/agent-farm/commands/reset/context.js.map +1 -0
  27. package/dist/agent-farm/commands/reset/index.d.ts +192 -0
  28. package/dist/agent-farm/commands/reset/index.d.ts.map +1 -0
  29. package/dist/agent-farm/commands/reset/index.js +488 -0
  30. package/dist/agent-farm/commands/reset/index.js.map +1 -0
  31. package/dist/agent-farm/commands/reset/receipt.d.ts +97 -0
  32. package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -0
  33. package/dist/agent-farm/commands/reset/receipt.js +149 -0
  34. package/dist/agent-farm/commands/reset/receipt.js.map +1 -0
  35. package/dist/agent-farm/commands/reset/reorient.d.ts +117 -0
  36. package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -0
  37. package/dist/agent-farm/commands/reset/reorient.js +313 -0
  38. package/dist/agent-farm/commands/reset/reorient.js.map +1 -0
  39. package/dist/agent-farm/commands/reset.d.ts +34 -0
  40. package/dist/agent-farm/commands/reset.d.ts.map +1 -0
  41. package/dist/agent-farm/commands/reset.js +309 -0
  42. package/dist/agent-farm/commands/reset.js.map +1 -0
  43. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  44. package/dist/agent-farm/commands/send.js +49 -8
  45. package/dist/agent-farm/commands/send.js.map +1 -1
  46. package/dist/agent-farm/commands/spawn-worktree.d.ts +105 -6
  47. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  48. package/dist/agent-farm/commands/spawn-worktree.js +289 -66
  49. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  50. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/spawn.js +13 -1
  52. package/dist/agent-farm/commands/spawn.js.map +1 -1
  53. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  54. package/dist/agent-farm/commands/status.js +80 -8
  55. package/dist/agent-farm/commands/status.js.map +1 -1
  56. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  57. package/dist/agent-farm/commands/tower.js +13 -0
  58. package/dist/agent-farm/commands/tower.js.map +1 -1
  59. package/dist/agent-farm/db/index.d.ts +1 -1
  60. package/dist/agent-farm/db/index.d.ts.map +1 -1
  61. package/dist/agent-farm/db/index.js +80 -1
  62. package/dist/agent-farm/db/index.js.map +1 -1
  63. package/dist/agent-farm/db/mailbox.d.ts +222 -0
  64. package/dist/agent-farm/db/mailbox.d.ts.map +1 -0
  65. package/dist/agent-farm/db/mailbox.js +304 -0
  66. package/dist/agent-farm/db/mailbox.js.map +1 -0
  67. package/dist/agent-farm/db/schema.d.ts +1 -1
  68. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  69. package/dist/agent-farm/db/schema.js +35 -0
  70. package/dist/agent-farm/db/schema.js.map +1 -1
  71. package/dist/agent-farm/db/types.d.ts +45 -0
  72. package/dist/agent-farm/db/types.d.ts.map +1 -1
  73. package/dist/agent-farm/db/types.js.map +1 -1
  74. package/dist/agent-farm/lib/builder-lookup.d.ts +1 -1
  75. package/dist/agent-farm/lib/builder-lookup.js +2 -2
  76. package/dist/agent-farm/lib/builder-lookup.js.map +1 -1
  77. package/dist/agent-farm/lib/reconnect-backoff.d.ts +64 -0
  78. package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -0
  79. package/dist/agent-farm/lib/reconnect-backoff.js +57 -0
  80. package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -0
  81. package/dist/agent-farm/lib/tower-client.d.ts +16 -6
  82. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  83. package/dist/agent-farm/lib/tower-client.js +37 -6
  84. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  85. package/dist/agent-farm/lib/tunnel-client.d.ts +69 -1
  86. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  87. package/dist/agent-farm/lib/tunnel-client.js +225 -30
  88. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  89. package/dist/agent-farm/servers/canvas-relay.d.ts +60 -0
  90. package/dist/agent-farm/servers/canvas-relay.d.ts.map +1 -0
  91. package/dist/agent-farm/servers/canvas-relay.js +376 -0
  92. package/dist/agent-farm/servers/canvas-relay.js.map +1 -0
  93. package/dist/agent-farm/servers/cron-delivery.d.ts +72 -0
  94. package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -0
  95. package/dist/agent-farm/servers/cron-delivery.js +80 -0
  96. package/dist/agent-farm/servers/cron-delivery.js.map +1 -0
  97. package/dist/agent-farm/servers/delayed-send.d.ts +85 -0
  98. package/dist/agent-farm/servers/delayed-send.d.ts.map +1 -0
  99. package/dist/agent-farm/servers/delayed-send.js +165 -0
  100. package/dist/agent-farm/servers/delayed-send.js.map +1 -0
  101. package/dist/agent-farm/servers/gate-profiles.d.ts +67 -0
  102. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -0
  103. package/dist/agent-farm/servers/gate-profiles.js +113 -0
  104. package/dist/agent-farm/servers/gate-profiles.js.map +1 -0
  105. package/dist/agent-farm/servers/mailbox-delivery.d.ts +370 -0
  106. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -0
  107. package/dist/agent-farm/servers/mailbox-delivery.js +617 -0
  108. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -0
  109. package/dist/agent-farm/servers/mailbox-wiring.d.ts +125 -0
  110. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -0
  111. package/dist/agent-farm/servers/mailbox-wiring.js +425 -0
  112. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -0
  113. package/dist/agent-farm/servers/message-write.d.ts +53 -1
  114. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  115. package/dist/agent-farm/servers/message-write.js +63 -0
  116. package/dist/agent-farm/servers/message-write.js.map +1 -1
  117. package/dist/agent-farm/servers/overview.d.ts +19 -0
  118. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  119. package/dist/agent-farm/servers/overview.js +100 -4
  120. package/dist/agent-farm/servers/overview.js.map +1 -1
  121. package/dist/agent-farm/servers/render-gate.d.ts +141 -0
  122. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -0
  123. package/dist/agent-farm/servers/render-gate.js +251 -0
  124. package/dist/agent-farm/servers/render-gate.js.map +1 -0
  125. package/dist/agent-farm/servers/session-submit.d.ts +90 -0
  126. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -0
  127. package/dist/agent-farm/servers/session-submit.js +127 -0
  128. package/dist/agent-farm/servers/session-submit.js.map +1 -0
  129. package/dist/agent-farm/servers/tower-cron.d.ts +10 -7
  130. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  131. package/dist/agent-farm/servers/tower-cron.js +58 -53
  132. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  133. package/dist/agent-farm/servers/tower-instances.d.ts +14 -2
  134. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  135. package/dist/agent-farm/servers/tower-instances.js +78 -16
  136. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  137. package/dist/agent-farm/servers/tower-messages.d.ts +38 -1
  138. package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
  139. package/dist/agent-farm/servers/tower-messages.js +106 -1
  140. package/dist/agent-farm/servers/tower-messages.js.map +1 -1
  141. package/dist/agent-farm/servers/tower-routes.d.ts +16 -4
  142. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  143. package/dist/agent-farm/servers/tower-routes.js +826 -145
  144. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  145. package/dist/agent-farm/servers/tower-server.js +188 -34
  146. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  147. package/dist/agent-farm/servers/tower-terminals.d.ts +23 -2
  148. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  149. package/dist/agent-farm/servers/tower-terminals.js +134 -127
  150. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  151. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
  152. package/dist/agent-farm/servers/tower-tunnel.js +63 -4
  153. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  154. package/dist/agent-farm/servers/tower-types.d.ts +2 -1
  155. package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
  156. package/dist/agent-farm/servers/tower-utils.d.ts +64 -1
  157. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  158. package/dist/agent-farm/servers/tower-utils.js +168 -1
  159. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  160. package/dist/agent-farm/servers/tower-websocket.d.ts +6 -1
  161. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  162. package/dist/agent-farm/servers/tower-websocket.js +95 -57
  163. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  164. package/dist/agent-farm/servers/write-queue.d.ts +35 -0
  165. package/dist/agent-farm/servers/write-queue.d.ts.map +1 -0
  166. package/dist/agent-farm/servers/write-queue.js +56 -0
  167. package/dist/agent-farm/servers/write-queue.js.map +1 -0
  168. package/dist/agent-farm/types.d.ts +39 -0
  169. package/dist/agent-farm/types.d.ts.map +1 -1
  170. package/dist/agent-farm/utils/agent-names.d.ts +2 -2
  171. package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
  172. package/dist/agent-farm/utils/agent-names.js +3 -3
  173. package/dist/agent-farm/utils/agent-names.js.map +1 -1
  174. package/dist/agent-farm/utils/architect-name.d.ts +2 -2
  175. package/dist/agent-farm/utils/architect-name.d.ts.map +1 -1
  176. package/dist/agent-farm/utils/architect-name.js +3 -3
  177. package/dist/agent-farm/utils/architect-name.js.map +1 -1
  178. package/dist/agent-farm/utils/config.d.ts +13 -0
  179. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  180. package/dist/agent-farm/utils/config.js +33 -1
  181. package/dist/agent-farm/utils/config.js.map +1 -1
  182. package/dist/agent-farm/utils/harness.d.ts +103 -7
  183. package/dist/agent-farm/utils/harness.d.ts.map +1 -1
  184. package/dist/agent-farm/utils/harness.js +126 -19
  185. package/dist/agent-farm/utils/harness.js.map +1 -1
  186. package/dist/agent-farm/utils/message-format.d.ts +8 -0
  187. package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
  188. package/dist/agent-farm/utils/message-format.js +20 -0
  189. package/dist/agent-farm/utils/message-format.js.map +1 -1
  190. package/dist/agent-farm/utils/server-utils.d.ts +80 -4
  191. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  192. package/dist/agent-farm/utils/server-utils.js +286 -5
  193. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  194. package/dist/cli.d.ts.map +1 -1
  195. package/dist/cli.js +6 -32
  196. package/dist/cli.js.map +1 -1
  197. package/dist/commands/consult/cli-options.d.ts +34 -0
  198. package/dist/commands/consult/cli-options.d.ts.map +1 -0
  199. package/dist/commands/consult/cli-options.js +67 -0
  200. package/dist/commands/consult/cli-options.js.map +1 -0
  201. package/dist/commands/consult/index.d.ts +56 -2
  202. package/dist/commands/consult/index.d.ts.map +1 -1
  203. package/dist/commands/consult/index.js +272 -28
  204. package/dist/commands/consult/index.js.map +1 -1
  205. package/dist/commands/consult/metrics.d.ts +42 -0
  206. package/dist/commands/consult/metrics.d.ts.map +1 -1
  207. package/dist/commands/consult/metrics.js +129 -9
  208. package/dist/commands/consult/metrics.js.map +1 -1
  209. package/dist/commands/doctor.d.ts.map +1 -1
  210. package/dist/commands/doctor.js +71 -19
  211. package/dist/commands/doctor.js.map +1 -1
  212. package/dist/commands/porch/checks.d.ts +23 -0
  213. package/dist/commands/porch/checks.d.ts.map +1 -1
  214. package/dist/commands/porch/checks.js +60 -0
  215. package/dist/commands/porch/checks.js.map +1 -1
  216. package/dist/commands/porch/config.d.ts +20 -0
  217. package/dist/commands/porch/config.d.ts.map +1 -1
  218. package/dist/commands/porch/config.js +20 -0
  219. package/dist/commands/porch/config.js.map +1 -1
  220. package/dist/commands/porch/index.js +21 -28
  221. package/dist/commands/porch/index.js.map +1 -1
  222. package/dist/commands/porch/next.d.ts.map +1 -1
  223. package/dist/commands/porch/next.js +2 -41
  224. package/dist/commands/porch/next.js.map +1 -1
  225. package/dist/lib/config.d.ts +69 -3
  226. package/dist/lib/config.d.ts.map +1 -1
  227. package/dist/lib/config.js +67 -3
  228. package/dist/lib/config.js.map +1 -1
  229. package/dist/lib/consult-lanes.d.ts +149 -0
  230. package/dist/lib/consult-lanes.d.ts.map +1 -0
  231. package/dist/lib/consult-lanes.js +360 -0
  232. package/dist/lib/consult-lanes.js.map +1 -0
  233. package/dist/lib/forge-contracts.d.ts +9 -0
  234. package/dist/lib/forge-contracts.d.ts.map +1 -1
  235. package/dist/lib/forge-contracts.js.map +1 -1
  236. package/dist/lib/github.d.ts +15 -1
  237. package/dist/lib/github.d.ts.map +1 -1
  238. package/dist/lib/github.js +18 -1
  239. package/dist/lib/github.js.map +1 -1
  240. package/dist/lib/prompt-behavior-metrics.d.ts +67 -0
  241. package/dist/lib/prompt-behavior-metrics.d.ts.map +1 -0
  242. package/dist/lib/prompt-behavior-metrics.js +290 -0
  243. package/dist/lib/prompt-behavior-metrics.js.map +1 -0
  244. package/dist/lib/skeleton.d.ts +22 -1
  245. package/dist/lib/skeleton.d.ts.map +1 -1
  246. package/dist/lib/skeleton.js +120 -0
  247. package/dist/lib/skeleton.js.map +1 -1
  248. package/dist/lib/test-env.d.ts +74 -0
  249. package/dist/lib/test-env.d.ts.map +1 -0
  250. package/dist/lib/test-env.js +92 -0
  251. package/dist/lib/test-env.js.map +1 -0
  252. package/dist/terminal/attach-replay.d.ts +39 -0
  253. package/dist/terminal/attach-replay.d.ts.map +1 -0
  254. package/dist/terminal/attach-replay.js +76 -0
  255. package/dist/terminal/attach-replay.js.map +1 -0
  256. package/dist/terminal/pty-manager.d.ts +2 -0
  257. package/dist/terminal/pty-manager.d.ts.map +1 -1
  258. package/dist/terminal/pty-manager.js +51 -23
  259. package/dist/terminal/pty-manager.js.map +1 -1
  260. package/dist/terminal/pty-session.d.ts +201 -1
  261. package/dist/terminal/pty-session.d.ts.map +1 -1
  262. package/dist/terminal/pty-session.js +327 -46
  263. package/dist/terminal/pty-session.js.map +1 -1
  264. package/dist/terminal/ring-buffer.d.ts +39 -6
  265. package/dist/terminal/ring-buffer.d.ts.map +1 -1
  266. package/dist/terminal/ring-buffer.js +74 -6
  267. package/dist/terminal/ring-buffer.js.map +1 -1
  268. package/dist/terminal/session-manager.d.ts +53 -0
  269. package/dist/terminal/session-manager.d.ts.map +1 -1
  270. package/dist/terminal/session-manager.js +94 -9
  271. package/dist/terminal/session-manager.js.map +1 -1
  272. package/dist/terminal/session-screen.d.ts +116 -0
  273. package/dist/terminal/session-screen.d.ts.map +1 -0
  274. package/dist/terminal/session-screen.js +180 -0
  275. package/dist/terminal/session-screen.js.map +1 -0
  276. package/dist/terminal/shellper-main.js +2 -1
  277. package/dist/terminal/shellper-main.js.map +1 -1
  278. package/dist/terminal/shellper-process.d.ts +1 -1
  279. package/dist/terminal/shellper-process.d.ts.map +1 -1
  280. package/dist/terminal/shellper-process.js +17 -8
  281. package/dist/terminal/shellper-process.js.map +1 -1
  282. package/dist/terminal/shellper-replay-buffer.d.ts +69 -7
  283. package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -1
  284. package/dist/terminal/shellper-replay-buffer.js +167 -31
  285. package/dist/terminal/shellper-replay-buffer.js.map +1 -1
  286. package/package.json +13 -8
  287. package/scripts/forge/gitea/pr-view.sh +4 -1
  288. package/scripts/forge/github/pr-view.sh +1 -1
  289. package/scripts/forge/gitlab/pr-view.sh +4 -1
  290. package/skeleton/.claude/skills/afx/SKILL.md +68 -1
  291. package/skeleton/.claude/skills/arch-init/SKILL.md +22 -9
  292. package/skeleton/.claude/skills/arch-save/SKILL.md +183 -0
  293. package/skeleton/.claude/skills/codev/SKILL.md +31 -0
  294. package/skeleton/.claude/skills/runnable-worktrees/SKILL.md +119 -0
  295. package/skeleton/.codex/skills/afx/SKILL.md +68 -1
  296. package/skeleton/.codex/skills/arch-init/SKILL.md +22 -9
  297. package/skeleton/.codex/skills/arch-save/SKILL.md +183 -0
  298. package/skeleton/.codex/skills/codev/SKILL.md +31 -0
  299. package/skeleton/.codex/skills/runnable-worktrees/SKILL.md +119 -0
  300. package/skeleton/protocols/air/builder-prompt.md +28 -47
  301. package/skeleton/protocols/air/consult-types/impl-review.md +17 -34
  302. package/skeleton/protocols/air/consult-types/pr-review.md +14 -37
  303. package/skeleton/protocols/air/prompts/implement.md +20 -73
  304. package/skeleton/protocols/air/prompts/pr.md +22 -54
  305. package/skeleton/protocols/air/protocol.md +40 -71
  306. package/skeleton/protocols/aspir/builder-prompt.md +29 -66
  307. package/skeleton/protocols/aspir/consult-types/impl-review.md +17 -44
  308. package/skeleton/protocols/aspir/consult-types/phase-review.md +17 -44
  309. package/skeleton/protocols/aspir/consult-types/plan-review.md +14 -38
  310. package/skeleton/protocols/aspir/consult-types/pr-review.md +13 -39
  311. package/skeleton/protocols/aspir/consult-types/spec-review.md +13 -33
  312. package/skeleton/protocols/aspir/prompts/implement.md +27 -196
  313. package/skeleton/protocols/aspir/prompts/plan.md +21 -85
  314. package/skeleton/protocols/aspir/prompts/review.md +29 -228
  315. package/skeleton/protocols/aspir/prompts/specify.md +25 -111
  316. package/skeleton/protocols/aspir/protocol.json +10 -0
  317. package/skeleton/protocols/aspir/protocol.md +36 -82
  318. package/skeleton/protocols/bugfix/builder-prompt.md +23 -45
  319. package/skeleton/protocols/bugfix/consult-types/impl-review.md +21 -45
  320. package/skeleton/protocols/bugfix/consult-types/pr-review.md +18 -52
  321. package/skeleton/protocols/bugfix/prompts/fix.md +16 -61
  322. package/skeleton/protocols/bugfix/prompts/investigate.md +18 -62
  323. package/skeleton/protocols/bugfix/prompts/pr.md +22 -57
  324. package/skeleton/protocols/bugfix/protocol.md +44 -50
  325. package/skeleton/protocols/experiment/builder-prompt.md +25 -58
  326. package/skeleton/protocols/experiment/protocol.md +22 -188
  327. package/skeleton/protocols/experiment/templates/notes.md +11 -71
  328. package/skeleton/protocols/maintain/builder-prompt.md +24 -45
  329. package/skeleton/protocols/maintain/consult-types/impl-review.md +17 -44
  330. package/skeleton/protocols/maintain/consult-types/pr-review.md +13 -39
  331. package/skeleton/protocols/maintain/prompts/maintain.md +1 -1
  332. package/skeleton/protocols/maintain/protocol.md +32 -266
  333. package/skeleton/protocols/maintain/templates/maintenance-run.md +11 -0
  334. package/skeleton/protocols/pir/builder-prompt.md +31 -64
  335. package/skeleton/protocols/pir/consult-types/impl-review.md +17 -50
  336. package/skeleton/protocols/pir/consult-types/pr-review.md +11 -40
  337. package/skeleton/protocols/pir/prompts/implement.md +2 -3
  338. package/skeleton/protocols/pir/prompts/plan.md +1 -4
  339. package/skeleton/protocols/pir/prompts/review.md +2 -2
  340. package/skeleton/protocols/pir/protocol.md +54 -177
  341. package/skeleton/protocols/research/builder-prompt.md +27 -58
  342. package/skeleton/protocols/research/protocol.md +28 -153
  343. package/skeleton/protocols/spike/builder-prompt.md +30 -48
  344. package/skeleton/protocols/spike/protocol.md +24 -107
  345. package/skeleton/protocols/spike/templates/findings.md +9 -39
  346. package/skeleton/protocols/spir/builder-prompt.md +33 -62
  347. package/skeleton/protocols/spir/consult-types/impl-review.md +17 -44
  348. package/skeleton/protocols/spir/consult-types/phase-review.md +17 -44
  349. package/skeleton/protocols/spir/consult-types/plan-review.md +14 -38
  350. package/skeleton/protocols/spir/consult-types/pr-review.md +13 -39
  351. package/skeleton/protocols/spir/consult-types/spec-review.md +13 -33
  352. package/skeleton/protocols/spir/prompts/implement.md +26 -195
  353. package/skeleton/protocols/spir/prompts/plan.md +20 -84
  354. package/skeleton/protocols/spir/prompts/review.md +28 -227
  355. package/skeleton/protocols/spir/prompts/specify.md +24 -110
  356. package/skeleton/protocols/spir/protocol.json +10 -0
  357. package/skeleton/protocols/spir/protocol.md +84 -633
  358. package/skeleton/protocols/spir/templates/plan.md +28 -147
  359. package/skeleton/protocols/spir/templates/review.md +21 -80
  360. package/skeleton/protocols/spir/templates/spec.md +24 -118
  361. package/skeleton/resources/commands/agent-farm.md +262 -0
  362. package/skeleton/resources/commands/consult.md +236 -8
  363. package/skeleton/resources/commands/overview.md +1 -0
  364. package/skeleton/roles/architect.md +67 -317
  365. package/skeleton/roles/builder.md +76 -191
  366. package/skeleton/templates/AGENTS.md +2 -0
  367. package/skeleton/templates/CLAUDE.md +2 -0
  368. package/templates/3d-viewer.html +32 -4
  369. package/templates/open.html +58 -12
  370. package/templates/tower.html +65 -9
  371. package/templates/vendor/three-3MFLoader.js +1478 -0
  372. package/templates/vendor/three-STLLoader.js +410 -0
  373. package/templates/vendor/three-TrackballControls.js +828 -0
  374. package/templates/vendor/three-fflate.module.js +2474 -0
  375. package/templates/vendor/three.module.js +53044 -0
  376. package/dashboard-dist/assets/index-BZ1x7x1X.js.map +0 -1
  377. package/dashboard-dist/assets/index-DB1KBSNE.css +0 -32
  378. package/dist/agent-farm/servers/send-buffer.d.ts +0 -59
  379. package/dist/agent-farm/servers/send-buffer.d.ts.map +0 -1
  380. package/dist/agent-farm/servers/send-buffer.js +0 -116
  381. package/dist/agent-farm/servers/send-buffer.js.map +0 -1
  382. package/skeleton/porch/prompts/defend.md +0 -108
  383. package/skeleton/porch/prompts/diagnose.md +0 -70
  384. package/skeleton/porch/prompts/evaluate.md +0 -132
  385. package/skeleton/porch/prompts/fix.md +0 -59
  386. package/skeleton/porch/prompts/implement.md +0 -88
  387. package/skeleton/porch/prompts/plan.md +0 -74
  388. package/skeleton/porch/prompts/pr.md +0 -84
  389. package/skeleton/porch/prompts/review.md +0 -249
  390. package/skeleton/porch/prompts/specify.md +0 -53
  391. package/skeleton/porch/prompts/test.md +0 -63
  392. package/skeleton/protocols/aspir/templates/plan.md +0 -184
  393. package/skeleton/protocols/aspir/templates/review.md +0 -120
  394. package/skeleton/protocols/aspir/templates/spec.md +0 -154
@@ -2,47 +2,27 @@
2
2
 
3
3
  ## Context
4
4
 
5
- You are reviewing the implementation of a PIR protocol project before it reaches the `dev-approval` human gate. A builder has implemented the approved plan and written a dev-approval summary. Your job is to verify the implementation matches the plan and is ready for human review.
5
+ You are reviewing a PIR implementation before it reaches the `dev-approval` human gate. A builder has implemented the approved plan and written a dev-approval summary. Verify the implementation matches the plan and is ready for human review.
6
6
 
7
- ## CRITICAL: Verify Before Flagging
7
+ ## Verify before flagging
8
8
 
9
- Before requesting changes for missing configuration, incorrect patterns, or framework issues:
10
- 1. **Check `package.json`** for actual dependency versions — framework conventions change between major versions
11
- 2. **Read the actual config files** (or confirm their deliberate absence) before flagging missing configs
12
- 3. **Do not assume** your training data reflects the version in use — verify against project files
13
- 4. If "Previous Iteration Context" is provided, read it carefully before re-raising concerns that were already disputed
9
+ Before requesting changes for missing configuration, wrong patterns, or framework issues, confirm the claim against the project rather than your training data:
14
10
 
15
- ## Focus Areas
16
-
17
- 1. **Plan Adherence**
18
- - Does the implementation fulfill the approved plan?
19
- - Are all "Files to Change" actually changed?
20
- - Are the changes scoped to what the plan described, or has scope crept?
21
-
22
- 2. **Code Quality**
23
- - Is the code readable and maintainable?
24
- - Are there obvious bugs?
25
- - Are error cases handled appropriately?
26
- - Is the change minimal — no unnecessary refactoring or unrelated tidy-ups?
27
-
28
- 3. **Test Coverage**
29
- - Are the tests adequate for the changes?
30
- - Do tests cover both the main path and the edge cases the plan called out?
31
- - For a bug fix: is there a regression test that would fail without the fix?
11
+ - Check `package.json` for the actual dependency versions — framework conventions change between major versions.
12
+ - Read the actual config files (or confirm their deliberate absence) before flagging a missing config.
13
+ - If "Previous Iteration Context" is provided, read it before re-raising concerns already disputed.
32
14
 
33
- 4. **Review File Quality**
34
- - Does `codev/reviews/<id>-<slug>.md` exist and follow the template?
35
- - Does it accurately describe what changed?
36
- - Is "Things to Look At" honest about tricky spots?
37
- - Is "How to Test Locally" specific enough that the human reviewer can act on it?
15
+ ## Focus Areas
38
16
 
39
- 5. **PIR-Specific Concerns**
40
- - For UI / mobile / cross-platform changes: does the review file explain platform-specific behavior the human should verify?
41
- - For changes with external integrations: are the integration points documented?
17
+ - **Plan Adherence** — the implementation fulfills the approved plan; every "Files to Change" is changed; the change is scoped to the plan, no creep.
18
+ - **Code Quality** — readable and maintainable; no obvious bugs; error cases handled; the change is minimal, with no unrelated refactors.
19
+ - **Test Coverage** — tests are adequate and cover the plan's main path and edge cases; a bug fix has a regression test that would fail without the fix.
20
+ - **Review File Quality** — `codev/reviews/<id>-<slug>.md` exists, follows the template, describes what changed accurately, is honest in "Things to Look At", and specific enough in "How to Test Locally" for the human to act on.
21
+ - **PIR-Specific Concerns** — for UI / mobile / cross-platform changes, the review file explains platform-specific behavior the human should verify; for external integrations, the integration points are documented.
42
22
 
43
23
  ## Verdict Format
44
24
 
45
- After your review, provide your verdict in exactly this format:
25
+ Provide your verdict in exactly this format — `consult` parses it:
46
26
 
47
27
  ```
48
28
  ---
@@ -56,23 +36,10 @@ KEY_ISSUES:
56
36
  ...
57
37
  ```
58
38
 
59
- **Verdict meanings:**
60
- - `APPROVE`: Ready for human at the `dev-approval` gate
61
- - `REQUEST_CHANGES`: Issues that must be fixed before reaching the human
62
- - `COMMENT`: Minor suggestions, can proceed but note feedback
39
+ - `APPROVE`: ready for the human at the `dev-approval` gate.
40
+ - `REQUEST_CHANGES`: issues that must be fixed before reaching the human.
41
+ - `COMMENT`: minor suggestions; can proceed but note the feedback.
63
42
 
64
43
  ## Scope
65
44
 
66
- - **DO** review the implementation against the approved plan
67
- - **DO** flag missing regression tests for bug fixes
68
- - **DO** flag obvious bugs, code smells, security issues
69
- - **DO NOT** redesign the approach — that was settled at `plan-approval`
70
- - **DO NOT** demand changes outside the plan's scope
71
- - **DO NOT** request architecture-level refactors unless the change introduces a clear new problem
72
-
73
- ## Notes
74
-
75
- - This is a pre-gate review; the human is the final authority
76
- - Focus on "is this ready for someone else to test in a browser / simulator"
77
- - If referencing line numbers, use `file:line` format
78
- - The builder needs actionable feedback to iterate
45
+ Review the implementation against the approved plan; flag missing regression tests for bug fixes, and obvious bugs, code smells, or security issues. Do **not** redesign the approach (that was settled at `plan-approval`), demand changes outside the plan's scope, or request architecture-level refactors unless the change introduces a clear new problem. This is a pre-gate review — the human is the final authority; focus on "is this ready for someone else to test in a browser / simulator".
@@ -2,37 +2,19 @@
2
2
 
3
3
  ## Context
4
4
 
5
- You are performing the 3-way review of a PIR protocol PR. The builder has implemented an approved plan, the human has approved the `dev-approval` gate (meaning a human has run the code locally and tested it), and the PR has been opened. This is a single advisory pass (`max_iterations: 1`) — your verdict is surfaced to the human at the `pr` gate, who is the sole remaining reviewer; it is not auto-re-reviewed.
5
+ You are performing the 3-way review of a PIR PR. The builder implemented an approved plan, the human approved the `dev-approval` gate (having run and tested the code locally), and the PR is open. This is a single advisory pass (`max_iterations: 1`) — your verdict is surfaced to the human at the `pr` gate, who is the sole remaining reviewer; it is not auto-re-reviewed.
6
6
 
7
7
  ## Focus Areas
8
8
 
9
- 1. **Completeness**
10
- - Is the PR body the review file content + `Fixes #<N>`?
11
- - Are all commits properly formatted (`[PIR #<N>] ...`)?
12
- - Does the diff match what the review file describes?
13
-
14
- 2. **Test Status**
15
- - Do all tests pass on the branch?
16
- - Is test coverage adequate for the change?
17
- - Are there skipped or flaky tests documented?
18
-
19
- 3. **Code Quality**
20
- - Any debug code left in?
21
- - Any TODO comments that should be resolved?
22
- - Any `// REVIEW:` markers that weren't addressed?
23
-
24
- 4. **Branch Hygiene**
25
- - Is the branch up to date with the default branch? (If not, suggest a rebase. The default branch is whatever `git symbolic-ref --short refs/remotes/origin/HEAD` reports — typically `main`, but may be `dev`, `ci`, etc.)
26
- - Are commits atomic and well-described?
27
- - Is the change diff a reasonable size for the issue scope?
28
-
29
- 5. **Issue Linkage**
30
- - Does the PR body contain `Fixes #<N>` (or `Refs #<N>` for partial fixes)?
31
- - Without this, GitHub won't auto-close the issue on merge
9
+ - **Completeness** — the PR body is the review-file content plus `Fixes #<N>`; commits are formatted `[PIR #<N>] ...`; the diff matches what the review file describes.
10
+ - **Test Status** — all tests pass on the branch, coverage is adequate, and skipped/flaky tests are documented.
11
+ - **Code Quality** — no debug code, no stray `TODO` or unaddressed `// REVIEW:` markers.
12
+ - **Branch Hygiene** — the branch is up to date with the default branch (whatever `git symbolic-ref --short refs/remotes/origin/HEAD` reports — typically `main`, sometimes `dev`/`ci`); commits are atomic; the diff size is reasonable for the issue.
13
+ - **Issue Linkage** — the PR body carries `Fixes #<N>` (or `Refs #<N>` for a partial fix), without which GitHub won't auto-close the issue on merge.
32
14
 
33
15
  ## Verdict Format
34
16
 
35
- After your review, provide your verdict in exactly this format:
17
+ Provide your verdict in exactly this format — `consult` parses it:
36
18
 
37
19
  ```
38
20
  ---
@@ -46,21 +28,10 @@ KEY_ISSUES:
46
28
  ...
47
29
  ```
48
30
 
49
- **Verdict meanings:**
50
- - `APPROVE`: Ready to merge
51
- - `REQUEST_CHANGES`: Issues to fix before merging
52
- - `COMMENT`: Minor items, can merge but note feedback
31
+ - `APPROVE`: ready to merge.
32
+ - `REQUEST_CHANGES`: issues to fix before merging.
33
+ - `COMMENT`: minor items; can merge but note the feedback.
53
34
 
54
35
  ## Scope
55
36
 
56
- - **DO** flag missing `Fixes #<N>` lines
57
- - **DO** flag obvious problems the human reviewer at the gate might have missed
58
- - **DO NOT** redesign the approach — that was settled at `plan-approval` and validated at `dev-approval`
59
- - **DO NOT** demand changes the human reviewer already accepted at the `dev-approval` gate (the human ran the code and approved it; you didn't)
60
- - **DO NOT** flag the syntax of `git diff` examples that appear in review-file prose (e.g., `git diff ci..HEAD` inside a "Files Changed" caption or "How to Test Locally" section). Quoted diff syntax is documentation, not a command. Apply two-dot/three-dot scrutiny only to diffs you compute yourself.
61
-
62
- ## Notes
63
-
64
- - The human at the `dev-approval` gate is the primary reviewer for behavior; you are the secondary reviewer for hygiene and edge cases
65
- - Focus on "what would an integration reviewer catch that the gate reviewer missed"
66
- - If referencing line numbers, use `file:line` format
37
+ Flag a missing `Fixes #<N>` and obvious problems the gate reviewer might have missed. Do **not** redesign the approach (settled at `plan-approval`, validated at `dev-approval`), demand changes the human already accepted at `dev-approval` (they ran the code; you didn't), or flag the syntax of `git diff` examples in review-file prose — quoted diff syntax is documentation, not a command; apply two-dot/three-dot scrutiny only to diffs you compute yourself. You are the secondary reviewer for hygiene and edge cases: "what would an integration reviewer catch that the gate reviewer missed".
@@ -61,7 +61,7 @@ Follow the plan's "Files to Change" section. Apply the changes.
61
61
  [PIR #{{issue.number}}] <Concise description of this commit's change>
62
62
  ```
63
63
 
64
- **Never use `git add .` or `git add -A`.** Stage files explicitly:
64
+ Stage files explicitly:
65
65
 
66
66
  ```bash
67
67
  git add path/to/changed-file.ts
@@ -140,10 +140,9 @@ Then **stay in the interactive session**. Do not exit. Wait for the user's next
140
140
 
141
141
  - **Don't write `codev/reviews/<id>-<slug>.md` in this phase** — it's the next phase's artifact, with a different shape (retrospective with arch + lessons updates)
142
142
  - Don't add features not in the plan — scope creep is a `BLOCKED` signal, not a free expansion
143
- - Don't run `porch approve` yourself
143
+ - Don't run `porch approve` on your own initiative — only when the architect relays the human's approval
144
144
  - Don't push to the default branch — only to your builder branch
145
145
  - Don't squash commits — let the merge commit preserve history
146
- - Don't use `git add .` or `git add -A`
147
146
  - Don't open the PR yet — that's the `review` phase
148
147
  - Don't exit the interactive session at the gate
149
148
 
@@ -87,8 +87,6 @@ git commit -m "[PIR #{{issue.number}}] Plan draft"
87
87
  git push -u origin "$(git branch --show-current)"
88
88
  ```
89
89
 
90
- **Never use `git add .` or `git add -A`.**
91
-
92
90
  ### 5. Signal Phase Complete
93
91
 
94
92
  ```bash
@@ -116,9 +114,8 @@ Then **stay in the interactive session**. Do not exit. Wait for the user's next
116
114
  ## What NOT to Do
117
115
 
118
116
  - Don't write code — that's the implement phase
119
- - Don't run `porch approve` yourself — only the human can approve the gate
117
+ - Don't run `porch approve` on your own initiative — only when the architect relays the human's approval
120
118
  - Don't post the plan content as a GitHub issue comment — the plan lives in the file, not the issue thread. A one-line pointer comment on the issue is fine if you think it helps the discussion.
121
- - Don't use `git add .` or `git add -A`
122
119
  - Don't exit the interactive session at the gate
123
120
 
124
121
  ## Handling Feedback
@@ -238,9 +238,9 @@ Together with the `--pr` record from step 4a and the `--merged` record from step
238
238
 
239
239
  ## What NOT to Do
240
240
 
241
- - **Don't merge before the `pr` gate is approved.** A consultation APPROVE verdict is NOT merge authorization. User-in-pane prose ("looks good", "lgtm", "merge it") is NOT merge authorization. The *only* signal that authorizes `gh pr merge` is porch reporting `gate_status: approved` for the `pr` gate (which only the user can do, via Cmd+K G or `porch approve` from a non-Claude shell). If `porch next` doesn't show the gate as approved, you wait.
241
+ - **Don't merge before the `pr` gate is approved** (steps 8–9). Neither a consultation APPROVE verdict nor user-in-pane prose ("looks good", "lgtm", "merge it") authorizes `gh pr merge` — only porch reporting `gate_status: approved` for the `pr` gate does.
242
242
  - Don't skip porch's PR/merge records (steps 4a, 9). The `--pr` record (step 4a) lets the gate-pending state link to the actual PR; the `--merged` record (step 9) closes the lifecycle in porch state. Skipping either leaves `history:` empty and downstream tooling blind.
243
- - Don't run `porch approve` for any gate yourself
243
+ - Don't run `porch approve` for any gate on your own initiative — only when the architect relays the human's approval
244
244
  - Don't push to the default branch — only merge via PR
245
245
  - Don't skip the Architecture Updates / Lessons Learned sections — porch checks enforce their presence (the section must exist; explaining "no changes needed" in one line is fine)
246
246
  - **Don't run `consult` commands yourself** — porch handles consultations via the `verify` block. Manually invoking `consult` causes the consultation to run twice.
@@ -1,202 +1,79 @@
1
1
  # PIR Protocol
2
2
 
3
- > **Plan → Implement → Review** for GitHub-issue-driven work that needs human review of *either* the approach (before code is written) *or* the implementation (before a PR exists), or both. Lighter than SPIR/ASPIR (no `specify` phase — the GitHub issue is the implicit spec) with the human dev-approval moved earlier (pre-PR instead of post-PR). Stronger than BUGFIX/AIR (two human gates before the PR).
3
+ Plan → Implement → Review, driven by a GitHub issue, with **two human gates before any PR
4
+ exists**. The issue is the implicit spec; there is no specify phase.
4
5
 
5
- ## When to Use PIR
6
+ Choose PIR when either is true:
6
7
 
7
- Pick PIR when working from a GitHub Issue and ONE or BOTH of the following apply — based on the *nature* of the change, not its size:
8
+ - **The approach needs review before coding.** Ambiguous root cause, unfamiliar or
9
+ high-blast-radius area, or a design-sensitive change — cheaper to redirect at plan time than
10
+ at PR time.
11
+ - **The implementation must be exercised running, before a PR exists.** Mobile, UI/UX,
12
+ hardware-adjacent behaviour, OAuth or payment integrations, full user journeys, anything
13
+ performance-sensitive. A diff cannot show you these; a running worktree can.
8
14
 
9
- ### 1. The approach needs review before coding starts
10
- - Root cause is ambiguous; multiple valid fixes exist
11
- - Area is unfamiliar or high-blast-radius (shared utilities, auth, migrations, public APIs)
12
- - Design-sensitive (affects conventions, patterns, architecture)
13
- - Cheaper to redirect at plan time than at PR time
15
+ Lighter than SPIR (no spec phase, one consult at the PR). Stronger than BUGFIX/AIR (two human
16
+ gates *before* a PR, where the human reviews the running code rather than the diff).
14
17
 
15
- ### 2. The implementation needs to be tested before a PR is created
16
- The PR diff alone is insufficient; the reviewer must *run* the code:
17
- - Mobile app changes (needs device testing on Android, iOS, possibly web)
18
- - UI / UX changes (visual inspection, interaction flow, accessibility)
19
- - Hardware-adjacent behavior (sensors, camera, permissions, notifications)
20
- - Integration with external services that don't mock cleanly (OAuth, payments, analytics)
21
- - User-journey changes that need a full-flow exercise
22
- - Performance-sensitive changes that need profiling on the running app
23
-
24
- ### Use SPIR / ASPIR / BUGFIX / AIR instead when
25
- - **SPIR / ASPIR**: the change is complex enough to warrant careful specification, multi-agent consultation at every phase, and the full spec → plan → implement → review ceremony with file artifacts. The driving issue is incidental — what matters is that the design work deserves a formal spec and the implementation deserves consult-driven review at each phase
26
- - **BUGFIX**: small bug fix, no design review needed, diff-on-PR review is enough
27
- - **AIR**: small feature from an issue, autonomous, diff-on-PR review is enough
28
-
29
- ## How PIR Differs from SPIR
30
-
31
- PIR is structurally *SPIR minus the `specify` phase*, with the human dev-approval moved earlier (pre-PR instead of post-PR).
32
-
33
- | Aspect | SPIR | PIR |
34
- |---|---|---|
35
- | Phases | specify → plan → implement → review → verify | plan → implement → review |
36
- | Spec artifact | `codev/specs/<id>-<slug>.md` | GitHub Issue body (implicit spec) |
37
- | Plan artifact | `codev/plans/<id>-<slug>.md` | Same — committed on builder branch |
38
- | Review artifact | `codev/reviews/<id>-<slug>.md` (Summary + Architecture Updates + Lessons Learned, becomes PR body) | **Same shape** — `codev/reviews/<id>-<slug>.md` with the same sections, also becomes PR body |
39
- | Human gates | spec-approval, plan-approval, pr, verify-approval | plan-approval, dev-approval, pr |
40
- | Where code is reviewed by the human | On the PR (post-creation) — read the diff | Pre-PR (at the `dev-approval` gate) — read the diff **and run the worktree locally** |
41
-
42
- The review file always includes Summary, Architecture Updates, and Lessons Learned sections so `codev/reviews/` stays semantically consistent across all protocols. PIR's lightness comes from skipping the `specify` phase (the issue body is the spec), not from cutting corners on the retrospective.
43
-
44
- The `dev-approval` gate is what makes PIR genuinely different: the human gates the *running implementation* via the worktree before the PR exists, instead of gating the PR after creation.
45
-
46
- ## Phases
47
-
48
- ```
49
- plan → implement → review
50
- ```
51
-
52
- ### Plan (gated by `plan-approval`)
53
-
54
- The builder:
55
- 1. Reads the GitHub issue and investigates the codebase
56
- 2. Writes `codev/plans/<id>-<slug>.md` with: Understanding / Proposed change / Files to change / Risks & alternatives / Test plan
57
- 3. Commits the plan on the builder branch and pushes
58
- 4. Runs `porch done` and `porch next` — the `plan-approval` gate becomes pending
59
- 5. Sits at the interactive prompt waiting for review
60
-
61
- **Reviewer paths** (all equivalent):
62
- - Open `codev/plans/<id>-<slug>.md` in the worktree, read and / or edit directly, save
63
- - Type feedback into the builder's PTY pane — the builder is alive in interactive mode
64
- - `afx send <builder-id> "<feedback>"`
65
- - Comment on the GitHub issue (sidecar discussion)
66
-
67
- When satisfied, approve via VSCode's "Approve Gate" command (Cmd+K G) or:
68
-
69
- ```bash
70
- porch approve <id> plan-approval --a-human-explicitly-approved-this
71
- ```
72
-
73
- ### Implement (gated by `dev-approval`)
74
-
75
- The builder:
76
- 1. Reads the approved plan file
77
- 2. Writes code and tests; runs build + tests via the `checks` block
78
- 3. *No AI consult on this phase* — the human at the `dev-approval` gate is the sole reviewer of the running code. Matches BUGFIX / AIR's pattern of "no consult on implementation, one consult at PR creation".
79
- 4. Pushes the branch
80
- 5. Runs `porch done` and `porch next` — the `dev-approval` gate becomes pending
81
- 6. Outputs a **prose** dev-approval summary in the PTY pane (Summary / Files / Test results / Things to look at / How to test locally). This is a transient message to orient the human reviewer — **not a committed file**. The retrospective file is written in the next phase, after the human approves the running code.
82
- 7. Sits at the interactive prompt
83
-
84
- **The reviewer's killer move**: run the worktree locally.
85
-
86
- - VSCode: right-click the builder in the Codev sidebar → **Run Dev** (spawns `afx dev <builder-id>` via Tower)
87
- - CLI: `afx dev <builder-id>`
88
-
89
- The dev process uses **the same ports and URLs as main** intentionally (OAuth callbacks, CORS, cookie scoping all depend on consistent origins). Only one dev env runs at a time; stop main's `pnpm dev` before starting the worktree's, or use VSCode's **Stop Dev** to swap.
90
-
91
- Reviewer tests the change on real devices / browsers / simulators. When satisfied, approves via Cmd+K G or:
92
-
93
- ```bash
94
- porch approve <id> dev-approval --a-human-explicitly-approved-this
95
- ```
96
-
97
- ### Review (gated by `pr`)
98
-
99
- The builder:
100
- 1. Writes `codev/reviews/<id>-<slug>.md` with **Summary**, **Architecture Updates**, **Lessons Learned Updates**, plus the supporting sections (Files Changed, Commits, Test Results, Things to Look At, How to Test Locally).
101
- 2. Routes new facts/wisdom by tier (Spec 987) — HOT `codev/resources/arch-critical.md` / `lessons-critical.md` (capped) or COLD `codev/resources/arch.md` / `lessons-learned.md` (reference) — if real changes need recording. If not, the review file's sections state "no changes needed" with a one-line explanation (the porch `checks` block enforces section presence, not content).
102
- 3. Commits the review file (and arch / lessons updates if any) and pushes
103
- 4. Opens a PR with `gh pr create`; PR body is the review file content + `Fixes #<N>`. Records the PR with `porch done <id> --pr <M> --branch <name>`.
104
- 5. Runs `porch done <id>` — porch's `verify` block runs 3-way consultation (Gemini, Codex, Claude; type=impl) as a **single advisory pass** (`max_iterations: 1`); consultation outputs land in `codev/projects/<id>-*/`. There is no iterate-until-APPROVE loop: whatever the verdicts, porch records them and advances to the `pr` gate. A `REQUEST_CHANGES` is not auto-re-reviewed — the builder addresses or rebuts it, adds a regression test if it's a real defect, and escalates it in the architect notification so the human verifies it at the `pr` gate. Outcomes are not auto-appended to the PR body; reviewers with the worktree read them from the projects dir.
105
- 6. The `pr` gate fires (pending) regardless of verdict. Builder notifies the architect once — leading with any `REQUEST_CHANGES` and its disposition (since PIR will not re-review it) rather than burying it in a flat status line.
106
- 7. Builder waits at the `pr` gate. The human reviews the PR on GitHub, then approves the `pr` gate (Cmd+K G or `porch approve <id> pr --a-human-explicitly-approved-this`). Porch wakes the builder.
107
- 8. Builder verifies the gate is genuinely approved via `porch next` (defensive — typed prose can't trigger this branch, only real porch state does), then runs `gh pr merge --merge`, records via `porch done --merged <M>`, and sends the cleanup-ready notification. Protocol complete (`next: null`).
108
-
109
- ## Gates
110
-
111
- PIR uses porch's existing gate machinery. Gate names are opaque strings; no porch engine changes are needed.
112
-
113
- - **`plan-approval`** — pre-PR. Human reads the plan file (committed on the builder branch) and approves before any code is written. Gates are keyed by `(project_id, gate_name)` so the name is safe to share with other protocols.
114
- - **`dev-approval`** — pre-PR. The human reviews the *running* worktree (via `afx dev`) before any PR exists. This is PIR's distinctive gate.
115
- - **`pr`** — post-PR. Gates the merge step. The human reviews the PR on GitHub and approves this gate; porch wakes the builder, which then runs `gh pr merge`. The gate exists so the merge trigger is structured porch state (binary approved/not), not free-text prose typed into the builder's pane. Eliminates the self-merge bug class: builders can't infer authorization from ambiguous user input.
116
-
117
- When a gate becomes pending, porch broadcasts `overview-changed` via SSE. The VSCode Builders tree picks up the blocked state and renders it with a bell icon; a toast surfaces the new gate-pending event. Architect notification is *not* automatic — gates surface via the toast/sidebar (for IDE users) or by checking the builder pane / `porch pending` (for CLI users). The builder's job at any gate is to write the artifact, commit, signal completion, and wait — never to invoke `porch approve` itself (Claude refuses the `--a-human-explicitly-approved-this` flag by design).
118
-
119
- ## Rejection / Feedback Model
120
-
121
- There is no formal `porch reject` command. Rejection works via the feedback-iterate pattern:
122
-
123
- 1. Reviewer provides feedback (edit the plan file in VSCode, type in the builder pane, `afx send`, or issue comment)
124
- 2. Builder reads the feedback on its next turn, revises the artifact, recommits
125
- 3. The gate remains pending — porch doesn't advance until the human runs `porch approve`
126
-
127
- The same pattern works at both gates.
128
-
129
- ## Builder Session Lifetime
130
-
131
- The builder is a long-running interactive Claude Code session in a PTY pane managed by Tower. The session is launched as `claude "<prompt>"` (no `--print`) inside a `while true` restart loop. That form starts an interactive Claude REPL with the prompt as the first user message; after Claude finishes the prompted work it sits at the input prompt awaiting next user input. The outer `while true` loop only fires if Claude crashes — it is a crash-recovery safety net, not the gate-wait mechanism.
132
-
133
- This means typed input in the builder pane reaches the live Claude session immediately, exactly like any other interactive Claude Code conversation. There is no "session ended at gate" state to worry about under normal operation.
134
-
135
- ## Configuration
136
-
137
- PIR uses the same `.codev/config.json` configuration as other protocols. The `worktree` block (from Issue 689) enables the at-gate dev review flow:
18
+ ## The state machine
138
19
 
139
20
  ```json
140
- {
141
- "worktree": {
142
- "symlinks": [".env.local", "packages/*/.env"],
143
- "postSpawn": ["pnpm install --frozen-lockfile"],
144
- "devCommand": "pnpm dev"
145
- }
146
- }
21
+ {{> protocols/pir/protocol.json}}
147
22
  ```
148
23
 
149
- Without `worktree.devCommand`, `afx dev` won't work and the `dev-approval` gate degenerates to a diff-read — at which point you should probably use AIR or BUGFIX instead.
150
-
151
- ## Multi-Agent Consultation
152
-
153
- - **plan**: human-only review. No AI consultation.
154
- - **implement**: no AI consult — the human at the `dev-approval` gate is the sole reviewer of the running code.
155
- - **review**: 3-way consultation (Gemini, Codex, Claude; type=impl) after the PR is opened, as a **single advisory pass** (`max_iterations: 1`). Same consult type (`impl`) as BUGFIX / AIR's PR-creation consult.
156
-
157
- The consultation at the PR is a single pass — there is **no iterate-until-APPROVE loop**. A `REQUEST_CHANGES` does not block or re-trigger it; the builder addresses or rebuts it and escalates it to the human at the `pr` gate, who is the sole remaining reviewer of any resulting fix (the consultation does not re-check it).
158
-
159
- Net: PIR's distinguishing features are the two human gates (`plan-approval`, `dev-approval`), not AI-consult density.
24
+ ## Gates
160
25
 
161
- To disable consultation entirely, say "without multi-agent consultation" when starting work.
26
+ Gate names are opaque strings keyed by `(project_id, gate_name)`, so sharing a name with another
27
+ protocol is safe and needs no porch change.
162
28
 
163
- ## Signals
29
+ | Gate | When | What the human does |
30
+ |---|---|---|
31
+ | `plan-approval` | pre-PR | Reads the plan committed on the builder branch, before any code exists |
32
+ | `dev-approval` | pre-PR | **PIR's distinctive gate** — reviews the *running* worktree via `afx dev` |
33
+ | `pr` | post-PR | Reviews on GitHub, then approves; porch wakes the builder to merge |
164
34
 
165
- PIR uses the standard porch signal vocabulary:
35
+ The `pr` gate holds the merge behind porch state: the human approves, the architect relays that
36
+ approval, and the builder records it with `porch approve pr` before porch hands over the merge task.
166
37
 
167
- ```
168
- <signal>PHASE_COMPLETE</signal> # Current phase build complete
169
- <signal>BLOCKED:reason</signal> # Cannot proceed
170
- ```
38
+ **Gates do not notify the architect automatically.** Porch broadcasts `overview-changed` over
39
+ SSE; the VSCode Builders tree renders the blocked state with a bell and raises a toast. CLI
40
+ users see it via the builder pane or `porch pending`. The builder's job at any gate is: write
41
+ the artifact, commit, signal, wait — then run `porch approve` when the architect relays the human's
42
+ approval, never on your own initiative.
171
43
 
172
- Signals are informational for log readability. The state machine is driven by `porch done` and `porch next` CLI calls inside the builder turn.
44
+ ## Rejection is iteration, not a command
173
45
 
174
- ## Commit Messages
46
+ There is no `porch reject`. Feedback arrives however is convenient — editing the plan file,
47
+ typing in the builder pane, `afx send`, an issue comment — the builder revises and recommits,
48
+ and **the gate stays pending until a human approves it**. The same pattern works at both
49
+ pre-PR gates.
175
50
 
176
- Commits during PIR phases use the issue-driven format:
51
+ ## Artifacts
177
52
 
178
- ```
179
- [PIR #<N>] Plan draft
180
- [PIR #<N>] Implement avatar masking
181
- [PIR #<N>] Add Android-side regression test
182
- ```
53
+ Plan and review live in `codev/plans/` and `codev/reviews/` on the builder branch and ship to
54
+ the default branch with the merge. The review is shaped like SPIR's (Summary, Architecture
55
+ Updates, Lessons Learned) so `codev/reviews/` stays semantically consistent across protocols.
183
56
 
184
- The PR title follows the project's existing PR convention.
57
+ ## Consultation
185
58
 
186
- ## Branch Naming
59
+ **One advisory CMAP pass at the PR** (`max_iterations: 1`) — no iterate-until-APPROVE loop. A
60
+ `REQUEST_CHANGES` escalates to the human at the `pr` gate rather than triggering an automatic
61
+ re-review.
187
62
 
188
- ```
189
- builder/pir-<issue-number>
190
- ```
63
+ That footprint is a **design invariant, and it is fragile**: porch resolves models as
64
+ *config > protocol*, so a project-wide `porch.consultation.models` (say a SPIR-tuned 3-model
65
+ list) silently inflates PIR's cost. Leave it unset, or scope it per-protocol.
191
66
 
192
- Example: `builder/pir-842` for a PIR spawn against GitHub issue #842.
67
+ ## Builder session
193
68
 
194
- ## File Locations
69
+ A long-running interactive session in a Tower-managed PTY, launched as `claude "<prompt>"`
70
+ inside a restart loop and pinned to a session id minted at spawn. Typed input reaches the live
71
+ session immediately; the loop is crash recovery, not the gate-wait mechanism. There is no
72
+ "session ended at gate" state. On a crash the loop **resumes the pinned conversation** (context
73
+ intact, plus a re-orientation nudge) rather than replaying the spawn prompt; only an unresumable
74
+ session degrades to a fresh prompt-replay relaunch. A deliberate quit relaunches fresh.
195
75
 
196
- ```
197
- codev/plans/<id>-<slug>.md # written in plan phase, on builder branch
198
- codev/reviews/<id>-<slug>.md # written in review phase (post-dev-approval-approval), on builder branch; becomes PR body
199
- codev/projects/<id>-<slug>/status.yaml # porch state, managed automatically
200
- ```
76
+ ## Configuration
201
77
 
202
- The plan and review files ship to `main` with the merged PR — durable, searchable, git-versioned. The review file includes Summary + Architecture Updates + Lessons Learned + supporting sections, so `codev/reviews/` stays semantically consistent across protocols.
78
+ The `worktree` block in `.codev/config.json` is what makes the `dev-approval` gate work — see
79
+ the `runnable-worktrees` skill for `symlinks`, `postSpawn` and `devCommand`.
@@ -1,91 +1,60 @@
1
1
  # {{protocol_name}} Builder ({{mode}} mode)
2
2
 
3
- You are conducting multi-agent research.
3
+ You are implementing {{input_description}}.
4
4
 
5
5
  {{#if mode_soft}}
6
6
  ## Mode: SOFT
7
- You are running in SOFT mode. This means:
8
- - You follow the RESEARCH protocol yourself (no porch orchestration)
9
- - The architect monitors your work and verifies you're adhering to the protocol
10
- - Use `consult` for the 3-way investigation and critique phases
7
+
8
+ You follow the protocol yourself; the architect verifies compliance.
11
9
  {{/if}}
12
10
 
13
11
  {{#if mode_strict}}
14
12
  ## 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 consultation** — always follow porch next → porch done cycle
13
+
14
+ Porch orchestrates. `porch next` gives you tasks; `porch done` signals completion. Never
15
+ hand-edit `status.yaml` — only porch commands modify project state.
24
16
  {{/if}}
25
17
 
26
18
  ## Protocol
27
- Follow the RESEARCH protocol. Read and internalize the protocol before starting any work. The full protocol text is included below under **## Protocol Reference (full text)**.
28
19
 
29
- ## RESEARCH Overview
20
+ The full protocol text is inlined below under **## Protocol Reference (full text)** — you do not
21
+ need to fetch it.
30
22
 
31
- The RESEARCH protocol produces a high-confidence research report through triangulation:
23
+ ## Research Topic
32
24
 
33
- 1. **Scope** — Define the precise question, scope, and acceptance criteria. Write a research brief. Gate: architect approval before proceeding.
34
- 2. **Investigate** — Dispatch the brief to 3 models (Gemini, Codex, Claude) in parallel. Each investigates independently. No anchoring — they don't see each other's work.
35
- 3. **Synthesize** — Read all 3 reports. Identify consensus, disagreements, and unique contributions. Write a single synthesis report organized by topic (not by model).
36
- 4. **Critique** — Send the synthesis back to all 3 models for critique. Incorporate valid feedback. Document rejected critique. Finalize the report.
25
+ {{task_text}}
37
26
 
38
- ## Output Location
27
+ ## Output
39
28
 
40
- All artifacts go to `codev/research/`:
41
- - `<topic>-brief.md` — the scoped question (Phase 1)
42
- - `<topic>-gemini.md`, `<topic>-codex.md`, `<topic>-claude.md` — individual investigations (Phase 2)
43
- - `<topic>.md` — the final synthesis report (Phase 3+4, this is the deliverable)
44
- - `<topic>-critique-rebuttals.md` — critique responses (Phase 4)
45
-
46
- {{#if task}}
47
- ## Research Topic
48
- {{task_text}}
49
- {{/if}}
29
+ `codev/research/<topic>.md`
50
30
 
51
31
  ## Key Principles
52
32
 
53
- - **Triangulate**: consensus across 3 models > any single model's claim
54
- - **Cite sources**: tell investigators to provide sources where possible
55
- - **Be candid about uncertainty**: "I don't know" > confabulation
56
- - **Organize by topic, not by model**: the synthesis is a standalone document
57
- - **Note surprises**: the most valuable findings are often unexpected
58
- - **Keep it concise**: the synthesis should be shorter than the sum of the investigations
59
-
60
- ## Using consult for 3-way Investigation
33
+ - **Triangulate**: consensus across three models beats any single model's claim
34
+ - **Cite sources**; be candid about uncertainty — "I don't know" beats confabulation
35
+ - **Organize by topic, not by model** — the synthesis is a standalone document
36
+ - **Note surprises**: the most valuable findings are usually the unexpected ones
37
+ - **Preserve disagreement**: smoothing over conflict destroys the signal that made a 3-way
38
+ investigation worth running
39
+ - Keep the synthesis shorter than the sum of its investigations
61
40
 
62
- For the investigate phase, use the `consult` CLI to dispatch to each model:
41
+ ## Dispatching the investigation
63
42
 
64
43
  ```bash
65
- # Phase 2: parallel investigation
44
+ # investigate — parallel, independent
66
45
  consult -m gemini --prompt-file codev/research/<topic>-brief.md --output codev/research/<topic>-gemini.md &
67
- consult -m codex --prompt-file codev/research/<topic>-brief.md --output codev/research/<topic>-codex.md &
46
+ consult -m codex --prompt-file codev/research/<topic>-brief.md --output codev/research/<topic>-codex.md &
68
47
  consult -m claude --prompt-file codev/research/<topic>-brief.md --output codev/research/<topic>-claude.md &
69
48
  wait
70
- ```
71
49
 
72
- For the critique phase:
73
- ```bash
74
- # Phase 4: parallel critique
50
+ # critique — same shape, pointed at the synthesis
75
51
  consult -m gemini --prompt "Critique this research synthesis for gaps, errors, and bias:" --prompt-file codev/research/<topic>.md --output codev/research/<topic>-critique-gemini.md &
76
- consult -m codex --prompt "Critique this research synthesis for gaps, errors, and bias:" --prompt-file codev/research/<topic>.md --output codev/research/<topic>-critique-codex.md &
52
+ consult -m codex --prompt "Critique this research synthesis for gaps, errors, and bias:" --prompt-file codev/research/<topic>.md --output codev/research/<topic>-critique-codex.md &
77
53
  consult -m claude --prompt "Critique this research synthesis for gaps, errors, and bias:" --prompt-file codev/research/<topic>.md --output codev/research/<topic>-critique-claude.md &
78
54
  wait
79
55
  ```
80
56
 
81
- ## Getting Started
82
- 1. Read the RESEARCH protocol document
83
- 2. Understand the research question from the architect
84
- 3. Write the research brief (Phase 1)
85
- 4. Wait for scope-approval before proceeding to investigation
86
-
87
- ---
88
-
89
- ## Protocol Reference (full text)
57
+ ## Notifications
90
58
 
91
- {{protocol_reference}}
59
+ The architect is not watching. `afx send architect "..."` at each of: gate reached, PR ready, PR
60
+ merged, blocked.