olympus-ai 4.5.13 → 4.5.14

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 (49) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/cli/index.js +63 -27
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/hooks/olympus-hooks.cjs +257 -257
  5. package/dist/installer/hooks.d.ts +47 -14
  6. package/dist/installer/hooks.d.ts.map +1 -1
  7. package/dist/installer/hooks.js +45 -77
  8. package/dist/installer/hooks.js.map +1 -1
  9. package/dist/installer/index.d.ts +8 -7
  10. package/dist/installer/index.d.ts.map +1 -1
  11. package/dist/installer/index.js +49 -46
  12. package/dist/installer/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/config/risk-keywords.json +5 -5
  15. package/resources/rules/common/ascii-diagram-standards.md +115 -115
  16. package/resources/rules/common/content-validation.md +131 -131
  17. package/resources/rules/common/error-handling.md +430 -430
  18. package/resources/rules/common/markdown-formatting.md +170 -170
  19. package/resources/rules/common/overconfidence-prevention.md +100 -100
  20. package/resources/rules/common/pathway-behaviors.json +60 -60
  21. package/resources/rules/common/pathway-behaviors.md +100 -100
  22. package/resources/rules/common/process-overview.md +157 -157
  23. package/resources/rules/common/terminal-formatting.md +161 -161
  24. package/resources/rules/common/terminology.md +189 -189
  25. package/resources/rules/common/welcome-message.md +118 -118
  26. package/resources/rules/common/workflow-changes.md +285 -285
  27. package/resources/rules/construction/bolt-planning.md +153 -153
  28. package/resources/rules/construction/bolt-review.md +143 -143
  29. package/resources/rules/construction/build-and-test.md +527 -527
  30. package/resources/rules/construction/code-generation.md +414 -414
  31. package/resources/rules/construction/documentation.md +201 -201
  32. package/resources/rules/construction/functional-design.md +135 -135
  33. package/resources/rules/construction/infrastructure-design.md +110 -110
  34. package/resources/rules/construction/nfr-design.md +106 -106
  35. package/resources/rules/construction/nfr-requirements.md +118 -118
  36. package/resources/rules/construction/test-generation.md +112 -112
  37. package/resources/rules/core-workflow.md +196 -196
  38. package/resources/rules/inception/application-design.md +195 -195
  39. package/resources/rules/inception/bolt-planning.md +588 -588
  40. package/resources/rules/inception/reverse-engineering.md +354 -354
  41. package/resources/rules/inception/units-generation.md +505 -505
  42. package/resources/rules/inception/user-stories.md +527 -527
  43. package/resources/rules/inception/workspace-detection.md +82 -82
  44. package/resources/rules/operations/operations.md +19 -19
  45. package/resources/skills/brief/templates/ai-dlc-intent-brief-template.md +149 -149
  46. package/resources/skills/getting-started/SKILL.md +79 -79
  47. package/resources/templates/construction/bolt-spec-template.md +270 -270
  48. package/resources/templates/inception/unit-brief-template.md +188 -188
  49. package/resources/templates/inception/units-template.md +99 -99
