@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
@@ -2,456 +2,229 @@
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
+ The two governance docs are siblings with **different purposes**: `arch.md` owns system shape (services, transports, mental models, verified-wrong assumptions about *this* system); `lessons-learned.md` owns durable engineering wisdom that applies *across* specs. Use the routing matrix below to decide where each fact belongs.
14
14
 
15
- ## When to Use MAINTAIN
15
+ ### Lives where: routing facts to the right home
16
+
17
+ | Type of fact/insight | Lives in |
18
+ |---|---|
19
+ | Current system shape (services, transports, key mental models) | `codev/resources/arch.md` |
20
+ | Mechanism for a unique subsystem | `codev/resources/arch.md` (subsystem section) OR a meta-spec under `codev/architecture/<domain>.md` if the mechanism is large enough to warrant its own doc |
21
+ | A durable engineering pattern that applies across multiple specs | `codev/resources/lessons-learned.md` |
22
+ | A spec-narrow fix recipe (only relevant inside the originating feature) | Spec review only — does NOT belong in `lessons-learned.md` |
23
+ | A system-shape surprise verified-wrong in production ("looks like X but isn't") | `codev/resources/arch.md` § "Verified-Wrong Assumptions" |
24
+ | Aspirational architectural direction (where we want to go) | The relevant meta-spec or roadmap doc, NOT `arch.md` body |
25
+ | A changelog entry ("we shipped X in spec Y on date Z") | `git log` + the spec/review document — NOT `arch.md`, NOT `lessons-learned.md` |
26
+ | A retired or removed component | Delete the section entirely; do NOT keep a "retired components" graveyard. (`git log` retains history.) |
27
+
28
+ The most commonly-misrouted entry is the system-shape surprise. 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`.
29
+
30
+ ## When to Use
16
31
 
17
- - When the user/architect requests it
18
32
  - Before a release (clean slate for shipping)
19
- - Quarterly maintenance window
20
33
  - After completing a major feature
34
+ - Quarterly maintenance window
21
35
  - When the codebase feels "crusty"
22
36
 
23
37
  ## Execution Model
24
38
 
25
- MAINTAIN is orchestrated by porch with 4 sequential phases:
26
-
27
39
  ```
28
- af spawn --protocol maintain
40
+ afx spawn --protocol maintain
29
41
  ↓
30
- 1. AUDIT: Scan for dead code, unused deps, stale docs
42
+ 1. MAINTAIN: Audit → Clean → Sync docs (single pass)
43
+ ↓ (build + test checks, 3-way review)
44
+ 2. REVIEW: Create PR
31
45
  ↓ (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
37
- ↓ (3-way review)
38
- PR with maintenance changes
39
- ↓
40
46
  Architect reviews → Merge
41
47
  ```
42
48
 
43
- Each phase goes through build-verify cycles with 3-way consultation before proceeding.
49
+ Two phases total. One consultation during the maintain phase, one before PR.
44
50
 
45
51
  ## Prerequisites
46
52
 
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`
53
+ Before starting:
54
+ 1. Check `codev/maintain/` for the last run number
55
+ 2. Note the base commit: `git log --oneline -1` on the last run file
56
+ 3. Focus on changes since then: `git log --oneline <base-commit>..HEAD`
51
57
 
52
58
  ---
53
59
 
54
- ## Maintenance Files
60
+ ## The Maintain Phase (Single Pass)
55
61
 
56
- Each maintenance run creates a numbered file in `codev/maintain/`:
62
+ The builder works through these tasks in order, committing as they go.
57
63
 
58
- ```
59
- codev/maintain/
60
- ├── 1.md
61
- ├── 2.md
62
- └── ...
63
- ```
64
+ ### Step 1: Audit
64
65
 
65
- **Template**: `codev/protocols/maintain/templates/maintenance-run.md`
66
+ Identify what needs fixing. Don't fix yet — just catalog.
66
67
 
67
- The file records:
68
- - Base commit (starting point)
69
- - Tasks completed
70
- - Findings and deferred items
71
- - Summary
72
-
73
- ---
74
-
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**:
68
+ **Dead code**:
89
69
  ```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)
70
+ # Find unused exports (TypeScript)
71
+ npx ts-prune 2>/dev/null || echo "ts-prune not available"
94
72
 
95
- # Python
96
- ruff check --select F401 # Find unused imports
73
+ # Find unused dependencies
74
+ npx depcheck 2>/dev/null || echo "depcheck not available"
97
75
  ```
98
76
 
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]
77
+ **Stale documentation**:
78
+ ```bash
79
+ # What changed since last maintenance?
80
+ git log --oneline <base-commit>..HEAD
213
81
 
214
- ## Development Patterns
215
- [Common patterns used throughout the codebase]
82
+ # Check arch.md references still exist
83
+ grep -oE '[a-zA-Z]+/[a-zA-Z/]+\.[a-z]+' codev/resources/arch.md | sort -u | while read f; do
84
+ [ -e "$f" ] || echo "Missing: $f"
85
+ done
216
86
  ```
