@devobsessed/code-captain 0.0.3

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.
Files changed (55) hide show
  1. package/README.md +214 -0
  2. package/bin/install.js +1048 -0
  3. package/claude-code/README.md +276 -0
  4. package/claude-code/agents/code-captain.md +121 -0
  5. package/claude-code/agents/spec-generator.md +271 -0
  6. package/claude-code/agents/story-creator.md +309 -0
  7. package/claude-code/agents/tech-spec.md +440 -0
  8. package/claude-code/commands/cc-initialize.md +520 -0
  9. package/copilot/README.md +210 -0
  10. package/copilot/chatmodes/Code Captain.chatmode.md +60 -0
  11. package/copilot/docs/best-practices.md +74 -0
  12. package/copilot/prompts/create-adr.prompt.md +468 -0
  13. package/copilot/prompts/create-spec.prompt.md +430 -0
  14. package/copilot/prompts/edit-spec.prompt.md +396 -0
  15. package/copilot/prompts/execute-task.prompt.md +144 -0
  16. package/copilot/prompts/explain-code.prompt.md +292 -0
  17. package/copilot/prompts/initialize.prompt.md +65 -0
  18. package/copilot/prompts/new-command.prompt.md +310 -0
  19. package/copilot/prompts/plan-product.prompt.md +450 -0
  20. package/copilot/prompts/research.prompt.md +329 -0
  21. package/copilot/prompts/status.prompt.md +424 -0
  22. package/copilot/prompts/swab.prompt.md +217 -0
  23. package/cursor/README.md +224 -0
  24. package/cursor/cc.md +183 -0
  25. package/cursor/cc.mdc +69 -0
  26. package/cursor/commands/create-adr.md +504 -0
  27. package/cursor/commands/create-spec.md +430 -0
  28. package/cursor/commands/edit-spec.md +405 -0
  29. package/cursor/commands/execute-task.md +514 -0
  30. package/cursor/commands/explain-code.md +289 -0
  31. package/cursor/commands/initialize.md +397 -0
  32. package/cursor/commands/new-command.md +312 -0
  33. package/cursor/commands/plan-product.md +466 -0
  34. package/cursor/commands/research.md +317 -0
  35. package/cursor/commands/status.md +413 -0
  36. package/cursor/commands/swab.md +209 -0
  37. package/cursor/docs/best-practices.md +74 -0
  38. package/cursor/integrations/azure-devops/create-azure-work-items.md +403 -0
  39. package/cursor/integrations/azure-devops/sync-azure-work-items.md +486 -0
  40. package/cursor/integrations/github/create-github-issues.md +765 -0
  41. package/cursor/integrations/github/scripts/create-issues-batch.sh +272 -0
  42. package/cursor/integrations/github/sync-github-issues.md +237 -0
  43. package/cursor/integrations/github/sync.md +305 -0
  44. package/manifest.json +381 -0
  45. package/package.json +58 -0
  46. package/windsurf/README.md +254 -0
  47. package/windsurf/rules/cc.md +5 -0
  48. package/windsurf/workflows/create-adr.md +331 -0
  49. package/windsurf/workflows/create-spec.md +280 -0
  50. package/windsurf/workflows/edit-spec.md +273 -0
  51. package/windsurf/workflows/execute-task.md +276 -0
  52. package/windsurf/workflows/explain-code.md +292 -0
  53. package/windsurf/workflows/initialize.md +298 -0
  54. package/windsurf/workflows/new-command.md +321 -0
  55. package/windsurf/workflows/status.md +213 -0
