@cluesmith/codev 2.0.0-rc.24 → 2.0.0-rc.26

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 (128) hide show
  1. package/dist/agent-farm/cli.d.ts.map +1 -1
  2. package/dist/agent-farm/cli.js +52 -52
  3. package/dist/agent-farm/cli.js.map +1 -1
  4. package/dist/agent-farm/commands/consult.js +1 -1
  5. package/dist/agent-farm/commands/consult.js.map +1 -1
  6. package/dist/agent-farm/commands/index.d.ts +1 -2
  7. package/dist/agent-farm/commands/index.d.ts.map +1 -1
  8. package/dist/agent-farm/commands/index.js +1 -2
  9. package/dist/agent-farm/commands/index.js.map +1 -1
  10. package/dist/agent-farm/commands/{util.d.ts → shell.d.ts} +4 -4
  11. package/dist/agent-farm/commands/shell.d.ts.map +1 -0
  12. package/dist/agent-farm/commands/{util.js → shell.js} +4 -4
  13. package/dist/agent-farm/commands/shell.js.map +1 -0
  14. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  15. package/dist/agent-farm/commands/spawn.js +361 -66
  16. package/dist/agent-farm/commands/spawn.js.map +1 -1
  17. package/dist/agent-farm/commands/start.js +5 -4
  18. package/dist/agent-farm/commands/start.js.map +1 -1
  19. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  20. package/dist/agent-farm/commands/tower.js +2 -1
  21. package/dist/agent-farm/commands/tower.js.map +1 -1
  22. package/dist/agent-farm/hq-connector.d.ts +2 -2
  23. package/dist/agent-farm/hq-connector.js +2 -2
  24. package/dist/agent-farm/servers/dashboard-server.js +153 -6
  25. package/dist/agent-farm/servers/dashboard-server.js.map +1 -1
  26. package/dist/agent-farm/servers/tower-server.js +374 -0
  27. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  28. package/dist/agent-farm/types.d.ts +38 -0
  29. package/dist/agent-farm/types.d.ts.map +1 -1
  30. package/dist/agent-farm/utils/notifications.d.ts +30 -0
  31. package/dist/agent-farm/utils/notifications.d.ts.map +1 -0
  32. package/dist/agent-farm/utils/notifications.js +121 -0
  33. package/dist/agent-farm/utils/notifications.js.map +1 -0
  34. package/dist/agent-farm/utils/server-utils.d.ts +2 -1
  35. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  36. package/dist/agent-farm/utils/server-utils.js +11 -1
  37. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  38. package/dist/agent-farm/utils/shell.d.ts +1 -0
  39. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  40. package/dist/agent-farm/utils/shell.js +2 -0
  41. package/dist/agent-farm/utils/shell.js.map +1 -1
  42. package/dist/cli.d.ts.map +1 -1
  43. package/dist/cli.js +0 -37
  44. package/dist/cli.js.map +1 -1
  45. package/dist/commands/adopt.js +3 -3
  46. package/dist/commands/adopt.js.map +1 -1
  47. package/dist/commands/init.js +1 -1
  48. package/dist/commands/porch/run.d.ts.map +1 -1
  49. package/dist/commands/porch/run.js +5 -0
  50. package/dist/commands/porch/run.js.map +1 -1
  51. package/package.json +3 -1
  52. package/skeleton/protocol-schema.json +282 -0
  53. package/skeleton/protocols/bugfix/builder-prompt.md +49 -0
  54. package/skeleton/protocols/bugfix/protocol.json +13 -1
  55. package/skeleton/protocols/experiment/builder-prompt.md +47 -0
  56. package/skeleton/protocols/experiment/protocol.json +101 -0
  57. package/skeleton/protocols/maintain/builder-prompt.md +41 -0
  58. package/skeleton/protocols/maintain/protocol.json +114 -0
  59. package/skeleton/protocols/protocol-schema.json +53 -0
  60. package/skeleton/protocols/spider/builder-prompt.md +53 -0
  61. package/skeleton/protocols/spider/protocol.json +7 -1
  62. package/skeleton/protocols/tick/builder-prompt.md +51 -0
  63. package/skeleton/protocols/tick/protocol.json +6 -1
  64. package/skeleton/resources/commands/agent-farm.md +23 -41
  65. package/skeleton/resources/commands/overview.md +5 -5
  66. package/skeleton/resources/workflow-reference.md +2 -2
  67. package/skeleton/roles/architect.md +49 -33
  68. package/skeleton/roles/builder.md +77 -108
  69. package/skeleton/templates/cheatsheet.md +4 -2
  70. package/templates/tower.html +456 -17
  71. package/dist/agent-farm/commands/kickoff.d.ts +0 -20
  72. package/dist/agent-farm/commands/kickoff.d.ts.map +0 -1
  73. package/dist/agent-farm/commands/kickoff.js +0 -343
  74. package/dist/agent-farm/commands/kickoff.js.map +0 -1
  75. package/dist/agent-farm/commands/tutorial.d.ts +0 -10
  76. package/dist/agent-farm/commands/tutorial.d.ts.map +0 -1
  77. package/dist/agent-farm/commands/tutorial.js +0 -49
  78. package/dist/agent-farm/commands/tutorial.js.map +0 -1
  79. package/dist/agent-farm/commands/util.d.ts.map +0 -1
  80. package/dist/agent-farm/commands/util.js.map +0 -1
  81. package/dist/agent-farm/tutorial/index.d.ts +0 -8
  82. package/dist/agent-farm/tutorial/index.d.ts.map +0 -1
  83. package/dist/agent-farm/tutorial/index.js +0 -8
  84. package/dist/agent-farm/tutorial/index.js.map +0 -1
  85. package/dist/agent-farm/tutorial/prompts.d.ts +0 -57
  86. package/dist/agent-farm/tutorial/prompts.d.ts.map +0 -1
  87. package/dist/agent-farm/tutorial/prompts.js +0 -147
  88. package/dist/agent-farm/tutorial/prompts.js.map +0 -1
  89. package/dist/agent-farm/tutorial/runner.d.ts +0 -52
  90. package/dist/agent-farm/tutorial/runner.d.ts.map +0 -1
  91. package/dist/agent-farm/tutorial/runner.js +0 -204
  92. package/dist/agent-farm/tutorial/runner.js.map +0 -1
  93. package/dist/agent-farm/tutorial/state.d.ts +0 -26
  94. package/dist/agent-farm/tutorial/state.d.ts.map +0 -1
  95. package/dist/agent-farm/tutorial/state.js +0 -89
  96. package/dist/agent-farm/tutorial/state.js.map +0 -1
  97. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +0 -7
  98. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +0 -1
  99. package/dist/agent-farm/tutorial/steps/first-spec.js +0 -136
  100. package/dist/agent-farm/tutorial/steps/first-spec.js.map +0 -1
  101. package/dist/agent-farm/tutorial/steps/implementation.d.ts +0 -7
  102. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +0 -1
  103. package/dist/agent-farm/tutorial/steps/implementation.js +0 -76
  104. package/dist/agent-farm/tutorial/steps/implementation.js.map +0 -1
  105. package/dist/agent-farm/tutorial/steps/index.d.ts +0 -10
  106. package/dist/agent-farm/tutorial/steps/index.d.ts.map +0 -1
  107. package/dist/agent-farm/tutorial/steps/index.js +0 -10
  108. package/dist/agent-farm/tutorial/steps/index.js.map +0 -1
  109. package/dist/agent-farm/tutorial/steps/planning.d.ts +0 -7
  110. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +0 -1
  111. package/dist/agent-farm/tutorial/steps/planning.js +0 -143
  112. package/dist/agent-farm/tutorial/steps/planning.js.map +0 -1
  113. package/dist/agent-farm/tutorial/steps/review.d.ts +0 -7
  114. package/dist/agent-farm/tutorial/steps/review.d.ts.map +0 -1
  115. package/dist/agent-farm/tutorial/steps/review.js +0 -78
  116. package/dist/agent-farm/tutorial/steps/review.js.map +0 -1
  117. package/dist/agent-farm/tutorial/steps/setup.d.ts +0 -7
  118. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +0 -1
  119. package/dist/agent-farm/tutorial/steps/setup.js +0 -126
  120. package/dist/agent-farm/tutorial/steps/setup.js.map +0 -1
  121. package/dist/agent-farm/tutorial/steps/welcome.d.ts +0 -7
  122. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +0 -1
  123. package/dist/agent-farm/tutorial/steps/welcome.js +0 -50
  124. package/dist/agent-farm/tutorial/steps/welcome.js.map +0 -1
  125. package/dist/commands/tower.d.ts +0 -16
  126. package/dist/commands/tower.d.ts.map +0 -1
  127. package/dist/commands/tower.js +0 -21
  128. package/dist/commands/tower.js.map +0 -1