217
87
 
218
- **Critical: The "How It Works" Requirement**
88
+ **Stale project tracking**:
89
+ - GitHub Issues that should be closed
90
+ - Labels that need updating
219
91
 
220
- For each major component, arch.md MUST explain the implementation mechanism, not just the purpose. Examples of good vs bad:
92
+ Record findings in the maintenance run file (`codev/maintain/NNNN.md`).
221
93
 
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." |
94
+ ### Step 2: Clean
226
95
 
227
- This level of detail enables rapid onboarding and debugging.
96
+ For each finding from the audit:
97
+ 1. Verify it's truly unused (grep the codebase)
98
+ 2. Remove it (use `git rm` for tracked files)
99
+ 3. Verify build + tests still pass
100
+ 4. Commit with `[Maintain] Remove unused X`
228
101
 
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
102
+ **Rules**:
103
+ - One removal at a time — don't batch unrelated changes
104
+ - Verify after each removal — build must pass
105
+ - Use soft deletion for untracked files: `mv file codev/maintain/.trash/$(date +%Y-%m-%d)/`
106
+ - Never use `git add -A` or `git add .`
234
107
 
235
- **Special Attention Areas**:
108
+ ### Step 3: Sync Documentation
236
109
 
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
110
+ Step 3 is split into two sub-steps: **Audit first, then update.** This split exists because `arch.md` and `lessons-learned.md` accumulate without bound when MAINTAIN does only "what's new" — the audit pass surfaces what should be cut so the update pass is not purely additive.
241
111
 
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
112
+ The `update-arch-docs` skill (at `.claude/skills/update-arch-docs/SKILL.md`) is invoked by both sub-steps. Read it before starting Step 3 so the discipline is fresh.
246
113
 
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
114
+ #### Step 3a: Audit documentation
251
115
 
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
116
+ Invoke the `update-arch-docs` skill in **audit-mode**. The skill reads `codev/resources/arch.md` and `codev/resources/lessons-learned.md` end-to-end against the discipline below and produces a candidate-cuts list (with reasons) recorded in the run file (`codev/maintain/NNNN.md`) under a new `## Audit Findings` section before any edits land.
258
117
 
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
118
+ **Per-arch.md-section pruning checklist** — for each section in `arch.md`, ask:
119
+ - Does it describe **current state**? If aspirational, the section moves to a meta-spec; `arch.md` keeps a 1-paragraph summary + pointer (or nothing, if the meta-spec stands on its own).
120
+ - Does it duplicate a meta-spec? If yes, replace with a 1-paragraph summary + pointer.
121
+ - Is it a per-file enumeration that's gone stale? If yes, prune to the directory shape + a few key files.
122
+ - Is it a changelog/narrative section ("Spec 0042 added X")? If yes, absorb the architecturally-relevant facts and remove the spec-numbered framing.
123
+ - Is the component still alive? If retired, delete the section entirely.
263
124
 
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
125
+ **Per-lessons-learned.md-entry pruning checklist** — for each entry, ask:
126
+ - Is it cross-applicable beyond the spec that produced it? If no, remove (the lesson belongs in the spec's review).
127
+ - Is it terse (1–3 sentences)? If multi-paragraph, split or compress.
128
+ - Is the topic section the right home? If filed under "Architecture (continued)" or a spec-numbered section, move it to the right topical home.
129
+ - Is it a duplicate of an adjacent entry? If yes, fold them.
285
130
 
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
131
+ **Sample audit prompt** (paste into the skill invocation if you want a baseline checklist run):
289
132
 
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
293
-
294
- ## Process
295
- - [From 1] Multi-agent consultation catches issues humans miss
296
133
  ```
297
-
298
- ### Sync CLAUDE.md ↔ AGENTS.md
299
-
300
- Ensure both instruction files contain the same content:
301
-
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)
306
-
307
- ### Prune Documentation
308
-
309
- **CRITICAL: Documentation pruning requires JUSTIFICATION for every deletion.**
310
-
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.
312
-
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
321
-
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 |
134
+ Audit codev/resources/arch.md and codev/resources/lessons-learned.md against the
135
+ discipline in the update-arch-docs skill. For each section/entry, run the per-
136
+ arch.md-section and per-lessons-learned.md-entry pruning checklists from the
137
+ MAINTAIN protocol (Step 3a). Produce a candidate-cuts list with one-line reasons.
138
+ Bias toward fewer, higher-confidence cuts ("when in doubt, KEEP"). Record the
139
+ findings in the current run file's ## Audit Findings section before applying.
332
140
  ```
333
141
 
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)
339
-
340
- **Conservative approach**:
341
- - 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/`
142
+ **When in doubt, KEEP.** This rule is preserved from the older Step 3. A confident cut is better than three speculative ones. The audit pass is a *proposal*; the architect's PR review confirms it.
350
143
 
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
144
+ #### Step 3b: Update documentation
357
145
 
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
146
+ Apply the audit decisions from Step 3a, plus any additive content needed.
363
147
 
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
148
+ **arch.md**: Compare documented structure with actual codebase. Update:
149
+ - Directory structure
150
+ - Component descriptions (explain HOW things work, not just WHAT)
151
+ - Key files and their purposes
152
+ - Remove references to deleted code (per Step 3a audit findings)
153
+ - Add new components/utilities
367
154
 
368
- ### Remove Dead Code
155
+ **lessons-learned.md**: Scan `codev/reviews/` for new reviews since last run. Extract lessons that are actionable, durable, and general. Apply Step 3a's per-entry cuts.
369
156
 
370
- Use static analysis to find and remove unused code:
157
+ For specific additive changes, invoke `update-arch-docs` in **diff-mode** — it applies the smallest section update needed.
371
158
 
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
159
+ **CLAUDE.md / AGENTS.md**: Diff the two files. They must be identical. Update the stale one.
376
160
 
377
- **Important**: Use `git rm`, not `rm`. Git history preserves deleted files.
161
+ **Documentation pruning**:
162
+ - Remove obsolete references
163
+ - ~400 line guideline for CLAUDE.md/README.md (not a hard limit)
164
+ - Document every deletion with justification (OBSOLETE, DUPLICATIVE, MOVED, VERBOSE)
165
+ - When in doubt, KEEP the content
378
166
 
379
- ### Update Dependencies
167
+ ### Step 4: Final Checks
380
168
 
381
- Review and update outdated dependencies:
169
+ ```bash
170
+ # Build and test from the package directory
171
+ cd packages/codev && pnpm build && pnpm test
172
+ ```
382
173
 
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
174
+ Both must pass before moving to the review phase.
390
175
 
391
- ### Run codev update
176
+ ---
392
177
 
393
- Update the codev framework to the latest version:
178
+ ## Maintenance Run File
394
179
 
395
- ```bash
396
- codev update
397
- ```
180
+ Each run creates `codev/maintain/NNNN.md`:
398
181
 
399
- This updates protocols, templates, and agents while preserving your specs, plans, and reviews.
182
+ ```markdown
183
+ # Maintenance Run NNNN
400
184
 