@@ -1,354 +1,354 @@
1
- # Reverse Engineering
2
-
3
- **Purpose**: Analyze existing codebase and generate comprehensive design artifacts
4
-
5
- **Execute when**: Brownfield project detected (existing code found in workspace)
6
-
7
- **Skip when**: Greenfield project (no existing code)
8
-
9
- **Rerun behavior**: Always rerun when brownfield project detected, even if artifacts exist. This ensures artifacts reflect current code state
10
-
11
- ## Agent Delegation Strategy
12
-
13
- **MANDATORY**: Delegate codebase analysis to specialized agents. Do NOT analyze the codebase directly.
14
-
15
- **Execution mode**: Foreground parallel — launch multiple agents in the same response, but do NOT use `run_in_background: true`. This ensures:
16
- - The user can see what each agent is doing
17
- - Failed tasks are detected immediately (not silently lost)
18
- - Results are available inline without polling via TaskOutput
19
-
20
- **Recommended split**:
21
- - **Agent 1** (`explore-medium`): Static code model — modules, data models, dependencies, file inventory, technology stack
22
- - **Agent 2** (`oracle-medium`): Dynamic behavior model — user flows, auth patterns, state management, API interactions, error handling
23
-
24
- **If an agent task fails**: Follow the Agent Task Failure Recovery procedure in `error-handling.md` — retry the delegation, never silently do the work yourself.
25
-
26
- **After both agents complete**: Compile their findings into the artifact files defined in the steps below.
27
-
28
- **Optional visual analysis — `multimodal-looker`**:
29
- If the repository contains image-format architecture diagrams, ERDs, wireframes, or design documents (`.png`, `.jpg`, `.pdf`, `.svg` in the repo root, `docs/`, or `diagrams/` directories), optionally invoke `multimodal-looker` to extract architectural context from them. This enriches `architecture.md` and `business-overview.md` with information that text-only analysis cannot capture. Only invoke if relevant image files are discovered during the workspace scan — do not search exhaustively for images.
30
-
31
- ## Step 1: Multi-Package Discovery
32
-
33
- ### 1.1 Scan Workspace
34
- - All packages (not just mentioned ones)
35
- - Package relationships via config files
36
- - Package types: Application, CDK/Infrastructure, Models, Clients, Tests
37
-
38
- ### 1.2 Understand the Business Context
39
- - The core business that the system is implementing overall
40
- - The business overview of every package
41
- - List of Business Transactions that are implemented in the system
42
-
43
- ### 1.3 Infrastructure Discovery
44
- - CDK packages (package.json with CDK dependencies)
45
- - Terraform (.tf files)
46
- - CloudFormation (.yaml/.json templates)
47
- - Deployment scripts
48
-
49
- ### 1.4 Build System Discovery
50
- - Build systems: Brazil, Maven, Gradle, npm
51
- - Config files for build-system declarations
52
- - Build dependencies between packages
53
-
54
- ### 1.5 Service Architecture Discovery
55
- - Lambda functions (handlers, triggers)
56
- - Container services (Docker/ECS configs)
57
- - API definitions (Smithy models, OpenAPI specs)
58
- - Data stores (DynamoDB, S3, etc.)
59
-
60
- ### 1.6 Code Quality Analysis
61
- - Programming languages and frameworks
62
- - Test coverage indicators
63
- - Linting configurations
64
- - CI/CD pipelines
65
-
66
- ## Step 1: Generate Workspace Scan
67
-
68
- Create `aidlc-docs/{workflowId}/discovery/workspace-scan.json`:
69
-
70
- ```json
71
- {
72
- "_meta": {
73
- "artifact": "Workspace Scan",
74
- "contains": "Raw inventory of packages, languages, frameworks, and structural patterns discovered in the codebase",
75
- "reviewFor": "Verify all packages and repos were discovered. Flag any missed projects or incorrectly categorized packages."
76
- },
77
- "scanDate": "[ISO timestamp]",
78
- "projectPath": "[Project root path]",
79
- "fileCount": "[Total number of source files]",
80
- "packageStructure": {
81
- "total": "[Number]",
82
- "byType": {
83
- "application": "[Number]",
84
- "infrastructure": "[Number]",
85
- "shared": "[Number]",
86
- "test": "[Number]"
87
- }
88
- },
89
- "languages": ["[Language 1]", "[Language 2]"],
90
- "frameworks": ["[Framework 1]", "[Framework 2]"],
91
- "keyPatterns": {
92
- "architecture": "[Primary architecture pattern]",
93
- "dataFlow": "[Primary data flow pattern]",
94
- "codeOrganization": "[How code is organized]"
95
- }
96
- }
97
- ```
98
-
99
- ## Step 2: Generate Analysis Plan
100
-
101
- Create `aidlc-docs/{workflowId}/discovery/analysis-plan.md`:
102
-
103
- ```markdown
104
- > **Artifact**: Analysis Plan
105
- > **Contains**: Scope, methodology, key questions, and success criteria that guided the AI agents during reverse engineering
106
- > **Review for**: Confirm the analysis scope and key questions cover what matters to you. These questions are answered by the other discovery artifacts — you do not need to answer them yourself.
107
-
108
- # Analysis Plan
109
-
110
- ## Scope
111
- - **Analysis Focus**: [Primary areas of analysis]
112
- - **Depth Level**: [Shallow/Medium/Deep]
113
- - **Key Packages**: [List of critical packages to analyze]
114
-
115
- ## Methodology
116
- - **Agent 1 Focus**: [Static code structure analysis]
117
- - **Agent 2 Focus**: [Dynamic behavior and interactions]
118
-
119
- ## Key Questions
120
- - [Question 1]
121
- - [Question 2]
122
- - [Question 3]
123
-
124
- ## Success Criteria
125
- - [Criterion 1]
126
- - [Criterion 2]
127
- ```
128
-
129
- ## Step 3: Generate Current State Analysis
130
-
131
- Create `aidlc-docs/{workflowId}/discovery/current-state-analysis.md`:
132
-
133
- ```markdown
134
- > **Artifact**: Current State Analysis
135
- > **Contains**: Architecture summary, technology stack, component inventory, data models, and integration points
136
- > **Review for**: Verify the architecture summary and tech stack match reality. Flag missing components, incorrect relationships, or outdated technology versions.
137
-
138
- # Current State Analysis
139
-
140
- ## System Overview
141
- [High-level description of the current system state]
142
-
143
- ## Architecture Summary
144
- [Mermaid diagram showing key components and relationships]
145
-
146
- ## Technology Stack
147
- - **Languages**: [List with versions]
148
- - **Frameworks**: [List with versions]
149
- - **Runtime/Infrastructure**: [Key services]
150
-
151
- ## Component Inventory
152
- ### [Package/Component Name]
153
- - **Type**: [Application/Infrastructure/Shared/Test]
154
- - **Purpose**: [What it does]
155
- - **Technology**: [Key tech used]
156
- - **Dependencies**: [What it depends on]
157
-
158
- ## Data Models and Flows
159
- [Key data structures and flow patterns]
160
-
161
- ## Integration Points
162
- - **External APIs**: [List with purposes]
163
- - **Data Stores**: [List with purposes]
164
- - **Third-party Services**: [List with purposes]
165
- ```
166
-
167
- ## Step 4: Generate Regression Baseline
168
-
169
- Create `aidlc-docs/{workflowId}/discovery/regression-baseline.md`:
170
-
171
- ```markdown
172
- > **Artifact**: Regression Baseline
173
- > **Contains**: Test coverage status, quality metrics, known issues, technical debt, and behaviors that must be preserved
174
- > **Review for**: Confirm the baseline behavior list is complete and accurate. Add any missing behaviors that should survive the migration. These items are verified during Build and Test via coverage mapping.
175
-
176
- # Regression Baseline
177
-
178
- ## Test Coverage Status
179
- - **Overall Coverage**: [Percentage or Quality Assessment]
180
- - **Unit Tests**: [Count/Status]
181
- - **Integration Tests**: [Count/Status]
182
- - **E2E Tests**: [Count/Status]
183
-
184
- ## Quality Metrics
185
- - **Code Quality**: [Assessment: Good/Fair/Poor]
186
- - **Linting**: [Configured: Yes/No]
187
- - **Type Safety**: [Assessment]
188
- - **Documentation**: [Assessment: Good/Fair/Poor]
189
-
190
- ## Known Issues
191
- - [Issue 1 and location]
192
- - [Issue 2 and location]
193
-
194
- ## Technical Debt
195
- - [Debt item and impact]
196
-
197
- ## Baseline Tests
198
- [List of key tests that must pass in any regression]
199
- ```
200
-
201
- ## Step 5: Generate Change Impact Analysis
202
-
203
- Create `aidlc-docs/{workflowId}/discovery/change-impact.md`:
204
-
205
- ```markdown
206
- > **Artifact**: Change Impact Analysis
207
- > **Contains**: Affected components, dependency impact, risk assessment, and regression test strategy for the planned changes
208
- > **Review for**: Validate the risk levels assigned to each component. Verify all affected areas are identified — especially indirect dependencies the AI may have missed.
209
-
210
- # Change Impact Analysis
211
-
212
- ## Scope of Proposed Changes
213
- [Description of what is being changed and why]
214
-
215
- ## Components Affected
216
- ### [Component Name]
217
- - **Direct Impact**: [What changes]
218
- - **Risk Level**: [Low/Medium/High]
219
- - **Testing Required**: [What tests to run]
220
-
221
- ## Dependency Impact
222
- [Which packages/services depend on affected areas]
223
-
224
- ## Risk Assessment
225
- - **High Risk Areas**: [List]
226
- - **Low Risk Areas**: [List]
227
- - **Mitigations**: [Risk mitigation strategies]
228
-
229
- ## Regression Test Strategy
230
- [Specific tests to verify no regression]
231
- ```
232
-
233
- ## Step 6: Generate Static Model
234
-
235
- Create `aidlc-docs/{workflowId}/discovery/static-model.md`:
236
-
237
- ```markdown
238
- > **Artifact**: Static Code Model
239
- > **Contains**: Module hierarchy, data models, design patterns, package dependencies, and file inventory
240
- > **Review for**: Verify module structure and data model relationships match your understanding. Flag missing components, incorrect dependency directions, or design patterns that aren't actually used.
241
-
242
- # Static Code Model
243
-
244
- ## Module Hierarchy
245
- [Mermaid diagram showing module/package structure]
246
-
247
- ## Data Models
248
- ### [Model Name]
249
- - **Fields**: [Field descriptions]
250
- - **Relationships**: [Related models]
251
- - **Location**: [File path]
252
-
253
- ## Design Patterns
254
- ### [Pattern Name]
255
- - **Location**: [Where used in codebase]
256
- - **Purpose**: [Why used]
257
- - **Implementation**: [How implemented]
258
-
259
- ## Dependencies
260
- [Mermaid diagram showing package dependencies]
261
-
262
- ### [Package A] depends on [Package B]
263
- - **Type**: [Compile/Runtime/Test]
264
- - **Reason**: [Why dependency exists]
265
-
266
- ## File Inventory
267
- [List of key source files with their purposes]
268
- - `[path/to/file]` - [Purpose/responsibility]
269
- ```
270
-
271
- ## Step 7: Generate Dynamic Model
272
-
273
- Create `aidlc-docs/{workflowId}/discovery/dynamic-model.md`:
274
-
275
- ```markdown
276
- > **Artifact**: Dynamic Behavior Model
277
- > **Contains**: User flows, state management, authentication/authorization, API interactions, error handling, and integration patterns
278
- > **Review for**: Verify user flows and auth patterns are correctly captured. Flag missing API interactions, incorrect sequence flows, or error handling gaps the AI may have overlooked.
279
-
280
- # Dynamic Behavior Model
281
-
282
- ## User Flows
283
- [Mermaid sequence diagrams of key user workflows]
284
-
285
- ### [Workflow Name]
286
- [Sequence diagram and description]
287
-
288
- ## State Management
289
- - **Global State**: [How state is managed]
290
- - **Local State**: [Component-level state patterns]
291
- - **Data Flow**: [Unidirectional/Bidirectional/Event-driven]
292
-
293
- ## Authentication and Authorization
294
- - **Auth Mechanism**: [OAuth/Session/JWT/etc]
295
- - **Permission Model**: [How permissions are enforced]
296
- - **Flow**: [Auth sequence diagram]
297
-
298
- ## API Interactions
299
- ### [Endpoint/Service Name]
300
- - **Purpose**: [What it does]
301
- - **Request Format**: [Request structure]
302
- - **Response Format**: [Response structure]
303
- - **Callers**: [Who calls it]
304
-
305
- ## Error Handling
306
- - **Strategy**: [How errors are handled]
307
- - **Patterns**: [Common error patterns]
308
- - **Recovery**: [How the system recovers from errors]
309
-
310
- ## Integration Patterns
311
- - **Event-driven**: [Description if used]
312
- - **Request/Response**: [Description if used]
313
- - **Message Queue**: [Description if used]
314
- ```
315
-
316
- ## Step 10: MANDATORY: Update State Tracking
317
-
318
- **MANDATORY**: Update BOTH state files in the SAME interaction:
319
- 1. Update `aidlc-docs/{workflow-id}/aidlc-state.md`:
320
-
321
- ```markdown
322
- ## Reverse Engineering Status
323
- - [x] Reverse Engineering - Completed on [timestamp]
324
- - **Artifacts Location**: aidlc-docs/{workflowId}/discovery/
325
- ```
326
-
327
- 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — set reverse-engineering status to "completed" with completed_at timestamp, update current_inception_stage to next stage
328
- - **Do NOT proceed to the next stage without completing this step**
329
-
330
- ## Step 11: Present Completion Message to User
331
-
332
- ```markdown
333
- # 🔍 Reverse Engineering Complete
334
-
335
- [AI-generated summary of key findings from analysis in the form of bullet points]
336
-
337
- ---
338
-
339
- ⚠️ **REVIEW REQUIRED**
340
-
341
- > Please examine the reverse engineering artifacts at:
342
- > `aidlc-docs/{workflowId}/discovery/`
343
-
344
- **You may:**
345
- - 🔧 **Request Changes** — Ask for modifications to the reverse engineering analysis if required
346
- - ➕ **Add Skipped Stage** — Include a previously excluded stage in the workflow
347
- - ✅ **Approve & Continue** — Approve analysis and proceed to **Requirements Analysis**
348
- ```
349
-
350
- ## Step 12: Wait for User Approval
351
-
352
- - **MANDATORY**: Do not proceed until user explicitly approves
353
- - **MANDATORY**: This approval gate is **unconditional** — it must fire regardless of how the analysis was completed (by agents, retries, manual recovery, or any combination). Never skip this gate.
354
- - **MANDATORY**: Log user's response in audit.md with complete raw input
1
+ # Reverse Engineering
2
+
3
+ **Purpose**: Analyze existing codebase and generate comprehensive design artifacts
4
+
5
+ **Execute when**: Brownfield project detected (existing code found in workspace)
6
+
7
+ **Skip when**: Greenfield project (no existing code)
8
+
9
+ **Rerun behavior**: Always rerun when brownfield project detected, even if artifacts exist. This ensures artifacts reflect current code state
10
+
11
+ ## Agent Delegation Strategy
12
+
13
+ **MANDATORY**: Delegate codebase analysis to specialized agents. Do NOT analyze the codebase directly.
14
+
15
+ **Execution mode**: Foreground parallel — launch multiple agents in the same response, but do NOT use `run_in_background: true`. This ensures:
16
+ - The user can see what each agent is doing
17
+ - Failed tasks are detected immediately (not silently lost)
18
+ - Results are available inline without polling via TaskOutput
19
+
20
+ **Recommended split**:
21
+ - **Agent 1** (`explore-medium`): Static code model — modules, data models, dependencies, file inventory, technology stack
22
+ - **Agent 2** (`oracle-medium`): Dynamic behavior model — user flows, auth patterns, state management, API interactions, error handling
23
+
24
+ **If an agent task fails**: Follow the Agent Task Failure Recovery procedure in `error-handling.md` — retry the delegation, never silently do the work yourself.
25
+
26
+ **After both agents complete**: Compile their findings into the artifact files defined in the steps below.
27
+
28
+ **Optional visual analysis — `multimodal-looker`**:
29
+ If the repository contains image-format architecture diagrams, ERDs, wireframes, or design documents (`.png`, `.jpg`, `.pdf`, `.svg` in the repo root, `docs/`, or `diagrams/` directories), optionally invoke `multimodal-looker` to extract architectural context from them. This enriches `architecture.md` and `business-overview.md` with information that text-only analysis cannot capture. Only invoke if relevant image files are discovered during the workspace scan — do not search exhaustively for images.
30
+
31
+ ## Step 1: Multi-Package Discovery
32
+
33
+ ### 1.1 Scan Workspace
34
+ - All packages (not just mentioned ones)
35
+ - Package relationships via config files
36
+ - Package types: Application, CDK/Infrastructure, Models, Clients, Tests
37
+
38
+ ### 1.2 Understand the Business Context
39
+ - The core business that the system is implementing overall
40
+ - The business overview of every package
41
+ - List of Business Transactions that are implemented in the system
42
+
43
+ ### 1.3 Infrastructure Discovery
44
+ - CDK packages (package.json with CDK dependencies)
45
+ - Terraform (.tf files)
46
+ - CloudFormation (.yaml/.json templates)
47
+ - Deployment scripts
48
+
49
+ ### 1.4 Build System Discovery
50
+ - Build systems: Brazil, Maven, Gradle, npm
51
+ - Config files for build-system declarations
52
+ - Build dependencies between packages
53
+
54
+ ### 1.5 Service Architecture Discovery
55
+ - Lambda functions (handlers, triggers)
56
+ - Container services (Docker/ECS configs)
57
+ - API definitions (Smithy models, OpenAPI specs)
58
+ - Data stores (DynamoDB, S3, etc.)
59
+
60
+ ### 1.6 Code Quality Analysis
61
+ - Programming languages and frameworks
62
+ - Test coverage indicators
63
+ - Linting configurations
64
+ - CI/CD pipelines
65
+
66
+ ## Step 1: Generate Workspace Scan
67
+
68
+ Create `aidlc-docs/{workflowId}/discovery/workspace-scan.json`:
69
+
70
+ ```json
71
+ {
72
+ "_meta": {
73
+ "artifact": "Workspace Scan",
74
+ "contains": "Raw inventory of packages, languages, frameworks, and structural patterns discovered in the codebase",
75
+ "reviewFor": "Verify all packages and repos were discovered. Flag any missed projects or incorrectly categorized packages."
76
+ },
77
+ "scanDate": "[ISO timestamp]",
78
+ "projectPath": "[Project root path]",
79
+ "fileCount": "[Total number of source files]",
80
+ "packageStructure": {
81
+ "total": "[Number]",
82
+ "byType": {
83
+ "application": "[Number]",
84
+ "infrastructure": "[Number]",
85
+ "shared": "[Number]",
86
+ "test": "[Number]"
87
+ }
88
+ },
89
+ "languages": ["[Language 1]", "[Language 2]"],
90
+ "frameworks": ["[Framework 1]", "[Framework 2]"],
91
+ "keyPatterns": {
92
+ "architecture": "[Primary architecture pattern]",
93
+ "dataFlow": "[Primary data flow pattern]",
94
+ "codeOrganization": "[How code is organized]"
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Step 2: Generate Analysis Plan
100
+
101
+ Create `aidlc-docs/{workflowId}/discovery/analysis-plan.md`:
102
+
103
+ ```markdown
104
+ > **Artifact**: Analysis Plan
105
+ > **Contains**: Scope, methodology, key questions, and success criteria that guided the AI agents during reverse engineering
106
+ > **Review for**: Confirm the analysis scope and key questions cover what matters to you. These questions are answered by the other discovery artifacts — you do not need to answer them yourself.
107
+
108
+ # Analysis Plan
109
+
110
+ ## Scope
111
+ - **Analysis Focus**: [Primary areas of analysis]
112
+ - **Depth Level**: [Shallow/Medium/Deep]
113
+ - **Key Packages**: [List of critical packages to analyze]
114
+
115
+ ## Methodology
116
+ - **Agent 1 Focus**: [Static code structure analysis]
117
+ - **Agent 2 Focus**: [Dynamic behavior and interactions]
118
+
119
+ ## Key Questions
120
+ - [Question 1]
121
+ - [Question 2]
122
+ - [Question 3]
123
+
124
+ ## Success Criteria
125
+ - [Criterion 1]
126
+ - [Criterion 2]
127
+ ```
128
+
129
+ ## Step 3: Generate Current State Analysis
130
+
131
+ Create `aidlc-docs/{workflowId}/discovery/current-state-analysis.md`:
132
+
133
+ ```markdown
134
+ > **Artifact**: Current State Analysis
135
+ > **Contains**: Architecture summary, technology stack, component inventory, data models, and integration points
136
+ > **Review for**: Verify the architecture summary and tech stack match reality. Flag missing components, incorrect relationships, or outdated technology versions.
137
+
138
+ # Current State Analysis
139
+
140
+ ## System Overview
141
+ [High-level description of the current system state]
142
+
143
+ ## Architecture Summary
144
+ [Mermaid diagram showing key components and relationships]
145
+
146
+ ## Technology Stack
147
+ - **Languages**: [List with versions]
148
+ - **Frameworks**: [List with versions]
149
+ - **Runtime/Infrastructure**: [Key services]
150
+
151
+ ## Component Inventory
152
+ ### [Package/Component Name]
153
+ - **Type**: [Application/Infrastructure/Shared/Test]
154
+ - **Purpose**: [What it does]
155
+ - **Technology**: [Key tech used]
156
+ - **Dependencies**: [What it depends on]
157
+
158
+ ## Data Models and Flows
159
+ [Key data structures and flow patterns]
160
+
161
+ ## Integration Points
162
+ - **External APIs**: [List with purposes]
163
+ - **Data Stores**: [List with purposes]
164
+ - **Third-party Services**: [List with purposes]
165
+ ```
166
+
167
+ ## Step 4: Generate Regression Baseline
168
+
169
+ Create `aidlc-docs/{workflowId}/discovery/regression-baseline.md`:
170
+
171
+ ```markdown
172
+ > **Artifact**: Regression Baseline
173
+ > **Contains**: Test coverage status, quality metrics, known issues, technical debt, and behaviors that must be preserved
174
+ > **Review for**: Confirm the baseline behavior list is complete and accurate. Add any missing behaviors that should survive the migration. These items are verified during Build and Test via coverage mapping.
175
+
176
+ # Regression Baseline
177
+
178
+ ## Test Coverage Status
179
+ - **Overall Coverage**: [Percentage or Quality Assessment]
180
+ - **Unit Tests**: [Count/Status]
181
+ - **Integration Tests**: [Count/Status]
182
+ - **E2E Tests**: [Count/Status]
183
+
184
+ ## Quality Metrics
185
+ - **Code Quality**: [Assessment: Good/Fair/Poor]
186
+ - **Linting**: [Configured: Yes/No]
187
+ - **Type Safety**: [Assessment]
188
+ - **Documentation**: [Assessment: Good/Fair/Poor]
189
+
190
+ ## Known Issues
191
+ - [Issue 1 and location]
192
+ - [Issue 2 and location]
193
+
194
+ ## Technical Debt
195
+ - [Debt item and impact]
196
+
197
+ ## Baseline Tests
198
+ [List of key tests that must pass in any regression]
199
+ ```
200
+
201
+ ## Step 5: Generate Change Impact Analysis
202
+
203
+ Create `aidlc-docs/{workflowId}/discovery/change-impact.md`:
204
+
205
+ ```markdown
206
+ > **Artifact**: Change Impact Analysis
207
+ > **Contains**: Affected components, dependency impact, risk assessment, and regression test strategy for the planned changes
208
+ > **Review for**: Validate the risk levels assigned to each component. Verify all affected areas are identified — especially indirect dependencies the AI may have missed.
209
+
210
+ # Change Impact Analysis
211
+
212
+ ## Scope of Proposed Changes
213
+ [Description of what is being changed and why]
214
+
215
+ ## Components Affected
216
+ ### [Component Name]
217
+ - **Direct Impact**: [What changes]
218
+ - **Risk Level**: [Low/Medium/High]
219
+ - **Testing Required**: [What tests to run]
220
+
221
+ ## Dependency Impact
222
+ [Which packages/services depend on affected areas]
223
+
224
+ ## Risk Assessment
225
+ - **High Risk Areas**: [List]
226
+ - **Low Risk Areas**: [List]
227
+ - **Mitigations**: [Risk mitigation strategies]
228
+
229
+ ## Regression Test Strategy
230
+ [Specific tests to verify no regression]
231
+ ```
232
+
233
+ ## Step 6: Generate Static Model
234
+
235
+ Create `aidlc-docs/{workflowId}/discovery/static-model.md`:
236
+
237
+ ```markdown
238
+ > **Artifact**: Static Code Model
239
+ > **Contains**: Module hierarchy, data models, design patterns, package dependencies, and file inventory
240
+ > **Review for**: Verify module structure and data model relationships match your understanding. Flag missing components, incorrect dependency directions, or design patterns that aren't actually used.
241
+
242
+ # Static Code Model
243
+
244
+ ## Module Hierarchy
245
+ [Mermaid diagram showing module/package structure]
246
+
247
+ ## Data Models
248
+ ### [Model Name]
249
+ - **Fields**: [Field descriptions]
250
+ - **Relationships**: [Related models]
251
+ - **Location**: [File path]
252
+
253
+ ## Design Patterns
254
+ ### [Pattern Name]
255
+ - **Location**: [Where used in codebase]
256
+ - **Purpose**: [Why used]
257
+ - **Implementation**: [How implemented]
258
+
259
+ ## Dependencies
260
+ [Mermaid diagram showing package dependencies]
261
+
262
+ ### [Package A] depends on [Package B]
263
+ - **Type**: [Compile/Runtime/Test]
264
+ - **Reason**: [Why dependency exists]
265
+
266
+ ## File Inventory
267
+ [List of key source files with their purposes]
268
+ - `[path/to/file]` - [Purpose/responsibility]
269
+ ```
270
+
271
+ ## Step 7: Generate Dynamic Model
272
+
273
+ Create `aidlc-docs/{workflowId}/discovery/dynamic-model.md`:
274
+
275
+ ```markdown
276
+ > **Artifact**: Dynamic Behavior Model
277
+ > **Contains**: User flows, state management, authentication/authorization, API interactions, error handling, and integration patterns
278
+ > **Review for**: Verify user flows and auth patterns are correctly captured. Flag missing API interactions, incorrect sequence flows, or error handling gaps the AI may have overlooked.
279
+
280
+ # Dynamic Behavior Model
281
+
282
+ ## User Flows
283
+ [Mermaid sequence diagrams of key user workflows]
284
+
285
+ ### [Workflow Name]
286
+ [Sequence diagram and description]
287
+
288
+ ## State Management
289
+ - **Global State**: [How state is managed]
290
+ - **Local State**: [Component-level state patterns]
291
+ - **Data Flow**: [Unidirectional/Bidirectional/Event-driven]
292
+
293
+ ## Authentication and Authorization
294
+ - **Auth Mechanism**: [OAuth/Session/JWT/etc]
295
+ - **Permission Model**: [How permissions are enforced]
296
+ - **Flow**: [Auth sequence diagram]
297
+
298
+ ## API Interactions
299
+ ### [Endpoint/Service Name]
300
+ - **Purpose**: [What it does]
301
+ - **Request Format**: [Request structure]
302
+ - **Response Format**: [Response structure]
303
+ - **Callers**: [Who calls it]
304
+
305
+ ## Error Handling
306
+ - **Strategy**: [How errors are handled]
307
+ - **Patterns**: [Common error patterns]
308
+ - **Recovery**: [How the system recovers from errors]
309
+
310
+ ## Integration Patterns
311
+ - **Event-driven**: [Description if used]
312
+ - **Request/Response**: [Description if used]
313
+ - **Message Queue**: [Description if used]
314
+ ```
315
+
316
+ ## Step 10: MANDATORY: Update State Tracking
317
+
318
+ **MANDATORY**: Update BOTH state files in the SAME interaction:
319
+ 1. Update `aidlc-docs/{workflow-id}/aidlc-state.md`:
320
+
321
+ ```markdown
322
+ ## Reverse Engineering Status
323
+ - [x] Reverse Engineering - Completed on [timestamp]
324
+ - **Artifacts Location**: aidlc-docs/{workflowId}/discovery/
325
+ ```
326
+
327
+ 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — set reverse-engineering status to "completed" with completed_at timestamp, update current_inception_stage to next stage
328
+ - **Do NOT proceed to the next stage without completing this step**
329
+
330
+ ## Step 11: Present Completion Message to User
331
+
332
+ ```markdown
333
+ # 🔍 Reverse Engineering Complete
334
+
335
+ [AI-generated summary of key findings from analysis in the form of bullet points]
336
+
337
+ ---
338
+
339
+ ⚠️ **REVIEW REQUIRED**
340
+
341
+ > Please examine the reverse engineering artifacts at:
342
+ > `aidlc-docs/{workflowId}/discovery/`
343
+
344
+ **You may:**
345
+ - 🔧 **Request Changes** — Ask for modifications to the reverse engineering analysis if required
346
+ - ➕ **Add Skipped Stage** — Include a previously excluded stage in the workflow
347
+ - ✅ **Approve & Continue** — Approve analysis and proceed to **Requirements Analysis**
348
+ ```
349
+
350
+ ## Step 12: Wait for User Approval
351
+
352
+ - **MANDATORY**: Do not proceed until user explicitly approves
353
+ - **MANDATORY**: This approval gate is **unconditional** — it must fire regardless of how the analysis was completed (by agents, retries, manual recovery, or any combination). Never skip this gate.
354
+ - **MANDATORY**: Log user's response in audit.md with complete raw input