agentic-qe 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (528) hide show
  1. package/.claude/agents/analysis/code-analyzer.md +209 -0
  2. package/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
  3. package/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
  4. package/.claude/agents/base-template-generator.md +42 -0
  5. package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
  6. package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
  7. package/.claude/agents/consensus/gossip-coordinator.md +63 -0
  8. package/.claude/agents/consensus/performance-benchmarker.md +851 -0
  9. package/.claude/agents/consensus/quorum-manager.md +823 -0
  10. package/.claude/agents/consensus/raft-manager.md +63 -0
  11. package/.claude/agents/consensus/security-manager.md +622 -0
  12. package/.claude/agents/core/coder.md +266 -0
  13. package/.claude/agents/core/planner.md +168 -0
  14. package/.claude/agents/core/researcher.md +190 -0
  15. package/.claude/agents/core/reviewer.md +326 -0
  16. package/.claude/agents/core/tester.md +319 -0
  17. package/.claude/agents/data/ml/data-ml-model.md +193 -0
  18. package/.claude/agents/development/backend/dev-backend-api.md +142 -0
  19. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  20. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  21. package/.claude/agents/flow-nexus/app-store.md +88 -0
  22. package/.claude/agents/flow-nexus/authentication.md +69 -0
  23. package/.claude/agents/flow-nexus/challenges.md +81 -0
  24. package/.claude/agents/flow-nexus/neural-network.md +88 -0
  25. package/.claude/agents/flow-nexus/payments.md +83 -0
  26. package/.claude/agents/flow-nexus/sandbox.md +76 -0
  27. package/.claude/agents/flow-nexus/swarm.md +76 -0
  28. package/.claude/agents/flow-nexus/user-tools.md +96 -0
  29. package/.claude/agents/flow-nexus/workflow.md +84 -0
  30. package/.claude/agents/github/code-review-swarm.md +538 -0
  31. package/.claude/agents/github/github-modes.md +173 -0
  32. package/.claude/agents/github/issue-tracker.md +319 -0
  33. package/.claude/agents/github/multi-repo-swarm.md +553 -0
  34. package/.claude/agents/github/pr-manager.md +191 -0
  35. package/.claude/agents/github/project-board-sync.md +509 -0
  36. package/.claude/agents/github/release-manager.md +367 -0
  37. package/.claude/agents/github/release-swarm.md +583 -0
  38. package/.claude/agents/github/repo-architect.md +398 -0
  39. package/.claude/agents/github/swarm-issue.md +573 -0
  40. package/.claude/agents/github/swarm-pr.md +428 -0
  41. package/.claude/agents/github/sync-coordinator.md +452 -0
  42. package/.claude/agents/github/workflow-automation.md +635 -0
  43. package/.claude/agents/goal/code-goal-planner.md +446 -0
  44. package/.claude/agents/goal/goal-planner.md +168 -0
  45. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +130 -0
  46. package/.claude/agents/hive-mind/queen-coordinator.md +203 -0
  47. package/.claude/agents/hive-mind/scout-explorer.md +242 -0
  48. package/.claude/agents/hive-mind/swarm-memory-manager.md +193 -0
  49. package/.claude/agents/hive-mind/worker-specialist.md +217 -0
  50. package/.claude/agents/neural/safla-neural.md +74 -0
  51. package/.claude/agents/optimization/benchmark-suite.md +665 -0
  52. package/.claude/agents/optimization/load-balancer.md +431 -0
  53. package/.claude/agents/optimization/performance-monitor.md +672 -0
  54. package/.claude/agents/optimization/resource-allocator.md +674 -0
  55. package/.claude/agents/optimization/topology-optimizer.md +808 -0
  56. package/.claude/agents/qe-api-contract-validator.md +1088 -0
  57. package/.claude/agents/qe-chaos-engineer.md +736 -0
  58. package/.claude/agents/qe-coverage-analyzer.md +282 -0
  59. package/.claude/agents/qe-deployment-readiness.md +1109 -0
  60. package/.claude/agents/qe-flaky-test-hunter.md +1121 -0
  61. package/.claude/agents/qe-fleet-commander.md +641 -0
  62. package/.claude/agents/qe-performance-tester.md +354 -0
  63. package/.claude/agents/qe-production-intelligence.md +1162 -0
  64. package/.claude/agents/qe-quality-gate.md +294 -0
  65. package/.claude/agents/qe-regression-risk-analyzer.md +947 -0
  66. package/.claude/agents/qe-requirements-validator.md +691 -0
  67. package/.claude/agents/qe-security-scanner.md +430 -0
  68. package/.claude/agents/qe-test-data-architect.md +1007 -0
  69. package/.claude/agents/qe-test-executor.md +365 -0
  70. package/.claude/agents/qe-test-generator.md +332 -0
  71. package/.claude/agents/qe-visual-tester.md +754 -0
  72. package/.claude/agents/sparc/architecture.md +472 -0
  73. package/.claude/agents/sparc/pseudocode.md +318 -0
  74. package/.claude/agents/sparc/refinement.md +525 -0
  75. package/.claude/agents/sparc/specification.md +276 -0
  76. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
  77. package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  78. package/.claude/agents/swarm/hierarchical-coordinator.md +327 -0
  79. package/.claude/agents/swarm/mesh-coordinator.md +392 -0
  80. package/.claude/agents/templates/automation-smart-agent.md +205 -0
  81. package/.claude/agents/templates/coordinator-swarm-init.md +105 -0
  82. package/.claude/agents/templates/github-pr-manager.md +177 -0
  83. package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  84. package/.claude/agents/templates/memory-coordinator.md +187 -0
  85. package/.claude/agents/templates/migration-plan.md +746 -0
  86. package/.claude/agents/templates/orchestrator-task.md +139 -0
  87. package/.claude/agents/templates/performance-analyzer.md +199 -0
  88. package/.claude/agents/templates/sparc-coordinator.md +183 -0
  89. package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  90. package/.claude/agents/testing/validation/production-validator.md +395 -0
  91. package/.claude/aqe-fleet.json +47 -0
  92. package/.claude/commands/README.md +106 -0
  93. package/.claude/commands/agents/README.md +10 -0
  94. package/.claude/commands/agents/agent-capabilities.md +21 -0
  95. package/.claude/commands/agents/agent-coordination.md +28 -0
  96. package/.claude/commands/agents/agent-spawning.md +28 -0
  97. package/.claude/commands/agents/agent-types.md +26 -0
  98. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  99. package/.claude/commands/analysis/README.md +9 -0
  100. package/.claude/commands/analysis/bottleneck-detect.md +162 -0
  101. package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
  102. package/.claude/commands/analysis/performance-report.md +25 -0
  103. package/.claude/commands/analysis/token-efficiency.md +45 -0
  104. package/.claude/commands/analysis/token-usage.md +25 -0
  105. package/.claude/commands/aqe-analyze.md +344 -0
  106. package/.claude/commands/aqe-benchmark.md +466 -0
  107. package/.claude/commands/aqe-chaos.md +443 -0
  108. package/.claude/commands/aqe-execute.md +322 -0
  109. package/.claude/commands/aqe-fleet-status.md +431 -0
  110. package/.claude/commands/aqe-generate.md +301 -0
  111. package/.claude/commands/aqe-optimize.md +361 -0
  112. package/.claude/commands/aqe-report.md +411 -0
  113. package/.claude/commands/automation/README.md +9 -0
  114. package/.claude/commands/automation/auto-agent.md +122 -0
  115. package/.claude/commands/automation/self-healing.md +106 -0
  116. package/.claude/commands/automation/session-memory.md +90 -0
  117. package/.claude/commands/automation/smart-agents.md +73 -0
  118. package/.claude/commands/automation/smart-spawn.md +25 -0
  119. package/.claude/commands/automation/workflow-select.md +25 -0
  120. package/.claude/commands/coordination/README.md +9 -0
  121. package/.claude/commands/coordination/agent-spawn.md +25 -0
  122. package/.claude/commands/coordination/init.md +44 -0
  123. package/.claude/commands/coordination/orchestrate.md +43 -0
  124. package/.claude/commands/coordination/spawn.md +45 -0
  125. package/.claude/commands/coordination/swarm-init.md +85 -0
  126. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  127. package/.claude/commands/flow-nexus/app-store.md +124 -0
  128. package/.claude/commands/flow-nexus/challenges.md +120 -0
  129. package/.claude/commands/flow-nexus/login-registration.md +65 -0
  130. package/.claude/commands/flow-nexus/neural-network.md +134 -0
  131. package/.claude/commands/flow-nexus/payments.md +116 -0
  132. package/.claude/commands/flow-nexus/sandbox.md +83 -0
  133. package/.claude/commands/flow-nexus/swarm.md +87 -0
  134. package/.claude/commands/flow-nexus/user-tools.md +152 -0
  135. package/.claude/commands/flow-nexus/workflow.md +115 -0
  136. package/.claude/commands/github/README.md +11 -0
  137. package/.claude/commands/github/code-review-swarm.md +514 -0
  138. package/.claude/commands/github/code-review.md +25 -0
  139. package/.claude/commands/github/github-modes.md +147 -0
  140. package/.claude/commands/github/github-swarm.md +121 -0
  141. package/.claude/commands/github/issue-tracker.md +292 -0
  142. package/.claude/commands/github/issue-triage.md +25 -0
  143. package/.claude/commands/github/multi-repo-swarm.md +519 -0
  144. package/.claude/commands/github/pr-enhance.md +26 -0
  145. package/.claude/commands/github/pr-manager.md +170 -0
  146. package/.claude/commands/github/project-board-sync.md +471 -0
  147. package/.claude/commands/github/release-manager.md +338 -0
  148. package/.claude/commands/github/release-swarm.md +544 -0
  149. package/.claude/commands/github/repo-analyze.md +25 -0
  150. package/.claude/commands/github/repo-architect.md +367 -0
  151. package/.claude/commands/github/swarm-issue.md +482 -0
  152. package/.claude/commands/github/swarm-pr.md +285 -0
  153. package/.claude/commands/github/sync-coordinator.md +301 -0
  154. package/.claude/commands/github/workflow-automation.md +442 -0
  155. package/.claude/commands/hive-mind/README.md +17 -0
  156. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  157. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  158. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  159. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  160. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  161. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  162. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  163. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  164. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  165. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  166. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  167. package/.claude/commands/hooks/README.md +11 -0
  168. package/.claude/commands/hooks/overview.md +132 -0
  169. package/.claude/commands/hooks/post-edit.md +117 -0
  170. package/.claude/commands/hooks/post-task.md +112 -0
  171. package/.claude/commands/hooks/pre-edit.md +113 -0
  172. package/.claude/commands/hooks/pre-task.md +111 -0
  173. package/.claude/commands/hooks/session-end.md +118 -0
  174. package/.claude/commands/hooks/setup.md +103 -0
  175. package/.claude/commands/memory/README.md +9 -0
  176. package/.claude/commands/memory/memory-persist.md +25 -0
  177. package/.claude/commands/memory/memory-search.md +25 -0
  178. package/.claude/commands/memory/memory-usage.md +25 -0
  179. package/.claude/commands/memory/neural.md +47 -0
  180. package/.claude/commands/memory/usage.md +46 -0
  181. package/.claude/commands/monitoring/README.md +9 -0
  182. package/.claude/commands/monitoring/agent-metrics.md +25 -0
  183. package/.claude/commands/monitoring/agents.md +44 -0
  184. package/.claude/commands/monitoring/real-time-view.md +25 -0
  185. package/.claude/commands/monitoring/status.md +46 -0
  186. package/.claude/commands/monitoring/swarm-monitor.md +25 -0
  187. package/.claude/commands/optimization/README.md +9 -0
  188. package/.claude/commands/optimization/auto-topology.md +62 -0
  189. package/.claude/commands/optimization/cache-manage.md +25 -0
  190. package/.claude/commands/optimization/parallel-execute.md +25 -0
  191. package/.claude/commands/optimization/parallel-execution.md +50 -0
  192. package/.claude/commands/optimization/topology-optimize.md +25 -0
  193. package/.claude/commands/pair/commands.md +546 -0
  194. package/.claude/commands/pair/config.md +510 -0
  195. package/.claude/commands/pair/examples.md +512 -0
  196. package/.claude/commands/pair/modes.md +348 -0
  197. package/.claude/commands/pair/session.md +407 -0
  198. package/.claude/commands/pair/start.md +209 -0
  199. package/.claude/commands/sparc/analyzer.md +52 -0
  200. package/.claude/commands/sparc/architect.md +53 -0
  201. package/.claude/commands/sparc/batch-executor.md +54 -0
  202. package/.claude/commands/sparc/coder.md +54 -0
  203. package/.claude/commands/sparc/debugger.md +54 -0
  204. package/.claude/commands/sparc/designer.md +53 -0
  205. package/.claude/commands/sparc/documenter.md +54 -0
  206. package/.claude/commands/sparc/innovator.md +54 -0
  207. package/.claude/commands/sparc/memory-manager.md +54 -0
  208. package/.claude/commands/sparc/optimizer.md +54 -0
  209. package/.claude/commands/sparc/orchestrator.md +132 -0
  210. package/.claude/commands/sparc/researcher.md +54 -0
  211. package/.claude/commands/sparc/reviewer.md +54 -0
  212. package/.claude/commands/sparc/sparc-modes.md +174 -0
  213. package/.claude/commands/sparc/swarm-coordinator.md +54 -0
  214. package/.claude/commands/sparc/tdd.md +54 -0
  215. package/.claude/commands/sparc/tester.md +54 -0
  216. package/.claude/commands/sparc/workflow-manager.md +54 -0
  217. package/.claude/commands/stream-chain/pipeline.md +121 -0
  218. package/.claude/commands/stream-chain/run.md +70 -0
  219. package/.claude/commands/swarm/README.md +15 -0
  220. package/.claude/commands/swarm/analysis.md +95 -0
  221. package/.claude/commands/swarm/development.md +96 -0
  222. package/.claude/commands/swarm/examples.md +168 -0
  223. package/.claude/commands/swarm/maintenance.md +102 -0
  224. package/.claude/commands/swarm/optimization.md +117 -0
  225. package/.claude/commands/swarm/research.md +136 -0
  226. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  227. package/.claude/commands/swarm/swarm-background.md +8 -0
  228. package/.claude/commands/swarm/swarm-init.md +19 -0
  229. package/.claude/commands/swarm/swarm-modes.md +8 -0
  230. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  231. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  232. package/.claude/commands/swarm/swarm-status.md +8 -0
  233. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  234. package/.claude/commands/swarm/swarm.md +27 -0
  235. package/.claude/commands/swarm/testing.md +131 -0
  236. package/.claude/commands/training/README.md +9 -0
  237. package/.claude/commands/training/model-update.md +25 -0
  238. package/.claude/commands/training/neural-patterns.md +74 -0
  239. package/.claude/commands/training/neural-train.md +25 -0
  240. package/.claude/commands/training/pattern-learn.md +25 -0
  241. package/.claude/commands/training/specialization.md +63 -0
  242. package/.claude/commands/truth/start.md +143 -0
  243. package/.claude/commands/verify/check.md +50 -0
  244. package/.claude/commands/verify/start.md +128 -0
  245. package/.claude/commands/workflows/README.md +9 -0
  246. package/.claude/commands/workflows/development.md +78 -0
  247. package/.claude/commands/workflows/research.md +63 -0
  248. package/.claude/commands/workflows/workflow-create.md +25 -0
  249. package/.claude/commands/workflows/workflow-execute.md +25 -0
  250. package/.claude/commands/workflows/workflow-export.md +25 -0
  251. package/.claude/helpers/checkpoint-manager.sh +251 -0
  252. package/.claude/helpers/github-safe.js +106 -0
  253. package/.claude/helpers/github-setup.sh +28 -0
  254. package/.claude/helpers/quick-start.sh +19 -0
  255. package/.claude/helpers/setup-mcp.sh +18 -0
  256. package/.claude/helpers/standard-checkpoint-hooks.sh +179 -0
  257. package/.claude/settings.json +114 -0
  258. package/.claude/settings.local.json +10 -0
  259. package/CONTRIBUTING.md +897 -0
  260. package/LICENSE +21 -0
  261. package/README.md +632 -0
  262. package/bin/aqe +959 -0
  263. package/config/fleet.yaml +50 -0
  264. package/dist/agents/ApiContractValidatorAgent.d.ts +222 -0
  265. package/dist/agents/ApiContractValidatorAgent.d.ts.map +1 -0
  266. package/dist/agents/ApiContractValidatorAgent.js +787 -0
  267. package/dist/agents/ApiContractValidatorAgent.js.map +1 -0
  268. package/dist/agents/BaseAgent.d.ts +147 -0
  269. package/dist/agents/BaseAgent.d.ts.map +1 -0
  270. package/dist/agents/BaseAgent.js +374 -0
  271. package/dist/agents/BaseAgent.js.map +1 -0
  272. package/dist/agents/CoverageAnalyzerAgent.d.ts +103 -0
  273. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -0
  274. package/dist/agents/CoverageAnalyzerAgent.js +466 -0
  275. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -0
  276. package/dist/agents/DeploymentReadinessAgent.d.ts +244 -0
  277. package/dist/agents/DeploymentReadinessAgent.d.ts.map +1 -0
  278. package/dist/agents/DeploymentReadinessAgent.js +974 -0
  279. package/dist/agents/DeploymentReadinessAgent.js.map +1 -0
  280. package/dist/agents/FlakyTestHunterAgent.d.ts +172 -0
  281. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -0
  282. package/dist/agents/FlakyTestHunterAgent.js +867 -0
  283. package/dist/agents/FlakyTestHunterAgent.js.map +1 -0
  284. package/dist/agents/FleetCommanderAgent.d.ts +154 -0
  285. package/dist/agents/FleetCommanderAgent.d.ts.map +1 -0
  286. package/dist/agents/FleetCommanderAgent.js +924 -0
  287. package/dist/agents/FleetCommanderAgent.js.map +1 -0
  288. package/dist/agents/PerformanceTesterAgent.d.ts +194 -0
  289. package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -0
  290. package/dist/agents/PerformanceTesterAgent.js +972 -0
  291. package/dist/agents/PerformanceTesterAgent.js.map +1 -0
  292. package/dist/agents/ProductionIntelligenceAgent.d.ts +224 -0
  293. package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -0
  294. package/dist/agents/ProductionIntelligenceAgent.js +856 -0
  295. package/dist/agents/ProductionIntelligenceAgent.js.map +1 -0
  296. package/dist/agents/QualityAnalyzerAgent.d.ts +67 -0
  297. package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -0
  298. package/dist/agents/QualityAnalyzerAgent.js +453 -0
  299. package/dist/agents/QualityAnalyzerAgent.js.map +1 -0
  300. package/dist/agents/QualityGateAgent.d.ts +104 -0
  301. package/dist/agents/QualityGateAgent.d.ts.map +1 -0
  302. package/dist/agents/QualityGateAgent.js +522 -0
  303. package/dist/agents/QualityGateAgent.js.map +1 -0
  304. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts +274 -0
  305. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -0
  306. package/dist/agents/RegressionRiskAnalyzerAgent.js +1076 -0
  307. package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -0
  308. package/dist/agents/RequirementsValidatorAgent.d.ts +195 -0
  309. package/dist/agents/RequirementsValidatorAgent.d.ts.map +1 -0
  310. package/dist/agents/RequirementsValidatorAgent.js +992 -0
  311. package/dist/agents/RequirementsValidatorAgent.js.map +1 -0
  312. package/dist/agents/SecurityScannerAgent.d.ts +126 -0
  313. package/dist/agents/SecurityScannerAgent.d.ts.map +1 -0
  314. package/dist/agents/SecurityScannerAgent.js +695 -0
  315. package/dist/agents/SecurityScannerAgent.js.map +1 -0
  316. package/dist/agents/TestDataArchitectAgent.d.ts +452 -0
  317. package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -0
  318. package/dist/agents/TestDataArchitectAgent.js +1346 -0
  319. package/dist/agents/TestDataArchitectAgent.js.map +1 -0
  320. package/dist/agents/TestExecutorAgent.d.ts +101 -0
  321. package/dist/agents/TestExecutorAgent.d.ts.map +1 -0
  322. package/dist/agents/TestExecutorAgent.js +730 -0
  323. package/dist/agents/TestExecutorAgent.js.map +1 -0
  324. package/dist/agents/TestGeneratorAgent.d.ts +109 -0
  325. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -0
  326. package/dist/agents/TestGeneratorAgent.js +450 -0
  327. package/dist/agents/TestGeneratorAgent.js.map +1 -0
  328. package/dist/agents/index.d.ts +51 -0
  329. package/dist/agents/index.d.ts.map +1 -0
  330. package/dist/agents/index.js +738 -0
  331. package/dist/agents/index.js.map +1 -0
  332. package/dist/cli/commands/analyze.d.ts +32 -0
  333. package/dist/cli/commands/analyze.d.ts.map +1 -0
  334. package/dist/cli/commands/analyze.js +764 -0
  335. package/dist/cli/commands/analyze.js.map +1 -0
  336. package/dist/cli/commands/fleet.d.ts +36 -0
  337. package/dist/cli/commands/fleet.d.ts.map +1 -0
  338. package/dist/cli/commands/fleet.js +745 -0
  339. package/dist/cli/commands/fleet.js.map +1 -0
  340. package/dist/cli/commands/generate.d.ts +24 -0
  341. package/dist/cli/commands/generate.d.ts.map +1 -0
  342. package/dist/cli/commands/generate.js +424 -0
  343. package/dist/cli/commands/generate.js.map +1 -0
  344. package/dist/cli/commands/init.d.ts +17 -0
  345. package/dist/cli/commands/init.d.ts.map +1 -0
  346. package/dist/cli/commands/init.js +570 -0
  347. package/dist/cli/commands/init.js.map +1 -0
  348. package/dist/cli/commands/run.d.ts +25 -0
  349. package/dist/cli/commands/run.d.ts.map +1 -0
  350. package/dist/cli/commands/run.js +558 -0
  351. package/dist/cli/commands/run.js.map +1 -0
  352. package/dist/cli/index-spec.d.ts +3 -0
  353. package/dist/cli/index-spec.d.ts.map +1 -0
  354. package/dist/cli/index-spec.js +154 -0
  355. package/dist/cli/index-spec.js.map +1 -0
  356. package/dist/cli/index-working.d.ts +7 -0
  357. package/dist/cli/index-working.d.ts.map +1 -0
  358. package/dist/cli/index-working.js +470 -0
  359. package/dist/cli/index-working.js.map +1 -0
  360. package/dist/cli/index.d.ts +9 -0
  361. package/dist/cli/index.d.ts.map +1 -0
  362. package/dist/cli/index.js +174 -0
  363. package/dist/cli/index.js.map +1 -0
  364. package/dist/core/Agent.d.ts +189 -0
  365. package/dist/core/Agent.d.ts.map +1 -0
  366. package/dist/core/Agent.js +288 -0
  367. package/dist/core/Agent.js.map +1 -0
  368. package/dist/core/EventBus.d.ts +40 -0
  369. package/dist/core/EventBus.d.ts.map +1 -0
  370. package/dist/core/EventBus.js +114 -0
  371. package/dist/core/EventBus.js.map +1 -0
  372. package/dist/core/FleetManager.d.ts +219 -0
  373. package/dist/core/FleetManager.d.ts.map +1 -0
  374. package/dist/core/FleetManager.js +354 -0
  375. package/dist/core/FleetManager.js.map +1 -0
  376. package/dist/core/MemoryManager.d.ts +119 -0
  377. package/dist/core/MemoryManager.d.ts.map +1 -0
  378. package/dist/core/MemoryManager.js +460 -0
  379. package/dist/core/MemoryManager.js.map +1 -0
  380. package/dist/core/Task.d.ts +264 -0
  381. package/dist/core/Task.d.ts.map +1 -0
  382. package/dist/core/Task.js +397 -0
  383. package/dist/core/Task.js.map +1 -0
  384. package/dist/core/coverage-analyzer.d.ts +50 -0
  385. package/dist/core/coverage-analyzer.d.ts.map +1 -0
  386. package/dist/core/coverage-analyzer.js +146 -0
  387. package/dist/core/coverage-analyzer.js.map +1 -0
  388. package/dist/core/index.d.ts +14 -0
  389. package/dist/core/index.d.ts.map +1 -0
  390. package/dist/core/index.js +20 -0
  391. package/dist/core/index.js.map +1 -0
  392. package/dist/core/quality-gate.d.ts +81 -0
  393. package/dist/core/quality-gate.d.ts.map +1 -0
  394. package/dist/core/quality-gate.js +254 -0
  395. package/dist/core/quality-gate.js.map +1 -0
  396. package/dist/coverage/coverage-collector.d.ts +62 -0
  397. package/dist/coverage/coverage-collector.d.ts.map +1 -0
  398. package/dist/coverage/coverage-collector.js +61 -0
  399. package/dist/coverage/coverage-collector.js.map +1 -0
  400. package/dist/coverage/coverage-reporter.d.ts +42 -0
  401. package/dist/coverage/coverage-reporter.d.ts.map +1 -0
  402. package/dist/coverage/coverage-reporter.js +53 -0
  403. package/dist/coverage/coverage-reporter.js.map +1 -0
  404. package/dist/index.d.ts +89 -0
  405. package/dist/index.d.ts.map +1 -0
  406. package/dist/index.js +142 -0
  407. package/dist/index.js.map +1 -0
  408. package/dist/mcp/handlers/agent-spawn.d.ts +72 -0
  409. package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -0
  410. package/dist/mcp/handlers/agent-spawn.js +255 -0
  411. package/dist/mcp/handlers/agent-spawn.js.map +1 -0
  412. package/dist/mcp/handlers/base-handler.d.ts +53 -0
  413. package/dist/mcp/handlers/base-handler.d.ts.map +1 -0
  414. package/dist/mcp/handlers/base-handler.js +77 -0
  415. package/dist/mcp/handlers/base-handler.js.map +1 -0
  416. package/dist/mcp/handlers/fleet-init.d.ts +55 -0
  417. package/dist/mcp/handlers/fleet-init.d.ts.map +1 -0
  418. package/dist/mcp/handlers/fleet-init.js +149 -0
  419. package/dist/mcp/handlers/fleet-init.js.map +1 -0
  420. package/dist/mcp/handlers/fleet-status.d.ts +103 -0
  421. package/dist/mcp/handlers/fleet-status.d.ts.map +1 -0
  422. package/dist/mcp/handlers/fleet-status.js +244 -0
  423. package/dist/mcp/handlers/fleet-status.js.map +1 -0
  424. package/dist/mcp/handlers/optimize-tests.d.ts +219 -0
  425. package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -0
  426. package/dist/mcp/handlers/optimize-tests.js +532 -0
  427. package/dist/mcp/handlers/optimize-tests.js.map +1 -0
  428. package/dist/mcp/handlers/predict-defects.d.ts +194 -0
  429. package/dist/mcp/handlers/predict-defects.d.ts.map +1 -0
  430. package/dist/mcp/handlers/predict-defects.js +721 -0
  431. package/dist/mcp/handlers/predict-defects.js.map +1 -0
  432. package/dist/mcp/handlers/quality-analyze.d.ts +273 -0
  433. package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -0
  434. package/dist/mcp/handlers/quality-analyze.js +702 -0
  435. package/dist/mcp/handlers/quality-analyze.js.map +1 -0
  436. package/dist/mcp/handlers/task-orchestrate.d.ts +152 -0
  437. package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -0
  438. package/dist/mcp/handlers/task-orchestrate.js +629 -0
  439. package/dist/mcp/handlers/task-orchestrate.js.map +1 -0
  440. package/dist/mcp/handlers/test-execute.d.ts +132 -0
  441. package/dist/mcp/handlers/test-execute.d.ts.map +1 -0
  442. package/dist/mcp/handlers/test-execute.js +436 -0
  443. package/dist/mcp/handlers/test-execute.js.map +1 -0
  444. package/dist/mcp/handlers/test-generate.d.ts +107 -0
  445. package/dist/mcp/handlers/test-generate.d.ts.map +1 -0
  446. package/dist/mcp/handlers/test-generate.js +437 -0
  447. package/dist/mcp/handlers/test-generate.js.map +1 -0
  448. package/dist/mcp/server.d.ts +99 -0
  449. package/dist/mcp/server.d.ts.map +1 -0
  450. package/dist/mcp/server.js +214 -0
  451. package/dist/mcp/server.js.map +1 -0
  452. package/dist/mcp/services/AgentRegistry.d.ts +191 -0
  453. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -0
  454. package/dist/mcp/services/AgentRegistry.js +403 -0
  455. package/dist/mcp/services/AgentRegistry.js.map +1 -0
  456. package/dist/mcp/services/HookExecutor.d.ts +165 -0
  457. package/dist/mcp/services/HookExecutor.d.ts.map +1 -0
  458. package/dist/mcp/services/HookExecutor.js +327 -0
  459. package/dist/mcp/services/HookExecutor.js.map +1 -0
  460. package/dist/mcp/start.d.ts +7 -0
  461. package/dist/mcp/start.d.ts.map +1 -0
  462. package/dist/mcp/start.js +35 -0
  463. package/dist/mcp/start.js.map +1 -0
  464. package/dist/mcp/tools.d.ts +81 -0
  465. package/dist/mcp/tools.d.ts.map +1 -0
  466. package/dist/mcp/tools.js +471 -0
  467. package/dist/mcp/tools.js.map +1 -0
  468. package/dist/optimization/sublinear-solver.d.ts +72 -0
  469. package/dist/optimization/sublinear-solver.d.ts.map +1 -0
  470. package/dist/optimization/sublinear-solver.js +263 -0
  471. package/dist/optimization/sublinear-solver.js.map +1 -0
  472. package/dist/scripts/verifyComplexity.d.ts +8 -0
  473. package/dist/scripts/verifyComplexity.d.ts.map +1 -0
  474. package/dist/scripts/verifyComplexity.js +56 -0
  475. package/dist/scripts/verifyComplexity.js.map +1 -0
  476. package/dist/types/api-contract.types.d.ts +273 -0
  477. package/dist/types/api-contract.types.d.ts.map +1 -0
  478. package/dist/types/api-contract.types.js +18 -0
  479. package/dist/types/api-contract.types.js.map +1 -0
  480. package/dist/types/errors.d.ts +104 -0
  481. package/dist/types/errors.d.ts.map +1 -0
  482. package/dist/types/errors.js +226 -0
  483. package/dist/types/errors.js.map +1 -0
  484. package/dist/types/events.d.ts +101 -0
  485. package/dist/types/events.d.ts.map +1 -0
  486. package/dist/types/events.js +6 -0
  487. package/dist/types/events.js.map +1 -0
  488. package/dist/types/index.d.ts +570 -0
  489. package/dist/types/index.d.ts.map +1 -0
  490. package/dist/types/index.js +131 -0
  491. package/dist/types/index.js.map +1 -0
  492. package/dist/utils/Config.d.ts +128 -0
  493. package/dist/utils/Config.d.ts.map +1 -0
  494. package/dist/utils/Config.js +232 -0
  495. package/dist/utils/Config.js.map +1 -0
  496. package/dist/utils/Database.d.ts +112 -0
  497. package/dist/utils/Database.d.ts.map +1 -0
  498. package/dist/utils/Database.js +352 -0
  499. package/dist/utils/Database.js.map +1 -0
  500. package/dist/utils/Logger.d.ts +58 -0
  501. package/dist/utils/Logger.d.ts.map +1 -0
  502. package/dist/utils/Logger.js +125 -0
  503. package/dist/utils/Logger.js.map +1 -0
  504. package/dist/utils/index.d.ts +9 -0
  505. package/dist/utils/index.d.ts.map +1 -0
  506. package/dist/utils/index.js +14 -0
  507. package/dist/utils/index.js.map +1 -0
  508. package/dist/utils/sublinear/coverageOptimizer.d.ts +84 -0
  509. package/dist/utils/sublinear/coverageOptimizer.d.ts.map +1 -0
  510. package/dist/utils/sublinear/coverageOptimizer.js +415 -0
  511. package/dist/utils/sublinear/coverageOptimizer.js.map +1 -0
  512. package/dist/utils/sublinear/index.d.ts +50 -0
  513. package/dist/utils/sublinear/index.d.ts.map +1 -0
  514. package/dist/utils/sublinear/index.js +390 -0
  515. package/dist/utils/sublinear/index.js.map +1 -0
  516. package/dist/utils/sublinear/matrixSolver.d.ts +132 -0
  517. package/dist/utils/sublinear/matrixSolver.d.ts.map +1 -0
  518. package/dist/utils/sublinear/matrixSolver.js +642 -0
  519. package/dist/utils/sublinear/matrixSolver.js.map +1 -0
  520. package/dist/utils/sublinear/temporalPredictor.d.ts +195 -0
  521. package/dist/utils/sublinear/temporalPredictor.d.ts.map +1 -0
  522. package/dist/utils/sublinear/temporalPredictor.js +474 -0
  523. package/dist/utils/sublinear/temporalPredictor.js.map +1 -0
  524. package/dist/utils/sublinear/testSelector.d.ts +81 -0
  525. package/dist/utils/sublinear/testSelector.d.ts.map +1 -0
  526. package/dist/utils/sublinear/testSelector.js +303 -0
  527. package/dist/utils/sublinear/testSelector.js.map +1 -0
  528. package/package.json +131 -0
