@cluesmith/codev 3.0.0-rc.1 → 3.0.0-rc.10

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 (325) 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-Bs8I7N2s.css} +1 -1
  7. package/dashboard-dist/assets/index-CkNo2z6t.js +195 -0
  8. package/dashboard-dist/assets/index-CkNo2z6t.js.map +1 -0
  9. package/dashboard-dist/dist/assets/index-Bs8I7N2s.css +32 -0
  10. package/dashboard-dist/dist/assets/index-CkNo2z6t.js +195 -0
  11. package/dashboard-dist/dist/assets/index-CkNo2z6t.js.map +1 -0
  12. package/{dashboard → dashboard-dist}/dist/index.html +2 -2
  13. package/dashboard-dist/index.html +14 -0
  14. package/dist/agent-farm/cli.d.ts.map +1 -1
  15. package/dist/agent-farm/cli.js +17 -14
  16. package/dist/agent-farm/cli.js.map +1 -1
  17. package/dist/agent-farm/commands/architect.d.ts +4 -4
  18. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  19. package/dist/agent-farm/commands/architect.js +23 -12
  20. package/dist/agent-farm/commands/architect.js.map +1 -1
  21. package/dist/agent-farm/commands/attach.js +8 -8
  22. package/dist/agent-farm/commands/attach.js.map +1 -1
  23. package/dist/agent-farm/commands/bench.d.ts +1 -1
  24. package/dist/agent-farm/commands/bench.js +1 -1
  25. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  26. package/dist/agent-farm/commands/cleanup.js +10 -5
  27. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  28. package/dist/agent-farm/commands/cron.js +1 -1
  29. package/dist/agent-farm/commands/cron.js.map +1 -1
  30. package/dist/agent-farm/commands/db.d.ts +3 -3
  31. package/dist/agent-farm/commands/db.js +4 -4
  32. package/dist/agent-farm/commands/db.js.map +1 -1
  33. package/dist/agent-farm/commands/open.js +2 -2
  34. package/dist/agent-farm/commands/open.js.map +1 -1
  35. package/dist/agent-farm/commands/rename.js +1 -1
  36. package/dist/agent-farm/commands/rename.js.map +1 -1
  37. package/dist/agent-farm/commands/send.d.ts +4 -1
  38. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  39. package/dist/agent-farm/commands/send.js +8 -5
  40. package/dist/agent-farm/commands/send.js.map +1 -1
  41. package/dist/agent-farm/commands/shell.js +3 -3
  42. package/dist/agent-farm/commands/shell.js.map +1 -1
  43. package/dist/agent-farm/commands/spawn-roles.d.ts +2 -1
  44. package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -1
  45. package/dist/agent-farm/commands/spawn-roles.js +1 -1
  46. package/dist/agent-farm/commands/spawn-roles.js.map +1 -1
  47. package/dist/agent-farm/commands/spawn-worktree.d.ts +49 -10
  48. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  49. package/dist/agent-farm/commands/spawn-worktree.js +356 -51
  50. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  51. package/dist/agent-farm/commands/spawn.d.ts +6 -6
  52. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  53. package/dist/agent-farm/commands/spawn.js +182 -74
  54. package/dist/agent-farm/commands/spawn.js.map +1 -1
  55. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  56. package/dist/agent-farm/commands/status.js +48 -3
  57. package/dist/agent-farm/commands/status.js.map +1 -1
  58. package/dist/agent-farm/commands/team-update.d.ts +1 -1
  59. package/dist/agent-farm/commands/team-update.d.ts.map +1 -1
  60. package/dist/agent-farm/commands/team-update.js +8 -5
  61. package/dist/agent-farm/commands/team-update.js.map +1 -1
  62. package/dist/agent-farm/commands/team.d.ts +1 -1
  63. package/dist/agent-farm/commands/team.d.ts.map +1 -1
  64. package/dist/agent-farm/commands/team.js +7 -3
  65. package/dist/agent-farm/commands/team.js.map +1 -1
  66. package/dist/agent-farm/commands/tower-cloud.d.ts +2 -2
  67. package/dist/agent-farm/commands/tower-cloud.js +3 -3
  68. package/dist/agent-farm/commands/tower-cloud.js.map +1 -1
  69. package/dist/agent-farm/commands/tower.js +2 -2
  70. package/dist/agent-farm/commands/tower.js.map +1 -1
  71. package/dist/agent-farm/lib/cloud-config.js +2 -2
  72. package/dist/agent-farm/lib/cloud-config.js.map +1 -1
  73. package/dist/agent-farm/lib/tower-client.d.ts +6 -230
  74. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  75. package/dist/agent-farm/lib/tower-client.js +6 -293
  76. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  77. package/dist/agent-farm/lib/tunnel-client.js +1 -1
  78. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  79. package/dist/agent-farm/servers/message-write.d.ts +24 -0
  80. package/dist/agent-farm/servers/message-write.d.ts.map +1 -0
  81. package/dist/agent-farm/servers/message-write.js +63 -0
  82. package/dist/agent-farm/servers/message-write.js.map +1 -0
  83. package/dist/agent-farm/servers/overview.d.ts +10 -8
  84. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  85. package/dist/agent-farm/servers/overview.js +78 -38
  86. package/dist/agent-farm/servers/overview.js.map +1 -1
  87. package/dist/agent-farm/servers/send-buffer.d.ts +4 -3
  88. package/dist/agent-farm/servers/send-buffer.d.ts.map +1 -1
  89. package/dist/agent-farm/servers/send-buffer.js +7 -4
  90. package/dist/agent-farm/servers/send-buffer.js.map +1 -1
  91. package/dist/agent-farm/servers/tower-cron-parser.js +1 -1
  92. package/dist/agent-farm/servers/tower-cron-parser.js.map +1 -1
  93. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  94. package/dist/agent-farm/servers/tower-cron.js +4 -5
  95. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  96. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  97. package/dist/agent-farm/servers/tower-instances.js +15 -13
  98. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  99. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  100. package/dist/agent-farm/servers/tower-routes.js +9 -16
  101. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  102. package/dist/agent-farm/servers/tower-server.js +1 -1
  103. package/dist/agent-farm/servers/tower-terminals.d.ts +2 -2
  104. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  105. package/dist/agent-farm/servers/tower-terminals.js +64 -36
  106. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  107. package/dist/agent-farm/servers/tower-tunnel.js +2 -2
  108. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  109. package/dist/agent-farm/servers/tower-utils.d.ts +9 -6
  110. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  111. package/dist/agent-farm/servers/tower-utils.js +13 -7
  112. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  113. package/dist/agent-farm/types.d.ts +13 -0
  114. package/dist/agent-farm/types.d.ts.map +1 -1
  115. package/dist/agent-farm/utils/config.d.ts +11 -0
  116. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  117. package/dist/agent-farm/utils/config.js +39 -17
  118. package/dist/agent-farm/utils/config.js.map +1 -1
  119. package/dist/agent-farm/utils/harness.d.ts +85 -0
  120. package/dist/agent-farm/utils/harness.d.ts.map +1 -0
  121. package/dist/agent-farm/utils/harness.js +212 -0
  122. package/dist/agent-farm/utils/harness.js.map +1 -0
  123. package/dist/agent-farm/utils/roles.d.ts +11 -4
  124. package/dist/agent-farm/utils/roles.d.ts.map +1 -1
  125. package/dist/agent-farm/utils/roles.js +21 -6
  126. package/dist/agent-farm/utils/roles.js.map +1 -1
  127. package/dist/cli.d.ts +1 -1
  128. package/dist/cli.d.ts.map +1 -1
  129. package/dist/cli.js +40 -5
  130. package/dist/cli.js.map +1 -1
  131. package/dist/commands/adopt.d.ts.map +1 -1
  132. package/dist/commands/adopt.js +16 -45
  133. package/dist/commands/adopt.js.map +1 -1
  134. package/dist/commands/consult/index.d.ts +6 -2
  135. package/dist/commands/consult/index.d.ts.map +1 -1
  136. package/dist/commands/consult/index.js +231 -183
  137. package/dist/commands/consult/index.js.map +1 -1
  138. package/dist/commands/doctor.d.ts.map +1 -1
  139. package/dist/commands/doctor.js +121 -31
  140. package/dist/commands/doctor.js.map +1 -1
  141. package/dist/commands/init.d.ts.map +1 -1
  142. package/dist/commands/init.js +13 -43
  143. package/dist/commands/init.js.map +1 -1
  144. package/dist/commands/porch/artifacts.d.ts +69 -0
  145. package/dist/commands/porch/artifacts.d.ts.map +1 -0
  146. package/dist/commands/porch/artifacts.js +368 -0
  147. package/dist/commands/porch/artifacts.js.map +1 -0
  148. package/dist/commands/porch/checks.d.ts +14 -3
  149. package/dist/commands/porch/checks.d.ts.map +1 -1
  150. package/dist/commands/porch/checks.js +150 -4
  151. package/dist/commands/porch/checks.js.map +1 -1
  152. package/dist/commands/porch/config.d.ts +6 -9
  153. package/dist/commands/porch/config.d.ts.map +1 -1
  154. package/dist/commands/porch/config.js +12 -37
  155. package/dist/commands/porch/config.js.map +1 -1
  156. package/dist/commands/porch/index.d.ts +12 -7
  157. package/dist/commands/porch/index.d.ts.map +1 -1
  158. package/dist/commands/porch/index.js +273 -82
  159. package/dist/commands/porch/index.js.map +1 -1
  160. package/dist/commands/porch/next.d.ts.map +1 -1
  161. package/dist/commands/porch/next.js +142 -75
  162. package/dist/commands/porch/next.js.map +1 -1
  163. package/dist/commands/porch/notify.d.ts +2 -2
  164. package/dist/commands/porch/notify.js +5 -5
  165. package/dist/commands/porch/notify.js.map +1 -1
  166. package/dist/commands/porch/prompts.d.ts +2 -1
  167. package/dist/commands/porch/prompts.d.ts.map +1 -1
  168. package/dist/commands/porch/prompts.js +34 -38
  169. package/dist/commands/porch/prompts.js.map +1 -1
  170. package/dist/commands/porch/protocol.d.ts +4 -3
  171. package/dist/commands/porch/protocol.d.ts.map +1 -1
  172. package/dist/commands/porch/protocol.js +21 -21
  173. package/dist/commands/porch/protocol.js.map +1 -1
  174. package/dist/commands/porch/state.d.ts +27 -2
  175. package/dist/commands/porch/state.d.ts.map +1 -1
  176. package/dist/commands/porch/state.js +100 -9
  177. package/dist/commands/porch/state.js.map +1 -1
  178. package/dist/commands/porch/types.d.ts +10 -2
  179. package/dist/commands/porch/types.d.ts.map +1 -1
  180. package/dist/commands/sync.d.ts +26 -0
  181. package/dist/commands/sync.d.ts.map +1 -0
  182. package/dist/commands/sync.js +207 -0
  183. package/dist/commands/sync.js.map +1 -0
  184. package/dist/commands/update.d.ts +15 -2
  185. package/dist/commands/update.d.ts.map +1 -1
  186. package/dist/commands/update.js +159 -202
  187. package/dist/commands/update.js.map +1 -1
  188. package/dist/lib/config.d.ts +96 -0
  189. package/dist/lib/config.d.ts.map +1 -0
  190. package/dist/lib/config.js +165 -0
  191. package/dist/lib/config.js.map +1 -0
  192. package/dist/lib/forge-contracts.d.ts +100 -0
  193. package/dist/lib/forge-contracts.d.ts.map +1 -0
  194. package/dist/lib/forge-contracts.js +35 -0
  195. package/dist/lib/forge-contracts.js.map +1 -0
  196. package/dist/lib/forge.d.ts +102 -0
  197. package/dist/lib/forge.d.ts.map +1 -0
  198. package/dist/lib/forge.js +376 -0
  199. package/dist/lib/forge.js.map +1 -0
  200. package/dist/lib/github.d.ts +68 -60
  201. package/dist/lib/github.d.ts.map +1 -1
  202. package/dist/lib/github.js +160 -169
  203. package/dist/lib/github.js.map +1 -1
  204. package/dist/lib/skeleton.d.ts +15 -5
  205. package/dist/lib/skeleton.d.ts.map +1 -1
  206. package/dist/lib/skeleton.js +82 -7
  207. package/dist/lib/skeleton.js.map +1 -1
  208. package/dist/lib/team-github.d.ts +7 -3
  209. package/dist/lib/team-github.d.ts.map +1 -1
  210. package/dist/lib/team-github.js +29 -19
  211. package/dist/lib/team-github.js.map +1 -1
  212. package/dist/terminal/pty-manager.d.ts.map +1 -1
  213. package/dist/terminal/pty-manager.js +2 -0
  214. package/dist/terminal/pty-manager.js.map +1 -1
  215. package/dist/terminal/ws-protocol.d.ts +10 -8
  216. package/dist/terminal/ws-protocol.d.ts.map +1 -1
  217. package/dist/terminal/ws-protocol.js +3 -0
  218. package/dist/terminal/ws-protocol.js.map +1 -1
  219. package/package.json +27 -24
  220. package/scripts/forge/gitea/auth-status.sh +3 -0
  221. package/scripts/forge/gitea/issue-comment.sh +3 -0
  222. package/scripts/forge/gitea/issue-list.sh +3 -0
  223. package/scripts/forge/gitea/issue-view.sh +3 -0
  224. package/scripts/forge/gitea/pr-exists.sh +6 -0
  225. package/scripts/forge/gitea/pr-list.sh +3 -0
  226. package/scripts/forge/gitea/pr-merge.sh +3 -0
  227. package/scripts/forge/gitea/pr-view.sh +3 -0
  228. package/scripts/forge/gitea/recently-closed.sh +3 -0
  229. package/scripts/forge/gitea/recently-merged.sh +3 -0
  230. package/scripts/forge/gitea/repo-archive.sh +11 -0
  231. package/scripts/forge/gitea/user-identity.sh +3 -0
  232. package/scripts/forge/github/auth-status.sh +4 -0
  233. package/scripts/forge/github/issue-comment.sh +5 -0
  234. package/scripts/forge/github/issue-list.sh +4 -0
  235. package/scripts/forge/github/issue-view.sh +5 -0
  236. package/scripts/forge/github/on-it-timestamps.sh +8 -0
  237. package/scripts/forge/github/pr-diff.sh +10 -0
  238. package/scripts/forge/github/pr-exists.sh +7 -0
  239. package/scripts/forge/github/pr-list.sh +4 -0
  240. package/scripts/forge/github/pr-merge.sh +5 -0
  241. package/scripts/forge/github/pr-search.sh +5 -0
  242. package/scripts/forge/github/pr-view.sh +11 -0
  243. package/scripts/forge/github/recently-closed.sh +15 -0
  244. package/scripts/forge/github/recently-merged.sh +15 -0
  245. package/scripts/forge/github/repo-archive.sh +10 -0
  246. package/scripts/forge/github/team-activity.sh +5 -0
  247. package/scripts/forge/github/user-identity.sh +4 -0
  248. package/scripts/forge/gitlab/auth-status.sh +3 -0
  249. package/scripts/forge/gitlab/issue-comment.sh +3 -0
  250. package/scripts/forge/gitlab/issue-list.sh +3 -0
  251. package/scripts/forge/gitlab/issue-view.sh +3 -0
  252. package/scripts/forge/gitlab/pr-diff.sh +3 -0
  253. package/scripts/forge/gitlab/pr-exists.sh +5 -0
  254. package/scripts/forge/gitlab/pr-list.sh +3 -0
  255. package/scripts/forge/gitlab/pr-merge.sh +3 -0
  256. package/scripts/forge/gitlab/pr-search.sh +3 -0
  257. package/scripts/forge/gitlab/pr-view.sh +3 -0
  258. package/scripts/forge/gitlab/recently-closed.sh +3 -0
  259. package/scripts/forge/gitlab/recently-merged.sh +3 -0
  260. package/scripts/forge/gitlab/repo-archive.sh +12 -0
  261. package/scripts/forge/gitlab/user-identity.sh +3 -0
  262. package/skeleton/.claude/skills/afx/SKILL.md +144 -0
  263. package/skeleton/.claude/skills/codev/SKILL.md +3 -3
  264. package/skeleton/.claude/skills/consult/SKILL.md +1 -1
  265. package/skeleton/.claude/skills/porch/SKILL.md +2 -2
  266. package/skeleton/DEPENDENCIES.md +1 -1
  267. package/skeleton/builders.md +4 -4
  268. package/skeleton/protocol-schema.json +2 -2
  269. package/skeleton/protocols/air/builder-prompt.md +6 -6
  270. package/skeleton/protocols/air/prompts/pr.md +2 -2
  271. package/skeleton/protocols/air/protocol.md +1 -2
  272. package/skeleton/protocols/aspir/builder-prompt.md +28 -6
  273. package/skeleton/protocols/aspir/protocol.json +9 -1
  274. package/skeleton/protocols/aspir/protocol.md +1 -1
  275. package/skeleton/protocols/aspir/templates/plan.md +0 -20
  276. package/skeleton/protocols/aspir/templates/spec.md +0 -28
  277. package/skeleton/protocols/bugfix/builder-prompt.md +6 -6
  278. package/skeleton/protocols/bugfix/prompts/pr.md +1 -1
  279. package/skeleton/protocols/experiment/protocol.md +1 -6
  280. package/skeleton/protocols/maintain/builder-prompt.md +12 -11
  281. package/skeleton/protocols/maintain/prompts/maintain.md +88 -0
  282. package/skeleton/protocols/maintain/prompts/review.md +72 -0
  283. package/skeleton/protocols/maintain/protocol.json +14 -68
  284. package/skeleton/protocols/maintain/protocol.md +111 -409
  285. package/skeleton/protocols/maintain/templates/maintenance-run.md +18 -49
  286. package/skeleton/protocols/protocol-schema.json +1 -1
  287. package/skeleton/protocols/spike/builder-prompt.md +1 -1
  288. package/skeleton/protocols/spike/protocol.md +4 -4
  289. package/skeleton/protocols/spir/builder-prompt.md +28 -5
  290. package/skeleton/protocols/spir/protocol.json +9 -1
  291. package/skeleton/protocols/spir/protocol.md +2 -2
  292. package/skeleton/protocols/spir/templates/plan.md +0 -20
  293. package/skeleton/protocols/spir/templates/spec.md +0 -28
  294. package/skeleton/resources/commands/agent-farm.md +84 -84
  295. package/skeleton/resources/commands/codev.md +1 -1
  296. package/skeleton/resources/commands/consult.md +16 -7
  297. package/skeleton/resources/commands/overview.md +14 -15
  298. package/skeleton/resources/risk-triage.md +1 -1
  299. package/skeleton/resources/workflow-reference.md +14 -14
  300. package/skeleton/roles/architect.md +55 -43
  301. package/skeleton/roles/builder.md +22 -14
  302. package/skeleton/templates/AGENTS.md +4 -3
  303. package/skeleton/templates/CLAUDE.md +4 -3
  304. package/skeleton/templates/cheatsheet.md +11 -12
  305. package/templates/3d-viewer.html +16 -18
  306. package/templates/tower.html +1 -1
  307. package/dashboard/dist/assets/index-CiIBsixF.js +0 -194
  308. package/dashboard/dist/assets/index-CiIBsixF.js.map +0 -1
  309. package/skeleton/.claude/skills/af/SKILL.md +0 -146
  310. package/skeleton/porch/prompts/understand.md +0 -61
  311. package/skeleton/porch/prompts/verify.md +0 -58
  312. package/skeleton/protocols/maintain/prompts/audit.md +0 -111
  313. package/skeleton/protocols/maintain/prompts/clean.md +0 -91
  314. package/skeleton/protocols/maintain/prompts/sync.md +0 -113
  315. package/skeleton/protocols/maintain/prompts/verify.md +0 -110
  316. package/skeleton/protocols/tick/builder-prompt.md +0 -65
  317. package/skeleton/protocols/tick/consult-types/impl-review.md +0 -72
  318. package/skeleton/protocols/tick/consult-types/plan-review.md +0 -59
  319. package/skeleton/protocols/tick/consult-types/pr-review.md +0 -72
  320. package/skeleton/protocols/tick/consult-types/spec-review.md +0 -55
  321. package/skeleton/protocols/tick/protocol.json +0 -151
  322. package/skeleton/protocols/tick/protocol.md +0 -277
  323. package/skeleton/protocols/tick/templates/plan.md +0 -67
  324. package/skeleton/protocols/tick/templates/review.md +0 -89
  325. package/skeleton/protocols/tick/templates/spec.md +0 -61