@@ -0,0 +1,280 @@
1
+ ---
2
+ description: Generate comprehensive feature specifications using contract-first approach with complete alignment before file creation
3
+ ---
4
+
5
+ # Create Spec Workflow
6
+
7
+ ## Overview
8
+ Generate comprehensive feature specifications using a contract-first approach that ensures complete alignment between developer and AI before creating any supporting files. This eliminates presumptuous file creation by establishing a clear "contract" through structured clarification rounds.
9
+
10
+ ## Command Process
11
+
12
+ ### Phase 1: Contract Establishment (No File Creation)
13
+
14
+ **Mission Statement:**
15
+ > Turn rough feature ideas into clear work specifications. Deliver the complete spec package only after both parties agree on the requirements contract. **Challenge ideas that don't make technical or business sense - better to surface concerns early than build the wrong thing.**
16
+
17
+ #### Step 1.1: Initial Context Scan
18
+ - Use `find_by_name` to scan existing `.code-captain/specs/` for related specifications
19
+ - Use `codebase_search` to analyze current architecture and patterns
20
+ - Use `view_file` to load project context files (`tech-stack.md`, `code-style.md`, `objective.md`)
21
+ - **Output:** Context summary (no files created yet)
22
+
23
+ #### Step 1.2: Gap Analysis & Silent Enumeration
24
+ **Internal Process (not shown to user):**
25
+ - Silently list every missing fact, constraint, or requirement
26
+ - Identify ambiguities in the initial description
27
+ - Note potential integration points and dependencies
28
+ - Catalog unknowns across domains:
29
+ - Purpose & business value
30
+ - Target audience & user personas
31
+ - Technical constraints & requirements
32
+ - Success criteria & acceptance tests
33
+ - Scope boundaries (in/out of scope)
34
+ - UI/UX requirements & design constraints
35
+ - Performance & scalability needs
36
+ - Security & compliance requirements
37
+ - Integration points with existing systems
38
+ - Risk tolerance & implementation approach
39
+
40
+ #### Step 1.3: Structured Clarification Loop
41
+ **Rules:**
42
+ - Ask ONE focused question at a time
43
+ - After each answer, re-scan codebase with `codebase_search` for new context if relevant
44
+ - Continue until reaching 95% confidence on deliverable
45
+ - Each question should target the highest-impact unknown
46
+ - **Never declare "final question"** - let the conversation flow naturally
47
+ - Let the user signal when they're ready to lock the contract
48
+ - **Challenge ideas that don't make technical or business sense**
49
+
50
+ **Critical Analysis Responsibility:**
51
+ - Challenge technically infeasible requirements; suggest alternatives
52
+ - Break down overly large scope into focused features
53
+ - Point out conflicts with existing codebase patterns
54
+ - Surface performance/security/scalability concerns proactively
55
+
56
+ **Question Categories:**
57
+ - "What specific user problem does this solve, and who experiences it?"
58
+ - "Should this integrate with [existing system], or remain separate?"
59
+ - "What does 'success' look like - how will we measure if this works?"
60
+ - "Are there performance requirements (response time, throughput, scale)?"
61
+ - "What UI/UX constraints exist - web only, mobile responsive, accessibility?"
62
+ - "What's your risk tolerance - stable/proven vs cutting-edge solutions?"
63
+
64
+ #### Step 1.4: Echo Check (Contract Proposal)
65
+ When confident, present a contract proposal with any concerns surfaced:
66
+
67
+ ```
68
+ ## Specification Contract
69
+
70
+ **Deliverable:** [One clear sentence describing what will be built]
71
+
72
+ **Must Include:** [Critical requirement that makes this valuable]
73
+
74
+ **Hardest Constraint:** [Biggest technical/business limitation to navigate]
75
+
76
+ **Success Criteria:** [How we'll know it's working correctly]
77
+
78
+ **Scope Boundaries:**
79
+ - In Scope: [2-3 key features]
80
+ - Out of Scope: [2-3 things we won't build]
81
+
82
+ **⚠️ Technical Concerns (if any):**
83
+ - [Specific concern about feasibility, performance, or architecture]
84
+ - [Suggested alternative or mitigation approach]
85
+
86
+ **💡 Recommendations:**
87
+ - [Suggestions for improving the approach based on codebase analysis]
88
+ - [Ways to reduce risk or complexity]
89
+
90
+ ---
91
+ Options:
92
+ - Type 'yes' to lock this contract and create the spec package
93
+ - Type 'edit: [your changes]' to modify the contract
94
+ - Type 'risks' to explore potential implementation risks in detail
95
+ - Type 'blueprint' to see the planned folder structure and documents
96
+ - Ask more questions if anything needs clarification
97
+ ```
98
+
99
+ ### Phase 2: Spec Package Creation (Post-Agreement Only)
100
+
101
+ **Triggered only after user confirms contract with 'yes'**
102
+
103
+ #### Step 2.1: Determine Current Date
104
+ Use `run_command` to get current date:
105
+ ```bash
106
+ date +%Y-%m-%d
107
+ ```
108
+
109
+ #### Step 2.2: Create Directory Structure
110
+ Use `write_to_file` to create organized folder structure:
111
+ ```
112
+ .code-captain/specs/[DATE]-{feature-name}/
113
+ ├── spec.md # Main specification (from contract)
114
+ ├── spec-lite.md # Condensed version for AI context
115
+ ├── user-stories/ # Individual user story files
116
+ │ ├── README.md # Overview and progress tracking
117
+ │ ├── story-1-{name}.md # Individual user story with focused tasks
118
+ │ ├── story-2-{name}.md # Each story kept small and manageable
119
+ │ └── story-N-{name}.md # Max 5-7 implementation tasks per story
120
+ └── sub-specs/ # Technical deep-dives
121
+ ├── technical-spec.md # Architecture & implementation details
122
+ ├── database-schema.md # Database changes (if needed)
123
+ ├── api-spec.md # API documentation (if needed)
124
+ └── ui-wireframes.md # UI/UX specifications (if needed)
125
+ ```
126
+
127
+ #### Step 2.3: Generate Core Documents
128
+
129
+ **spec.md** - Built directly from the locked contract:
130
+ ```markdown
131
+ # [Feature Name] Specification
132
+
133
+ > Created: [DATE]
134
+ > Status: Planning
135
+ > Contract Locked: ✅
136
+
137
+ ## Contract Summary
138
+ [Echo check content verbatim]
139
+
140
+ ## Detailed Requirements
141
+ [Expanded from clarification responses]
142
+
143
+ ## Implementation Approach
144
+ [Technical strategy based on codebase analysis]
145
+ ```
146
+
147
+ **user-stories/README.md** - Overview and progress tracking:
148
+ ```markdown
149
+ # User Stories Overview
150
+
151
+ > **Specification:** [Feature Name]
152
+ > **Created:** [DATE]
153
+ > **Status:** Planning
154
+
155
+ ## Stories Summary
156
+
157
+ | Story | Title | Status | Tasks | Progress |
158
+ |-------|-------|--------|-------|----------|
159
+ | 1 | [Story title] | Not Started | 5 | 0/5 |
160
+ | 2 | [Story title] | Not Started | 4 | 0/4 |
161
+ | 3 | [Story title] | Not Started | 6 | 0/6 |
162
+
163
+ **Total Progress:** 0/15 tasks (0%)
164
+
165
+ ## Story Dependencies
166
+ - Story 2 depends on Story 1 completion
167
+ - Story 3 can run parallel to Story 2
168
+
169
+ ## Quick Links
170
+ - [Story 1: Feature Name](./story-1-feature-name.md)
171
+ - [Story 2: Feature Name](./story-2-feature-name.md)
172
+ - [Story 3: Feature Name](./story-3-feature-name.md)
173
+ ```
174
+
175
+ **user-stories/story-1-{name}.md** - Individual story files:
176
+ ```markdown
177
+ # Story 1: [Title]
178
+
179
+ > **Status:** Not Started | **Priority:** High | **Dependencies:** None
180
+
181
+ ## User Story
182
+ **As a** [user type] **I want to** [action] **So that** [value]
183
+
184
+ ## Acceptance Criteria
185
+ - [ ] Given [context], when [action], then [outcome]
186
+ - [ ] Given [context], when [action], then [outcome]
187
+
188
+ ## Implementation Tasks
189
+ - [ ] 1.1 Write tests for [component]
190
+ - [ ] 1.2 [Technical step]
191
+ - [ ] 1.3 [Technical step]
192
+ - [ ] 1.4 Verify acceptance criteria
193
+ - [ ] 1.5 Verify all tests pass
194
+
195
+ ## Definition of Done
196
+ - [ ] All tasks completed | [ ] Tests passing | [ ] Code reviewed
197
+ ```
198
+
199
+ #### Step 2.4: Generate Technical Sub-Specs
200
+
201
+ **Only create relevant sub-specs based on contract requirements:**
202
+
203
+ - **technical-spec.md**: Always created - architecture, patterns, dependencies
204
+ - **database-schema.md**: Only if database changes needed
205
+ - **api-spec.md**: Only if new API endpoints required
206
+ - **ui-wireframes.md**: Only if UI/UX requirements were discussed
207
+
208
+ #### Step 2.5: Final Package Review & User Validation
209
+
210
+ Present complete package:
211
+ ```
212
+ ✅ Specification package created successfully!
213
+
214
+ 📁 .code-captain/specs/[DATE]-feature-name/
215
+ ├── 📋 spec.md - Main specification
216
+ ├── 📝 spec-lite.md - AI context summary
217
+ ├── 👥 user-stories/ - Individual story files
218
+ │ ├── 📊 README.md - Overview and progress tracking
219
+ │ └── 📝 story-N-{name}.md - Focused stories (5-7 tasks each)
220
+ └── 📂 sub-specs/ - Technical specifications
221
+
222
+ **Stories Created:** [N] user stories | **Total Tasks:** [X] implementation tasks
223
+
224
+ Please review the specification documents and let me know:
225
+ - Does this accurately capture your vision?
226
+ - Are there any missing requirements or incorrect assumptions?
227
+ - Should any stories be split further or combined?
228
+
229
+ Once satisfied, I can help start implementation or make adjustments.
230
+ ```
231
+
232
+ #### Step 2.6: Create Memory of Specification (Optional)
233
+ After successful spec creation, ask Cascade:
234
+ "Please create a memory of this feature specification: [brief summary of deliverable and key technical approach]"
235
+
236
+ ## Key Improvements
237
+
238
+ ### 1. Contract-First Approach
239
+ - **No presumptuous file creation** - Nothing gets built until contract is locked
240
+ - **Structured clarification** - One question at a time, building understanding
241
+ - **Echo check validation** - Clear contract summary before proceeding
242
+
243
+ ### 2. Codebase-Aware Questioning
244
+ - **Context scanning between questions** - Each answer triggers fresh codebase analysis
245
+ - **Integration-focused queries** - Questions shaped by what exists in the codebase
246
+ - **Architecture consistency** - Recommendations align with existing patterns
247
+
248
+ ### 3. User Control & Transparency
249
+ - **Clear decision points** - User explicitly approves before file creation
250
+ - **Risk assessment option** - Can explore implementation risks before committing
251
+ - **Blueprint preview** - Can see planned structure before creation
252
+ - **Edit capability** - Can modify contract before locking
253
+
254
+ ### 4. Efficient Clarification Process
255
+ - **Gap enumeration** - Systematically identifies all unknowns
256
+ - **95% confidence threshold** - Stops asking when ready to deliver
257
+ - **Token efficiency** - Focused questions, no verbose explanations during clarification
258
+
259
+ ## User Stories Folder Structure
260
+
261
+ **Philosophy:** Each story gets its own file (max 5-7 tasks), README.md provides overview and progress tracking, follows TDD approach.
262
+
263
+ **Benefits:** Manageable files, easy navigation, parallel work, clear progress tracking, every task traces to user value.
264
+
265
+ ## Windsurf Tools Used
266
+
267
+ - `find_by_name`: Locate existing specifications and project files
268
+ - `view_file`: Read existing documentation and context files
269
+ - `codebase_search`: Analyze current architecture and patterns
270
+ - `write_to_file`: Create specification documents and folder structure
271
+ - `run_command`: Get current date for folder naming
272
+ - `search_web`: Research best practices and technical approaches (if needed)
273
+
274
+ ## Windsurf Features Used
275
+
276
+ - **Memories**: After completion, optionally create memory of specification decision and approach
277
+
278
+ ---
279
+
280
+ *📋 Great specifications lead to great implementations. Invest in clarity upfront.*
@@ -0,0 +1,273 @@
1
+ ---
2
+ description: Modify existing feature specifications using contract-first approach with safe change management
3
+ ---
4
+
5
+ # Edit Spec Workflow
6
+
7
+ ## Overview
8
+ Modify existing feature specifications using a contract-first approach that ensures complete alignment between developer and AI before updating any supporting files. Prevents assumptions by establishing a clear "modification contract" through structured clarification rounds.
9
+
10
+ ## Usage Examples
11
+ - "user-authentication" "add social login options"
12
+ - "2024-01-15-payment-gateway" "change from Stripe to PayPal"
13
+ - "latest" "remove the mobile app requirement"
14
+
15
+ ## Command Process
16
+
17
+ ### Phase 1: Specification Loading & Change Contract (No File Modifications)
18
+
19
+ **Mission Statement:**
20
+ > Help modify existing specifications safely and precisely. Deliver updated spec package only after both parties agree on the modification contract. **Challenge changes that could break existing functionality or create technical debt - better to surface concerns early than implement problematic modifications.**
21
+
22
+ #### Step 1.1: Specification Discovery & Loading
23
+
24
+ **Locate Target Specification:**
25
+ 1. Use `find_by_name` to scan `.code-captain/specs/` directory for all existing specifications
26
+ 2. If spec-identifier provided:
27
+ - Search for exact folder name match: `[DATE]-{spec-identifier}`
28
+ - Search for partial name match in folder names
29
+ - Search for identifier in spec.md titles/content using `view_file`
30
+ 3. If spec-identifier is "latest":
31
+ - Find most recent folder by date prefix using `list_dir`
32
+ 4. If no spec-identifier provided:
33
+ - List all available specifications for user selection
34
+ 5. If multiple matches found:
35
+ - Present options for user disambiguation
36
+
37
+ **Load Current State:**
38
+ 1. Use `view_file` to read primary specification file (`spec.md`)
39
+ 2. Use `view_file` to read user stories overview (`user-stories/README.md`)
40
+ 3. Use `view_file` to read all individual story files in `user-stories/` directory
41
+ 4. Use `view_file` to read all sub-specifications in `sub-specs/` directory
42
+ 5. Use `codebase_search` to scan for any implementation progress related to this spec
43
+ 6. **Output:** Current specification summary with story status (no modifications yet)
44
+
45
+ #### Step 1.2: Impact Analysis & Change Assessment
46
+
47
+ **Internal Process (not shown to user):**
48
+ - Analyze proposed changes against current specification
49
+ - Identify affected individual story files and task groups
50
+ - Note potential ripple effects on:
51
+ - Existing implementation (if any)
52
+ - Specific user story files in user-stories/ folder
53
+ - Story dependencies and sequencing
54
+ - Technical architecture
55
+ - Acceptance criteria within affected stories
56
+ - Project timelines and story priorities
57
+ - Catalog modification domains:
58
+ - Scope changes (adding/removing/splitting stories)
59
+ - Technical approach modifications
60
+ - Individual story adjustments or combinations
61
+ - Task group reorganization (keeping 5-7 tasks max)
62
+ - Performance/security requirement changes
63
+ - Integration point modifications
64
+ - Success criteria updates within stories
65
+
66
+ #### Step 1.3: Change Clarification Loop
67
+
68
+ **Rules:**
69
+ - Ask ONE focused question at a time about the proposed changes
70
+ - After each answer, re-analyze the existing spec and codebase using `codebase_search`
71
+ - Continue until reaching 95% confidence on modification impact
72
+ - Each question should target the highest-impact unknown or risk
73
+ - **Never declare "final question"** - let the conversation flow naturally
74
+ - **Challenge changes that could break existing functionality or create technical debt**
75
+
76
+ **Critical Analysis Responsibility:**
77
+ - If proposed changes conflict with existing implementation, explain impact and suggest migration strategies
78
+ - If scope changes affect other dependent specifications, identify and discuss dependencies
79
+ - If modifications introduce technical complexity, assess if benefits justify the cost
80
+ - If changes affect user stories that may already be in progress, surface timeline implications
81
+ - If proposed changes contradict original business value, question the modification rationale
82
+
83
+ **Risk Assessment Categories:**
84
+ - **Breaking Changes**: Will this break existing functionality?
85
+ - **Implementation Impact**: How much existing work needs to be modified/discarded?
86
+ - **Architecture Consistency**: Do changes align with existing patterns?
87
+ - **Scope Creep**: Are we expanding beyond the original contract boundaries?
88
+ - **Business Value**: Do changes improve or compromise original user value?
89
+
90
+ **Question Categories:**
91
+ - "This change would affect [existing user story]. Should we modify that story or create a new one?"
92
+ - "I see this conflicts with [existing implementation]. Should we plan a migration strategy?"
93
+ - "This modification increases complexity in [area]. Is the added value worth the technical cost?"
94
+ - "The original spec was focused on [goal]. How does this change serve that same goal?"
95
+ - "This would require changes to [dependent system]. Have you considered the downstream impact?"
96
+
97
+ #### Step 1.4: Modification Contract Proposal
98
+
99
+ When confident about changes, present a modification contract:
100
+
101
+ ```
102
+ ## Modification Contract
103
+
104
+ **Target Specification:** [Specification name and date]
105
+
106
+ **Proposed Changes:** [Clear description of what will be modified]
107
+
108
+ **Change Type:** [Addition/Removal/Modification/Refactor]
109
+
110
+ **Impact Assessment:**
111
+ - **Story Files Affected:** [Specific story-N-{name}.md files needing changes]
112
+ - **New Stories Required:** [Additional story files to create]
113
+ - **Stories to Remove/Combine:** [Story files becoming obsolete]
114
+ - **Technical Components Affected:** [Code/architecture areas needing updates]
115
+ - **Implementation Status:** [Existing work affected across stories]
116
+
117
+ **Migration Strategy:** [Handle existing implementation, preserve work, rollback plan]
118
+
119
+ **Updated Success Criteria:** [How success metrics change]
120
+
121
+ **Revised Scope:** Still/Now/Removed/Out of scope [summarized changes]
122
+
123
+ **⚠️ Risks & Concerns:**
124
+ - [Specific technical or business risks from the changes]
125
+ - [Potential complications or dependencies]
126
+
127
+ **💡 Recommendations:**
128
+ - [Suggestions for safer implementation approaches]
129
+ - [Ways to minimize disruption to existing work]
130
+
131
+ **Effort Estimate:** [How much additional/changed work is involved]
132
+
133
+ ---
134
+ Options:
135
+ - Type 'yes' to lock this modification contract and update the specification
136
+ - Type 'edit: [your changes]' to modify the contract
137
+ - Type 'compare' to see a detailed before/after comparison
138
+ - Type 'risks' to explore implementation risks in detail
139
+ - Type 'rollback' to understand how to undo these changes later
140
+ - Ask more questions if anything needs clarification
141
+ ```
142
+
143
+ ### Phase 2: Specification Update (Post-Agreement Only)
144
+
145
+ **Triggered only after user confirms modification contract with 'yes'**
146
+
147
+ #### Step 2.1: Create Backup & Change Documentation
148
+
149
+ **Backup Process:**
150
+ 1. Use `run_command` to get current timestamp:
151
+ ```bash
152
+ date +%Y%m%d-%H%M%S
153
+ ```
154
+ 2. Use `write_to_file` to create backup folder structure
155
+ 3. Use `view_file` to read all current files and copy to backup location
156
+ 4. Use `write_to_file` to create change log entry in `CHANGELOG.md`
157
+
158
+ **Change Log Format:**
159
+ ```markdown
160
+ # Specification Change Log
161
+
162
+ ## [Date] - [Change Type]
163
+ **Modified by:** [User] | **Contract:** [Brief summary]
164
+
165
+ ### Changes: [List changes] | ### Files: [List files] | ### Backup: `backups/[timestamp]/`
166
+ ```
167
+
168
+ #### Step 2.2: Update Core Specification Files
169
+
170
+ **spec.md Updates:**
171
+ - Use `view_file` to read current content
172
+ - Use `write_to_file` to update with:
173
+ - Modified contract summary to reflect new agreement
174
+ - Updated detailed requirements based on clarification
175
+ - Revised implementation approach if changed
176
+ - Change log reference
177
+ - Updated status if appropriate
178
+
179
+ **user-stories/ folder Updates:**
180
+ - **README.md**: Update progress tracking table and story dependencies
181
+ - **Individual story files**: Modify affected story-N-{name}.md files
182
+ - **Story additions**: Create new story files with focused task groups (5-7 tasks max)
183
+ - **Story combinations**: Merge related stories if they become too granular
184
+ - **Story removals**: Archive or delete story files no longer needed
185
+ - **Task reorganization**: Ensure task groups within stories remain manageable
186
+ - **Status updates**: Mark completed tasks that might need rework across all stories
187
+
188
+ #### Step 2.3: Update Technical Sub-Specifications
189
+
190
+ **Selective Updates:**
191
+ - Only update sub-specs affected by the changes using `view_file` and `write_to_file`
192
+ - Create new sub-specs if new technical areas introduced
193
+ - Archive sub-specs no longer relevant
194
+ - Update cross-references between documents
195
+
196
+ #### Step 2.4: Story-Based Task Reconciliation
197
+
198
+ **Task Status Assessment Across Stories:**
199
+ - Review each story file for task status and relevance
200
+ - Identify completed tasks within stories that remain valid
201
+ - Flag tasks requiring rework due to changes
202
+ - Add new tasks while maintaining 5-7 task limit per story
203
+ - Split stories if task count would exceed 7 tasks
204
+ - Combine stories if task counts become too small
205
+ - Reorder stories if dependencies changed
206
+
207
+ **Story-Level Task Annotations:**
208
+ ```markdown
209
+ # In story-1-user-auth.md:
210
+ - [x] 1.1 Write tests for user authentication ✅ (Still valid)
211
+ - [ ] 1.2 Implement OAuth provider ⚠️ (Needs modification)
212
+ - [ ] 1.3 Create social login UI 🆕 (New task from scope change)
213
+ - [~~] 1.4 Implement mobile-specific auth ❌ (Moved to new story-4-mobile-auth.md)
214
+ ```
215
+
216
+ **Story Management:**
217
+ - **Split large stories**: If modifications would create >7 tasks, create additional story files
218
+ - **Archive obsolete stories**: Move removed stories to archived/ subfolder with timestamp
219
+ - **Update story dependencies**: Modify README.md to reflect new story relationships
220
+ - **Maintain story cohesion**: Ensure each story delivers standalone user value
221
+
222
+ #### Step 2.5: Final Update Review & Validation
223
+
224
+ Present updated package:
225
+ ```
226
+ ✅ Specification successfully updated!
227
+
228
+ 📁 .code-captain/specs/[DATE]-feature-name/
229
+ ├── 📋 spec.md - ⭐ Updated specification
230
+ ├── 👥 user-stories/ - ⭐ Updated story organization
231
+ │ ├── 📊 README.md - ⭐ Updated progress tracking
232
+ │ └── 📝 story-N-{name}.md - ⭐ Modified stories (5-7 tasks each)
233
+ ├── 📂 sub-specs/ - ⭐ Updated technical specifications
234
+ ├── 💾 backups/[timestamp]/ - Original files preserved
235
+ └── 📝 CHANGELOG.md - ⭐ Change documentation
236
+
237
+ **Changes:** [X] stories modified, [Y] added, [Z] archived | **Tasks:** [N] total (max 5-7 per story)
238
+
239
+ Please review: Does this accurately reflect the agreed modifications? Should any stories be split/combined?
240
+
241
+ Original version backed up. Can help with rollback if needed.
242
+ ```
243
+
244
+ #### Step 2.6: Create Memory of Specification Changes (Optional)
245
+ After successful spec update, ask Cascade:
246
+ "Please create a memory of these specification changes: [brief summary of modifications and their impact on the feature]"
247
+
248
+ ## Key Features
249
+
250
+ **Safe Modification:** Backup creation, change tracking, rollback capability, impact assessment
251
+
252
+ **Precise Control:** Focused clarification, risk assessment, migration strategy, selective updates
253
+
254
+ **Implementation Continuity:** Task status preservation, clear rework annotation, timeline impact analysis
255
+
256
+ **Change Documentation:** Detailed logs, comparison capability, rationale capture, rollback instructions
257
+
258
+ ## Windsurf Tools Used
259
+
260
+ - `find_by_name`: Locate existing specifications and story files
261
+ - `list_dir`: Explore specification directories and folder structures
262
+ - `view_file`: Read current specification content and story files
263
+ - `write_to_file`: Update specification documents and create backups
264
+ - `codebase_search`: Analyze implementation progress and conflicts
265
+ - `run_command`: Get timestamps for backup folder naming
266
+
267
+ ## Windsurf Features Used
268
+
269
+ - **Memories**: After completion, optionally create memory of specification changes and their rationale
270
+
271
+ ---
272
+
273
+ *📝 Safe evolution keeps specifications valuable. Change with intention, preserve with care.*