agentic-qe 3.7.16 → 3.7.17

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 (280) hide show
  1. package/.claude/agents/v3/qe-devils-advocate.md +20 -0
  2. package/.claude/agents/v3/qe-gap-detector.md +25 -0
  3. package/.claude/agents/v3/qe-quality-gate.md +8 -0
  4. package/.claude/agents/v3/qe-requirements-validator.md +25 -0
  5. package/.claude/agents/v3/subagents/qe-code-reviewer.md +11 -0
  6. package/.claude/agents/v3/subagents/qe-integration-reviewer.md +11 -0
  7. package/.claude/agents/v3/subagents/qe-performance-reviewer.md +11 -0
  8. package/.claude/agents/v3/subagents/qe-security-reviewer.md +11 -0
  9. package/.claude/helpers/adr-compliance.sh +10 -10
  10. package/.claude/helpers/auto-memory-hook.mjs +24 -9
  11. package/.claude/helpers/brain-checkpoint.cjs +55 -145
  12. package/.claude/helpers/ddd-tracker.sh +2 -2
  13. package/.claude/helpers/guidance-hooks.sh +2 -2
  14. package/.claude/helpers/hook-handler.cjs +57 -18
  15. package/.claude/helpers/statusline.cjs +414 -595
  16. package/.claude/helpers/v3/quality-criteria/evidence-classification.md +116 -116
  17. package/.claude/helpers/v3/quality-criteria/htsm-categories.md +139 -139
  18. package/.claude/skills/README.md +8 -11
  19. package/.claude/skills/brutal-honesty-review/SKILL.md +3 -0
  20. package/.claude/skills/code-review-quality/SKILL.md +3 -0
  21. package/.claude/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
  22. package/.claude/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
  23. package/.claude/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
  24. package/.claude/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
  25. package/.claude/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
  26. package/.claude/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
  27. package/.claude/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
  28. package/.claude/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
  29. package/.claude/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
  30. package/.claude/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
  31. package/.claude/skills/qcsd-development-swarm/SKILL.md +79 -2027
  32. package/.claude/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
  33. package/.claude/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
  34. package/.claude/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
  35. package/.claude/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
  36. package/.claude/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
  37. package/.claude/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
  38. package/.claude/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
  39. package/.claude/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
  40. package/.claude/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
  41. package/.claude/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
  42. package/.claude/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
  43. package/.claude/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
  44. package/.claude/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
  45. package/.claude/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
  46. package/.claude/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
  47. package/.claude/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
  48. package/.claude/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
  49. package/.claude/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
  50. package/.claude/skills/qcsd-production-swarm/SKILL.md +88 -2663
  51. package/.claude/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
  52. package/.claude/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
  53. package/.claude/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
  54. package/.claude/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
  55. package/.claude/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
  56. package/.claude/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
  57. package/.claude/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
  58. package/.claude/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
  59. package/.claude/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
  60. package/.claude/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
  61. package/.claude/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
  62. package/.claude/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
  63. package/.claude/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
  64. package/.claude/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
  65. package/.claude/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
  66. package/.claude/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
  67. package/.claude/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
  68. package/.claude/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
  69. package/.claude/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
  70. package/.claude/skills/sherlock-review/SKILL.md +3 -0
  71. package/.claude/skills/skill-builder/SKILL.md +103 -0
  72. package/.claude/skills/skills-manifest.json +1 -1
  73. package/CHANGELOG.md +22 -0
  74. package/assets/agents/v3/qe-devils-advocate.md +20 -0
  75. package/assets/agents/v3/qe-gap-detector.md +25 -0
  76. package/assets/agents/v3/qe-quality-gate.md +8 -0
  77. package/assets/agents/v3/qe-requirements-validator.md +25 -0
  78. package/assets/agents/v3/subagents/qe-code-reviewer.md +11 -0
  79. package/assets/agents/v3/subagents/qe-integration-reviewer.md +11 -0
  80. package/assets/agents/v3/subagents/qe-performance-reviewer.md +11 -0
  81. package/assets/agents/v3/subagents/qe-security-reviewer.md +11 -0
  82. package/assets/helpers/statusline-v3.cjs +693 -0
  83. package/assets/skills/brutal-honesty-review/SKILL.md +3 -0
  84. package/assets/skills/code-review-quality/SKILL.md +3 -0
  85. package/assets/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
  86. package/assets/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
  87. package/assets/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
  88. package/assets/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
  89. package/assets/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
  90. package/assets/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
  91. package/assets/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
  92. package/assets/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
  93. package/assets/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
  94. package/assets/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
  95. package/assets/skills/qcsd-development-swarm/SKILL.md +79 -2027
  96. package/assets/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
  97. package/assets/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
  98. package/assets/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
  99. package/assets/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
  100. package/assets/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
  101. package/assets/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
  102. package/assets/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
  103. package/assets/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
  104. package/assets/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
  105. package/assets/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
  106. package/assets/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
  107. package/assets/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
  108. package/assets/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
  109. package/assets/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
  110. package/assets/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
  111. package/assets/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
  112. package/assets/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
  113. package/assets/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
  114. package/assets/skills/qcsd-production-swarm/SKILL.md +88 -2663
  115. package/assets/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
  116. package/assets/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
  117. package/assets/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
  118. package/assets/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
  119. package/assets/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
  120. package/assets/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
  121. package/assets/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
  122. package/assets/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
  123. package/assets/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
  124. package/assets/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
  125. package/assets/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
  126. package/assets/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
  127. package/assets/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
  128. package/assets/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
  129. package/assets/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
  130. package/assets/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
  131. package/assets/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
  132. package/assets/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
  133. package/assets/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
  134. package/assets/skills/sherlock-review/SKILL.md +3 -0
  135. package/assets/templates/agent-override-example.yaml +39 -0
  136. package/dist/agents/devils-advocate/agent.d.ts +25 -1
  137. package/dist/agents/devils-advocate/agent.js +108 -4
  138. package/dist/agents/devils-advocate/types.d.ts +54 -0
  139. package/dist/agents/devils-advocate/types.js +14 -0
  140. package/dist/agents/overlay-loader.d.ts +28 -0
  141. package/dist/agents/overlay-loader.js +232 -0
  142. package/dist/agents/overlay-schema.d.ts +56 -0
  143. package/dist/agents/overlay-schema.js +77 -0
  144. package/dist/analysis/branch-enumerator.d.ts +68 -0
  145. package/dist/analysis/branch-enumerator.js +393 -0
  146. package/dist/analysis/index.d.ts +2 -0
  147. package/dist/analysis/index.js +2 -0
  148. package/dist/cli/bundle.js +2396 -614
  149. package/dist/cli/commands/coverage.js +50 -0
  150. package/dist/context/compiler.d.ts +62 -0
  151. package/dist/context/compiler.js +143 -0
  152. package/dist/context/index.d.ts +8 -0
  153. package/dist/context/index.js +6 -0
  154. package/dist/context/sources/coverage-source.d.ts +15 -0
  155. package/dist/context/sources/coverage-source.js +77 -0
  156. package/dist/context/sources/git-source.d.ts +12 -0
  157. package/dist/context/sources/git-source.js +33 -0
  158. package/dist/context/sources/index.d.ts +6 -0
  159. package/dist/context/sources/index.js +5 -0
  160. package/dist/context/sources/memory-source.d.ts +17 -0
  161. package/dist/context/sources/memory-source.js +94 -0
  162. package/dist/context/sources/test-source.d.ts +13 -0
  163. package/dist/context/sources/test-source.js +53 -0
  164. package/dist/context/sources/types.d.ts +42 -0
  165. package/dist/context/sources/types.js +5 -0
  166. package/dist/init/agents-installer.d.ts +9 -0
  167. package/dist/init/agents-installer.js +72 -0
  168. package/dist/init/phases/07-hooks.d.ts +11 -0
  169. package/dist/init/phases/07-hooks.js +67 -0
  170. package/dist/init/phases/09-assets.js +3 -0
  171. package/dist/init/settings-merge.js +1 -1
  172. package/dist/mcp/bundle.js +4411 -3979
  173. package/dist/mcp/services/task-router.d.ts +11 -0
  174. package/dist/mcp/services/task-router.js +26 -0
  175. package/dist/routing/qe-agent-registry.d.ts +11 -0
  176. package/dist/routing/qe-agent-registry.js +34 -0
  177. package/dist/routing/qe-task-router.d.ts +1 -0
  178. package/dist/routing/qe-task-router.js +34 -2
  179. package/dist/routing/types.d.ts +2 -0
  180. package/dist/validation/index.d.ts +3 -0
  181. package/dist/validation/index.js +10 -0
  182. package/dist/validation/pipeline.d.ts +80 -0
  183. package/dist/validation/pipeline.js +173 -0
  184. package/dist/validation/steps/requirements.d.ts +32 -0
  185. package/dist/validation/steps/requirements.js +596 -0
  186. package/package.json +6 -6
  187. package/.claude/agents/consensus/README.md +0 -253
  188. package/.claude/agents/deprecated/qe-api-contract-validator.md.v2 +0 -162
  189. package/.claude/agents/deprecated/qe-coverage-analyzer.md.v2 +0 -208
  190. package/.claude/agents/deprecated/qe-test-generator.md.v2 +0 -212
  191. package/.claude/agents/deprecated/qe-visual-tester.md.v2 +0 -216
  192. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -130
  193. package/.claude/agents/hive-mind/queen-coordinator.md +0 -203
  194. package/.claude/agents/hive-mind/scout-explorer.md +0 -242
  195. package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -193
  196. package/.claude/agents/hive-mind/worker-specialist.md +0 -217
  197. package/.claude/agents/neural/safla-neural.md +0 -74
  198. package/.claude/agents/optimization/README.md +0 -250
  199. package/.claude/agents/reasoning/agent.md +0 -816
  200. package/.claude/agents/reasoning/goal-planner.md +0 -73
  201. package/.claude/agents/subagents/qe-code-reviewer.md +0 -76
  202. package/.claude/agents/subagents/qe-coverage-gap-analyzer.md +0 -76
  203. package/.claude/agents/subagents/qe-data-generator.md +0 -77
  204. package/.claude/agents/subagents/qe-flaky-investigator.md +0 -91
  205. package/.claude/agents/subagents/qe-integration-tester.md +0 -90
  206. package/.claude/agents/subagents/qe-performance-validator.md +0 -92
  207. package/.claude/agents/subagents/qe-security-auditor.md +0 -94
  208. package/.claude/agents/subagents/qe-test-data-architect-sub.md +0 -93
  209. package/.claude/agents/subagents/qe-test-implementer.md +0 -106
  210. package/.claude/agents/subagents/qe-test-refactorer.md +0 -117
  211. package/.claude/agents/subagents/qe-test-writer.md +0 -112
  212. package/.claude/agents/swarm/README.md +0 -190
  213. package/.claude/agents/templates/migration-plan.md +0 -746
  214. package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -244
  215. package/.claude/agents/testing/validation/production-validator.md +0 -395
  216. package/.claude/agents/v3/README.md +0 -39
  217. package/.claude/agents/v3/typescript-specialist.yaml +0 -21
  218. package/.claude/agents/v3/v3-memory-specialist.md +0 -318
  219. package/.claude/agents/v3/v3-performance-engineer.md +0 -397
  220. package/.claude/agents/v3/v3-queen-coordinator.md +0 -98
  221. package/.claude/agents/v3/v3-security-architect.md +0 -174
  222. package/.claude/commands/README.md +0 -106
  223. package/.claude/commands/agents/README.md +0 -10
  224. package/.claude/commands/agents/agent-capabilities.md +0 -21
  225. package/.claude/commands/agents/agent-coordination.md +0 -28
  226. package/.claude/commands/agents/agent-spawning.md +0 -28
  227. package/.claude/commands/agents/agent-types.md +0 -26
  228. package/.claude/commands/coordination/README.md +0 -9
  229. package/.claude/commands/coordination/agent-spawn.md +0 -25
  230. package/.claude/commands/coordination/init.md +0 -44
  231. package/.claude/commands/coordination/orchestrate.md +0 -43
  232. package/.claude/commands/coordination/spawn.md +0 -45
  233. package/.claude/commands/coordination/swarm-init.md +0 -85
  234. package/.claude/commands/coordination/task-orchestrate.md +0 -25
  235. package/.claude/commands/hive-mind/README.md +0 -17
  236. package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -8
  237. package/.claude/commands/hive-mind/hive-mind-init.md +0 -18
  238. package/.claude/commands/hive-mind/hive-mind-memory.md +0 -8
  239. package/.claude/commands/hive-mind/hive-mind-metrics.md +0 -8
  240. package/.claude/commands/hive-mind/hive-mind-resume.md +0 -8
  241. package/.claude/commands/hive-mind/hive-mind-sessions.md +0 -8
  242. package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -21
  243. package/.claude/commands/hive-mind/hive-mind-status.md +0 -8
  244. package/.claude/commands/hive-mind/hive-mind-stop.md +0 -8
  245. package/.claude/commands/hive-mind/hive-mind-wizard.md +0 -8
  246. package/.claude/commands/hive-mind/hive-mind.md +0 -27
  247. package/.claude/commands/memory/README.md +0 -9
  248. package/.claude/commands/memory/memory-persist.md +0 -25
  249. package/.claude/commands/memory/memory-search.md +0 -25
  250. package/.claude/commands/memory/memory-usage.md +0 -25
  251. package/.claude/commands/memory/neural.md +0 -47
  252. package/.claude/commands/swarm/README.md +0 -15
  253. package/.claude/commands/swarm/swarm-analysis.md +0 -8
  254. package/.claude/commands/swarm/swarm-background.md +0 -8
  255. package/.claude/commands/swarm/swarm-init.md +0 -19
  256. package/.claude/commands/swarm/swarm-modes.md +0 -8
  257. package/.claude/commands/swarm/swarm-monitor.md +0 -8
  258. package/.claude/commands/swarm/swarm-spawn.md +0 -19
  259. package/.claude/commands/swarm/swarm-status.md +0 -8
  260. package/.claude/commands/swarm/swarm-strategies.md +0 -8
  261. package/.claude/commands/swarm/swarm.md +0 -27
  262. package/.claude/commands/training/README.md +0 -9
  263. package/.claude/commands/training/model-update.md +0 -25
  264. package/.claude/commands/training/neural-patterns.md +0 -74
  265. package/.claude/commands/training/neural-train.md +0 -25
  266. package/.claude/commands/training/pattern-learn.md +0 -25
  267. package/.claude/commands/training/specialization.md +0 -63
  268. package/.claude/commands/workflows/README.md +0 -9
  269. package/.claude/commands/workflows/development.md +0 -78
  270. package/.claude/commands/workflows/research.md +0 -63
  271. package/.claude/commands/workflows/workflow-create.md +0 -25
  272. package/.claude/commands/workflows/workflow-execute.md +0 -25
  273. package/.claude/commands/workflows/workflow-export.md +0 -25
  274. package/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
  275. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
  276. package/.claude/skills/iterative-loop/SKILL.md +0 -371
  277. package/.claude/skills/performance-analysis/SKILL.md +0 -569
  278. package/.claude/skills/performance-analysis/evals/performance-analysis.yaml +0 -144
  279. package/.claude/skills/performance-analysis/schemas/output.json +0 -588
  280. package/.claude/skills/performance-analysis/scripts/validate-config.json +0 -36