@@ -2,456 +2,162 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- MAINTAIN is a periodic maintenance protocol for keeping codebases healthy. It runs as a **strict porch protocol** with sequential phases and 3-way consultation (Gemini, Codex, Claude) at each phase.
5
+ MAINTAIN is a single-pass maintenance protocol for keeping codebases healthy. The builder does all maintenance work in one phase, then creates a PR with a 3-way review.
6
6
 
7
- **Core Principle**: Regular maintenance prevents technical debt accumulation.
7
+ **Core Principle**: Do the work in one pass. Don't over-ceremonialize housekeeping.
8
8
 
9
- **Key Documents**: MAINTAIN is responsible for keeping these living documents accurate and consistent:
10
- - `codev/resources/arch.md` - Architecture documentation (how the system works)
9
+ **Key Documents** MAINTAIN keeps current:
10
+ - `codev/resources/arch.md` - Architecture documentation
11
11
  - `codev/resources/lessons-learned.md` - Extracted wisdom from reviews
12
12
 
13
- Any builder can update these files during development, but MAINTAIN ensures they stay consistent with the actual codebase.
13
+ ## When to Use
14
14
 
15
- ## When to Use MAINTAIN
16
-
17
- - When the user/architect requests it
18
15
  - Before a release (clean slate for shipping)
