@cluesmith/codev 2.0.12 → 2.0.13

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.
@@ -0,0 +1,139 @@
1
+ # SPECIFY Phase Prompt
2
+
3
+ You are executing the **SPECIFY** phase of the SPIR protocol.
4
+
5
+ ## Your Goal
6
+
7
+ Create a comprehensive specification document that thoroughly explores the problem space and proposed solution.
8
+
9
+ ## Context
10
+
11
+ - **Project ID**: {{project_id}}
12
+ - **Project Title**: {{title}}
13
+ - **Current State**: {{current_state}}
14
+ - **Spec File**: `codev/specs/{{artifact_name}}.md`
15
+
16
+ ## Process
17
+
18
+ ### 0. Check for Existing Spec (ALWAYS DO THIS FIRST)
19
+
20
+ **Before asking ANY questions**, check if a spec already exists:
21
+
22
+ ```bash
23
+ ls codev/specs/{{project_id}}-*.md
24
+ ```
25
+
26
+ **If a spec file exists:**
27
+ 1. READ IT COMPLETELY - the answers to your questions are already there
28
+ 2. The spec author has already made the key decisions
29
+ 3. DO NOT ask clarifying questions - proceed directly to consultation
30
+ 4. Your job is to REVIEW and IMPROVE the existing spec, not rewrite it from scratch
31
+
32
+ **If no spec exists:** Proceed to Step 1 below.
33
+
34
+ ### 1. Clarifying Questions (ONLY IF NO SPEC EXISTS)
35
+
36
+ Before writing anything, ask clarifying questions to understand:
37
+ - What problem is being solved?
38
+ - Who are the stakeholders?
39
+ - What are the constraints?
40
+ - What's in scope vs out of scope?
41
+ - What does success look like?
42
+
43
+ If this is your first iteration AND no spec exists, ask these questions now and wait for answers.
44
+
45
+ **CRITICAL**: Do NOT ask questions if a spec already exists. The spec IS the answer.
46
+
47
+ **On subsequent iterations**: If questions were already answered, acknowledge the answers and proceed to the next step.
48
+
49
+ ### 2. Problem Analysis
50
+
51
+ Once you have answers, document:
52
+ - The problem being solved (clearly articulated)
53
+ - Current state vs desired state
54
+ - Stakeholders and their needs
55
+ - Assumptions and constraints
56
+
57
+ ### 3. Solution Exploration
58
+
59
+ Generate multiple solution approaches. For each:
60
+ - Technical design overview
61
+ - Trade-offs (pros/cons)
62
+ - Complexity assessment
63
+ - Risk assessment
64
+
65
+ ### 4. Open Questions
66
+
67
+ List uncertainties categorized as:
68
+ - **Critical** - blocks progress
69
+ - **Important** - affects design
70
+ - **Nice-to-know** - optimization
71
+
72
+ ### 5. Success Criteria
73
+
74
+ Define measurable acceptance criteria:
75
+ - Functional requirements (MUST, SHOULD, COULD)
76
+ - Non-functional requirements (performance, security)
77
+ - Test scenarios
78
+
79
+ ### 6. Finalize
80
+
81
+ After completing the spec draft, signal completion. Porch will run 3-way consultation (Gemini, Codex, Claude) automatically via the verify step. If reviewers request changes, you'll be respawned with their feedback.
82
+
83
+ ## Output
84
+
85
+ Create or update the specification file at `codev/specs/{{artifact_name}}.md`.
86
+
87
+ **IMPORTANT**: Keep spec/plan/review filenames in sync:
88
+ - Spec: `codev/specs/{{artifact_name}}.md`
89
+ - Plan: `codev/plans/{{artifact_name}}.md`
90
+ - Review: `codev/reviews/{{artifact_name}}.md`
91
+
92
+ ## Signals
93
+
94
+ Emit appropriate signals based on your progress:
95
+
96
+ - When waiting for clarifying question answers, **include your questions in the signal**:
97
+ ```
98
+ <signal type=AWAITING_INPUT>
99
+ Please answer these questions:
100
+ 1. What should the primary use case be - internal tooling or customer-facing?
101
+ 2. What are the key constraints we should consider?
102
+ 3. Who are the main stakeholders?
103
+ </signal>
104
+ ```
105
+
106
+ The content inside the signal tag is displayed prominently to the user.
107
+
108
+ - After completing the initial spec draft:
109
+ ```
110
+ <signal>SPEC_DRAFTED</signal>
111
+ ```
112
+
113
+
114
+ ## Commit Cadence
115
+
116
+ Make commits at these milestones:
117
+ 1. `[Spec {{project_id}}] Initial specification draft`
118
+ 2. `[Spec {{project_id}}] Specification with multi-agent review`
119
+ 3. `[Spec {{project_id}}] Specification with user feedback`
120
+ 4. `[Spec {{project_id}}] Final approved specification`
121
+
122
+ **CRITICAL**: Never use `git add .` or `git add -A`. Always stage specific files:
123
+ ```bash
124
+ git add codev/specs/{{artifact_name}}.md
125
+ ```
126
+
127
+ ## Important Notes
128
+
129
+ 1. **Be thorough** - A good spec prevents implementation problems
130
+ 3. **Be specific** - Vague specs lead to wrong implementations
131
+ 4. **Include examples** - Concrete examples clarify intent
132
+
133
+ ## What NOT to Do
134
+
135
+ - Don't run `consult` commands yourself (porch handles consultations)
136
+ - Don't include implementation details (that's for the Plan phase)
137
+ - Don't estimate time (AI makes time estimates meaningless)
138
+ - Don't start coding (you're in Specify, not Implement)
139
+ - Don't use `git add .` or `git add -A` (security risk)
@@ -0,0 +1,161 @@
1
+ {
2
+ "$schema": "../../protocol-schema.json",
3
+ "name": "aspir",
4
+ "version": "1.0.0",
5
+ "description": "ASPIR: Autonomous SPIR — Specify → Plan → Implement → Review without human approval gates",
6
+ "input": {
7
+ "type": "spec",
8
+ "required": false,
9
+ "default_for": ["--project", "-p"]
10
+ },
11
+ "phases": [
12
+ {
13
+ "id": "specify",
14
+ "name": "Specify",
15
+ "description": "Write specification with 3-way review",
16
+ "type": "build_verify",
17
+ "build": {
18
+ "prompt": "specify.md",
19
+ "artifact": "codev/specs/${PROJECT_TITLE}.md"
20
+ },
21
+ "verify": {
22
+ "type": "spec",
23
+ "models": ["gemini", "codex", "claude"],
24
+ "parallel": true
25
+ },
26
+ "max_iterations": 1,
27
+ "on_complete": {
28
+ "commit": true,
29
+ "push": true
30
+ },
31
+ "next": "plan"
32
+ },
33
+ {
34
+ "id": "plan",
35
+ "name": "Plan",
36
+ "description": "Write implementation plan with 3-way review",
37
+ "type": "build_verify",
38
+ "build": {
39
+ "prompt": "plan.md",
40
+ "artifact": "codev/plans/${PROJECT_TITLE}.md"
41
+ },
42
+ "verify": {
43
+ "type": "plan",
44
+ "models": ["gemini", "codex", "claude"],
45
+ "parallel": true
46
+ },
47
+ "max_iterations": 1,
48
+ "on_complete": {
49
+ "commit": true,
50
+ "push": true
51
+ },
52
+ "checks": {
53
+ "plan_exists": "test -f codev/plans/${PROJECT_TITLE}.md",
54
+ "has_phases_json": "grep -q '\"phases\":' codev/plans/${PROJECT_TITLE}.md",
55
+ "min_two_phases": "grep -o '\"id\": *\"[^\"]*\"' codev/plans/${PROJECT_TITLE}.md | wc -l | awk '$1 >= 2 {exit 0} {exit 1}'"
56
+ },
57
+ "next": "implement"
58
+ },
59
+ {
60
+ "id": "implement",
61
+ "name": "Implement",
62
+ "description": "Implement code with 3-way review per plan phase",
63
+ "type": "per_plan_phase",
64
+ "build": {
65
+ "prompt": "implement.md",
66
+ "artifact": "src/**/*.{ts,tsx,js,jsx}"
67
+ },
68
+ "verify": {
69
+ "type": "impl",
70
+ "models": ["gemini", "codex", "claude"],
71
+ "parallel": true
72
+ },
73
+ "max_iterations": 1,
74
+ "on_complete": {
75
+ "commit": true,
76
+ "push": true
77
+ },
78
+ "checks": {
79
+ "build": {
80
+ "command": "npm run build",
81
+ "on_fail": "retry",
82
+ "max_retries": 2
83
+ },
84
+ "tests": {
85
+ "command": "npm test -- --exclude='**/e2e/**'",
86
+ "description": "Unit tests only - e2e tests run in review phase",
87
+ "on_fail": "retry",
88
+ "max_retries": 2
89
+ }
90
+ },
91
+ "transition": {
92
+ "on_complete": "implement",
93
+ "on_all_phases_complete": "review"
94
+ }
95
+ },
96
+ {
97
+ "id": "review",
98
+ "name": "Review",
99
+ "description": "Final review and PR with 3-way review",
100
+ "type": "build_verify",
101
+ "build": {
102
+ "prompt": "review.md",
103
+ "artifact": "codev/reviews/${PROJECT_TITLE}.md"
104
+ },
105
+ "verify": {
106
+ "type": "pr",
107
+ "models": ["gemini", "codex", "claude"],
108
+ "parallel": true
109
+ },
110
+ "max_iterations": 1,
111
+ "on_complete": {
112
+ "commit": true,
113
+ "push": true
114
+ },
115
+ "checks": {
116
+ "pr_exists": {
117
+ "command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
118
+ "description": "PR must be created before signaling completion"
119
+ },
120
+ "review_has_arch_updates": {
121
+ "command": "grep -q '## Architecture Updates' codev/reviews/${PROJECT_TITLE}.md",
122
+ "description": "Review must include '## Architecture Updates' section (what changed in arch.md, or why no changes needed)"
123
+ },
124
+ "review_has_lessons_updates": {
125
+ "command": "grep -q '## Lessons Learned Updates' codev/reviews/${PROJECT_TITLE}.md",
126
+ "description": "Review must include '## Lessons Learned Updates' section (what changed in lessons-learned.md, or why no changes needed)"
127
+ },
128
+ "e2e_tests": {
129
+ "command": "npm run test:e2e 2>&1 || echo 'e2e tests skipped (not configured)'",
130
+ "description": "Full e2e test suite - only runs in review phase",
131
+ "optional": true
132
+ }
133
+ },
134
+ "gate": "pr",
135
+ "next": null
136
+ }
137
+ ],
138
+ "signals": {
139
+ "PHASE_COMPLETE": {
140
+ "description": "Signal current build phase is complete",
141
+ "transitions_to": "verify"
142
+ },
143
+ "BLOCKED": {
144
+ "description": "Signal implementation is blocked",
145
+ "requires": "reason"
146
+ }
147
+ },
148
+ "phase_completion": {
149
+ "build_succeeds": "npm run build 2>&1",
150
+ "tests_pass": "npm test 2>&1",
151
+ "commit_has_code": "git log -1 --name-only --pretty=format: | grep -qE '\\.(ts|tsx|js|jsx|py|go|rs)$'"
152
+ },
153
+ "defaults": {
154
+ "mode": "strict",
155
+ "max_iterations": 1,
156
+ "verify": {
157
+ "models": ["gemini", "codex", "claude"],
158
+ "parallel": true
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,94 @@
1
+ # ASPIR Protocol
2
+
3
+ > **ASPIR** = **A**utonomous **S**pecify → **P**lan → **I**mplement → **R**eview
4
+ >
5
+ > Identical to SPIR but without human approval gates on spec and plan phases.
6
+ > Each phase has one build-verify cycle with 3-way consultation.
7
+
8
+ ## What is ASPIR?
9
+
10
+ ASPIR is an autonomous variant of the SPIR protocol. It follows the exact same phases (Specify → Plan → Implement → Review) with the same 3-way consultations, checks, and PR flow — but removes the `spec-approval` and `plan-approval` human gates.
11
+
12
+ This means the builder proceeds automatically from Specify → Plan → Implement without waiting for human approval at each gate. The `pr` gate in the Review phase is preserved — a human still reviews all code before merge.
13
+
14
+ ### Differences from SPIR
15
+
16
+ | Aspect | SPIR | ASPIR |
17
+ |--------|------|-------|
18
+ | Spec gate (`spec-approval`) | Human must approve | Auto-approved |
19
+ | Plan gate (`plan-approval`) | Human must approve | Auto-approved |
20
+ | PR gate (`pr`) | Human must approve | Human must approve |
21
+ | Phases | Specify → Plan → Implement → Review | Same |
22
+ | 3-way consultations | Yes, every phase | Same |
23
+ | Checks (build, tests, PR) | Yes | Same |
24
+ | Prompts / templates | Full set | Same (copied from SPIR) |
25
+
26
+ ### When to Use ASPIR
27
+
28
+ Use ASPIR instead of SPIR when:
29
+
30
+ - The work is **trusted and low-risk** — internal tooling, protocol additions, well-understood features
31
+ - The architect has **pre-written and approved** the spec before spawning
32
+ - The scope is **self-contained** with low blast radius
33
+ - You want **full SPIR discipline** (consultations, phased implementation, review) without waiting at gates
34
+
35
+ ### When NOT to Use ASPIR
36
+
37
+ Use SPIR instead when:
38
+
39
+ - The feature involves **novel architecture** or unclear requirements
40
+ - The spec needs **iterative human feedback** during drafting
41
+ - The work is **high-risk** — security-sensitive, user-facing, or broadly impactful
42
+ - You want to **review and adjust** the plan before implementation starts
43
+
44
+ ## Protocol Phases
45
+
46
+ ASPIR follows the same four phases as SPIR. For full phase documentation, see the [SPIR protocol](../spir/protocol.md).
47
+
48
+ ### S - Specify
49
+ Write specification with 3-way review (Gemini, Codex, Claude). **No human gate** — proceeds directly to Plan after verification.
50
+
51
+ ### P - Plan
52
+ Write implementation plan with 3-way review. **No human gate** — proceeds directly to Implement after verification and checks pass.
53
+
54
+ ### I - Implement
55
+ Execute each plan phase with build-verify cycle. Same as SPIR — no gate between phases (SPIR also has no gate here).
56
+
57
+ ### R - Review
58
+ Final review, PR preparation, and 3-way review. **PR gate preserved** — builder stops and waits for human approval before merge.
59
+
60
+ ## Usage
61
+
62
+ ```bash
63
+ # Spawn a builder using ASPIR
64
+ af spawn 42 --protocol aspir
65
+
66
+ # The builder runs autonomously through Specify → Plan → Implement
67
+ # and stops only at the PR gate in the Review phase
68
+ ```
69
+
70
+ ## File Structure
71
+
72
+ ```
73
+ codev/protocols/aspir/
74
+ ├── protocol.json # Protocol definition (SPIR minus gates)
75
+ ├── protocol.md # This file
76
+ ├── builder-prompt.md # Builder instructions (same as SPIR)
77
+ ├── prompts/
78
+ │ ├── specify.md # Specify phase prompt (same as SPIR)
79
+ │ ├── plan.md # Plan phase prompt (same as SPIR)
80
+ │ ├── implement.md # Implement phase prompt (same as SPIR)
81
+ │ └── review.md # Review phase prompt (same as SPIR)
82
+ ├── consult-types/
83
+ │ ├── spec-review.md # Spec consultation guide (same as SPIR)
84
+ │ ├── plan-review.md # Plan consultation guide (same as SPIR)
85
+ │ ├── impl-review.md # Impl consultation guide (same as SPIR)
86
+ │ ├── phase-review.md # Phase consultation guide (same as SPIR)
87
+ │ └── pr-review.md # PR consultation guide (same as SPIR)
88
+ └── templates/
89
+ ├── spec.md # Spec template (same as SPIR)
90
+ ├── plan.md # Plan template (same as SPIR)
91
+ └── review.md # Review template (same as SPIR)
92
+ ```
93
+
94
+ All files except `protocol.json` and `protocol.md` are identical to their SPIR counterparts.
@@ -0,0 +1,204 @@
1
+ # Plan: [Title]
2
+
3
+ ## Metadata
4
+ - **ID**: plan-[YYYY-MM-DD]-[short-name]
5
+ - **Status**: draft
6
+ - **Specification**: [Link to codev/specs/spec-file.md]
7
+ - **Created**: [YYYY-MM-DD]
8
+
9
+ ## Executive Summary
10
+ [Brief overview of the implementation approach chosen and why. Reference the specification's selected approach.]
11
+
12
+ ## Success Metrics
13
+ [Copy from specification and add implementation-specific metrics]
14
+ - [ ] All specification criteria met
15
+ - [ ] Test coverage >90%
16
+ - [ ] Performance benchmarks achieved
17
+ - [ ] Zero critical security issues
18
+ - [ ] Documentation complete
19
+
20
+ ## Phases (Machine Readable)
21
+
22
+ <!-- REQUIRED: porch uses this JSON to track phase progress. Update this when adding/removing phases. -->
23
+
24
+ ```json
25
+ {
26
+ "phases": [
27
+ {"id": "phase_1", "title": "Phase 1 Title Here"},
28
+ {"id": "phase_2", "title": "Phase 2 Title Here"},
29
+ {"id": "phase_3", "title": "Phase 3 Title Here"}
30
+ ]
31
+ }
32
+ ```
33
+
34
+ ## Phase Breakdown
35
+
36
+ ### Phase 1: [Descriptive Name]
37
+ **Dependencies**: None
38
+
39
+ #### Objectives
40
+ - [Clear, single objective for this phase]
41
+ - [What value does this phase deliver?]
42
+
43
+ #### Deliverables
44
+ - [ ] [Specific deliverable 1]
45
+ - [ ] [Specific deliverable 2]
46
+ - [ ] [Tests for this phase]
47
+ - [ ] [Documentation updates]
48
+
49
+ #### Implementation Details
50
+ [Specific technical approach for this phase. Include:
51
+ - Key files/modules to create or modify
52
+ - Architectural decisions
53
+ - API contracts
54
+ - Data models]
55
+
56
+ #### Acceptance Criteria
57
+ - [ ] [Testable criterion 1]
58
+ - [ ] [Testable criterion 2]
59
+ - [ ] All tests pass
60
+ - [ ] Code review completed
61
+
62
+ #### Test Plan
63
+ - **Unit Tests**: [What to test]
64
+ - **Integration Tests**: [What to test]
65
+ - **Manual Testing**: [Scenarios to verify]
66
+
67
+ #### Rollback Strategy
68
+ [How to revert this phase if issues arise]
69
+
70
+ #### Risks
71
+ - **Risk**: [Specific risk for this phase]
72
+ - **Mitigation**: [How to address]
73
+
74
+ ---
75
+
76
+ ### Phase 2: [Descriptive Name]
77
+ **Dependencies**: Phase 1
78
+
79
+ [Repeat structure for each phase]
80
+
81
+ ---
82
+
83
+ ### Phase 3: [Descriptive Name]
84
+ **Dependencies**: Phase 2
85
+
86
+ [Continue for all phases]
87
+
88
+ ## Dependency Map
89
+ ```
90
+ Phase 1 ──→ Phase 2 ──→ Phase 3
91
+
92
+ Phase 4 (optional)
93
+ ```
94
+
95
+ ## Resource Requirements
96
+ ### Development Resources
97
+ - **Engineers**: [Expertise needed]
98
+ - **Environment**: [Dev/staging requirements]
99
+
100
+ ### Infrastructure
101
+ - [Database changes]
102
+ - [New services]
103
+ - [Configuration updates]
104
+ - [Monitoring additions]
105
+
106
+ ## Integration Points
107
+ ### External Systems
108
+ - **System**: [Name]
109
+ - **Integration Type**: [API/Database/Message Queue]
110
+ - **Phase**: [Which phase needs this]
111
+ - **Fallback**: [What if unavailable]
112
+
113
+ ### Internal Systems
114
+ [Repeat structure]
115
+
116
+ ## Risk Analysis
117
+ ### Technical Risks
118
+ | Risk | Probability | Impact | Mitigation | Owner |
119
+ |------|------------|--------|------------|-------|
120
+ | [Risk 1] | L/M/H | L/M/H | [Strategy] | [Name] |
121
+
122
+ ### Schedule Risks
123
+ | Risk | Probability | Impact | Mitigation | Owner |
124
+ |------|------------|--------|------------|-------|
125
+ | [Risk 1] | L/M/H | L/M/H | [Strategy] | [Name] |
126
+
127
+ ## Validation Checkpoints
128
+ 1. **After Phase 1**: [What to validate]
129
+ 2. **After Phase 2**: [What to validate]
130
+ 3. **Before Production**: [Final checks]
131
+
132
+ ## Monitoring and Observability
133
+ ### Metrics to Track
134
+ - [Metric 1: Description and threshold]
135
+ - [Metric 2: Description and threshold]
136
+
137
+ ### Logging Requirements
138
+ - [What to log and at what level]
139
+ - [Retention requirements]
140
+
141
+ ### Alerting
142
+ - [Alert condition and severity]
143
+ - [Who to notify]
144
+
145
+ ## Documentation Updates Required
146
+ - [ ] API documentation
147
+ - [ ] Architecture diagrams
148
+ - [ ] Runbooks
149
+ - [ ] User guides
150
+ - [ ] Configuration guides
151
+
152
+ ## Post-Implementation Tasks
153
+ - [ ] Performance validation
154
+ - [ ] Security audit
155
+ - [ ] Load testing
156
+ - [ ] User acceptance testing
157
+ - [ ] Monitoring validation
158
+
159
+ ## Expert Review
160
+ **Date**: [YYYY-MM-DD]
161
+ **Model**: [Model consulted]
162
+ **Key Feedback**:
163
+ - [Feasibility assessment]
164
+ - [Missing considerations]
165
+ - [Risk identification]
166
+ - [Alternative suggestions]
167
+
168
+ **Plan Adjustments**:
169
+ - [How the plan was modified based on feedback]
170
+
171
+ ## Approval
172
+ - [ ] Technical Lead Review
173
+ - [ ] Engineering Manager Approval
174
+ - [ ] Resource Allocation Confirmed
175
+ - [ ] Expert AI Consultation Complete
176
+
177
+ ## Change Log
178
+ | Date | Change | Reason | Author |
179
+ |------|--------|--------|--------|
180
+ | [Date] | [What changed] | [Why] | [Who] |
181
+
182
+ ## Notes
183
+ [Additional context, assumptions, or considerations]
184
+
185
+ ---
186
+
187
+ ## Amendment History
188
+
189
+ This section tracks all TICK amendments to this plan. TICKs modify both the spec and plan together as an atomic unit.
190
+
191
+ <!-- When adding a TICK amendment, add a new entry below this line in chronological order -->
192
+
193
+ <!--
194
+ ### TICK-001: [Amendment Title] (YYYY-MM-DD)
195
+
196
+ **Changes**:
197
+ - [Phase added]: [Description of new phase]
198
+ - [Phase modified]: [What was updated]
199
+ - [Implementation steps]: [New steps added]
200
+
201
+ **Review**: See `reviews/####-name-tick-001.md`
202
+
203
+ ---
204
+ -->