Abstract Due to the influence from external factors such as repair sites and seasonal climate change, it is difficult to restore the system performance to any intermediate level between perfect maintenance and minimal maintenance through imperfect maintenance. This article first categorizes the states of the system just before repair into three classes based on its internal degradation level: failure, major defect, and minor defect, with three corresponding thresholds. Subsequently, the corresponding repairs are carried out to dwindle the system’s degradation to different levels. In detail, if the internal degradation level of the system just before repair is recognized as minor defect, an imperfect repair, termed as type I imperfect repair, is implemented to scale down the degradation level below the minor defect threshold. If the degradation level is identified as major defect, an upgraded imperfect repair, termed as type II imperfect repair, is executed to only lower the degradation to the level between the minor defect threshold and major defect threshold. Otherwise, if the degradation before repair is beyond the failure threshold, replacement will be carried out instead of these imperfect repairs. Thus, a novel hierarchical imperfect maintenance structure is introduced. Then, a multi-variable repair cost model is constructed when considering the related costs incurred from inspection, type I imperfect repair, type II imperfect repair, replacement, and even system downtime. Finally, with the aid of the stationary law of Markov chains and the semi-regenerative process, the cost-based performance optimization with three parameters, including the inspection interval, minor defect threshold, and major defect threshold, is explored through a numerical experiment, and the closed expression of the optimal cost rate is provided.