19
- - Quarterly maintenance window
20
16
  - After completing a major feature
17
+ - Quarterly maintenance window
21
18
  - When the codebase feels "crusty"
22
19
 
23
20
  ## Execution Model
24
21
 
25
- MAINTAIN is orchestrated by porch with 4 sequential phases:
26
-
27
22
  ```
28
- af spawn --protocol maintain
23
+ afx spawn --protocol maintain
29
24
  ↓
30
- 1. AUDIT: Scan for dead code, unused deps, stale docs
31
- ↓ (3-way review)
32
- 2. CLEAN: Remove identified cruft
33
- ↓ (3-way review + build/test checks)
34
- 3. SYNC: Update documentation
35
- ↓ (3-way review)
36
- 4. VERIFY: Final validation + PR
25
+ 1. MAINTAIN: Audit → Clean → Sync docs (single pass)
26
+ ↓ (build + test checks, 3-way review)
27
+ 2. REVIEW: Create PR
37
28
  ↓ (3-way review)
38
- PR with maintenance changes
39
- ↓
40
29
  Architect reviews → Merge
41
30
  ```
42
31
 
43
- Each phase goes through build-verify cycles with 3-way consultation before proceeding.
32
+ Two phases total. One consultation during the maintain phase, one before PR.
44
33
 
