@cluesmith/codev 3.0.0 → 3.0.2

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 (311) hide show
  1. package/LICENSE +201 -0
  2. package/bin/af.js +2 -2
  3. package/bin/afx.js +8 -0
  4. package/bin/consult.js +2 -1
  5. package/bin/team.js +2 -1
  6. package/{dashboard/dist/assets/index-nr0cXxtf.css → dashboard-dist/assets/index-BWYZtvwm.css} +1 -1
  7. package/dashboard-dist/assets/index-Dn9zmcKp.js +195 -0
  8. package/dashboard-dist/assets/index-Dn9zmcKp.js.map +1 -0
  9. package/{dashboard/dist → dashboard-dist}/index.html +2 -2
  10. package/dist/agent-farm/cli.d.ts.map +1 -1
  11. package/dist/agent-farm/cli.js +27 -19
  12. package/dist/agent-farm/cli.js.map +1 -1
  13. package/dist/agent-farm/commands/architect.d.ts +4 -4
  14. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  15. package/dist/agent-farm/commands/architect.js +23 -12
  16. package/dist/agent-farm/commands/architect.js.map +1 -1
  17. package/dist/agent-farm/commands/attach.d.ts.map +1 -1
  18. package/dist/agent-farm/commands/attach.js +101 -11
  19. package/dist/agent-farm/commands/attach.js.map +1 -1
  20. package/dist/agent-farm/commands/bench.d.ts +1 -1
  21. package/dist/agent-farm/commands/bench.js +1 -1
  22. package/dist/agent-farm/commands/cron.js +1 -1
  23. package/dist/agent-farm/commands/cron.js.map +1 -1
  24. package/dist/agent-farm/commands/db.d.ts +3 -3
  25. package/dist/agent-farm/commands/db.js +4 -4
  26. package/dist/agent-farm/commands/db.js.map +1 -1
  27. package/dist/agent-farm/commands/open.js +2 -2
  28. package/dist/agent-farm/commands/open.js.map +1 -1
  29. package/dist/agent-farm/commands/rename.js +1 -1
  30. package/dist/agent-farm/commands/rename.js.map +1 -1
  31. package/dist/agent-farm/commands/send.js +3 -3
  32. package/dist/agent-farm/commands/send.js.map +1 -1
  33. package/dist/agent-farm/commands/shell.js +3 -3
  34. package/dist/agent-farm/commands/shell.js.map +1 -1
  35. package/dist/agent-farm/commands/spawn-roles.d.ts +9 -5
  36. package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -1
  37. package/dist/agent-farm/commands/spawn-roles.js +48 -28
  38. package/dist/agent-farm/commands/spawn-roles.js.map +1 -1
  39. package/dist/agent-farm/commands/spawn-worktree.d.ts +5 -5
  40. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  41. package/dist/agent-farm/commands/spawn-worktree.js +80 -13
  42. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  43. package/dist/agent-farm/commands/spawn.d.ts +6 -6
  44. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  45. package/dist/agent-farm/commands/spawn.js +90 -53
  46. package/dist/agent-farm/commands/spawn.js.map +1 -1
  47. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  48. package/dist/agent-farm/commands/status.js +48 -3
  49. package/dist/agent-farm/commands/status.js.map +1 -1
  50. package/dist/agent-farm/commands/team-update.d.ts +1 -1
  51. package/dist/agent-farm/commands/team-update.js +1 -1
  52. package/dist/agent-farm/commands/team.d.ts +1 -1
  53. package/dist/agent-farm/commands/team.js +1 -1
  54. package/dist/agent-farm/commands/tower-cloud.d.ts +2 -2
  55. package/dist/agent-farm/commands/tower-cloud.js +3 -3
  56. package/dist/agent-farm/commands/tower-cloud.js.map +1 -1
  57. package/dist/agent-farm/commands/tower.js +2 -2
  58. package/dist/agent-farm/commands/tower.js.map +1 -1
  59. package/dist/agent-farm/db/index.d.ts.map +1 -1
  60. package/dist/agent-farm/db/index.js +47 -0
  61. package/dist/agent-farm/db/index.js.map +1 -1
  62. package/dist/agent-farm/db/schema.d.ts +1 -1
  63. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  64. package/dist/agent-farm/db/schema.js +1 -1
  65. package/dist/agent-farm/db/types.d.ts +1 -1
  66. package/dist/agent-farm/lib/cloud-config.js +2 -2
  67. package/dist/agent-farm/lib/cloud-config.js.map +1 -1
  68. package/dist/agent-farm/lib/tower-client.d.ts +6 -230
  69. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  70. package/dist/agent-farm/lib/tower-client.js +6 -293
  71. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  72. package/dist/agent-farm/lib/tunnel-client.js +1 -1
  73. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  74. package/dist/agent-farm/servers/message-write.d.ts +24 -0
  75. package/dist/agent-farm/servers/message-write.d.ts.map +1 -0
  76. package/dist/agent-farm/servers/message-write.js +63 -0
  77. package/dist/agent-farm/servers/message-write.js.map +1 -0
  78. package/dist/agent-farm/servers/overview.d.ts +4 -1
  79. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  80. package/dist/agent-farm/servers/overview.js +38 -5
  81. package/dist/agent-farm/servers/overview.js.map +1 -1
  82. package/dist/agent-farm/servers/send-buffer.d.ts +4 -3
  83. package/dist/agent-farm/servers/send-buffer.d.ts.map +1 -1
  84. package/dist/agent-farm/servers/send-buffer.js +7 -4
  85. package/dist/agent-farm/servers/send-buffer.js.map +1 -1
  86. package/dist/agent-farm/servers/tower-cron-parser.js +1 -1
  87. package/dist/agent-farm/servers/tower-cron-parser.js.map +1 -1
  88. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  89. package/dist/agent-farm/servers/tower-cron.js +4 -5
  90. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  91. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  92. package/dist/agent-farm/servers/tower-instances.js +6 -5
  93. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  94. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  95. package/dist/agent-farm/servers/tower-routes.js +19 -16
  96. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  97. package/dist/agent-farm/servers/tower-server.js +19 -4
  98. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  99. package/dist/agent-farm/servers/tower-terminals.d.ts +2 -2
  100. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  101. package/dist/agent-farm/servers/tower-terminals.js +47 -18
  102. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  103. package/dist/agent-farm/servers/tower-tunnel.js +2 -2
  104. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  105. package/dist/agent-farm/servers/tower-utils.d.ts +9 -6
  106. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  107. package/dist/agent-farm/servers/tower-utils.js +12 -6
  108. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  109. package/dist/agent-farm/state.js +1 -1
  110. package/dist/agent-farm/state.js.map +1 -1
  111. package/dist/agent-farm/types.d.ts +11 -2
  112. package/dist/agent-farm/types.d.ts.map +1 -1
  113. package/dist/agent-farm/utils/config.d.ts +11 -0
  114. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  115. package/dist/agent-farm/utils/config.js +21 -0
  116. package/dist/agent-farm/utils/config.js.map +1 -1
  117. package/dist/agent-farm/utils/harness.d.ts +85 -0
  118. package/dist/agent-farm/utils/harness.d.ts.map +1 -0
  119. package/dist/agent-farm/utils/harness.js +212 -0
  120. package/dist/agent-farm/utils/harness.js.map +1 -0
  121. package/dist/agent-farm/utils/server-utils.d.ts +13 -0
  122. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  123. package/dist/agent-farm/utils/server-utils.js +38 -0
  124. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  125. package/dist/cli.d.ts +1 -1
  126. package/dist/cli.d.ts.map +1 -1
  127. package/dist/cli.js +19 -5
  128. package/dist/cli.js.map +1 -1
  129. package/dist/commands/adopt.js +2 -2
  130. package/dist/commands/adopt.js.map +1 -1
  131. package/dist/commands/consult/index.d.ts +37 -3
  132. package/dist/commands/consult/index.d.ts.map +1 -1
  133. package/dist/commands/consult/index.js +220 -150
  134. package/dist/commands/consult/index.js.map +1 -1
  135. package/dist/commands/doctor.d.ts.map +1 -1
  136. package/dist/commands/doctor.js +54 -8
  137. package/dist/commands/doctor.js.map +1 -1
  138. package/dist/commands/init.js +1 -1
  139. package/dist/commands/init.js.map +1 -1
  140. package/dist/commands/porch/artifacts.d.ts +69 -0
  141. package/dist/commands/porch/artifacts.d.ts.map +1 -0
  142. package/dist/commands/porch/artifacts.js +368 -0
  143. package/dist/commands/porch/artifacts.js.map +1 -0
  144. package/dist/commands/porch/checks.d.ts +8 -1
  145. package/dist/commands/porch/checks.d.ts.map +1 -1
  146. package/dist/commands/porch/checks.js +98 -1
  147. package/dist/commands/porch/checks.js.map +1 -1
  148. package/dist/commands/porch/index.d.ts +18 -7
  149. package/dist/commands/porch/index.d.ts.map +1 -1
  150. package/dist/commands/porch/index.js +299 -61
  151. package/dist/commands/porch/index.js.map +1 -1
  152. package/dist/commands/porch/next.d.ts.map +1 -1
  153. package/dist/commands/porch/next.js +72 -74
  154. package/dist/commands/porch/next.js.map +1 -1
  155. package/dist/commands/porch/notify.d.ts +2 -2
  156. package/dist/commands/porch/notify.js +5 -5
  157. package/dist/commands/porch/notify.js.map +1 -1
  158. package/dist/commands/porch/prompts.d.ts +2 -1
  159. package/dist/commands/porch/prompts.d.ts.map +1 -1
  160. package/dist/commands/porch/prompts.js +23 -14
  161. package/dist/commands/porch/prompts.js.map +1 -1
  162. package/dist/commands/porch/state.d.ts +27 -2
  163. package/dist/commands/porch/state.d.ts.map +1 -1
  164. package/dist/commands/porch/state.js +96 -9
  165. package/dist/commands/porch/state.js.map +1 -1
  166. package/dist/commands/porch/types.d.ts +8 -0
  167. package/dist/commands/porch/types.d.ts.map +1 -1
  168. package/dist/lib/config.d.ts +14 -0
  169. package/dist/lib/config.d.ts.map +1 -1
  170. package/dist/lib/config.js +7 -0
  171. package/dist/lib/config.js.map +1 -1
  172. package/dist/lib/forge-contracts.d.ts +10 -1
  173. package/dist/lib/forge-contracts.d.ts.map +1 -1
  174. package/dist/lib/forge-contracts.js.map +1 -1
  175. package/dist/lib/forge.d.ts.map +1 -1
  176. package/dist/lib/forge.js +25 -7
  177. package/dist/lib/forge.js.map +1 -1
  178. package/dist/lib/team-github.d.ts +49 -0
  179. package/dist/lib/team-github.d.ts.map +1 -1
  180. package/dist/lib/team-github.js +115 -6
  181. package/dist/lib/team-github.js.map +1 -1
  182. package/dist/terminal/pty-manager.d.ts.map +1 -1
  183. package/dist/terminal/pty-manager.js +2 -0
  184. package/dist/terminal/pty-manager.js.map +1 -1
  185. package/dist/terminal/ws-protocol.d.ts +10 -8
  186. package/dist/terminal/ws-protocol.d.ts.map +1 -1
  187. package/dist/terminal/ws-protocol.js +3 -0
  188. package/dist/terminal/ws-protocol.js.map +1 -1
  189. package/package.json +28 -25
  190. package/scripts/forge/gitea/auth-status.sh +0 -0
  191. package/scripts/forge/gitea/issue-comment.sh +0 -0
  192. package/scripts/forge/gitea/issue-list.sh +0 -0
  193. package/scripts/forge/gitea/issue-view.sh +0 -0
  194. package/scripts/forge/gitea/pr-exists.sh +4 -1
  195. package/scripts/forge/gitea/pr-list.sh +0 -0
  196. package/scripts/forge/gitea/pr-merge.sh +0 -0
  197. package/scripts/forge/gitea/pr-view.sh +0 -0
  198. package/scripts/forge/gitea/recently-closed.sh +0 -0
  199. package/scripts/forge/gitea/recently-merged.sh +0 -0
  200. package/scripts/forge/gitea/repo-archive.sh +0 -0
  201. package/scripts/forge/gitea/user-identity.sh +0 -0
  202. package/scripts/forge/github/auth-status.sh +0 -0
  203. package/scripts/forge/github/issue-comment.sh +0 -0
  204. package/scripts/forge/github/issue-list.sh +2 -2
  205. package/scripts/forge/github/issue-view.sh +0 -0
  206. package/scripts/forge/github/on-it-timestamps.sh +0 -0
  207. package/scripts/forge/github/pr-diff.sh +0 -0
  208. package/scripts/forge/github/pr-exists.sh +3 -1
  209. package/scripts/forge/github/pr-list.sh +2 -2
  210. package/scripts/forge/github/pr-merge.sh +0 -0
  211. package/scripts/forge/github/pr-search.sh +0 -0
  212. package/scripts/forge/github/pr-view.sh +0 -0
  213. package/scripts/forge/github/recently-closed.sh +0 -0
  214. package/scripts/forge/github/recently-merged.sh +0 -0
  215. package/scripts/forge/github/repo-archive.sh +0 -0
  216. package/scripts/forge/github/team-activity.sh +0 -0
  217. package/scripts/forge/github/user-identity.sh +0 -0
  218. package/scripts/forge/gitlab/auth-status.sh +0 -0
  219. package/scripts/forge/gitlab/issue-comment.sh +0 -0
  220. package/scripts/forge/gitlab/issue-list.sh +0 -0
  221. package/scripts/forge/gitlab/issue-view.sh +0 -0
  222. package/scripts/forge/gitlab/pr-diff.sh +0 -0
  223. package/scripts/forge/gitlab/pr-exists.sh +3 -1
  224. package/scripts/forge/gitlab/pr-list.sh +0 -0
  225. package/scripts/forge/gitlab/pr-merge.sh +0 -0
  226. package/scripts/forge/gitlab/pr-search.sh +0 -0
  227. package/scripts/forge/gitlab/pr-view.sh +0 -0
  228. package/scripts/forge/gitlab/recently-closed.sh +0 -0
  229. package/scripts/forge/gitlab/recently-merged.sh +0 -0
  230. package/scripts/forge/gitlab/repo-archive.sh +0 -0
  231. package/scripts/forge/gitlab/user-identity.sh +0 -0
  232. package/scripts/forge/linear/auth-status.sh +15 -0
  233. package/scripts/forge/linear/issue-comment.sh +38 -0
  234. package/scripts/forge/linear/issue-list.sh +35 -0
  235. package/scripts/forge/linear/issue-view.sh +37 -0
  236. package/scripts/forge/linear/recently-closed.sh +45 -0
  237. package/scripts/forge/linear/user-identity.sh +15 -0
  238. package/scripts/postinstall.mjs +51 -0
  239. package/skeleton/.claude/skills/afx/SKILL.md +144 -0
  240. package/skeleton/.claude/skills/codev/SKILL.md +3 -3
  241. package/skeleton/.claude/skills/consult/SKILL.md +1 -1
  242. package/skeleton/.claude/skills/porch/SKILL.md +2 -2
  243. package/skeleton/.claude/skills/update-arch-docs/SKILL.md +107 -0
  244. package/skeleton/DEPENDENCIES.md +1 -1
  245. package/skeleton/builders.md +4 -4
  246. package/skeleton/protocol-schema.json +2 -2
  247. package/skeleton/protocols/air/builder-prompt.md +6 -6
  248. package/skeleton/protocols/air/prompts/pr.md +17 -5
  249. package/skeleton/protocols/air/protocol.md +1 -2
  250. package/skeleton/protocols/aspir/builder-prompt.md +28 -6
  251. package/skeleton/protocols/aspir/prompts/review.md +11 -0
  252. package/skeleton/protocols/aspir/protocol.json +9 -1
  253. package/skeleton/protocols/aspir/protocol.md +1 -1
  254. package/skeleton/protocols/aspir/templates/plan.md +0 -20
  255. package/skeleton/protocols/aspir/templates/spec.md +0 -28
  256. package/skeleton/protocols/bugfix/builder-prompt.md +6 -6
  257. package/skeleton/protocols/bugfix/prompts/pr.md +16 -4
  258. package/skeleton/protocols/experiment/builder-prompt.md +15 -0
  259. package/skeleton/protocols/experiment/protocol.md +1 -6
  260. package/skeleton/protocols/maintain/builder-prompt.md +12 -11
  261. package/skeleton/protocols/maintain/prompts/maintain.md +88 -0
  262. package/skeleton/protocols/maintain/prompts/review.md +84 -0
  263. package/skeleton/protocols/maintain/protocol.json +14 -68
  264. package/skeleton/protocols/maintain/protocol.md +163 -394
  265. package/skeleton/protocols/maintain/templates/maintenance-run.md +18 -49
  266. package/skeleton/protocols/protocol-schema.json +1 -1
  267. package/skeleton/protocols/research/builder-prompt.md +85 -0
  268. package/skeleton/protocols/research/protocol.json +118 -0
  269. package/skeleton/protocols/research/protocol.md +169 -0
  270. package/skeleton/protocols/spike/builder-prompt.md +1 -1
  271. package/skeleton/protocols/spike/protocol.md +4 -4
  272. package/skeleton/protocols/spir/builder-prompt.md +28 -5
  273. package/skeleton/protocols/spir/prompts/review.md +11 -0
  274. package/skeleton/protocols/spir/protocol.json +9 -1
  275. package/skeleton/protocols/spir/protocol.md +6 -5
  276. package/skeleton/protocols/spir/templates/plan.md +0 -20
  277. package/skeleton/protocols/spir/templates/spec.md +0 -28
  278. package/skeleton/resources/commands/agent-farm.md +84 -84
  279. package/skeleton/resources/commands/codev.md +1 -1
  280. package/skeleton/resources/commands/consult.md +16 -7
  281. package/skeleton/resources/commands/overview.md +14 -15
  282. package/skeleton/resources/risk-triage.md +2 -2
  283. package/skeleton/resources/workflow-reference.md +14 -14
  284. package/skeleton/roles/architect.md +39 -39
  285. package/skeleton/roles/builder.md +22 -14
  286. package/skeleton/templates/AGENTS.md +5 -3
  287. package/skeleton/templates/CLAUDE.md +5 -3
  288. package/skeleton/templates/arch.md +100 -30
  289. package/skeleton/templates/cheatsheet.md +12 -12
  290. package/skeleton/templates/lessons-learned.md +45 -7
  291. package/templates/3d-viewer.html +16 -18
  292. package/templates/tower.html +1 -1
  293. package/dashboard/dist/assets/index-CTrlY11L.js +0 -194
  294. package/dashboard/dist/assets/index-CTrlY11L.js.map +0 -1
  295. package/skeleton/.claude/skills/af/SKILL.md +0 -146
  296. package/skeleton/porch/prompts/understand.md +0 -61
  297. package/skeleton/porch/prompts/verify.md +0 -58
  298. package/skeleton/protocols/maintain/prompts/audit.md +0 -111
  299. package/skeleton/protocols/maintain/prompts/clean.md +0 -91
  300. package/skeleton/protocols/maintain/prompts/sync.md +0 -113
  301. package/skeleton/protocols/maintain/prompts/verify.md +0 -110
  302. package/skeleton/protocols/tick/builder-prompt.md +0 -65
  303. package/skeleton/protocols/tick/consult-types/impl-review.md +0 -72
  304. package/skeleton/protocols/tick/consult-types/plan-review.md +0 -59
  305. package/skeleton/protocols/tick/consult-types/pr-review.md +0 -72
  306. package/skeleton/protocols/tick/consult-types/spec-review.md +0 -55
  307. package/skeleton/protocols/tick/protocol.json +0 -151
  308. package/skeleton/protocols/tick/protocol.md +0 -277
  309. package/skeleton/protocols/tick/templates/plan.md +0 -67
  310. package/skeleton/protocols/tick/templates/review.md +0 -89
  311. package/skeleton/protocols/tick/templates/spec.md +0 -61
