@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
@@ -0,0 +1,88 @@
1
+ # MAINTAIN Phase Prompt
2
+
3
+ You are executing the **maintain** phase — a single pass covering audit, cleanup, and doc sync.
4
+
5
+ ## Context
6
+
7
+ - **Current State**: {{current_state}}
8
+
9
+ ## Step 1: Determine Scope
10
+
11
+ ```bash
12
+ ls codev/maintain/
13
+ ```
14
+
15
+ Find the last run number and its base commit. Then see what changed:
16
+
17
+ ```bash
18
+ git log --oneline <base-commit>..HEAD
19
+ ```
20
+
21
+ Create your maintenance run file: `codev/maintain/NNNN.md` (next number in sequence).
22
+
23
+ ## Step 2: Audit
24
+
25
+ Identify dead code, unused dependencies, and stale documentation. Don't fix yet — catalog first.
26
+
27
+ ```bash
28
+ # Dead exports
29
+ npx ts-prune 2>/dev/null || echo "ts-prune not available"
30
+
31
+ # Unused dependencies
32
+ npx depcheck 2>/dev/null || echo "depcheck not available"
33
+
34
+ # Stale arch.md references
35
+ grep -oE '[a-zA-Z]+/[a-zA-Z/]+\.[a-z]+' codev/resources/arch.md | sort -u | while read f; do
36
+ [ -e "$f" ] || echo "Missing: $f"
37
+ done
38
+ ```
39
+
40
+ Record all findings in the maintenance run file.
41
+
42
+ ## Step 3: Clean
43
+
44
+ For each audit finding:
45
+ 1. Verify it's truly unused (grep the codebase)
46
+ 2. Remove with `git rm` (tracked) or move to `codev/maintain/.trash/$(date +%Y-%m-%d)/` (untracked)
47
+ 3. Build and test: `cd packages/codev && pnpm build && pnpm test`
48
+ 4. Commit: `git add <specific-files> && git commit -m "[Maintain] Remove unused X"`
49
+
50
+ One removal at a time. Verify after each. Never use `git add -A`.
51
+
52
+ ## Step 4: Sync Documentation
53
+
54
+ **arch.md**: Read `codev/resources/arch.md`, compare with actual codebase. Update directory structure, component descriptions, key files. Remove references to deleted code. Add new components. Explain HOW things work, not just WHAT.
55
+
56
+ **lessons-learned.md**: Scan `codev/reviews/` for new reviews since the base commit. Extract actionable, durable, general lessons.
57
+
58
+ **CLAUDE.md / AGENTS.md**: `diff CLAUDE.md AGENTS.md` — they must be identical. Update the stale one.
59
+
60
+ **Pruning**: Remove obsolete content. Document every deletion with justification (OBSOLETE, DUPLICATIVE, MOVED, VERBOSE). When in doubt, keep.
61
+
62
+ Commit documentation changes:
63
+ ```bash
64
+ git add codev/resources/arch.md codev/resources/lessons-learned.md
65
+ git commit -m "[Maintain] Update arch.md and lessons-learned.md"
66
+ ```
67
+
68
+ ## Step 5: Final Checks
69
+
70
+ ```bash
71
+ cd packages/codev && pnpm build && pnpm test
72
+ ```
73
+
74
+ Both must pass. Update the maintenance run file with a summary of everything done.
75
+
76
+ ## Signals
77
+
78
+ When all work is complete and build/tests pass:
79
+
80
+ ```
81
+ <signal>PHASE_COMPLETE</signal>
82
+ ```
83
+
84
+ If blocked:
85
+
86
+ ```
87
+ <signal>BLOCKED:reason</signal>
88
+ ```
@@ -0,0 +1,84 @@
1
+ # REVIEW Phase Prompt
2
+
3
+ You are executing the **review** phase of the MAINTAIN protocol.
4
+
5
+ ## Context
6
+
7
+ - **Current State**: {{current_state}}
8
+
9
+ ## Process
10
+
11
+ ### 1. Final Validation
12
+
13
+ ```bash
14
+ cd packages/codev && pnpm build && pnpm test
15
+ ```
16
+
17
+ Both must pass. If either fails, fix before proceeding.
18
+
19
+ ### 2. Verify Documentation Links
20
+
21
+ ```bash
22
+ grep -oE '[a-zA-Z]+/[a-zA-Z/]+\.[a-z]+' codev/resources/arch.md | sort -u | while read f; do
23
+ [ -e "$f" ] || echo "Missing: $f"
24
+ done
25
+ ```
26
+
27
+ ### 3. Finalize Maintenance Run File
28
+
29
+ Update `codev/maintain/NNNN.md` with:
30
+ - PR number (once created)
31
+ - Final summary of what was done
32
+ - Deferred items (if any)
33
+
34
+ ### 4. Create PR
35
+
36
+ **PR body requirements**: If this maintenance run was triggered by a GitHub issue
37
+ (e.g. "track down dead X", "clean up Y module"), the PR body MUST include
38
+ `Closes #<N>` for that issue so GitHub auto-closes it on merge. If multiple
39
+ issues are addressed in one run, include one `Closes #<N>` per issue.
40
+
41
+ **Exception**: if this PR only partially addresses a tracking issue (e.g. more
42
+ cleanup passes are planned), use `Refs #<N>` or `Part of #<N>` instead.
43
+
44
+ If the run was not tied to any issue, the `Closes` line can be omitted.
45
+
46
+ ```bash
47
+ git push origin HEAD
48
+
49
+ gh pr create --title "[Maintain] Codebase maintenance run NNNN" --body "$(cat <<'PREOF'
50
+ ## Summary
51
+
52
+ <2-3 bullet points of what was done>
53
+
54
+ Closes #<N> <!-- Only if this run was triggered by a GitHub issue. Use "Refs #<N>" for partial cleanup. -->
55
+
56
+ ## Changes
57
+
58
+ - Dead code removed: X items
59
+ - Dependencies cleaned: Y packages
60
+ - Documentation updated: arch.md, lessons-learned.md
61
+ - Tests: all passing
62
+
63
+ ## Test plan
64
+
65
+ - [x] Build passes
66
+ - [x] All tests pass
67
+ - [x] Documentation links resolve
68
+ PREOF
69
+ )"
70
+ ```
71
+
72
+ ## Signals
73
+
74
+ When PR is created:
75
+
76
+ ```
77
+ <signal>PHASE_COMPLETE</signal>
78
+ ```
79
+
80
+ If blocked:
81
+
82
+ ```
83
+ <signal>BLOCKED:reason</signal>
84
+ ```
@@ -2,8 +2,8 @@
2
2
  "$schema": "../../protocol-schema.json",
