sdlc-framework 1.0.0

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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -0
  3. package/bin/install.js +193 -0
  4. package/package.json +39 -0
  5. package/src/commands/close.md +200 -0
  6. package/src/commands/debug.md +124 -0
  7. package/src/commands/fast.md +149 -0
  8. package/src/commands/fix.md +104 -0
  9. package/src/commands/help.md +144 -0
  10. package/src/commands/hotfix.md +99 -0
  11. package/src/commands/impl.md +142 -0
  12. package/src/commands/init.md +93 -0
  13. package/src/commands/milestone.md +136 -0
  14. package/src/commands/pause.md +115 -0
  15. package/src/commands/research.md +136 -0
  16. package/src/commands/resume.md +103 -0
  17. package/src/commands/review.md +195 -0
  18. package/src/commands/spec.md +164 -0
  19. package/src/commands/status.md +118 -0
  20. package/src/commands/verify.md +153 -0
  21. package/src/references/clarification-strategy.md +352 -0
  22. package/src/references/engineering-laws.md +374 -0
  23. package/src/references/loop-phases.md +331 -0
  24. package/src/references/playwright-testing.md +298 -0
  25. package/src/references/prompt-detection.md +264 -0
  26. package/src/references/sub-agent-strategy.md +260 -0
  27. package/src/rules/commands.md +180 -0
  28. package/src/rules/style.md +354 -0
  29. package/src/rules/templates.md +238 -0
  30. package/src/rules/workflows.md +314 -0
  31. package/src/templates/HANDOFF.md +121 -0
  32. package/src/templates/LAWS.md +521 -0
  33. package/src/templates/PROJECT.md +112 -0
  34. package/src/templates/REVIEW.md +145 -0
  35. package/src/templates/ROADMAP.md +101 -0
  36. package/src/templates/SPEC.md +231 -0
  37. package/src/templates/STATE.md +106 -0
  38. package/src/templates/SUMMARY.md +126 -0
  39. package/src/workflows/close-phase.md +189 -0
  40. package/src/workflows/debug-flow.md +302 -0
  41. package/src/workflows/fast-forward.md +340 -0
  42. package/src/workflows/fix-findings.md +235 -0
  43. package/src/workflows/hotfix-flow.md +190 -0
  44. package/src/workflows/impl-phase.md +229 -0
  45. package/src/workflows/init-project.md +249 -0
  46. package/src/workflows/milestone-management.md +169 -0
  47. package/src/workflows/pause-work.md +153 -0
  48. package/src/workflows/research.md +219 -0
  49. package/src/workflows/resume-project.md +159 -0
  50. package/src/workflows/review-phase.md +337 -0
  51. package/src/workflows/spec-phase.md +379 -0
  52. package/src/workflows/transition-phase.md +203 -0
  53. package/src/workflows/verify-phase.md +280 -0