@@ -0,0 +1,282 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codev.dev/protocol-schema.json",
4
+ "title": "Codev Protocol Definition",
5
+ "description": "Schema for porch protocol definitions (SPIDER, TICK, BUGFIX, etc.)",
6
+ "type": "object",
7
+ "required": ["name", "phases"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "JSON Schema reference"
12
+ },
13
+ "name": {
14
+ "type": "string",
15
+ "description": "Protocol name (e.g., 'spider', 'tick', 'bugfix')",
16
+ "pattern": "^[a-z][a-z0-9-]*$"
17
+ },
18
+ "alias": {
19
+ "type": "string",
20
+ "description": "Alternative name for the protocol (e.g., 'spir' for spider)"
21
+ },
22
+ "version": {
23
+ "type": "string",
24
+ "description": "Semantic version of the protocol",
25
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-z0-9.]+)?$"
26
+ },
27
+ "description": {
28
+ "type": "string",
29
+ "description": "Human-readable description of the protocol"
30
+ },
31
+ "phases": {
32
+ "type": "array",
33
+ "description": "Ordered list of protocol phases",
34
+ "minItems": 1,
35
+ "items": { "$ref": "#/$defs/phase" }
36
+ },
37
+ "signals": {
38
+ "type": "object",
39
+ "description": "Signals that can be emitted during protocol execution",
40
+ "additionalProperties": { "$ref": "#/$defs/signal" }
41
+ },
42
+ "phase_completion": {
43
+ "type": "object",
44
+ "description": "Checks run when a plan phase completes",
45
+ "additionalProperties": {
46
+ "type": "string",
47
+ "description": "Shell command to run"
48
+ }
49
+ },
50
+ "defaults": {
51
+ "type": "object",
52
+ "description": "Default values for phase properties",
53
+ "properties": {
54
+ "max_iterations": {
55
+ "type": "integer",
56
+ "minimum": 1,
57
+ "maximum": 20,
58
+ "default": 7
59
+ },
60
+ "verify": { "$ref": "#/$defs/verifyConfig" }
61
+ }
62
+ }
63
+ },
64
+ "$defs": {
65
+ "phase": {
66
+ "type": "object",
67
+ "required": ["id", "name"],
68
+ "properties": {
69
+ "id": {
70
+ "type": "string",
71
+ "description": "Unique phase identifier",
72
+ "pattern": "^[a-z][a-z0-9_-]*$"
73
+ },
74
+ "name": {
75
+ "type": "string",
76
+ "description": "Human-readable phase name"
77
+ },
78
+ "description": {
79
+ "type": "string",
80
+ "description": "What this phase does"
81
+ },
82
+ "type": {
83
+ "type": "string",
84
+ "enum": ["once", "build_verify", "per_plan_phase"],
85
+ "description": "Phase execution type",
86
+ "default": "build_verify"
87
+ },
88
+ "build": { "$ref": "#/$defs/buildConfig" },
89
+ "verify": { "$ref": "#/$defs/verifyConfig" },
90
+ "max_iterations": {
91
+ "type": "integer",
92
+ "description": "Maximum build-verify iterations before failing",
93
+ "minimum": 1,
94
+ "maximum": 20,
95
+ "default": 7
96
+ },
97
+ "on_complete": { "$ref": "#/$defs/onCompleteConfig" },
98
+ "checks": {
99
+ "type": "object",
100
+ "description": "Named checks to run during this phase",
101
+ "additionalProperties": { "$ref": "#/$defs/check" }
102
+ },
103
+ "gate": {
104
+ "oneOf": [
105
+ {
106
+ "type": "string",
107
+ "description": "Gate name (simple format)",
108
+ "pattern": "^[a-z][a-z0-9-]*$"
109
+ },
110
+ {
111
+ "$ref": "#/$defs/gateConfig",
112
+ "description": "Gate with options (extended format)"
113
+ }
114
+ ]
115
+ },
116
+ "transition": { "$ref": "#/$defs/transitionConfig" },
117
+ "next": {
118
+ "oneOf": [
119
+ { "type": "string", "description": "Next phase id" },
120
+ { "type": "null", "description": "Terminal phase" }
121
+ ]
122
+ }
123
+ }
124
+ },
125
+ "buildConfig": {
126
+ "type": "object",
127
+ "description": "Configuration for the build step",
128
+ "required": ["prompt", "artifact"],
129
+ "properties": {
130
+ "prompt": {
131
+ "type": "string",
132
+ "description": "Prompt file name (e.g., 'specify.md')"
133
+ },
134
+ "artifact": {
135
+ "type": "string",
136
+ "description": "Artifact path pattern with ${PROJECT_ID} variable"
137
+ }
138
+ }
139
+ },
140
+ "verifyConfig": {
141
+ "type": "object",
142
+ "description": "Configuration for 3-way verification",
143
+ "required": ["type", "models"],
144
+ "properties": {
145
+ "type": {
146
+ "type": "string",
147
+ "description": "Review type (maps to consult --type)",
148
+ "enum": ["spec-review", "plan-review", "impl-review", "pr-ready", "integration-review"]
149
+ },
150
+ "models": {
151
+ "type": "array",
152
+ "description": "Models to consult",
153
+ "items": {
154
+ "type": "string",
155
+ "enum": ["gemini", "codex", "claude"]
156
+ },
157
+ "minItems": 1
158
+ },
159
+ "parallel": {
160
+ "type": "boolean",
161
+ "description": "Run consultations in parallel",
162
+ "default": true
163
+ }
164
+ }
165
+ },
166
+ "onCompleteConfig": {
167
+ "type": "object",
168
+ "description": "Actions to perform after successful verification",
169
+ "properties": {
170
+ "commit": {
171
+ "type": "boolean",
172
+ "description": "Commit artifact to git",
173
+ "default": false
174
+ },
175
+ "push": {
176
+ "type": "boolean",
177
+ "description": "Push commit to remote",
178
+ "default": false
179
+ }
180
+ }
181
+ },
182
+ "check": {
183
+ "oneOf": [
184
+ {
185
+ "type": "string",
186
+ "description": "Simple shell command"
187
+ },
188
+ {
189
+ "type": "object",
190
+ "description": "Check with options",
191
+ "required": ["command"],
192
+ "properties": {
193
+ "command": {
194
+ "type": "string",
195
+ "description": "Shell command to run"
196
+ },
197
+ "description": {
198
+ "type": "string",
199
+ "description": "Human-readable description"
200
+ },
201
+ "on_fail": {
202
+ "type": "string",
203
+ "enum": ["fail", "retry", "warn"],
204
+ "description": "Action on failure",
205
+ "default": "fail"
206
+ },
207
+ "max_retries": {
208
+ "type": "integer",
209
+ "description": "Maximum retry attempts",
210
+ "minimum": 0,
211
+ "maximum": 10,
212
+ "default": 0
213
+ },
214
+ "optional": {
215
+ "type": "boolean",
216
+ "description": "Don't fail protocol if check fails",
217
+ "default": false
218
+ }
219
+ }
220
+ }
221
+ ]
222
+ },
223
+ "transitionConfig": {
224
+ "type": "object",
225
+ "description": "Transition rules for per_plan_phase types",
226
+ "properties": {
227
+ "on_complete": {
228
+ "type": "string",
229
+ "description": "Phase to transition to after each plan phase"
230
+ },
231
+ "on_all_phases_complete": {
232
+ "type": "string",
233
+ "description": "Phase to transition to when all plan phases complete"
234
+ }
235
+ }
236
+ },
237
+ "signal": {
238
+ "type": "object",
239
+ "description": "Signal definition",
240
+ "properties": {
241
+ "description": {
242
+ "type": "string"
243
+ },
244
+ "transitions_to": {
245
+ "type": "string",
246
+ "description": "State to transition to when signal received"
247
+ },
248
+ "requires": {
249
+ "type": "string",
250
+ "description": "Required parameter name"
251
+ }
252
+ }
253
+ },
254
+ "gateConfig": {
255
+ "type": "object",
256
+ "description": "Gate with extended configuration",
257
+ "required": ["name"],
258
+ "properties": {
259
+ "name": {
260
+ "type": "string",
261
+ "description": "Gate identifier",
262
+ "pattern": "^[a-z][a-z0-9-]*$"
263
+ },
264
+ "description": {
265
+ "type": "string",
266
+ "description": "Human-readable description"
267
+ },
268
+ "requires": {
269
+ "type": "array",
270
+ "description": "Check names that must pass before gate can be approved",
271
+ "items": { "type": "string" }
272
+ },
273
+ "next": {
274
+ "oneOf": [
275
+ { "type": "string", "description": "Next phase after gate approval" },
276
+ { "type": "null", "description": "Terminal gate" }
277
+ ]
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }
@@ -0,0 +1,49 @@
1
+ # {{protocol_name}} Builder ({{mode}} mode)
2
+
3
+ You are implementing {{input_description}}.
4
+
5
+ {{#if mode_soft}}
6
+ ## Mode: SOFT
7
+ You are running in SOFT mode. This means:
8
+ - You follow the BUGFIX protocol yourself (no porch orchestration)
9
+ - The architect monitors your work and verifies you're adhering to the protocol
10
+ - Run consultations manually when the protocol calls for them
11
+ - You have flexibility in execution, but must stay compliant with the protocol
12
+ {{/if}}
13
+
14
+ {{#if mode_strict}}
15
+ ## Mode: STRICT
16
+ You are running in STRICT mode. This means:
17
+ - Porch orchestrates your work
18
+ - Run: `porch run {{project_id}}`
19
+ - Follow porch signals and gate approvals
20
+ {{/if}}
21
+
22
+ ## Protocol
23
+ Follow the BUGFIX protocol: `codev/protocols/bugfix/protocol.md`
24
+
25
+ {{#if issue}}
26
+ ## Issue #{{issue.number}}
27
+ **Title**: {{issue.title}}
28
+
29
+ **Description**:
30
+ {{issue.body}}
31
+
32
+ ## Your Mission
33
+ 1. Reproduce the bug
34
+ 2. Identify root cause
35
+ 3. Implement fix (< 300 LOC)
36
+ 4. Add regression test
37
+ 5. Run CMAP review (3-way parallel: Gemini, Codex, Claude)
38
+ 6. Create PR with "Fixes #{{issue.number}}" in body
39
+
40
+ If the fix is too complex (> 300 LOC or architectural changes), notify the Architect via:
41
+ ```bash
42
+ af send architect "Issue #{{issue.number}} is more complex than expected. [Reason]. Recommend escalating to SPIDER/TICK."
43
+ ```
44
+ {{/if}}
45
+
46
+ ## Getting Started
47
+ 1. Read the BUGFIX protocol
48
+ 2. Review the issue details
49
+ 3. Reproduce the bug before fixing
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "$schema": "../../protocol-schema.json",
3
3
  "name": "bugfix",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "description": "Lightweight protocol for minor bugfixes using GitHub Issues",
6
+ "input": {
7
+ "type": "github-issue",
8
+ "required": false,
9
+ "default_for": ["--issue", "-i"]
10
+ },
11
+ "hooks": {
12
+ "pre-spawn": {
13
+ "collision-check": true,
14
+ "comment-on-issue": "On it! Working on a fix now."
15
+ }
16
+ },
6
17
  "phases": [
7
18
  {
8
19
  "id": "investigate",
@@ -114,6 +125,7 @@
114
125
  }
115
126
  },
116
127
  "defaults": {
128
+ "mode": "soft",
117
129
  "consultation": {
118
130
  "enabled": true,
119
131
  "models": ["gemini", "codex"],
@@ -0,0 +1,47 @@
1
+ # {{protocol_name}} Builder ({{mode}} mode)
2
+
3
+ You are executing a disciplined experiment.
4
+
5
+ {{#if mode_soft}}
6
+ ## Mode: SOFT
7
+ You are running in SOFT mode. This means:
8
+ - You follow the EXPERIMENT protocol yourself (no porch orchestration)
9
+ - The architect monitors your work and verifies you're adhering to the protocol
10
+ - Document your findings thoroughly
11
+ {{/if}}
12
+
13
+ {{#if mode_strict}}
14
+ ## Mode: STRICT
15
+ You are running in STRICT mode. This means:
16
+ - Porch orchestrates your work
17
+ - Run: `porch run {{project_id}}`
18
+ - Follow porch signals and gate approvals
19
+ {{/if}}
20
+
21
+ ## Protocol
22
+ Follow the EXPERIMENT protocol: `codev/protocols/experiment/protocol.md`
23
+
24
+ ## EXPERIMENT Overview
25
+ The EXPERIMENT protocol ensures disciplined experimentation:
26
+
27
+ 1. **Hypothesis Phase**: Define what you're testing and success criteria
28
+ 2. **Design Phase**: Plan the experiment approach
29
+ 3. **Execute Phase**: Run the experiment and gather data
30
+ 4. **Analyze Phase**: Evaluate results and draw conclusions
31
+
32
+ {{#if task}}
33
+ ## Experiment Focus
34
+ {{task_text}}
35
+ {{/if}}
36
+
37
+ ## Key Principles
38
+ - Start with a clear, falsifiable hypothesis
39
+ - Define success/failure criteria upfront
40
+ - Keep scope minimal for quick iteration
41
+ - Document findings regardless of outcome
42
+ - Separate experiment artifacts from production code
43
+
44
+ ## Getting Started
45
+ 1. Read the EXPERIMENT protocol document
46
+ 2. Define your hypothesis clearly
47
+ 3. Follow the phases in order
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "../../protocol-schema.json",
3
+ "name": "experiment",
4
+ "version": "1.0.0",
5
+ "description": "Disciplined experimentation with hypothesis testing",
6
+ "input": {
7
+ "type": "none",
8
+ "required": false,
9
+ "default_for": []
10
+ },
11
+ "hooks": {
12
+ "pre-spawn": {}
13
+ },
14
+ "phases": [
15
+ {
16
+ "id": "hypothesis",
17
+ "name": "Hypothesis",
18
+ "description": "Define the hypothesis and success criteria",
19
+ "type": "once",
20
+ "steps": [
21
+ "define_hypothesis",
22
+ "define_success_criteria",
23
+ "define_scope",
24
+ "create_experiment_doc"
25
+ ],
26
+ "transition": {
27
+ "on_complete": "design"
28
+ }
29
+ },
30
+ {
31
+ "id": "design",
32
+ "name": "Design",
33
+ "description": "Design the experiment approach",
34
+ "type": "once",
35
+ "steps": [
36
+ "choose_approach",
37
+ "identify_dependencies",
38
+ "plan_implementation",
39
+ "define_measurements"
40
+ ],
41
+ "transition": {
42
+ "on_complete": "execute"
43
+ }
44
+ },
45
+ {
46
+ "id": "execute",
47
+ "name": "Execute",
48
+ "description": "Run the experiment",
49
+ "type": "once",
50
+ "steps": [
51
+ "implement_prototype",
52
+ "gather_data",
53
+ "document_findings"
54
+ ],
55
+ "transition": {
56
+ "on_complete": "analyze"
57
+ }
58
+ },
59
+ {
60
+ "id": "analyze",
61
+ "name": "Analyze",
62
+ "description": "Analyze results and draw conclusions",
63
+ "type": "once",
64
+ "steps": [
65
+ "analyze_data",
66
+ "evaluate_hypothesis",
67
+ "document_conclusions",
68
+ "recommend_next_steps"
69
+ ],
70
+ "gate": {
71
+ "name": "experiment-complete",
72
+ "description": "Experiment complete",
73
+ "requires": ["conclusions_documented"],
74
+ "next": null
75
+ }
76
+ }
77
+ ],
78
+ "signals": {
79
+ "PHASE_COMPLETE": {
80
+ "description": "Signal current phase is complete",
81
+ "transitions_to": "next_phase"
82
+ },
83
+ "BLOCKED": {
84
+ "description": "Signal experiment is blocked",
85
+ "requires": "reason"
86
+ },
87
+ "HYPOTHESIS_REJECTED": {
88
+ "description": "Signal hypothesis was disproven",
89
+ "transitions_to": "analyze"
90
+ }
91
+ },
92
+ "defaults": {
93
+ "mode": "soft",
94
+ "consultation": {
95
+ "enabled": false,
96
+ "models": [],
97
+ "parallel": false
98
+ },
99
+ "checks": {}
100
+ }
101
+ }
@@ -0,0 +1,41 @@
1
+ # {{protocol_name}} Builder ({{mode}} mode)
2
+
3
+ You are executing the MAINTAIN protocol to clean up and synchronize the codebase.
4
+
5
+ {{#if mode_soft}}
6
+ ## Mode: SOFT
7
+ You are running in SOFT mode. This means:
8
+ - You follow the MAINTAIN protocol yourself (no porch orchestration)
9
+ - The architect monitors your work and verifies you're adhering to the protocol
10
+ - Work through each phase methodically
11
+ {{/if}}
12
+
13
+ {{#if mode_strict}}
14
+ ## Mode: STRICT
15
+ You are running in STRICT mode. This means:
16
+ - Porch orchestrates your work
17
+ - Run: `porch run {{project_id}}`
18
+ - Follow porch signals and gate approvals
19
+ {{/if}}
20
+
21
+ ## Protocol
22
+ Follow the MAINTAIN protocol: `codev/protocols/maintain/protocol.md`
23
+
24
+ ## MAINTAIN Overview
25
+ The MAINTAIN protocol handles codebase hygiene:
26
+
27
+ 1. **Audit Phase**: Scan for dead code, unused dependencies, stale docs
28
+ 2. **Clean Phase**: Remove identified cruft, verify build
29
+ 3. **Sync Phase**: Update documentation (arch.md, lessons-learned.md, CLAUDE.md)
30
+ 4. **Verify Phase**: Run full test suite, confirm health
31
+
32
+ ## Key Rules
33
+ - Use soft deletion (move to `codev/maintain/.trash/`)
34
+ - Always verify build passes after removals
35
+ - Update documentation to match current architecture
36
+ - Don't remove anything actively used
37
+
38
+ ## Getting Started
39
+ 1. Read the MAINTAIN protocol document
40
+ 2. Start with the Audit phase
41
+ 3. Document all changes made
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "../../protocol-schema.json",
3
+ "name": "maintain",
4
+ "version": "1.0.0",
5
+ "description": "Codebase maintenance - dead code removal, doc sync, hygiene",
6
+ "input": {
7
+ "type": "none",
8
+ "required": false,
9
+ "default_for": []
10
+ },
11
+ "hooks": {
12
+ "pre-spawn": {}
13
+ },
14
+ "phases": [
15
+ {
16
+ "id": "audit",
17
+ "name": "Audit",
18
+ "description": "Analyze codebase for dead code, unused dependencies, stale docs",
19
+ "type": "once",
20
+ "steps": [
21
+ "scan_unused_exports",
22
+ "scan_unused_dependencies",
23
+ "scan_stale_documentation",
24
+ "generate_report"
25
+ ],
26
+ "transition": {
27
+ "on_complete": "clean"
28
+ }
29
+ },
30
+ {
31
+ "id": "clean",
32
+ "name": "Clean",
33
+ "description": "Remove identified dead code and unused dependencies",
34
+ "type": "once",
35
+ "steps": [
36
+ "remove_dead_code",
37
+ "remove_unused_deps",
38
+ "verify_build",
39
+ "commit"
40
+ ],
41
+ "checks": {
42
+ "build": {
43
+ "command": "npm run build",
44
+ "on_fail": "retry",
45
+ "max_retries": 2
46
+ }
47
+ },
48
+ "transition": {
49
+ "on_complete": "sync"
50
+ }
51
+ },
52
+ {
53
+ "id": "sync",
54
+ "name": "Sync Documentation",
55
+ "description": "Update documentation to match current codebase",
56
+ "type": "once",
57
+ "steps": [
58
+ "update_arch_md",
59
+ "update_lessons_learned",
60
+ "update_claude_md",
61
+ "commit"
62
+ ],
63
+ "transition": {
64
+ "on_complete": "verify"
65
+ }
66
+ },
67
+ {
68
+ "id": "verify",
69
+ "name": "Verify",
70
+ "description": "Run tests and verify codebase health",
71
+ "type": "once",
72
+ "steps": [
73
+ "run_tests",
74
+ "run_build",
75
+ "create_summary"
76
+ ],
77
+ "checks": {
78
+ "tests": {
79
+ "command": "npm test",
80
+ "on_fail": "clean",
81
+ "max_retries": 1
82
+ }
83
+ },
84
+ "gate": {
85
+ "name": "maintain-complete",
86
+ "description": "Maintenance complete",
87
+ "requires": ["tests_pass", "build_succeeds"],
88
+ "next": null
89
+ }
90
+ }
91
+ ],
92
+ "signals": {
93
+ "PHASE_COMPLETE": {
94
+ "description": "Signal current phase is complete",
95
+ "transitions_to": "next_phase"
96
+ },
97
+ "BLOCKED": {
98
+ "description": "Signal maintenance is blocked",
99
+ "requires": "reason"
100
+ }
101
+ },
102
+ "defaults": {
103
+ "mode": "soft",
104
+ "consultation": {
105
+ "enabled": false,
106
+ "models": [],
107
+ "parallel": false
108
+ },
109
+ "checks": {
110
+ "build": "npm run build",
111
+ "test": "npm test"
112
+ }
113
+ }
114
+ }