3
3
  "name": "maintain",
4
4
  "alias": "maint",
5
- "version": "2.0.0",
6
- "description": "Codebase maintenance - dead code removal, doc sync, hygiene with 3-way review",
5
+ "version": "3.0.0",
6
+ "description": "Codebase maintenance — single-pass hygiene, doc sync, and cleanup with PR review",
7
7
  "input": {
8
8
  "type": "protocol",
9
9
  "required": false,
@@ -11,12 +11,12 @@
11
11
  },
12
12
  "phases": [
13
13
  {
14
- "id": "audit",
15
- "name": "Audit",
16
- "description": "Analyze codebase for dead code, unused dependencies, stale docs",
14
+ "id": "maintain",
15
+ "name": "Maintain",
16
+ "description": "Single-pass: audit, clean dead code, sync docs, verify build",
17
17
  "type": "build_verify",
18
18
  "build": {
19
- "prompt": "audit.md",
19
+ "prompt": "maintain.md",
20
20
  "artifact": "codev/maintain/*.md"
21
21
  },
22
22
  "verify": {
@@ -24,27 +24,6 @@
24
24
  "models": ["gemini", "codex", "claude"],
25
25
  "parallel": true
26
26
  },
27
- "max_iterations": 3,
28
- "on_complete": {
29
- "commit": true,
30
- "push": true
31
- },
32
- "next": "clean"
33
- },
34
- {
35
- "id": "clean",
36
- "name": "Clean",
37
- "description": "Remove identified dead code and unused dependencies",
38
- "type": "build_verify",
39
- "build": {
40
- "prompt": "clean.md",
41
- "artifact": "src/**/*.{ts,tsx,js,jsx}"
42
- },
43
- "verify": {
44
- "type": "impl",
45
- "models": ["gemini", "codex", "claude"],
46
- "parallel": true
47
- },
48
27
  "max_iterations": 5,
49
28
  "on_complete": {
50
29
  "commit": true,
@@ -52,46 +31,25 @@
52
31
  },
53
32
  "checks": {
54
33
  "build": {
55
- "command": "npm run build",
34
+ "command": "pnpm build",
56
35
  "on_fail": "retry",
57
36
  "max_retries": 2
58
37
  },
59
38
  "tests": {
60
- "command": "npm test -- --exclude='**/e2e/**'",
39
+ "command": "pnpm test",
61
40
  "on_fail": "retry",
62
41
  "max_retries": 2
63
42
  }
64
43
  },
65
- "next": "sync"
66
- },
67
- {
68
- "id": "sync",
69
- "name": "Sync Documentation",
70
- "description": "Update documentation to match current codebase",
71
- "type": "build_verify",
72
- "build": {
73
- "prompt": "sync.md",
74
- "artifact": "codev/resources/*.md"
75
- },
76
- "verify": {
77
- "type": "impl",
78
- "models": ["gemini", "codex", "claude"],
79
- "parallel": true
80
- },
81
- "max_iterations": 5,
82
- "on_complete": {
83
- "commit": true,
84
- "push": true
85
- },
86
- "next": "verify"
44
+ "next": "review"
87
45
  },
88
46
  {
89
- "id": "verify",
90
- "name": "Verify",
91
- "description": "Final validation and PR creation",
47
+ "id": "review",
48
+ "name": "Review",
49
+ "description": "Final validation, PR creation, 3-way review",
92
50
  "type": "build_verify",
93
51
  "build": {
94
- "prompt": "verify.md",
52
+ "prompt": "review.md",
95
53
  "artifact": "codev/maintain/*.md"
96
54
  },
97
55
  "verify": {
@@ -104,18 +62,6 @@
104
62
  "commit": true,
105
63
  "push": true
106
64
  },
107
- "checks": {
108
- "build": {
109
- "command": "npm run build",
110
- "on_fail": "retry",
111
- "max_retries": 2
112
- },
113
- "tests": {
114
- "command": "npm test",
115
- "on_fail": "retry",
116
- "max_retries": 2
117
- }
118
- },
119
65
  "gate": "maintain-complete",
120
66
  "next": null
121
67
  }
@@ -123,7 +69,7 @@
123
69
  "signals": {
124
70
  "PHASE_COMPLETE": {
125
71
  "description": "Signal current phase is complete",
126
- "transitions_to": "verify"
72
+ "transitions_to": "review"
127
73
  },
128
74
  "BLOCKED": {
129
75
  "description": "Signal maintenance is blocked",