@@ -30,7 +30,7 @@ The `-m` / `--model` flag is **always required** except for `consult stats`.
30
30
  -m, --model <model> Model to use (required except stats)
31
31
  --prompt <text> Inline prompt (general mode)
32
32
  --prompt-file <path> Prompt file path (general mode)
33
- --protocol <name> Protocol: spir, aspir, air, bugfix, tick, maintain
33
+ --protocol <name> Protocol: spir, aspir, air, bugfix, maintain
34
34
  -t, --type <type> Review type (see below)
35
35
  --issue <number> Issue number (required in architect context)
36
36
  --output <path> Save result to file
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: porch
3
- description: Protocol orchestrator CLI — drives SPIR, ASPIR, AIR, TICK, and BUGFIX protocols via a state machine. ALWAYS check this skill before running any `porch` command. Use when you need to check project status, approve gates, signal phase completion, or manage protocol state. Also use when a builder asks about gate approvals or phase transitions.
3
+ description: Protocol orchestrator CLI — drives SPIR, ASPIR, AIR, and BUGFIX protocols via a state machine. ALWAYS check this skill before running any `porch` command. Use when you need to check project status, approve gates, signal phase completion, or manage protocol state. Also use when a builder asks about gate approvals or phase transitions.
4
4
  ---
5
5
 
