@cluesmith/codev 2.0.0-rc.10 → 2.0.0-rc.12
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.
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +81 -1
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/porch/claude.d.ts.map +1 -1
- package/dist/commands/porch/claude.js +2 -1
- package/dist/commands/porch/claude.js.map +1 -1
- package/dist/commands/porch/prompts.d.ts.map +1 -1
- package/dist/commands/porch/prompts.js +13 -2
- package/dist/commands/porch/prompts.js.map +1 -1
- package/dist/commands/porch/protocol.d.ts +3 -1
- package/dist/commands/porch/protocol.d.ts.map +1 -1
- package/dist/commands/porch/protocol.js +6 -4
- package/dist/commands/porch/protocol.js.map +1 -1
- package/dist/commands/porch/run.d.ts.map +1 -1
- package/dist/commands/porch/run.js +176 -9
- package/dist/commands/porch/run.js.map +1 -1
- package/dist/commands/porch/signals.d.ts +3 -0
- package/dist/commands/porch/signals.d.ts.map +1 -1
- package/dist/commands/porch/signals.js +5 -0
- package/dist/commands/porch/signals.js.map +1 -1
- package/dist/commands/porch/types.d.ts +5 -1
- package/dist/commands/porch/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/skeleton/protocols/bugfix/protocol.json +1 -1
- package/skeleton/protocols/spider/prompts/implement.md +99 -47
- package/skeleton/protocols/spider/protocol.json +10 -8
- package/skeleton/protocols/spider/protocol.md +26 -16
- package/skeleton/protocols/tick/protocol.json +1 -1
- package/skeleton/roles/builder.md +131 -332
- package/skeleton/protocols/spider/prompts/defend.md +0 -215
- package/skeleton/protocols/spider/prompts/evaluate.md +0 -241
|
@@ -4,7 +4,7 @@ You are executing the **IMPLEMENT** phase of the SPIDER protocol.
|
|
|
4
4
|
|
|
5
5
|
## Your Goal
|
|
6
6
|
|
|
7
|
-
Write clean, well-structured code that
|
|
7
|
+
Write clean, well-structured code AND tests that implement the current plan phase.
|
|
8
8
|
|
|
9
9
|
## Context
|
|
10
10
|
|
|
@@ -15,14 +15,54 @@ Write clean, well-structured code that implements the current plan phase.
|
|
|
15
15
|
- **Spec File**: `codev/specs/{{project_id}}-{{title}}.md`
|
|
16
16
|
- **Plan File**: `codev/plans/{{project_id}}-{{title}}.md`
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## What Happens After You Finish
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
When you signal `PHASE_COMPLETE`, porch will:
|
|
21
|
+
1. Run 3-way consultation (Gemini, Codex, Claude) on your implementation
|
|
22
|
+
2. Check that tests exist and pass
|
|
23
|
+
3. If reviewers request changes, you'll be respawned with their feedback
|
|
24
|
+
4. Once approved, porch commits and moves to the next plan phase
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
## Spec Compliance (CRITICAL)
|
|
27
|
+
|
|
28
|
+
**The spec is the source of truth. Code that doesn't match the spec is wrong, even if it "works".**
|
|
29
|
+
|
|
30
|
+
### Trust Hierarchy
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
SPEC (source of truth)
|
|
34
|
+
↓
|
|
35
|
+
PLAN (implementation guide derived from spec)
|
|
36
|
+
↓
|
|
37
|
+
EXISTING CODE (NOT TRUSTED - must be validated against spec)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Never trust existing code over the spec.** Previous implementations may have drifted.
|
|
41
|
+
|
|
42
|
+
### Pre-Implementation Sanity Check (PISC)
|
|
43
|
+
|
|
44
|
+
**Before writing ANY code:**
|
|
45
|
+
|
|
46
|
+
1. ✅ "Have I read the spec in the last 30 minutes?"
|
|
47
|
+
2. ✅ "If the spec has a 'Traps to Avoid' section, have I read it?"
|
|
48
|
+
3. ✅ "Does my approach match the spec's Technical Implementation section?"
|
|
49
|
+
4. ✅ "If the spec has code examples, am I following them?"
|
|
50
|
+
5. ✅ "Does the existing code I'm building on actually match the spec?"
|
|
51
|
+
|
|
52
|
+
**If ANY answer is "no" or "unsure" → STOP and re-read the spec.**
|
|
53
|
+
|
|
54
|
+
### Avoiding "Fixing Mode"
|
|
55
|
+
|
|
56
|
+
A dangerous pattern: You start looking at symptoms in code, making incremental fixes, copying existing patterns - without going back to the spec. This leads to:
|
|
57
|
+
- Cargo-culting patterns that may be wrong
|
|
58
|
+
- Building on broken foundations
|
|
59
|
+
- Implementing something different from the spec
|
|
60
|
+
|
|
61
|
+
**When you catch yourself "fixing" code:**
|
|
62
|
+
1. STOP
|
|
63
|
+
2. Ask: "What does the spec say about this?"
|
|
64
|
+
3. Re-read the spec's Traps to Avoid section
|
|
65
|
+
4. Verify existing code matches the spec before building on it
|
|
26
66
|
|
|
27
67
|
## Prerequisites
|
|
28
68
|
|
|
@@ -48,7 +88,7 @@ Read the current phase in the plan:
|
|
|
48
88
|
- Check that previous phase is committed: `git log --oneline -5`
|
|
49
89
|
- Ensure build passes before starting: `npm run build` (or equivalent)
|
|
50
90
|
|
|
51
|
-
### 3. Implement
|
|
91
|
+
### 3. Implement the Code
|
|
52
92
|
|
|
53
93
|
Write the code following these principles:
|
|
54
94
|
|
|
@@ -62,60 +102,72 @@ Write the code following these principles:
|
|
|
62
102
|
**Implementation Approach**:
|
|
63
103
|
- Work on one file at a time
|
|
64
104
|
- Make small, incremental changes
|
|
65
|
-
- Test as you go (manual verification is fine here)
|
|
66
105
|
- Document complex logic with comments
|
|
67
106
|
|
|
68
|
-
### 4.
|
|
107
|
+
### 4. Write Tests
|
|
69
108
|
|
|
70
|
-
|
|
71
|
-
- Read through all changes
|
|
72
|
-
- Check for obvious bugs
|
|
73
|
-
- Verify code matches the spec requirements
|
|
74
|
-
- Ensure no accidental debug code
|
|
109
|
+
**Tests are required.** For each piece of functionality you implement:
|
|
75
110
|
|
|
76
|
-
|
|
111
|
+
- Write unit tests for core logic
|
|
112
|
+
- Write integration tests if the phase involves multiple components
|
|
113
|
+
- Test error cases and edge conditions
|
|
114
|
+
- Ensure tests are deterministic (no flaky tests)
|
|
77
115
|
|
|
78
|
-
|
|
116
|
+
**Test file locations** (follow project conventions):
|
|
117
|
+
- `tests/` or `__tests__/` directories
|
|
118
|
+
- `*.test.ts` or `*.spec.ts` naming
|
|
119
|
+
|
|
120
|
+
### 5. Verify Everything Works
|
|
121
|
+
|
|
122
|
+
Run both build and tests:
|
|
79
123
|
|
|
80
124
|
```bash
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
npm run build # Node.js/TypeScript projects
|
|
84
|
-
npm run typecheck # TypeScript type checking
|
|
85
|
-
npm run lint # Linting (ESLint, etc.)
|
|
86
|
-
cargo build # Rust projects
|
|
87
|
-
go build ./... # Go projects
|
|
88
|
-
make build # Projects using Makefiles
|
|
125
|
+
npm run build # Must pass
|
|
126
|
+
npm test # Must pass
|
|
89
127
|
```
|
|
90
128
|
|
|
91
|
-
**Important**: Don't assume
|
|
129
|
+
**Important**: Don't assume these commands exist. Check `package.json` first.
|
|
130
|
+
|
|
131
|
+
Fix any errors before signaling completion.
|
|
132
|
+
|
|
133
|
+
### 6. Self-Review
|
|
92
134
|
|
|
93
|
-
|
|
135
|
+
Before signaling completion:
|
|
136
|
+
- Read through all code changes
|
|
137
|
+
- Read through all test changes
|
|
138
|
+
- Verify code matches the spec requirements
|
|
139
|
+
- Ensure no accidental debug code
|
|
140
|
+
- Check test coverage is adequate
|
|
94
141
|
|
|
95
142
|
## Output
|
|
96
143
|
|
|
144
|
+
When complete, you should have:
|
|
97
145
|
- Modified/created source files as specified in the plan phase
|
|
146
|
+
- Tests covering the new functionality
|
|
98
147
|
- All build checks passing
|
|
99
|
-
-
|
|
148
|
+
- All tests passing
|
|
100
149
|
|
|
101
150
|
## Signals
|
|
102
151
|
|
|
103
|
-
|
|
152
|
+
When implementation AND tests are complete and passing:
|
|
104
153
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
154
|
+
```
|
|
155
|
+
<signal>PHASE_COMPLETE</signal>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If you encounter a blocker:
|
|
109
159
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
```
|
|
160
|
+
```
|
|
161
|
+
<signal>BLOCKED:reason goes here</signal>
|
|
162
|
+
```
|
|
114
163
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
164
|
+
If you need spec/plan clarification:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
<signal type=AWAITING_INPUT>
|
|
168
|
+
Your specific questions here
|
|
169
|
+
</signal>
|
|
170
|
+
```
|
|
119
171
|
|
|
120
172
|
## Important Notes
|
|
121
173
|
|
|
@@ -123,21 +175,21 @@ Emit appropriate signals based on your progress:
|
|
|
123
175
|
2. **Don't over-engineer** - Simplest solution that works
|
|
124
176
|
3. **Don't skip error handling** - But don't go overboard either
|
|
125
177
|
4. **Keep changes focused** - Only touch files in this phase
|
|
126
|
-
5. **Build must pass** - Don't
|
|
178
|
+
5. **Build AND tests must pass** - Don't signal complete until both pass
|
|
179
|
+
6. **Write tests** - Every implementation phase needs tests
|
|
127
180
|
|
|
128
181
|
## What NOT to Do
|
|
129
182
|
|
|
130
|
-
- Don't write tests yet (that's Defend phase)
|
|
131
183
|
- Don't modify files outside this phase's scope
|
|
132
184
|
- Don't add features not in the spec
|
|
133
185
|
- Don't leave TODO comments for later (fix now or note as blocker)
|
|
134
|
-
- Don't
|
|
135
|
-
- Don't use `git add .` or `git add -A` when you
|
|
186
|
+
- Don't skip writing tests
|
|
187
|
+
- Don't use `git add .` or `git add -A` when you commit (security risk)
|
|
136
188
|
|
|
137
189
|
## Handling Problems
|
|
138
190
|
|
|
139
191
|
**If the plan is unclear**:
|
|
140
|
-
Signal `
|
|
192
|
+
Signal `AWAITING_INPUT` with your specific question.
|
|
141
193
|
|
|
142
194
|
**If you discover the spec is wrong**:
|
|
143
195
|
Signal `BLOCKED` and explain the issue. The Architect may need to update the spec.
|
|
@@ -145,5 +197,5 @@ Signal `BLOCKED` and explain the issue. The Architect may need to update the spe
|
|
|
145
197
|
**If a dependency is missing**:
|
|
146
198
|
Signal `BLOCKED` with details about what's missing.
|
|
147
199
|
|
|
148
|
-
**If build
|
|
200
|
+
**If build or tests fail and you can't fix it**:
|
|
149
201
|
Signal `BLOCKED` with the error message.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../protocol-schema.json",
|
|
3
3
|
"name": "spider",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"alias": "spir",
|
|
5
|
+
"version": "2.1.0",
|
|
6
|
+
"description": "SPIR: Specify → Plan → Implement → Review with build-verify cycles",
|
|
6
7
|
"phases": [
|
|
7
8
|
{
|
|
8
9
|
"id": "specify",
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"models": ["gemini", "codex", "claude"],
|
|
19
20
|
"parallel": true
|
|
20
21
|
},
|
|
21
|
-
"max_iterations":
|
|
22
|
+
"max_iterations": 7,
|
|
22
23
|
"on_complete": {
|
|
23
24
|
"commit": true,
|
|
24
25
|
"push": true
|
|
@@ -40,14 +41,15 @@
|
|
|
40
41
|
"models": ["gemini", "codex", "claude"],
|
|
41
42
|
"parallel": true
|
|
42
43
|
},
|
|
43
|
-
"max_iterations":
|
|
44
|
+
"max_iterations": 7,
|
|
44
45
|
"on_complete": {
|
|
45
46
|
"commit": true,
|
|
46
47
|
"push": true
|
|
47
48
|
},
|
|
48
49
|
"checks": {
|
|
49
50
|
"plan_exists": "test -f codev/plans/${PROJECT_ID}-*.md",
|
|
50
|
-
"has_phases_json": "grep -q '\"phases\":' codev/plans/${PROJECT_ID}-*.md"
|
|
51
|
+
"has_phases_json": "grep -q '\"phases\":' codev/plans/${PROJECT_ID}-*.md",
|
|
52
|
+
"min_two_phases": "grep -o '\"id\": *\"[^\"]*\"' codev/plans/${PROJECT_ID}-*.md | wc -l | awk '$1 >= 2 {exit 0} {exit 1}'"
|
|
51
53
|
},
|
|
52
54
|
"gate": "plan-approval",
|
|
53
55
|
"next": "implement"
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"models": ["gemini", "codex", "claude"],
|
|
67
69
|
"parallel": true
|
|
68
70
|
},
|
|
69
|
-
"max_iterations":
|
|
71
|
+
"max_iterations": 7,
|
|
70
72
|
"on_complete": {
|
|
71
73
|
"commit": true,
|
|
72
74
|
"push": true
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
"models": ["gemini", "codex", "claude"],
|
|
103
105
|
"parallel": true
|
|
104
106
|
},
|
|
105
|
-
"max_iterations":
|
|
107
|
+
"max_iterations": 7,
|
|
106
108
|
"on_complete": {
|
|
107
109
|
"commit": true,
|
|
108
110
|
"push": true
|
|
@@ -127,7 +129,7 @@
|
|
|
127
129
|
"commit_has_code": "git log -1 --name-only --pretty=format: | grep -qE '\\.(ts|tsx|js|jsx|py|go|rs)$'"
|
|
128
130
|
},
|
|
129
131
|
"defaults": {
|
|
130
|
-
"max_iterations":
|
|
132
|
+
"max_iterations": 7,
|
|
131
133
|
"verify": {
|
|
132
134
|
"models": ["gemini", "codex", "claude"],
|
|
133
135
|
"parallel": true
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SPIR Protocol (formerly SPIDER)
|
|
2
|
+
|
|
3
|
+
> **Also known as**: SPIDER (legacy name)
|
|
4
|
+
>
|
|
5
|
+
> **SPIR** = **S**pecify → **P**lan → **I**mplement → **R**eview
|
|
6
|
+
>
|
|
7
|
+
> Each phase has one build-verify cycle with 3-way consultation.
|
|
2
8
|
|
|
3
9
|
> **Quick Reference**: See `codev/resources/workflow-reference.md` for stage diagrams and common commands.
|
|
4
10
|
|
|
@@ -40,13 +46,21 @@ The user can specify different agents by saying: "use SPIDER with consultation f
|
|
|
40
46
|
- **Review**: After review document
|
|
41
47
|
|
|
42
48
|
## Overview
|
|
43
|
-
|
|
49
|
+
SPIR 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.
|
|
50
|
+
|
|
51
|
+
**The SPIR Model**:
|
|
52
|
+
- **S - Specify**: Write specification with 3-way review → Gate: `spec-approval`
|
|
53
|
+
- **P - Plan**: Write implementation plan with 3-way review → Gate: `plan-approval`
|
|
54
|
+
- **I - Implement**: Execute each plan phase with build-verify cycle (one cycle per phase)
|
|
55
|
+
- **R - Review**: Final review and PR preparation with 3-way review
|
|
56
|
+
|
|
57
|
+
Each phase follows a build-verify loop: build the artifact, then verify with 3-way consultation (Gemini, Codex, Claude).
|
|
44
58
|
|
|
45
59
|
**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
60
|
|
|
47
|
-
## When to Use
|
|
61
|
+
## When to Use SPIR
|
|
48
62
|
|
|
49
|
-
### Use
|
|
63
|
+
### Use SPIR for:
|
|
50
64
|
- New feature development
|
|
51
65
|
- Architecture changes
|
|
52
66
|
- Complex refactoring
|
|
@@ -54,7 +68,7 @@ SPIDER is a structured development protocol that emphasizes specification-driven
|
|
|
54
68
|
- API design and implementation
|
|
55
69
|
- Performance optimization initiatives
|
|
56
70
|
|
|
57
|
-
### Skip
|
|
71
|
+
### Skip SPIR for:
|
|
58
72
|
- Simple bug fixes (< 10 lines)
|
|
59
73
|
- Documentation updates
|
|
60
74
|
- Configuration changes
|
|
@@ -224,25 +238,21 @@ Each phase should be:
|
|
|
224
238
|
**Template**: `templates/plan.md`
|
|
225
239
|
**Review Required**: Yes - Technical lead approval AFTER consultations
|
|
226
240
|
|
|
227
|
-
###
|
|
228
|
-
|
|
229
|
-
Execute for each phase in the plan. This is a strict cycle that must be completed in order.
|
|
241
|
+
### I - Implement (Per Plan Phase)
|
|
230
242
|
|
|
231
|
-
|
|
243
|
+
Execute for each phase in the plan. Each phase follows a build-verify cycle.
|
|
232
244
|
|
|
233
245
|
**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
246
|
|
|
235
|
-
**
|
|
236
|
-
1. **
|
|
237
|
-
2. **
|
|
238
|
-
3. **
|
|
247
|
+
**Build-Verify Cycle Per Phase**:
|
|
248
|
+
1. **Build** - Implement code and tests for this phase
|
|
249
|
+
2. **Verify** - 3-way consultation (Gemini, Codex, Claude)
|
|
250
|
+
3. **Iterate** - Address feedback until verification passes
|
|
239
251
|
4. **Commit** - Single atomic commit for the phase (MANDATORY before next phase)
|
|
240
252
|
5. **Proceed** - Move to next phase only after commit
|
|
241
253
|
|
|
242
254
|
**Handling Failures**:
|
|
243
|
-
- If
|
|
244
|
-
- If **Evaluation** reveals unmet criteria → return to **Implement**
|
|
245
|
-
- If user requests changes → return to **Implement**
|
|
255
|
+
- If verification reveals gaps → iterate and fix
|
|
246
256
|
- If fundamental plan flaws found → mark phase as `blocked` and revise plan
|
|
247
257
|
|
|
248
258
|
**Commit Requirements**:
|