@cluesmith/codev 1.1.0

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 (245) hide show
  1. package/bin/af.js +8 -0
  2. package/bin/codev.js +4 -0
  3. package/bin/consult.js +7 -0
  4. package/dist/agent-farm/cli.d.ts +11 -0
  5. package/dist/agent-farm/cli.d.ts.map +1 -0
  6. package/dist/agent-farm/cli.js +359 -0
  7. package/dist/agent-farm/cli.js.map +1 -0
  8. package/dist/agent-farm/commands/cleanup.d.ts +12 -0
  9. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -0
  10. package/dist/agent-farm/commands/cleanup.js +154 -0
  11. package/dist/agent-farm/commands/cleanup.js.map +1 -0
  12. package/dist/agent-farm/commands/db.d.ts +38 -0
  13. package/dist/agent-farm/commands/db.d.ts.map +1 -0
  14. package/dist/agent-farm/commands/db.js +133 -0
  15. package/dist/agent-farm/commands/db.js.map +1 -0
  16. package/dist/agent-farm/commands/index.d.ts +11 -0
  17. package/dist/agent-farm/commands/index.d.ts.map +1 -0
  18. package/dist/agent-farm/commands/index.js +11 -0
  19. package/dist/agent-farm/commands/index.js.map +1 -0
  20. package/dist/agent-farm/commands/open.d.ts +15 -0
  21. package/dist/agent-farm/commands/open.d.ts.map +1 -0
  22. package/dist/agent-farm/commands/open.js +118 -0
  23. package/dist/agent-farm/commands/open.js.map +1 -0
  24. package/dist/agent-farm/commands/rename.d.ts +13 -0
  25. package/dist/agent-farm/commands/rename.d.ts.map +1 -0
  26. package/dist/agent-farm/commands/rename.js +33 -0
  27. package/dist/agent-farm/commands/rename.js.map +1 -0
  28. package/dist/agent-farm/commands/send.d.ts +9 -0
  29. package/dist/agent-farm/commands/send.d.ts.map +1 -0
  30. package/dist/agent-farm/commands/send.js +282 -0
  31. package/dist/agent-farm/commands/send.js.map +1 -0
  32. package/dist/agent-farm/commands/spawn.d.ts +15 -0
  33. package/dist/agent-farm/commands/spawn.d.ts.map +1 -0
  34. package/dist/agent-farm/commands/spawn.js +575 -0
  35. package/dist/agent-farm/commands/spawn.js.map +1 -0
  36. package/dist/agent-farm/commands/start.d.ts +9 -0
  37. package/dist/agent-farm/commands/start.d.ts.map +1 -0
  38. package/dist/agent-farm/commands/start.js +175 -0
  39. package/dist/agent-farm/commands/start.js.map +1 -0
  40. package/dist/agent-farm/commands/status.d.ts +8 -0
  41. package/dist/agent-farm/commands/status.d.ts.map +1 -0
  42. package/dist/agent-farm/commands/status.js +123 -0
  43. package/dist/agent-farm/commands/status.js.map +1 -0
  44. package/dist/agent-farm/commands/stop.d.ts +8 -0
  45. package/dist/agent-farm/commands/stop.d.ts.map +1 -0
  46. package/dist/agent-farm/commands/stop.js +76 -0
  47. package/dist/agent-farm/commands/stop.js.map +1 -0
  48. package/dist/agent-farm/commands/tower.d.ts +19 -0
  49. package/dist/agent-farm/commands/tower.d.ts.map +1 -0
  50. package/dist/agent-farm/commands/tower.js +125 -0
  51. package/dist/agent-farm/commands/tower.js.map +1 -0
  52. package/dist/agent-farm/commands/tutorial.d.ts +10 -0
  53. package/dist/agent-farm/commands/tutorial.d.ts.map +1 -0
  54. package/dist/agent-farm/commands/tutorial.js +49 -0
  55. package/dist/agent-farm/commands/tutorial.js.map +1 -0
  56. package/dist/agent-farm/commands/util.d.ts +15 -0
  57. package/dist/agent-farm/commands/util.d.ts.map +1 -0
  58. package/dist/agent-farm/commands/util.js +108 -0
  59. package/dist/agent-farm/commands/util.js.map +1 -0
  60. package/dist/agent-farm/db/errors.d.ts +17 -0
  61. package/dist/agent-farm/db/errors.d.ts.map +1 -0
  62. package/dist/agent-farm/db/errors.js +46 -0
  63. package/dist/agent-farm/db/errors.js.map +1 -0
  64. package/dist/agent-farm/db/index.d.ts +41 -0
  65. package/dist/agent-farm/db/index.d.ts.map +1 -0
  66. package/dist/agent-farm/db/index.js +168 -0
  67. package/dist/agent-farm/db/index.js.map +1 -0
  68. package/dist/agent-farm/db/migrate.d.ts +15 -0
  69. package/dist/agent-farm/db/migrate.d.ts.map +1 -0
  70. package/dist/agent-farm/db/migrate.js +137 -0
  71. package/dist/agent-farm/db/migrate.js.map +1 -0
  72. package/dist/agent-farm/db/schema.d.ts +16 -0
  73. package/dist/agent-farm/db/schema.d.ts.map +1 -0
  74. package/dist/agent-farm/db/schema.js +103 -0
  75. package/dist/agent-farm/db/schema.js.map +1 -0
  76. package/dist/agent-farm/db/types.d.ts +87 -0
  77. package/dist/agent-farm/db/types.d.ts.map +1 -0
  78. package/dist/agent-farm/db/types.js +65 -0
  79. package/dist/agent-farm/db/types.js.map +1 -0
  80. package/dist/agent-farm/index.d.ts +7 -0
  81. package/dist/agent-farm/index.d.ts.map +1 -0
  82. package/dist/agent-farm/index.js +373 -0
  83. package/dist/agent-farm/index.js.map +1 -0
  84. package/dist/agent-farm/servers/annotate-server.d.ts +9 -0
  85. package/dist/agent-farm/servers/annotate-server.d.ts.map +1 -0
  86. package/dist/agent-farm/servers/annotate-server.js +136 -0
  87. package/dist/agent-farm/servers/annotate-server.js.map +1 -0
  88. package/dist/agent-farm/servers/dashboard-server.d.ts +9 -0
  89. package/dist/agent-farm/servers/dashboard-server.d.ts.map +1 -0
  90. package/dist/agent-farm/servers/dashboard-server.js +939 -0
  91. package/dist/agent-farm/servers/dashboard-server.js.map +1 -0
  92. package/dist/agent-farm/servers/tower-server.d.ts +9 -0
  93. package/dist/agent-farm/servers/tower-server.d.ts.map +1 -0
  94. package/dist/agent-farm/servers/tower-server.js +463 -0
  95. package/dist/agent-farm/servers/tower-server.js.map +1 -0
  96. package/dist/agent-farm/state.d.ts +93 -0
  97. package/dist/agent-farm/state.d.ts.map +1 -0
  98. package/dist/agent-farm/state.js +253 -0
  99. package/dist/agent-farm/state.js.map +1 -0
  100. package/dist/agent-farm/tutorial/index.d.ts +8 -0
  101. package/dist/agent-farm/tutorial/index.d.ts.map +1 -0
  102. package/dist/agent-farm/tutorial/index.js +8 -0
  103. package/dist/agent-farm/tutorial/index.js.map +1 -0
  104. package/dist/agent-farm/tutorial/prompts.d.ts +57 -0
  105. package/dist/agent-farm/tutorial/prompts.d.ts.map +1 -0
  106. package/dist/agent-farm/tutorial/prompts.js +147 -0
  107. package/dist/agent-farm/tutorial/prompts.js.map +1 -0
  108. package/dist/agent-farm/tutorial/runner.d.ts +52 -0
  109. package/dist/agent-farm/tutorial/runner.d.ts.map +1 -0
  110. package/dist/agent-farm/tutorial/runner.js +204 -0
  111. package/dist/agent-farm/tutorial/runner.js.map +1 -0
  112. package/dist/agent-farm/tutorial/state.d.ts +26 -0
  113. package/dist/agent-farm/tutorial/state.d.ts.map +1 -0
  114. package/dist/agent-farm/tutorial/state.js +89 -0
  115. package/dist/agent-farm/tutorial/state.js.map +1 -0
  116. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +7 -0
  117. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +1 -0
  118. package/dist/agent-farm/tutorial/steps/first-spec.js +136 -0
  119. package/dist/agent-farm/tutorial/steps/first-spec.js.map +1 -0
  120. package/dist/agent-farm/tutorial/steps/implementation.d.ts +7 -0
  121. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +1 -0
  122. package/dist/agent-farm/tutorial/steps/implementation.js +76 -0
  123. package/dist/agent-farm/tutorial/steps/implementation.js.map +1 -0
  124. package/dist/agent-farm/tutorial/steps/index.d.ts +10 -0
  125. package/dist/agent-farm/tutorial/steps/index.d.ts.map +1 -0
  126. package/dist/agent-farm/tutorial/steps/index.js +10 -0
  127. package/dist/agent-farm/tutorial/steps/index.js.map +1 -0
  128. package/dist/agent-farm/tutorial/steps/planning.d.ts +7 -0
  129. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +1 -0
  130. package/dist/agent-farm/tutorial/steps/planning.js +143 -0
  131. package/dist/agent-farm/tutorial/steps/planning.js.map +1 -0
  132. package/dist/agent-farm/tutorial/steps/review.d.ts +7 -0
  133. package/dist/agent-farm/tutorial/steps/review.d.ts.map +1 -0
  134. package/dist/agent-farm/tutorial/steps/review.js +78 -0
  135. package/dist/agent-farm/tutorial/steps/review.js.map +1 -0
  136. package/dist/agent-farm/tutorial/steps/setup.d.ts +7 -0
  137. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +1 -0
  138. package/dist/agent-farm/tutorial/steps/setup.js +126 -0
  139. package/dist/agent-farm/tutorial/steps/setup.js.map +1 -0
  140. package/dist/agent-farm/tutorial/steps/welcome.d.ts +7 -0
  141. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +1 -0
  142. package/dist/agent-farm/tutorial/steps/welcome.js +50 -0
  143. package/dist/agent-farm/tutorial/steps/welcome.js.map +1 -0
  144. package/dist/agent-farm/types.d.ts +131 -0
  145. package/dist/agent-farm/types.d.ts.map +1 -0
  146. package/dist/agent-farm/types.js +5 -0
  147. package/dist/agent-farm/types.js.map +1 -0
  148. package/dist/agent-farm/utils/config.d.ts +27 -0
  149. package/dist/agent-farm/utils/config.d.ts.map +1 -0
  150. package/dist/agent-farm/utils/config.js +242 -0
  151. package/dist/agent-farm/utils/config.js.map +1 -0
  152. package/dist/agent-farm/utils/deps.d.ts +51 -0
  153. package/dist/agent-farm/utils/deps.d.ts.map +1 -0
  154. package/dist/agent-farm/utils/deps.js +194 -0
  155. package/dist/agent-farm/utils/deps.js.map +1 -0
  156. package/dist/agent-farm/utils/index.d.ts +6 -0
  157. package/dist/agent-farm/utils/index.d.ts.map +1 -0
  158. package/dist/agent-farm/utils/index.js +6 -0
  159. package/dist/agent-farm/utils/index.js.map +1 -0
  160. package/dist/agent-farm/utils/logger.d.ts +31 -0
  161. package/dist/agent-farm/utils/logger.d.ts.map +1 -0
  162. package/dist/agent-farm/utils/logger.js +58 -0
  163. package/dist/agent-farm/utils/logger.js.map +1 -0
  164. package/dist/agent-farm/utils/orphan-handler.d.ts +27 -0
  165. package/dist/agent-farm/utils/orphan-handler.d.ts.map +1 -0
  166. package/dist/agent-farm/utils/orphan-handler.js +127 -0
  167. package/dist/agent-farm/utils/orphan-handler.js.map +1 -0
  168. package/dist/agent-farm/utils/port-registry.d.ts +58 -0
  169. package/dist/agent-farm/utils/port-registry.d.ts.map +1 -0
  170. package/dist/agent-farm/utils/port-registry.js +149 -0
  171. package/dist/agent-farm/utils/port-registry.js.map +1 -0
  172. package/dist/agent-farm/utils/shell.d.ts +45 -0
  173. package/dist/agent-farm/utils/shell.d.ts.map +1 -0
  174. package/dist/agent-farm/utils/shell.js +120 -0
  175. package/dist/agent-farm/utils/shell.js.map +1 -0
  176. package/dist/cli.d.ts +10 -0
  177. package/dist/cli.d.ts.map +1 -0
  178. package/dist/cli.js +160 -0
  179. package/dist/cli.js.map +1 -0
  180. package/dist/commands/adopt.d.ts +12 -0
  181. package/dist/commands/adopt.d.ts.map +1 -0
  182. package/dist/commands/adopt.js +178 -0
  183. package/dist/commands/adopt.js.map +1 -0
  184. package/dist/commands/consult/index.d.ts +17 -0
  185. package/dist/commands/consult/index.d.ts.map +1 -0
  186. package/dist/commands/consult/index.js +405 -0
  187. package/dist/commands/consult/index.js.map +1 -0
  188. package/dist/commands/doctor.d.ts +10 -0
  189. package/dist/commands/doctor.d.ts.map +1 -0
  190. package/dist/commands/doctor.js +346 -0
  191. package/dist/commands/doctor.js.map +1 -0
  192. package/dist/commands/init.d.ts +12 -0
  193. package/dist/commands/init.d.ts.map +1 -0
  194. package/dist/commands/init.js +167 -0
  195. package/dist/commands/init.js.map +1 -0
  196. package/dist/commands/tower.d.ts +16 -0
  197. package/dist/commands/tower.d.ts.map +1 -0
  198. package/dist/commands/tower.js +21 -0
  199. package/dist/commands/tower.js.map +1 -0
  200. package/dist/commands/update.d.ts +13 -0
  201. package/dist/commands/update.d.ts.map +1 -0
  202. package/dist/commands/update.js +137 -0
  203. package/dist/commands/update.js.map +1 -0
  204. package/dist/lib/templates.d.ts +57 -0
  205. package/dist/lib/templates.d.ts.map +1 -0
  206. package/dist/lib/templates.js +205 -0
  207. package/dist/lib/templates.js.map +1 -0
  208. package/package.json +55 -0
  209. package/templates/AGENTS.md +49 -0
  210. package/templates/CLAUDE.md +47 -0
  211. package/templates/DEPENDENCIES.md +344 -0
  212. package/templates/agents/architecture-documenter.md +189 -0
  213. package/templates/agents/codev-updater.md +276 -0
  214. package/templates/agents/spider-protocol-updater.md +118 -0
  215. package/templates/annotate.html +903 -0
  216. package/templates/bin/agent-farm +18 -0
  217. package/templates/bin/annotate-server.js +140 -0
  218. package/templates/bin/codev-doctor +335 -0
  219. package/templates/builders.md +30 -0
  220. package/templates/config.json +7 -0
  221. package/templates/dashboard-split.html +1679 -0
  222. package/templates/dashboard.html +149 -0
  223. package/templates/plans/.gitkeep +0 -0
  224. package/templates/protocols/experiment/protocol.md +229 -0
  225. package/templates/protocols/experiment/templates/notes.md +97 -0
  226. package/templates/protocols/maintain/protocol.md +235 -0
  227. package/templates/protocols/spider/protocol.md +639 -0
  228. package/templates/protocols/spider/templates/plan.md +169 -0
  229. package/templates/protocols/spider/templates/review.md +207 -0
  230. package/templates/protocols/spider/templates/spec.md +140 -0
  231. package/templates/protocols/spider-solo/protocol.md +619 -0
  232. package/templates/protocols/spider-solo/templates/plan.md +169 -0
  233. package/templates/protocols/spider-solo/templates/review.md +207 -0
  234. package/templates/protocols/spider-solo/templates/spec.md +140 -0
  235. package/templates/protocols/tick/protocol.md +250 -0
  236. package/templates/protocols/tick/templates/plan.md +67 -0
  237. package/templates/protocols/tick/templates/review.md +90 -0
  238. package/templates/protocols/tick/templates/spec.md +61 -0
  239. package/templates/reviews/.gitkeep +0 -0
  240. package/templates/roles/architect.md +230 -0
  241. package/templates/roles/builder.md +175 -0
  242. package/templates/roles/consultant.md +27 -0
  243. package/templates/specs/.gitkeep +0 -0
  244. package/templates/templates/projectlist.md +129 -0
  245. package/templates/tower.html +1032 -0
