It's super cumbersome, I think there's koinly you can use and plug in the data dumps from wallets or exchanges and it can work it out for you but really its just an incentive not to spend your bitcoin or limit your spending of it to non-kyc transfers
If you want to spend bitcoin, best to secure that spendable stash non-kyc, spending your KYC sats is always going to leave a trail that you might have to explain in the future.