6
6
  # porch - Protocol Orchestrator
@@ -31,7 +31,7 @@ Gates are human-only approval checkpoints. The `--a-human-explicitly-approved-th
31
31
  |------|----------|------|
32
32
  | `spec-approval` | SPIR | After spec is written |
33
33
  | `plan-approval` | SPIR | After plan is written |
34
- | `pr` | SPIR, TICK, AIR | After PR is created |
34
+ | `pr` | SPIR, AIR | After PR is created |
35
35
 
36
36
  ```bash
37
37
  porch approve 42 spec-approval --a-human-explicitly-approved-this
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: update-arch-docs
3
+ description: Audit, prune, and update the project's architecture documentation — `codev/resources/arch.md` and `codev/resources/lessons-learned.md`. Use this skill when running MAINTAIN's arch-doc step, or when asked to update / audit / prune `codev/resources/arch.md` or `codev/resources/lessons-learned.md`. The skill is opinionated about what NOT to include in these files (per-spec changelogs, exhaustive enumerations, aspirational state, duplicate meta-spec content) and ships two operating modes: diff-mode (apply a specific change) and audit-mode (propose cuts with reasons). It edits files directly via normal file-edit tooling and does not invoke destructive shell commands.
4
+ ---
5
+
6
+ # update-arch-docs
7
+
8
+ This skill maintains two governance documents:
9
+
10
+ - `codev/resources/arch.md` — the project's architecture document.
11
+ - `codev/resources/lessons-learned.md` — durable engineering wisdom extracted from reviews.
12
+
13
+ It is invoked by the MAINTAIN protocol's documentation step, and ad-hoc whenever someone needs to update, audit, or prune either file. The skill is opinionated about *what does not belong* in these files. Use it whenever a doc change touches arch.md or lessons-learned.md, even if the change is just an addition.
14
+
15
+ ## What this skill does NOT do
16
+
17
+ These are the patterns that have, in practice, caused arch.md and lessons-learned.md to grow without bound. Treat them as bright-line rejections during both audit-mode and diff-mode work.
18
+
19
+ ### In arch.md
20
+
21
+ - **Per-file enumerations** that go stale the moment they're written. Document the *shape* of a directory and the handful of load-bearing files; do not list every file. `git ls-files` is authoritative; the doc is for orientation.
22
+ - **Per-spec changelog sections** ("Spec 0042 added X, Spec 0073 changed Y"). Architecture is current state, not history. The git log + the spec/review documents own the changelog framing.
23
+ - **Specs/plans tables** that mirror the contents of `codev/specs/` and `codev/plans/`. These are duplicative and rot quickly. Link to the directory; do not paginate it into the doc.
24
+ - **Aspirational state** ("we plan to…", "in the next phase we'll…"). That belongs in the relevant meta-spec or roadmap doc, not in the architecture body. arch.md describes what *is*, not what *might be*.
25
+ - **Date-stamped narrative** ("As of 2026-Q2, the system uses…"). Dates make the doc look fresh while making it harder to maintain. Use git log + commit dates for temporal context.
26
+ - **Duplication of meta-spec content**. If a subsystem has its own meta-spec under `codev/architecture/<domain>.md` or under `codev/specs/`, arch.md should carry a 1-paragraph summary plus a pointer — not a copy.
27
+ - **Retired-component graveyards**. When a component is removed, delete its section. `git log` retains history; an arch.md that describes things that no longer exist is misleading.
28
+
29
+ ### In lessons-learned.md
30
+
31
+ - **Spec-narrow recipes** that only matter inside the originating feature ("In spec 0073 we found that the rate limiter needs X"). These belong in the spec's review document, not in lessons-learned.md. lessons-learned.md captures patterns that apply *across* specs.
32
+ - **Multi-paragraph entries**. If a lesson needs more than 1–3 sentences to land, it is either two lessons fused together or it is documentation that belongs elsewhere.
33
+ - **Duplicate adjacent entries**. Fold variations of the same lesson into one entry. Two entries that say the same thing are louder, not clearer.
34
+ - **Spec-numbered narrative entries** ("Lesson from #0468:…"). Link to the review if needed; the lesson itself should be stated as a general principle.
35
+
36
+ ### In either file (process)
37
+
38
+ - **Destructive shell commands**. The skill must not invoke `rm -rf`, `git rm`, or destructive `sed` scripts. All edits go through the normal Edit tool. The MAINTAIN PR diff is the human-confirmation step; that's enough.
39
+
40
+ ## arch.md vs. lessons-learned.md (two-doc framing)
41
+
42
+ Treat the two files as siblings with different purposes. When in doubt about which file a fact belongs in, route by purpose:
43
+
44
+ | Purpose | Goes in |
45
+ |---|---|
46
+ | Current system shape — services, transports, key mental models | `arch.md` |
47
+ | Mechanism for a unique subsystem | `arch.md` (subsystem section) — or its own meta-spec if the mechanism is large enough to warrant one, with arch.md keeping a 1-paragraph summary + pointer |
48
+ | Pointers ("see meta-spec X for details") | `arch.md` |
49
+ | A durable engineering pattern that applies across multiple specs | `lessons-learned.md` |
50
+ | A system-shape surprise verified-wrong in production ("looks like X but isn't") | `arch.md` § "Verified-Wrong Assumptions" — *not* lessons-learned.md, because it's a property of the system, not a general pattern |
51
+
52
+ The "system-shape surprise" routing is the one most often gotten wrong. If a future reader needs to know "the system *looks* like X but actually does Y", that is system shape and lives in arch.md. If they need to know "we learned that doing X is generally a bad idea", that is engineering wisdom and lives in lessons-learned.md.
53
+
54
+ ## Sizing by purpose, not by line count
55
+
56
+ There is no line-count budget for either file. The right size for each section is determined by what the section needs to do. If a subsystem genuinely has unique mechanism that takes 80 lines to explain clearly, 80 lines is the right size. If a subsystem can be described in 5 lines and a pointer to a meta-spec, 5 lines is right.
57
+
58
+ What's *wrong* is bulk that comes from any of the patterns in "What this skill does NOT do" above. Strip those, and the file's size will land where it belongs.
59
+
60
+ When proposing a section, ask: "Could a future reader skip this section without losing anything load-bearing?" If yes, the section should not exist. The doc's purpose is orientation, not completeness.
61
+
62
+ ## Mode: diff-mode (apply a specific change)
63
+
64
+ Use diff-mode when the request is specific: "add a section about the new caching layer," "update the Glossary entry for Tower," "remove the reference to the deleted dashboard-server."
65
+
66
+ In diff-mode:
67
+
68
+ 1. Find the smallest section that needs to change.
69
+ 2. Apply the change via the Edit tool.
70
+ 3. If the change adds new content, run a quick sanity check against "What this skill does NOT do" before saving — make sure the new content is current state, not aspirational; not duplicative of a meta-spec; not a per-spec changelog entry.
71
+ 4. Surface the resulting diff for review.
72
+
73
+ Diff-mode is fast. It is the right mode for ~80% of post-MAINTAIN documentation work.
74
+
75
+ ## Mode: audit-mode (identify what to cut)
76
+
77
+ Use audit-mode when the request is general: "the doc feels stale," "MAINTAIN says it's time to prune," "review arch.md against the principles."
78
+
79
+ In audit-mode:
80
+
81
+ 1. Read the file end-to-end.
82
+ 2. For each section in arch.md, run through the per-section pruning checklist (from the MAINTAIN protocol):
83
+ - Does it describe *current state*? If aspirational, the section moves to a meta-spec; the arch.md keeps a 1-paragraph summary + pointer (or nothing, if the meta-spec stands on its own).
84
+ - Does it duplicate a meta-spec? If yes, replace with a 1-paragraph summary + pointer.
85
+ - Is it a per-file enumeration that's gone stale? If yes, prune to the directory shape + a few key files.
86
+ - Is it a changelog/narrative section ("Spec 0042 added X")? If yes, absorb the architecturally-relevant facts and remove the spec-numbered framing.
87
+ - Is the component still alive? If retired, delete the section entirely.
88
+ 3. For each entry in lessons-learned.md, run the per-entry checklist:
89
+ - Is it cross-applicable beyond the spec that produced it? If no, remove (the lesson belongs in the spec's review).
90
+ - Is it terse (1–3 sentences)? If multi-paragraph, split or compress.
91
+ - Is the topic section the right one? If filed under "Architecture (continued)" or a spec-numbered section, move it to the right topical home.
92
+ - Is it a duplicate of an adjacent entry? If yes, fold them.
93
+ 4. **When in doubt, KEEP.** This rule comes from the MAINTAIN protocol and applies in audit-mode too. A confident cut is better than three speculative ones. Bias toward fewer, higher-confidence proposals with clear rationale; do not chase a maximum cut count.
94
+ 5. Apply the cuts via the Edit tool — the skill does not produce a "candidate-cuts list and stop." The diff *is* the proposal. The MAINTAIN PR review is the human-confirmation step.
95
+ 6. Surface a short reason alongside each cut in the run file (`codev/maintain/NNNN.md`) so PR reviewers can evaluate intent ("removed because: per-spec changelog framing"; "compressed because: duplicates the orchestrator meta-spec").
96
+
97
+ Audit-mode is slower than diff-mode and produces larger diffs. Reserve it for explicit audit invocations, not for routine doc updates.
98
+
99
+ ## Output contract
100
+
101
+ The skill commits to the following:
102
+
103
+ - It edits `codev/resources/arch.md` and `codev/resources/lessons-learned.md` directly via the Edit tool.
104
+ - It does not invoke destructive shell commands (no `rm -rf`, no `git rm`, no destructive `sed`). File deletions happen only through Edit removing the relevant content; whole-file removal would be a structural change that is out of scope for this skill.
105
+ - In audit-mode, every removal is paired with a one-line reason in the MAINTAIN run file's `## Audit Findings` section. Rationale lives there so reviewers can evaluate intent without re-deriving it from the diff.
106
+ - The skill does not modify other files (specs, plans, reviews, source code). If a fact belongs somewhere else, the skill flags it; it does not move it.
107
+ - The skill does not edit live arch.md or lessons-learned.md content as a side effect of being read or invoked — only when the user/MAINTAIN protocol explicitly asks for an update or audit.
@@ -218,7 +218,7 @@ Ensure no firewall is blocking the ports (default: 4200-4299):
218
218
  lsof -i :4200
219
219
 
220
220
  # Clean up stale port allocations
221
- af ports cleanup
221
+ afx ports cleanup
222
222
  ```
223
223
 
224
224
  ### gh authentication issues
@@ -1,6 +1,6 @@
1
1
  # Active Builders
2
2
 
3
- > **Note**: Builder status is now tracked automatically via SQLite database and the Tower dashboard. Use `af status` to check all builders. This file is retained as a reference for status values only.
3
+ > **Note**: Builder status is now tracked automatically via SQLite database and the Tower dashboard. Use `afx status` to check all builders. This file is retained as a reference for status values only.
4
4
 
5
5
  ## Status Values
6
6
 
@@ -13,7 +13,7 @@
13
13
  ## Commands
14
14
 
15
15
  ```bash
16
- af status # Check all builder statuses
17
- af spawn <id> # Spawn a new builder
18
- af cleanup -p <id> # Clean up a completed builder
16
+ afx status # Check all builder statuses
17
+ afx spawn <id> # Spawn a new builder
18
+ afx cleanup -p <id> # Clean up a completed builder
19
19
  ```
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://codev.dev/protocol-schema.json",
4
4
  "title": "Codev Protocol Definition",
5
- "description": "Schema for porch protocol definitions (SPIR, TICK, BUGFIX, etc.)",
5
+ "description": "Schema for porch protocol definitions (SPIR, BUGFIX, AIR, etc.)",
6
6
  "type": "object",
7
7
  "required": ["name", "phases"],
8
8
  "properties": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "name": {
14
14
  "type": "string",
15
- "description": "Protocol name (e.g., 'spir', 'tick', 'bugfix')",
15
+ "description": "Protocol name (e.g., 'spir', 'bugfix', 'air')",
16
16
  "pattern": "^[a-z][a-z0-9-]*$"
17
17
  },
18
18
  "alias": {
@@ -38,20 +38,20 @@ Follow the AIR protocol: `codev/protocols/air/protocol.md`
38
38
  2. Implement the feature (< 300 LOC)
39
39
  3. Write tests for the feature
40
40
  4. Create PR with review in the PR body (NOT as a separate file)
41
- 5. Notify architect via `af send architect "PR #N ready for review (implements #{{issue.number}})"`
41
+ 5. Notify architect via `afx send architect "PR #N ready for review (implements #{{issue.number}})"`
42
42
 
43
43
  **IMPORTANT**: AIR produces NO spec, plan, or review files. The review goes in the PR body.
44
44
 
45
45
  If the feature is too complex (> 300 LOC or architectural changes), notify the Architect via:
46
46
  ```bash
47
- af send architect "Issue #{{issue.number}} is more complex than expected. [Reason]. Recommend escalating to ASPIR."
47
+ afx send architect "Issue #{{issue.number}} is more complex than expected. [Reason]. Recommend escalating to ASPIR."
48
48
  ```
49
49
 
50
50
  ## Notifications
51
- Always use `af send architect "..."` to notify the architect at key moments:
52
- - **PR ready**: `af send architect "PR #N ready for review (implements #{{issue.number}})"`
53
- - **PR merged**: `af send architect "PR #N merged for issue #{{issue.number}}. Ready for cleanup."`
54
- - **Blocked**: `af send architect "Blocked on issue #{{issue.number}}: [reason]"`
51
+ Always use `afx send architect "..."` to notify the architect at key moments:
52
+ - **PR ready**: `afx send architect "PR #N ready for review (implements #{{issue.number}})"`
53
+ - **PR merged**: `afx send architect "PR #N merged for issue #{{issue.number}}. Ready for cleanup."`
54
+ - **Blocked**: `afx send architect "Blocked on issue #{{issue.number}}: [reason]"`
55
55
  {{/if}}
56
56
 
57
57
  ## Handling Flaky Tests
@@ -15,15 +15,27 @@ Create a pull request with the review embedded in the PR body, optionally run CM
15
15
 
16
16
  ### 1. Create the Pull Request
17
17
 
18
- Create a PR that links to the issue. The PR body IS the review — include a summary, key decisions, and test plan:
18
+ Create a PR that links to the issue. The PR body IS the review — include a summary, key decisions, and test plan.
19
+
20
+ **PR body requirements**: The PR body MUST include `Closes #<N>` (where `<N>` is
21
+ the driving issue number) so GitHub auto-closes the issue on merge. If the PR
22
+ closes multiple issues (e.g. duplicates consolidated), include one `Closes #<N>`
23
+ per issue. Without this, GitHub will not auto-close the issue.
24
+
25
+ **Exception**: if this PR only partially addresses the issue, use `Refs #<N>`
26
+ or `Part of #<N>` instead of `Closes` — the issue stays open until a
27
+ follow-up PR closes it.
28
+
29
+ **Note**: substitute the real issue number for `<N>` — do not leave the
30
+ placeholder or any `{{...}}` template tag in the committed PR body.
19
31
 
