specdacular 0.8.1 → 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/resolve-pipeline.md +74 -0
- 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/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
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Guide the user to add new content to a codebase context file (.specd/codebase/*.md). Identifies the correct file and section, checks for duplicates, confirms placement, and writes the content with a USER_MODIFIED tag.
|
|
3
|
+
|
|
4
|
+
Output: Updated context file with new content added to the correct section.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<philosophy>
|
|
8
|
+
|
|
9
|
+
## Guide, Don't Assume
|
|
10
|
+
|
|
11
|
+
The agent suggests where content should go, but the user confirms before anything is written. Never auto-place content.
|
|
12
|
+
|
|
13
|
+
## Check for Duplicates
|
|
14
|
+
|
|
15
|
+
Before adding, search existing context files for similar content. Avoid creating duplicate documentation.
|
|
16
|
+
|
|
17
|
+
## Minimal Touch
|
|
18
|
+
|
|
19
|
+
Add the content where it belongs. Don't reorganize surrounding sections or rewrite adjacent content.
|
|
20
|
+
|
|
21
|
+
</philosophy>
|
|
22
|
+
|
|
23
|
+
<critical_rules>
|
|
24
|
+
|
|
25
|
+
## Date Format
|
|
26
|
+
|
|
27
|
+
Always write dates as `YYYY-MM-DD`. Never write times. Never write month names.
|
|
28
|
+
|
|
29
|
+
## USER_MODIFIED Tag Format
|
|
30
|
+
|
|
31
|
+
Exact format: `<!-- USER_MODIFIED: YYYY-MM-DD -->`
|
|
32
|
+
|
|
33
|
+
Placement: On its own line immediately after the section heading. No blank line between heading and tag.
|
|
34
|
+
|
|
35
|
+
If the section already has a USER_MODIFIED tag, update the date. Never add a second tag.
|
|
36
|
+
|
|
37
|
+
## Timestamp Lines
|
|
38
|
+
|
|
39
|
+
After writing content, update the document-level `Last Modified:` timestamp. If it doesn't exist, add it after `Generated:` or `**Analysis Date:**`.
|
|
40
|
+
|
|
41
|
+
</critical_rules>
|
|
42
|
+
|
|
43
|
+
<process>
|
|
44
|
+
|
|
45
|
+
<step name="validate">
|
|
46
|
+
Check that codebase context files exist.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
ls .specd/codebase/*.md 2>/dev/null
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**If no files found:**
|
|
53
|
+
```
|
|
54
|
+
No codebase context files found.
|
|
55
|
+
|
|
56
|
+
Run /specd:map-codebase to generate codebase documentation.
|
|
57
|
+
```
|
|
58
|
+
End workflow.
|
|
59
|
+
|
|
60
|
+
Continue to gather_input.
|
|
61
|
+
</step>
|
|
62
|
+
|
|
63
|
+
<step name="gather_input">
|
|
64
|
+
Ask what the user wants to add.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
What do you want to add to the codebase context?
|
|
68
|
+
|
|
69
|
+
Describe the information — I'll figure out which file and section it belongs in.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Wait for user response.
|
|
73
|
+
|
|
74
|
+
Continue to identify_target.
|
|
75
|
+
</step>
|
|
76
|
+
|
|
77
|
+
<step name="identify_target">
|
|
78
|
+
Determine where the content belongs.
|
|
79
|
+
|
|
80
|
+
**Step 1: Check for duplicates**
|
|
81
|
+
|
|
82
|
+
Search all context files for key terms from the user's description:
|
|
83
|
+
|
|
84
|
+
Use Grep to search `.specd/codebase/*.md` for the main keywords/concepts from the user's input.
|
|
85
|
+
|
|
86
|
+
**If similar content found:**
|
|
87
|
+
```
|
|
88
|
+
Similar content already exists:
|
|
89
|
+
|
|
90
|
+
**{file}** → {## Section}
|
|
91
|
+
{relevant excerpt, 2-3 lines}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Use AskUserQuestion:
|
|
95
|
+
- header: "Duplicate?"
|
|
96
|
+
- question: "Similar content exists. What would you like to do?"
|
|
97
|
+
- options:
|
|
98
|
+
- "Add anyway" — Add as new content in the best location
|
|
99
|
+
- "Update existing" — Modify the existing section instead
|
|
100
|
+
- "Cancel" — Don't add anything
|
|
101
|
+
|
|
102
|
+
If "Update existing": Switch to edit mode — show the existing section and ask what to change. Apply edit, add USER_MODIFIED tag. Continue to update_timestamps.
|
|
103
|
+
|
|
104
|
+
If "Cancel": End workflow.
|
|
105
|
+
|
|
106
|
+
**Step 2: Identify best file**
|
|
107
|
+
|
|
108
|
+
Based on the content type, determine the target file:
|
|
109
|
+
- **MAP.md** — Entry points, modules, functions, integrations, data flow
|
|
110
|
+
- **PATTERNS.md** — Code patterns, conventions, examples to follow
|
|
111
|
+
- **STRUCTURE.md** — Directory layout, where to put new files, naming conventions
|
|
112
|
+
- **CONCERNS.md** — Gotchas, anti-patterns, tech debt, fragile areas, warnings
|
|
113
|
+
|
|
114
|
+
**Step 3: Identify best section**
|
|
115
|
+
|
|
116
|
+
Read the target file. Determine which existing section the content fits under. If no existing section is appropriate, propose creating a new section.
|
|
117
|
+
|
|
118
|
+
Continue to confirm_placement.
|
|
119
|
+
</step>
|
|
120
|
+
|
|
121
|
+
<step name="confirm_placement">
|
|
122
|
+
Show the user where content will be placed and get confirmation.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
I'll add this to:
|
|
126
|
+
|
|
127
|
+
**File:** {file}
|
|
128
|
+
**Section:** {## Section} → {### Subsection if applicable}
|
|
129
|
+
{If new section: "New section: ## {proposed title}"}
|
|
130
|
+
|
|
131
|
+
**Content to add:**
|
|
132
|
+
|
|
133
|
+
{formatted content that will be written}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Use AskUserQuestion:
|
|
137
|
+
- header: "Placement"
|
|
138
|
+
- question: "Add content here?"
|
|
139
|
+
- options:
|
|
140
|
+
- "Confirm" — Add it here
|
|
141
|
+
- "Different section" — Show me other options
|
|
142
|
+
- "Cancel" — Don't add
|
|
143
|
+
|
|
144
|
+
**If "Different section":**
|
|
145
|
+
Show all sections across all 4 files as options:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Available sections:
|
|
149
|
+
|
|
150
|
+
MAP.md:
|
|
151
|
+
## Entry Points
|
|
152
|
+
## Core Modules
|
|
153
|
+
...
|
|
154
|
+
|
|
155
|
+
PATTERNS.md:
|
|
156
|
+
## Workflow/Command Pattern
|
|
157
|
+
...
|
|
158
|
+
|
|
159
|
+
STRUCTURE.md:
|
|
160
|
+
## Directory Layout
|
|
161
|
+
...
|
|
162
|
+
|
|
163
|
+
CONCERNS.md:
|
|
164
|
+
## Gotchas
|
|
165
|
+
## Anti-patterns
|
|
166
|
+
...
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Use AskUserQuestion to let user pick from available sections, or type a custom section name.
|
|
170
|
+
|
|
171
|
+
**If "Cancel":** End workflow.
|
|
172
|
+
|
|
173
|
+
Continue to write_content.
|
|
174
|
+
</step>
|
|
175
|
+
|
|
176
|
+
<step name="write_content">
|
|
177
|
+
Insert content at the chosen location.
|
|
178
|
+
|
|
179
|
+
1. **If adding to existing section:**
|
|
180
|
+
- Append the new content at the end of the section (before the next heading)
|
|
181
|
+
- Add or update `<!-- USER_MODIFIED: {today} -->` after the section heading
|
|
182
|
+
|
|
183
|
+
2. **If creating new section:**
|
|
184
|
+
- Add the new `##` or `###` heading at an appropriate location in the file
|
|
185
|
+
- Add `<!-- USER_MODIFIED: {today} -->` on the line after the heading
|
|
186
|
+
- Add the content below
|
|
187
|
+
|
|
188
|
+
Use the Edit tool to make the changes.
|
|
189
|
+
|
|
190
|
+
Continue to update_timestamps.
|
|
191
|
+
</step>
|
|
192
|
+
|
|
193
|
+
<step name="update_timestamps">
|
|
194
|
+
Update the document-level timestamps.
|
|
195
|
+
|
|
196
|
+
1. Read the first 5 lines of the file
|
|
197
|
+
2. Set `Last Modified: {today}`
|
|
198
|
+
3. If the line doesn't exist, add it after `Generated:` or `**Analysis Date:**`
|
|
199
|
+
|
|
200
|
+
Continue to commit.
|
|
201
|
+
</step>
|
|
202
|
+
|
|
203
|
+
<step name="commit">
|
|
204
|
+
@~/.claude/specdacular/references/commit-docs.md
|
|
205
|
+
|
|
206
|
+
- **$FILES:** `.specd/codebase/{file}`
|
|
207
|
+
- **$MESSAGE:** `docs: add to {file} — {brief description of what was added}`
|
|
208
|
+
- **$LABEL:** `context addition`
|
|
209
|
+
|
|
210
|
+
Continue to completion.
|
|
211
|
+
</step>
|
|
212
|
+
|
|
213
|
+
<step name="completion">
|
|
214
|
+
Show what was added.
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
───────────────────────────────────────────────────────
|
|
218
|
+
Content added to: {file}
|
|
219
|
+
───────────────────────────────────────────────────────
|
|
220
|
+
|
|
221
|
+
**Section:** {section heading}
|
|
222
|
+
**Tagged:** USER_MODIFIED: {today}
|
|
223
|
+
**Last Modified:** updated to {today}
|
|
224
|
+
|
|
225
|
+
{Brief summary of what was added}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
End workflow.
|
|
229
|
+
</step>
|
|
230
|
+
|
|
231
|
+
</process>
|
|
232
|
+
|
|
233
|
+
<success_criteria>
|
|
234
|
+
- User describes what to add
|
|
235
|
+
- Duplicate check performed across all context files
|
|
236
|
+
- Target file and section identified
|
|
237
|
+
- User confirms placement before writing
|
|
238
|
+
- Content written with USER_MODIFIED tag
|
|
239
|
+
- Last Modified timestamp updated
|
|
240
|
+
- Changes committed
|
|
241
|
+
- Summary shown
|
|
242
|
+
</success_criteria>
|
|
@@ -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>
|