401
- ---
185
+ **Date**: YYYY-MM-DD
186
+ **Base Commit**: <hash>
187
+ **PR**: #NNN
402
188
 
403
- ## Validation
189
+ ## Changes Since Last Run
404
190
 
405
- After completing tasks, validate the codebase:
191
+ <key commits summary>
406
192
 
407
- - [ ] All tests pass
408
- - [ ] Build succeeds
409
- - [ ] No import/module errors
410
- - [ ] Documentation links resolve
411
- - [ ] Linter passes
193
+ ## Audit Findings
412
194
 
413
- If validation fails, investigate and fix before creating PR.
195
+ Recorded by Step 3a (Audit documentation) before any edits land. One line per candidate cut.
414
196
 
415
- ---
197
+ ### arch.md
198
+ - <section-name>: <reason for proposed cut/compression>
416
199
 
417
- ## 3-Way Review (Before PR)
200
+ ### lessons-learned.md
201
+ - <entry>: <reason>
418
202
 
419
- After completing all tasks and validation, run a 3-way consultation review:
203
+ ## What Was Done
420
204
 
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
- ```
205
+ ### Dead Code Removed
206
+ - `path/to/file.ts`: `unusedFunction()` — not imported anywhere
207
+ - Removed `some-package` dependency — zero imports
428
208
 
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?
209
+ ### Documentation Updated
210
+ - arch.md: Added VS Code extension section, removed old dashboard-server refs
211
+ - lessons-learned.md: Extracted 3 lessons from reviews 653, 672
434
212
 
435
- **Verdicts:**
436
- - All APPROVE → Create PR
437
- - Any REQUEST_CHANGES → Address feedback, re-run review
438
- - Conflicting opinions → Use judgment, document decision
213
+ ### Documentation Changes Log
214
+ | Document | Section | Action | Reason |
215
+ |----------|---------|--------|--------|
216
+ | arch.md | "Dashboard Server" | DELETED | OBSOLETE — replaced by Tower |
439
217
 
440
- Only create the PR after the 3-way review passes.
218
+ ## Deferred
441
219
 
442
- ---
220
+ - Items found but not worth fixing now
443
221
 
444
- ## Rollback Strategy
222
+ ## Summary
445
223
 
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
224
+ <2-3 sentences>
451
225
  ```