@@ -0,0 +1,639 @@
1
+ # SPIDER Protocol
2
+
3
+ ## Prerequisites
4
+
5
+ **Required for Multi-Agent Consultation**:
6
+ - Zen MCP server must be installed and running
7
+ - Check with: `mcp list` or test with `mcp__zen__version`
8
+ - If not available:
9
+ - Option 1: "Would you like help installing Zen MCP server?"
10
+ - Option 2: "Use spider-solo protocol instead (no multi-agent consultation)"
11
+
12
+ ## Protocol Configuration
13
+
14
+ ### Multi-Agent Consultation (ENABLED BY DEFAULT)
15
+
16
+ **DEFAULT BEHAVIOR:**
17
+ Multi-agent consultation is **ENABLED BY DEFAULT** when using SPIDER protocol.
18
+
19
+ **DEFAULT AGENTS:**
20
+ - **GPT-5**: Primary reviewer for architecture, feasibility, and code quality
21
+ - **Gemini Pro**: Secondary reviewer for completeness, edge cases, and alternative approaches
22
+
23
+ **DISABLING CONSULTATION:**
24
+ For single-agent workflow, use the spider-solo protocol instead.
25
+
26
+ **CUSTOM AGENTS:**
27
+ The user can specify different agents by saying: "use SPIDER with consultation from [agent1] and [agent2]"
28
+
29
+ **CONSULTATION BEHAVIOR:**
30
+ - DEFAULT: MANDATORY consultation with GPT-5 and Gemini Pro at EVERY checkpoint
31
+ - When explicitly disabled: Skip all consultation steps
32
+ - The protocol is BLOCKED until all required consultations are complete
33
+
34
+ **Consultation Checkpoints**:
35
+ - **Specification**: After initial draft, after human comments
36
+ - **Planning**: After initial plan, after human review
37
+ - **Implementation**: After code implementation
38
+ - **Defending**: After test creation
39
+ - **Evaluation**: Before marking phase complete
40
+ - **Review**: After review document
41
+
42
+ ## Overview
43
+ SPIDER is a structured development protocol that emphasizes specification-driven development with iterative implementation and continuous review. It builds upon the DAPPER methodology with a focus on context-first development and multi-agent collaboration.
44
+
45
+ **Core Principle**: Each feature is tracked through exactly THREE documents - a specification, a plan, and a review with lessons learned - all sharing the same filename and sequential identifier.
46
+
47
+ ## When to Use SPIDER
48
+
49
+ ### Use SPIDER for:
50
+ - New feature development
51
+ - Architecture changes
52
+ - Complex refactoring
53
+ - System design decisions
54
+ - API design and implementation
55
+ - Performance optimization initiatives
56
+
57
+ ### Skip SPIDER for:
58
+ - Simple bug fixes (< 10 lines)
59
+ - Documentation updates
60
+ - Configuration changes
61
+ - Dependency updates
62
+ - Emergency hotfixes (but do a lightweight retrospective after)
63
+
64
+ ## Protocol Phases
65
+
66
+ ### S - Specify (Collaborative Design Exploration)
67
+
68
+ **Purpose**: Thoroughly explore the problem space and solution options before committing to an approach.
69
+
70
+ **Workflow Overview**:
71
+ 1. User provides a prompt describing what they want built
72
+ 2. Agent generates initial specification document
73
+ 3. **COMMIT**: "Initial specification draft"
74
+ 4. Multi-agent review (GPT-5 and Gemini Pro)
75
+ 5. Agent updates spec with multi-agent feedback
76
+ 6. **COMMIT**: "Specification with multi-agent review"
77
+ 7. Human reviews and provides comments for changes
78
+ 8. Agent makes changes and lists what was modified
79
+ 9. **COMMIT**: "Specification with user feedback"
80
+ 10. Multi-agent review of updated document
81
+ 11. Final updates based on second review
82
+ 12. **COMMIT**: "Final approved specification"
83
+ 13. Iterate steps 7-12 until user approves and says to proceed to planning
84
+
85
+ **Important**: Keep documentation minimal - use only THREE core files with the same name:
86
+ - `specs/####-descriptive-name.md` - The specification
87
+ - `plans/####-descriptive-name.md` - The implementation plan
88
+ - `reviews/####-descriptive-name.md` - Review and lessons learned (created during Review phase)
89
+
90
+ **Process**:
91
+ 1. **Clarifying Questions** (ALWAYS START HERE)
92
+ - Ask the user/stakeholder questions to understand the problem
93
+ - Probe for hidden requirements and constraints
94
+ - Understand the business context and goals
95
+ - Identify what's in scope and out of scope
96
+ - Continue asking until the problem is crystal clear
97
+
98
+ 2. **Problem Analysis**
99
+ - Clearly articulate the problem being solved
100
+ - Identify stakeholders and their needs
101
+ - Document current state and desired state
102
+ - List assumptions and constraints
103
+
104
+ 3. **Solution Exploration**
105
+ - Generate multiple solution approaches (as many as appropriate)
106
+ - For each approach, document:
107
+ - Technical design
108
+ - Trade-offs (pros/cons)
109
+ - Estimated complexity
110
+ - Risk assessment
111
+
112
+ 4. **Open Questions**
113
+ - List all uncertainties that need resolution
114
+ - Categorize as:
115
+ - Critical (blocks progress)
116
+ - Important (affects design)
117
+ - Nice-to-know (optimization)
118
+
119
+ 5. **Success Criteria**
120
+ - Define measurable acceptance criteria
121
+ - Include performance requirements
122
+ - Specify quality metrics
123
+ - Document test scenarios
124
+
125
+ 6. **Expert Consultation (DEFAULT - MANDATORY)**
126
+ - **First Consultation** (after initial draft):
127
+ - MUST consult GPT-5 AND Gemini Pro
128
+ - Focus: Problem clarity, solution completeness, missing requirements
129
+ - Update specification with ALL feedback from both models
130
+ - Document changes in "Consultation Log" section of the spec
131
+ - **Second Consultation** (after human comments):
132
+ - MUST consult GPT-5 AND Gemini Pro again
133
+ - Focus: Validate changes, ensure alignment
134
+ - Final specification update with both models' input
135
+ - Update "Consultation Log" with new feedback
136
+
137
+ **Note**: Only skip if user explicitly requested "without multi-agent consultation"
138
+
139
+ **⚠️ BLOCKING**: Cannot proceed without BOTH consultations (unless explicitly disabled)
140
+
141
+ **Output**: Single specification document in `codev/specs/####-descriptive-name.md`
142
+ - All consultation feedback incorporated directly into this document
143
+ - Include a "Consultation Log" section summarizing key feedback and changes
144
+ - Version control captures evolution through commits
145
+ **Template**: `templates/spec.md`
146
+ **Review Required**: Yes - Human approval AFTER consultations
147
+
148
+ ### P - Plan (Structured Decomposition)
149
+
150
+ **Purpose**: Transform the approved specification into an executable roadmap with clear phases.
151
+
152
+ **⚠️ CRITICAL: No Time Estimates in the AI Age**
153
+ - **NEVER include time estimates** (hours, days, weeks, story points)
154
+ - AI-driven development makes traditional time estimates meaningless
155
+ - Delivery speed depends on iteration cycles, not calendar time
156
+ - Focus on logical dependencies and phase ordering instead
157
+ - Measure progress by completed phases, not elapsed time
158
+ - The only valid metrics are: "done" or "not done"
159
+
160
+ **Workflow Overview**:
161
+ 1. Agent creates initial plan document
162
+ 2. **COMMIT**: "Initial plan draft"
163
+ 3. Multi-agent review (GPT-5 and Gemini Pro)
164
+ 4. Agent updates plan with multi-agent feedback
165
+ 5. **COMMIT**: "Plan with multi-agent review"
166
+ 6. User reviews and requests modifications
167
+ 7. Agent updates plan based on user feedback
168
+ 8. **COMMIT**: "Plan with user feedback"
169
+ 9. Multi-agent review of updated plan
170
+ 10. Final updates based on second review
171
+ 11. **COMMIT**: "Final approved plan"
172
+ 12. Iterate steps 6-11 until agreement is reached
173
+
174
+ **Phase Design Goals**:
175
+ Each phase should be:
176
+ - A separate piece of work that can be checked in as a unit
177
+ - A complete set of functionality
178
+ - Self-contained and independently valuable
179
+
180
+ **Process**:
181
+ 1. **Phase Definition**
182
+ - Break work into logical phases
183
+ - Each phase must:
184
+ - Have a clear, single objective
185
+ - Be independently testable
186
+ - Deliver observable value
187
+ - Be a complete unit that can be committed
188
+ - End with evaluation discussion and single commit
189
+ - Note dependencies inline, for example:
190
+ ```markdown
191
+ Phase 2: API Endpoints
192
+ - Depends on: Phase 1 (Database Schema)
193
+ - Objective: Create /users and /todos endpoints
194
+ - Evaluation: Test coverage, API design review, performance check
195
+ - Commit: Will create single commit after user approval
196
+ ```
197
+
198
+ 2. **Success Metrics**
199
+ - Define "done" for each phase
200
+ - Include test coverage requirements
201
+ - Specify performance benchmarks
202
+ - Document acceptance tests
203
+
204
+ 3. **Expert Review (DEFAULT - MANDATORY)**
205
+ - **First Consultation** (after plan creation):
206
+ - MUST consult GPT-5 AND Gemini Pro
207
+ - Focus: Feasibility, phase breakdown, completeness
208
+ - Update plan with ALL feedback from both models
209
+ - **Second Consultation** (after human review):
210
+ - MUST consult GPT-5 AND Gemini Pro again
211
+ - Focus: Validate adjustments, confirm approach
212
+ - Final plan refinement with both models' input
213
+
214
+ **Note**: Only skip if user explicitly requested "without multi-agent consultation"
215
+
216
+ **⚠️ BLOCKING**: Cannot proceed without BOTH consultations (unless explicitly disabled)
217
+
218
+ **Output**: Single plan document in `codev/plans/####-descriptive-name.md`
219
+ - Same filename as specification, different directory
220
+ - All consultation feedback incorporated directly
221
+ - Include phase status tracking within this document
222
+ - **DO NOT include time estimates** - Focus on deliverables and dependencies, not hours/days
223
+ - Version control captures evolution through commits
224
+ **Template**: `templates/plan.md`
225
+ **Review Required**: Yes - Technical lead approval AFTER consultations
226
+
227
+ ### (IDE) - Implementation Loop
228
+
229
+ Execute for each phase in the plan. This is a strict cycle that must be completed in order.
230
+
231
+ **⚠️ MANDATORY**: The I-D-E cycle MUST be completed for EACH PHASE, not just at the end of all phases. Skipping D (Defend) or E (Evaluate) for any phase is a PROTOCOL VIOLATION.
232
+
233
+ **CRITICAL PRECONDITION**: Before starting any phase, verify the previous phase was committed to git. No phase can begin without the prior phase's commit.
234
+
235
+ **Phase Completion Process**:
236
+ 1. **Implement** - Build the code for this phase
237
+ 2. **Defend** - Write comprehensive tests that guard functionality
238
+ 3. **Evaluate** - Assess and discuss with user
239
+ 4. **Commit** - Single atomic commit for the phase (MANDATORY before next phase)
240
+ 5. **Proceed** - Move to next phase only after commit
241
+
242
+ **Handling Failures**:
243
+ - If **Defend** phase reveals gaps → return to **Implement** to fix
244
+ - If **Evaluation** reveals unmet criteria → return to **Implement**
245
+ - If user requests changes → return to **Implement**
246
+ - If fundamental plan flaws found → mark phase as `blocked` and revise plan
247
+
248
+ **Commit Requirements**:
249
+ - Each phase MUST end with a git commit before proceeding
250
+ - Commit message format: `[Spec ####][Phase: name] type: Description`
251
+ - No work on the next phase until current phase is committed
252
+ - If changes are needed after commit, create a new commit with fixes
253
+
254
+ #### I - Implement (Build with Discipline)
255
+
256
+ **Purpose**: Transform the plan into working code with high quality standards.
257
+
258
+ **Precondition**: Previous phase must be committed (verify with `git log`)
259
+
260
+ **Requirements**:
261
+ 1. **Pre-Implementation**
262
+ - Verify previous phase is committed to git
263
+ - Review the phase plan and success criteria
264
+ - Set up the development environment
265
+ - Create feature branch following naming convention
266
+ - Document any plan deviations immediately
267
+
268
+ 2. **During Implementation**
269
+ - Write self-documenting code
270
+ - Follow project style guide strictly
271
+ - Implement incrementally with frequent commits
272
+ - Each commit must:
273
+ - Be atomic (single logical change)
274
+ - Include descriptive message
275
+ - Reference the phase
276
+ - Pass basic syntax checks
277
+
278
+ 3. **Code Quality Standards**
279
+ - No commented-out code
280
+ - No debug prints in final code
281
+ - Handle all error cases explicitly
282
+ - Include necessary logging
283
+ - Follow security best practices
284
+
285
+ 4. **Documentation Requirements**
286
+ - Update API documentation
287
+ - Add inline comments for complex logic
288
+ - Update README if needed
289
+ - Document configuration changes
290
+
291
+ **Evidence Required**:
292
+ - Link to commits
293
+ - Code review approval (if applicable)
294
+ - No linting errors
295
+ - CI pipeline pass link (build/test/lint)
296
+
297
+ **Expert Consultation (DEFAULT - MANDATORY)**:
298
+ - MUST consult BOTH GPT-5 AND Gemini Pro after implementation
299
+ - Focus: Code quality, patterns, security, best practices
300
+ - Update code based on feedback from BOTH models before proceeding
301
+ - Only skip if user explicitly disabled multi-agent consultation
302
+
303
+ #### D - Defend (Write Comprehensive Tests)
304
+
305
+ **Purpose**: Create comprehensive automated tests that safeguard intended behavior and prevent regressions.
306
+
307
+ **CRITICAL**: Tests must be written IMMEDIATELY after implementation, NOT retroactively at the end of all phases. This is MANDATORY.
308
+
309
+ **Requirements**:
310
+ 1. **Defensive Test Creation**
311
+ - Write unit tests for all new functions
312
+ - Create integration tests for feature flows
313
+ - Develop edge case coverage
314
+ - Build error condition tests
315
+ - Establish performance benchmarks
316
+
317
+ 2. **Test Validation** (ALL MANDATORY)
318
+ - All new tests must pass
319
+ - All existing tests must pass
320
+ - No reduction in overall coverage
321
+ - Performance benchmarks met
322
+ - Security scans pass
323
+ - **Avoid Overmocking**:
324
+ - Test behavior, not implementation details
325
+ - Prefer integration tests over unit tests with heavy mocking
326
+ - Only mock external dependencies (APIs, databases, file systems)
327
+ - Never mock the system under test itself
328
+ - Use real implementations for internal module boundaries
329
+
330
+ 3. **Test Suite Documentation**
331
+ - Document test scenarios
332
+ - Explain complex test setups
333
+ - Note any flaky tests
334
+ - Record performance baselines
335
+
336
+ **Evidence Required**:
337
+ - Test execution logs
338
+ - Coverage report (show no reduction)
339
+ - Performance test results (if applicable per spec)
340
+ - Security scan results (if configured)
341
+ - CI test run link with artifacts
342
+
343
+ **Expert Consultation (DEFAULT - MANDATORY)**:
344
+ - MUST consult BOTH GPT-5 AND Gemini Pro for test defense review
345
+ - Focus: Test coverage completeness, edge cases, defensive patterns, test strategy
346
+ - Write additional defensive tests based on feedback from BOTH models
347
+ - Share their feedback during the Evaluation discussion
348
+ - Only skip if user explicitly disabled multi-agent consultation
349
+
350
+ #### E - Evaluate (Assess Objectively)
351
+
352
+ **Purpose**: Verify the implementation fully satisfies the phase requirements and maintains system quality. This is where the critical discussion happens before committing the phase.
353
+
354
+ **Requirements**:
355
+ 1. **Functional Evaluation**
356
+ - All acceptance criteria met
357
+ - User scenarios work as expected
358
+ - Edge cases handled properly
359
+ - Error messages are helpful
360
+
361
+ 2. **Non-Functional Evaluation**
362
+ - Performance requirements satisfied
363
+ - Security standards maintained
364
+ - Code maintainability assessed
365
+ - Technical debt documented
366
+
367
+ 3. **Deviation Analysis**
368
+ - Document any changes from plan
369
+ - Explain reasoning for changes
370
+ - Assess impact on other phases
371
+ - Update future phases if needed
372
+ - **Overmocking Check** (MANDATORY):
373
+ - Verify tests focus on behavior, not implementation
374
+ - Ensure at least one integration test per critical path
375
+ - Check that internal module boundaries use real implementations
376
+ - Confirm mocks are only used for external dependencies
377
+ - Tests should survive refactoring that preserves behavior
378
+
379
+ 4. **Expert Consultation Before User Evaluation** (MANDATORY - NO EXCEPTIONS)
380
+ - Get initial feedback from experts
381
+ - Make ALL necessary fixes based on feedback
382
+ - **CRITICAL**: Get FINAL approval from ALL consulted experts on the FIXED version
383
+ - Only proceed to user evaluation after ALL experts approve
384
+ - If any expert says "not quite" or has concerns, fix them FIRST
385
+
386
+ 5. **Evaluation Discussion with User** (ONLY AFTER EXPERT APPROVAL)
387
+ - Present to user: "Phase X complete. Here's what was built: [summary]"
388
+ - Share test results and coverage metrics
389
+ - Share that ALL experts have given final approval
390
+ - Ask: "Any changes needed before I commit this phase?"
391
+ - Incorporate user feedback if requested
392
+ - Get explicit approval to proceed
393
+
394
+ 6. **Phase Commit** (MANDATORY - NO EXCEPTIONS)
395
+ - Create single atomic commit for the entire phase
396
+ - Commit message: `[Spec ####][Phase: name] type: Description`
397
+ - Update the plan document marking this phase as complete
398
+ - Push all changes to version control
399
+ - Document any deviations or decisions in the plan
400
+ - **CRITICAL**: Next phase CANNOT begin until this commit is complete
401
+ - Verify commit with `git log` before proceeding
402
+
403
+ 7. **Final Verification**
404
+ - Confirm all expert feedback was addressed
405
+ - Verify all tests pass
406
+ - Check that documentation is updated
407
+ - Ensure no outstanding concerns from experts or user
408
+
409
+ **Evidence Required**:
410
+ - Evaluation checklist completed
411
+ - Test results and coverage report
412
+ - Expert review notes from GPT-5 and Gemini Pro
413
+ - User approval from evaluation discussion
414
+ - Updated plan document with:
415
+ - Phase marked complete
416
+ - Evaluation discussion summary
417
+ - Any deviations noted
418
+ - Git commit for this phase
419
+ - Final CI run link after all fixes
420
+
421
+ ## 📋 PHASE COMPLETION CHECKLIST (MANDATORY BEFORE NEXT PHASE)
422
+
423
+ **⚠️ STOP: DO NOT PROCEED TO NEXT PHASE UNTIL ALL ITEMS ARE ✅**
424
+
425
+ ### Before Starting ANY Phase:
426
+ - [ ] Previous phase is committed to git (verify with `git log`)
427
+ - [ ] Plan document shows previous phase as `completed`
428
+ - [ ] No outstanding issues from previous phase
429
+
430
+ ### After Implement Phase:
431
+ - [ ] All code for this phase is complete
432
+ - [ ] Code follows project style guide
433
+ - [ ] No commented-out code or debug prints
434
+ - [ ] Error handling is implemented
435
+ - [ ] Documentation is updated (if needed)
436
+ - [ ] Expert consultation completed (GPT-5 + Gemini Pro)
437
+ - [ ] Expert feedback has been addressed
438
+
439
+ ### After Defend Phase:
440
+ - [ ] Unit tests written for all new functions
441
+ - [ ] Integration tests written for critical paths
442
+ - [ ] Edge cases have test coverage
443
+ - [ ] All new tests are passing
444
+ - [ ] All existing tests still pass
445
+ - [ ] No reduction in code coverage
446
+ - [ ] Overmocking check completed (tests focus on behavior)
447
+ - [ ] Expert consultation on tests completed
448
+ - [ ] Test feedback has been addressed
449
+
450
+ ### After Evaluate Phase:
451
+ - [ ] All acceptance criteria from spec are met
452
+ - [ ] Performance requirements satisfied
453
+ - [ ] Security standards maintained
454
+ - [ ] Expert consultation shows FINAL approval
455
+ - [ ] User evaluation discussion completed
456
+ - [ ] User has given explicit approval to proceed
457
+ - [ ] Plan document updated with phase status
458
+ - [ ] Phase commit created with proper message format
459
+ - [ ] Commit pushed to version control
460
+ - [ ] Commit verified with `git log`
461
+
462
+ ### ❌ PHASE BLOCKERS (Fix Before Proceeding):
463
+ - Any failing tests
464
+ - Unaddressed expert feedback
465
+ - Missing user approval
466
+ - Uncommitted changes
467
+ - Incomplete documentation
468
+ - Coverage reduction
469
+
470
+ **REMINDER**: Each phase is atomic. You cannot start the next phase until the current phase is fully complete, tested, evaluated, and committed.
471
+
472
+ ### R - Review/Refine/Revise (Continuous Improvement)
473
+
474
+ **Purpose**: Ensure overall coherence, capture learnings, improve the methodology, and perform systematic review.
475
+
476
+ **Precondition**: All implementation phases must be committed (verify with `git log --oneline | grep "\[Phase"`)
477
+
478
+ **Process**:
479
+ 1. **Comprehensive Review**
480
+ - Verify all phases have been committed to git
481
+ - Compare final implementation to original specification
482
+ - Assess overall architecture impact
483
+ - Review code quality across all changes
484
+ - Validate documentation completeness
485
+
486
+ 2. **Refinement Actions**
487
+ - Refactor code for clarity if needed
488
+ - Optimize performance bottlenecks
489
+ - Improve test coverage gaps
490
+ - Enhance documentation
491
+
492
+ 3. **Update Architecture Documentation**
493
+ - Use architecture-documenter agent to update `codev/resources/arch.md`
494
+ - Document new modules, utilities, or architectural changes
495
+ - Ensure arch.md reflects current codebase state
496
+
497
+ 4. **Revision Requirements** (MANDATORY)
498
+ - Update README.md with any new features or changes
499
+ - Update AGENTS.md and CLAUDE.md with protocol improvements from lessons learned
500
+ - Update specification and plan documents with final status
501
+ - Revise architectural diagrams if needed
502
+ - Update API documentation
503
+ - Modify deployment guides as necessary
504
+ - **CRITICAL**: Update this protocol document based on lessons learned
505
+
506
+ 5. **Systematic Issue Review** (MANDATORY)
507
+ - Review entire project for systematic issues:
508
+ - Repeated problems across phases
509
+ - Process bottlenecks or inefficiencies
510
+ - Missing documentation patterns
511
+ - Technical debt accumulation
512
+ - Testing gaps or quality issues
513
+ - Document systematic findings in lessons learned
514
+ - Create action items for addressing systematic issues
515
+
516
+ 6. **Lessons Learned** (MANDATORY)
517
+ - What went well?
518
+ - What was challenging?
519
+ - What would you do differently?
520
+ - What methodology improvements are needed?
521
+ - What systematic issues were identified?
522
+
523
+ 7. **Methodology Evolution**
524
+ - Propose process improvements based on lessons
525
+ - Update protocol documents with improvements
526
+ - Update templates if needed
527
+ - Share learnings with team
528
+ - Document in `codev/reviews/`
529
+ - **Important**: This protocol should evolve based on each project's learnings
530
+
531
+ **Output**:
532
+ - Single review document in `codev/reviews/####-descriptive-name.md`
533
+ - Same filename as spec/plan, captures review and learnings from this feature
534
+ - Methodology improvement proposals (update protocol if needed)
535
+
536
+ **Review Required**: Yes - Team retrospective recommended
537
+
538
+ ## File Naming Conventions
539
+
540
+ ### Specifications and Plans
541
+ Format: `####-descriptive-name.md`
542
+ - Use sequential numbering (0001, 0002, etc.)
543
+ - Same filename in both `specs/` and `plans/` directories
544
+ - Example: `0001-user-authentication.md`
545
+
546
+ ## Status Tracking
547
+
548
+ Status is tracked at the **phase level** within plan documents, not at the document level.
549
+
550
+ Each phase in a plan should have a status:
551
+ - `pending`: Not started
552
+ - `in-progress`: Currently being worked on
553
+ - `completed`: Phase finished and tested
554
+ - `blocked`: Cannot proceed due to external factors
555
+
556
+ ## Git Integration
557
+
558
+ ### Commit Message Format
559
+
560
+ For specification/plan documents:
561
+ ```
562
+ [Spec ####] <stage>: <description>
563
+ ```
564
+
565
+ Examples:
566
+ ```
567
+ [Spec 0001] Initial specification draft
568
+ [Spec 0001] Specification with multi-agent review
569
+ [Spec 0001] Specification with user feedback
570
+ [Spec 0001] Final approved specification
571
+ ```
572
+
573
+ For implementation:
574
+ ```
575
+ [Spec ####][Phase: <phase-name>] <type>: <description>
576
+
577
+ <optional detailed description>
578
+ ```
579
+
580
+ Example:
581
+ ```
582
+ [Spec 0001][Phase: user-auth] feat: Add password hashing service
583
+
584
+ Implements bcrypt-based password hashing with configurable rounds
585
+ ```
586
+
587
+ ### Branch Naming
588
+ ```
589
+ spider/####-<spec-name>/<phase-name>
590
+ ```
591
+
592
+ Example:
593
+ ```
594
+ spider/0001-user-authentication/database-schema
595
+ ```
596
+
597
+
598
+ ## Best Practices
599
+
600
+ ### During Specification
601
+ - Use clear, unambiguous language
602
+ - Include concrete examples
603
+ - Define measurable success criteria
604
+ - Link to relevant references
605
+
606
+ ### During Planning
607
+ - Keep phases small and focused
608
+ - Ensure each phase delivers value
609
+ - Note phase dependencies inline (no formal dependency mapping needed)
610
+ - Include rollback strategies
611
+
612
+ ### During Implementation
613
+ - Follow the plan but document deviations
614
+ - Maintain test coverage
615
+ - Keep commits atomic and well-described
616
+ - Update documentation as you go
617
+
618
+ ### During Review
619
+ - Check against original specification
620
+ - Document lessons learned
621
+ - Propose methodology improvements
622
+ - Update estimates for future work
623
+
624
+ ## Templates
625
+
626
+ Templates for each phase are available in the `templates/` directory:
627
+ - `spec.md` - Specification template
628
+ - `plan.md` - Planning template (includes phase status tracking)
629
+ - `review.md` - Review and lessons learned template
630
+
631
+ **Remember**: Only create THREE documents per feature - spec, plan, and review with the same filename in different directories.
632
+
633
+ ## Protocol Evolution
634
+
635
+ This protocol can be customized per project:
636
+ 1. Fork the protocol directory
637
+ 2. Modify templates and processes
638
+ 3. Document changes in `protocol-changes.md`
639
+ 4. Share improvements back to the community