Abstract Accurately forecasting the remaining useful life (RUL) stands as a pivotal and formidable task within the realm of prognostics and health management. However, there is limited research that considers integrating early fault diagnosis during the bearing’s lifecycle with the prediction of its RUL. In this article, a comprehensive bearing prognosis framework based on piecewise function stacking convolution auto-encoder (AE) and XGBoost algorithm is proposed. To achieve this, an unsupervised piecewise function-based deep stacked convolutional AE was designed to construct the health indicator (HI) of the bearing for reducing the dependency on prior knowledge and furnishing a dynamic foundation for predicting RUL. The 4σ criterion based on HI’s increment was proposed for determining the fault occurrence time (FOT) of the bearing’s operational process. Subsequently, an XGBoost algorithm model was utilized to predict the RUL of faulty bearings. The efficacy of the bearing prognosis framework was validated by two real bearing test datasets. Results indicate the employed criterion of construct HI can flexibly adjust to various operational conditions and accurately pinpoint the bearing’s FOT. Furthermore, the findings demonstrate the proposed bearing prognosis framework achieves superior performance compared with several conventional anomaly detection methods.