45
34
  ## Prerequisites
46
35
 
47
- Before starting MAINTAIN:
48
- 1. Check `codev/maintain/` for last maintenance run
49
- 2. Note the base commit from that run
50
- 3. Focus on changes since that commit: `git log --oneline <base-commit>..HEAD`
36
+ Before starting:
37
+ 1. Check `codev/maintain/` for the last run number
38
+ 2. Note the base commit: `git log --oneline -1` on the last run file
39
+ 3. Focus on changes since then: `git log --oneline <base-commit>..HEAD`
51
40
 
52
41
  ---
53
42
 
54
- ## Maintenance Files
55
-
56
- Each maintenance run creates a numbered file in `codev/maintain/`:
57
-
58
- ```
59
- codev/maintain/
60
- ├── 1.md
61
- ├── 2.md
62
- └── ...
63
- ```
43
+ ## The Maintain Phase (Single Pass)
64
44
 
65
- **Template**: `codev/protocols/maintain/templates/maintenance-run.md`
45
+ The builder works through these tasks in order, committing as they go.
66
46
 
67
- The file records:
68
- - Base commit (starting point)
69
- - Tasks completed
70
- - Findings and deferred items
71
- - Summary
47
+ ### Step 1: Audit
72
48
 
73
- ---
49
+ Identify what needs fixing. Don't fix yet — just catalog.
74
50
 
