specdacular 0.2.3 → 0.2.5

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/README.md CHANGED
@@ -28,7 +28,8 @@ Spawns 4 parallel agents to analyze your codebase and generate AI-optimized docu
28
28
  A structured flow for planning features with enough detail for agent implementation:
29
29
 
30
30
  ```
31
- new-feature → (discuss ↔ research)* → plan-feature
31
+ new-feature → discuss-feature → plan-feature
32
+ (discuss-phase? → research-phase? → execute-plan)* per phase
32
33
  ```
33
34
 
34
35
  **You control the rhythm:**
@@ -36,6 +37,9 @@ new-feature → (discuss ↔ research)* → plan-feature
36
37
  - `discuss-feature` — Refine understanding (call many times)
37
38
  - `research-feature` — Investigate implementation approaches
38
39
  - `plan-feature` — Create executable task plans
40
+ - `discuss-phase` — Optional: dive into phase specifics before execution
41
+ - `research-phase` — Optional: research patterns for a specific phase
42
+ - `execute-plan` — Execute plans with progress tracking
39
43
 
40
44
  ---
41
45
 
@@ -74,6 +78,9 @@ In Claude Code:
74
78
  | `/specd:discuss-feature [name]` | Continue/deepen discussion (iterative) |
75
79
  | `/specd:research-feature [name]` | Research implementation with parallel agents |
76
80
  | `/specd:plan-feature [name]` | Create executable task plans |
81
+ | `/specd:discuss-phase [feature] [phase]` | Discuss a phase before execution |
82
+ | `/specd:research-phase [feature] [phase]` | Research patterns for a phase |
83
+ | `/specd:execute-plan [feature]` | Execute plans with progress tracking |
77
84
 
78
85
  ### Utilities
79
86
 
@@ -113,6 +120,13 @@ Then refine and plan:
113
120
  /specd:plan-feature user-dashboard # Create executable plans
114
121
  ```
115
122
 
123
+ Optionally, before executing each phase:
124
+ ```
125
+ /specd:discuss-phase user-dashboard 1 # Discuss phase 1 specifics
126
+ /specd:research-phase user-dashboard 1 # Research phase 1 patterns
127
+ /specd:execute-plan user-dashboard # Execute with phase context
128
+ ```
129
+
116
130
  ---
117
131
 
118
132
  ## How It Works
@@ -155,18 +169,32 @@ The feature planning flow accumulates context over multiple sessions:
155
169
 
156
170
  ┌──────────────┐
157
171
  │ plan-feature │
158
- │ │
159
172
  └──────────────┘
160
173
 
161
174
 
162
- Executable PLAN.md
163
- files for agents
175
+ ┌─────────────────────────────┐
176
+ │ For each phase: │
177
+ │ ┌─────────┐ ┌─────────┐ │
178
+ │ │ discuss │ → │research │ │
179
+ │ │ phase │ │ phase │ │
180
+ │ └─────────┘ └─────────┘ │
181
+ │ │ │ │
182
+ │ └─────┬─────┘ │
183
+ │ ▼ │
184
+ │ ┌────────────┐ │
185
+ │ │execute-plan│ │
186
+ │ └────────────┘ │
187
+ └─────────────────────────────┘
164
188
  ```
165
189
 
166
190
  Each session updates:
167
191
  - `CONTEXT.md` — Resolved questions accumulate
168
192
  - `DECISIONS.md` — Decisions with rationale accumulate
169
193
 
194
+ **Phase-level commands** (optional but powerful):
195
+ - `discuss-phase` — Just-in-time clarification for a specific phase
196
+ - `research-phase` — Focused research for phase-specific patterns
197
+
170
198
  Plans are prompts for implementing agents with:
171
199
  - Specific file paths
172
200
  - Code patterns to follow
@@ -191,16 +219,20 @@ your-project/
191
219
  │ └── features/ # From feature commands
192
220
  │ └── user-dashboard/
193
221
  │ ├── FEATURE.md # Technical requirements
194
- │ ├── CONTEXT.md # Discussion context
195
- │ ├── DECISIONS.md # Decision log
222
+ │ ├── CONTEXT.md # Feature-level discussion
223
+ │ ├── DECISIONS.md # Decision log (feature + phase)
196
224
  │ ├── STATE.md # Progress tracking
197
- │ ├── RESEARCH.md # Research findings
225
+ │ ├── RESEARCH.md # Feature-level research
198
226
  │ ├── ROADMAP.md # Phase overview
199
227
  │ └── plans/ # Executable plans
200
228
  │ ├── phase-01/
229
+ │ │ ├── CONTEXT.md # Phase discussion (optional)
230
+ │ │ ├── RESEARCH.md # Phase research (optional)
201
231
  │ │ ├── 01-PLAN.md
202
232
  │ │ └── 02-PLAN.md
203
233
  │ └── phase-02/
234
+ │ ├── CONTEXT.md
235
+ │ ├── RESEARCH.md
204
236
  │ └── 01-PLAN.md
205
237
  └── ...