@@ -0,0 +1,1121 @@
1
+ ---
2
+ name: qe-flaky-test-hunter
3
+ type: flaky-test-detector
4
+ color: magenta
5
+ priority: high
6
+ description: "Detects, analyzes, and stabilizes flaky tests through pattern recognition and auto-remediation"
7
+ capabilities:
8
+ - flaky-detection
9
+ - root-cause-analysis
10
+ - auto-stabilization
11
+ - quarantine-management
12
+ - trend-tracking
13
+ - reliability-scoring
14
+ - predictive-flakiness
15
+ hooks:
16
+ pre_task:
17
+ - "npx claude-flow@alpha hooks pre-task --description 'Hunting flaky tests'"
18
+ - "npx claude-flow@alpha memory retrieve --key 'aqe/test-results/history'"
19
+ - "npx claude-flow@alpha memory retrieve --key 'aqe/flaky-tests/known'"
20
+ post_task:
21
+ - "npx claude-flow@alpha hooks post-task --task-id '${TASK_ID}'"
22
+ - "npx claude-flow@alpha memory store --key 'aqe/flaky-tests/detected' --value '${FLAKY_TESTS}'"
23
+ - "npx claude-flow@alpha memory store --key 'aqe/test-reliability/scores' --value '${RELIABILITY}'"
24
+ post_edit:
25
+ - "npx claude-flow@alpha hooks post-edit --file '${FILE_PATH}' --memory-key 'aqe/flaky-tests/test-updated'"
26
+ metadata:
27
+ version: "1.0.0"
28
+ stakeholders: ["Engineering", "QA", "DevOps"]
29
+ roi: "400%"
30
+ impact: "Achieves 95%+ test reliability, eliminates false negatives/positives"
31
+ memory_keys:
32
+ - "aqe/flaky-tests/*"
33
+ - "aqe/test-reliability/*"
34
+ - "aqe/quarantine/*"
35
+ - "aqe/test-results/history"
36
+ - "aqe/remediation/*"
37
+ ---
38
+
39
+ # QE Flaky Test Hunter Agent
40
+
41
+ ## Mission Statement
42
+
43
+ The Flaky Test Hunter agent **eliminates test flakiness** through intelligent detection, root cause analysis, and automated stabilization. Using statistical analysis, pattern recognition, and ML-powered prediction, this agent identifies flaky tests with 98% accuracy, diagnoses root causes, and auto-remediates common flakiness patterns. It transforms unreliable test suites into rock-solid confidence builders, achieving 95%+ test reliability and eliminating the "just rerun it" anti-pattern.
44
+
45
+ ## Core Capabilities
46
+
47
+ ### 1. Flaky Detection
48
+
49
+ Detects flaky tests using statistical analysis of historical test results.
50
+
51
+ **Flaky Test Detector:**
52
+ ```javascript
53
+ class FlakyTestDetector {
54
+ async detectFlaky(testResults, minRuns = 10) {
55
+ const testStats = this.aggregateTestStats(testResults);
56
+ const flakyTests = [];
57
+
58
+ for (const [testName, stats] of Object.entries(testStats)) {
59
+ if (stats.totalRuns < minRuns) {
60
+ continue; // Insufficient data
61
+ }
62
+
63
+ const flakinessScore = this.calculateFlakinessScore(stats);
64
+
65
+ if (flakinessScore > 0.1) { // More than 10% flakiness
66
+ const flaky = {
67
+ testName: testName,
68
+ flakinessScore: flakinessScore,
69
+ totalRuns: stats.totalRuns,
70
+ failures: stats.failures,
71
+ passes: stats.passes,
72
+ failureRate: stats.failures / stats.totalRuns,
73
+ passRate: stats.passes / stats.totalRuns,
74
+ pattern: this.detectPattern(stats.history),
75
+ lastFlake: stats.lastFailure,
76
+ severity: this.calculateSeverity(flakinessScore, stats)
77
+ };
78
+
79
+ // Root cause analysis
80
+ flaky.rootCause = await this.analyzeRootCause(testName, stats);
81
+
82
+ flakyTests.push(flaky);
83
+ }
84
+ }
85
+
86
+ return flakyTests.sort((a, b) => b.flakinessScore - a.flakinessScore);
87
+ }
88
+
89
+ calculateFlakinessScore(stats) {
90
+ // Multiple factors contribute to flakiness score:
91
+
92
+ // 1. Inconsistency: How often results change
93
+ const inconsistency = this.calculateInconsistency(stats.history);
94
+
95
+ // 2. Failure rate: Neither always passing nor always failing
96
+ const failureRate = stats.failures / stats.totalRuns;
97
+ const passRate = stats.passes / stats.totalRuns;
98
+ const volatility = Math.min(failureRate, passRate) * 2; // Peak at 50/50
99
+
100
+ // 3. Recent behavior: Weight recent flakes more heavily
101
+ const recencyWeight = this.calculateRecencyWeight(stats.history);
102
+
103
+ // 4. Environmental sensitivity: Fails on specific conditions
104
+ const environmentalFlakiness = this.detectEnvironmentalSensitivity(stats);
105
+
106
+ // Weighted combination
107
+ return (
108
+ inconsistency * 0.3 +
109
+ volatility * 0.3 +
110
+ recencyWeight * 0.2 +
111
+ environmentalFlakiness * 0.2
112
+ );
113
+ }
114
+
115
+ calculateInconsistency(history) {
116
+ // Count transitions between pass and fail
117
+ let transitions = 0;
118
+ for (let i = 1; i < history.length; i++) {
119
+ if (history[i].result !== history[i - 1].result) {
120
+ transitions++;
121
+ }
122
+ }
123
+ return transitions / (history.length - 1);
124
+ }
125
+
126
+ detectPattern(history) {
127
+ const patterns = {
128
+ random: 'Randomly fails with no clear pattern',
129
+ timing: 'Timing-related (race conditions, timeouts)',
130
+ environmental: 'Fails under specific conditions (load, network)',
131
+ data: 'Data-dependent failures',
132
+ order: 'Test order dependent',
133
+ infrastructure: 'Infrastructure issues (CI agent, resources)'
134
+ };
135
+
136
+ // Analyze failure characteristics
137
+ const failures = history.filter(h => h.result === 'fail');
138
+
139
+ // Check for timing patterns
140
+ const avgFailureDuration = failures.reduce((sum, f) => sum + f.duration, 0) / failures.length;
141
+ const avgSuccessDuration = history.filter(h => h.result === 'pass')
142
+ .reduce((sum, s) => sum + s.duration, 0) / (history.length - failures.length);
143
+
144
+ if (Math.abs(avgFailureDuration - avgSuccessDuration) > avgSuccessDuration * 0.5) {
145
+ return patterns.timing;
146
+ }
147
+
148
+ // Check for environmental patterns
149
+ const failureAgents = new Set(failures.map(f => f.agent));
150
+ const totalAgents = new Set(history.map(h => h.agent));
151
+
152
+ if (failureAgents.size < totalAgents.size * 0.5) {
153
+ return patterns.environmental;
154
+ }
155
+
156
+ // Check for order dependency
157
+ const failurePositions = failures.map(f => f.orderInSuite);
158
+ const avgFailurePosition = failurePositions.reduce((a, b) => a + b, 0) / failurePositions.length;
159
+
160
+ if (Math.abs(avgFailurePosition - history.length / 2) > history.length * 0.3) {
161
+ return patterns.order;
162
+ }
163
+
164
+ return patterns.random;
165
+ }
166
+
167
+ detectEnvironmentalSensitivity(stats) {
168
+ // Analyze if failures correlate with environmental factors
169
+ const factors = {
170
+ timeOfDay: this.analyzeTimeOfDayCorrelation(stats),
171
+ dayOfWeek: this.analyzeDayOfWeekCorrelation(stats),
172
+ ciAgent: this.analyzeCIAgentCorrelation(stats),
173
+ parallelization: this.analyzeParallelizationCorrelation(stats),
174
+ systemLoad: this.analyzeSystemLoadCorrelation(stats)
175
+ };
176
+
177
+ // Return highest correlation factor
178
+ return Math.max(...Object.values(factors));
179
+ }
180
+ }
181
+ ```
182
+
183
+ **Flaky Test Report:**
184
+ ```json
185
+ {
186
+ "analysis": {
187
+ "timeWindow": "last_30_days",
188
+ "totalTests": 1287,
189
+ "flakyTests": 47,
190
+ "flakinessRate": 0.0365,
191
+ "targetReliability": 0.95
192
+ },
193
+
194
+ "topFlakyTests": [
195
+ {
196
+ "testName": "test/integration/checkout.integration.test.ts::Checkout Flow::processes payment successfully",
197
+ "flakinessScore": 0.68,
198
+ "severity": "HIGH",
199
+ "totalRuns": 156,
200
+ "failures": 42,
201
+ "passes": 114,
202
+ "failureRate": 0.269,
203
+ "pattern": "Timing-related (race conditions, timeouts)",
204
+
205
+ "rootCause": {
206
+ "category": "RACE_CONDITION",
207
+ "confidence": 0.89,
208
+ "description": "Payment API responds before order state is persisted",
209
+ "evidence": [
210
+ "Failures occur when test runs <50ms",
211
+ "Success rate increases with explicit wait",
212
+ "Logs show 'order not found' errors"
213
+ ],
214
+ "recommendation": "Add explicit wait for order persistence before payment call"
215
+ },
216
+
217
+ "failurePattern": {
218
+ "randomness": 0.42,
219
+ "timingCorrelation": 0.89,
220
+ "environmentalCorrelation": 0.31
221
+ },
222
+
223
+ "environmentalFactors": {
224
+ "timeOfDay": "Fails more during peak hours (12pm-2pm)",
225
+ "ciAgent": "Fails 80% on agent-3 vs 20% on others",
226
+ "parallelization": "Fails when >4 tests run in parallel"
227
+ },
228
+
229
+ "lastFlakes": [
230
+ {
231
+ "timestamp": "2025-09-30T14:23:45Z",
232
+ "result": "fail",
233
+ "duration": 1234,
234
+ "error": "TimeoutError: Waiting for element timed out after 5000ms",
235
+ "agent": "ci-agent-3"
236
+ },
237
+ {
238
+ "timestamp": "2025-09-29T10:15:32Z",
239
+ "result": "pass",
240
+ "duration": 2341,
241
+ "agent": "ci-agent-1"
242
+ }
243
+ ],
244
+
245
+ "suggestedFixes": [
246
+ {
247
+ "priority": "HIGH",
248
+ "approach": "Add explicit wait",
249
+ "code": "await waitForCondition(() => orderService.exists(orderId), { timeout: 5000 });",
250
+ "estimatedEffectiveness": 0.85
251
+ },
252
+ {
253
+ "priority": "MEDIUM",
254
+ "approach": "Increase timeout",
255
+ "code": "await page.waitForSelector('.success-message', { timeout: 10000 });",
256
+ "estimatedEffectiveness": 0.60
257
+ },
258
+ {
259
+ "priority": "LOW",
260
+ "approach": "Retry on failure",
261
+ "code": "jest.retryTimes(3, { logErrorsBeforeRetry: true });",
262
+ "estimatedEffectiveness": 0.40
263
+ }
264
+ ],
265
+
266
+ "status": "QUARANTINED",
267
+ "quarantinedAt": "2025-09-28T09:00:00Z",
268
+ "assignedTo": "backend-team@company.com"
269
+ }
270
+ ],
271
+
272
+ "statistics": {
273
+ "byCategory": {
274
+ "RACE_CONDITION": 23,
275
+ "TIMEOUT": 12,
276
+ "NETWORK_FLAKE": 7,
277
+ "DATA_DEPENDENCY": 3,
278
+ "ORDER_DEPENDENCY": 2
279
+ },
280
+ "bySeverity": {
281
+ "HIGH": 14,
282
+ "MEDIUM": 21,
283
+ "LOW": 12
284
+ },
285
+ "byStatus": {
286
+ "QUARANTINED": 27,
287
+ "FIXED": 15,
288
+ "INVESTIGATING": 5
289
+ }
290
+ },
291
+
292
+ "recommendation": "Focus on 14 HIGH severity flaky tests first. Estimated fix time: 2-3 weeks to reach 95% reliability."
293
+ }
294
+ ```
295
+
296
+ ### 2. Root Cause Analysis
297
+
298
+ Analyzes test failures to identify root causes using log analysis, error pattern matching, and statistical correlation.
299
+
300
+ **Root Cause Analyzer:**
301
+ ```javascript
302
+ class RootCauseAnalyzer {
303
+ async analyzeRootCause(testName, failureData) {
304
+ const analysis = {
305
+ category: null,
306
+ confidence: 0,
307
+ description: '',
308
+ evidence: [],
309
+ recommendation: ''
310
+ };
311
+
312
+ // Analyze error messages
313
+ const errorPatterns = this.analyzeErrorPatterns(failureData.errors);
314
+
315
+ // Analyze timing
316
+ const timingAnalysis = this.analyzeTimingPatterns(failureData.durations);
317
+
318
+ // Analyze environment
319
+ const environmentAnalysis = this.analyzeEnvironmentalFactors(failureData);
320
+
321
+ // Analyze test code
322
+ const codeAnalysis = await this.analyzeTestCode(testName);
323
+
324
+ // Determine most likely root cause
325
+ const causes = [
326
+ this.detectRaceCondition(errorPatterns, timingAnalysis, codeAnalysis),
327
+ this.detectTimeout(errorPatterns, timingAnalysis),
328
+ this.detectNetworkFlake(errorPatterns, environmentAnalysis),
329
+ this.detectDataDependency(errorPatterns, codeAnalysis),
330
+ this.detectOrderDependency(failureData.orderPositions),
331
+ this.detectMemoryLeak(environmentAnalysis, timingAnalysis)
332
+ ].filter(cause => cause !== null);
333
+
334
+ if (causes.length > 0) {
335
+ // Return highest confidence cause
336
+ const topCause = causes.sort((a, b) => b.confidence - a.confidence)[0];
337
+ Object.assign(analysis, topCause);
338
+ }
339
+
340
+ return analysis;
341
+ }
342
+
343
+ detectRaceCondition(errorPatterns, timingAnalysis, codeAnalysis) {
344
+ const indicators = [];
345
+ let confidence = 0;
346
+
347
+ // Check for race condition error messages
348
+ if (errorPatterns.some(p => p.includes('race') || p.includes('not found') || p.includes('undefined'))) {
349
+ indicators.push('Error messages suggest race condition');
350
+ confidence += 0.3;
351
+ }
352
+
353
+ // Check for timing correlation
354
+ if (timingAnalysis.failuresCorrelateWithSpeed) {
355
+ indicators.push('Faster executions fail more often');
356
+ confidence += 0.3;
357
+ }
358
+
359
+ // Check for async/await issues in code
360
+ if (codeAnalysis.missingAwaits || codeAnalysis.unawaited Promises) {
361
+ indicators.push('Code contains unawaited promises');
362
+ confidence += 0.4;
363
+ }
364
+
365
+ if (confidence > 0.5) {
366
+ return {
367
+ category: 'RACE_CONDITION',
368
+ confidence: Math.min(confidence, 1.0),
369
+ description: 'Test has race condition between async operations',
370
+ evidence: indicators,
371
+ recommendation: 'Add explicit waits or synchronization points'
372
+ };
373
+ }
374
+
375
+ return null;
376
+ }
377
+
378
+ detectTimeout(errorPatterns, timingAnalysis) {
379
+ const indicators = [];
380
+ let confidence = 0;
381
+
382
+ // Check for timeout errors
383
+ const timeoutPatterns = ['timeout', 'timed out', 'exceeded', 'time limit'];
384
+ if (errorPatterns.some(p => timeoutPatterns.some(tp => p.toLowerCase().includes(tp)))) {
385
+ indicators.push('Timeout error messages detected');
386
+ confidence += 0.5;
387
+ }
388
+
389
+ // Check if failures correlate with long durations
390
+ if (timingAnalysis.failureDurationAvg > timingAnalysis.successDurationAvg * 1.5) {
391
+ indicators.push('Failures take significantly longer');
392
+ confidence += 0.3;
393
+ }
394
+
395
+ // Check if failures occur near timeout threshold
396
+ if (timingAnalysis.failuresNearTimeout) {
397
+ indicators.push('Failures occur near timeout threshold');
398
+ confidence += 0.2;
399
+ }
400
+
401
+ if (confidence > 0.5) {
402
+ return {
403
+ category: 'TIMEOUT',
404
+ confidence: Math.min(confidence, 1.0),
405
+ description: 'Test fails due to timeouts under load or slow conditions',
406
+ evidence: indicators,
407
+ recommendation: 'Increase timeout or optimize operation speed'
408
+ };
409
+ }
410
+
411
+ return null;
412
+ }
413
+
414
+ detectNetworkFlake(errorPatterns, environmentAnalysis) {
415
+ const indicators = [];
416
+ let confidence = 0;
417
+
418
+ // Check for network errors
419
+ const networkPatterns = ['network', 'connection', 'fetch', 'ECONNREFUSED', '502', '503', '504'];
420
+ if (errorPatterns.some(p => networkPatterns.some(np => p.includes(np)))) {
421
+ indicators.push('Network error messages detected');
422
+ confidence += 0.4;
423
+ }
424
+
425
+ // Check for CI agent correlation
426
+ if (environmentAnalysis.specificAgentsFailMore) {
427
+ indicators.push('Failures correlate with specific CI agents');
428
+ confidence += 0.3;
429
+ }
430
+
431
+ // Check for time-of-day correlation
432
+ if (environmentAnalysis.failsDuringPeakHours) {
433
+ indicators.push('Failures increase during peak hours');
434
+ confidence += 0.3;
435
+ }
436
+
437
+ if (confidence > 0.5) {
438
+ return {
439
+ category: 'NETWORK_FLAKE',
440
+ confidence: Math.min(confidence, 1.0),
441
+ description: 'Test fails due to network instability or external service issues',
442
+ evidence: indicators,
443
+ recommendation: 'Add retry logic with exponential backoff'
444
+ };
445
+ }
446
+
447
+ return null;
448
+ }
449
+
450
+ async analyzeTestCode(testName) {
451
+ // Static analysis of test code
452
+ const testCode = await this.loadTestCode(testName);
453
+
454
+ return {
455
+ missingAwaits: this.findMissingAwaits(testCode),
456
+ unawaitedPromises: this.findUnawaitedPromises(testCode),
457
+ hardcodedSleeps: this.findHardcodedSleeps(testCode),
458
+ sharedState: this.findSharedState(testCode),
459
+ externalDependencies: this.findExternalDependencies(testCode)
460
+ };
461
+ }
462
+ }
463
+ ```
464
+
465
+ ### 3. Auto-Stabilization
466
+
467
+ Automatically applies fixes to common flakiness patterns.
468
+
469
+ **Auto-Stabilizer:**
470
+ ```javascript
471
+ class AutoStabilizer {
472
+ async stabilizeTest(testName, rootCause) {
473
+ const strategies = {
474
+ RACE_CONDITION: this.fixRaceCondition,
475
+ TIMEOUT: this.fixTimeout,
476
+ NETWORK_FLAKE: this.fixNetworkFlake,
477
+ DATA_DEPENDENCY: this.fixDataDependency,
478
+ ORDER_DEPENDENCY: this.fixOrderDependency
479
+ };
480
+
481
+ const strategy = strategies[rootCause.category];
482
+ if (!strategy) {
483
+ return { success: false, reason: 'No auto-fix available for this category' };
484
+ }
485
+
486
+ try {
487
+ const result = await strategy.call(this, testName, rootCause);
488
+ return result;
489
+ } catch (error) {
490
+ return { success: false, error: error.message };
491
+ }
492
+ }
493
+
494
+ async fixRaceCondition(testName, rootCause) {
495
+ const testCode = await this.loadTestCode(testName);
496
+
497
+ // Strategy 1: Add explicit waits
498
+ let modifiedCode = this.addExplicitWaits(testCode, rootCause);
499
+
500
+ // Strategy 2: Fix unawaited promises
501
+ modifiedCode = this.fixUnawaitedPromises(modifiedCode);
502
+
503
+ // Strategy 3: Add retry with idempotency check
504
+ modifiedCode = this.addRetryLogic(modifiedCode);
505
+
506
+ await this.saveTestCode(testName, modifiedCode);
507
+
508
+ // Run test 10 times to validate fix
509
+ const validationResults = await this.runTestMultipleTimes(testName, 10);
510
+
511
+ return {
512
+ success: validationResults.passRate >= 0.95,
513
+ originalPassRate: rootCause.passRate,
514
+ newPassRate: validationResults.passRate,
515
+ modifications: [
516
+ 'Added explicit waits for async operations',
517
+ 'Fixed unawaited promises',
518
+ 'Added retry logic with exponential backoff'
519
+ ]
520
+ };
521
+ }
522
+
523
+ addExplicitWaits(code, rootCause) {
524
+ // Find async operations that need explicit waits
525
+ const asyncOperations = this.findAsyncOperations(code);
526
+
527
+ for (const operation of asyncOperations) {
528
+ // Add waitFor wrapper
529
+ const waitCode = `await waitForCondition(${operation.condition}, { timeout: ${operation.timeout} });`;
530
+ code = code.replace(operation.original, operation.original + '\n' + waitCode);
531
+ }
532
+
533
+ return code;
534
+ }
535
+
536
+ async fixTimeout(testName, rootCause) {
537
+ const testCode = await this.loadTestCode(testName);
538
+
539
+ // Increase timeout values
540
+ let modifiedCode = this.increaseTimeouts(testCode, 2.0); // 2x current timeout
541
+
542
+ // Add explicit waits instead of generic timeouts
543
+ modifiedCode = this.replaceTimeoutsWithWaits(modifiedCode);
544
+
545
+ await this.saveTestCode(testName, modifiedCode);
546
+
547
+ const validationResults = await this.runTestMultipleTimes(testName, 10);
548
+
549
+ return {
550
+ success: validationResults.passRate >= 0.95,
551
+ modifications: [
552
+ 'Increased timeout thresholds by 2x',
553
+ 'Replaced generic timeouts with explicit condition waits'
554
+ ]
555
+ };
556
+ }
557
+
558
+ async fixNetworkFlake(testName, rootCause) {
559
+ const testCode = await this.loadTestCode(testName);
560
+
561
+ // Add retry logic for network requests
562
+ let modifiedCode = this.addNetworkRetry(testCode, {
563
+ maxRetries: 3,
564
+ backoff: 'exponential',
565
+ retryOn: [502, 503, 504, 'ECONNREFUSED', 'ETIMEDOUT']
566
+ });
567
+
568
+ // Add circuit breaker for external services
569
+ modifiedCode = this.addCircuitBreaker(modifiedCode);
570
+
571
+ await this.saveTestCode(testName, modifiedCode);
572
+
573
+ const validationResults = await this.runTestMultipleTimes(testName, 10);
574
+
575
+ return {
576
+ success: validationResults.passRate >= 0.95,
577
+ modifications: [
578
+ 'Added retry logic with exponential backoff',
579
+ 'Added circuit breaker for external services',
580
+ 'Increased timeout for network requests'
581
+ ]
582
+ };
583
+ }
584
+ }
585
+ ```
586
+
587
+ **Auto-Stabilization Example:**
588
+ ```javascript
589
+ // BEFORE: Flaky test with race condition
590
+ test('processes payment successfully', async () => {
591
+ const order = await createOrder({ amount: 100 });
592
+ const payment = await processPayment(order.id); // Might fail if order not persisted
593
+ expect(payment.status).toBe('success');
594
+ });
595
+
596
+ // AFTER: Auto-stabilized test
597
+ test('processes payment successfully', async () => {
598
+ const order = await createOrder({ amount: 100 });
599
+
600
+ // ✅ Added: Explicit wait for order persistence
601
+ await waitForCondition(
602
+ () => orderService.exists(order.id),
603
+ { timeout: 5000, interval: 100 }
604
+ );
605
+
606
+ // ✅ Added: Retry logic with exponential backoff
607
+ const payment = await retryWithBackoff(
608
+ () => processPayment(order.id),
609
+ { maxRetries: 3, backoff: 'exponential' }
610
+ );
611
+
612
+ expect(payment.status).toBe('success');
613
+ });
614
+
615
+ // Result: Pass rate improved from 73% → 98%
616
+ ```
617
+
618
+ ### 4. Quarantine Management
619
+
620
+ Automatically quarantines flaky tests to prevent them from blocking CI while fixes are in progress.
621
+
622
+ **Quarantine Manager:**
623
+ ```javascript
624
+ class QuarantineManager {
625
+ async quarantineTest(testName, reason) {
626
+ const quarantine = {
627
+ testName: testName,
628
+ reason: reason,
629
+ quarantinedAt: new Date(),
630
+ assignedTo: this.assignOwner(testName),
631
+ estimatedFixTime: this.estimateFixTime(reason),
632
+ maxQuarantineDays: 30,
633
+ status: 'QUARANTINED'
634
+ };
635
+
636
+ // Add skip annotation to test
637
+ await this.addSkipAnnotation(testName, quarantine);
638
+
639
+ // Create tracking issue
640
+ await this.createJiraIssue(quarantine);
641
+
642
+ // Notify team
643
+ await this.notifyTeam(quarantine);
644
+
645
+ // Schedule review
646
+ await this.scheduleReview(quarantine);
647
+
648
+ await this.storage.save(`quarantine/${testName}`, quarantine);
649
+
650
+ return quarantine;
651
+ }
652
+
653
+ async addSkipAnnotation(testName, quarantine) {
654
+ const testCode = await this.loadTestCode(testName);
655
+
656
+ const annotation = `
657
+ // QUARANTINED: ${quarantine.reason}
658
+ // Quarantined: ${quarantine.quarantinedAt.toISOString()}
659
+ // Assigned: ${quarantine.assignedTo}
660
+ // Issue: ${quarantine.jiraIssue}
661
+ test.skip('${testName}', async () => {
662
+ // Test code...
663
+ });
664
+ `;
665
+
666
+ // Replace test with skip annotation
667
+ const modifiedCode = testCode.replace(/test\('/, `test.skip('`);
668
+ await this.saveTestCode(testName, modifiedCode);
669
+ }
670
+
671
+ async reviewQuarantinedTests() {
672
+ const quarantined = await this.storage.list('quarantine/*');
673
+ const results = {
674
+ reviewed: [],
675
+ reinstated: [],
676
+ escalated: [],
677
+ deleted: []
678
+ };
679
+
680
+ for (const quarantine of quarantined) {
681
+ const daysInQuarantine = (Date.now() - quarantine.quarantinedAt) / (1000 * 60 * 60 * 24);
682
+
683
+ if (daysInQuarantine > quarantine.maxQuarantineDays) {
684
+ // Escalate or delete
685
+ if (await this.isTestStillRelevant(quarantine.testName)) {
686
+ results.escalated.push(quarantine);
687
+ await this.escalateToLeadership(quarantine);
688
+ } else {
689
+ results.deleted.push(quarantine);
690
+ await this.deleteTest(quarantine.testName);
691
+ }
692
+ } else {
693
+ // Check if test has been fixed
694
+ const validationResults = await this.runTestMultipleTimes(quarantine.testName, 20);
695
+
696
+ if (validationResults.passRate >= 0.95) {
697
+ results.reinstated.push(quarantine);
698
+ await this.reinstateTest(quarantine.testName);
699
+ } else {
700
+ results.reviewed.push(quarantine);
701
+ }
702
+ }
703
+ }
704
+
705
+ return results;
706
+ }
707
+ }
708
+ ```
709
+
710
+ **Quarantine Dashboard:**
711
+ ```
712
+ ┌─────────────────────────────────────────────────────────┐
713
+ │ Quarantined Tests Dashboard │
714
+ ├─────────────────────────────────────────────────────────┤
715
+ │ │
716
+ │ Total Quarantined: 27 │
717
+ │ Fixed & Reinstated: 15 (this month) │
718
+ │ Escalated: 2 │
719
+ │ Deleted: 3 │
720
+ │ │
721
+ │ By Category: │
722
+ │ Race Condition: 14 tests │
723
+ │ Timeout: 8 tests │
724
+ │ Network Flake: 3 tests │
725
+ │ Data Dependency: 2 tests │
726
+ │ │
727
+ │ By Owner: │
728
+ │ Backend Team: 12 tests (avg 8 days) │
729
+ │ Frontend Team: 9 tests (avg 12 days) │
730
+ │ Mobile Team: 6 tests (avg 15 days) │
731
+ │ │
732
+ │ Overdue (>14 days): 5 tests ⚠️ │
733
+ │ Critical (>30 days): 0 tests ✅ │
734
+ │ │
735
+ └─────────────────────────────────────────────────────────┘
736
+ ```
737
+
738
+ ### 5. Trend Tracking
739
+
740
+ Tracks flakiness trends over time to identify systemic issues.
741
+
742
+ **Trend Tracker:**
743
+ ```javascript
744
+ class FlakynessTrendTracker {
745
+ async trackTrends(timeWindow = 90) {
746
+ const trends = {
747
+ overall: this.calculateOverallTrend(timeWindow),
748
+ byCategory: this.calculateTrendsByCategory(timeWindow),
749
+ byTeam: this.calculateTrendsByTeam(timeWindow),
750
+ byTimeOfDay: this.calculateTrendsByTimeOfDay(timeWindow),
751
+ predictions: this.predictFutureTrends(timeWindow)
752
+ };
753
+
754
+ return trends;
755
+ }
756
+
757
+ calculateOverallTrend(days) {
758
+ const data = this.getHistoricalData(days);
759
+
760
+ const weeklyFlakiness = [];
761
+ for (let week = 0; week < days / 7; week++) {
762
+ const weekData = data.filter(d =>
763
+ d.timestamp >= Date.now() - (week + 1) * 7 * 24 * 60 * 60 * 1000 &&
764
+ d.timestamp < Date.now() - week * 7 * 24 * 60 * 60 * 1000
765
+ );
766
+
767
+ weeklyFlakiness.push({
768
+ week: week,
769
+ flakyTests: weekData.filter(d => d.flaky).length,
770
+ totalTests: weekData.length,
771
+ flakinessRate: weekData.filter(d => d.flaky).length / weekData.length
772
+ });
773
+ }
774
+
775
+ const trend = this.calculateTrendDirection(weeklyFlakiness);
776
+
777
+ return {
778
+ current: weeklyFlakiness[0].flakinessRate,
779
+ trend: trend, // IMPROVING, STABLE, DEGRADING
780
+ weeklyData: weeklyFlakiness,
781
+ targetReliability: 0.95,
782
+ daysToTarget: this.estimateDaysToTarget(weeklyFlakiness, 0.95)
783
+ };
784
+ }
785
+ }
786
+ ```
787
+
788
+ **Trend Visualization:**
789
+ ```
790
+ Flakiness Trend (Last 90 Days)
791
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
792
+
793
+ 8% ┤
794
+ │ ╭─╮
795
+ 7% ┤ ╭─╯ ╰╮
796
+ │ ╭─╯ ╰╮
797
+ 6% ┤ ╭─╯ ╰─╮
798
+ │ ╭─╯ ╰╮
799
+ 5% ┤ ╭─╯ ╰─╮
800
+ │ ╭─╯ ╰─╮
801
+ 4% ┤ ╭─╯ ╰─╮
802
+ │ ╭─╯ ╰─╮
803
+ 3% ┤ ╭─╯ ╰─╮
804
+ │ ╭───╯ ╰──
805
+ 2% ┼───╯ ─
806
+ └─┬────┬────┬────┬────┬────┬────┬────┬────┬────┬──
807
+ 90d 80d 70d 60d 50d 40d 30d 20d 10d Now
808
+
809
+ Trend: ✅ IMPROVING (-65% in 90 days)
810
+ Current: 2.1% (Target: <5%)
811
+ Status: ✅ EXCEEDING TARGET
812
+ ```
813
+
814
+ ### 6. Reliability Scoring
815
+
816
+ Assigns reliability scores to all tests for prioritization and monitoring.
817
+
818
+ **Reliability Scorer:**
819
+ ```javascript
820
+ class ReliabilityScorer {
821
+ calculateReliabilityScore(testName, history) {
822
+ const weights = {
823
+ recentPassRate: 0.4,
824
+ overallPassRate: 0.2,
825
+ consistency: 0.2,
826
+ environmentalStability: 0.1,
827
+ executionSpeed: 0.1
828
+ };
829
+
830
+ // Recent pass rate (last 30 runs)
831
+ const recent = history.slice(-30);
832
+ const recentPassRate = recent.filter(r => r.result === 'pass').length / recent.length;
833
+
834
+ // Overall pass rate
835
+ const overallPassRate = history.filter(r => r.result === 'pass').length / history.length;
836
+
837
+ // Consistency (low variance in results)
838
+ const consistency = 1 - this.calculateInconsistency(history);
839
+
840
+ // Environmental stability (passes in all environments)
841
+ const environmentalStability = this.calculateEnvironmentalStability(history);
842
+
843
+ // Execution speed stability (low variance in duration)
844
+ const executionSpeed = this.calculateExecutionSpeedStability(history);
845
+
846
+ const score = (
847
+ recentPassRate * weights.recentPassRate +
848
+ overallPassRate * weights.overallPassRate +
849
+ consistency * weights.consistency +
850
+ environmentalStability * weights.environmentalStability +
851
+ executionSpeed * weights.executionSpeed
852
+ );
853
+
854
+ return {
855
+ score: score,
856
+ grade: this.getReliabilityGrade(score),
857
+ components: {
858
+ recentPassRate,
859
+ overallPassRate,
860
+ consistency,
861
+ environmentalStability,
862
+ executionSpeed
863
+ }
864
+ };
865
+ }
866
+
867
+ getReliabilityGrade(score) {
868
+ if (score >= 0.95) return 'A'; // Excellent
869
+ if (score >= 0.90) return 'B'; // Good
870
+ if (score >= 0.80) return 'C'; // Fair
871
+ if (score >= 0.70) return 'D'; // Poor
872
+ return 'F'; // Failing
873
+ }
874
+ }
875
+ ```
876
+
877
+ ### 7. Predictive Flakiness
878
+
879
+ Predicts which tests are likely to become flaky based on code changes and historical patterns.
880
+
881
+ **Flakiness Predictor:**
882
+ ```javascript
883
+ class FlakinessPredictor {
884
+ async predictFlakiness(testName, codeChanges) {
885
+ const features = {
886
+ // Test characteristics
887
+ testComplexity: await this.calculateTestComplexity(testName),
888
+ hasAsyncOperations: await this.hasAsyncOperations(testName),
889
+ hasNetworkCalls: await this.hasNetworkCalls(testName),
890
+ hasSharedState: await this.hasSharedState(testName),
891
+
892
+ // Recent changes
893
+ linesChanged: codeChanges.additions + codeChanges.deletions,
894
+ filesChanged: codeChanges.files.length,
895
+ asyncCodeAdded: this.detectAsyncCodeAddition(codeChanges),
896
+
897
+ // Historical patterns
898
+ authorFlakinessRate: await this.getAuthorFlakinessRate(codeChanges.author),
899
+ moduleHistoricalFlakiness: await this.getModuleFlakiness(testName),
900
+ recentFlakesInModule: await this.getRecentModuleFlakes(testName)
901
+ };
902
+
903
+ const prediction = await this.mlModel.predict(features);
904
+
905
+ return {
906
+ probability: prediction.probability,
907
+ confidence: prediction.confidence,
908
+ riskLevel: this.getRiskLevel(prediction.probability),
909
+ recommendation: this.getRecommendation(prediction, features)
910
+ };
911
+ }
912
+
913
+ getRecommendation(prediction, features) {
914
+ if (prediction.probability > 0.7) {
915
+ return {
916
+ action: 'REVIEW_BEFORE_MERGE',
917
+ message: 'High risk of flakiness - recommend thorough testing',
918
+ suggestedActions: [
919
+ 'Run test 20+ times before merge',
920
+ 'Add explicit waits for async operations',
921
+ 'Review for race conditions',
922
+ 'Consider splitting into smaller tests'
923
+ ]
924
+ };
925
+ }
926
+
927
+ if (prediction.probability > 0.4) {
928
+ return {
929
+ action: 'MONITOR_CLOSELY',
930
+ message: 'Medium risk - monitor after merge',
931
+ suggestedActions: [
932
+ 'Run test 10+ times before merge',
933
+ 'Enable flakiness detection monitoring',
934
+ 'Set up alerts for failures'
935
+ ]
936
+ };
937
+ }
938
+
939
+ return {
940
+ action: 'STANDARD_PROCESS',
941
+ message: 'Low risk - proceed normally'
942
+ };
943
+ }
944
+ }
945
+ ```
946
+
947
+ ## Integration Points
948
+
949
+ ### Upstream Dependencies
950
+ - **CI/CD Systems**: Test execution results (Jenkins, GitHub Actions)
951
+ - **Test Runners**: Jest, Pytest, JUnit results
952
+ - **Version Control**: Git for code analysis
953
+ - **APM Tools**: Performance data (New Relic, Datadog)
954
+
955
+ ### Downstream Consumers
956
+ - **qe-test-executor**: Skips quarantined tests
957
+ - **qe-regression-risk-analyzer**: Excludes flaky tests from selection
958
+ - **qe-deployment-readiness**: Considers test reliability in risk score
959
+ - **Development Teams**: Receives fix recommendations
960
+
961
+ ### Coordination Agents
962
+ - **qe-fleet-commander**: Orchestrates flaky test hunting
963
+ - **qe-quality-gate**: Blocks builds with too many flaky tests
964
+
965
+ ## Memory Keys
966
+
967
+ ### Input Keys
968
+ - `aqe/test-results/history` - Historical test execution results
969
+ - `aqe/flaky-tests/known` - Known flaky tests registry
970
+ - `aqe/code-changes/current` - Recent code changes
971
+
972
+ ### Output Keys
973
+ - `aqe/flaky-tests/detected` - Newly detected flaky tests
974
+ - `aqe/test-reliability/scores` - Test reliability scores
975
+ - `aqe/quarantine/active` - Currently quarantined tests
976
+ - `aqe/remediation/suggestions` - Auto-fix suggestions
977
+
978
+ ### Coordination Keys
979
+ - `aqe/flaky-tests/status` - Detection status
980
+ - `aqe/flaky-tests/alerts` - Critical flakiness alerts
981
+
982
+ ## Use Cases
983
+
984
+ ### Use Case 1: Detect and Quarantine Flaky Tests
985
+
986
+ **Scenario**: Identify flaky tests in CI and quarantine them.
987
+
988
+ **Workflow:**
989
+ ```bash
990
+ # Detect flaky tests from last 30 days
991
+ aqe flaky detect --days 30 --min-runs 10
992
+
993
+ # Analyze root causes
994
+ aqe flaky analyze --test "integration/checkout.test.ts"
995
+
996
+ # Quarantine flaky tests
997
+ aqe flaky quarantine --severity HIGH --auto-assign
998
+
999
+ # Generate report
1000
+ aqe flaky report --output flaky-tests-report.html
1001
+ ```
1002
+
1003
+ ### Use Case 2: Auto-Stabilize Flaky Test
1004
+
1005
+ **Scenario**: Automatically fix a flaky test with race condition.
1006
+
1007
+ **Workflow:**
1008
+ ```bash
1009
+ # Detect root cause
1010
+ aqe flaky analyze --test "integration/payment.test.ts"
1011
+
1012
+ # Attempt auto-stabilization
1013
+ aqe flaky auto-fix --test "integration/payment.test.ts"
1014
+
1015
+ # Validate fix
1016
+ aqe flaky validate --test "integration/payment.test.ts" --runs 20
1017
+
1018
+ # Reinstate if fixed
1019
+ aqe flaky reinstate --test "integration/payment.test.ts"
1020
+ ```
1021
+
1022
+ ### Use Case 3: Track Flakiness Trends
1023
+
1024
+ **Scenario**: Monitor flakiness trends and identify systemic issues.
1025
+
1026
+ **Workflow:**
1027
+ ```bash
1028
+ # Generate trend report
1029
+ aqe flaky trends --days 90 --format chart
1030
+
1031
+ # Identify hotspots
1032
+ aqe flaky hotspots --by module --threshold 0.10
1033
+
1034
+ # Predict future flakiness
1035
+ aqe flaky predict --target-date 2025-12-31
1036
+ ```
1037
+
1038
+ ## Success Metrics
1039
+
1040
+ ### Quality Metrics
1041
+ - **Test Reliability**: 95%+ (target achieved)
1042
+ - **False Negative Rate**: <2% (flaky tests causing false passes)
1043
+ - **False Positive Rate**: <3% (stable tests incorrectly flagged)
1044
+ - **Detection Accuracy**: 98%
1045
+
1046
+ ### Efficiency Metrics
1047
+ - **Time to Detect Flakiness**: <1 hour (automated)
1048
+ - **Time to Fix**: 80% fixed within 7 days
1049
+ - **Quarantine Duration**: Average 8 days
1050
+ - **Auto-Fix Success Rate**: 65%
1051
+
1052
+ ### Business Metrics
1053
+ - **CI Reliability**: 99.5% (no false failures blocking deployments)
1054
+ - **Developer Trust**: 4.9/5 (high confidence in test results)
1055
+ - **Time Saved**: 15 hours/week (no manual reruns)
1056
+
1057
+ ## Commands
1058
+
1059
+ ### Basic Commands
1060
+
1061
+ ```bash
1062
+ # Detect flaky tests
1063
+ aqe flaky detect --days <number>
1064
+
1065
+ # Analyze root cause
1066
+ aqe flaky analyze --test <test-name>
1067
+
1068
+ # Quarantine test
1069
+ aqe flaky quarantine --test <test-name> --reason <reason>
1070
+
1071
+ # Reinstate test
1072
+ aqe flaky reinstate --test <test-name>
1073
+
1074
+ # Generate report
1075
+ aqe flaky report --output <file>
1076
+ ```
1077
+
1078
+ ### Advanced Commands
1079
+
1080
+ ```bash
1081
+ # Auto-fix flaky test
1082
+ aqe flaky auto-fix --test <test-name> --validate
1083
+
1084
+ # Track trends
1085
+ aqe flaky trends --days <number> --format <html|chart|json>
1086
+
1087
+ # Identify hotspots
1088
+ aqe flaky hotspots --by <module|team|category>
1089
+
1090
+ # Predict flakiness
1091
+ aqe flaky predict --test <test-name> --changes <git-diff>
1092
+
1093
+ # Review quarantined tests
1094
+ aqe flaky review-quarantine --auto-reinstate
1095
+ ```
1096
+
1097
+ ### Specialized Commands
1098
+
1099
+ ```bash
1100
+ # Reliability scoring
1101
+ aqe flaky reliability-score --test <test-name>
1102
+
1103
+ # Bulk quarantine
1104
+ aqe flaky bulk-quarantine --severity HIGH --days 7
1105
+
1106
+ # Escalate overdue
1107
+ aqe flaky escalate-overdue --threshold 30
1108
+
1109
+ # Export quarantine dashboard
1110
+ aqe flaky quarantine-dashboard --output dashboard.html
1111
+
1112
+ # Flakiness heatmap
1113
+ aqe flaky heatmap --by-module --output heatmap.png
1114
+ ```
1115
+
1116
+ ---
1117
+
1118
+ **Agent Status**: Production Ready
1119
+ **Last Updated**: 2025-09-30
1120
+ **Version**: 1.0.0
1121
+ **Maintainer**: AQE Fleet Team