75
- ## Task List
76
-
77
- ### Code Hygiene Tasks
78
-
79
- | Task | Parallelizable | Human Review? | Description |
80
- |------|----------------|---------------|-------------|
81
- | Remove dead code | Yes | No | Delete unused functions, imports, unreachable code |
82
- | Remove unused dependencies | Yes | Yes | Check package.json/requirements.txt for unused packages |
83
- | Clean unused flags | Yes | No | Remove feature flags that are always on/off |
84
- | Fix flaky tests | No | Yes | Investigate and fix intermittently failing tests |
85
- | Update outdated dependencies | Yes | Yes | Bump dependencies with breaking change review |
86
- | Identify duplicate code | Yes | Yes | Find repeated patterns that should be utility functions |
87
-
88
- **Tools**:
51
+ **Dead code**:
89
52
  ```bash
90
- # TypeScript/JavaScript
91
- npx ts-prune # Find unused exports
92
- npx depcheck # Find unused dependencies
93
- npx jscpd . # Find copy-paste code (optional)
53
+ # Find unused exports (TypeScript)
54
+ npx ts-prune 2>/dev/null || echo "ts-prune not available"
94
55
 
95
- # Python
96
- ruff check --select F401 # Find unused imports
56
+ # Find unused dependencies
57
+ npx depcheck 2>/dev/null || echo "depcheck not available"
97
58
  ```
98
59
 