206
238
  ```
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: specd:discuss-phase
3
+ description: Discuss a specific phase before execution
4
+ argument-hint: "[feature-name] [phase-number]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ <objective>
15
+ Discuss a specific phase before executing it. Enables just-in-time clarification focused on the phase's scope rather than the entire feature.
16
+
17
+ **Updates:**
18
+ - `.specd/features/{name}/plans/phase-{NN}/CONTEXT.md` — Phase-specific discussion resolutions
19
+ - `.specd/features/{name}/DECISIONS.md` — Accumulates decisions with dates/rationale
20
+
21
+ **Why phase-level discussion?** Instead of researching/discussing the entire feature upfront, dive deeper into each phase's specifics right before executing it. Smaller context, more focused.
22
+ </objective>
23
+
24
+ <execution_context>
25
+ @~/.claude/specdacular/workflows/discuss-phase.md
26
+ </execution_context>
27
+
28
+ <context>
29
+ Arguments: $ARGUMENTS (expects: feature-name phase-number)
30
+
31
+ **Load feature context:**
32
+ @.specd/features/{name}/FEATURE.md
33
+ @.specd/features/{name}/CONTEXT.md
34
+ @.specd/features/{name}/DECISIONS.md
35
+ @.specd/features/{name}/ROADMAP.md
36
+
37
+ **Load phase context:**
38
+ @.specd/features/{name}/plans/phase-{NN}/*.md (plan files)
39
+
40
+ **Load codebase context (if available):**
41
+ @.specd/codebase/PATTERNS.md
42
+ @.specd/codebase/STRUCTURE.md
43
+ @.specd/codebase/MAP.md
44
+ </context>
45
+
46
+ <process>
47
+ 1. **Validate** — Feature exists, phase exists in ROADMAP.md
48
+ 2. **Load Context** — Phase details from ROADMAP.md, plans in phase, feature DECISIONS.md
49
+ 3. **Identify Gray Areas** — Phase-type-specific concerns
50
+ 4. **Probe Gray Areas** — 4 questions per area, then move on
51
+ 5. **Record** — Save to `plans/phase-{NN}/CONTEXT.md`, update DECISIONS.md
52
+ 6. **Commit**
53
+ </process>
54
+
55
+ <success_criteria>
56
+ - [ ] Feature and phase validated
57
+ - [ ] Phase context loaded (plans, goals, files to create/modify)
58
+ - [ ] Phase-type-specific gray areas identified
59
+ - [ ] User-selected areas discussed
60
+ - [ ] Decisions recorded with date, context, rationale
61
+ - [ ] Phase CONTEXT.md created/updated with resolved questions
62
+ - [ ] Committed to git
63
+ </success_criteria>
@@ -30,6 +30,8 @@ Display available specdacular commands and usage guidance.
30
30
  | `/specd:discuss-feature [name]` | Continue/deepen feature discussion (can call many times) |
31
31
  | `/specd:research-feature [name]` | Research implementation with parallel agents |
32
32
  | `/specd:plan-feature [name]` | Create executable task plans for agents |
33
+ | `/specd:discuss-phase [feature] [phase]` | Discuss a phase before execution |
34
+ | `/specd:research-phase [feature] [phase]` | Research patterns for a phase |
33
35
  | `/specd:execute-plan [feature] [plan]` | Execute a plan with progress tracking |
34
36
 
35
37
  ### Utilities
@@ -46,7 +48,8 @@ Display available specdacular commands and usage guidance.
46
48
  The feature flow helps you plan features specific enough that an agent can implement without asking questions.
47
49
 
48
50
  ```