20
32
  ```bash
21
- gh pr create --title "[Air #{{issue.number}}] feat: <brief description>" --body "$(cat <<'EOF'
33
+ gh pr create --title "[Air #<N>] feat: <brief description>" --body "$(cat <<'EOF'
22
34
  ## Summary
23
35
 
24
36
  <1-2 sentence description of the feature>
25
37
 
26
- Implements #{{issue.number}}
38
+ Closes #<N> <!-- Substitute <N> with the real issue number -->
27
39
 
28
40
  ## What Changed
29
41
 
@@ -75,12 +87,12 @@ If you ran CMAP:
75
87
  Send notification with PR link:
76
88
 
77
89
  ```bash
78
- af send architect "PR #<number> ready for review (implements issue #{{issue.number}})"
90
+ afx send architect "PR #<number> ready for review (implements issue #{{issue.number}})"
79
91
  ```
80
92
 
81
93
  If CMAP was run, include verdicts:
82
94
  ```bash
83
- af send architect "PR #<number> ready for review (implements issue #{{issue.number}}). CMAP: gemini=<verdict>, codex=<verdict>, claude=<verdict>"
95
+ afx send architect "PR #<number> ready for review (implements issue #{{issue.number}}). CMAP: gemini=<verdict>, codex=<verdict>, claude=<verdict>"
84
96
  ```
85
97
 
86
98
  ## Signals
@@ -34,7 +34,6 @@ AIR is a minimal protocol for implementing small features (< 300 LOC) where the
34
34
 
35
35
  - Bug fixes → use **BUGFIX**
36
36
  - Features needing spec discussion → use **SPIR** or **ASPIR**
37
- - Amendments to existing specs → use **TICK**
38
37
  - Architectural changes → use **SPIR**
39
38
  - Complex features with multiple phases → use **SPIR** or **ASPIR**
40
39
 
@@ -67,7 +66,7 @@ The **PR gate** is preserved — a human reviews all code before merge.
67
66
 
68
67
  ```bash