452
226
 
453
- ### For untracked files
454
- Move to `codev/maintain/.trash/YYYY-MM-DD/` before deleting. Retained for 30 days.
227
+ Keep it factual and short. The run file documents what happened, not what might happen.
455
228
 
456
229
  ---
457
230
 
@@ -459,49 +232,45 @@ Move to `codev/maintain/.trash/YYYY-MM-DD/` before deleting. Retained for 30 day
459
232
 
460
233
  ```
461
234
  [Maintain] Remove 5 unused exports
462
- [Maintain] Update arch.md with new utilities
463
- [Maintain] Generate lessons-learned.md
235
+ [Maintain] Remove http-proxy dependency
236
+ [Maintain] Update arch.md — add VS Code extension, remove dashboard-server refs
237
+ [Maintain] Generate lessons-learned.md from reviews 653, 672
464
238
  [Maintain] Sync CLAUDE.md with AGENTS.md
465
- [Maintain] Update dependencies (patch)
466
239
  ```
467
240
 
468
241
  ---
469
242
 
470
243
  ## Governance
471
244
 
472
- MAINTAIN is an **operational protocol**, not a feature development protocol:
245
+ MAINTAIN is an operational protocol, not a feature protocol:
473
246
 
474
247
  | Document | Required? |
475
248
  |----------|-----------|
476
249
  | Spec | No |
477
250
  | Plan | No |
478
- | Review | No |
479
- | 3-Way Consultation | **Yes** (before creating PR) |
251
+ | Review | No (maintenance run file serves this purpose) |
252
+ | Consultation | Yes — 3-way review before PR |
480
253
 
481
- **Exception**: If MAINTAIN reveals need for architectural changes, those should follow SPIR.
254
+ If maintenance reveals need for architectural changes, those should follow SPIR.
482
255
 
483
256
  ---
484
257
 
485
- ## Best Practices
258
+ ## Rules
486
259
 
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
- ---
260
+ 1. **Don't be aggressive** — when in doubt, KEEP the content
261
+ 2. **Check git blame** — understand why code/docs exist before removing
262
+ 3. **Run full test suite** — not just affected tests
263
+ 4. **Group related changes** — one commit per logical change
264
+ 5. **Document every deletion** — what, why, and where (if moved)
265
+ 6. **Prefer moving over deleting** — extract to another file rather than removing
266
+ 7. **Size targets are guidelines** — never sacrifice clarity to hit a line count
497
267
 
498
268
  ## Anti-Patterns
499
269
 
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
270
+ 1. Aggressive rewriting without explanation
271
+ 2. Deleting without documenting why
272
+ 3. Hitting line count targets at all costs
273
+ 4. Removing "patterns" or "best practices" sections without explicit approval
274
+ 5. Deleting everything the audit finds — review each item individually
275
+ 6. Skipping validation — "it looked dead" is not validation
276
+ 7. Using `rm` instead of `git rm`