49
- new-feature → (discuss ↔ research)* → plan-feature → execute-plan*
51
+ new-feature → discuss-feature → plan-feature →
52
+ (discuss-phase? → research-phase? → execute-plan)* per phase
50
53
  ```
51
54
 
52
55
  **You control the rhythm:**
@@ -54,6 +57,8 @@ new-feature → (discuss ↔ research)* → plan-feature → execute-plan*
54
57
  - `discuss-feature` — Can be called **many times** to refine understanding
55
58
  - `research-feature` — Can be called **many times** to investigate
56
59
  - `plan-feature` — When satisfied, creates executable plans for an agent
60
+ - `discuss-phase` — Optional: dive deeper into phase specifics before execution
61
+ - `research-phase` — Optional: research patterns for a specific phase
57
62
  - `execute-plan` — Execute plans with progress tracking and deviation logging
58
63
 
59
64
  ### Quick Start
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: specd:research-phase
3
+ description: Research implementation patterns for a phase
4
+ argument-hint: "[feature-name] [phase-number]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Task
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ <objective>
17
+ Research implementation patterns for a specific phase before executing it. Spawns parallel research agents focused on the phase's scope.
18
+
19
+ **Output:** `.specd/features/{name}/plans/phase-{NN}/RESEARCH.md` with phase-specific guidance.
20
+
21
+ **Why phase-level research?** Instead of researching the entire feature upfront, investigate each phase's specifics right before executing it. Smaller scope, more focused, fresher context.
22
+ </objective>
23
+
24
+ <execution_context>
25
+ @~/.claude/specdacular/workflows/research-phase.md
26
+ </execution_context>
27
+
28
+ <context>
29
+ Arguments: $ARGUMENTS (expects: feature-name phase-number)
30
+
31
+ **Load feature context:**
32
+ @.specd/features/{name}/FEATURE.md
33
+ @.specd/features/{name}/DECISIONS.md
34
+ @.specd/features/{name}/ROADMAP.md
35
+ @.specd/features/{name}/RESEARCH.md (if exists, feature-level research)
36
+
37
+ **Load phase context:**
38
+ @.specd/features/{name}/plans/phase-{NN}/CONTEXT.md (if exists)
39
+ @.specd/features/{name}/plans/phase-{NN}/*.md (plan files)
40
+
41
+ **Load codebase context:**
42
+ @.specd/codebase/PATTERNS.md
43
+ @.specd/codebase/STRUCTURE.md
44
+ @.specd/codebase/MAP.md
45
+ </context>
46
+
47
+ <process>
48
+ 1. **Validate** — Feature and phase exist
49
+ 2. **Load Context** — Phase goals, files to create/modify, previous phase research
50
+ 3. **Spawn Research Agents** — 3 parallel agents for phase-specific research
51
+ 4. **Synthesize** — Combine into `plans/phase-{NN}/RESEARCH.md`
52
+ 5. **Record Decisions** — Technology choices to DECISIONS.md
53
+ 6. **Commit**
54
+ </process>
55
+
56
+ <success_criteria>
57
+ - [ ] Feature and phase validated
58
+ - [ ] Phase context loaded (goals, files, type)
59
+ - [ ] Research agents spawned (codebase, patterns, pitfalls)
60
+ - [ ] Results synthesized into phase RESEARCH.md
61
+ - [ ] Decisions recorded in DECISIONS.md
62
+ - [ ] Committed to git
63
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdacular",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Feature planning system for existing codebases. Map, understand, and plan features in large projects.",
5
5
  "bin": {
6
6
  "specdacular": "bin/install.js"
@@ -13,5 +13,8 @@
13
13
  "v1_count": 0,
14
14
  "v2_count": 0,
15
15
  "completed": 0
16
+ },
17
+ "execution": {
18
+ "auto_commit": false
16
19
  }
17
20
  }
@@ -0,0 +1,389 @@
1
+ <purpose>
2
+ Discuss a specific phase before executing it. Enables just-in-time clarification focused on the phase's scope.
3
+
4
+ **Key behaviors:**
5
+ - Phase-specific gray areas based on phase type (Types, API, UI, Integration, etc.)
6
+ - Builds on feature-level context but focuses narrowly
7
+ - Output lives alongside phase plans for easy reference during execution
8
+
9
+ **Output:** `plans/phase-{NN}/CONTEXT.md` with resolved questions, updated DECISIONS.md
10
+ </purpose>
11
+
12
+ <philosophy>
13
+
14
+ ## Just-in-Time Clarification
15
+
16
+ Don't try to clarify everything upfront. Discuss each phase right before executing it, when the context is freshest and questions are most concrete.
17
+
18
+ ## Phase-Type Specific
19
+
20
+ Different phase types have different gray areas. A Types phase has different concerns than a UI phase. Tailor questions to what's actually being built.
21
+
22
+ ## Focused Context
23
+
24
+ Unlike feature-level discussion which covers everything, phase discussion is narrow. Only discuss what's relevant to THIS phase's deliverables.
25
+
26
+ </philosophy>
27
+
28
+ <phase_type_gray_areas>
29
+
30
+ ## Types/Schema Phase
31
+ - Data model completeness — Are all fields defined?
32
+ - Naming conventions — Consistent with codebase?
33
+ - Relationships — How do types relate to each other?
34
+ - Validation rules — What constraints apply?
35
+ - Nullable fields — What can be undefined/null?
36
+
37
+ ## API/Data Phase
38
+ - Endpoint design — REST conventions, URL structure
39
+ - Error responses — Format, status codes, messages
40
+ - Pagination approach — Cursor vs offset, page size
41
+ - Auth requirements — What auth is needed?
42
+ - Rate limiting — Any throttling needed?
43
+
44
+ ## Business Logic Phase
45
+ - Edge cases — What unusual inputs can occur?
46
+ - Validation rules — What makes data valid/invalid?
47
+ - Error handling — How to handle failures?
48
+ - Transaction boundaries — What operations are atomic?
49
+
50
+ ## UI/Components Phase
51
+ - Component hierarchy — How do components nest?
52
+ - State management — Local vs global state
53
+ - Loading states — What to show while loading?
54
+ - Error states — How to display errors?
55
+ - Accessibility — ARIA, keyboard navigation
56
+
57
+ ## Integration Phase
58
+ - Wiring points — Where does this connect?
59
+ - Initialization order — What depends on what?
60
+ - Dependency injection — How are deps provided?
61
+ - Entry points — Where is this invoked from?
62
+
63
+ </phase_type_gray_areas>
64
+
65
+ <process>
66
+
67
+ <step name="validate">
68
+ Validate feature exists and phase exists.
69
+
70
+ **Parse arguments:**
71
+ Split $ARGUMENTS into feature-name and phase-number.
72
+ - First word: feature-name
73
+ - Second word: phase-number (numeric, e.g., "1", "2")
74
+
75
+ ```bash
76
+ # Check feature exists
77
+ [ -d ".specd/features/$FEATURE_NAME" ] || { echo "Feature not found"; exit 1; }
78
+
79
+ # Check ROADMAP.md exists
80
+ [ -f ".specd/features/$FEATURE_NAME/ROADMAP.md" ] || { echo "No roadmap"; exit 1; }
81
+
82
+ # Check phase directory exists
83
+ PHASE_DIR=".specd/features/$FEATURE_NAME/plans/phase-$(printf '%02d' $PHASE_NUMBER)"
84
+ [ -d "$PHASE_DIR" ] || { echo "Phase not found"; exit 1; }
85
+ ```
86
+
87
+ **If feature not found:**
88
+ ```
89
+ Feature '{name}' not found.
90
+
91
+ Run /specd:new-feature {name} to create it.
92
+ ```
93
+
94
+ **If phase not found:**
95
+ ```
96
+ Phase {N} not found for feature '{name}'.
97
+
98
+ Available phases in ROADMAP.md:
99
+ {list phases from ROADMAP.md}
100
+ ```
101
+
102
+ Continue to load_context.
103
+ </step>
104
+
105
+ <step name="load_context">
106
+ Load all context needed for phase discussion.
107
+
108
+ **Read feature context:**
109
+ - `FEATURE.md` — Overall feature requirements
110
+ - `CONTEXT.md` — Feature-level resolutions (already discussed)
111
+ - `DECISIONS.md` — All decisions so far
112
+ - `ROADMAP.md` — Phase overview, understand this phase's role
113
+
114
+ **Read phase context:**
115
+ - All plan files in `plans/phase-{NN}/`
116
+ - Existing `plans/phase-{NN}/CONTEXT.md` if it exists (prior phase discussion)
117
+ - Existing `plans/phase-{NN}/RESEARCH.md` if it exists
118
+
119
+ **Extract from ROADMAP.md:**
120
+ - Phase title and goal
121
+ - Phase type (Types, API, UI, Integration, Business Logic, etc.)
122
+ - Files to be created/modified
123
+ - Dependencies on other phases
124
+
125
+ **Extract from plan files:**
126
+ - Specific tasks
127
+ - Files and changes
128
+ - Verification criteria
129
+
130
+ Continue to show_phase_state.
131
+ </step>
132
+
133
+ <step name="show_phase_state">
134
+ Present phase context to user.
135
+
136
+ ```
137
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
138
+ DISCUSS PHASE {N}
139
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
140
+
141
+ **Feature:** {feature-name}
142
+ **Phase:** {N} — {Phase Title}
143
+ **Type:** {Phase Type}
144
+
145
+ ## Phase Goal
146
+
147
+ {Goal from ROADMAP.md}
148
+
149
+ ## Deliverables
150
+
151
+ Files to create:
152
+ - {file 1}
153
+ - {file 2}
154
+
155
+ Files to modify:
156
+ - {file 3}
157
+
158
+ ## Plans in This Phase
159
+
160
+ - {plan 1 title}
161
+ - {plan 2 title}
162
+
163
+ {If phase CONTEXT.md exists:}
164
+ ## Previously Discussed
165
+
166
+ {Summary from existing phase CONTEXT.md}
167
+
168
+ {If feature CONTEXT.md has relevant resolutions:}
169
+ ## Relevant Feature Decisions
170
+
171
+ {Decisions from feature-level that affect this phase}
172
+ ```
173
+
174
+ Continue to identify_gray_areas.
175
+ </step>
176
+
177
+ <step name="identify_gray_areas">
178
+ Identify gray areas based on phase type.
179
+
180
+ **Determine phase type** from ROADMAP.md or infer from:
181
+ - "types", "schema", "models" → Types/Schema
182
+ - "api", "endpoint", "route" → API/Data
183
+ - "component", "ui", "page" → UI/Components
184
+ - "logic", "service", "util" → Business Logic
185
+ - "integration", "wiring", "setup" → Integration
186
+
187
+ **Select gray areas** from phase_type_gray_areas section based on type.
188
+
189
+ **Filter out already-resolved:**
190
+ - Check feature CONTEXT.md for resolutions that apply
191
+ - Check phase CONTEXT.md if it exists
192
+ - Remove any gray areas that are already clear
193
+
194
+ **Present:**
195
+ ```
196
+ ## Areas to Discuss
197
+
198
+ Based on this {Phase Type} phase, these areas could use clarity:
199
+
200
+ 1. **{Gray area}** — {Why it matters for this phase}
201
+ 2. **{Gray area}** — {Why it matters for this phase}
202
+ 3. **{Gray area}** — {Why it matters for this phase}
203
+ 4. **{Gray area}** — {Why it matters for this phase}
204
+
205
+ Which would you like to discuss? (Or describe something else)
206
+ ```
207
+
208
+ Use AskUserQuestion:
209
+ - header: "Phase Discussion"
210
+ - question: "Which area would you like to discuss for this phase?"
211
+ - options: List identified gray areas (up to 4)
212
+ - Add "Something else" as final option
213
+
214
+ Continue to probe_area.
215
+ </step>
216
+
217
+ <step name="probe_area">
218
+ Probe selected gray area until clear.
219
+
220
+ **For each selected area, ask up to 4 questions:**
221
+
222
+ **Question 1:** Open-ended
223
+ "For this phase's {area}, how do you see this working?"
224
+
225
+ **Question 2:** Clarify specifics
226
+ "When you say X, do you mean Y or Z?"
227
+
228
+ **Question 3:** Edge cases
229
+ "What should happen when {edge case specific to this phase}?"
230
+
231
+ **Question 4:** Confirm
232
+ "So for phase {N}, the approach would be {summary}. Correct?"
233
+
234
+ **After 4 questions (or earlier if clear):**
235
+ ```
236
+ Let me capture what we've resolved for phase {N}:
237
+
238
+ **{Area}:**
239
+ - {Key point 1}
240
+ - {Key point 2}
241
+ - {Any code pattern implied}
242
+
243
+ Does that capture it?
244
+ ```
245
+
246
+ **If user confirms:** Continue to record
247
+ **If user corrects:** Adjust and confirm again
248
+ **If user wants another area:** Return to identify_gray_areas
249
+
250
+ Continue to record.
251
+ </step>
252
+
253
+ <step name="record">
254
+ Record phase discussion to CONTEXT.md and DECISIONS.md.
255
+
256
+ **Create/Update plans/phase-{NN}/CONTEXT.md:**
257
+
258
+ ```markdown
259
+ # Phase {N} Context: {Phase Title}
260
+
261
+ **Feature:** {feature-name}
262
+ **Phase Type:** {type}
263
+ **Discussed:** {today}
264
+
265
+ ## Phase Overview
266
+
267
+ {Brief description of what this phase accomplishes}
268
+
269
+ ## Resolved Questions
270
+
271
+ ### {Question title}
272
+
273
+ **Question:** {What was unclear}
274
+ **Resolution:** {The answer/decision}
275
+ **Details:**
276
+ - {Detail 1}
277
+ - {Detail 2}
278
+
279
+ {If code pattern implied:}
280
+ **Code Pattern:**
281
+ ```{language}
282
+ {code example}
283
+ ```
284
+
285
+ **Related Decisions:** DEC-XXX
286
+
287
+ ---
288
+
289
+ {Repeat for each resolved question}
290
+
291
+ ## Gray Areas Remaining
292
+
293
+ {Any areas still unclear, or "None" if all resolved}
294
+
295
+ ## Implications for Plans
296
+
297
+ {How these resolutions affect the plan execution}
298
+ ```
299
+
300
+ **Update DECISIONS.md:**
301
+
302
+ For any new decisions made during phase discussion:
303
+
304
+ ```markdown
305
+ ### DEC-{NNN}: {Title}
306
+
307
+ **Date:** {today}
308
+ **Status:** Active
309
+ **Phase:** {N} — {Phase Title}
310
+ **Context:** {What situation required this decision — from phase discussion}
311
+ **Decision:** {What was decided}
312
+ **Rationale:**
313
+ - {Why this choice}
314
+ **Implications:**
315
+ - {What this means for phase implementation}
316
+ ```
317
+
318
+ Continue to commit.
319
+ </step>
320
+
321
+ <step name="commit">
322
+ Commit the phase discussion.
323
+
324
+ ```bash
325
+ # Add phase CONTEXT.md
326
+ git add ".specd/features/{feature}/plans/phase-{NN}/CONTEXT.md"
327
+
328
+ # Add updated DECISIONS.md if modified
329
+ git add ".specd/features/{feature}/DECISIONS.md"
330
+
331
+ git commit -m "docs({feature}): discuss phase {N} - {phase title}
332
+
333
+ Resolved:
334
+ - {Area 1}
335
+ - {Area 2}
336
+
337
+ New decisions: {count}"
338
+ ```
339
+
340
+ Continue to completion.
341
+ </step>
342
+
343
+ <step name="completion">
344
+ Present summary and next options.
345
+
346
+ ```
347
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
+ PHASE DISCUSSION COMPLETE
349
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
350
+
351
+ **Feature:** {feature-name}
352
+ **Phase:** {N} — {Phase Title}
353
+
354
+ ## Resolved
355
+
356
+ - **{Area 1}:** {Brief resolution}
357
+ - **{Area 2}:** {Brief resolution}
358
+
359
+ ## Files Created/Updated
360
+
361
+ - `plans/phase-{NN}/CONTEXT.md`
362
+ - `DECISIONS.md` ({count} new decisions)
363
+
364
+ ───────────────────────────────────────────────────────
365
+
366
+ ## What's Next
367
+
368
+ **/specd:research-phase {feature} {N}** — Research implementation patterns for this phase
369
+
370
+ **/specd:execute-plan {feature}** — Execute this phase (will load phase context)
371
+
372
+ **/specd:discuss-phase {feature} {N}** — Continue discussing this phase
373
+ ```
374
+
375
+ End workflow.
376
+ </step>
377
+
378
+ </process>
379
+
380
+ <success_criteria>
381
+ - Feature and phase validated
382
+ - Phase context loaded (plans, goals, type)
383
+ - Phase-type-specific gray areas identified
384
+ - User-selected areas probed (4 questions max)
385
+ - Phase CONTEXT.md created/updated
386
+ - DECISIONS.md updated with phase-specific decisions
387
+ - Committed to git
388
+ - User knows next steps (research-phase or execute-plan)
389
+ </success_criteria>
@@ -81,11 +81,16 @@ Continue to load_context.
81
81
  Load ALL context needed for execution.
82
82
 
83
83
  **Read feature context:**
84
+ - `config.json` — Feature settings (check `execution.auto_commit`)
84
85
  - `STATE.md` — Current progress, completed plans
85
86
  - `DECISIONS.md` — Constraints to follow during implementation
86
87
  - `RESEARCH.md` — Implementation notes, pitfalls (if exists)
87
88
  - `ROADMAP.md` — Phase overview, plan order
88
89
 
90
+ **Read phase context (if available):**
91
+ - `plans/phase-{NN}/CONTEXT.md` — Phase-specific discussion resolutions
92
+ - `plans/phase-{NN}/RESEARCH.md` — Phase-specific research findings
93
+
89
94
  **Read codebase context (if available):**
90
95
  - `PATTERNS.md` — Code patterns to follow
91
96
  - `STRUCTURE.md` — Where files go
@@ -96,6 +101,7 @@ Load ALL context needed for execution.
96
101
  - Which phase we're in
97
102
  - Key decisions affecting implementation
98
103
  - Patterns to follow
104
+ - Phase-specific context and research (if discuss-phase/research-phase were run)
99
105
 
100
106
  Continue to find_plan.
101
107
  </step>
@@ -134,6 +140,13 @@ Feature execution finished. Review:
134
140
  - STATE.md: {phase X, N plans executed}
135
141
  - DECISIONS.md: {N} decisions
136
142
  - ROADMAP.md: {N} phases, {M} plans total
143
+ {If phase CONTEXT.md exists:}
144
+ - Phase CONTEXT.md: {N} gray areas resolved
145
+ {If phase RESEARCH.md exists:}
146
+ - Phase RESEARCH.md: patterns identified
147
+
148
+ **Settings:**
149
+ - Auto-commit: {yes | no} (from config.json)
137
150
 
138
151
  **Next plan:** {plans/phase-XX/YY-PLAN.md}
139
152
  **Objective:** {one-line from plan}
@@ -279,12 +292,27 @@ Use AskUserQuestion:
279
292
  - **Files:** `{affected files}`
280
293
  ```