99
- ### Documentation Sync Tasks
100
-
101
- | Task | Parallelizable | Human Review? | Description |
102
- |------|----------------|---------------|-------------|
103
- | Update arch.md | Yes | No | Sync architecture doc with actual codebase |
104
- | Generate lessons-learned.md | Yes | Yes | Extract wisdom from review documents |
105
- | Sync CLAUDE.md ↔ AGENTS.md | Yes | No | Ensure both files match |
106
- | Prune documentation | Yes | Yes | Remove obsolete info, keep CLAUDE.md/README.md under 400 lines |
107
- | Check spec/plan/review consistency | Yes | Yes | Find specs without reviews, plans that don't match code |
108
- | Remove stale doc references | Yes | No | Delete references to deleted code/files |
109
-
110
- ### Project Tracking Tasks
111
-
112
- | Task | Parallelizable | Human Review? | Description |
113
- |------|----------------|---------------|-------------|
114
- | Update GitHub Issue statuses | Yes | No | Close completed issues, update labels |
115
-
116
- ### Framework Tasks
117
-
118
- | Task | Parallelizable | Human Review? | Description |
119
- |------|----------------|---------------|-------------|
120
- | Run codev update | No | Yes | Update codev framework to latest version |
121
-
122
- ---
123
-
124
- ## Task Details
125
-
126
- ### Update arch.md
127
-
128
- Scan the actual codebase and update `codev/resources/arch.md`:
129
-
130
- **Discovery phase**:
131
- 1. `git log --oneline <base-commit>..HEAD` - what changed since last maintenance
132
- 2. `ls -R` key directories to find new files/modules
133
- 3. `grep` for new exports, classes, key functions
134
- 4. Review new/modified specs: `git diff <base-commit>..HEAD --name-only -- codev/specs/`
135
- 5. Review new/modified plans: `git diff <base-commit>..HEAD --name-only -- codev/plans/`
136
-
137
- **Update arch.md**:
138
- 1. Verify directory structure matches documented structure
139
- 2. Update component descriptions for changed modules
140
- 3. Add new utilities/helpers discovered
141
- 4. Remove references to deleted code
142
- 5. Update technology stack if dependencies changed
143
- 6. Document new integration points or APIs
144
- 7. Capture architectural decisions from new specs/plans
145
-
146
- **Primary sources** (specs/plans):
147
- - Architectural decisions from specs
148
- - Component relationships from plans
149
- - Design rationale and tradeoffs
150
-
151
- **Secondary sources** (code):
152
- - File locations and their purpose
153
- - Key functions/classes and what they do
154
- - Data flow and dependencies
155
- - Configuration options
156
- - CLI commands and flags
157
-
158
- **What NOT to include**:
159
- - Implementation details that change frequently
160
- - Line numbers (they go stale)
161
- - Full API documentation (use JSDoc/docstrings for that)
162
-
163
- **Primary Purpose**: arch.md should enable a developer (or AI agent) to rapidly understand the entire system - not just file locations, but **how things actually work**.
164
-
165
- **Recommended Document Structure**:
166
- ```markdown
167
- # Project Architecture
168
-
169
- ## Overview
170
- [High-level description: what the system does, core design philosophy, 2-3 sentences]
171
-
172
- ## Quick Start for Developers
173
- [The fastest path to understanding: "To understand X, read Y first"]
174
-
175
- ## Technology Stack
176
- [Technologies, frameworks, key dependencies with versions]
177
-
178
- ## Directory Structure
179
- [Complete directory tree with explanations for each major directory]
180
-
181
- ## Major Components
182
-
183
- ### [Component Name] (e.g., Agent Farm)
184
- - **Purpose**: What problem it solves
185
- - **Location**: path/to/component
186
- - **How It Works**:
187
- - Step-by-step explanation of the mechanism
188
- - Key technologies used (e.g., "uses shellper processes for terminal persistence")
189
- - Runtime behavior (e.g., "spawns a shellper process per builder terminal")
190
- - State management (e.g., "state stored in SQLite at .agent-farm/state.db")
191
- - **Key Files**:
192
- - `file.ts` - does X
193
- - `other.ts` - handles Y
194
- - **Configuration**: How to customize behavior
195
- - **Common Operations**: Examples of typical usage
196
-
197
- [Repeat for each major component - be thorough about HOW, not just WHAT]
198
-
199
- ## Utility Functions & Helpers
200
- ### [Utility Category]
201
- - **File**: path/to/utility.ts
202
- - **Functions**: `functionName()` - Description and use case
203
- - **When to Use**: Guidance on appropriate usage
204
-
205
- ## Data Flow
206
- [How data moves through the system, with concrete examples]
207
-
208
- ## Key Design Decisions
209
- [Important architectural choices and their rationale - the WHY]
210
-
211
- ## Integration Points
212
- [External services, APIs, databases, and how they connect]
213
-
214
- ## Development Patterns
215
- [Common patterns used throughout the codebase]
216
- ```
217
-
218
- **Critical: The "How It Works" Requirement**
219
-
220
- For each major component, arch.md MUST explain the implementation mechanism, not just the purpose. Examples of good vs bad:
221
-
222
- | Bad (just WHAT) | Good (includes HOW) |
223
- |-----------------|---------------------|
224
- | "Agent Farm manages builders" | "Agent Farm spawns builders in isolated git worktrees. Each builder runs in a shellper-backed terminal session. The Tower dashboard exposes terminals via WebSocket. State is persisted in SQLite." |
225
- | "Consult tool queries AI models" | "Consult shells out to external CLIs (gemini-cli, codex, claude). It writes the consultant role to a temp file, sets environment variables, and streams stdout/stderr back to the user." |
226
-
227
- This level of detail enables rapid onboarding and debugging.
228
-
229
- **Content Quality Standards**:
230
- - **Be Specific**: Include exact file paths, actual function names, concrete examples
231
- - **Maintain Accuracy**: Cross-reference specs/plans with actual implementation; flag discrepancies
232
- - **Optimize for Quick Understanding**: Use clear hierarchy, highlight commonly used components
233
- - **Stay Current**: Reflect actual state, not aspirational; remove deprecated components
234
-
235
- **Special Attention Areas**:
236
-
237
- 1. **Utility Functions** (critical for productivity):
238
- - Document every utility function with exact location
239
- - Explain what each does and when to use it
240
- - Include parameter types and return types
241
-
242
- 2. **Directory Structure** (often first thing referenced):
243
- - Keep directory tree up-to-date and complete
244
- - Explain purpose of each major directory
245
- - Highlight where specific types of files should be placed
246
-
247
- 3. **Integration Points** (critical for understanding system boundaries):
248
- - Document all external dependencies and APIs
249
- - Explain how different parts connect
250
- - Note special configuration requirements
251
-
252
- **Quality Assurance Before Finalizing**:
253
- - [ ] All file paths are correct and current
254
- - [ ] All documented functions actually exist
255
- - [ ] Directory structure matches reality
256
- - [ ] Architectural decisions are accurately represented
257
- - [ ] Document is internally consistent
258
-
259
- **Constraints**:
260
- - Never invent structure - only document what exists or is in specs/plans
261
- - Never make architectural decisions - document them, don't make them
262
- - Always verify documentation against actual implementation
263
-
264
- ### Generate lessons-learned.md
265
-
266
- Extract actionable wisdom from review documents into `codev/resources/lessons-learned.md`:
267
-
268
- **Discovery phase**:
269
- 1. Find new/modified reviews: `git diff <base-commit>..HEAD --name-only -- codev/reviews/`
270
- 2. Read each new/modified review file
271
-
272
- **Extract from reviews**:
273
- 1. Read all files in `codev/reviews/`
274
- 2. Extract lessons that are:
275
- - Actionable (not just "we learned X")
276
- - Durable (still relevant)
277
- - General (applicable beyond one project)
278
- 3. Organize by topic (Testing, Architecture, Process, etc.)
279
- 4. Link back to source review
280
- 5. Prune outdated lessons
281
-
282
- **Template**:
283
- ```markdown
284
- # Lessons Learned
285
-
286
- ## Testing
287
- - [From 1] Always use XDG sandboxing in tests to avoid touching real $HOME
288
- - [From 9] Verify dependencies actually export what you expect
289
-
290
- ## Architecture
291
- - [From 8] Single source of truth beats distributed state
292
- - [From 31] SQLite with WAL mode handles concurrency better than JSON files
60
+ **Stale documentation**:
61
+ ```bash
62
+ # What changed since last maintenance?
63
+ git log --oneline <base-commit>..HEAD
293
64
 
