@leeovery/claude-technical-workflows 2.0.28 → 2.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,210 @@
1
+ #!/bin/bash
2
+ #
3
+ # discover-spec-state.sh
4
+ #
5
+ # Discovers the current state of discussions, specifications, and cache
6
+ # for the workflow:start-specification command.
7
+ #
8
+ # Outputs structured YAML that the command can consume directly.
9
+ #
10
+
11
+ set -eo pipefail
12
+
13
+ DISCUSSION_DIR="docs/workflow/discussion"
14
+ SPEC_DIR="docs/workflow/specification"
15
+ CACHE_FILE="docs/workflow/.cache/discussion-consolidation-analysis.md"
16
+
17
+ # Helper: Extract a frontmatter field value from a file
18
+ # Usage: extract_field <file> <field_name>
19
+ extract_field() {
20
+ local file="$1"
21
+ local field="$2"
22
+ # Read until --- (end of frontmatter), find field, extract value
23
+ # Use grep -m1 and || true to handle no match gracefully
24
+ sed -n '/^---$/,/^---$/p' "$file" 2>/dev/null | \
25
+ grep -m1 "^${field}:" | \
26
+ sed "s/^${field}:[[:space:]]*//" || true
27
+ }
28
+
29
+ # Helper: Extract array field from frontmatter (returns space-separated values)
30
+ # Usage: extract_array_field <file> <field_name>
31
+ extract_array_field() {
32
+ local file="$1"
33
+ local field="$2"
34
+ local result
35
+ # Look for field followed by array items (- item), excluding --- delimiters
36
+ result=$(sed -n '/^---$/,/^---$/p' "$file" 2>/dev/null | \
37
+ grep -v "^---$" | \
38
+ sed -n "/^${field}:/,/^[a-z_]*:/p" | \
39
+ grep "^[[:space:]]*-" | \
40
+ sed 's/^[[:space:]]*-[[:space:]]*//' | \
41
+ tr '\n' ' ' | \
42
+ sed 's/[[:space:]]*$//' || true)
43
+ echo "$result"
44
+ }
45
+
46
+ # Start YAML output
47
+ echo "# Specification Command State Discovery"
48
+ echo "# Generated: $(date -Iseconds)"
49
+ echo ""
50
+
51
+ #
52
+ # DISCUSSIONS
53
+ #
54
+ echo "discussions:"
55
+
56
+ if [ -d "$DISCUSSION_DIR" ] && [ -n "$(ls -A "$DISCUSSION_DIR" 2>/dev/null)" ]; then
57
+ for file in "$DISCUSSION_DIR"/*.md; do
58
+ [ -f "$file" ] || continue
59
+
60
+ name=$(basename "$file" .md)
61
+ status=$(extract_field "$file" "status")
62
+ status=${status:-"unknown"}
63
+
64
+ # Check if this discussion has a corresponding individual spec
65
+ has_individual_spec="false"
66
+ if [ -f "$SPEC_DIR/${name}.md" ]; then
67
+ has_individual_spec="true"
68
+ fi
69
+
70
+ echo " - name: \"$name\""
71
+ echo " status: \"$status\""
72
+ echo " has_individual_spec: $has_individual_spec"
73
+ done
74
+ else
75
+ echo " [] # No discussions found"
76
+ fi
77
+
78
+ echo ""
79
+
80
+ #
81
+ # SPECIFICATIONS
82
+ #
83
+ echo "specifications:"
84
+
85
+ if [ -d "$SPEC_DIR" ] && [ -n "$(ls -A "$SPEC_DIR" 2>/dev/null)" ]; then
86
+ for file in "$SPEC_DIR"/*.md; do
87
+ [ -f "$file" ] || continue
88
+
89
+ name=$(basename "$file" .md)
90
+ status=$(extract_field "$file" "status")
91
+ status=${status:-"active"}
92
+
93
+ superseded_by=$(extract_field "$file" "superseded_by")
94
+ sources=$(extract_array_field "$file" "sources")
95
+
96
+ echo " - name: \"$name\""
97
+ echo " status: \"$status\""
98
+
99
+ if [ -n "$superseded_by" ]; then
100
+ echo " superseded_by: \"$superseded_by\""
101
+ fi
102
+
103
+ if [ -n "$sources" ]; then
104
+ echo " sources:"
105
+ for src in $sources; do
106
+ echo " - \"$src\""
107
+ done
108
+ fi
109
+ done
110
+ else
111
+ echo " [] # No specifications found"
112
+ fi
113
+
114
+ echo ""
115
+
116
+ #
117
+ # CACHE STATE
118
+ #
119
+ echo "cache:"
120
+
121
+ if [ -f "$CACHE_FILE" ]; then
122
+ echo " exists: true"
123
+
124
+ cached_checksum=$(extract_field "$CACHE_FILE" "checksum")
125
+ cached_date=$(extract_field "$CACHE_FILE" "generated")
126
+
127
+ echo " cached_checksum: \"${cached_checksum:-unknown}\""
128
+ echo " cached_date: \"${cached_date:-unknown}\""
129
+
130
+ # Extract anchored names (groupings that have existing specs)
131
+ # These are the grouping names from the cache that have corresponding specs
132
+ echo " anchored_names:"
133
+
134
+ # Parse the cache file for grouping names (### Name format)
135
+ # and check if a spec exists for each
136
+ anchored_found=false
137
+ while IFS= read -r grouping_name; do
138
+ # Clean the name (remove any trailing annotations, lowercase, spaces to hyphens)
139
+ clean_name=$(echo "$grouping_name" | sed 's/[[:space:]]*(.*)//' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
140
+ if [ -f "$SPEC_DIR/${clean_name}.md" ]; then
141
+ echo " - \"$clean_name\""
142
+ anchored_found=true
143
+ fi
144
+ done < <(grep "^### " "$CACHE_FILE" 2>/dev/null | sed 's/^### //' || true)
145
+
146
+ if [ "$anchored_found" = false ]; then
147
+ echo " [] # No anchored names found"
148
+ fi
149
+ else
150
+ echo " exists: false"
151
+ echo " cached_checksum: null"
152
+ echo " cached_date: null"
153
+ echo " anchored_names: []"
154
+ fi
155
+
156
+ echo ""
157
+
158
+ #
159
+ # CURRENT CHECKSUM
160
+ #
161
+ echo "current_state:"
162
+
163
+ if [ -d "$DISCUSSION_DIR" ] && [ -n "$(ls -A "$DISCUSSION_DIR" 2>/dev/null)" ]; then
164
+ # Compute checksum of all discussion files (deterministic via sorted glob)
165
+ current_checksum=$(cat "$DISCUSSION_DIR"/*.md 2>/dev/null | md5sum | cut -d' ' -f1)
166
+ echo " discussions_checksum: \"$current_checksum\""
167
+
168
+ # Count concluded discussions
169
+ concluded_count=0
170
+ for file in "$DISCUSSION_DIR"/*.md; do
171
+ [ -f "$file" ] || continue
172
+ status=$(extract_field "$file" "status")
173
+ if [ "$status" = "concluded" ]; then
174
+ concluded_count=$((concluded_count + 1))
175
+ fi
176
+ done
177
+ echo " concluded_discussion_count: $concluded_count"
178
+ else
179
+ echo " discussions_checksum: null"
180
+ echo " concluded_discussion_count: 0"
181
+ fi
182
+
183
+ echo ""
184
+
185
+ #
186
+ # CHECKSUM COMPARISON
187
+ #
188
+ echo "cache_validity:"
189
+
190
+ if [ -f "$CACHE_FILE" ]; then
191
+ cached_checksum=$(extract_field "$CACHE_FILE" "checksum")
192
+
193
+ if [ -d "$DISCUSSION_DIR" ] && [ -n "$(ls -A "$DISCUSSION_DIR" 2>/dev/null)" ]; then
194
+ current_checksum=$(cat "$DISCUSSION_DIR"/*.md 2>/dev/null | md5sum | cut -d' ' -f1)
195
+
196
+ if [ "$cached_checksum" = "$current_checksum" ]; then
197
+ echo " is_valid: true"
198
+ echo " reason: \"checksums match\""
199
+ else
200
+ echo " is_valid: false"
201
+ echo " reason: \"discussions have changed since cache was generated\""
202
+ fi
203
+ else
204
+ echo " is_valid: false"
205
+ echo " reason: \"no discussions to compare\""
206
+ fi
207
+ else
208
+ echo " is_valid: false"
209
+ echo " reason: \"no cache exists\""
210
+ fi
@@ -38,6 +38,18 @@ Either way: Transform unvalidated reference material into a specification that's
38
38
 
39
39
  **When complete**: User signs off on the specification.
40
40
 
41
+ ### Post-Completion: Handle Source Specifications
42
+
43
+ If any of your sources were **existing specifications** (as opposed to discussions, research, or other reference material), these have now been consolidated into the new specification.
44
+
45
+ After user signs off:
46
+ 1. Mark each source specification as superseded by updating its frontmatter:
47
+ ```yaml
48
+ status: superseded
49
+ superseded_by: {new-specification-name}
50
+ ```
51
+ 2. Inform the user which files were updated
52
+
41
53
  ## CRITICAL: You Do NOT Create or Update the Specification Autonomously
42
54
 
43
55
  **This is a collaborative, interactive process. You MUST wait for explicit user approval before writing ANYTHING to the specification file.**
@@ -1,15 +0,0 @@
1
- ---
2
- description: "[DEPRECATED] Use /workflow:start-discussion instead"
3
- ---
4
-
5
- # Deprecated Command
6
-
7
- ⚠️ **`/start-discussion` is deprecated.** Use `/workflow:start-discussion` instead.
8
-
9
- The command has been renamed to use the `workflow:` prefix to distinguish workflow commands from standalone commands.
10
-
11
- ---
12
-
13
- **Forwarding to `/workflow:start-discussion`...**
14
-
15
- Run the `/workflow:start-discussion` command now.
@@ -1,15 +0,0 @@
1
- ---
2
- description: "[DEPRECATED] Use /workflow:start-implementation instead"
3
- ---
4
-
5
- # Deprecated Command
6
-
7
- ⚠️ **`/start-implementation` is deprecated.** Use `/workflow:start-implementation` instead.
8
-
9
- The command has been renamed to use the `workflow:` prefix to distinguish workflow commands from standalone commands.
10
-
11
- ---
12
-
13
- **Forwarding to `/workflow:start-implementation`...**
14
-
15
- Run the `/workflow:start-implementation` command now.
@@ -1,15 +0,0 @@
1
- ---
2
- description: "[DEPRECATED] Use /workflow:start-planning instead"
3
- ---
4
-
5
- # Deprecated Command
6
-
7
- ⚠️ **`/start-planning` is deprecated.** Use `/workflow:start-planning` instead.
8
-
9
- The command has been renamed to use the `workflow:` prefix to distinguish workflow commands from standalone commands.
10
-
11
- ---
12
-
13
- **Forwarding to `/workflow:start-planning`...**
14
-
15
- Run the `/workflow:start-planning` command now.
@@ -1,15 +0,0 @@
1
- ---
2
- description: "[DEPRECATED] Use /workflow:start-research instead"
3
- ---
4
-
5
- # Deprecated Command
6
-
7
- ⚠️ **`/start-research` is deprecated.** Use `/workflow:start-research` instead.
8
-
9
- The command has been renamed to use the `workflow:` prefix to distinguish workflow commands from standalone commands.
10
-
11
- ---
12
-
13
- **Forwarding to `/workflow:start-research`...**
14
-
15
- Run the `/workflow:start-research` command now.
@@ -1,15 +0,0 @@
1
- ---
2
- description: "[DEPRECATED] Use /workflow:start-specification instead"
3
- ---
4
-
5
- # Deprecated Command
6
-
7
- ⚠️ **`/start-specification` is deprecated.** Use `/workflow:start-specification` instead.
8
-
9
- The command has been renamed to use the `workflow:` prefix to distinguish workflow commands from standalone commands.
10
-
11
- ---
12
-
13
- **Forwarding to `/workflow:start-specification`...**
14
-
15
- Run the `/workflow:start-specification` command now.
@@ -1,304 +0,0 @@
1
- ---
2
- description: Start a specification session from existing discussions. Discovers available discussions, offers consolidation assessment for multiple discussions, and invokes the technical-specification skill.
3
- ---
4
-
5
- Invoke the **technical-specification** skill for this conversation.
6
-
7
- ## Workflow Context
8
-
9
- This is **Phase 3** of the six-phase workflow:
10
-
11
- | Phase | Focus | You |
12
- |-------|-------|-----|
13
- | 1. Research | EXPLORE - ideas, feasibility, market, business | |
14
- | 2. Discussion | WHAT and WHY - decisions, architecture, edge cases | |
15
- | **3. Specification** | REFINE - validate into standalone spec | ◀ HERE |
16
- | 4. Planning | HOW - phases, tasks, acceptance criteria | |
17
- | 5. Implementation | DOING - tests first, then code | |
18
- | 6. Review | VALIDATING - check work against artifacts | |
19
-
20
- **Stay in your lane**: Validate and refine discussion content into standalone specifications. Don't jump to planning, phases, tasks, or code. The specification is the "line in the sand" - everything after this has hard dependencies on it.
21
-
22
- ---
23
-
24
- ## Instructions
25
-
26
- Follow these steps EXACTLY as written. Do not skip steps or combine them. Present output using the EXACT format shown in examples - do not simplify or alter the formatting.
27
-
28
- Before beginning, discover existing work and gather necessary information.
29
-
30
- ## Important
31
-
32
- Use simple, individual commands. Never combine multiple operations into bash loops or one-liners. Execute commands one at a time.
33
-
34
- ## Step 1: Discover Existing Work
35
-
36
- Scan the codebase for discussions and specifications:
37
-
38
- 1. **Find discussions**: Look in `docs/workflow/discussion/`
39
- - Run `ls docs/workflow/discussion/` to list discussion files
40
- - Each file is named `{topic}.md`
41
-
42
- 2. **Check discussion status**: For each discussion file
43
- - Run `head -20 docs/workflow/discussion/{topic}.md` to read the frontmatter and extract the `status:` field
44
- - Do NOT use bash loops - run separate `head` commands for each topic
45
-
46
- 3. **Check for existing specifications**: Look in `docs/workflow/specification/`
47
- - Identify discussions that don't have corresponding specifications
48
-
49
- 4. **Check for cached consolidation analysis** (if multiple discussions):
50
- - Check if `docs/workflow/.cache/discussion-consolidation-analysis.md` exists
51
- - If it exists, read it to get the stored checksum from the frontmatter
52
-
53
- 5. **Compute current discussions checksum** (if multiple concluded discussions):
54
- - Run exactly: `cat docs/workflow/discussion/*.md 2>/dev/null | md5sum | cut -d' ' -f1`
55
- - IMPORTANT: Use this exact command - glob expansion is alphabetically sorted by default
56
- - Do NOT modify or "simplify" this command - checksum must be deterministic
57
- - Store this value to compare with the cached checksum
58
-
59
- ## Step 2: Check Prerequisites
60
-
61
- **If no discussions exist:**
62
-
63
- ```
64
- No discussions found in docs/workflow/discussion/
65
-
66
- The specification phase requires a completed discussion. Please run /workflow:start-discussion first to document the technical decisions, edge cases, and rationale before creating a specification.
67
- ```
68
-
69
- Stop here and wait for the user to acknowledge.
70
-
71
- ## Step 3: Present Options
72
-
73
- Show what you found:
74
-
75
- ```
76
- Discussions found:
77
- {topic-1} - Concluded - ready for specification
78
- {topic-2} - Exploring - not ready for specification
79
- {topic-3} - Concluded - specification exists
80
- ```
81
-
82
- **Important:** Only concluded discussions should proceed to specification. If a discussion is still exploring, advise the user to complete the discussion phase first.
83
-
84
- **If only ONE concluded discussion is ready:** Skip to Step 4 (single-source path).
85
-
86
- **If MORE THAN ONE concluded discussion is ready:** Proceed to Step 3A (consolidation assessment).
87
-
88
- ---
89
-
90
- ## Step 3A: Consolidation Assessment (Multiple Discussions)
91
-
92
- When multiple concluded discussions exist, offer to assess how they should be organized into specifications.
93
-
94
- ```
95
- You have {N} concluded discussions ready for specification.
96
-
97
- Would you like me to assess how these might be combined into specifications?
98
-
99
- 1. **Yes, assess them** - I'll analyze all discussions for natural groupings
100
- 2. **No, proceed individually** - Create specifications 1:1 with discussions
101
-
102
- Which approach?
103
- ```
104
-
105
- **If user chooses individual:** Skip to Step 4 and ask which discussion to specify.
106
-
107
- **If user chooses assessment:** Proceed to Step 3A.1.
108
-
109
- ### Step 3A.1: Gather Context for Analysis
110
-
111
- Before analyzing, ask:
112
-
113
- ```
114
- Before I analyze the discussions, is there anything about your project structure or how these topics relate that would help me group them appropriately?
115
- ```
116
-
117
- Wait for response.
118
-
119
- ### Step 3A.2: Check Cache Validity
120
-
121
- Compare the current discussions checksum (computed in Step 1.5) with the cached checksum:
122
-
123
- **If cache exists AND checksums match:**
124
- ```
125
- Using cached analysis
126
-
127
- Discussion documents unchanged since last analysis ({date from cache}).
128
- Loading previously identified groupings...
129
-
130
- To force a fresh analysis, enter: refresh
131
- ```
132
-
133
- Then load the groupings from the cache file and skip to Step 3A.4 (Present Options).
134
-
135
- **If cache missing OR checksums differ:**
136
- ```
137
- Analyzing discussions...
138
- ```
139
-
140
- Proceed to Step 3A.3 (Full Analysis).
141
-
142
- ### Step 3A.3: Full Analysis (when cache invalid)
143
-
144
- **This step is critical. You MUST read every concluded discussion document thoroughly.**
145
-
146
- For each concluded discussion:
147
- 1. Read the ENTIRE document (not just frontmatter)
148
- 2. Understand the decisions, systems, and concepts it defines
149
- 3. Note dependencies on or references to other discussions
150
- 4. Identify shared data structures, entities, or behaviors
151
-
152
- Then analyze coupling between discussions:
153
- - **Data coupling**: Discussions that define or depend on the same data structures
154
- - **Behavioral coupling**: Discussions where one's implementation requires another
155
- - **Conceptual coupling**: Discussions that address different facets of the same problem
156
-
157
- Group discussions that are tightly coupled - they should become a single specification because their decisions are inseparable.
158
-
159
- **Save to cache:**
160
- After analysis, ensure `.cache` directory exists: `mkdir -p docs/workflow/.cache`
161
-
162
- Create/update `docs/workflow/.cache/discussion-consolidation-analysis.md`:
163
-
164
- ```markdown
165
- ---
166
- checksum: {computed_checksum}
167
- generated: {ISO date}
168
- discussion_files:
169
- - {topic1}.md
170
- - {topic2}.md
171
- ---
172
-
173
- # Discussion Consolidation Analysis
174
-
175
- ## Recommended Groupings
176
-
177
- ### {Suggested Specification Name}
178
- - **{topic-a}**: {why it belongs in this group}
179
- - **{topic-b}**: {why it belongs in this group}
180
- - **{topic-c}**: {why it belongs in this group}
181
-
182
- **Coupling**: {Brief explanation of what binds these together - shared data, dependencies, etc.}
183
-
184
- ### {Another Specification Name}
185
- - **{topic-d}**: {why it belongs}
186
- - **{topic-e}**: {why it belongs}
187
-
188
- **Coupling**: {Brief explanation}
189
-
190
- ## Independent Discussions
191
- - **{topic-f}**: {Why this stands alone - no strong coupling to others}
192
-
193
- ## Analysis Notes
194
- {Any additional context about the relationships discovered}
195
- ```
196
-
197
- ### Step 3A.4: Present Options
198
-
199
- Present the analysis and options:
200
-
201
- **If using cached analysis:**
202
- ```
203
- Cached analysis (discussions unchanged since {date})
204
-
205
- {Display the Recommended Groupings section from cache}
206
-
207
- How would you like to proceed?
208
-
209
- 1. **Combine as recommended** - Create specifications per the groupings above
210
- 2. **Combine differently** - Tell me your preferred groupings
211
- 3. **Single specification** - Consolidate all discussions into one spec
212
- 4. **Individual specifications** - Create 1:1 (I'll ask which to start with)
213
-
214
- (Or enter 'refresh' to re-analyze)
215
- ```
216
-
217
- **If fresh analysis:**
218
- ```
219
- Analysis complete (cached for future sessions)
220
-
221
- {Display the Recommended Groupings section}
222
-
223
- How would you like to proceed?
224
-
225
- 1. **Combine as recommended** - Create specifications per the groupings above
226
- 2. **Combine differently** - Tell me your preferred groupings
227
- 3. **Single specification** - Consolidate all discussions into one spec
228
- 4. **Individual specifications** - Create 1:1 (I'll ask which to start with)
229
- ```
230
-
231
- Wait for user to choose.
232
-
233
- ### Step 3A.5: Handle Choices
234
-
235
- **If "Combine as recommended":**
236
- - Confirm the first specification to create
237
- - Proceed to Step 4 with the grouped sources
238
-
239
- **If "Combine differently":**
240
- - Ask user to describe their preferred groupings
241
- - Confirm understanding
242
- - Proceed to Step 4 with user-specified sources
243
-
244
- **If "Single specification":**
245
- - Use "unified" as the specification name (output: `docs/workflow/specification/unified.md`)
246
- - Proceed to Step 4 with all discussions as sources
247
-
248
- **If "Individual specifications":**
249
- - Ask which discussion to specify first
250
- - Proceed to Step 4 with single source
251
-
252
- **If "refresh":**
253
- - Delete the cache file: `rm docs/workflow/.cache/discussion-consolidation-analysis.md`
254
- - Return to Step 3A.3 (Full Analysis)
255
- - Inform user: "Refreshing analysis..."
256
-
257
- ---
258
-
259
- ## Step 4: Gather Additional Context
260
-
261
- Ask:
262
- - Any additional context or priorities to consider?
263
- - Any constraints or changes since the discussion(s) concluded?
264
- - Are there any existing partial plans or related documentation I should review?
265
-
266
- ## Step 5: Invoke the Skill
267
-
268
- After completing the steps above, this command's purpose is fulfilled.
269
-
270
- Invoke the [technical-specification](../skills/technical-specification/SKILL.md) skill for your next instructions. Do not act on the gathered information until the skill is loaded - it contains the instructions for how to proceed.
271
-
272
- **Example handoff (single source):**
273
- ```
274
- Specification session for: {topic}
275
- Source: docs/workflow/discussion/{topic}.md
276
- Output: docs/workflow/specification/{topic}.md
277
- Additional context: {summary of user's answers from Step 4}
278
-
279
- Invoke the technical-specification skill.
280
- ```
281
-
282
- **Example handoff (multiple sources):**
283
- ```
284
- Specification session for: {specification-name}
285
-
286
- Sources:
287
- - docs/workflow/discussion/{topic-1}.md
288
- - docs/workflow/discussion/{topic-2}.md
289
- - docs/workflow/discussion/{topic-3}.md
290
-
291
- Output: docs/workflow/specification/{specification-name}.md
292
- Additional context: {summary of user's answers from Step 4}
293
-
294
- Invoke the technical-specification skill.
295
- ```
296
-
297
- ---
298
-
299
- ## Notes
300
-
301
- - Ask questions clearly and wait for responses before proceeding
302
- - The specification phase validates and refines discussion content into standalone documents
303
- - When multiple sources are provided, the skill will extract exhaustively from ALL of them
304
- - Attribution in the specification should trace content back to its source discussion(s)