specdacular 0.8.0 → 0.9.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/README.md +166 -54
- package/commands/specd/continue.md +22 -14
- package/commands/specd/toolbox.md +58 -14
- package/package.json +1 -1
- package/specdacular/HELP.md +70 -9
- package/specdacular/STATE-MACHINE.md +376 -0
- package/specdacular/pipeline.json +76 -0
- package/specdacular/references/brain-routing.md +168 -0
- package/specdacular/references/commit-code.md +9 -6
- package/specdacular/references/commit-docs.md +9 -6
- package/specdacular/references/execute-hooks.md +127 -0
- package/specdacular/references/load-context.md +10 -9
- package/specdacular/references/resolve-pipeline.md +74 -0
- package/specdacular/references/select-feature.md +12 -5
- package/specdacular/references/validate-task.md +19 -11
- package/specdacular/templates/context/review-diff.md +60 -0
- package/specdacular/templates/context/section-display.md +51 -0
- package/specdacular/workflows/brain.md +378 -0
- package/specdacular/workflows/context-add.md +242 -0
- package/specdacular/workflows/context-manual-review.md +410 -0
- package/specdacular/workflows/continue.md +17 -259
- package/specdacular/workflows/execute.md +15 -42
- package/specdacular/workflows/map-codebase.md +14 -0
- package/specdacular/workflows/new.md +2 -2
- package/specdacular/workflows/phase-plan.md +142 -0
- package/specdacular/workflows/plan.md +10 -37
- package/specdacular/workflows/research.md +25 -7
- package/specdacular/workflows/review.md +11 -136
- package/specdacular/workflows/revise.md +126 -0
- package/specdacular/workflows/status.md +1 -1
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Manual review of a codebase context file (.specd/codebase/*.md). Shows a section list and lets the user pick which section to review, edit, remove, re-map, or add new content.
|
|
3
|
+
|
|
4
|
+
Edits are tagged with `<!-- USER_MODIFIED: YYYY-MM-DD -->`. Re-mapping spawns a targeted agent for just that section and shows a semantic diff.
|
|
5
|
+
|
|
6
|
+
Output: Updated context file with reviewed/edited sections and updated timestamps.
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
<philosophy>
|
|
10
|
+
|
|
11
|
+
## User Picks What To Review
|
|
12
|
+
|
|
13
|
+
Don't walk through every section automatically. Show a list of sections and let the user choose which one to look at. The user knows what needs attention.
|
|
14
|
+
|
|
15
|
+
## User Controls Everything
|
|
16
|
+
|
|
17
|
+
Every change requires explicit user approval. Never auto-edit, auto-remove, or auto-accept re-mapped content.
|
|
18
|
+
|
|
19
|
+
## Minimal Touch
|
|
20
|
+
|
|
21
|
+
Edit only what the user asks. Don't reorganize surrounding sections or rewrite adjacent content.
|
|
22
|
+
|
|
23
|
+
</philosophy>
|
|
24
|
+
|
|
25
|
+
<critical_rules>
|
|
26
|
+
|
|
27
|
+
## Date Format
|
|
28
|
+
|
|
29
|
+
Always write dates as `YYYY-MM-DD`. Never write times. Never write month names.
|
|
30
|
+
|
|
31
|
+
## Section Tags
|
|
32
|
+
|
|
33
|
+
Two tag types for tracking section state:
|
|
34
|
+
|
|
35
|
+
- `<!-- USER_MODIFIED: YYYY-MM-DD -->` — Section was manually edited by the user
|
|
36
|
+
- `<!-- AUTO_GENERATED: YYYY-MM-DD -->` — Section was generated or updated via mapper agent
|
|
37
|
+
|
|
38
|
+
Sections with no tag are treated as AUTO_GENERATED with today's date. When displaying untagged sections, tell the user: "No tag found — will default to AUTO_GENERATED with today's date." Then add the tag.
|
|
39
|
+
|
|
40
|
+
Placement: On its own line immediately after the section heading. No blank line between heading and tag.
|
|
41
|
+
|
|
42
|
+
```markdown
|
|
43
|
+
## Section Title
|
|
44
|
+
<!-- USER_MODIFIED: 2026-02-17 -->
|
|
45
|
+
|
|
46
|
+
Content here...
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Never place the tag on the same line as the heading. Never add more than one tag per section. If a tag already exists, replace it with the appropriate tag type and today's date.
|
|
50
|
+
|
|
51
|
+
## Section Boundaries
|
|
52
|
+
|
|
53
|
+
- A `##` section runs from its heading until the next `##` heading or end of file
|
|
54
|
+
- A `###` section runs from its heading until the next `###`, `##`, or end of file
|
|
55
|
+
- Ignore `#` (document title) — it is not a reviewable section
|
|
56
|
+
- Code fences (```) do NOT start new sections even if they contain `#` characters
|
|
57
|
+
- `<!-- USER_MODIFIED: ... -->` and `<!-- AUTO_GENERATED: ... -->` tags inside fenced code blocks are NOT real tags — only detect tags outside code fences
|
|
58
|
+
|
|
59
|
+
## Timestamp Lines
|
|
60
|
+
|
|
61
|
+
Document-level timestamps live near the top of the file (lines 2-4), after the `# Title`:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
# Document Title
|
|
65
|
+
Generated: 2026-02-04
|
|
66
|
+
Last Reviewed: 2026-02-17
|
|
67
|
+
Last Modified: 2026-02-17
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If `Last Reviewed:` or `Last Modified:` lines don't exist yet, add them after the `Generated:` line (or `**Analysis Date:**` line for CONCERNS.md).
|
|
71
|
+
|
|
72
|
+
## After Every Action
|
|
73
|
+
|
|
74
|
+
For EVERY section acted on, you MUST add or update the tag immediately — not later, not at the end:
|
|
75
|
+
|
|
76
|
+
- **User edits a section** → `<!-- USER_MODIFIED: {today} -->`
|
|
77
|
+
- **Re-map accepted** → `<!-- AUTO_GENERATED: {today} -->`
|
|
78
|
+
- **Section confirmed unchanged** → Update existing tag's date to today (keep same tag type). If no tag exists, add `<!-- AUTO_GENERATED: {today} -->`
|
|
79
|
+
|
|
80
|
+
Also update the file's `Last Modified: {today}` timestamp at the top if any content changed (edit, remove, or re-map).
|
|
81
|
+
|
|
82
|
+
When returning to the section list, update `Last Reviewed: {today}` at the top of the file.
|
|
83
|
+
|
|
84
|
+
Never skip tagging. Never defer to a later step.
|
|
85
|
+
|
|
86
|
+
</critical_rules>
|
|
87
|
+
|
|
88
|
+
<process>
|
|
89
|
+
|
|
90
|
+
<step name="validate">
|
|
91
|
+
Check that codebase context files exist.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
ls .specd/codebase/*.md 2>/dev/null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**If no files found:**
|
|
98
|
+
```
|
|
99
|
+
No codebase context files found.
|
|
100
|
+
|
|
101
|
+
Run /specd:map-codebase to generate codebase documentation.
|
|
102
|
+
```
|
|
103
|
+
End workflow.
|
|
104
|
+
|
|
105
|
+
Continue to select_file.
|
|
106
|
+
</step>
|
|
107
|
+
|
|
108
|
+
<step name="select_file">
|
|
109
|
+
Let the user pick which file to review.
|
|
110
|
+
|
|
111
|
+
Read the first 5 lines of each existing context file to extract timestamps. Show last reviewed dates.
|
|
112
|
+
|
|
113
|
+
Use AskUserQuestion:
|
|
114
|
+
- header: "Review"
|
|
115
|
+
- question: "Which context file do you want to review?"
|
|
116
|
+
- options (only show files that exist):
|
|
117
|
+
- "MAP.md" — Navigation map {Last Reviewed: date or "never reviewed"}
|
|
118
|
+
- "PATTERNS.md" — Code patterns {Last Reviewed: date or "never reviewed"}
|
|
119
|
+
- "STRUCTURE.md" — Directory layout {Last Reviewed: date or "never reviewed"}
|
|
120
|
+
- "CONCERNS.md" — Gotchas and warnings {Last Reviewed: date or "never reviewed"}
|
|
121
|
+
|
|
122
|
+
**Set the mapper focus** based on the selected file (used by re-map action):
|
|
123
|
+
- `MAP.md` → `MAPPER_FOCUS = "map"`
|
|
124
|
+
- `PATTERNS.md` → `MAPPER_FOCUS = "patterns"`
|
|
125
|
+
- `STRUCTURE.md` → `MAPPER_FOCUS = "structure"`
|
|
126
|
+
- `CONCERNS.md` → `MAPPER_FOCUS = "concerns"`
|
|
127
|
+
|
|
128
|
+
**Extract `Last Reviewed` date** from the selected file for assessment logic. Store as `LAST_REVIEWED_DATE`. If no `Last Reviewed:` line exists, set to `null`.
|
|
129
|
+
|
|
130
|
+
Continue to parse_sections.
|
|
131
|
+
</step>
|
|
132
|
+
|
|
133
|
+
<step name="parse_sections">
|
|
134
|
+
Read the selected file and build a section list.
|
|
135
|
+
|
|
136
|
+
**Parse rules (from critical_rules):**
|
|
137
|
+
1. Skip the `#` title line and document-level metadata (first few lines)
|
|
138
|
+
2. Identify all `##` and `###` headings (outside fenced code blocks)
|
|
139
|
+
3. For each heading, capture:
|
|
140
|
+
- Heading level (## or ###)
|
|
141
|
+
- Heading text
|
|
142
|
+
- Whether a tag exists on the line after the heading (USER_MODIFIED or AUTO_GENERATED)
|
|
143
|
+
- The tag type and date if present
|
|
144
|
+
- The section content (everything from after the heading/tag until the next heading of same or higher level)
|
|
145
|
+
- Parent `##` heading (for `###` sections)
|
|
146
|
+
4. **Exclude empty parent sections:** If a `##` section has no content of its own (only `###` children), do NOT count it as a reviewable section. Instead, store its heading text as the parent label for its children.
|
|
147
|
+
5. Count only reviewable sections (sections with actual content)
|
|
148
|
+
|
|
149
|
+
Continue to show_section_list.
|
|
150
|
+
</step>
|
|
151
|
+
|
|
152
|
+
<step name="show_section_list">
|
|
153
|
+
Show the user a numbered list of all sections with their tag status, then let them pick one or add new content.
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
================================================================
|
|
157
|
+
{file} — {N} sections
|
|
158
|
+
================================================================
|
|
159
|
+
|
|
160
|
+
{For each section:}
|
|
161
|
+
{N}. {If ### subsection: "{Parent} > "}{heading} {If tagged: "({tag type}: {date})" else "(no tag)"}
|
|
162
|
+
{...}
|
|
163
|
+
|
|
164
|
+
================================================================
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Use AskUserQuestion:
|
|
168
|
+
- header: "{file}"
|
|
169
|
+
- question: "How would you like to review?"
|
|
170
|
+
- options:
|
|
171
|
+
- "Select section" — Pick a section by number
|
|
172
|
+
- "Walk all" — Go through every section in order
|
|
173
|
+
- "Done" — Finish reviewing this file
|
|
174
|
+
|
|
175
|
+
**If "Select section":**
|
|
176
|
+
Ask the user: "Which section number?" — the section list is already displayed above, so just ask for the number as a plain text prompt. Do NOT use AskUserQuestion (it has a 4-option limit and can't show all sections). Continue to show_section. After the action, return to show_section_list.
|
|
177
|
+
|
|
178
|
+
**If "Walk all":**
|
|
179
|
+
Continue to walk_sections.
|
|
180
|
+
|
|
181
|
+
**If "Done":**
|
|
182
|
+
Continue to update_timestamps.
|
|
183
|
+
</step>
|
|
184
|
+
|
|
185
|
+
<step name="walk_sections">
|
|
186
|
+
Walk through every section in document order, one at a time.
|
|
187
|
+
|
|
188
|
+
For each section in order: run the **show_section** step exactly as written below (same assessment, same display format, same AskUserQuestion options). The only addition: include "Done for now" as a 5th option. If selected, stop walking and return to show_section_list.
|
|
189
|
+
|
|
190
|
+
After the user acts on a section, move to the next section automatically.
|
|
191
|
+
|
|
192
|
+
After all sections are walked, return to show_section_list.
|
|
193
|
+
</step>
|
|
194
|
+
|
|
195
|
+
<step name="show_section">
|
|
196
|
+
Display the selected section and let the user act on it.
|
|
197
|
+
|
|
198
|
+
**Perform an assessment** using the assessment logic from `@~/.claude/specdacular/templates/context/section-display.md`.
|
|
199
|
+
|
|
200
|
+
**Display using the section display template:**
|
|
201
|
+
|
|
202
|
+
@~/.claude/specdacular/templates/context/section-display.md
|
|
203
|
+
|
|
204
|
+
Follow the Section Display format from the template above exactly. Do not improvise a different format.
|
|
205
|
+
|
|
206
|
+
**After displaying, use AskUserQuestion:**
|
|
207
|
+
- header: "Section {N}"
|
|
208
|
+
- question: "What would you like to do with this section?"
|
|
209
|
+
- options:
|
|
210
|
+
- "Confirm" — Section is correct, mark as reviewed
|
|
211
|
+
- "Edit" — Tell me what to change
|
|
212
|
+
- "Remove" — Delete this section
|
|
213
|
+
- "Re-map" — Re-run the mapper for this section and compare
|
|
214
|
+
|
|
215
|
+
**If Confirm:**
|
|
216
|
+
Update the existing tag's date to today (keep the same tag type). If the section has no tag, add `<!-- AUTO_GENERATED: {today} -->`. Return to show_section_list.
|
|
217
|
+
|
|
218
|
+
**If Edit:**
|
|
219
|
+
Ask: "What should I change in this section?"
|
|
220
|
+
|
|
221
|
+
Wait for user response. Apply the edit using the Edit tool.
|
|
222
|
+
|
|
223
|
+
Add or update `<!-- USER_MODIFIED: {today} -->` on the line immediately after the section heading.
|
|
224
|
+
|
|
225
|
+
Mark that modifications were made in this session.
|
|
226
|
+
|
|
227
|
+
Return to show_section_list.
|
|
228
|
+
|
|
229
|
+
**If Remove:**
|
|
230
|
+
Check if this is a `##` section with `###` children.
|
|
231
|
+
|
|
232
|
+
If it has children, warn:
|
|
233
|
+
```
|
|
234
|
+
Removing "## {title}" will also remove {N} subsections:
|
|
235
|
+
- ### {child 1}
|
|
236
|
+
- ### {child 2}
|
|
237
|
+
...
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Use AskUserQuestion:
|
|
241
|
+
- header: "Confirm remove"
|
|
242
|
+
- question: "Remove this section and its subsections?"
|
|
243
|
+
- options:
|
|
244
|
+
- "Yes, remove" — Delete the section
|
|
245
|
+
- "Cancel" — Keep the section
|
|
246
|
+
|
|
247
|
+
If confirmed: Remove the section (and children if ##) from the file using the Edit tool. Mark modifications made. Re-parse sections.
|
|
248
|
+
|
|
249
|
+
If cancelled: Return to show_section_list.
|
|
250
|
+
|
|
251
|
+
**If Re-map:**
|
|
252
|
+
Spawn a targeted re-mapping agent using the `specd-codebase-mapper` agent with file-type-specific focus.
|
|
253
|
+
|
|
254
|
+
Use the Task tool:
|
|
255
|
+
```
|
|
256
|
+
subagent_type: "specd-codebase-mapper"
|
|
257
|
+
model: "sonnet"
|
|
258
|
+
description: "Re-map section: {section title}"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Prompt for the agent:**
|
|
262
|
+
```
|
|
263
|
+
Focus: {MAPPER_FOCUS}
|
|
264
|
+
|
|
265
|
+
You are re-mapping a SINGLE SECTION of .specd/codebase/{file}.
|
|
266
|
+
|
|
267
|
+
Section heading: {exact heading text}
|
|
268
|
+
Heading level: {## or ###}
|
|
269
|
+
|
|
270
|
+
Current content of this section:
|
|
271
|
+
{paste the exact current section content, excluding the heading line}
|
|
272
|
+
|
|
273
|
+
{If USER_MODIFIED tag exists:}
|
|
274
|
+
This section was manually modified by the user on {date}.
|
|
275
|
+
Preserve user additions that are still accurate.
|
|
276
|
+
|
|
277
|
+
Other sections in this file (do NOT cover these topics):
|
|
278
|
+
{list other section headings in the file}
|
|
279
|
+
|
|
280
|
+
Explore the codebase to verify and update what this section documents.
|
|
281
|
+
Check that all file paths still exist. Add new items discovered. Remove items that no longer exist.
|
|
282
|
+
|
|
283
|
+
Return ONLY the replacement section content as raw markdown.
|
|
284
|
+
Do NOT include the heading line.
|
|
285
|
+
Do NOT write to any file.
|
|
286
|
+
Do NOT wrap in code fences or add explanation.
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**After agent returns:**
|
|
290
|
+
|
|
291
|
+
Present using the Re-map Diff Display format from `@specdacular/templates/context/review-diff.md`:
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
295
|
+
RE-MAP RESULTS: {section title}
|
|
296
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
297
|
+
|
|
298
|
+
Note: AI regeneration may rephrase content even when
|
|
299
|
+
facts are unchanged. Focus on factual differences.
|
|
300
|
+
|
|
301
|
+
───── CURRENT ─────────────────────────────────────────
|
|
302
|
+
|
|
303
|
+
{current section content}
|
|
304
|
+
|
|
305
|
+
───── RE-MAPPED ───────────────────────────────────────
|
|
306
|
+
|
|
307
|
+
{agent's returned content}
|
|
308
|
+
|
|
309
|
+
───── KEY DIFFERENCES ─────────────────────────────────
|
|
310
|
+
|
|
311
|
+
- {factual difference 1: added/removed/changed item}
|
|
312
|
+
- {factual difference 2}
|
|
313
|
+
...
|
|
314
|
+
|
|
315
|
+
{If no factual differences: "No factual changes detected — only phrasing differences."}
|
|
316
|
+
|
|
317
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Use AskUserQuestion:
|
|
321
|
+
- header: "Re-map"
|
|
322
|
+
- question: "How do you want to handle the re-mapped content?"
|
|
323
|
+
- options:
|
|
324
|
+
- "Accept new" — Replace with re-mapped content
|
|
325
|
+
- "Keep current" — Keep existing content unchanged
|
|
326
|
+
- "Edit manually" — Tell me what to change
|
|
327
|
+
|
|
328
|
+
If "Accept new": Replace section content with agent's output. Add or update tag to `<!-- AUTO_GENERATED: {today} -->`. Mark modifications made.
|
|
329
|
+
|
|
330
|
+
If "Keep current": Return to show_section_list.
|
|
331
|
+
|
|
332
|
+
If "Edit manually": Ask user what to change. Apply edit. Add/update USER_MODIFIED tag. Mark modifications made.
|
|
333
|
+
|
|
334
|
+
Return to show_section_list.
|
|
335
|
+
</step>
|
|
336
|
+
|
|
337
|
+
<step name="update_timestamps">
|
|
338
|
+
Update the file's document-level timestamps.
|
|
339
|
+
|
|
340
|
+
**Always set:**
|
|
341
|
+
- `Last Reviewed: {today}` — because the user reviewed the file
|
|
342
|
+
|
|
343
|
+
**If any modifications were made (edit, remove, re-map accepted, content added):**
|
|
344
|
+
- `Last Modified: {today}`
|
|
345
|
+
|
|
346
|
+
**How to update:**
|
|
347
|
+
1. Read the first 5 lines of the file
|
|
348
|
+
2. Look for existing `Last Reviewed:` and `Last Modified:` lines
|
|
349
|
+
3. If they exist, update the dates using the Edit tool
|
|
350
|
+
4. If they don't exist, add them after the `Generated:` or `**Analysis Date:**` line
|
|
351
|
+
|
|
352
|
+
Continue to commit.
|
|
353
|
+
</step>
|
|
354
|
+
|
|
355
|
+
<step name="commit">
|
|
356
|
+
Commit changes if any were made.
|
|
357
|
+
|
|
358
|
+
**If no modifications were made (user only confirmed sections):**
|
|
359
|
+
Still commit the timestamp update (Last Reviewed changed).
|
|
360
|
+
|
|
361
|
+
@~/.claude/specdacular/references/commit-docs.md
|
|
362
|
+
|
|
363
|
+
- **$FILES:** `.specd/codebase/{file}`
|
|
364
|
+
- **$MESSAGE:** `docs: review {file}` with brief summary of changes
|
|
365
|
+
- **$LABEL:** `context review`
|
|
366
|
+
|
|
367
|
+
Continue to completion.
|
|
368
|
+
</step>
|
|
369
|
+
|
|
370
|
+
<step name="completion">
|
|
371
|
+
Show review summary.
|
|
372
|
+
|
|
373
|
+
```
|
|
374
|
+
───────────────────────────────────────────────────────
|
|
375
|
+
Review complete: {file}
|
|
376
|
+
───────────────────────────────────────────────────────
|
|
377
|
+
|
|
378
|
+
Sections: {total}
|
|
379
|
+
- Confirmed: {N}
|
|
380
|
+
- Edited: {N}
|
|
381
|
+
- Removed: {N}
|
|
382
|
+
- Re-mapped: {N}
|
|
383
|
+
- Added: {N}
|
|
384
|
+
|
|
385
|
+
Timestamps updated:
|
|
386
|
+
- Last Reviewed: {today}
|
|
387
|
+
{If modified:} - Last Modified: {today}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
End workflow.
|
|
391
|
+
</step>
|
|
392
|
+
|
|
393
|
+
</process>
|
|
394
|
+
|
|
395
|
+
<success_criteria>
|
|
396
|
+
- User selects a context file to review
|
|
397
|
+
- Section list shown with tag status
|
|
398
|
+
- User picks which section to review (not auto-walked)
|
|
399
|
+
- Section display follows `specdacular/templates/context/section-display.md`
|
|
400
|
+
- Re-map diff display follows `specdacular/templates/context/review-diff.md`
|
|
401
|
+
- User can confirm, edit, remove, or re-map each section
|
|
402
|
+
- Edits add USER_MODIFIED tag with date
|
|
403
|
+
- Re-map accepts add AUTO_GENERATED tag with date
|
|
404
|
+
- Confirms update the tag date to today (or add AUTO_GENERATED if untagged)
|
|
405
|
+
- Removes warn about child sections
|
|
406
|
+
- Re-map spawns `specd-codebase-mapper` agent with file-type-specific focus
|
|
407
|
+
- Timestamps updated after review
|
|
408
|
+
- Changes committed
|
|
409
|
+
- Summary shown
|
|
410
|
+
</success_criteria>
|
|
@@ -1,263 +1,26 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Continue a task's lifecycle.
|
|
2
|
+
Continue a task's lifecycle. Delegates to brain.md for all flow control, state routing, mode handling, and step dispatch.
|
|
3
3
|
|
|
4
|
-
This is
|
|
5
|
-
|
|
6
|
-
**Modes:**
|
|
7
|
-
- **Interactive (default):** Prompts at each stage transition
|
|
8
|
-
- **--semi-auto:** Auto-runs discuss→research→plan, pauses after each phase execution + review
|
|
9
|
-
- **--auto:** Runs everything, only stops on review issues or task completion
|
|
4
|
+
This is a thin entry point — the brain does all the work.
|
|
10
5
|
</purpose>
|
|
11
6
|
|
|
12
7
|
<process>
|
|
13
8
|
|
|
14
|
-
<step name="
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**Parse $ARGUMENTS:**
|
|
18
|
-
- Extract task name (first argument, or only argument without --)
|
|
19
|
-
- Check for `--semi-auto` flag
|
|
20
|
-
- Check for `--auto` flag
|
|
21
|
-
- Default mode: interactive
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
Mode: {interactive | semi-auto | auto}
|
|
25
|
-
Task: {task-name}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Continue to validate.
|
|
29
|
-
</step>
|
|
30
|
-
|
|
31
|
-
<step name="validate">
|
|
32
|
-
@~/.claude/specdacular/references/validate-task.md
|
|
33
|
-
|
|
34
|
-
Use basic validation with $TASK_NAME.
|
|
35
|
-
|
|
36
|
-
Continue to load_state.
|
|
37
|
-
</step>
|
|
38
|
-
|
|
39
|
-
<step name="load_state">
|
|
40
|
-
Read current state to determine next action.
|
|
41
|
-
|
|
42
|
-
**Read:**
|
|
43
|
-
- `config.json` — stage, phases info
|
|
44
|
-
- `STATE.md` — progress checkboxes
|
|
45
|
-
- `CONTEXT.md` — gray areas remaining
|
|
46
|
-
|
|
47
|
-
**Determine current position:**
|
|
48
|
-
- stage from config.json: discussion, research, planning, execution
|
|
49
|
-
- phases.current_status: pending, executing, executed, completed
|
|
50
|
-
- Gray areas count from CONTEXT.md
|
|
51
|
-
|
|
52
|
-
Continue to determine_action.
|
|
53
|
-
</step>
|
|
54
|
-
|
|
55
|
-
<step name="determine_action">
|
|
56
|
-
Route to the appropriate action based on state.
|
|
57
|
-
|
|
58
|
-
**Routing logic:**
|
|
59
|
-
|
|
60
|
-
1. **Stage = discussion, gray areas remain:**
|
|
61
|
-
→ action_discuss
|
|
62
|
-
|
|
63
|
-
2. **Stage = discussion, no gray areas:**
|
|
64
|
-
→ action_research_or_plan
|
|
65
|
-
|
|
66
|
-
3. **Stage = research (RESEARCH.md missing):**
|
|
67
|
-
→ action_research
|
|
68
|
-
|
|
69
|
-
4. **Stage = planning (no phases exist):**
|
|
70
|
-
→ action_plan
|
|
71
|
-
|
|
72
|
-
5. **Stage = planning or execution, phases.current_status = "pending":**
|
|
73
|
-
→ action_execute
|
|
74
|
-
|
|
75
|
-
6. **Stage = execution, phases.current_status = "executing":**
|
|
76
|
-
→ action_resume_execute
|
|
77
|
-
|
|
78
|
-
7. **Stage = execution, phases.current_status = "executed":**
|
|
79
|
-
→ action_review
|
|
80
|
-
|
|
81
|
-
8. **Stage = execution, phases.current_status = "completed":**
|
|
82
|
-
Check if more phases remain:
|
|
83
|
-
- Yes → advance to next phase, → action_execute
|
|
84
|
-
- No → action_complete
|
|
85
|
-
|
|
86
|
-
Continue to the determined action step.
|
|
87
|
-
</step>
|
|
88
|
-
|
|
89
|
-
<step name="action_discuss">
|
|
90
|
-
Offer or auto-run discussion.
|
|
91
|
-
|
|
92
|
-
**Interactive mode:**
|
|
93
|
-
```
|
|
94
|
-
**Current state:** Discussion in progress
|
|
95
|
-
**Gray areas remaining:** {count}
|
|
96
|
-
|
|
97
|
-
{list gray areas}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Use AskUserQuestion:
|
|
101
|
-
- header: "Next Step"
|
|
102
|
-
- question: "Want to discuss the remaining gray areas?"
|
|
103
|
-
- options:
|
|
104
|
-
- "Discuss" — Dive into gray areas (Recommended)
|
|
105
|
-
- "Skip to research" — Move on without resolving
|
|
106
|
-
- "Skip to planning" — Jump straight to planning
|
|
107
|
-
|
|
108
|
-
**Semi-auto / Auto mode:**
|
|
109
|
-
Auto-run discuss workflow.
|
|
110
|
-
|
|
111
|
-
Dispatch to: @~/.claude/specdacular/workflows/discuss.md
|
|
112
|
-
|
|
113
|
-
After completion, return to load_state (re-evaluate).
|
|
114
|
-
</step>
|
|
115
|
-
|
|
116
|
-
<step name="action_research_or_plan">
|
|
117
|
-
Offer or auto-run research (when discussion is complete but no research yet).
|
|
118
|
-
|
|
119
|
-
**Interactive mode:**
|
|
120
|
-
```
|
|
121
|
-
**Current state:** Discussion complete, no research yet
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Use AskUserQuestion:
|
|
125
|
-
- header: "Next Step"
|
|
126
|
-
- question: "Discussion looks solid. What's next?"
|
|
127
|
-
- options:
|
|
128
|
-
- "Research" — Investigate implementation patterns (Recommended)
|
|
129
|
-
- "Skip to planning" — Plan without research
|
|
130
|
-
- "Discuss more" — Continue discussion
|
|
131
|
-
|
|
132
|
-
**Semi-auto / Auto mode:**
|
|
133
|
-
Auto-run research workflow.
|
|
134
|
-
|
|
135
|
-
Dispatch to chosen workflow. After completion, return to load_state.
|
|
136
|
-
</step>
|
|
137
|
-
|
|
138
|
-
<step name="action_research">
|
|
139
|
-
Run research.
|
|
140
|
-
|
|
141
|
-
**Interactive mode:**
|
|
142
|
-
Use AskUserQuestion:
|
|
143
|
-
- header: "Next Step"
|
|
144
|
-
- question: "Ready to research implementation patterns?"
|
|
145
|
-
- options:
|
|
146
|
-
- "Research" — Run research agents (Recommended)
|
|
147
|
-
- "Skip" — Proceed without research
|
|
148
|
-
- "Discuss first" — Go back to discussion
|
|
149
|
-
|
|
150
|
-
**Semi-auto / Auto mode:**
|
|
151
|
-
Auto-run research.
|
|
152
|
-
|
|
153
|
-
Dispatch to: @~/.claude/specdacular/workflows/research.md
|
|
154
|
-
|
|
155
|
-
After completion, return to load_state.
|
|
156
|
-
</step>
|
|
157
|
-
|
|
158
|
-
<step name="action_plan">
|
|
159
|
-
Run planning.
|
|
160
|
-
|
|
161
|
-
**Interactive mode:**
|
|
162
|
-
```
|
|
163
|
-
**Current state:** Ready to plan
|
|
164
|
-
{If RESEARCH.md exists: "Research available — will inform planning"}
|
|
165
|
-
{If no RESEARCH.md: "Note: No research. Consider running /specd:research first"}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Use AskUserQuestion:
|
|
169
|
-
- header: "Next Step"
|
|
170
|
-
- question: "Ready to create execution phases?"
|
|
171
|
-
- options:
|
|
172
|
-
- "Plan" — Create phases and PLAN.md files (Recommended)
|
|
173
|
-
- "Research first" — Run research before planning
|
|
174
|
-
- "Discuss more" — Continue discussion
|
|
175
|
-
|
|
176
|
-
**Semi-auto / Auto mode:**
|
|
177
|
-
Auto-run planning.
|
|
178
|
-
|
|
179
|
-
Dispatch to: @~/.claude/specdacular/workflows/plan.md
|
|
180
|
-
|
|
181
|
-
After completion, return to load_state.
|
|
182
|
-
</step>
|
|
183
|
-
|
|
184
|
-
<step name="action_execute">
|
|
185
|
-
Execute next phase.
|
|
186
|
-
|
|
187
|
-
**Interactive mode:**
|
|
188
|
-
```
|
|
189
|
-
**Current state:** Phase {N} ready for execution
|
|
190
|
-
**Phase:** {name} — {goal}
|
|
191
|
-
**Tasks:** {count}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Use AskUserQuestion:
|
|
195
|
-
- header: "Next Step"
|
|
196
|
-
- question: "Ready to execute Phase {N}?"
|
|
197
|
-
- options:
|
|
198
|
-
- "Execute" — Start phase execution (Recommended)
|
|
199
|
-
- "Review plan" — Read the PLAN.md first
|
|
200
|
-
- "Stop for now" — Come back later
|
|
201
|
-
|
|
202
|
-
**Semi-auto mode:**
|
|
203
|
-
Auto-execute. Review will pause for user after execution.
|
|
204
|
-
|
|
205
|
-
**Auto mode:**
|
|
206
|
-
Auto-execute. Review auto-approves if clean, stops only on issues.
|
|
207
|
-
|
|
208
|
-
Dispatch to: @~/.claude/specdacular/workflows/execute.md
|
|
209
|
-
|
|
210
|
-
Execute workflow chains to review automatically. After review completes (phase approved or stopped), return to load_state.
|
|
211
|
-
</step>
|
|
212
|
-
|
|
213
|
-
<step name="action_resume_execute">
|
|
214
|
-
Resume interrupted execution.
|
|
215
|
-
|
|
216
|
-
```
|
|
217
|
-
**Resuming:** Phase {N} execution was interrupted
|
|
218
|
-
**Phase:** {name}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Dispatch to: @~/.claude/specdacular/workflows/execute.md
|
|
222
|
-
|
|
223
|
-
The execute workflow handles finding incomplete tasks within the phase.
|
|
224
|
-
|
|
225
|
-
After completion, return to load_state.
|
|
226
|
-
</step>
|
|
227
|
-
|
|
228
|
-
<step name="action_review">
|
|
229
|
-
Phase executed, needs review.
|
|
230
|
-
|
|
231
|
-
**Interactive mode:**
|
|
232
|
-
```
|
|
233
|
-
**Current state:** Phase {N} executed, pending review
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
Dispatch to: @~/.claude/specdacular/workflows/review.md
|
|
237
|
-
|
|
238
|
-
After review completes, return to load_state.
|
|
239
|
-
|
|
240
|
-
**Semi-auto mode:**
|
|
241
|
-
Auto-trigger review. Review will prompt user for approval.
|
|
242
|
-
|
|
243
|
-
**Auto mode:**
|
|
244
|
-
Auto-trigger review. If clean, auto-approve. If issues found, stop for user.
|
|
245
|
-
</step>
|
|
246
|
-
|
|
247
|
-
<step name="action_complete">
|
|
248
|
-
All phases complete.
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
252
|
-
TASK COMPLETE
|
|
253
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
9
|
+
<step name="delegate">
|
|
10
|
+
Pass all arguments through to the brain.
|
|
254
11
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
12
|
+
The brain handles:
|
|
13
|
+
- Argument parsing (task name, --interactive/--auto flags)
|
|
14
|
+
- Task validation
|
|
15
|
+
- Pipeline resolution (pipeline.json)
|
|
16
|
+
- State-based routing
|
|
17
|
+
- Mode handling (default/interactive/auto)
|
|
18
|
+
- Hook execution
|
|
19
|
+
- Step dispatch
|
|
20
|
+
- State transitions
|
|
21
|
+
- Phase loop management
|
|
258
22
|
|
|
259
|
-
|
|
260
|
-
```
|
|
23
|
+
@~/.claude/specdacular/workflows/brain.md
|
|
261
24
|
|
|
262
25
|
End workflow.
|
|
263
26
|
</step>
|
|
@@ -265,11 +28,6 @@ End workflow.
|
|
|
265
28
|
</process>
|
|
266
29
|
|
|
267
30
|
<success_criteria>
|
|
268
|
-
-
|
|
269
|
-
-
|
|
270
|
-
- Semi-auto mode auto-advances through discuss→research→plan, pauses after phase execution + review
|
|
271
|
-
- Auto mode runs everything, stops only on review issues or completion
|
|
272
|
-
- Dispatches to correct workflow at each stage
|
|
273
|
-
- Loops back to state check after each workflow completes
|
|
274
|
-
- Handles all edge cases (interrupted execution, missing research, etc.)
|
|
31
|
+
- All arguments forwarded to brain.md
|
|
32
|
+
- Brain handles all orchestration
|
|
275
33
|
</success_criteria>
|