@@ -0,0 +1,91 @@
1
+ # Step 1: Analyze Story Content (Flag Detection)
2
+
3
+ ## Prerequisites
4
+ - Refinement swarm skill invoked
5
+ - User story / acceptance criteria provided
6
+ - OUTPUT_FOLDER determined
7
+
8
+ ## Instructions
9
+
10
+ ### MANDATORY: Complete this analysis before Step 2.
11
+
12
+ ### Step 0: Retrieve Ideation Phase Signals (Cross-Phase Consumption)
13
+
14
+ Before analyzing story content, retrieve the most recent Ideation phase signals from memory.
15
+
16
+ **MCP Method (preferred):**
17
+
18
+ ```javascript
19
+ mcp__agentic-qe__memory_query({
20
+ pattern: "qcsd-ideation-*",
21
+ namespace: "qcsd-ideation",
22
+ limit: 1
23
+ })
24
+ ```
25
+
26
+ **CLI Fallback:**
27
+
28
+ ```bash
29
+ npx @claude-flow/cli@latest memory search --query "qcsd-ideation" --namespace qcsd-ideation --limit 1
30
+ ```
31
+
32
+ ### Step 1: Scan Story Content and Detect Flags
33
+
34
+ Scan the user story, acceptance criteria, and any referenced specifications to SET these flags. Do not skip any flag.
35
+
36
+ ### Flag Detection (Check ALL SEVEN)
37
+
38
+ ```
39
+ HAS_API = FALSE
40
+ Set TRUE if story mentions ANY of: API, endpoint, REST, GraphQL, gRPC,
41
+ webhook, contract, consumer, provider, OpenAPI, Swagger, request/response,
42
+ HTTP method, payload, schema, backward compatibility
43
+
44
+ HAS_REFACTORING = FALSE
45
+ Set TRUE if story mentions ANY of: refactor, restructure, rewrite,
46
+ migrate, replace, consolidate, extract, decompose, simplify, optimize,
47
+ technical debt, legacy, modernize, upgrade
48
+
49
+ HAS_DEPENDENCIES = FALSE
50
+ Set TRUE if story mentions ANY of: dependency, library, package, version,
51
+ upgrade, third-party, external service, integration, SDK, plugin,
52
+ framework update, breaking change, compatibility
53
+
54
+ HAS_SECURITY = FALSE
55
+ Set TRUE if story mentions ANY of: authentication, authorization, encryption,
56
+ token, OAuth, JWT, RBAC, security, vulnerability, OWASP, input validation,
57
+ sanitization, XSS, CSRF, injection, secrets, credentials
58
+
59
+ HAS_MIDDLEWARE = FALSE
60
+ Set TRUE if story mentions ANY of: middleware, ESB, message broker, MQ,
61
+ Kafka, RabbitMQ, integration bus, API gateway, message queue, pub/sub,
62
+ event bus, service bus, ActiveMQ, NATS, Redis Streams
63
+
64
+ HAS_SAP_INTEGRATION = FALSE
65
+ Set TRUE if story mentions ANY of: SAP, OData, RFC, BAPI, IDoc,
66
+ S/4HANA, EWM, ECC, ABAP, CDS view, Fiori, SAP Cloud Integration,
67
+ SAP PI/PO, SAP Gateway, SAP connector
68
+
69
+ HAS_AUTHORIZATION = FALSE
70
+ Set TRUE if story mentions ANY of: SoD, segregation of duties,
71
+ role conflict, authorization object, T-code, user role,
72
+ access control matrix, GRC, RBAC policy, permission matrix,
73
+ privilege escalation, role assignment
74
+ ```
75
+
76
+ ### MANDATORY: Output Flag Detection Results
77
+
78
+ You MUST output flag detection results in a structured format showing each flag value with evidence before proceeding.
79
+
80
+ ## Success Criteria
81
+ - [ ] Ideation phase signals retrieved (or documented as unavailable)
82
+ - [ ] All SEVEN flags evaluated with evidence
83
+ - [ ] Flag detection results output
84
+ - [ ] Expected agent count calculated (3 core + conditional count + 1 transformation)
85
+
86
+ ## Output
87
+ Provide: All flag values with evidence, expected agent count, Ideation baseline data.
88
+
89
+ ## Navigation
90
+ - On success: proceed to Step 2 by reading `steps/02-core-agents.md`
91
+ - On failure: halt and report which flags could not be evaluated
@@ -0,0 +1,40 @@
1
+ # Step 2: Spawn Core Agents (Parallel Batch 1)
2
+
3
+ ## Prerequisites
4
+ - Step 1 (Flag Detection) completed
5
+ - User story content available
6
+ - OUTPUT_FOLDER determined
7
+
8
+ ## Instructions
9
+
10
+ ### CRITICAL: Spawn ALL THREE core agents in ONE message
11
+
12
+ | Agent | Domain | Role |
13
+ |-------|--------|------|
14
+ | qe-product-factors-assessor | requirements-validation | SFDIPOT (7 factors, 37 subcategories) analysis |
15
+ | qe-bdd-generator | requirements-validation | BDD Gherkin scenario generation |
16
+ | qe-requirements-validator | requirements-validation | INVEST validation and testability scoring |
17
+
18
+ ### Agent 1: Product Factors Assessor
19
+ Analyze the story using SFDIPOT product factors (Structure, Function, Data, Interface, Platform, Operations, Time). Must read the SFDIPOT reference material first. Save to: `${OUTPUT_FOLDER}/02-product-factors.md`
20
+
21
+ ### Agent 2: BDD Generator
22
+ Generate comprehensive BDD Gherkin scenarios from the story acceptance criteria. Must produce Given/When/Then scenarios covering happy paths, edge cases, and negative cases. Save to: `${OUTPUT_FOLDER}/03-bdd-scenarios.md`
23
+
24
+ ### Agent 3: Requirements Validator
25
+ Validate the story against INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable). Assess testability scoring and acceptance criteria completeness. Save to: `${OUTPUT_FOLDER}/04-requirements-validation.md`
26
+
27
+ ### Post-Spawn Confirmation
28
+ Tell the user all 3 core agents are running and WAIT.
29
+
30
+ ## Success Criteria
31
+ - [ ] All THREE agents spawned in ONE message
32
+ - [ ] Each agent has complete story content
33
+ - [ ] Post-spawn confirmation sent
34
+
35
+ ## Output
36
+ Confirmation that 3 agents are running in background.
37
+
38
+ ## Navigation
39
+ - On success: proceed to Step 3 by reading `steps/03-batch1-results.md`
40
+ - On failure: respawn missing agents
@@ -0,0 +1,40 @@
1
+ # Step 3: Wait for Batch 1 & Extract Results
2
+
3
+ ## Prerequisites
4
+ - Step 2: All 3 core agents spawned
5
+
6
+ ## Instructions
7
+
8
+ ### WAIT for all three agents to complete. Do NOT proceed early.
9
+
10
+ ### Extract from each agent:
11
+
12
+ **From qe-product-factors-assessor:**
13
+ - SFDIPOT factor scores and priorities
14
+ - Key quality risks identified
15
+ - Product factor coverage assessment
16
+
17
+ **From qe-bdd-generator:**
18
+ - Number of BDD scenarios generated
19
+ - Coverage of acceptance criteria
20
+ - Edge cases and negative scenarios
21
+
22
+ **From qe-requirements-validator:**
23
+ - INVEST validation score
24
+ - Testability score
25
+ - Acceptance criteria completeness percentage
26
+ - Missing requirements identified
27
+
28
+ ### Output Metrics Summary Box with all extracted values.
29
+
30
+ ## Success Criteria
31
+ - [ ] All three agents returned results
32
+ - [ ] All metrics extracted
33
+ - [ ] Summary box output with actual values
34
+
35
+ ## Output
36
+ Complete Batch 1 metrics for use in subsequent steps.
37
+
38
+ ## Navigation
39
+ - On success: proceed to Step 4 by reading `steps/04-conditional-agents.md`
40
+ - On failure: retry failed agents
@@ -0,0 +1,35 @@
1
+ # Step 4: Spawn Conditional Agents (Parallel Batch 2)
2
+
3
+ ## Prerequisites
4
+ - Step 3 completed with core metrics
5
+ - Flag values from Step 1
6
+
7
+ ## Instructions
8
+
9
+ ### IF A FLAG IS TRUE, YOU MUST SPAWN THAT AGENT
10
+
11
+ | Flag | Agent | Domain | Output File |
12
+ |------|-------|--------|-------------|
13
+ | HAS_API | qe-contract-validator | contract-testing | `05-contract-validation.md` |
14
+ | HAS_REFACTORING | qe-impact-analyzer | code-intelligence | `06-impact-analysis.md` |
15
+ | HAS_DEPENDENCIES | qe-dependency-mapper | code-intelligence | `07-dependency-analysis.md` |
16
+ | HAS_SECURITY | (handled by core) | - | - |
17
+ | HAS_MIDDLEWARE | qe-middleware-validator | enterprise-integration | `08-middleware-validation.md` |
18
+ | HAS_SAP_INTEGRATION | qe-odata-contract-tester | enterprise-integration | `09-odata-contracts.md` |
19
+ | HAS_AUTHORIZATION | qe-sod-analyzer | enterprise-integration | `10-sod-analysis.md` |
20
+
21
+ If ALL flags are FALSE, skip to Step 5.
22
+
23
+ Otherwise, spawn all applicable agents in ONE message and WAIT for completion.
24
+
25
+ ## Success Criteria
26
+ - [ ] All flagged agents spawned (or skipped if no flags)
27
+ - [ ] Agent count validation passed
28
+ - [ ] All conditional agents completed
29
+
30
+ ## Output
31
+ Conditional agent scores for decision logic.
32
+
33
+ ## Navigation
34
+ - On success: proceed to Step 5 by reading `steps/05-decision-synthesis.md`
35
+ - On failure: spawn missing agents
@@ -0,0 +1,43 @@
1
+ # Step 5: Synthesize Results & Determine Recommendation
2
+
3
+ ## Prerequisites
4
+ - Core and conditional agent results available
5
+
6
+ ## Instructions
7
+
8
+ ### Apply READY/CONDITIONAL/NOT-READY decision logic EXACTLY
9
+
10
+ Derive metrics from agent outputs and apply the decision tree:
11
+
12
+ **NOT-READY conditions (ANY triggers NOT-READY):**
13
+ - Testability score < 40%
14
+ - INVEST validation fails on 3+ criteria
15
+ - Critical SFDIPOT gaps in Structure or Function
16
+ - Missing acceptance criteria for core functionality
17
+ - Contract validation failures on existing APIs (if applicable)
18
+
19
+ **READY conditions (ALL required for READY):**
20
+ - Testability score >= 70%
21
+ - INVEST validation passes on 5+ criteria
22
+ - All SFDIPOT factors assessed with no critical gaps
23
+ - BDD scenarios cover all acceptance criteria
24
+ - No unresolved blocking issues from conditional agents
25
+
26
+ **Default: CONDITIONAL**
27
+
28
+ ### Record decision with full metrics and rationale.
29
+
30
+ If CONDITIONAL, list specific conditions that must be met.
31
+ If NOT-READY, list specific blockers with remediation steps.
32
+
33
+ ## Success Criteria
34
+ - [ ] All metrics derived from actual agent outputs
35
+ - [ ] Decision logic applied exactly
36
+ - [ ] FINAL RECOMMENDATION: READY / CONDITIONAL / NOT-READY
37
+
38
+ ## Output
39
+ Recommendation, metrics, rationale, and improvement actions.
40
+
41
+ ## Navigation
42
+ - On success: proceed to Step 6 by reading `steps/06-report-generation.md`
43
+ - On failure: resolve missing metrics
@@ -0,0 +1,42 @@
1
+ # Step 6: Generate Refinement Report
2
+
3
+ ## Prerequisites
4
+ - Step 5 completed with FINAL RECOMMENDATION
5
+ - All agent reports available
6
+
7
+ ## Instructions
8
+
9
+ Generate the complete Refinement Report and save to `${OUTPUT_FOLDER}/01-executive-summary.md`.
10
+
11
+ The report MUST include:
12
+ 1. Executive Summary with recommendation and key metrics
13
+ 2. SFDIPOT Product Factors Analysis (from qe-product-factors-assessor)
14
+ 3. BDD Scenarios (from qe-bdd-generator)
15
+ 4. Requirements Validation (from qe-requirements-validator)
16
+ 5. Conditional Analysis sections (for each conditional agent that ran)
17
+ 6. Recommended Actions (P0/P1/P2 prioritized)
18
+ 7. Test Strategy Summary
19
+
20
+ ### Report Validation Checklist
21
+
22
+ ```
23
+ +-- Executive Summary is complete with all metrics
24
+ +-- Recommendation matches decision logic
25
+ +-- SFDIPOT section covers all 7 factors
26
+ +-- BDD section includes all generated scenarios
27
+ +-- Requirements section includes INVEST scores
28
+ +-- Conditional sections present for all spawned agents
29
+ +-- Actions are specific and actionable
30
+ +-- Report saved to output folder
31
+ ```
32
+
33
+ ## Success Criteria
34
+ - [ ] Complete report with all sections
35
+ - [ ] Report saved to correct path
36
+
37
+ ## Output
38
+ Confirmation that report is saved.
39
+
40
+ ## Navigation
41
+ - On success: proceed to Step 7 by reading `steps/07-learning-persistence.md`
42
+ - On failure: complete missing sections
@@ -0,0 +1,53 @@
1
+ # Step 7: Store Learnings & Persist State
2
+
3
+ ## Prerequisites
4
+ - Step 6 completed
5
+ - All metrics and flags available
6
+
7
+ ## Instructions
8
+
9
+ ### ENFORCEMENT: ALWAYS RUN. NOT OPTIONAL.
10
+
11
+ Store refinement findings to memory for cross-phase feedback:
12
+
13
+ **Step 1: Store to memory**
14
+
15
+ ```javascript
16
+ mcp__agentic-qe__memory_store({
17
+ key: `qcsd-refinement-${storyId}-${Date.now()}`,
18
+ namespace: "qcsd-refinement",
19
+ value: {
20
+ storyId, recommendation, testabilityScore,
21
+ investScore, sfdipotPriorities, bddScenarioCount,
22
+ flags, agentsInvoked, timestamp
23
+ }
24
+ })
25
+ ```
26
+
27
+ **Step 2: Share learnings**
28
+
29
+ ```javascript
30
+ mcp__agentic-qe__memory_share({
31
+ sourceAgentId: "qcsd-refinement-swarm",
32
+ targetAgentIds: ["qe-test-idea-rewriter"],
33
+ knowledgeDomain: "refinement-test-patterns"
34
+ })
35
+ ```
36
+
37
+ **Step 3: Save persistence record**
38
+
39
+ Save to `${OUTPUT_FOLDER}/11-learning-persistence.json` with complete metrics, flags, and cross-phase signals.
40
+
41
+ ### Fallback: CLI commands if MCP unavailable.
42
+
43
+ ## Success Criteria
44
+ - [ ] Memory store executed with actual values
45
+ - [ ] Learning persistence JSON saved
46
+ - [ ] Cross-phase signals documented
47
+
48
+ ## Output
49
+ Confirmation of persistence.
50
+
51
+ ## Navigation
52
+ - On success: proceed to Step 8 by reading `steps/08-transformation.md`
53
+ - On failure: retry persistence
@@ -0,0 +1,36 @@
1
+ # Step 8: Apply Test Idea Rewriter (Transformation)
2
+
3
+ ## Prerequisites
4
+ - Step 7 completed
5
+ - BDD scenarios from Step 2 available
6
+ - All test ideas collected from all agents
7
+
8
+ ## Instructions
9
+
10
+ ### ENFORCEMENT: ALWAYS RUN qe-test-idea-rewriter
11
+
12
+ Spawn qe-test-idea-rewriter to transform ALL test ideas from passive descriptions
13
+ into active, exploratory test charters.
14
+
15
+ This agent must:
16
+ 1. Read all BDD scenarios from qe-bdd-generator output
17
+ 2. Read all test suggestions from other agents
18
+ 3. Transform each passive test idea ("Verify X works") into an active charter
19
+ 4. Apply the Session-Based Test Management (SBTM) charter format
20
+ 5. Prioritize test ideas by risk and SFDIPOT factor weights
21
+
22
+ Save output to: `${OUTPUT_FOLDER}/12-rewritten-test-ideas.md`
23
+
24
+ WAIT for the agent to complete.
25
+
26
+ ## Success Criteria
27
+ - [ ] qe-test-idea-rewriter spawned and completed
28
+ - [ ] All test ideas transformed
29
+ - [ ] Output saved to correct path
30
+
31
+ ## Output
32
+ Transformed test ideas for final report.
33
+
34
+ ## Navigation
35
+ - On success: proceed to Step 9 by reading `steps/09-final-output.md`
36
+ - On failure: retry the transformation agent
@@ -0,0 +1,46 @@
1
+ # Step 9: Final Output & Completion Summary
2
+
3
+ ## Prerequisites
4
+ - All steps (1-8) completed
5
+
6
+ ## Instructions
7
+
8
+ Display the completion summary:
9
+
10
+ ```
11
+ +---------------------------------------------------------------------+
12
+ | QCSD REFINEMENT SWARM COMPLETE |
13
+ +---------------------------------------------------------------------+
14
+ | |
15
+ | Story Assessed: [Story ID/Title] |
16
+ | Reports Generated: [count] |
17
+ | Output Folder: ${OUTPUT_FOLDER} |
18
+ | |
19
+ | REFINEMENT SCORES: |
20
+ | +-- Testability Score: __% |
21
+ | +-- INVEST Score: __/6 |
22
+ | +-- SFDIPOT Coverage: __% |
23
+ | +-- BDD Scenarios: __ generated |
24
+ | +-- Test Ideas Rewritten: __ |
25
+ | |
26
+ | RECOMMENDATION: [READY / CONDITIONAL / NOT-READY] |
27
+ | REASON: [1-2 sentence rationale] |
28
+ | |
29
+ | DELIVERABLES: |
30
+ | +-- 01-executive-summary.md |
31
+ | +-- 02-product-factors.md |
32
+ | +-- 03-bdd-scenarios.md |
33
+ | +-- 04-requirements-validation.md |
34
+ | [conditional reports as applicable] |
35
+ | +-- 11-learning-persistence.json |
36
+ | +-- 12-rewritten-test-ideas.md |
37
+ | |
38
+ +---------------------------------------------------------------------+
39
+ ```
40
+
41
+ ## Success Criteria
42
+ - [ ] Completion summary displayed
43
+ - [ ] All deliverables listed
44
+
45
+ ## Navigation
46
+ - This is the terminal step.
@@ -101,6 +101,9 @@ npm test -- --coverage
101
101
  1. [Action based on findings]