281
294
 
282
- ### 5. Commit task
295
+ ### 5. Commit task (if auto_commit enabled)
296
+
297
+ **Check config.json `execution.auto_commit`:**
298
+
299
+ **If auto_commit is true:**
283
300
  ```bash
284
301
  git add {files from task}
285
302
  git commit -m "feat({feature}): {task description}"
286
303
  ```
287
304
 
305
+ **If auto_commit is false:**
306
+ - Do NOT commit
307
+ - Show message:
308
+ ```
309
+ Task {N} complete. Changes ready for review.
310
+ Files modified: {file list}
311
+
312
+ Commit when ready:
313
+ git add {files} && git commit -m "feat({feature}): {task description}"
314
+ ```
315
+
288
316
  ### 6. Update STATE.md
289
317
  Update current task number:
290
318
  ```markdown
@@ -319,12 +347,18 @@ Mark plan complete and suggest next.
319
347
 
320
348
  3. Update stage progress checkboxes
321
349
 
322
- **Commit STATE.md update:**
350
+ **Commit STATE.md update (if auto_commit enabled):**
351
+
352
+ **If auto_commit is true:**
323
353
  ```bash
324
354
  git add .specd/features/{feature}/STATE.md
325
355
  git commit -m "docs({feature}): complete plan {phase-XX/YY}"
