Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

step-04e-aggregate-nfr.md 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. ---
  2. name: 'step-04e-aggregate-nfr'
  3. description: 'Aggregate NFR domain evidence audits into executive summary'
  4. nextStepFile: '{skill-root}/steps-c/step-05-generate-report.md'
  5. outputFile: '{test_artifacts}/nfr-assessment.md'
  6. ---
  7. # Step 4E: Aggregate NFR Evidence Audit Results
  8. ## STEP GOAL
  9. Read outputs from 4 parallel NFR evidence audit subagents, calculate overall risk level, aggregate compliance status, and identify cross-domain risks.
  10. ---
  11. ## MANDATORY EXECUTION RULES
  12. - 📖 Read the entire step file before acting
  13. - ✅ Speak in `{communication_language}`
  14. - ✅ Read all 4 subagent outputs
  15. - ✅ Calculate overall risk level
  16. - ❌ Do NOT re-assess NFRs (use subagent outputs)
  17. ---
  18. ## MANDATORY SEQUENCE
  19. ### 1. Read All Subagent Outputs
  20. ```javascript
  21. const domains = ['security', 'performance', 'reliability', 'scalability'];
  22. const assessments = {};
  23. domains.forEach((domain) => {
  24. const outputPath = `/tmp/tea-nfr-${domain}-{{timestamp}}.json`;
  25. assessments[domain] = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
  26. });
  27. ```
  28. ---
  29. ### 2. Calculate Overall Risk Level
  30. **Risk hierarchy:** HIGH > MEDIUM > LOW > NONE
  31. ```javascript
  32. const riskLevels = { HIGH: 3, MEDIUM: 2, LOW: 1, NONE: 0 };
  33. const domainRisks = domains.map((d) => assessments[d].risk_level);
  34. const maxRiskValue = Math.max(...domainRisks.map((r) => riskLevels[r]));
  35. const overallRisk = Object.keys(riskLevels).find((k) => riskLevels[k] === maxRiskValue);
  36. ```
  37. **Risk assessment:**
  38. - If ANY domain is HIGH → overall is HIGH
  39. - If ANY domain is MEDIUM (and none HIGH) → overall is MEDIUM
  40. - If ALL domains are LOW/NONE → overall is LOW
  41. ---
  42. ### 3. Aggregate Compliance Status
  43. ```javascript
  44. const allCompliance = {};
  45. domains.forEach((domain) => {
  46. const compliance = assessments[domain].compliance;
  47. Object.entries(compliance).forEach(([standard, status]) => {
  48. if (!allCompliance[standard]) {
  49. allCompliance[standard] = [];
  50. }
  51. allCompliance[standard].push({ domain, status });
  52. });
  53. });
  54. // Determine overall compliance per standard
  55. const complianceSummary = {};
  56. Object.entries(allCompliance).forEach(([standard, statuses]) => {
  57. const hasFail = statuses.some((s) => s.status === 'FAIL');
  58. const hasPartial = statuses.some((s) => s.status === 'PARTIAL' || s.status === 'CONCERN');
  59. complianceSummary[standard] = hasFail ? 'FAIL' : hasPartial ? 'PARTIAL' : 'PASS';
  60. });
  61. ```
  62. ---
  63. ### 4. Identify Cross-Domain Risks
  64. **Look for risks that span multiple domains:**
  65. ```javascript
  66. const crossDomainRisks = [];
  67. // Example: Performance + Scalability issue
  68. const perfConcerns = assessments.performance.findings.filter((f) => f.status !== 'PASS');
  69. const scaleConcerns = assessments.scalability.findings.filter((f) => f.status !== 'PASS');
  70. if (perfConcerns.length > 0 && scaleConcerns.length > 0) {
  71. crossDomainRisks.push({
  72. domains: ['performance', 'scalability'],
  73. description: 'Performance issues may worsen under scale',
  74. impact: 'HIGH',
  75. });
  76. }
  77. // Example: Security + Reliability issue
  78. const securityFails = assessments.security.findings.filter((f) => f.status === 'FAIL');
  79. const reliabilityConcerns = assessments.reliability.findings.filter((f) => f.status !== 'PASS');
  80. if (securityFails.length > 0 && reliabilityConcerns.length > 0) {
  81. crossDomainRisks.push({
  82. domains: ['security', 'reliability'],
  83. description: 'Security vulnerabilities may cause reliability incidents',
  84. impact: 'CRITICAL',
  85. });
  86. }
  87. ```
  88. ---
  89. ### 5. Aggregate Priority Actions
  90. ```javascript
  91. const allPriorityActions = domains.flatMap((domain) =>
  92. assessments[domain].priority_actions.map((action) => ({
  93. domain,
  94. action,
  95. urgency: assessments[domain].risk_level === 'HIGH' ? 'URGENT' : 'NORMAL',
  96. })),
  97. );
  98. // Sort by urgency
  99. const prioritizedActions = allPriorityActions.sort((a, b) => (a.urgency === 'URGENT' ? -1 : 1));
  100. ```
  101. ---
  102. ### 6. Generate Executive Summary
  103. ```javascript
  104. const resolvedMode = subagentContext?.execution?.resolvedMode ?? 'unknown';
  105. const subagentExecutionLabel =
  106. resolvedMode === 'sequential'
  107. ? 'SEQUENTIAL (4 NFR domains)'
  108. : resolvedMode === 'agent-team'
  109. ? 'AGENT-TEAM (4 NFR domains)'
  110. : resolvedMode === 'subagent'
  111. ? 'SUBAGENT (4 NFR domains)'
  112. : 'MODE-DEPENDENT (4 NFR domains)';
  113. const performanceGainLabel =
  114. resolvedMode === 'sequential'
  115. ? 'baseline (no parallel speedup)'
  116. : resolvedMode === 'agent-team' || resolvedMode === 'subagent'
  117. ? '~67% faster than sequential'
  118. : 'mode-dependent';
  119. const executiveSummary = {
  120. overall_risk: overallRisk,
  121. assessment_date: new Date().toISOString(),
  122. domain_assessments: assessments,
  123. compliance_summary: complianceSummary,
  124. cross_domain_risks: crossDomainRisks,
  125. priority_actions: prioritizedActions,
  126. risk_breakdown: {
  127. security: assessments.security.risk_level,
  128. performance: assessments.performance.risk_level,
  129. reliability: assessments.reliability.risk_level,
  130. scalability: assessments.scalability.risk_level,
  131. },
  132. subagent_execution: subagentExecutionLabel,
  133. performance_gain: performanceGainLabel,
  134. };
  135. // Save for Step 5 (report generation)
  136. fs.writeFileSync('/tmp/tea-nfr-summary-{{timestamp}}.json', JSON.stringify(executiveSummary, null, 2), 'utf8');
  137. ```
  138. ---
  139. ### 7. Display Summary to User
  140. ```
  141. ✅ NFR Evidence Audit Complete ({subagentExecutionLabel})
  142. 🎯 Overall Risk Level: {overallRisk}
  143. 📊 Domain Risk Breakdown:
  144. - Security: {security_risk}
  145. - Performance: {performance_risk}
  146. - Reliability: {reliability_risk}
  147. - Scalability: {scalability_risk}
  148. ✅ Compliance Summary:
  149. {list standards with PASS/PARTIAL/FAIL}
  150. ⚠️ Cross-Domain Risks: {cross_domain_risk_count}
  151. 🎯 Priority Actions: {priority_action_count}
  152. 🚀 Performance: {performanceGainLabel}
  153. ✅ Ready for report generation (Step 5)
  154. ```
  155. ---
  156. ---
  157. ### 8. Save Progress
  158. **Save this step's accumulated work to `{outputFile}`.**
  159. - **If `{outputFile}` does not exist** (first save), create it using the workflow template (if available) with YAML frontmatter:
  160. ```yaml
  161. ---
  162. stepsCompleted: ['step-04e-aggregate-nfr']
  163. lastStep: 'step-04e-aggregate-nfr'
  164. lastSaved: '{date}'
  165. ---
  166. ```
  167. Then write this step's output below the frontmatter.
  168. - **If `{outputFile}` already exists**, update:
  169. - Add `'step-04e-aggregate-nfr'` to `stepsCompleted` array (only if not already present)
  170. - Set `lastStep: 'step-04e-aggregate-nfr'`
  171. - Set `lastSaved: '{date}'`
  172. - Append this step's output to the appropriate section of the document.
  173. ---
  174. ## EXIT CONDITION
  175. Proceed to Step 5 when:
  176. - ✅ All subagent outputs read
  177. - ✅ Overall risk calculated
  178. - ✅ Compliance aggregated
  179. - ✅ Summary saved
  180. - ✅ Progress saved to output document
  181. Load next step: `{nextStepFile}`
  182. ---
  183. ## 🚨 SYSTEM SUCCESS METRICS
  184. ### ✅ SUCCESS:
  185. - All 4 NFR domains aggregated correctly
  186. - Overall risk level determined
  187. - Executive summary complete
  188. ### ❌ FAILURE:
  189. - Failed to read subagent outputs
  190. - Risk calculation incorrect