102
102
  ```
103
103
 
104
+ ## Minimum Findings Enforcement
105
+ Every investigation MUST surface at least 3 weighted observations (CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5). Elementary observations count at INFORMATIONAL=0.25 weight. A Sherlock investigation that finds nothing is a failed investigation -- Holmes always finds clues.
106
+
104
107
  ---
105
108
 
106
109
  ## Investigation Scenarios
@@ -0,0 +1,39 @@
1
+ # Agent Customization Overlay Example
2
+ #
3
+ # Copy this file and rename it to match your agent:
4
+ # .claude/agent-overrides/qe-test-architect.override.yaml
5
+ #
6
+ # Fields in "replace" OVERWRITE the base agent value.
7
+ # Fields in "append" are ADDED to the base agent value.
8
+ # Fields in "config" provide runtime configuration overrides.
9
+
10
+ # Which agent this overlay applies to
11
+ agent: qe-test-architect
12
+
13
+ # Replace base agent fields (overwrites)
14
+ # replace:
15
+ # description: "Custom test architect with focus on integration tests"
16
+ # domains:
17
+ # - test-generation
18
+ # - integration-testing
19
+ # complexity: complex
20
+
21
+ # Append to base agent (additions)
22
+ # append:
23
+ # instructions: |
24
+ # Additional custom instructions for this agent.
25
+ # These are appended to the end of the agent's instructions.
26
+ # capabilities:
27
+ # - custom-framework-support
28
+ # tags:
29
+ # - custom
30
+ # - team-specific
31
+
32
+ # Runtime configuration overrides
33
+ # config:
34
+ # minimumFindings: 5
35
+ # maxParallelAgents: 4
36
+ # preferredFrameworks:
37
+ # - vitest
38
+ # - playwright
39
+ # needsContext: true
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module agents/devils-advocate
10
10
  */
11
- import type { ChallengeTarget, ChallengeTargetType, ChallengeResult, ChallengeStrategy, DevilsAdvocateConfig, DevilsAdvocateStats } from './types.js';
11
+ import type { ChallengeTarget, ChallengeTargetType, ChallengeResult, ChallengeStrategy, DevilsAdvocateConfig, DevilsAdvocateStats, ReviewOutcome } from './types.js';
12
12
  /**
13
13
  * The Devil's Advocate agent reviews other agents' outputs and produces
14
14
  * structured challenges identifying gaps, weaknesses, and questionable results.
@@ -80,6 +80,30 @@ export declare class DevilsAdvocate {
80
80
  * Reset all accumulated statistics.
81
81
  */
82
82
  resetStats(): void;
83
+ /**
84
+ * Record the outcome of a review for learning feedback.
85
+ * Captures which challenges were accepted or dismissed.
86
+ *
87
+ * @param result - The challenge result from a review
88
+ * @param accepted - Array of booleans indicating acceptance per challenge
89
+ * @returns A ReviewOutcome for storage in the learning system
90
+ */
91
+ recordOutcome(result: ChallengeResult, accepted: boolean[]): ReviewOutcome;
92
+ /**
93
+ * Calculate the weighted finding score based on severity weights.
94
+ *
95
+ * @param challenges - The challenges to score
96
+ * @returns The weighted score sum
97
+ */
98
+ private calculateWeightedScore;
99
+ /**
100
+ * Run a second pass with all strategies and halved minConfidence
101
+ * to surface additional findings when the first pass falls below minimum.
102
+ *
103
+ * @param target - The challenge target to re-analyze
104
+ * @returns Additional challenges found in the second pass
105
+ */
106
+ private runSecondPass;
83
107
  /**
84
108
  * Compute the overall score based on challenges found.
85
109
  * Score is 1.0 minus the weighted impact of all challenges.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module agents/devils-advocate
10
10
  */
11
- import { DEFAULT_DEVILS_ADVOCATE_CONFIG, SEVERITY_ORDER, SEVERITY_WEIGHTS, } from './types.js';
11
+ import { DEFAULT_DEVILS_ADVOCATE_CONFIG, MINIMUM_FINDING_WEIGHTS, SEVERITY_ORDER, SEVERITY_WEIGHTS, } from './types.js';
12
12
  import { createAllStrategies, getApplicableStrategies } from './strategies.js';
13
13
  // ============================================================================
14
14
  // DevilsAdvocate Agent
@@ -99,12 +99,40 @@ export class DevilsAdvocate {
99
99
  }
100
100
  // 4-5: Filter by confidence and severity
101
101
  const minSeverityIndex = SEVERITY_ORDER.indexOf(this.config.minSeverity);
102
- const filtered = allChallenges.filter(c => {
102
+ let filtered = allChallenges.filter(c => {
103
103
  if (c.confidence < this.config.minConfidence)
104
104
  return false;
105
105
  const severityIndex = SEVERITY_ORDER.indexOf(c.severity);
106
106
  return severityIndex <= minSeverityIndex;
107
107
  });
108
+ // 5a: Calculate weighted finding score
109
+ let weightedScore = this.calculateWeightedScore(filtered);
110
+ // 5b: If below minimum, run second pass with all strategies and lower confidence
111
+ if (weightedScore < this.config.minimumFindings) {
112
+ const secondPassChallenges = this.runSecondPass(target);
113
+ // Merge new challenges, deduplicating by title
114
+ const existingTitles = new Set(filtered.map(c => c.title));
115
+ for (const challenge of secondPassChallenges) {
116
+ if (!existingTitles.has(challenge.title)) {
117
+ filtered.push(challenge);
118
+ existingTitles.add(challenge.title);
119
+ }
120
+ }
121
+ // Recalculate weighted score
122
+ weightedScore = this.calculateWeightedScore(filtered);
123
+ }
124
+ // 5c: Determine if minimum was met and build clean justification if needed
125
+ const minimumMet = weightedScore >= this.config.minimumFindings;
126
+ let cleanJustification;
127
+ if (!minimumMet) {
128
+ cleanJustification = {
129
+ isClean: true,
130
+ filesExamined: [],
131
+ patternsChecked: [],
132
+ toolsRun: applicable.map(s => s.type),
133
+ reasoning: 'Review completed under minimum threshold after first and second pass analysis.',
134
+ };
135
+ }
108
136
  // 6: Sort by severity (critical first), then by confidence descending
109
137
  const sorted = filtered.sort((a, b) => {
110
138
  const sevDiff = SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity);
@@ -114,8 +142,12 @@ export class DevilsAdvocate {
114
142
  });
115
143
  // 7: Limit to max challenges
116
144
  const limited = sorted.slice(0, this.config.maxChallengesPerReview);
117
- // 8: Compute overall score
118
- const overallScore = this.computeScore(limited);
145
+ // 8: Compute overall score (factor in minimum met status)
146
+ let overallScore = this.computeScore(limited);
147
+ if (!minimumMet && !cleanJustification) {
148
+ // Reduce score when minimum not met and no justification provided
149
+ overallScore = Math.max(0, overallScore * 0.8);
150
+ }
119
151
  // 9: Generate summary
120
152
  const summary = this.generateSummary(target, limited, overallScore);
121
153
  const reviewDuration = Date.now() - startTime;
@@ -129,6 +161,9 @@ export class DevilsAdvocate {
129
161
  summary,
130
162
  timestamp: Date.now(),
131
163
  reviewDuration,
164
+ cleanJustification,
165
+ weightedFindingScore: weightedScore,
166
+ minimumMet,
132
167
  };
133
168
  }
134
169
  /**
@@ -171,6 +206,75 @@ export class DevilsAdvocate {
171
206
  delete this.categoryCounts[key];
172
207
  }
173
208
  }
209
+ /**
210
+ * Record the outcome of a review for learning feedback.
211
+ * Captures which challenges were accepted or dismissed.
212
+ *
213
+ * @param result - The challenge result from a review
214
+ * @param accepted - Array of booleans indicating acceptance per challenge
215
+ * @returns A ReviewOutcome for storage in the learning system
216
+ */
217
+ recordOutcome(result, accepted) {
218
+ return {
219
+ targetType: result.targetType,
220
+ targetAgentId: result.targetAgentId,
221
+ challengeCount: result.challenges.length,
222
+ acceptedCount: accepted.filter(Boolean).length,
223
+ dismissedCount: accepted.filter(a => !a).length,
224
+ severityBreakdown: result.challenges.reduce((acc, c) => {
225
+ acc[c.severity] = (acc[c.severity] || 0) + 1;
226
+ return acc;
227
+ }, {}),
228
+ minimumMet: result.minimumMet ?? true,
229
+ timestamp: new Date().toISOString(),
230
+ };
231
+ }
232
+ /**
233
+ * Calculate the weighted finding score based on severity weights.
234
+ *
235
+ * @param challenges - The challenges to score
236
+ * @returns The weighted score sum
237
+ */
238
+ calculateWeightedScore(challenges) {
239
+ if (this.config.minimumFindingsMode === 'count') {
240
+ return challenges.length;
241
+ }
242
+ let score = 0;
243
+ for (const challenge of challenges) {
244
+ score += MINIMUM_FINDING_WEIGHTS[challenge.severity] ?? 0.25;
245
+ }
246
+ return score;
247
+ }
248
+ /**
249
+ * Run a second pass with all strategies and halved minConfidence
250
+ * to surface additional findings when the first pass falls below minimum.
251
+ *
252
+ * @param target - The challenge target to re-analyze
253
+ * @returns Additional challenges found in the second pass
254
+ */
255
+ runSecondPass(target) {
256
+ const allStrategies = getApplicableStrategies(this.strategies, target.type);
257
+ const halvedConfidence = this.config.minConfidence / 2;
258
+ const minSeverityIndex = SEVERITY_ORDER.indexOf(this.config.minSeverity);
259
+ const secondPassChallenges = [];
260
+ for (const strategy of allStrategies) {
261
+ try {
262
+ const found = strategy.challenge(target);
263
+ for (const c of found) {
264
+ if (c.confidence < halvedConfidence)
265
+ continue;
266
+ const severityIndex = SEVERITY_ORDER.indexOf(c.severity);
267
+ if (severityIndex <= minSeverityIndex) {
268
+ secondPassChallenges.push(c);
269
+ }
270
+ }
271
+ }
272
+ catch {
273
+ // Strategy failure should not abort the second pass.
274
+ }
275
+ }
276
+ return secondPassChallenges;
277
+ }
174
278
  /**
175
279
  * Compute the overall score based on challenges found.
176
280
  * Score is 1.0 minus the weighted impact of all challenges.