opencodekit 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENT_ALIGNMENT.md +564 -0
- package/dist/template/.opencode/agent/build.md +140 -0
- package/dist/template/.opencode/agent/general.md +89 -0
- package/dist/template/.opencode/agent/plan.md +175 -0
- package/dist/template/.opencode/agent/review.md +96 -0
- package/dist/template/.opencode/command/create.md +57 -15
- package/dist/template/.opencode/command/init-context.md +259 -0
- package/dist/template/.opencode/command/init-user.md +103 -0
- package/dist/template/.opencode/command/init.md +53 -39
- package/dist/template/.opencode/command/plan.md +200 -16
- package/dist/template/.opencode/command/ship.md +251 -17
- package/dist/template/.opencode/command/start.md +35 -4
- package/dist/template/.opencode/memory/_templates/PROJECT.md +58 -0
- package/dist/template/.opencode/memory/_templates/ROADMAP.md +93 -0
- package/dist/template/.opencode/memory/_templates/STATE.md +89 -0
- package/dist/template/.opencode/memory/_templates/tech-stack.md +35 -0
- package/dist/template/.opencode/memory/project/project.md +92 -0
- package/dist/template/.opencode/memory/project/roadmap.md +142 -0
- package/dist/template/.opencode/memory/project/state.md +84 -0
- package/dist/template/.opencode/opencode.json +1030 -1027
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/skill/context-initialization/SKILL.md +60 -0
- package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +76 -0
- package/dist/template/.opencode/skill/writing-plans/SKILL.md +68 -0
- package/package.json +1 -1
|
@@ -41,7 +41,44 @@ Verify:
|
|
|
41
41
|
- `prd.md` exists
|
|
42
42
|
- If `plan.md` already exists, ask user: overwrite or skip?
|
|
43
43
|
|
|
44
|
-
## Phase 2:
|
|
44
|
+
## Phase 2: Discovery Assessment
|
|
45
|
+
|
|
46
|
+
Before research, determine discovery level based on PRD:
|
|
47
|
+
|
|
48
|
+
| Level | Scope | When to Use | Action |
|
|
49
|
+
| ----- | -------------------- | ----------------------------------------------------------------- | ------------------------------------------- |
|
|
50
|
+
| **0** | Skip | Pure internal work, existing patterns only (grep confirms) | Skip research, proceed to decomposition |
|
|
51
|
+
| **1** | Quick (2-5 min) | Single known library, confirming syntax/version | `context7 resolve-library-id + query-docs` |
|
|
52
|
+
| **2** | Standard (15-30 min) | Choosing between 2-3 options, new external integration | Spawn `@scout` for research |
|
|
53
|
+
| **3** | Deep (1+ hour) | Architectural decision, novel problem, multiple external services | Full research with parallel `@scout` agents |
|
|
54
|
+
|
|
55
|
+
**Depth indicators:**
|
|
56
|
+
|
|
57
|
+
- Level 2+: New library not in package.json, external API, "choose/select/evaluate"
|
|
58
|
+
- Level 3: "architecture/design/system", data modeling, auth design
|
|
59
|
+
|
|
60
|
+
**Decision:** Ask user to confirm or adjust:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const suggestedLevel = assessDiscoveryLevel(prdContent);
|
|
64
|
+
|
|
65
|
+
question({
|
|
66
|
+
questions: [
|
|
67
|
+
{
|
|
68
|
+
header: "Discovery Level",
|
|
69
|
+
question: `Suggested: Level ${suggestedLevel} (${getLevelDescription(suggestedLevel)}). Proceed?`,
|
|
70
|
+
options: [
|
|
71
|
+
{ label: `Yes, Level ${suggestedLevel} (Recommended)` },
|
|
72
|
+
{ label: "Lower (less research)", description: "If you know the patterns" },
|
|
73
|
+
{ label: "Higher (more research)", description: "If uncertain about approach" },
|
|
74
|
+
{ label: "Skip research", description: "I know the codebase" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Phase 3: Research (if Level 1-3)
|
|
45
82
|
|
|
46
83
|
Read the PRD and extract tasks, success criteria, affected files, scope.
|
|
47
84
|
|
|
@@ -52,20 +89,163 @@ Spawn parallel agents to gather implementation context:
|
|
|
52
89
|
| `explore` | Codebase patterns, affected file structure, test patterns, conflicts |
|
|
53
90
|
| `scout` | Best practices, common patterns, pitfalls |
|
|
54
91
|
|
|
55
|
-
## Phase
|
|
92
|
+
## Phase 4: Goal-Backward Analysis
|
|
93
|
+
|
|
94
|
+
**Forward planning:** "What should we build?" → produces tasks
|
|
95
|
+
**Goal-backward:** "What must be TRUE for the goal to be achieved?" → produces requirements
|
|
96
|
+
|
|
97
|
+
### Step 1: Extract Goal from PRD
|
|
98
|
+
|
|
99
|
+
Take success criteria from PRD. Must be outcome-shaped, not task-shaped.
|
|
100
|
+
|
|
101
|
+
- Good: "Working chat interface" (outcome)
|
|
102
|
+
- Bad: "Build chat components" (task)
|
|
103
|
+
|
|
104
|
+
### Step 2: Derive Observable Truths
|
|
105
|
+
|
|
106
|
+
"What must be TRUE for this goal to be achieved?" List 3-7 truths from USER's perspective.
|
|
107
|
+
|
|
108
|
+
Example for "working chat interface":
|
|
109
|
+
|
|
110
|
+
- User can see existing messages
|
|
111
|
+
- User can type a new message
|
|
112
|
+
- User can send the message
|
|
113
|
+
- Sent message appears in the list
|
|
114
|
+
- Messages persist across page refresh
|
|
115
|
+
|
|
116
|
+
**Test:** Each truth verifiable by a human using the application.
|
|
117
|
+
|
|
118
|
+
### Step 3: Derive Required Artifacts
|
|
119
|
+
|
|
120
|
+
For each truth: "What must EXIST for this to be true?"
|
|
121
|
+
|
|
122
|
+
| Truth | Required Artifacts |
|
|
123
|
+
| ------------------------------ | --------------------------------------------------------------- |
|
|
124
|
+
| User can see existing messages | Message list component, Messages state, API route, Message type |
|
|
125
|
+
| User can send a message | Input component, Send handler, POST API |
|
|
126
|
+
|
|
127
|
+
**Test:** Each artifact = a specific file or database object.
|
|
128
|
+
|
|
129
|
+
### Step 4: Identify Key Links
|
|
130
|
+
|
|
131
|
+
"Where is this most likely to break?" Critical connections where breakage causes cascading failures.
|
|
132
|
+
|
|
133
|
+
| From | To | Via | Risk |
|
|
134
|
+
| --------- | --------- | ------------------- | ----------------------------------- |
|
|
135
|
+
| Input | API | `fetch` in onSubmit | Handler not wired |
|
|
136
|
+
| API | Database | `prisma.query` | Query returns static, not DB result |
|
|
137
|
+
| Component | Real data | `useEffect` fetch | Shows placeholder, not messages |
|
|
138
|
+
|
|
139
|
+
## Phase 5: Decompose with Context Budget
|
|
140
|
+
|
|
141
|
+
**Quality Degradation Rule:** Target ~50% context per execution. More plans, smaller scope = consistent quality.
|
|
142
|
+
|
|
143
|
+
| Task Complexity | Max Tasks | Context/Task | Total |
|
|
144
|
+
| --------------- | --------- | ------------ | ------- |
|
|
145
|
+
| Simple (CRUD) | 3 | ~10-15% | ~30-45% |
|
|
146
|
+
| Complex (auth) | 2 | ~20-30% | ~40-50% |
|
|
147
|
+
| Very complex | 1-2 | ~30-40% | ~30-50% |
|
|
148
|
+
|
|
149
|
+
**Split signals (create child plans):**
|
|
150
|
+
|
|
151
|
+
- More than 3 tasks
|
|
152
|
+
- Multiple subsystems (DB + API + UI)
|
|
153
|
+
- Any task with >5 file modifications
|
|
154
|
+
- Checkpoint + implementation in same plan
|
|
155
|
+
- Discovery + implementation in same plan
|
|
56
156
|
|
|
57
157
|
Assess size to determine plan structure:
|
|
58
158
|
|
|
59
|
-
| Size | Files
|
|
60
|
-
| ------------- |
|
|
61
|
-
| S (1-3 files) | Single plan, no phases |
|
|
62
|
-
| M (3-8 files) | 2-3 phases |
|
|
63
|
-
| L (8+ files) | Create child beads with `--create-beads` |
|
|
159
|
+
| Size | Files | Approach |
|
|
160
|
+
| ------------- | --------- | ---------------------------------------- |
|
|
161
|
+
| S (1-3 files) | 2-4 tasks | Single plan, no phases |
|
|
162
|
+
| M (3-8 files) | 5-8 tasks | 2-3 phases |
|
|
163
|
+
| L (8+ files) | 9+ tasks | Create child beads with `--create-beads` |
|
|
164
|
+
|
|
165
|
+
## Phase 6: Dependency Graph & Wave Assignment
|
|
166
|
+
|
|
167
|
+
**For each task, record:**
|
|
64
168
|
|
|
65
|
-
|
|
169
|
+
- `needs`: What must exist before this runs
|
|
170
|
+
- `creates`: What this produces
|
|
171
|
+
- `has_checkpoint`: Requires user interaction?
|
|
172
|
+
|
|
173
|
+
**Example:**
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
Task A (User model): needs nothing, creates src/models/user.ts
|
|
177
|
+
Task B (User API): needs Task A, creates src/api/users.ts
|
|
178
|
+
Task C (User UI): needs Task B, creates src/components/UserList.tsx
|
|
179
|
+
|
|
180
|
+
Wave 1: A (independent)
|
|
181
|
+
Wave 2: B (depends on A)
|
|
182
|
+
Wave 3: C (depends on B)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Wave assignment enables parallel execution in `/ship`.**
|
|
186
|
+
|
|
187
|
+
**Vertical slices preferred:** Each plan covers one feature end-to-end (model + API + UI)
|
|
188
|
+
**Avoid horizontal layers:** Don't create "all models" then "all APIs" then "all UI"
|
|
189
|
+
|
|
190
|
+
## Phase 7: Write Plan
|
|
66
191
|
|
|
67
192
|
Write `.beads/artifacts/$ARGUMENTS/plan.md` following the `writing-plans` skill format:
|
|
68
193
|
|
|
194
|
+
### Required Plan Header
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
# [Feature] Implementation Plan
|
|
198
|
+
|
|
199
|
+
> **For Claude:** REQUIRED SUB-SKILL: Use skill({ name: "executing-plans" }) to implement this plan task-by-task.
|
|
200
|
+
|
|
201
|
+
**Goal:** [Outcome-shaped goal from PRD]
|
|
202
|
+
|
|
203
|
+
**Discovery Level:** [0-3] - [Rationale]
|
|
204
|
+
|
|
205
|
+
**Context Budget:** [Estimated context usage, target ~50%]
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Must-Haves
|
|
210
|
+
|
|
211
|
+
### Observable Truths
|
|
212
|
+
|
|
213
|
+
(What must be TRUE for the goal to be achieved?)
|
|
214
|
+
|
|
215
|
+
1. [Truth 1]
|
|
216
|
+
2. [Truth 2]
|
|
217
|
+
3. [Truth 3]
|
|
218
|
+
|
|
219
|
+
### Required Artifacts
|
|
220
|
+
|
|
221
|
+
| Artifact | Provides | Path |
|
|
222
|
+
| ---------------- | -------------- | --------------------- |
|
|
223
|
+
| [File/component] | [What it does] | `src/path/to/file.ts` |
|
|
224
|
+
|
|
225
|
+
### Key Links
|
|
226
|
+
|
|
227
|
+
| From | To | Via | Risk |
|
|
228
|
+
| ----------- | ----- | ------- | -------------- |
|
|
229
|
+
| [Component] | [API] | `fetch` | [Failure mode] |
|
|
230
|
+
|
|
231
|
+
## Dependency Graph
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Task A: needs nothing, creates src/models/X.ts
|
|
235
|
+
Task B: needs Task A, creates src/api/X.ts
|
|
236
|
+
Task C: needs Task B, has_checkpoint, creates src/components/X.tsx
|
|
237
|
+
|
|
238
|
+
Wave 1: A
|
|
239
|
+
Wave 2: B
|
|
240
|
+
Wave 3: C
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Tasks
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Task Standards:
|
|
248
|
+
|
|
69
249
|
- **Exact file paths** — never "add to the relevant file"
|
|
70
250
|
- **Complete code** — never "add validation logic here"
|
|
71
251
|
- **Exact commands with expected output**
|
|
@@ -73,7 +253,7 @@ Write `.beads/artifacts/$ARGUMENTS/plan.md` following the `writing-plans` skill
|
|
|
73
253
|
- **Each step is 2-5 minutes** — one action per step
|
|
74
254
|
- **Tasks map to PRD tasks**
|
|
75
255
|
|
|
76
|
-
## Phase
|
|
256
|
+
## Phase 8: Create Child Beads (if --create-beads or L size)
|
|
77
257
|
|
|
78
258
|
For large work, create child beads for each plan phase:
|
|
79
259
|
|
|
@@ -82,18 +262,22 @@ CHILD=$(br create "[Phase title]" --type task --json | jq -r '.id')
|
|
|
82
262
|
br dep add $CHILD $ARGUMENTS
|
|
83
263
|
```
|
|
84
264
|
|
|
85
|
-
## Phase
|
|
265
|
+
## Phase 9: Report
|
|
86
266
|
|
|
87
267
|
Output:
|
|
88
268
|
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
92
|
-
4.
|
|
93
|
-
5.
|
|
269
|
+
1. **Discovery Level:** [0-3] with rationale
|
|
270
|
+
2. **Must-Haves:** [N] observable truths, [M] required artifacts, [K] key links
|
|
271
|
+
3. **Context Budget:** [Estimated usage]
|
|
272
|
+
4. **Dependency Waves:** [N] waves for parallel execution
|
|
273
|
+
5. **Task count:** [N] tasks, [M] TDD steps
|
|
274
|
+
6. **Files affected:** [List]
|
|
275
|
+
7. **Plan location:** `.beads/artifacts/$ARGUMENTS/plan.md`
|
|
276
|
+
8. **Child bead hierarchy:** (if created)
|
|
277
|
+
9. **Next step:** `/ship $ARGUMENTS`
|
|
94
278
|
|
|
95
279
|
```bash
|
|
96
|
-
br comments add $ARGUMENTS "Created plan.md
|
|
280
|
+
br comments add $ARGUMENTS "Created plan.md: Level [N] discovery, [X] waves, [Y] tasks, [Z] TDD steps"
|
|
97
281
|
```
|
|
98
282
|
|
|
99
283
|
## Related Commands
|
|
@@ -19,6 +19,40 @@ skill({ name: "beads" });
|
|
|
19
19
|
skill({ name: "verification-before-completion" });
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
## Deviation Rules (Auto-Fix Without Permission)
|
|
23
|
+
|
|
24
|
+
While executing, you WILL discover work not in the plan. Apply these rules automatically:
|
|
25
|
+
|
|
26
|
+
**RULE 1: Auto-fix bugs** (broken behavior, errors, logic issues)
|
|
27
|
+
|
|
28
|
+
- Wrong queries, type errors, null pointer exceptions
|
|
29
|
+
- Fix inline → verify → continue task
|
|
30
|
+
|
|
31
|
+
**RULE 2: Auto-add missing critical functionality** (validation, auth, error handling)
|
|
32
|
+
|
|
33
|
+
- Missing input validation, no auth on protected routes
|
|
34
|
+
- No error handling, missing null checks
|
|
35
|
+
- These are correctness requirements, not features
|
|
36
|
+
|
|
37
|
+
**RULE 3: Auto-fix blocking issues** (missing deps, wrong types, broken imports)
|
|
38
|
+
|
|
39
|
+
- Missing dependency, wrong types, broken imports
|
|
40
|
+
- Missing env var, DB connection error
|
|
41
|
+
- Fix to unblock task completion
|
|
42
|
+
|
|
43
|
+
**RULE 4: ASK about architectural changes** (new tables, library switches, major refactors)
|
|
44
|
+
|
|
45
|
+
- New DB table (not column), major schema changes
|
|
46
|
+
- Switching libraries/frameworks, changing auth approach
|
|
47
|
+
- Breaking API changes, new infrastructure
|
|
48
|
+
- STOP → report to user with: what found, proposed change, impact
|
|
49
|
+
|
|
50
|
+
**Rule Priority:**
|
|
51
|
+
|
|
52
|
+
1. Rule 4 applies → STOP (user decision required)
|
|
53
|
+
2. Rules 1-3 apply → Fix automatically, track deviation
|
|
54
|
+
3. Genuinely unsure → Treat as Rule 4 (ask)
|
|
55
|
+
|
|
22
56
|
## Phase 1: Guards
|
|
23
57
|
|
|
24
58
|
```bash
|
|
@@ -44,27 +78,164 @@ ls .beads/artifacts/$ARGUMENTS/
|
|
|
44
78
|
| `prd.json` | Proceed to PRD task loop below |
|
|
45
79
|
| Only `prd.md` | Load `prd-task` skill to create `prd.json`, then proceed |
|
|
46
80
|
|
|
47
|
-
## Phase 3:
|
|
81
|
+
## Phase 3: Wave-Based Execution
|
|
82
|
+
|
|
83
|
+
If `plan.md` exists with dependency graph:
|
|
84
|
+
|
|
85
|
+
1. **Parse waves** from plan header (Wave 1, Wave 2, etc.)
|
|
86
|
+
2. **Execute Wave 1** (independent tasks) in parallel using `task()` subagents
|
|
87
|
+
3. **Wait for Wave 1 completion** — all tasks pass or report failures
|
|
88
|
+
4. **Execute Wave 2** (depends on Wave 1) in parallel
|
|
89
|
+
5. **Continue** until all waves complete
|
|
48
90
|
|
|
49
|
-
|
|
91
|
+
**Parallel safety:** Only tasks within same wave run in parallel. Tasks in Wave N+1 wait for Wave N.
|
|
92
|
+
|
|
93
|
+
### Phase 3A: PRD Task Loop (Sequential Fallback)
|
|
94
|
+
|
|
95
|
+
For each task (wave-based or sequential fallback):
|
|
50
96
|
|
|
51
97
|
1. **Read** the task description, verification steps, and affected files
|
|
52
98
|
2. **Read** the affected files before editing
|
|
53
99
|
3. **Implement** the changes — stay within the task's `files` list
|
|
54
|
-
4. **
|
|
55
|
-
5. **
|
|
56
|
-
6. **
|
|
57
|
-
7. **
|
|
100
|
+
4. **Handle Deviations:** Apply deviation rules 1-4 as discovered
|
|
101
|
+
5. **Checkpoint Protocol:** If task has `checkpoint:*`, stop and request user input
|
|
102
|
+
6. **Verify** — run each verification step from the task
|
|
103
|
+
7. **If verification fails**, fix and retry (max 2 attempts per task)
|
|
104
|
+
8. **Commit** — per-task commit (see below)
|
|
105
|
+
9. **Mark** `passes: true` in `prd.json`
|
|
106
|
+
10. **Append** progress to `.beads/artifacts/$ARGUMENTS/progress.txt`
|
|
107
|
+
|
|
108
|
+
### Checkpoint Protocol
|
|
109
|
+
|
|
110
|
+
When task has `checkpoint:*` type:
|
|
111
|
+
|
|
112
|
+
| Type | Action |
|
|
113
|
+
| ------------------------- | ---------------------------------------------------------- |
|
|
114
|
+
| `checkpoint:human-verify` | Execute automation first, then pause for user verification |
|
|
115
|
+
| `checkpoint:decision` | Present options, wait for selection |
|
|
116
|
+
| `checkpoint:human-action` | Request specific action with verification command |
|
|
117
|
+
|
|
118
|
+
**Automation-first:** If verification CAN be automated, MUST automate it before requesting human check.
|
|
119
|
+
|
|
120
|
+
**Checkpoint return format:**
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
## CHECKPOINT REACHED
|
|
124
|
+
|
|
125
|
+
**Type:** [human-verify | decision | human-action]
|
|
126
|
+
**Progress:** X/Y tasks complete
|
|
127
|
+
|
|
128
|
+
### Completed
|
|
129
|
+
|
|
130
|
+
| Task | Commit | Status |
|
|
131
|
+
| ---- | ------ | ------ |
|
|
132
|
+
| [N] | [hash] | [✓/✗] |
|
|
133
|
+
|
|
134
|
+
### Current Task
|
|
135
|
+
|
|
136
|
+
**Task:** [name]
|
|
137
|
+
**Blocked by:** [specific blocker]
|
|
138
|
+
|
|
139
|
+
### Awaiting
|
|
140
|
+
|
|
141
|
+
[What user needs to do/provide]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### TDD Execution Flow
|
|
145
|
+
|
|
146
|
+
When task specifies TDD:
|
|
147
|
+
|
|
148
|
+
**RED Phase:**
|
|
149
|
+
|
|
150
|
+
1. Create test file with failing test
|
|
151
|
+
2. Run test → MUST fail
|
|
152
|
+
3. Commit: `test: add failing test for [feature]`
|
|
153
|
+
|
|
154
|
+
**GREEN Phase:**
|
|
155
|
+
|
|
156
|
+
1. Write minimal code to make test pass
|
|
157
|
+
2. Run test → MUST pass
|
|
158
|
+
3. Commit: `feat: implement [feature]`
|
|
159
|
+
|
|
160
|
+
**REFACTOR Phase:** (if needed)
|
|
161
|
+
|
|
162
|
+
1. Clean up code
|
|
163
|
+
2. Run tests → MUST still pass
|
|
164
|
+
3. Commit if changes: `refactor: clean up [feature]`
|
|
165
|
+
|
|
166
|
+
### Task Commit Protocol
|
|
167
|
+
|
|
168
|
+
After each task completes (verification passed):
|
|
169
|
+
|
|
170
|
+
1. **Check modified files:** `git status --short`
|
|
171
|
+
2. **Stage individually** (NEVER `git add .`):
|
|
172
|
+
```bash
|
|
173
|
+
git add src/specific/file.ts
|
|
174
|
+
git add tests/file.test.ts
|
|
175
|
+
```
|
|
176
|
+
3. **Commit with type prefix:**
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git commit -m "feat(bead-$ARGUMENTS): [task description]
|
|
180
|
+
|
|
181
|
+
- [key change 1]
|
|
182
|
+
- [key change 2]"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
4. **Record hash** in progress log
|
|
186
|
+
|
|
187
|
+
**Commit types:**
|
|
188
|
+
| Type | Use For |
|
|
189
|
+
|------|---------|
|
|
190
|
+
| `feat` | New feature, endpoint, component |
|
|
191
|
+
| `fix` | Bug fix, error correction |
|
|
192
|
+
| `test` | Test-only changes (TDD RED phase) |
|
|
193
|
+
| `refactor` | Code cleanup, no behavior change |
|
|
194
|
+
| `chore` | Config, tooling, dependencies |
|
|
58
195
|
|
|
59
196
|
### Stop Conditions
|
|
60
197
|
|
|
61
198
|
- Verification fails 2x on same task → stop, report blocker
|
|
62
199
|
- Blocked by unfinished dependency → stop, report which one
|
|
63
200
|
- Modifying files outside task scope → stop, ask user
|
|
201
|
+
- Rule 4 deviation encountered → stop, present options
|
|
202
|
+
|
|
203
|
+
## Phase 4: Choose Verification Gates
|
|
204
|
+
|
|
205
|
+
Ask user which gates to run:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
question({
|
|
209
|
+
questions: [
|
|
210
|
+
{
|
|
211
|
+
header: "Verification Gates",
|
|
212
|
+
question: "Which verification gates should run?",
|
|
213
|
+
options: [
|
|
214
|
+
{
|
|
215
|
+
label: "All (Recommended)",
|
|
216
|
+
description: "build + test + lint + typecheck — full validation",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
label: "Essential only",
|
|
220
|
+
description: "build + test — faster, basic validation",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "Test only",
|
|
224
|
+
description: "Just run tests",
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: "Skip gates",
|
|
228
|
+
description: "Trust my changes, skip verification",
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
});
|
|
234
|
+
```
|
|
64
235
|
|
|
65
|
-
## Phase
|
|
236
|
+
## Phase 5: Run Verification Gates
|
|
66
237
|
|
|
67
|
-
|
|
238
|
+
Based on selection, run appropriate gates. Detect project type:
|
|
68
239
|
|
|
69
240
|
| Project Type | Detect Via | Build | Test | Lint | Typecheck |
|
|
70
241
|
| --------------- | ----------------------------- | ---------------- | --------------- | ----------------------------- | ------------------------------------- |
|
|
@@ -73,13 +244,15 @@ After all PRD tasks pass, detect project type and run the appropriate verificati
|
|
|
73
244
|
| Python | `pyproject.toml` / `setup.py` | — | `pytest` | `ruff check .` | `mypy .` |
|
|
74
245
|
| Go | `go.mod` | `go build ./...` | `go test ./...` | `golangci-lint run` | (included in build) |
|
|
75
246
|
|
|
76
|
-
Check `package.json` scripts, `Makefile`, or `justfile` for project-specific commands first
|
|
247
|
+
Check `package.json` scripts, `Makefile`, or `justfile` for project-specific commands first.
|
|
77
248
|
|
|
78
|
-
Also
|
|
249
|
+
Also run PRD `Verify:` commands.
|
|
79
250
|
|
|
80
251
|
If any gate fails, fix before proceeding.
|
|
81
252
|
|
|
82
|
-
## Phase
|
|
253
|
+
## Phase 6: Review
|
|
254
|
+
|
|
255
|
+
### 5A: Code Review
|
|
83
256
|
|
|
84
257
|
Spawn review agent to check changes against the PRD:
|
|
85
258
|
|
|
@@ -103,7 +276,40 @@ Return: findings by severity, whether success criteria are met.`,
|
|
|
103
276
|
|
|
104
277
|
If review finds critical issues → fix → re-run Phase 4 → re-review.
|
|
105
278
|
|
|
106
|
-
|
|
279
|
+
### 5B: Goal-Backward Verification (if plan.md exists)
|
|
280
|
+
|
|
281
|
+
Verify that tasks completed ≠ goals achieved:
|
|
282
|
+
|
|
283
|
+
**Three-Level Verification:**
|
|
284
|
+
|
|
285
|
+
| Level | Check | Command/Action |
|
|
286
|
+
| ------------------ | ---------------------- | ----------------------------------------------------------------- |
|
|
287
|
+
| **1: Exists** | File is present | `ls path/to/file.ts` |
|
|
288
|
+
| **2: Substantive** | Not a stub/placeholder | `grep -v "TODO\|FIXME\|return null\|placeholder" path/to/file.ts` |
|
|
289
|
+
| **3: Wired** | Connected and used | `grep -r "import.*ComponentName" src/` |
|
|
290
|
+
|
|
291
|
+
**Key Link Verification:**
|
|
292
|
+
|
|
293
|
+
- Component → API: `grep -E "fetch.*api/|axios" Component.tsx`
|
|
294
|
+
- API → Database: `grep -E "prisma\.|db\." route.ts`
|
|
295
|
+
- Form → Handler: `grep "onSubmit" Component.tsx`
|
|
296
|
+
- State → Render: `grep "{stateVar}" Component.tsx`
|
|
297
|
+
|
|
298
|
+
**Stub Detection:**
|
|
299
|
+
Red flags indicating incomplete implementation:
|
|
300
|
+
|
|
301
|
+
```javascript
|
|
302
|
+
return <div>Component</div> // Placeholder
|
|
303
|
+
return <div>{/* TODO */}</div> // Empty
|
|
304
|
+
return null // Empty
|
|
305
|
+
onClick={() => {}} // No-op handler
|
|
306
|
+
fetch('/api/...') // No await, ignored
|
|
307
|
+
return Response.json({ok: true}) // Static, not query result
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
If any artifact fails Level 2 or 3 → fix → re-verify.
|
|
311
|
+
|
|
312
|
+
## Phase 7: Close
|
|
107
313
|
|
|
108
314
|
Ask user before closing:
|
|
109
315
|
|
|
@@ -135,11 +341,39 @@ Record significant learnings with `observation()`.
|
|
|
135
341
|
|
|
136
342
|
Report:
|
|
137
343
|
|
|
138
|
-
1.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
344
|
+
1. **Execution Summary:**
|
|
345
|
+
- Tasks completed/total
|
|
346
|
+
- Waves executed (if plan.md with waves)
|
|
347
|
+
- Deviations applied (Rules 1-3)
|
|
348
|
+
- Checkpoints encountered (human-verify/decision/human-action)
|
|
349
|
+
- Commits made
|
|
350
|
+
|
|
351
|
+
2. **PRD Task Results:**
|
|
352
|
+
- Each task status (✓ pass, ✗ fail, ⏸ checkpoint)
|
|
353
|
+
- Files modified per task
|
|
354
|
+
- Commit hashes
|
|
355
|
+
|
|
356
|
+
3. **Verification Gate Results:**
|
|
357
|
+
- Build: [pass/fail]
|
|
358
|
+
- Test: [pass/fail]
|
|
359
|
+
- Lint: [pass/fail]
|
|
360
|
+
- Typecheck: [pass/fail]
|
|
361
|
+
|
|
362
|
+
4. **Goal-Backward Verification:**
|
|
363
|
+
- Artifacts verified: [N] exists, [M] substantive, [K] wired
|
|
364
|
+
- Key links checked: [pass/fail per link]
|
|
365
|
+
- Stubs detected: [N] (if any)
|
|
366
|
+
|
|
367
|
+
5. **Review Summary:**
|
|
368
|
+
- Critical issues: [N]
|
|
369
|
+
- Important issues: [N]
|
|
370
|
+
- Minor issues: [N]
|
|
371
|
+
- Overall assessment: [pass/needs work]
|
|
372
|
+
|
|
373
|
+
6. **Next Steps:**
|
|
374
|
+
- `/pr` to create pull request
|
|
375
|
+
- Manual commits if not already done
|
|
376
|
+
- Create follow-up beads for deferred work
|
|
143
377
|
|
|
144
378
|
## Related Commands
|
|
145
379
|
|
|
@@ -46,24 +46,55 @@ ls .beads/artifacts/$ARGUMENTS/
|
|
|
46
46
|
|
|
47
47
|
Verify `prd.md` exists and has real content (not just placeholders). If missing or incomplete, tell user to run `/create` first.
|
|
48
48
|
|
|
49
|
-
## Phase 3: Claim
|
|
49
|
+
## Phase 3: Claim
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
br update $ARGUMENTS --status in_progress
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
## Phase 4: Prepare Workspace
|
|
56
|
+
|
|
57
|
+
Ask user how to handle workspace:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
question({
|
|
61
|
+
questions: [
|
|
62
|
+
{
|
|
63
|
+
header: "Workspace",
|
|
64
|
+
question: "How do you want to set up the workspace?",
|
|
65
|
+
options: [
|
|
66
|
+
{
|
|
67
|
+
label: "Create feature branch (Recommended)",
|
|
68
|
+
description: "git checkout -b feat/<bead-id>-<title>",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "Use current branch",
|
|
72
|
+
description: "Work on current branch",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "Create worktree",
|
|
76
|
+
description: "Isolated git worktree for this bead",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**If feature branch selected:**
|
|
56
85
|
|
|
57
86
|
```bash
|
|
58
|
-
git checkout -b feat/$ARGUMENTS
|
|
87
|
+
git checkout -b feat/$ARGUMENTS-$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
|
59
88
|
```
|
|
60
89
|
|
|
61
|
-
If
|
|
90
|
+
**If worktree selected:**
|
|
62
91
|
|
|
63
92
|
```typescript
|
|
64
93
|
skill({ name: "using-git-worktrees" });
|
|
65
94
|
```
|
|
66
95
|
|
|
96
|
+
**If current branch:** Continue without branch creation.
|
|
97
|
+
|
|
67
98
|
## Phase 4: Convert PRD to Tasks
|
|
68
99
|
|
|
69
100
|
If `prd.json` doesn't exist yet, use `prd-task` skill to convert PRD markdown → executable JSON.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
purpose: Project vision, goals, and success criteria (loaded into all AI contexts)
|
|
3
|
+
updated: 2024-12-21
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Vision
|
|
7
|
+
|
|
8
|
+
## The Goal
|
|
9
|
+
|
|
10
|
+
<!-- One sentence: What does this project achieve? Outcome-shaped, not task-shaped. -->
|
|
11
|
+
<!-- Good: "A real-time chat application with persistent message history" -->
|
|
12
|
+
<!-- Bad: "Build chat components and API endpoints" -->
|
|
13
|
+
|
|
14
|
+
## Success Criteria
|
|
15
|
+
|
|
16
|
+
<!-- How do we know the project is successful? List 3-7 observable outcomes. -->
|
|
17
|
+
<!-- Each should be verifiable by using the application, not by checking code. -->
|
|
18
|
+
|
|
19
|
+
1. **[Criterion 1]** - [Specific, measurable outcome]
|
|
20
|
+
2. **[Criterion 2]** - [Specific, measurable outcome]
|
|
21
|
+
3. **[Criterion 3]** - [Specific, measurable outcome]
|
|
22
|
+
|
|
23
|
+
## Target Users
|
|
24
|
+
|
|
25
|
+
<!-- Who will use this? What do they need? -->
|
|
26
|
+
|
|
27
|
+
- **Primary:** [User type and their core need]
|
|
28
|
+
- **Secondary:** [User type and their core need]
|
|
29
|
+
|
|
30
|
+
## Core Principles
|
|
31
|
+
|
|
32
|
+
<!-- Non-negotiable principles that guide all decisions -->
|
|
33
|
+
|
|
34
|
+
1. **[Principle 1]** - [Explanation]
|
|
35
|
+
2. **[Principle 2]** - [Explanation]
|
|
36
|
+
3. **[Principle 3]** - [Explanation]
|
|
37
|
+
|
|
38
|
+
## Current Phase
|
|
39
|
+
|
|
40
|
+
<!-- Where are we in the project lifecycle? -->
|
|
41
|
+
|
|
42
|
+
- **Status:** [Discovery / Planning / Implementation / Polish / Maintenance]
|
|
43
|
+
- **Milestone:** [Current milestone name]
|
|
44
|
+
- **Next Milestone:** [Next milestone name]
|
|
45
|
+
|
|
46
|
+
## Key Links
|
|
47
|
+
|
|
48
|
+
<!-- Important references -->
|
|
49
|
+
|
|
50
|
+
- **Repository:** [URL]
|
|
51
|
+
- **Documentation:** [URL]
|
|
52
|
+
- **Staging:** [URL]
|
|
53
|
+
- **Production:** [URL]
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
_Update this file when project direction or phase changes._
|
|
58
|
+
_AI uses this to maintain context across sessions and make decisions aligned with project goals._
|