In order to retain muscle mass while losing body fat & lifting weights. Do you need to be a caloric deficit or maintenance calories?
Both are fine. A slight deficit can get you there quicker if you know what you are doing but once body fat drops below a threshold, you would need to switch to a caloric surplus to fuel further muscle growth (or maintenance to sustain current levels). Higher protein intake is a must, \~2.4 g/kg is optimum at deficit levels to preserve LBM.