69
68
  # Spawn a builder using AIR
70
- af spawn 42 --protocol air
69
+ afx spawn 42 --protocol air
71
70
 
72
71
  # The builder implements autonomously and stops at the PR gate
73
72
  ```
@@ -27,7 +27,7 @@ You are running in STRICT mode. This means:
27
27
  {{/if}}
28
28
 
29
29
  ## Protocol
30
- Follow the SPIR protocol: `codev/protocols/spir/protocol.md`
30
+ Follow the ASPIR protocol: `codev/protocols/aspir/protocol.md`
31
31
  Read and internalize the protocol before starting any work.
32
32
 
33
33
  {{#if spec}}
@@ -53,12 +53,34 @@ Follow the implementation plan at: `{{plan.path}}`
53
53
  {{task_text}}
54
54
  {{/if}}
55
55
 
56
+ ## Multi-PR Workflow
57
+
58
+ Your worktree is persistent — it survives across PR merges. You can produce multiple PRs sequentially:
59
+
60
+ 1. Cut a branch, open a PR, wait for merge
61
+ 2. After merge: `git fetch origin main && git checkout -b <next-branch> origin/main`
62
+ 3. Continue to the next phase, open another PR
63
+
64
+ **Important**: Do NOT run `git checkout main` — git worktrees cannot check out a branch that's checked out elsewhere. Always branch off `origin/main` via fetch.
65
+
66
+ Record PRs: `porch done {{project_id}} --pr <N> --branch <name>`
67
+ Record merges: `porch done {{project_id}} --merged <N>`
68
+
69
+ ## Verify Phase
70
+
71
+ After the final PR merges, the project enters the **verify** phase. You stay alive through verify:
72
+ 1. Pull main into your worktree
73
+ 2. Run `porch done {{project_id}}` to signal verification is ready
74
+ 3. The architect approves `verify-approval` when satisfied
75
+
76
+ If verification is not needed: `porch verify {{project_id}} --skip "reason"`
77
+
56
78
  ## Notifications
57
- Always use `af send architect "..."` to notify the architect at key moments:
58
- - **Gate reached**: `af send architect "Project {{project_id}}: <gate-name> ready for approval"`
59
- - **PR ready**: `af send architect "PR #N ready for review (project {{project_id}})"`
60
- - **PR merged**: `af send architect "Project {{project_id}} complete. PR merged. Ready for cleanup."`
61
- - **Blocked**: `af send architect "Blocked on project {{project_id}}: [reason]"`
79
+ Always use `afx send architect "..."` to notify the architect at key moments:
80
+ - **Gate reached**: `afx send architect "Project {{project_id}}: <gate-name> ready for approval"`
81
+ - **PR ready**: `afx send architect "PR #N ready for review (project {{project_id}})"`
82
+ - **PR merged**: `afx send architect "Project {{project_id}} PR merged. Entering verify phase."`
83
+ - **Blocked**: `afx send architect "Blocked on project {{project_id}}: [reason]"`
62
84
 
63
85
  ## Handling Flaky Tests
64
86
 
@@ -181,11 +181,22 @@ Before PR:
181
181
  porch consultation reviews the actual PR, and the architect can review a real PR
182
182
  when the pr gate fires.
183
183
 
184
+ **PR body requirements**: The PR body MUST include `Closes #<N>` (for feature issues)
185
+ or `Fixes #<N>` (for bug issues) for the driving GitHub issue. If the PR closes
186
+ multiple issues (e.g. duplicates consolidated), include one keyword per issue.
187
+ Without this, GitHub will not auto-close the issue on merge.
188
+
189
+ **Exception**: if this PR only partially addresses the issue (e.g. one phase of a
190
+ multi-PR effort), DO NOT use `Closes`/`Fixes` — reference the issue with `Refs #<N>`
191
+ or `Part of #<N>` instead. The issue stays open until the follow-up PR closes it.
192
+
184
193
  ```bash
185
194
  gh pr create --title "[Spec {{project_id}}] {{title}}" --body "$(cat <<'EOF'
186
195
  ## Summary
187
196
  [Brief description of the implementation]
188
197
 
198
+ Closes #<N> <!-- Replace <N> with the driving issue number, or use "Refs #<N>" for partial fixes -->
199
+
189
200
  ## Changes
190
201
  - [Change 1]
191
202
  - [Change 2]
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "checks": {
53
53
  "plan_exists": "test -f codev/plans/${PROJECT_TITLE}.md",
54
- "has_phases_json": "grep -q '\"phases\":' codev/plans/${PROJECT_TITLE}.md",
54
+ "has_phases_json": "grep -qE '\"phases\"\\s*:' codev/plans/${PROJECT_TITLE}.md",
55
55
  "min_two_phases": "grep -o '\"id\": *\"[^\"]*\"' codev/plans/${PROJECT_TITLE}.md | wc -l | awk '$1 >= 2 {exit 0} {exit 1}'"
56
56
  },
57
57
  "next": "implement"
@@ -132,6 +132,14 @@
132
132
  }
133
133
  },
134
134
  "gate": "pr",
135
+ "next": "verify"
136
+ },
137
+ {
138
+ "id": "verify",
139
+ "name": "Verify",
140
+ "description": "Post-merge environmental verification (optional — skip with porch verify --skip)",
141
+ "type": "once",
142
+ "gate": "verify-approval",
135
143
  "next": null
136
144
  }
137
145
  ],
@@ -61,7 +61,7 @@ Final review, PR preparation, and 3-way review. **PR gate preserved** — builde
61
61
 
62
62
  ```bash