@@ -0,0 +1,169 @@
1
+ <purpose>Create new milestones or complete existing ones. Milestones are the highest-level organizational unit — they contain phases, which contain plans. This workflow manages the milestone lifecycle.</purpose>
2
+ <when_to_use>Run to create a new milestone (/sdlc:milestone create) or complete an existing one (/sdlc:milestone complete). Also triggered automatically by transition-phase when the last phase in a milestone completes.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/ROADMAP.md, .sdlc/PROJECT.md</required_reading>
4
+ <loop_context>
5
+ expected_phase: MILESTONE (meta-workflow, operates above the loop)
6
+ prior_phase: varies
7
+ next_phase: SPEC (for new milestone) or none (project complete)
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="determine_operation" priority="first">
12
+ Determine whether the user wants to CREATE or COMPLETE a milestone.
13
+
14
+ IF explicitly specified (e.g., "/sdlc:milestone create" or "/sdlc:milestone complete"):
15
+ Use the specified operation.
16
+
17
+ IF not specified:
18
+ Read .sdlc/ROADMAP.md.
19
+ - If the current milestone has incomplete phases → likely COMPLETE is premature
20
+ - If the current milestone is done or no milestone is active → likely CREATE
21
+
22
+ Ask: "Do you want to:
23
+ A. Create a new milestone
24
+ B. Complete the current milestone ({name})
25
+ ?"
26
+
27
+ WHY: The two operations are very different. Creating sets up future work. Completing archives past work. Mixing them up would corrupt the state.
28
+ </step>
29
+
30
+ <step name="create_milestone" priority="second">
31
+ ONLY IF operation = CREATE.
32
+
33
+ A. GATHER MILESTONE INFO:
34
+
35
+ Question 1: "What is the milestone name? (e.g., 'MVP', 'Auth System', 'v2.0')"
36
+
37
+ Question 2: "What is the goal of this milestone? What will be true when it is done?"
38
+ - This becomes the milestone completion criteria
39
+ - Be specific: "Users can register, log in, and reset passwords" not "Auth works"
40
+
41
+ Question 3: "What phases make up this milestone? List 2-5 phases in order."
42
+ - Provide guidance: "Each phase should be a cohesive group of related work"
43
+ - Example: "Phase 01: Database Schema, Phase 02: API Endpoints, Phase 03: Frontend Forms"
44
+
45
+ Question 4: "Any dependencies on prior milestones? (e.g., requires 'MVP' milestone to be complete)"
46
+ - If yes: verify the dependency milestone is complete
47
+
48
+ Question 5: "Any rough timeline or priority? (optional)"
49
+
50
+ B. CALCULATE MILESTONE NUMBER:
51
+ Read ROADMAP.md. Count existing milestones. New milestone = max + 1, zero-padded to 2 digits.
52
+
53
+ C. CREATE PHASE DIRECTORIES:
54
+ For each phase in the new milestone:
55
+ mkdir -p .sdlc/phases/{phase-number}-{phase-name}
56
+
57
+ D. UPDATE ROADMAP.MD:
58
+ Add the new milestone section:
59
+ ```markdown
60
+ ## Milestone {number}: {name}
61
+ **Goal**: {goal}
62
+ **Status**: NOT STARTED
63
+ **Dependencies**: {list or "None"}
64
+
65
+ ### Phases
66
+ | Phase | Name | Status | Plans |
67
+ |-------|------|--------|-------|
68
+ | {NN} | {name} | NOT STARTED | 0 |
69
+ | {NN} | {name} | NOT STARTED | 0 |
70
+ ```
71
+
72
+ E. UPDATE STATE.MD:
73
+ - If no active milestone: set this as the current milestone
74
+ - Add history entry: "{timestamp} | milestone | Created milestone {number}: {name} with {N} phases"
75
+
76
+ Display:
77
+ ```
78
+ Milestone created: {number} — {name}
79
+
80
+ Phases:
81
+ 1. {phase-name}
82
+ 2. {phase-name}
83
+ ...
84
+
85
+ Directories created: .sdlc/phases/{phase-dirs}
86
+
87
+ NEXT ACTION REQUIRED: /sdlc:spec
88
+ Start the first phase with /sdlc:spec.
89
+ ```
90
+
91
+ WHY: Milestones provide the big-picture structure. Without them, phases are disconnected chunks of work with no clear endpoint.
92
+ </step>
93
+
94
+ <step name="complete_milestone" priority="third">
95
+ ONLY IF operation = COMPLETE.
96
+
97
+ A. VERIFY ALL PHASES ARE DONE:
98
+ Read ROADMAP.md. For the current milestone:
99
+ - List all phases
100
+ - Check each phase status: must be COMPLETE
101
+ - Check each phase directory: must have at least one SUMMARY.md
102
+
103
+ IF ANY PHASE IS INCOMPLETE:
104
+ STOP. Display: "Cannot complete milestone. Phase {N} ({name}) is not complete. Status: {status}."
105
+ List incomplete phases with their current status.
106
+
107
+ B. VERIFY STATE CONSISTENCY:
108
+ Cross-check:
109
+ - STATE.md milestone number matches ROADMAP.md current milestone
110
+ - STATE.md loop_position is CLOSE ✓ or ready for new spec
111
+ - No active plan is in progress
112
+
113
+ IF INCONSISTENCY FOUND:
114
+ Display: "State inconsistency detected: {details}. Run /sdlc:resume to reconcile."
115
+
116
+ C. GENERATE MILESTONE SUMMARY:
117
+ Read all SUMMARY.md files across all phases in this milestone.
118
+ Compile a milestone-level summary:
119
+
120
+ ```
121
+ Milestone {number}: {name}
122
+
123
+ Completed: {date}
124
+ Duration: {first spec date} to {last close date}
125
+ Phases: {count}
126
+ Plans executed: {total across all phases}
127
+ Hotfixes: {count, if any}
128
+
129
+ Deliverables:
130
+ - {consolidated list from all summaries}
131
+
132
+ Key decisions:
133
+ - {consolidated from all summaries}
134
+
135
+ Technical debt introduced:
136
+ - {from hotfixes and review warnings}
137
+ ```
138
+
139
+ D. ARCHIVE:
140
+ The milestone's phase directories remain in place (they are the historical record).
141
+ No files are moved or deleted.
142
+
143
+ E. GIT TAG (if git repository):
144
+ Ask user: "Create a git tag for this milestone? (recommended)"
145
+ If yes:
146
+ git tag -a "milestone-{number}-{name}" -m "Milestone {number}: {name} complete"
147
+ Display the tag name.
148
+
149
+ F. UPDATE ROADMAP.MD:
150
+ Set milestone status to COMPLETE with completion date.
151
+
152
+ G. UPDATE STATE.MD:
153
+ - Clear current milestone
154
+ - Add history entry: "{timestamp} | milestone | Completed milestone {number}: {name}. {N} phases, {N} plans."
155
+
156
+ H. DETERMINE NEXT MILESTONE:
157
+ Check ROADMAP.md for the next NOT STARTED milestone.
158
+
159
+ IF NEXT MILESTONE EXISTS:
160
+ Set it as current in STATE.md.
161
+ Display: "Milestone {number} complete. Next milestone: {next-number} — {next-name}. Run /sdlc:spec to begin."
162
+
163
+ IF NO NEXT MILESTONE:
164
+ Display: "Milestone {number} complete. No further milestones planned. Run /sdlc:milestone create to plan the next one, or the project may be complete."
165
+
166
+ WHY: Milestone completion is a significant checkpoint. The git tag marks a stable point. The summary captures institutional knowledge. Without completion, milestones just fade out with no clear ending.
167
+ </step>
168
+
169
+ </process>
@@ -0,0 +1,153 @@
1
+ <purpose>Save the current session state so work can be resumed later without context loss. Creates a HANDOFF.md that captures everything the next session needs to continue seamlessly.</purpose>
2
+ <when_to_use>Run when ending a work session, switching context, or before a break. Can be run at any point in the loop — the state is preserved exactly as-is.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md</required_reading>
4
+ <loop_context>
5
+ expected_phase: any (pause works at any loop position)
6
+ prior_phase: current position is preserved
7
+ next_phase: RESUME (the next session must run /sdlc:resume)
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="read_current_state" priority="first">
12
+ Read .sdlc/STATE.md. Capture:
13
+ - Current milestone, phase, plan
14
+ - Loop position (e.g., "IMPL ✓", "VERIFY in progress")
15
+ - Next required action
16
+ - Last history entry
17
+
18
+ WHY: The state machine is the primary context. Without it, the resume workflow does not know where to continue.
19
+ </step>
20
+
21
+ <step name="gather_session_context" priority="second">
22
+ Collect all relevant context from the current session:
23
+
24
+ A. WORK COMPLETED THIS SESSION:
25
+ - Read STATE.md history entries from today/this session
26
+ - Summarize what was done (e.g., "Completed spec for auth module, started implementation")
27
+
28
+ B. DECISIONS MADE:
29
+ - Scan recent SPEC.md, REVIEW.md, or SUMMARY.md files for decisions
30
+ - List any verbal decisions or trade-offs discussed but not yet written down
31
+
32
+ C. IN-PROGRESS WORK:
33
+ - If mid-implementation: which tasks are done, which are pending?
34
+ - If mid-verification: which ACs passed, which remain?
35
+ - If mid-review: which files reviewed, which remain?
36
+
37
+ D. BLOCKERS AND OPEN QUESTIONS:
38
+ - Any unresolved issues?
39
+ - Any questions that need user input?
40
+ - Any external dependencies (waiting on API, waiting on design)?
41
+
42
+ E. IMPORTANT CONTEXT NOT IN FILES:
43
+ Ask the user: "Is there anything I should remember for next session that is not already written down? (decisions, context, concerns)"
44
+ If yes: record their response verbatim.
45
+
46
+ WHY: Session context is ephemeral — it lives in conversation history, not in files. The handoff captures it before it is lost.
47
+ </step>
48
+
49
+ <step name="check_uncommitted_changes" priority="third">
50
+ Run: git status (if the project is a git repository)
51
+
52
+ IF UNCOMMITTED CHANGES EXIST:
53
+ Display the list of modified/untracked files.
54
+
55
+ Ask the user:
56
+ "You have uncommitted changes:
57
+ {file list}
58
+
59
+ Options:
60
+ A. Create a WIP commit now (recommended — prevents accidental loss)
61
+ B. Leave changes uncommitted (they will persist in the working directory)
62
+ C. Stash changes (saves them without committing)"
63
+
64
+ IF user chooses A:
65
+ Stage relevant files (not .env or secret files)
66
+ Create commit with message: "wip({phase}): {brief description of current work}"
67
+ Note the commit hash in the handoff
68
+
69
+ IF user chooses B:
70
+ Note in handoff: "WARNING: uncommitted changes exist. Do not run git clean or git checkout."
71
+
72
+ IF user chooses C:
73
+ Run: git stash push -m "sdlc-pause-{timestamp}"
74
+ Note the stash reference in the handoff
75
+
76
+ IF NO UNCOMMITTED CHANGES:
77
+ Note: "Working directory clean. No uncommitted changes."
78
+
79
+ WHY: Uncommitted changes can be lost (accidental git clean, system crash, someone else working on the branch). A WIP commit is the safest option.
80
+ </step>
81
+
82
+ <step name="create_handoff" priority="fourth">
83
+ Create .sdlc/HANDOFF.md (overwrite if exists — only one active handoff at a time):
84
+
85
+ ```markdown
86
+ # Session Handoff
87
+
88
+ ## Session Info
89
+ - **Paused at**: {ISO timestamp}
90
+ - **Loop position**: {from STATE.md}
91
+ - **Next required action**: {from STATE.md}
92
+
93
+ ## What Was Done This Session
94
+ {Bulleted list of work completed}
95
+
96
+ ## Current State
97
+ - **Phase**: {phase name and number}
98
+ - **Plan**: {plan number and title, or "no active plan"}
99
+ - **Loop step**: {SPEC|IMPL|VERIFY|REVIEW|CLOSE} — {status}
100
+
101
+ ## In-Progress Work
102
+ {What is partially done — specific tasks, files, ACs}
103
+ - Task X: COMPLETE
104
+ - Task Y: IN PROGRESS — {what remains}
105
+ - Task Z: NOT STARTED
106
+
107
+ ## Decisions Made
108
+ {List of decisions with rationale}
109
+
110
+ ## Blockers / Open Questions
111
+ {List of blockers or questions that need resolution}
112
+
113
+ ## User Context
114
+ {Verbatim notes from the user, if any}
115
+
116
+ ## Git State
117
+ - **Branch**: {current branch}
118
+ - **Commit**: {latest commit hash and message}
119
+ - **Uncommitted changes**: {yes/no — details}
120
+ - **Stash**: {stash reference, if applicable}
121
+
122
+ ## Resume Instructions
123
+ Run /sdlc:resume to continue. The resume workflow will:
124
+ 1. Read this handoff
125
+ 2. Restore context
126
+ 3. Tell you exactly what to do next
127
+ ```
128
+
129
+ WHY: HANDOFF.md is the bridge between sessions. Without it, resuming requires re-reading all files and reconstructing context manually — slow and error-prone.
130
+ </step>
131
+
132
+ <step name="update_state" priority="fifth">
133
+ Update .sdlc/STATE.md:
134
+ - Add session field: paused_at = {timestamp}
135
+ - Add history entry: "{timestamp} | pause | Session paused at {loop_position}. Handoff created."
136
+ - Do NOT change loop_position or next_required_action — those are preserved for resume
137
+
138
+ Display:
139
+ ```
140
+ Session saved.
141
+
142
+ Handoff: .sdlc/HANDOFF.md
143
+ State: {loop_position}
144
+ Next action (on resume): {next_required_action}
145
+ Git: {clean | WIP committed | stashed | uncommitted changes}
146
+
147
+ When you return, run /sdlc:resume to continue exactly where you left off.
148
+ ```
149
+
150
+ WHY: The explicit "run /sdlc:resume" instruction ensures the next session starts correctly. Without it, the user might try to pick up manually and skip steps.
151
+ </step>
152
+
153
+ </process>
@@ -0,0 +1,219 @@
1
+ <purpose>Conduct structured research before writing a specification. Spawns sub-agents to explore the codebase or search the web, saves findings, and routes back to the spec phase with informed context.</purpose>
2
+ <when_to_use>Run when you need to understand existing code patterns, evaluate technical options, or gather external information before committing to a spec. Typically run before /sdlc:spec or when the spec phase reveals unknowns.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/PROJECT.md</required_reading>
4
+ <loop_context>
5
+ expected_phase: RESEARCH (pre-spec activity)
6
+ prior_phase: any (usually between loops or during spec clarification)
7
+ next_phase: SPEC (research always leads to a spec)
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="define_research_question" priority="first">
12
+ Ask the user: "What do you need to research? Describe the question or topic."
13
+
14
+ Then classify the research type:
15
+
16
+ TYPE: CODEBASE_EXPLORATION
17
+ Indicators: "how does X work in our code", "where is Y implemented", "what pattern does Z use", "find all instances of W"
18
+ Method: Codebase search agents (Grep, Glob, Read)
19
+
20
+ TYPE: WEB_RESEARCH
21
+ Indicators: "what is the best library for X", "how does Y technology work", "compare options for Z", "what are best practices for W"
22
+ Method: WebSearch agent
23
+
24
+ TYPE: HYBRID
25
+ Indicators: "how should we implement X" (needs both codebase understanding AND external knowledge)
26
+ Method: Both codebase and web agents
27
+
28
+ Display: "Research type: {type}. Proceeding with {method}."
29
+
30
+ WHY: Different research types need different tools. Searching the web for "how is auth implemented in our code" is useless. Searching the codebase for "best JWT library" is equally useless.
31
+ </step>
32
+
33
+ <step name="spawn_codebase_agents" priority="second">
34
+ ONLY IF type is CODEBASE_EXPLORATION or HYBRID.
35
+
36
+ Spawn an exploration agent with run_in_background: true.
37
+
38
+ Agent instruction:
39
+ ```
40
+ You are researching the codebase to answer: "{research question}"
41
+
42
+ PROJECT CONTEXT:
43
+ {from PROJECT.md: tech stack, architecture, conventions}
44
+
45
+ YOUR TASK:
46
+ 1. Search for files and code related to: {topic}
47
+ - Use Glob to find files by name pattern
48
+ - Use Grep to search file contents for relevant patterns
49
+ - Read key files to understand implementation details
50
+
51
+ 2. For each relevant finding, record:
52
+ - File path and line numbers
53
+ - What the code does
54
+ - What pattern it follows
55
+ - How it relates to the research question
56
+
57
+ 3. Look for:
58
+ - Existing implementations of similar features
59
+ - Patterns and conventions used in the codebase
60
+ - Utilities, helpers, and shared code that could be reused
61
+ - Test patterns used for similar features
62
+ - Configuration and setup patterns
63
+
64
+ 4. Compile findings into a structured summary:
65
+ - Existing patterns found: {list with file references}
66
+ - Reusable code: {list of utilities/helpers that apply}
67
+ - Conventions: {naming, structure, testing patterns}
68
+ - Gaps: {what does NOT exist yet that would be needed}
69
+ - Recommendation: {how to approach the implementation based on existing patterns}
70
+ ```
71
+
72
+ WHY: Codebase exploration prevents reinventing the wheel. Finding existing patterns before writing a spec ensures the spec follows conventions.
73
+ </step>
74
+
75
+ <step name="spawn_web_agents" priority="third">
76
+ ONLY IF type is WEB_RESEARCH or HYBRID.
77
+
78
+ Spawn a web research agent with run_in_background: true.
79
+
80
+ Agent instruction:
81
+ ```
82
+ You are researching an external topic to inform a specification.
83
+
84
+ RESEARCH QUESTION: "{research question}"
85
+
86
+ PROJECT CONTEXT:
87
+ {from PROJECT.md: tech stack — so research is relevant to the stack}
88
+
89
+ YOUR TASK:
90
+ 1. Use WebSearch to find information about: {topic}
91
+ 2. Search for:
92
+ - Official documentation for relevant libraries/tools
93
+ - Best practices and common patterns
94
+ - Comparison articles if evaluating options
95
+ - Known issues, gotchas, and caveats
96
+ - Security considerations
97
+
98
+ 3. For each option/approach found:
99
+ - Name and description
100
+ - Pros: {advantages}
101
+ - Cons: {disadvantages}
102
+ - Maturity: {stable, beta, experimental}
103
+ - Community: {active, declining, abandoned}
104
+ - Compatibility with our stack: {yes/no, details}
105
+
106
+ 4. Compile findings into a structured summary:
107
+ - Options evaluated: {list}
108
+ - Recommended option: {which and why}
109
+ - Key considerations: {trade-offs, risks}
110
+ - Implementation notes: {relevant details for the spec}
111
+ ```
112
+
113
+ WHY: Web research prevents choosing outdated or inappropriate tools. It also surfaces gotchas that would otherwise be discovered mid-implementation.
114
+ </step>
115
+
116
+ <step name="review_findings" priority="fourth">
117
+ Wait for all agents to complete.
118
+
119
+ Read and synthesize the results:
120
+
121
+ FOR CODEBASE FINDINGS:
122
+ - Are the patterns consistent? Or are there competing approaches in the codebase?
123
+ - Is there reusable code? How much can be leveraged?
124
+ - What gaps need to be filled?
125
+
126
+ FOR WEB FINDINGS:
127
+ - Are the recommended options compatible with our stack?
128
+ - Do any options conflict with existing patterns?
129
+ - Are there security concerns?
130
+
131
+ FOR HYBRID:
132
+ - Do the codebase patterns align with external best practices?
133
+ - Where do they diverge? Is the divergence justified?
134
+
135
+ Present the synthesized findings to the user:
136
+ ```
137
+ Research Findings: {topic}
138
+
139
+ Codebase:
140
+ - Found {N} relevant patterns
141
+ - Key pattern: {description} (used in {files})
142
+ - Reusable: {list of utilities/helpers}
143
+ - Gap: {what is missing}
144
+
145
+ External:
146
+ - Recommended approach: {option}
147
+ - Key trade-off: {trade-off}
148
+ - Risk: {risk}
149
+
150
+ Recommendation for spec:
151
+ {How to approach this in the specification, given both codebase and external findings}
152
+ ```
153
+
154
+ Ask: "Does this answer your question? Any follow-up research needed?"
155
+
156
+ IF FOLLOW-UP NEEDED: Return to step 1 with the refined question.
157
+
158
+ WHY: Raw agent output needs synthesis. The user should see a coherent recommendation, not a dump of search results.
159
+ </step>
160
+
161
+ <step name="save_findings" priority="fifth">
162
+ Create .sdlc/research/{topic-slug}.md:
163
+
164
+ ```markdown
165
+ # Research: {topic}
166
+
167
+ ## Question
168
+ {Original research question}
169
+
170
+ ## Date
171
+ {ISO timestamp}
172
+
173
+ ## Type
174
+ {CODEBASE|WEB|HYBRID}
175
+
176
+ ## Codebase Findings
177
+ {Structured findings from codebase exploration}
178
+ - Pattern: {description} — {file}:{line}
179
+ - Reusable: {utility/helper} — {file}
180
+
181
+ ## External Findings
182
+ {Structured findings from web research}
183
+ - Option: {name} — Pros: {pros}, Cons: {cons}
184
+
185
+ ## Synthesis
186
+ {Combined analysis}
187
+
188
+ ## Recommendation
189
+ {What to do in the spec, and why}
190
+
191
+ ## References
192
+ - {file paths for codebase references}
193
+ - {URLs for web references}
194
+ ```
195
+
196
+ WHY: Research findings are reusable. A future spec in the same area should read prior research instead of re-doing it. The research/ directory is a knowledge base.
197
+ </step>
198
+
199
+ <step name="route_to_spec" priority="sixth">
200
+ Update .sdlc/STATE.md:
201
+ - Add history entry: "{timestamp} | research | Topic: {topic}. Type: {type}. Findings saved."
202
+ - next_required_action: /sdlc:spec (if not already set)
203
+
204
+ Display:
205
+ ```
206
+ Research complete.
207
+
208
+ Findings: .sdlc/research/{topic-slug}.md
209
+
210
+ The spec phase will use these findings for informed task decomposition.
211
+
212
+ NEXT ACTION REQUIRED: /sdlc:spec
213
+ Run /sdlc:spec to create a specification informed by this research.
214
+ ```
215
+
216
+ WHY: Research without a spec is just reading. The forcing function ensures findings are applied to actual work.
217
+ </step>
218
+
219
+ </process>
@@ -0,0 +1,159 @@
1
+ <purpose>Restore a paused session by reading the handoff document, loading context, and directing the user to exactly one next action. Eliminates the cold-start problem when returning to work.</purpose>
2
+ <when_to_use>Run at the start of a new session after /sdlc:pause was used. Also useful when returning to a project after any break, even if /sdlc:pause was not explicitly run.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/HANDOFF.md (if exists)</required_reading>
4
+ <loop_context>
5
+ expected_phase: RESUME (transitional — immediately routes to the correct phase)
6
+ prior_phase: whatever was active when paused
7
+ next_phase: determined by STATE.md
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="read_state" priority="first">
12
+ Read .sdlc/STATE.md.
13
+
14
+ IF .sdlc/ DOES NOT EXIST:
15
+ STOP. Display: "No SDLC project found. Run /sdlc:init to initialize."
16
+
17
+ IF STATE.md DOES NOT EXIST:
18
+ STOP. Display: "STATE.md not found. The .sdlc/ directory may be corrupted. Run /sdlc:init to re-initialize."
19
+
20
+ Extract:
21
+ - Current milestone, phase, plan
22
+ - Loop position
23
+ - Next required action
24
+ - Last history entry
25
+ - paused_at timestamp (if present)
26
+
27
+ WHY: STATE.md is the single source of truth. If it is missing, nothing else works.
28
+ </step>
29
+
30
+ <step name="find_handoff" priority="second">
31
+ Check for .sdlc/HANDOFF.md.
32
+
33
+ IF HANDOFF.md EXISTS:
34
+ Read it. Extract:
35
+ - When the session was paused
36
+ - What was done last session
37
+ - In-progress work details
38
+ - Decisions made
39
+ - Blockers / open questions
40
+ - User context notes
41
+ - Git state at pause time
42
+
43
+ Calculate time since pause: {now} - {paused_at}
44
+ Display: "Last session was {N hours/days} ago."
45
+
46
+ IF HANDOFF.md DOES NOT EXIST:
47
+ This is a cold resume without a formal pause.
48
+ Fall back to STATE.md only.
49
+ Display: "No handoff found. Resuming from STATE.md."
50
+
51
+ Read the most recent files in .sdlc/phases/ to reconstruct context:
52
+ - Most recent SPEC.md, SUMMARY.md, REVIEW.md, or VERIFY.md
53
+ - Build a brief context summary from these files
54
+
55
+ WHY: HANDOFF.md has rich context. Without it, we can still resume but with less context — the state machine still knows the next action.
56
+ </step>
57
+
58
+ <step name="restore_context" priority="third">
59
+ Present the restored context to the user:
60
+
61
+ ```
62
+ === SESSION RESUMED ===
63
+
64
+ Project: {from PROJECT.md}
65
+ Milestone: {number} — {name}
66
+ Phase: {number} — {name}
67
+ Plan: {number} — {title, if active}
68
+
69
+ Loop position: {position}
70
+ Last action: {from history}
71
+
72
+ {IF HANDOFF EXISTS:}
73
+ Last session summary:
74
+ - {what was done}
75
+ - {what was done}
76
+
77
+ In-progress:
78
+ - {task/AC status}
79
+
80
+ Decisions from last session:
81
+ - {decision}
82
+
83
+ Blockers:
84
+ - {blocker, if any}
85
+
86
+ User notes:
87
+ - {user context, if any}
88
+ ```
89
+
90
+ IF BLOCKERS WERE RECORDED:
91
+ Ask: "These blockers were noted last session: {blockers}. Are they resolved?"
92
+ If resolved: note resolution and proceed.
93
+ If not resolved: "These blockers may affect the next action. Proceed anyway or address them first?"
94
+
95
+ WHY: Presenting context upfront saves the user from having to re-read files. The blocker check prevents wasting time on work that is still blocked.
96
+ </step>
97
+
98
+ <step name="check_git_state" priority="fourth">
99
+ IF a git repository exists:
100
+
101
+ Run: git status
102
+
103
+ Compare current git state to the handoff's recorded git state:
104
+ - Is the branch the same?
105
+ - Are there new commits since the pause? (someone else may have pushed)
106
+ - Are there uncommitted changes or stashed changes?
107
+
108
+ IF BRANCH CHANGED:
109
+ Display: "WARNING: You are on branch {current} but the handoff was on branch {paused}. Switch back?"
110
+
111
+ IF NEW COMMITS EXIST:
112
+ Display: "New commits since last session: {count}. These may affect in-progress work."
113
+ Run: git log --oneline {paused_commit}..HEAD
114
+ Display the new commits.
115
+
116
+ IF STASHED CHANGES:
117
+ Ask: "Stashed changes from last session exist. Pop the stash to restore them? (yes/no)"
118
+ If yes: run git stash pop
119
+
120
+ WHY: Git state can drift between sessions. Catching mismatches early prevents confusion when code does not behave as expected.
121
+ </step>
122
+
123
+ <step name="determine_next_action" priority="fifth">
124
+ Read next_required_action from STATE.md. This is the SINGLE next action.
125
+
126
+ MAP the action to a clear instruction:
127
+
128
+ /sdlc:spec → "Create the next specification"
129
+ /sdlc:impl → "Implement the current specification"
130
+ /sdlc:verify → "Verify acceptance criteria"
131
+ /sdlc:review → "Review for engineering law compliance"
132
+ /sdlc:close → "Close the current loop"
133
+ /sdlc:transition → "Transition to the next phase"
134
+ /sdlc:milestone → "Complete or create a milestone"
135
+
136
+ WHY: Exactly ONE next action. Not two options. Not "you could do X or Y." The state machine has already decided. The user just needs to execute it.
137
+ </step>
138
+
139
+ <step name="archive_handoff" priority="sixth">
140
+ IF HANDOFF.md was consumed:
141
+ Move it to .sdlc/HANDOFF-{timestamp}.md.archived (rename, do not delete)
142
+ This prevents the next resume from re-reading stale context.
143
+
144
+ Update .sdlc/STATE.md:
145
+ - Remove paused_at field (session is now active)
146
+ - Add history entry: "{timestamp} | resume | Resumed from {loop_position}. Time since pause: {duration}."
147
+
148
+ Display:
149
+ ```
150
+ Resumed at: {loop_position}
151
+
152
+ NEXT ACTION REQUIRED: {next_required_action}
153
+ Run {next_required_action} to continue.
154
+ ```
155
+
156
+ WHY: Archiving (not deleting) the handoff preserves the audit trail while preventing stale context from confusing future resumes.
157
+ </step>
158
+
159
+ </process>