294
- ## Process
295
- - [From 1] Multi-agent consultation catches issues humans miss
65
+ # Check arch.md references still exist
66
+ grep -oE '[a-zA-Z]+/[a-zA-Z/]+\.[a-z]+' codev/resources/arch.md | sort -u | while read f; do
67
+ [ -e "$f" ] || echo "Missing: $f"
68
+ done
296
69
  ```
297
70
 
298
- ### Sync CLAUDE.md ↔ AGENTS.md
71
+ **Stale project tracking**:
72
+ - GitHub Issues that should be closed
73
+ - Labels that need updating
299
74
 
300
- Ensure both instruction files contain the same content:
75
+ Record findings in the maintenance run file (`codev/maintain/NNNN.md`).
301
76
 
302
- 1. Diff the two files
303
- 2. Identify divergence
304
- 3. Update the stale one to match
305
- 4. Both should be identical (per AGENTS.md standard)
77
+ ### Step 2: Clean
306
78
 
307
- ### Prune Documentation
79
+ For each finding from the audit:
80
+ 1. Verify it's truly unused (grep the codebase)
81
+ 2. Remove it (use `git rm` for tracked files)
82
+ 3. Verify build + tests still pass
83
+ 4. Commit with `[Maintain] Remove unused X`
308
84
 
309
- **CRITICAL: Documentation pruning requires JUSTIFICATION for every deletion.**
85
+ **Rules**:
86
+ - One removal at a time — don't batch unrelated changes
87
+ - Verify after each removal — build must pass
88
+ - Use soft deletion for untracked files: `mv file codev/maintain/.trash/$(date +%Y-%m-%d)/`
89
+ - Never use `git add -A` or `git add .`
310
90
 
311
- Size targets (~400 lines for CLAUDE.md/README.md) are **guidelines, not mandates**. Never sacrifice clarity or important content just to hit a line count.
91
+ ### Step 3: Sync Documentation
312
92
 
313
- **Before deleting ANY content, document:**
314
- 1. **What** is being removed (quote or summarize)
315
- 2. **Why** it's being removed:
316
- - `OBSOLETE` - References deleted code/features
317
- - `DUPLICATIVE` - Same info exists elsewhere (cite location)
318
- - `MOVED` - Relocated to another file (cite new location)
319
- - `VERBOSE` - Can be condensed without losing meaning
320
- 3. **Decision** - Delete, move, or keep with note
93
+ **arch.md**: Compare documented structure with actual codebase. Update:
94
+ - Directory structure
95
+ - Component descriptions (explain HOW things work, not just WHAT)
96
+ - Key files and their purposes
97
+ - Remove references to deleted code
98
+ - Add new components/utilities
321
99
 
322
- **Create a deletion log in your maintenance file:**
323
- ```markdown
324
- ## Documentation Changes
325
-
326
- ### arch.md
327
- | Section | Action | Reason |
328
- |---------|--------|--------|
329
- | "Old API docs" | DELETED | OBSOLETE - API removed in v1.2 |
330
- | "Installation" | MOVED | To INSTALL.md for brevity |
331
- | "Architecture patterns" | KEPT | Still relevant, referenced by builders |
332
- ```
100
+ **lessons-learned.md**: Scan `codev/reviews/` for new reviews since last run. Extract lessons that are actionable, durable, and general.
333
101
 
334
- **Files to review**:
335
- - `codev/resources/arch.md` - remove references to deleted code/modules
336
- - `codev/resources/lessons-learned.md` - remove outdated lessons
337
- - `CLAUDE.md` / `AGENTS.md` - target ~400 lines (guideline, not hard limit)
338
- - `README.md` - target ~400 lines (guideline, not hard limit)
102
+ **CLAUDE.md / AGENTS.md**: Diff the two files. They must be identical. Update the stale one.
339
103
 
340
- **Conservative approach**:
104
+ **Documentation pruning**:
105
+ - Remove obsolete references
106
+ - ~400 line guideline for CLAUDE.md/README.md (not a hard limit)
107
+ - Document every deletion with justification (OBSOLETE, DUPLICATIVE, MOVED, VERBOSE)
341
108
  - When in doubt, KEEP the content
342
- - If unsure, ASK the architect before deleting
343
- - Prefer MOVING over DELETING
344
- - Never delete "development patterns" or "best practices" sections without explicit approval
345
-
346
- **What to extract (move, don't delete)**:
347
- - Detailed command references → `codev/resources/commands/`
348
- - Protocol details → `codev/protocols/*/protocol.md`
349
- - Tool configuration → `codev/resources/`
350
-
351
- **What to ALWAYS keep in CLAUDE.md**:
352
- - Git prohibitions and safety rules
353
- - Critical workflow instructions
354
- - Protocol selection guidance
355
- - Consultation requirements
356
- - Links to detailed docs
357
-
358
- **Good candidates for deletion from CLAUDE.md**:
359
- - Content duplicated elsewhere (e.g., in protocol files, role files, docs/)
360
- - **When removing duplicated content**: Replace with a pointer to the canonical location
361
- ```markdown
362
- ## Consult Tool
363
-
364
- See `codev/resources/commands/consult.md` for full documentation.
365
- ```
366
- - This keeps CLAUDE.md as an index/guide rather than duplicating detailed docs
367
-
368
- ### Remove Dead Code
369
-
370
- Use static analysis to find and remove unused code:
371
-
372
- 1. Run analysis tools (ts-prune, depcheck, ruff)
373
- 2. Review findings for false positives
374
- 3. Use `git rm` to remove confirmed dead code
375
- 4. Commit with descriptive message
376
-
377
- **Important**: Use `git rm`, not `rm`. Git history preserves deleted files.
378
-
379
- ### Update Dependencies
380
109
 
381
- Review and update outdated dependencies:
382
-
383
- 1. Run `npm outdated` or equivalent
384
- 2. Categorize updates:
385
- - Patch: Safe to auto-update
386
- - Minor: Review changelog
387
- - Major: Requires human review for breaking changes
388
- 3. Update and test
389
- 4. Document any migration steps
390
-
391
- ### Run codev update
392
-
393
- Update the codev framework to the latest version:
110
+ ### Step 4: Final Checks
394
111
 
395
112
  ```bash
396
- codev update
113
+ # Build and test from the package directory
114
+ cd packages/codev && pnpm build && pnpm test
397
115
  ```
398
116
 
399
- This updates protocols, templates, and agents while preserving your specs, plans, and reviews.
117
+ Both must pass before moving to the review phase.
400
118
 
401
119
  ---
402
120
 
403
- ## Validation
121
+ ## Maintenance Run File
404
122
 
405
- After completing tasks, validate the codebase:
123
+ Each run creates `codev/maintain/NNNN.md`:
406
124
 
407
- - [ ] All tests pass
408
- - [ ] Build succeeds
409
- - [ ] No import/module errors
410
- - [ ] Documentation links resolve
411
- - [ ] Linter passes
125
+ ```markdown
126
+ # Maintenance Run NNNN
412
127
 
413
- If validation fails, investigate and fix before creating PR.
128
+ **Date**: YYYY-MM-DD
129
+ **Base Commit**: <hash>
130
+ **PR**: #NNN
414
131
 
415
- ---
132
+ ## Changes Since Last Run
416
133
 
417
- ## 3-Way Review (Before PR)
134
+ <key commits summary>
418
135
 
419
- After completing all tasks and validation, run a 3-way consultation review:
136
+ ## What Was Done
420
137
 
421
- ```bash
422
- # Run all three in parallel
423
- consult -m gemini --protocol maintain --type pr &
424
- consult -m codex --protocol maintain --type pr &
425
- consult -m claude --protocol maintain --type pr &
426
- wait
427
- ```
138
+ ### Dead Code Removed
139
+ - `path/to/file.ts`: `unusedFunction()` — not imported anywhere
140
+ - Removed `some-package` dependency — zero imports
428
141
 
429
- **Focus areas for maintenance review:**
430
- - Are deletions justified and documented?
431
- - Is arch.md accurate and complete?
432
- - Are lessons-learned.md entries actionable?
433
- - Any regressions or side effects?
142
+ ### Documentation Updated
143
+ - arch.md: Added VS Code extension section, removed old dashboard-server refs
144
+ - lessons-learned.md: Extracted 3 lessons from reviews 653, 672
434
145
 
435
- **Verdicts:**
436
- - All APPROVE → Create PR
437
- - Any REQUEST_CHANGES → Address feedback, re-run review
438
- - Conflicting opinions → Use judgment, document decision
146
+ ### Documentation Changes Log
147
+ | Document | Section | Action | Reason |
148
+ |----------|---------|--------|--------|
149
+ | arch.md | "Dashboard Server" | DELETED | OBSOLETE — replaced by Tower |
439
150
 
440
- Only create the PR after the 3-way review passes.
151
+ ## Deferred
441
152
 
442
- ---
153
+ - Items found but not worth fixing now
443
154
 
444
- ## Rollback Strategy
155
+ ## Summary
445
156
 
446
- ### For code changes
447
- ```bash
448
- # Git history preserves everything
449
- git log --all --full-history -- path/to/file
450
- git checkout <commit>~1 -- path/to/file
157
+ <2-3 sentences>
451
158
  ```
452
159
 
453
- ### For untracked files
454
- Move to `codev/maintain/.trash/YYYY-MM-DD/` before deleting. Retained for 30 days.
160
+ Keep it factual and short. The run file documents what happened, not what might happen.
455
161
 
456
162
  ---
457
163
 
@@ -459,49 +165,45 @@ Move to `codev/maintain/.trash/YYYY-MM-DD/` before deleting. Retained for 30 day
459
165
 
460
166
  ```
461
167
  [Maintain] Remove 5 unused exports
462
- [Maintain] Update arch.md with new utilities
463
- [Maintain] Generate lessons-learned.md
168
+ [Maintain] Remove http-proxy dependency
169
+ [Maintain] Update arch.md — add VS Code extension, remove dashboard-server refs
170
+ [Maintain] Generate lessons-learned.md from reviews 653, 672
464
171
  [Maintain] Sync CLAUDE.md with AGENTS.md
465
- [Maintain] Update dependencies (patch)
466
172
  ```
467
173
 
468
174
  ---
469
175
 
470
176
  ## Governance
471
177
 
472
- MAINTAIN is an **operational protocol**, not a feature development protocol:
178
+ MAINTAIN is an operational protocol, not a feature protocol:
473
179
 
474
180
  | Document | Required? |
475
181
  |----------|-----------|
476
182
  | Spec | No |
477
183
  | Plan | No |
478
- | Review | No |
479
- | 3-Way Consultation | **Yes** (before creating PR) |
184
+ | Review | No (maintenance run file serves this purpose) |
185
+ | Consultation | Yes — 3-way review before PR |
480
186
 
481
- **Exception**: If MAINTAIN reveals need for architectural changes, those should follow SPIR.
187
+ If maintenance reveals need for architectural changes, those should follow SPIR.
482
188
 
483
189
  ---
484
190
 
485
- ## Best Practices
191
+ ## Rules
486
192
 
487
- 1. **Don't be aggressive**: When in doubt, KEEP the content. It's easier to delete later than to recover lost knowledge.
488
- 2. **Check git blame**: Understand why code/docs exist before removing
489
- 3. **Run full test suite**: Not just affected tests
490
- 4. **Group related changes**: One commit per logical change
491
- 5. **Document EVERY deletion**: Include what, why, and where (if moved)
492
- 6. **Ask when unsure**: Consult architect before removing "important-looking" content
493
- 7. **Prefer moving over deleting**: Extract to another file rather than removing entirely
494
- 8. **Size targets are guidelines**: Never sacrifice clarity to hit a line count
495
-
496
- ---
193
+ 1. **Don't be aggressive** — when in doubt, KEEP the content
194
+ 2. **Check git blame** — understand why code/docs exist before removing
195
+ 3. **Run full test suite** — not just affected tests
196
+ 4. **Group related changes** — one commit per logical change
197
+ 5. **Document every deletion** — what, why, and where (if moved)
198
+ 6. **Prefer moving over deleting** — extract to another file rather than removing
199
+ 7. **Size targets are guidelines** — never sacrifice clarity to hit a line count
497
200
 
498
201
  ## Anti-Patterns
499
202
 
500
- 1. **Aggressive rewriting without explanation**: "I condensed it" is not a reason
501
- 2. **Deleting without documenting why**: Every deletion needs justification in the maintenance file
502
- 3. **Hitting line count targets at all costs**: 400 lines is a guideline, not a mandate
503
- 4. **Removing "patterns" or "best practices" sections**: These are high-value content
504
- 5. **Deleting everything the audit finds**: Review each item individually
505
- 6. **Skipping validation**: "It looked dead/obsolete" is not validation
506
- 7. **Using `rm` instead of `git rm`**: Lose history
507
- 8. **Making changes the architect can't review**: Big deletions need clear explanations
203
+ 1. Aggressive rewriting without explanation
204
+ 2. Deleting without documenting why
205
+ 3. Hitting line count targets at all costs
206
+ 4. Removing "patterns" or "best practices" sections without explicit approval
207
+ 5. Deleting everything the audit finds — review each item individually
208
+ 6. Skipping validation — "it looked dead" is not validation
209
+ 7. Using `rm` instead of `git rm`