63
63
  # Spawn a builder using ASPIR
64
- af spawn 42 --protocol aspir
64
+ afx spawn 42 --protocol aspir
65
65
 
66
66
  # The builder runs autonomously through Specify → Plan → Implement
67
67
  # and stops only at the PR gate in the Review phase
@@ -182,23 +182,3 @@ Phase 1 ──→ Phase 2 ──→ Phase 3
182
182
  ## Notes
183
183
  [Additional context, assumptions, or considerations]
184
184
 
185
- ---
186
-
187
- ## Amendment History
188
-
189
- This section tracks all TICK amendments to this plan. TICKs modify both the spec and plan together as an atomic unit.
190
-
191
- <!-- When adding a TICK amendment, add a new entry below this line in chronological order -->
192
-
193
- <!--
194
- ### TICK-001: [Amendment Title] (YYYY-MM-DD)
195
-
196
- **Changes**:
197
- - [Phase added]: [Description of new phase]
198
- - [Phase modified]: [What was updated]
199
- - [Implementation steps]: [New steps added]
200
-
201
- **Review**: See `reviews/####-name-tick-001.md`
202
-
203
- ---
204
- -->
@@ -152,31 +152,3 @@ Note: All consultation feedback has been incorporated directly into the relevant
152
152
  ## Notes
