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,527 +1,527 @@
1
- # Build and Test
2
-
3
- **Purpose**: Build all units and execute comprehensive testing strategy
4
-
5
- ## Prerequisites
6
- - Code Generation must be complete for all units
7
- - All code artifacts must be generated
8
- - Project is ready for build and testing
9
-
10
- ## Agent Delegation Strategy
11
-
12
- **MANDATORY**: Delegate test execution to `qa-tester`. Do NOT run test suites directly.
13
-
14
- **Execution mode**: Foreground sequential — the orchestrator generates instruction documents first, then delegates actual test execution to the agent.
15
-
16
- **Delegation scope**:
17
- - **Orchestrator retains**: Steps 1-7 (analyze testing requirements, generate build instructions, generate unit/integration/performance/additional test instructions, generate test summary) and Steps 8-10 (state update, results presentation, audit logging). The orchestrator creates all instruction documentation.
18
- - **Delegated to `qa-tester`**: After instruction documents are generated (post-Step 7), delegate actual test execution to `qa-tester`. The agent uses the generated instruction files as input to build the project and run all test suites (unit, integration, performance, etc.). The agent reports pass/fail results for each test category.
19
-
20
- **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.
21
-
22
- **After agent completes**: The orchestrator incorporates the agent's test results into the build-and-test-summary.md, presents the results to the user (Step 9), and manages the approval gate.
23
-
24
- ## Orchestrator Verification Requirements
25
-
26
- After `qa-tester` reports results, the orchestrator MUST independently verify — never trust agent self-reports alone:
27
-
28
- - **Build Verification**: Run the build command yourself (e.g., `npm run build`, `mvn clean install`) and confirm exit code 0.
29
- - **Test Verification**: Run the test suite yourself and confirm all tests pass. Compare your results against the agent's report.
30
- - **Failure Loop**: If failures are found, delegate fixes to the appropriate agent (`olympian` for code fixes, `oracle` or `oracle-medium` for root cause analysis), then re-verify independently.
31
- - **No Early Exit**: Do not declare Build & Test complete until ALL test categories pass your independent verification.
32
- - **Evidence-Based Reporting**: When presenting results to the user (Step 9), include the actual command output you observed, not just the agent's summary.
33
-
34
- ---
35
-
36
- ## Step 1: Analyze Testing Requirements
37
-
38
- Analyze the project to determine appropriate testing strategy:
39
- - **Unit tests**: Already generated per unit during code generation
40
- - **Integration tests**: Test interactions between units/services
41
- - **Performance tests**: Load, stress, and scalability testing
42
- - **End-to-end tests**: Complete user workflows
43
- - **Contract tests**: API contract validation between services
44
- - **Security tests**: Vulnerability scanning, penetration testing
45
-
46
- ---
47
-
48
- ## Step 2: Generate Build Instructions
49
-
50
- Create `aidlc-docs/construction/build-and-test/build-instructions.md`:
51
-
52
- ```markdown
53
- # Build Instructions
54
-
55
- ## Prerequisites
56
- - **Build Tool**: [Tool name and version]
57
- - **Dependencies**: [List all required dependencies]
58
- - **Environment Variables**: [List required env vars]
59
- - **System Requirements**: [OS, memory, disk space]
60
-
61
- ## Build Steps
62
-
63
- ### 1. Install Dependencies
64
- \`\`\`bash
65
- [Command to install dependencies]
66
- # Example: npm install, mvn dependency:resolve, pip install -r requirements.txt
67
- \`\`\`
68
-
69
- ### 2. Configure Environment
70
- \`\`\`bash
71
- [Commands to set up environment]
72
- # Example: export variables, configure credentials
73
- \`\`\`
74
-
75
- ### 3. Build All Units
76
- \`\`\`bash
77
- [Command to build all units]
78
- # Example: mvn clean install, npm run build, brazil-build
79
- \`\`\`
80
-
81
- ### 4. Verify Build Success
82
- - **Expected Output**: [Describe successful build output]
83
- - **Build Artifacts**: [List generated artifacts and locations]
84
- - **Common Warnings**: [Note any acceptable warnings]
85
-
86
- ## Troubleshooting
87
-
88
- ### Build Fails with Dependency Errors
89
- - **Cause**: [Common causes]
90
- - **Solution**: [Step-by-step fix]
91
-
92
- ### Build Fails with Compilation Errors
93
- - **Cause**: [Common causes]
94
- - **Solution**: [Step-by-step fix]
95
- ```
96
-
97
- ---
98
-
99
- ## Step 3: Generate Unit Test Execution Instructions
100
-
101
- Create `aidlc-docs/construction/build-and-test/unit-test-instructions.md`:
102
-
103
- ```markdown
104
- # Unit Test Execution
105
-
106
- ## Run Unit Tests
107
-
108
- ### 1. Execute All Unit Tests
109
- \`\`\`bash
110
- [Command to run all unit tests]
111
- # Example: mvn test, npm test, pytest tests/unit
112
- \`\`\`
113
-
114
- ### 2. Review Test Results
115
- - **Expected**: [X] tests pass, 0 failures
116
- - **Test Coverage**: [Expected coverage percentage]
117
- - **Test Report Location**: [Path to test reports]
118
-
119
- ### 3. Fix Failing Tests
120
- If tests fail:
121
- 1. Review test output in [location]
122
- 2. Identify failing test cases
123
- 3. Fix code issues
124
- 4. Rerun tests until all pass
125
- ```
126
-
127
- ---
128
-
129
- ## Step 4: Generate Integration Test Instructions
130
-
131
- Create `aidlc-docs/construction/build-and-test/integration-test-instructions.md`:
132
-
133
- ```markdown
134
- # Integration Test Instructions
135
-
136
- ## Purpose
137
- Test interactions between units/services to ensure they work together correctly.
138
-
139
- ## Test Scenarios
140
-
141
- ### Scenario 1: [Unit A] → [Unit B] Integration
142
- - **Description**: [What is being tested]
143
- - **Setup**: [Required test environment setup]
144
- - **Test Steps**: [Step-by-step test execution]
145
- - **Expected Results**: [What should happen]
146
- - **Cleanup**: [How to clean up after test]
147
-
148
- ### Scenario 2: [Unit B] → [Unit C] Integration
149
- [Similar structure]
150
-
151
- ## Setup Integration Test Environment
152
-
153
- ### 1. Start Required Services
154
- \`\`\`bash
155
- [Commands to start services]
156
- # Example: docker-compose up, start test database
157
- \`\`\`
158
-
159
- ### 2. Configure Service Endpoints
160
- \`\`\`bash
161
- [Commands to configure endpoints]
162
- # Example: export API_URL=http://localhost:8080
163
- \`\`\`
164
-
165
- ## Run Integration Tests
166
-
167
- ### 1. Execute Integration Test Suite
168
- \`\`\`bash
169
- [Command to run integration tests]
170
- # Example: mvn integration-test, npm run test:integration
171
- \`\`\`
172
-
173
- ### 2. Verify Service Interactions
174
- - **Test Scenarios**: [List key integration test scenarios]
175
- - **Expected Results**: [Describe expected outcomes]
176
- - **Logs Location**: [Where to check logs]
177
-
178
- ### 3. Cleanup
179
- \`\`\`bash
180
- [Commands to clean up test environment]
181
- # Example: docker-compose down, stop test services
182
- \`\`\`
183
- ```
184
-
185
- ---
186
-
187
- ## Step 5: Generate Performance Test Instructions (If Applicable)
188
-
189
- Create `aidlc-docs/construction/build-and-test/performance-test-instructions.md`:
190
-
191
- ```markdown
192
- # Performance Test Instructions
193
-
194
- ## Purpose
195
- Validate system performance under load to ensure it meets requirements.
196
-
197
- ## Performance Requirements
198
- - **Response Time**: < [X]ms for [Y]% of requests
199
- - **Throughput**: [X] requests/second
200
- - **Concurrent Users**: Support [X] concurrent users
201
- - **Error Rate**: < [X]%
202
-
203
- ## Setup Performance Test Environment
204
-
205
- ### 1. Prepare Test Environment
206
- \`\`\`bash
207
- [Commands to set up performance testing]
208
- # Example: scale services, configure load balancers
209
- \`\`\`
210
-
211
- ### 2. Configure Test Parameters
212
- - **Test Duration**: [X] minutes
213
- - **Ramp-up Time**: [X] seconds
214
- - **Virtual Users**: [X] users
215
-
216
- ## Run Performance Tests
217
-
218
- ### 1. Execute Load Tests
219
- \`\`\`bash
220
- [Command to run load tests]
221
- # Example: jmeter -n -t test.jmx, k6 run script.js
222
- \`\`\`
223
-
224
- ### 2. Execute Stress Tests
225
- \`\`\`bash
226
- [Command to run stress tests]
227
- # Example: gradually increase load until failure
228
- \`\`\`
229
-
230
- ### 3. Analyze Performance Results
231
- - **Response Time**: [Actual vs Expected]
232
- - **Throughput**: [Actual vs Expected]
233
- - **Error Rate**: [Actual vs Expected]
234
- - **Bottlenecks**: [Identified bottlenecks]
235
- - **Results Location**: [Path to performance reports]
236
-
237
- ## Performance Optimization
238
-
239
- If performance doesn't meet requirements:
240
- 1. Identify bottlenecks from test results
241
- 2. Optimize code/queries/configurations
242
- 3. Rerun tests to validate improvements
243
- ```
244
-
245
- ---
246
-
247
- ## Step 6: Generate Additional Test Instructions (As Needed)
248
-
249
- Based on project requirements, generate additional test instruction files:
250
-
251
- ### Contract Tests (For Microservices)
252
- Create `aidlc-docs/construction/build-and-test/contract-test-instructions.md`:
253
- - API contract validation between services
254
- - Consumer-driven contract testing
255
- - Schema validation
256
-
257
- ### Security Tests
258
- Create `aidlc-docs/construction/build-and-test/security-test-instructions.md`:
259
- - Vulnerability scanning
260
- - Dependency security checks
261
- - Authentication/authorization testing
262
- - Input validation testing
263
-
264
- ### End-to-End Tests
265
- Create `aidlc-docs/construction/build-and-test/e2e-test-instructions.md`:
266
- - Complete user workflow testing
267
- - Cross-service scenarios
268
- - UI testing (if applicable)
269
-
270
- ---
271
-
272
- ## Step 6b: Run Smoke Tests
273
-
274
- Run the full test suite (or a targeted subset for bugfix pathway) and generate a structured
275
- test report that aggregates results across all units.
276
-
277
- **Scope parameter** — determined by `pathway_type`:
278
-
279
- | Scope | Pathway | What runs |
280
- |-------|---------|-----------|
281
- | `full` | standard, comprehensive, brownfield-enhancement, brownfield-refactor | Entire test suite |
282
- | `targeted` | bugfix | Only tests for changed units (scoped by file path filter) |
283
- | `summary` | minimal, optimization | Smoke pass — quick sanity check only |
284
-
285
- **Delegation**: Delegate test execution to `qa-tester` using the same pattern established
286
- in the Agent Delegation Strategy section. The orchestrator generates the scope instruction
287
- first, then delegates; after the agent reports, the orchestrator runs the test command
288
- independently to verify (see Orchestrator Verification Requirements above).
289
-
290
- **Output artifact**: `aidlc-docs/{workflow-id}/construction/build-and-test/test-report.md`
291
-
292
- Aggregate per-unit test reports from `aidlc-docs/{workflow-id}/construction/{unit}/testing/test-report.md`
293
- into the build-level report using this schema:
294
-
295
- ```markdown
296
- # Test Report — Build and Test
297
-
298
- ## Summary
299
-
300
- | Metric | Value |
301
- |--------|-------|
302
- | total_tests | [X] |
303
- | passed | [X] |
304
- | failed | [X] |
305
- | skipped | [X] |
306
-
307
- ## Per-Unit Breakdown
308
-
309
- | Unit | Total | Passed | Failed | Skipped | Status |
310
- |------|-------|--------|--------|---------|--------|
311
- | [unit-id] | [X] | [X] | [X] | [X] | Pass/Fail |
312
-
313
- ## Failure Details
314
-
315
- [For each failing test: unit, test name, file path, error message]
316
-
317
- ## Remediation Guidance
318
-
319
- [Populated only when failures exist — links to the failing unit's test-report.md]
320
- \`\`\`
321
-
322
- **Critical failure gate**: If `tests_failed > 0` and `allowFailures` is not set:
323
- - Block workflow progression
324
- - Surface the failing unit's `test-report.md` path in the Remediation Guidance section
325
- - Do NOT proceed to Step 6c or Step 7 until all failures are resolved or `allowFailures` is explicitly
326
- confirmed by the user
327
-
328
- ---
329
-
330
- ## Step 6c: Regression Baseline Coverage Mapping (Conditional)
331
-
332
- **Execute when**: `aidlc-docs/{workflow-id}/discovery/regression-baseline.md` exists (brownfield/bugfix pathways only).
333
-
334
- **Skip when**: No regression baseline artifact exists (greenfield workflows).
335
-
336
- **Purpose**: Close the loop between the behaviors inventoried during Reverse Engineering and the
337
- tests executed during Construction. Every baseline item must be mapped to at least one covering
338
- test — or explicitly flagged as a coverage gap.
339
-
340
- **Execution**: The orchestrator performs this step directly (no agent delegation needed). Read the
341
- regression baseline file, extract each checkbox item, then search test results and test files to
342
- find covering tests for each item.
343
-
344
- **Output artifact**: `aidlc-docs/{workflow-id}/construction/build-and-test/baseline-coverage.md`
345
-
346
- ```markdown
347
- # Regression Baseline Coverage Mapping
348
-
349
- ## Summary
350
-
351
- | Metric | Value |
352
- |--------|-------|
353
- | Total baseline behaviors | [X] |
354
- | Covered by tests | [X] |
355
- | Coverage gaps | [X] |
356
- | Coverage percentage | [X]% |
357
-
358
- ## Coverage Matrix
359
-
360
- | # | Baseline Behavior | Covering Test(s) | Status |
361
- |---|---|---|---|
362
- | 1 | [Behavior from regression-baseline.md] | [test file:test name] | Covered |
363
- | 2 | [Behavior from regression-baseline.md] | [test file:test name] | Covered |
364
- | 3 | [Behavior from regression-baseline.md] | (none identified) | Gap |
365
-
366
- ## Coverage Gaps
367
-
368
- [For each gap: explain why no test was identified and recommend whether a test should be
369
- added, or whether the behavior is verified through other means (e.g., manual QA, integration
370
- test, or framework guarantee)]
371
-
372
- ### [Gap #]: [Behavior description]
373
- - **Risk**: [Low/Medium/High — impact if this behavior silently breaks]
374
- - **Recommendation**: [Add test / Manual QA sufficient / Covered by integration test X]
375
- ```
376
-
377
- **Gap handling**: Coverage gaps are **surfaced but non-blocking**. The mapping is informational —
378
- it gives the user visibility into what is and isn't covered by automated tests. The user decides
379
- whether to add tests for gaps or accept the risk. Do NOT block workflow progression on gaps alone.
380
-
381
- **Include in summary**: Add a Regression Baseline Coverage section to `build-and-test-summary.md`
382
- (Step 7) summarizing the coverage percentage and listing any gaps.
383
-
384
- ---
385
-
386
- ## Step 7: Generate Test Summary
387
-
388
- Create `aidlc-docs/construction/build-and-test/build-and-test-summary.md`:
389
-
390
- ```markdown
391
- # Build and Test Summary
392
-
393
- ## Build Status
394
- - **Build Tool**: [Tool name]
395
- - **Build Status**: [Success/Failed]
396
- - **Build Artifacts**: [List artifacts]
397
- - **Build Time**: [Duration]
398
-
399
- ## Test Execution Summary
400
-
401
- ### Unit Tests
402
- - **Total Tests**: [X]
403
- - **Passed**: [X]
404
- - **Failed**: [X]
405
- - **Coverage**: [X]%
406
- - **Status**: [Pass/Fail]
407
-
408
- ### Integration Tests
409
- - **Test Scenarios**: [X]
410
- - **Passed**: [X]
411
- - **Failed**: [X]
412
- - **Status**: [Pass/Fail]
413
-
414
- ### Performance Tests
415
- - **Response Time**: [Actual] (Target: [Expected])
416
- - **Throughput**: [Actual] (Target: [Expected])
417
- - **Error Rate**: [Actual] (Target: [Expected])
418
- - **Status**: [Pass/Fail]
419
-
420
- ### Additional Tests
421
- - **Contract Tests**: [Pass/Fail/N/A]
422
- - **Security Tests**: [Pass/Fail/N/A]
423
- - **E2E Tests**: [Pass/Fail/N/A]
424
-
425
- ### Regression Baseline Coverage (Brownfield Only)
426
- - **Baseline Behaviors**: [X] total
427
- - **Covered by Tests**: [X] ([Y]%)
428
- - **Coverage Gaps**: [X] — see baseline-coverage.md for details
429
- [Omit this section if no regression baseline exists]
430
-
431
- ## Overall Status
432
- - **Build**: [Success/Failed]
433
- - **All Tests**: [Pass/Fail]
434
- - **Ready for Operations**: [Yes/No]
435
-
436
- ## Next Steps
437
- [If all pass]: Ready to proceed to Documentation Generation stage
438
- [If failures]: Address failing tests and rebuild
439
- ```
440
-
441
- ---
442
-
443
- ## Step 8: MANDATORY: Update State Tracking
444
-
445
- **MANDATORY**: Update BOTH state files in the SAME interaction:
446
- 1. Update `aidlc-docs/{workflow-id}/aidlc-state.md`:
447
- - Mark Build and Test stage as complete
448
- - Update current status
449
- 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — transition to documentation stage:
450
-
451
- ```json
452
- {
453
- "current_stage": "documentation",
454
- "status": "in_progress",
455
- "active_unit_id": null,
456
- "units_completed": N
457
- }
458
- ```
459
-
460
- - `current_stage` MUST be `"documentation"` (not `"complete"` — Documentation Generation follows)
461
- - `status` MUST be `"in_progress"`
462
- - Verify `units_completed` equals `units_total`
463
- - Verify all units in `construction_units` have `"code_generation_status": "completed"`
464
- - **Do NOT proceed to the next stage without completing this step**
465
-
466
- ---
467
-
468
- ## Step 9: Present Results to User
469
-
470
- Present comprehensive message:
471
-
472
- ```
473
- "🔨 Build and Test Complete!
474
-
475
- **Build Status**: [Success/Failed]
476
-
477
- **Test Results**:
478
- ✅ Unit Tests: [X] passed
479
- ✅ Integration Tests: [X] scenarios passed
480
- ✅ Performance Tests: [Status]
481
- ✅ Additional Tests: [Status]
482
-
483
- **Generated Files**:
484
- 1. ✅ build-instructions.md
485
- 2. ✅ unit-test-instructions.md
486
- 3. ✅ integration-test-instructions.md
487
- 4. ✅ performance-test-instructions.md (if applicable)
488
- 5. ✅ [additional test files as needed]
489
- 6. ✅ baseline-coverage.md (brownfield only)
490
- 7. ✅ build-and-test-summary.md
491
-
492
- **Regression Baseline**: [X]/[Y] behaviors covered ([Z]%) — [N] gaps identified
493
- [Omit this line if no regression baseline exists]
494
-
495
- Review the summary in aidlc-docs/construction/build-and-test/build-and-test-summary.md
496
-
497
- **Ready to proceed to Documentation Generation?""
498
- ```
499
-
500
- ---
501
-
502
- ## Step 10: Log Interaction
503
-
504
- **MANDATORY**: Log the phase completion in `aidlc-docs/audit.md`:
505
-
506
- ```markdown
507
- ## Build and Test Stage
508
- **Timestamp**: [ISO timestamp]
509
- **Build Status**: [Success/Failed]
510
- **Test Status**: [Pass/Fail]
511
- **Files Generated**:
512
- - build-instructions.md
513
- - unit-test-instructions.md
514
- - integration-test-instructions.md
515
- - performance-test-instructions.md
516
- - build-and-test-summary.md
517
-
518
- ---
519
- ```
520
-
521
- ---
522
-
523
- ## Mandatory Next Stage: Documentation Generation
524
-
525
- After Build and Test is approved, the workflow MUST proceed to Documentation Generation.
526
- Load `~/.claude/olympus/rules/construction/documentation.md` and execute.
527
- This stage is MANDATORY and cannot be skipped regardless of depth, pathway, or trust level.
1
+ # Build and Test
2
+
3
+ **Purpose**: Build all units and execute comprehensive testing strategy
4
+
5
+ ## Prerequisites
6
+ - Code Generation must be complete for all units
7
+ - All code artifacts must be generated
8
+ - Project is ready for build and testing
9
+
10
+ ## Agent Delegation Strategy
11
+
12
+ **MANDATORY**: Delegate test execution to `qa-tester`. Do NOT run test suites directly.
13
+
14
+ **Execution mode**: Foreground sequential — the orchestrator generates instruction documents first, then delegates actual test execution to the agent.
15
+
16
+ **Delegation scope**:
17
+ - **Orchestrator retains**: Steps 1-7 (analyze testing requirements, generate build instructions, generate unit/integration/performance/additional test instructions, generate test summary) and Steps 8-10 (state update, results presentation, audit logging). The orchestrator creates all instruction documentation.
18
+ - **Delegated to `qa-tester`**: After instruction documents are generated (post-Step 7), delegate actual test execution to `qa-tester`. The agent uses the generated instruction files as input to build the project and run all test suites (unit, integration, performance, etc.). The agent reports pass/fail results for each test category.
19
+
20
+ **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.
21
+
22
+ **After agent completes**: The orchestrator incorporates the agent's test results into the build-and-test-summary.md, presents the results to the user (Step 9), and manages the approval gate.
23
+
24
+ ## Orchestrator Verification Requirements
25
+
26
+ After `qa-tester` reports results, the orchestrator MUST independently verify — never trust agent self-reports alone:
27
+
28
+ - **Build Verification**: Run the build command yourself (e.g., `npm run build`, `mvn clean install`) and confirm exit code 0.
29
+ - **Test Verification**: Run the test suite yourself and confirm all tests pass. Compare your results against the agent's report.
30
+ - **Failure Loop**: If failures are found, delegate fixes to the appropriate agent (`olympian` for code fixes, `oracle` or `oracle-medium` for root cause analysis), then re-verify independently.
31
+ - **No Early Exit**: Do not declare Build & Test complete until ALL test categories pass your independent verification.
32
+ - **Evidence-Based Reporting**: When presenting results to the user (Step 9), include the actual command output you observed, not just the agent's summary.
33
+
34
+ ---
35
+
36
+ ## Step 1: Analyze Testing Requirements
37
+
38
+ Analyze the project to determine appropriate testing strategy:
39
+ - **Unit tests**: Already generated per unit during code generation
40
+ - **Integration tests**: Test interactions between units/services
41
+ - **Performance tests**: Load, stress, and scalability testing
42
+ - **End-to-end tests**: Complete user workflows
43
+ - **Contract tests**: API contract validation between services
44
+ - **Security tests**: Vulnerability scanning, penetration testing
45
+
46
+ ---
47
+
48
+ ## Step 2: Generate Build Instructions
49
+
50
+ Create `aidlc-docs/construction/build-and-test/build-instructions.md`:
51
+
52
+ ```markdown
53
+ # Build Instructions
54
+
55
+ ## Prerequisites
56
+ - **Build Tool**: [Tool name and version]
57
+ - **Dependencies**: [List all required dependencies]
58
+ - **Environment Variables**: [List required env vars]
59
+ - **System Requirements**: [OS, memory, disk space]
60
+
61
+ ## Build Steps
62
+
63
+ ### 1. Install Dependencies
64
+ \`\`\`bash
65
+ [Command to install dependencies]
66
+ # Example: npm install, mvn dependency:resolve, pip install -r requirements.txt
67
+ \`\`\`
68
+
69
+ ### 2. Configure Environment
70
+ \`\`\`bash
71
+ [Commands to set up environment]
72
+ # Example: export variables, configure credentials
73
+ \`\`\`
74
+
75
+ ### 3. Build All Units
76
+ \`\`\`bash
77
+ [Command to build all units]
78
+ # Example: mvn clean install, npm run build, brazil-build
79
+ \`\`\`
80
+
81
+ ### 4. Verify Build Success
82
+ - **Expected Output**: [Describe successful build output]
83
+ - **Build Artifacts**: [List generated artifacts and locations]
84
+ - **Common Warnings**: [Note any acceptable warnings]
85
+
86
+ ## Troubleshooting
87
+
88
+ ### Build Fails with Dependency Errors
89
+ - **Cause**: [Common causes]
90
+ - **Solution**: [Step-by-step fix]
91
+
92
+ ### Build Fails with Compilation Errors
93
+ - **Cause**: [Common causes]
94
+ - **Solution**: [Step-by-step fix]
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Step 3: Generate Unit Test Execution Instructions
100
+
101
+ Create `aidlc-docs/construction/build-and-test/unit-test-instructions.md`:
102
+
103
+ ```markdown
104
+ # Unit Test Execution
105
+
106
+ ## Run Unit Tests
107
+
108
+ ### 1. Execute All Unit Tests
109
+ \`\`\`bash
110
+ [Command to run all unit tests]
111
+ # Example: mvn test, npm test, pytest tests/unit
112
+ \`\`\`
113
+
114
+ ### 2. Review Test Results
115
+ - **Expected**: [X] tests pass, 0 failures
116
+ - **Test Coverage**: [Expected coverage percentage]
117
+ - **Test Report Location**: [Path to test reports]
118
+
119
+ ### 3. Fix Failing Tests
120
+ If tests fail:
121
+ 1. Review test output in [location]
122
+ 2. Identify failing test cases
123
+ 3. Fix code issues
124
+ 4. Rerun tests until all pass
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Step 4: Generate Integration Test Instructions
130
+
131
+ Create `aidlc-docs/construction/build-and-test/integration-test-instructions.md`:
132
+
133
+ ```markdown
134
+ # Integration Test Instructions
135
+
136
+ ## Purpose
137
+ Test interactions between units/services to ensure they work together correctly.
138
+
139
+ ## Test Scenarios
140
+
141
+ ### Scenario 1: [Unit A] → [Unit B] Integration
142
+ - **Description**: [What is being tested]
143
+ - **Setup**: [Required test environment setup]
144
+ - **Test Steps**: [Step-by-step test execution]
145
+ - **Expected Results**: [What should happen]
146
+ - **Cleanup**: [How to clean up after test]
147
+
148
+ ### Scenario 2: [Unit B] → [Unit C] Integration
149
+ [Similar structure]
150
+
151
+ ## Setup Integration Test Environment
152
+
153
+ ### 1. Start Required Services
154
+ \`\`\`bash
155
+ [Commands to start services]
156
+ # Example: docker-compose up, start test database
157
+ \`\`\`
158
+
159
+ ### 2. Configure Service Endpoints
160
+ \`\`\`bash
161
+ [Commands to configure endpoints]
162
+ # Example: export API_URL=http://localhost:8080
163
+ \`\`\`
164
+
165
+ ## Run Integration Tests
166
+
167
+ ### 1. Execute Integration Test Suite
168
+ \`\`\`bash
169
+ [Command to run integration tests]
170
+ # Example: mvn integration-test, npm run test:integration
171
+ \`\`\`
172
+
173
+ ### 2. Verify Service Interactions
174
+ - **Test Scenarios**: [List key integration test scenarios]
175
+ - **Expected Results**: [Describe expected outcomes]
176
+ - **Logs Location**: [Where to check logs]
177
+
178
+ ### 3. Cleanup
179
+ \`\`\`bash
180
+ [Commands to clean up test environment]
181
+ # Example: docker-compose down, stop test services
182
+ \`\`\`
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Step 5: Generate Performance Test Instructions (If Applicable)
188
+
189
+ Create `aidlc-docs/construction/build-and-test/performance-test-instructions.md`:
190
+
191
+ ```markdown
192
+ # Performance Test Instructions
193
+
194
+ ## Purpose
195
+ Validate system performance under load to ensure it meets requirements.
196
+
197
+ ## Performance Requirements
198
+ - **Response Time**: < [X]ms for [Y]% of requests
199
+ - **Throughput**: [X] requests/second
200
+ - **Concurrent Users**: Support [X] concurrent users
201
+ - **Error Rate**: < [X]%
202
+
203
+ ## Setup Performance Test Environment
204
+
205
+ ### 1. Prepare Test Environment
206
+ \`\`\`bash
207
+ [Commands to set up performance testing]
208
+ # Example: scale services, configure load balancers
209
+ \`\`\`
210
+
211
+ ### 2. Configure Test Parameters
212
+ - **Test Duration**: [X] minutes
213
+ - **Ramp-up Time**: [X] seconds
214
+ - **Virtual Users**: [X] users
215
+
216
+ ## Run Performance Tests
217
+
218
+ ### 1. Execute Load Tests
219
+ \`\`\`bash
220
+ [Command to run load tests]
221
+ # Example: jmeter -n -t test.jmx, k6 run script.js
222
+ \`\`\`
223
+
224
+ ### 2. Execute Stress Tests
225
+ \`\`\`bash
226
+ [Command to run stress tests]
227
+ # Example: gradually increase load until failure
228
+ \`\`\`
229
+
230
+ ### 3. Analyze Performance Results
231
+ - **Response Time**: [Actual vs Expected]
232
+ - **Throughput**: [Actual vs Expected]
233
+ - **Error Rate**: [Actual vs Expected]
234
+ - **Bottlenecks**: [Identified bottlenecks]
235
+ - **Results Location**: [Path to performance reports]
236
+
237
+ ## Performance Optimization
238
+
239
+ If performance doesn't meet requirements:
240
+ 1. Identify bottlenecks from test results
241
+ 2. Optimize code/queries/configurations
242
+ 3. Rerun tests to validate improvements
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Step 6: Generate Additional Test Instructions (As Needed)
248
+
249
+ Based on project requirements, generate additional test instruction files:
250
+
251
+ ### Contract Tests (For Microservices)
252
+ Create `aidlc-docs/construction/build-and-test/contract-test-instructions.md`:
253
+ - API contract validation between services
254
+ - Consumer-driven contract testing
255
+ - Schema validation
256
+
257
+ ### Security Tests
258
+ Create `aidlc-docs/construction/build-and-test/security-test-instructions.md`:
259
+ - Vulnerability scanning
260
+ - Dependency security checks
261
+ - Authentication/authorization testing
262
+ - Input validation testing
263
+
264
+ ### End-to-End Tests
265
+ Create `aidlc-docs/construction/build-and-test/e2e-test-instructions.md`:
266
+ - Complete user workflow testing
267
+ - Cross-service scenarios
268
+ - UI testing (if applicable)
269
+
270
+ ---
271
+
272
+ ## Step 6b: Run Smoke Tests
273
+
274
+ Run the full test suite (or a targeted subset for bugfix pathway) and generate a structured
275
+ test report that aggregates results across all units.
276
+
277
+ **Scope parameter** — determined by `pathway_type`:
278
+
279
+ | Scope | Pathway | What runs |
280
+ |-------|---------|-----------|
281
+ | `full` | standard, comprehensive, brownfield-enhancement, brownfield-refactor | Entire test suite |
282
+ | `targeted` | bugfix | Only tests for changed units (scoped by file path filter) |
283
+ | `summary` | minimal, optimization | Smoke pass — quick sanity check only |
284
+
285
+ **Delegation**: Delegate test execution to `qa-tester` using the same pattern established
286
+ in the Agent Delegation Strategy section. The orchestrator generates the scope instruction
287
+ first, then delegates; after the agent reports, the orchestrator runs the test command
288
+ independently to verify (see Orchestrator Verification Requirements above).
289
+
290
+ **Output artifact**: `aidlc-docs/{workflow-id}/construction/build-and-test/test-report.md`
291
+
292
+ Aggregate per-unit test reports from `aidlc-docs/{workflow-id}/construction/{unit}/testing/test-report.md`
293
+ into the build-level report using this schema:
294
+
295
+ ```markdown
296
+ # Test Report — Build and Test
297
+
298
+ ## Summary
299
+
300
+ | Metric | Value |
301
+ |--------|-------|
302
+ | total_tests | [X] |
303
+ | passed | [X] |
304
+ | failed | [X] |
305
+ | skipped | [X] |
306
+
307
+ ## Per-Unit Breakdown
308
+
309
+ | Unit | Total | Passed | Failed | Skipped | Status |
310
+ |------|-------|--------|--------|---------|--------|
311
+ | [unit-id] | [X] | [X] | [X] | [X] | Pass/Fail |
312
+
313
+ ## Failure Details
314
+
315
+ [For each failing test: unit, test name, file path, error message]
316
+
317
+ ## Remediation Guidance
318
+
319
+ [Populated only when failures exist — links to the failing unit's test-report.md]
320
+ \`\`\`
321
+
322
+ **Critical failure gate**: If `tests_failed > 0` and `allowFailures` is not set:
323
+ - Block workflow progression
324
+ - Surface the failing unit's `test-report.md` path in the Remediation Guidance section
325
+ - Do NOT proceed to Step 6c or Step 7 until all failures are resolved or `allowFailures` is explicitly
326
+ confirmed by the user
327
+
328
+ ---
329
+
330
+ ## Step 6c: Regression Baseline Coverage Mapping (Conditional)
331
+
332
+ **Execute when**: `aidlc-docs/{workflow-id}/discovery/regression-baseline.md` exists (brownfield/bugfix pathways only).
333
+
334
+ **Skip when**: No regression baseline artifact exists (greenfield workflows).
335
+
336
+ **Purpose**: Close the loop between the behaviors inventoried during Reverse Engineering and the
337
+ tests executed during Construction. Every baseline item must be mapped to at least one covering
338
+ test — or explicitly flagged as a coverage gap.
339
+
340
+ **Execution**: The orchestrator performs this step directly (no agent delegation needed). Read the
341
+ regression baseline file, extract each checkbox item, then search test results and test files to
342
+ find covering tests for each item.
343
+
344
+ **Output artifact**: `aidlc-docs/{workflow-id}/construction/build-and-test/baseline-coverage.md`
345
+
346
+ ```markdown
347
+ # Regression Baseline Coverage Mapping
348
+
349
+ ## Summary
350
+
351
+ | Metric | Value |
352
+ |--------|-------|
353
+ | Total baseline behaviors | [X] |
354
+ | Covered by tests | [X] |
355
+ | Coverage gaps | [X] |
356
+ | Coverage percentage | [X]% |
357
+
358
+ ## Coverage Matrix
359
+
360
+ | # | Baseline Behavior | Covering Test(s) | Status |
361
+ |---|---|---|---|
362
+ | 1 | [Behavior from regression-baseline.md] | [test file:test name] | Covered |
363
+ | 2 | [Behavior from regression-baseline.md] | [test file:test name] | Covered |
364
+ | 3 | [Behavior from regression-baseline.md] | (none identified) | Gap |
365
+
366
+ ## Coverage Gaps
367
+
368
+ [For each gap: explain why no test was identified and recommend whether a test should be
369
+ added, or whether the behavior is verified through other means (e.g., manual QA, integration
370
+ test, or framework guarantee)]
371
+
372
+ ### [Gap #]: [Behavior description]
373
+ - **Risk**: [Low/Medium/High — impact if this behavior silently breaks]
374
+ - **Recommendation**: [Add test / Manual QA sufficient / Covered by integration test X]
375
+ ```
376
+
377
+ **Gap handling**: Coverage gaps are **surfaced but non-blocking**. The mapping is informational —
378
+ it gives the user visibility into what is and isn't covered by automated tests. The user decides
379
+ whether to add tests for gaps or accept the risk. Do NOT block workflow progression on gaps alone.
380
+
381
+ **Include in summary**: Add a Regression Baseline Coverage section to `build-and-test-summary.md`
382
+ (Step 7) summarizing the coverage percentage and listing any gaps.
383
+
384
+ ---
385
+
386
+ ## Step 7: Generate Test Summary
387
+
388
+ Create `aidlc-docs/construction/build-and-test/build-and-test-summary.md`:
389
+
390
+ ```markdown
391
+ # Build and Test Summary
392
+
393
+ ## Build Status
394
+ - **Build Tool**: [Tool name]
395
+ - **Build Status**: [Success/Failed]
396
+ - **Build Artifacts**: [List artifacts]
397
+ - **Build Time**: [Duration]
398
+
399
+ ## Test Execution Summary
400
+
401
+ ### Unit Tests
402
+ - **Total Tests**: [X]
403
+ - **Passed**: [X]
404
+ - **Failed**: [X]
405
+ - **Coverage**: [X]%
406
+ - **Status**: [Pass/Fail]
407
+
408
+ ### Integration Tests
409
+ - **Test Scenarios**: [X]
410
+ - **Passed**: [X]
411
+ - **Failed**: [X]
412
+ - **Status**: [Pass/Fail]
413
+
414
+ ### Performance Tests
415
+ - **Response Time**: [Actual] (Target: [Expected])
416
+ - **Throughput**: [Actual] (Target: [Expected])
417
+ - **Error Rate**: [Actual] (Target: [Expected])
418
+ - **Status**: [Pass/Fail]
419
+
420
+ ### Additional Tests
421
+ - **Contract Tests**: [Pass/Fail/N/A]
422
+ - **Security Tests**: [Pass/Fail/N/A]
423
+ - **E2E Tests**: [Pass/Fail/N/A]
424
+
425
+ ### Regression Baseline Coverage (Brownfield Only)
426
+ - **Baseline Behaviors**: [X] total
427
+ - **Covered by Tests**: [X] ([Y]%)
428
+ - **Coverage Gaps**: [X] — see baseline-coverage.md for details
429
+ [Omit this section if no regression baseline exists]
430
+
431
+ ## Overall Status
432
+ - **Build**: [Success/Failed]
433
+ - **All Tests**: [Pass/Fail]
434
+ - **Ready for Operations**: [Yes/No]
435
+
436
+ ## Next Steps
437
+ [If all pass]: Ready to proceed to Documentation Generation stage
438
+ [If failures]: Address failing tests and rebuild
439
+ ```
440
+
441
+ ---
442
+
443
+ ## Step 8: MANDATORY: Update State Tracking
444
+
445
+ **MANDATORY**: Update BOTH state files in the SAME interaction:
446
+ 1. Update `aidlc-docs/{workflow-id}/aidlc-state.md`:
447
+ - Mark Build and Test stage as complete
448
+ - Update current status
449
+ 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — transition to documentation stage:
450
+
451
+ ```json
452
+ {
453
+ "current_stage": "documentation",
454
+ "status": "in_progress",
455
+ "active_unit_id": null,
456
+ "units_completed": N
457
+ }
458
+ ```
459
+
460
+ - `current_stage` MUST be `"documentation"` (not `"complete"` — Documentation Generation follows)
461
+ - `status` MUST be `"in_progress"`
462
+ - Verify `units_completed` equals `units_total`
463
+ - Verify all units in `construction_units` have `"code_generation_status": "completed"`
464
+ - **Do NOT proceed to the next stage without completing this step**
465
+
466
+ ---
467
+
468
+ ## Step 9: Present Results to User
469
+
470
+ Present comprehensive message:
471
+
472
+ ```
473
+ "🔨 Build and Test Complete!
474
+
475
+ **Build Status**: [Success/Failed]
476
+
477
+ **Test Results**:
478
+ ✅ Unit Tests: [X] passed
479
+ ✅ Integration Tests: [X] scenarios passed
480
+ ✅ Performance Tests: [Status]
481
+ ✅ Additional Tests: [Status]
482
+
483
+ **Generated Files**:
484
+ 1. ✅ build-instructions.md
485
+ 2. ✅ unit-test-instructions.md
486
+ 3. ✅ integration-test-instructions.md
487
+ 4. ✅ performance-test-instructions.md (if applicable)
488
+ 5. ✅ [additional test files as needed]
489
+ 6. ✅ baseline-coverage.md (brownfield only)
490
+ 7. ✅ build-and-test-summary.md
491
+
492
+ **Regression Baseline**: [X]/[Y] behaviors covered ([Z]%) — [N] gaps identified
493
+ [Omit this line if no regression baseline exists]
494
+
495
+ Review the summary in aidlc-docs/construction/build-and-test/build-and-test-summary.md
496
+
497
+ **Ready to proceed to Documentation Generation?""
498
+ ```
499
+
500
+ ---
501
+
502
+ ## Step 10: Log Interaction
503
+
504
+ **MANDATORY**: Log the phase completion in `aidlc-docs/audit.md`:
505
+
506
+ ```markdown
507
+ ## Build and Test Stage
508
+ **Timestamp**: [ISO timestamp]
509
+ **Build Status**: [Success/Failed]
510
+ **Test Status**: [Pass/Fail]
511
+ **Files Generated**:
512
+ - build-instructions.md
513
+ - unit-test-instructions.md
514
+ - integration-test-instructions.md
515
+ - performance-test-instructions.md
516
+ - build-and-test-summary.md
517
+
518
+ ---
519
+ ```
520
+
521
+ ---
522
+
523
+ ## Mandatory Next Stage: Documentation Generation
524
+
525
+ After Build and Test is approved, the workflow MUST proceed to Documentation Generation.
526
+ Load `~/.claude/olympus/rules/construction/documentation.md` and execute.
527
+ This stage is MANDATORY and cannot be skipped regardless of depth, pathway, or trust level.