326
356
  ```
327
357
 
358
+ **If auto_commit is false:**
359
+ - Do NOT commit
360
+ - Include STATE.md in the list of modified files for user to review
361
+
328
362
  **Find next plan:**
329
363
  - Check ROADMAP.md for next plan in sequence
330
364
  - Or next phase if current phase complete
@@ -0,0 +1,583 @@
1
+ <purpose>
2
+ Research implementation patterns for a specific phase before executing it.
3
+
4
+ Uses three parallel research tracks tailored to the phase:
5
+ 1. **Codebase Integration** - How phase deliverables integrate with existing code
6
+ 2. **Phase-Type Patterns** - Patterns specific to this phase type (API, UI, etc.)
7
+ 3. **Phase-Type Pitfalls** - What goes wrong with this type of work
8
+
9
+ Output: `plans/phase-{NN}/RESEARCH.md` that execute-plan consumes.
10
+ </purpose>
11
+
12
+ <philosophy>
13
+
14
+ ## Phase-Focused Research
15
+
16
+ Don't research the whole feature again. Focus narrowly on what THIS phase creates/modifies. If phase 1 creates types, research type patterns. If phase 2 creates APIs, research API patterns.
17
+
18
+ ## Builds on Feature Research
19
+
20
+ If feature-level RESEARCH.md exists, don't duplicate it. Reference it and add phase-specific details.
21
+
22
+ ## Codebase First
23
+
24
+ The most valuable research is understanding how this phase's files integrate with existing code. External patterns matter, but integration patterns matter more.
25
+
26
+ ## Decisions Get Recorded
27
+
28
+ Any choice made during research goes into DECISIONS.md with phase context.
29
+
30
+ </philosophy>
31
+
32
+ <phase_type_research>
33
+
34
+ ## Types/Schema Phase Research
35
+ - Existing type patterns in codebase
36
+ - TypeScript/schema best practices
37
+ - Type relationships and composition
38
+ - Validation library patterns (zod, etc.)
39
+
40
+ ## API/Data Phase Research
41
+ - Existing API patterns in codebase
42
+ - REST/GraphQL conventions
43
+ - Error handling patterns
44
+ - Auth integration patterns
45
+ - Pagination patterns
46
+
47
+ ## Business Logic Phase Research
48
+ - Existing service patterns
49
+ - Error handling approaches
50
+ - Transaction patterns
51
+ - Testing patterns for logic
52
+
53
+ ## UI/Components Phase Research
54
+ - Existing component patterns
55
+ - State management approach
56
+ - Form handling patterns
57
+ - Loading/error state patterns
58
+ - Accessibility patterns
59
+
60
+ ## Integration Phase Research
61
+ - Existing integration patterns
62
+ - Provider/context patterns
63
+ - Initialization patterns
64
+ - Entry point conventions
65
+
66
+ </phase_type_research>
67
+
68
+ <process>
69
+
70
+ <step name="validate">
71
+ Validate feature exists and phase exists.
72
+
73
+ **Parse arguments:**
74
+ Split $ARGUMENTS into feature-name and phase-number.
75
+
76
+ ```bash
77
+ # Check feature exists
78
+ [ -d ".specd/features/$FEATURE_NAME" ] || { echo "Feature not found"; exit 1; }
79
+
80
+ # Check ROADMAP.md exists
81
+ [ -f ".specd/features/$FEATURE_NAME/ROADMAP.md" ] || { echo "No roadmap"; exit 1; }
82
+
83
+ # Check phase directory exists
84
+ PHASE_DIR=".specd/features/$FEATURE_NAME/plans/phase-$(printf '%02d' $PHASE_NUMBER)"
85
+ [ -d "$PHASE_DIR" ] || { echo "Phase not found"; exit 1; }
86
+
87
+ # Check if RESEARCH.md already exists
88
+ [ -f "$PHASE_DIR/RESEARCH.md" ] && echo "existing"
89
+ ```
90
+
91
+ **If RESEARCH.md exists:**
92
+ Use AskUserQuestion:
93
+ - header: "Research Exists"
94
+ - question: "Phase research already exists. What would you like to do?"
95
+ - options:
96
+ - "Update research" — Re-run research, incorporate new findings
97
+ - "View existing" — Show current RESEARCH.md
98
+ - "Continue anyway" — Skip research, use existing
99
+
100
+ Continue to load_context.
101
+ </step>
102
+
103
+ <step name="load_context">
104
+ Load all context needed for phase research.
105
+
106
+ **Read feature context:**
107
+ - `FEATURE.md` — Overall feature requirements
108
+ - `DECISIONS.md` — All decisions so far
109
+ - `ROADMAP.md` — Phase overview
110
+ - `RESEARCH.md` — Feature-level research if exists
111
+
112
+ **Read phase context:**
113
+ - All plan files in `plans/phase-{NN}/`
114
+ - `plans/phase-{NN}/CONTEXT.md` if exists (from discuss-phase)
115
+ - Previous phases' RESEARCH.md files for continuity
116
+
117
+ **Read codebase context:**
118
+ - `PATTERNS.md` — Code patterns to follow
119
+ - `STRUCTURE.md` — Where files go
120
+ - `MAP.md` — System overview
121
+
122
+ **Extract from ROADMAP.md:**
123
+ - Phase title and goal
124
+ - Phase type (Types, API, UI, Integration, Business Logic)
125
+ - Files to be created/modified
126
+
127
+ **Determine phase type** from ROADMAP.md or infer from files:
128
+ - `.ts` types files → Types/Schema
129
+ - `route.ts`, `api/` → API/Data
130
+ - `.tsx` components → UI/Components
131
+ - `service`, `util` → Business Logic
132
+ - `provider`, `setup` → Integration
133
+
134
+ Continue to present_research_plan.
135
+ </step>
136
+
137
+ <step name="present_research_plan">
138
+ Present research plan to user.
139
+
140
+ ```
141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142
+ RESEARCH PHASE {N}
143
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
144
+
145
+ **Feature:** {feature-name}
146
+ **Phase:** {N} — {Phase Title}
147
+ **Type:** {Phase Type}
148
+
149
+ ## Phase Deliverables
150
+
151
+ Files to create:
152
+ - {file 1}
153
+ - {file 2}
154
+
155
+ Files to modify:
156
+ - {file 3}
157
+
158
+ ## Research Dimensions
159
+
160
+ I'll research these areas for this {Phase Type} phase:
161
+
162
+ 1. **Codebase Integration** — How these files fit with existing code
163
+ - Existing patterns for {phase type}
164
+ - Files to import from
165
+ - Integration points
166
+
167
+ 2. **{Phase Type} Patterns** — Standard approaches
168
+ - Best practices for {phase type}
169
+ - Library patterns
170
+ - Code examples
171
+
172
+ 3. **{Phase Type} Pitfalls** — What goes wrong
173
+ - Common mistakes
174
+ - Performance issues
175
+ - Integration gotchas
176
+
177
+ Estimated: 3 parallel research agents
178
+
179
+ [Start research] / [Adjust scope]
180
+ ```
181
+
182
+ Use AskUserQuestion:
183
+ - header: "Research"
184
+ - question: "Start phase research?"
185
+ - options:
186
+ - "Start research" — Spawn agents
187
+ - "Adjust scope" — Modify research dimensions
188
+
189
+ Continue to spawn_agents.
190
+ </step>
191
+
192
+ <step name="spawn_agents">
193
+ Spawn three parallel research agents.
194
+
195
+ ### Agent 1: Codebase Integration (using Explore agent)
196
+
197
+ ```
198
+ Task(
199
+ prompt="Research how phase {N} of {feature-name} should integrate with the existing codebase.
200
+
201
+ <phase_context>
202
+ Phase: {N} — {Phase Title}
203
+ Type: {Phase Type}
204
+ Goal: {Phase goal from ROADMAP.md}
205
+
206
+ Files to create:
207
+ {list of files}
208
+
209
+ Files to modify:
210
+ {list of files}
211
+ </phase_context>
212
+
213
+ <locked_decisions>
214
+ {Relevant decisions from DECISIONS.md}
215
+ </locked_decisions>
216
+
217
+ <research_questions>
218
+ 1. What existing files/modules will this phase's files need to import from?
219
+ 2. What patterns do similar {phase type} files in this codebase follow?
220
+ 3. Where exactly should new files be created?
221
+ 4. What types/interfaces already exist that should be reused?
222
+ 5. What utility functions or hooks can be leveraged?
223
+ </research_questions>
224
+
225
+ <output_format>
226
+ Return findings as structured markdown:
227
+
228
+ ## Codebase Integration for Phase {N}
229
+
230
+ ### Import Dependencies
231
+ - `path/to/file` — what it provides, why needed
232
+
233
+ ### Patterns to Follow
234
+ - Pattern name: description, example file reference
235
+
236
+ ### File Locations
237
+ - Exactly where each new file should go
238
+
239
+ ### Reusable Code
240
+ - Types: list with paths
241
+ - Utilities: list with paths
242
+
243
+ ### Integration Points
244
+ - Where this phase's code connects to existing code
245
+ </output_format>
246
+ ",
247
+ subagent_type="Explore",
248
+ description="Phase codebase integration"
249
+ )
250
+ ```
251
+
252
+ ### Agent 2: Phase-Type Patterns Research
253
+
254
+ ```
255
+ Task(
256
+ prompt="First, read ~/.claude/specdacular/agents/feature-researcher.md for your role.
257
+
258
+ <research_type>
259
+ {Phase Type} patterns research for phase {N} of {feature-name}.
260
+ </research_type>
261
+
262
+ <phase_context>
263
+ Phase: {N} — {Phase Title}
264
+ Type: {Phase Type}
265
+ Goal: {Phase goal}
266
+
267
+ Files to create:
268
+ {list of files}
269
+ </phase_context>
270
+
271
+ <codebase_stack>
272
+ {From .specd/codebase/ if available}
273
+ </codebase_stack>
274
+
275
+ <research_questions>
276
+ 1. What's the standard approach for {phase type} in this stack?
277
+ 2. What libraries are commonly used for {phase type}?
278
+ 3. What code patterns work well for {phase type}?
279
+ 4. What should NOT be hand-rolled?
280
+ </research_questions>
281
+
282
+ <tool_strategy>
283
+ 1. Context7 first for any library questions
284
+ 2. Official docs via WebFetch for gaps
285
+ 3. WebSearch for patterns (include current year)
286
+ 4. Verify all findings
287
+ </tool_strategy>
288
+
289
+ <output_format>
290
+ Return findings as structured markdown with confidence levels.
291
+
292
+ ## {Phase Type} Patterns
293
+
294
+ ### Standard Approach
295
+ {Recommended approach with rationale}
296
+
297
+ ### Libraries
298
+ | Library | Version | Purpose | Confidence |
299
+
300
+ ### Code Patterns
301
+ {Code examples with sources}
302
+
303
+ ### Don't Hand-Roll
304
+ | Problem | Use Instead | Why |
305
+ </output_format>
306
+ ",
307
+ subagent_type="general-purpose",
308
+ model="sonnet",
309
+ description="Phase type patterns"
310
+ )
311
+ ```
312
+
313
+ ### Agent 3: Phase-Type Pitfalls Research
314
+
315
+ ```
316
+ Task(
317
+ prompt="First, read ~/.claude/specdacular/agents/feature-researcher.md for your role.
318
+
319
+ <research_type>
320
+ Pitfalls research for {Phase Type} work in phase {N} of {feature-name}.
321
+ </research_type>
322
+
323
+ <phase_context>
324
+ Phase: {N} — {Phase Title}
325
+ Type: {Phase Type}
326
+ Goal: {Phase goal}
327
+
328
+ Files to create:
329
+ {list of files}
330
+ </phase_context>
331
+
332
+ <research_questions>
333
+ 1. What do developers commonly get wrong with {phase type}?
334
+ 2. What are the performance pitfalls for {phase type}?
335
+ 3. What security issues should be avoided?
336
+ 4. What integration mistakes happen with {phase type}?
337
+ </research_questions>
338
+
339
+ <tool_strategy>
340
+ 1. WebSearch for common mistakes (include current year)
341
+ 2. Look for post-mortems, issue discussions
342
+ 3. Check official docs for warnings/caveats
343
+ </tool_strategy>
344
+
345
+ <output_format>
346
+ Return pitfalls as structured markdown:
347
+
348
+ ## {Phase Type} Pitfalls
349
+
350
+ ### Critical (causes failures/rewrites)
351
+ - Pitfall: description
352
+ - Why it happens
353
+ - Prevention
354
+ - Detection
355
+
356
+ ### Moderate (causes bugs/debt)
357
+ - Pitfall: description
358
+ - Prevention
359
+
360
+ ### Minor (causes friction)
361
+ - Pitfall: description
362
+ - Prevention
363
+ </output_format>
364
+ ",
365
+ subagent_type="general-purpose",
366
+ model="sonnet",
367
+ description="Phase type pitfalls"
368
+ )
369
+ ```
370
+
371
+ Wait for all agents to complete.
372
+
373
+ Continue to synthesize.
374
+ </step>
375
+
376
+ <step name="synthesize">
377
+ Combine agent results into single RESEARCH.md.
378
+
379
+ **Create plans/phase-{NN}/RESEARCH.md:**
380
+
381
+ ```markdown
382
+ # Phase {N} Research: {Phase Title}
383
+
384
+ **Feature:** {feature-name}
385
+ **Phase Type:** {Phase Type}
386
+ **Researched:** {today}
387
+
388
+ ## Summary
389
+
390
+ {2-3 paragraphs synthesizing all findings for this phase}
391
+
392
+ **Key recommendation:** {One-liner actionable guidance}
393
+
394
+ ---
395
+
396
+ ## Codebase Integration
397
+
398
+ {From Agent 1 — Explore findings}
399
+
400
+ ### Import From
401
+ | Module | Provides | Path |
402
+ |--------|----------|------|
403
+ | ... | ... | ... |
404
+
405
+ ### Patterns to Follow
406
+ {Patterns with file references}
407
+
408
+ ### File Locations
409
+ ```
410
+ {exact paths for new files}
411
+ ```
412
+
413
+ ### Reusable Code
414
+ - **Types:** {list with @paths}
415
+ - **Utilities:** {list with @paths}
416
+
417
+ ### Integration Points
418
+ {Where this phase connects to existing code}
419
+
420
+ ---
421
+
422
+ ## {Phase Type} Patterns
423
+
424
+ {From Agent 2 — Pattern findings}
425
+
426
+ ### Standard Approach
427
+ {Recommended approach with rationale}
428
+
429
+ ### Libraries
430
+ | Library | Version | Purpose | Confidence |
431
+ |---------|---------|---------|------------|
432
+ | ... | ... | ... | HIGH/MED |
433
+
434
+ ### Code Patterns
435
+ ```typescript
436
+ // Pattern name - source: {Context7/docs URL}
437
+ {code example}
438
+ ```
439
+
440
+ ### Don't Hand-Roll
441
+ | Problem | Use Instead | Why |
442
+ |---------|-------------|-----|
443
+ | ... | ... | ... |
444
+
445
+ ---
446
+
447
+ ## Pitfalls
448
+
449
+ {From Agent 3 — Pitfalls findings}
450
+
451
+ ### Critical
452
+ {List with prevention strategies}
453
+
454
+ ### Moderate
455
+ {List with prevention strategies}
456
+
457
+ ### Phase-Specific Warnings
458
+ | When Implementing | Watch Out For | Prevention |
459
+ |-------------------|---------------|------------|
460
+ | ... | ... | ... |
461
+
462
+ ---
463
+
464
+ ## Confidence Assessment
465
+
466
+ | Area | Level | Reason |
467
+ |------|-------|--------|
468
+ | Codebase integration | {level} | {reason} |
469
+ | {Phase type} patterns | {level} | {reason} |
470
+ | Pitfalls | {level} | {reason} |
471
+
472
+ ## Open Questions
473
+
474
+ {Anything that couldn't be resolved}
475
+
476
+ ## Sources
477
+
478
+ ### Codebase (from Explore)
479
+ - {file references used}
480
+
481
+ ### External (verified)
482
+ - {Context7 queries}
483
+ - {Official docs URLs}
484
+ ```
485
+
486
+ Continue to record_decisions.
487
+ </step>
488
+
489
+ <step name="record_decisions">
490
+ Record any technology choices from research.
491
+
492
+ **Identify decisions from synthesis:**
493
+ - Library choices
494
+ - Pattern choices
495
+ - Approach choices
496
+
497
+ **For each new decision, add to DECISIONS.md:**
498
+
499
+ ```markdown
500
+ ### DEC-{NNN}: {Title}
501
+
502
+ **Date:** {today}
503
+ **Status:** Active
504
+ **Phase:** {N} — {Phase Title}
505
+ **Context:** Identified during phase research
506
+ **Decision:** {What was decided}
507
+ **Rationale:** {From research findings}
508
+ **Implications:** {What this means for implementation}
509
+ **References:** {Sources}
510
+ ```
511
+
512
+ Continue to commit.
513
+ </step>
514
+
515
+ <step name="commit">
516
+ Commit the phase research.
517
+
518
+ ```bash
519
+ git add ".specd/features/{feature}/plans/phase-{NN}/RESEARCH.md"
520
+ git add ".specd/features/{feature}/DECISIONS.md"
521
+
522
+ git commit -m "docs({feature}): research phase {N} - {phase title}
523
+
524
+ Research dimensions:
525
+ - Codebase integration
526
+ - {Phase type} patterns
527
+ - {Phase type} pitfalls
528
+
529
+ Key findings:
530
+ - {one-liner from summary}"
531
+ ```
532
+
533
+ Continue to completion.
534
+ </step>
535
+
536
+ <step name="completion">
537
+ Present summary and next options.
538
+
539
+ ```
540
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
541
+ PHASE RESEARCH COMPLETE
542
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
543
+
544
+ **Feature:** {feature-name}
545
+ **Phase:** {N} — {Phase Title}
546
+ **Confidence:** {overall level}
547
+
548
+ ## Key Findings
549
+
550
+ - {Finding 1}
551
+ - {Finding 2}
552
+ - {Finding 3}
553
+
554
+ ## Files Created
555
+
556
+ - `plans/phase-{NN}/RESEARCH.md`
557
+ - Updated `DECISIONS.md` with {N} new decisions
558
+
559
+ ───────────────────────────────────────────────────────
560
+
561
+ ## What's Next
562
+
563
+ **/specd:execute-plan {feature}** — Execute this phase (will load phase research)
564
+
565
+ **/specd:discuss-phase {feature} {N}** — Discuss this phase further
566
+
567
+ <sub>/clear first — fresh context window for execution</sub>
568
+ ```
569
+
570
+ End workflow.
571
+ </step>
572
+
573
+ </process>
574
+
575
+ <success_criteria>
576
+ - Feature and phase validated
577
+ - Phase context loaded (goals, files, type)
578
+ - Research agents spawned in parallel
579
+ - Results synthesized into phase RESEARCH.md
580
+ - Decisions recorded in DECISIONS.md
581
+ - Committed to git
582
+ - User knows next step is execute-plan
583
+ </success_criteria>