153
153
  [Any additional context or considerations not covered above]
154
154
 
155
- ---
156
-
157
- ## Amendments
158
-
159
- This section tracks all TICK amendments to this specification. TICKs are lightweight changes that refine an existing spec rather than creating a new one.
160
-
161
- <!-- When adding a TICK amendment, add a new entry below this line in chronological order -->
162
-
163
- <!--
164
- ### TICK-001: [Amendment Title] (YYYY-MM-DD)
165
-
166
- **Summary**: [One-line description of what changed]
167
-
168
- **Problem Addressed**:
169
- [Why this amendment was needed - what gap or issue in the original spec]
170
-
171
- **Spec Changes**:
172
- - [Section modified]: [What changed and why]
173
- - [New section added]: [Purpose]
174
-
175
- **Plan Changes**:
176
- - [Phase added/modified]: [Description]
177
- - [Implementation steps]: [What was updated]
178
-
179
- **Review**: See `reviews/####-name-tick-001.md`
180
-
181
- ---
182
- -->
@@ -40,18 +40,18 @@ Follow the BUGFIX protocol: `codev/protocols/bugfix/protocol.md`
40
40
  3. Implement fix (< 300 LOC)
41
41
  4. Add regression test
42
42
  5. Create PR with "Fixes #{{issue.number}}" in body
43
- 6. Notify architect via `af send architect "PR #N ready for review (fixes #{{issue.number}})"`
43
+ 6. Notify architect via `afx send architect "PR #N ready for review (fixes #{{issue.number}})"`
44
44
 
45
45
  If the fix is too complex (> 300 LOC or architectural changes), notify the Architect via:
46
46
  ```bash
47
- af send architect "Issue #{{issue.number}} is more complex than expected. [Reason]. Recommend escalating to SPIR/TICK."
47
+ afx send architect "Issue #{{issue.number}} is more complex than expected. [Reason]. Recommend escalating to SPIR."
48
48
  ```
49
49
 
50
50
  ## Notifications
51
- Always use `af send architect "..."` to notify the architect at key moments:
52
- - **PR ready**: `af send architect "PR #N ready for review (fixes #{{issue.number}})"`
53
- - **PR merged**: `af send architect "PR #N merged for issue #{{issue.number}}. Ready for cleanup."`
54
- - **Blocked**: `af send architect "Blocked on issue #{{issue.number}}: [reason]"`
51
+ Always use `afx send architect "..."` to notify the architect at key moments:
52
+ - **PR ready**: `afx send architect "PR #N ready for review (fixes #{{issue.number}})"`
53
+ - **PR merged**: `afx send architect "PR #N merged for issue #{{issue.number}}. Ready for cleanup."`
54
+ - **Blocked**: `afx send architect "Blocked on issue #{{issue.number}}: [reason]"`
55
55
  {{/if}}
56
56
 
57
57
  ## Handling Flaky Tests
@@ -15,15 +15,27 @@ Create a pull request, run CMAP review, and address feedback.
15
15
 
16
16
  ### 1. Create the Pull Request
17
17
 
18
- Create a PR that links to the issue:
18
+ Create a PR that links to the issue.
19
+
20
+ **PR body requirements**: The PR body MUST include `Fixes #<N>` (where `<N>` is
21
+ the driving issue number) so GitHub auto-closes the issue on merge. If the PR
22
+ fixes multiple issues (e.g. duplicates consolidated), include one `Fixes #<N>`
23
+ per issue. Without this, GitHub will not auto-close the issue.
24
+
25
+ **Exception**: if this PR only partially addresses the issue, use `Refs #<N>`
26
+ or `Part of #<N>` instead of `Fixes` — the issue stays open until a
27
+ follow-up PR closes it.
28
+
29
+ **Note**: substitute the real issue number for `<N>` — do not leave the
30
+ placeholder or any `{{...}}` template tag in the committed PR body.
19
31
 
20
32
  ```bash
21
- gh pr create --title "Fix #{{issue.number}}: <brief description>" --body "$(cat <<'EOF'
33
+ gh pr create --title "Fix #<N>: <brief description>" --body "$(cat <<'EOF'
22
34
  ## Summary
23
35
 
24
36
  <1-2 sentence description of the bug and fix>
25
37
 
26
- Fixes #{{issue.number}}
38
+ Fixes #<N> <!-- Substitute <N> with the real issue number -->
27
39
 
28
40
  ## Root Cause
29
41
 
@@ -74,7 +86,7 @@ You must have three concrete verdicts (e.g., "gemini: APPROVE, codex: APPROVE, c
74
86
  Send a **single** notification that includes the PR link and each model's verdict:
75
87
 
76
88
  ```bash
77
- af send architect "PR #<number> ready for review (fixes issue #{{issue.number}}). CMAP: gemini=<APPROVE|REQUEST_CHANGES>, codex=<APPROVE|REQUEST_CHANGES>, claude=<APPROVE|REQUEST_CHANGES>"
89
+ afx send architect "PR #<number> ready for review (fixes issue #{{issue.number}}). CMAP: gemini=<APPROVE|REQUEST_CHANGES>, codex=<APPROVE|REQUEST_CHANGES>, claude=<APPROVE|REQUEST_CHANGES>"
78
90
  ```
79
91
 
80
92
  **This is the only notification you send.** After this, your work is done — the architect
@@ -46,6 +46,21 @@ The EXPERIMENT protocol ensures disciplined experimentation:
46
46
  - Document findings regardless of outcome
47
47
  - Separate experiment artifacts from production code
48
48
 
49
+ ## If You Open a PR
50
+
51
+ Most experiments are committed to a branch without a PR, but if you do open one
52
+ to integrate findings and the experiment was triggered by a GitHub issue:
53
+
54
+ **PR body requirements**: The PR body MUST include `Closes #<N>` (for feature
55
+ issues) or `Fixes #<N>` (for bug issues) for the driving issue so GitHub
56
+ auto-closes it on merge. If the PR closes multiple issues, include one keyword
57
+ per issue.
58
+
59
+ **Exception**: if this PR only partially addresses the issue (e.g. experiment
60
+ validates an approach but production implementation is deferred), use
61
+ `Refs #<N>` or `Part of #<N>` instead — the issue stays open until a follow-up
62
+ PR closes it.
63
+
49
64
  ## Handling Flaky Tests
50
65
 
51
66
  If you encounter **pre-existing flaky tests** (intermittent failures unrelated to your changes):
@@ -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 SPIR), simple one-off scripts, well-understood implementations (use TICK)
13
+ **Skip for**: Production code (use SPIR), simple one-off scripts
14
14
 
15
15
  ## Structure
16
16
 
@@ -156,11 +156,6 @@ Experiment 5 validated that [approach] achieves [results].
156
156
  See: experiments/5_validation_test/notes.md
157
157
  ```
158
158
 
159
- ### Experiment → TICK
160
- For small, validated changes discovered during experimentation:
161
- - Use TICK for quick implementation
162
- - Reference experiment as justification
163
-
164
159
  ## Numbering Convention
165
160
 
166
161
  Use four-digit sequential numbering (consistent with project list):
@@ -7,7 +7,7 @@ You are executing the MAINTAIN protocol to clean up and synchronize the codebase
7
7
  You are running in SOFT mode. This means:
8
8
  - You follow the MAINTAIN protocol yourself (no porch orchestration)
9
9
  - The architect monitors your work and verifies you're adhering to the protocol
10
- - Work through each phase methodically
10
+ - Work through each step methodically
11
11
  {{/if}}
12
12
 
13
13
  {{#if mode_strict}}
@@ -20,25 +20,25 @@ You are running in STRICT mode. This means:
20
20
  ### ABSOLUTE RESTRICTIONS (STRICT MODE)
21
21
  - **NEVER edit `status.yaml` directly** — only porch commands may modify project state
22
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
23
  {{/if}}
25
24
 
26
25
  ## Protocol
27
26
  Follow the MAINTAIN protocol: `codev/protocols/maintain/protocol.md`
28
27
 
29
28
  ## MAINTAIN Overview
30
- The MAINTAIN protocol handles codebase hygiene:
31
29
 
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
30
+ Two phases:
31
+ 1. **Maintain**: Single pass — audit findings, clean dead code, sync docs, verify build
32
+ 2. **Review**: Create PR with 3-way consultation
36
33
 
37
34
  ## Key Rules
38
35
  - Use soft deletion (move to `codev/maintain/.trash/`)
39
- - Always verify build passes after removals
36
+ - Verify build passes after each removal (`cd packages/codev && pnpm build && pnpm test`)
40
37
  - Update documentation to match current architecture
41
38
  - Don't remove anything actively used
39
+ - One removal at a time — commit after each
40
+ - Document every deletion with justification
41
+ - Never use `git add -A` or `git add .`
42
42
 
43
43
  ## Handling Flaky Tests
44
44
 
@@ -46,10 +46,11 @@ If you encounter **pre-existing flaky tests** (intermittent failures unrelated t
46
46
  1. **DO NOT** edit `status.yaml` to bypass checks
47
47
  2. **DO NOT** skip porch checks or use any workaround to avoid the failure
48
48
  3. **DO** mark the test as skipped with a clear annotation (e.g., `it.skip('...') // FLAKY: skipped pending investigation`)
49
- 4. **DO** document each skipped flaky test in your review under a `## Flaky Tests` section
49
+ 4. **DO** document each skipped flaky test in your maintenance run file
50
50
  5. Commit the skip and continue with your work
51
51
 
52
52
  ## Getting Started
53
53
  1. Read the MAINTAIN protocol document
54
- 2. Start with the Audit phase
55
- 3. Document all changes made
54
+ 2. Run `porch next` to get your first task
55
+ 3. Work through audit → clean → sync → verify in a single pass
56
+ 4. Document everything in the maintenance run file