Unless someone in your inner circle said something, I'm guessing he was preparing to file and his attorney checked or gets an update of filings from the court. I agree with Treasur, he was trying to surprise you and you beat him to the punch. Whether you got to see it or not, I'm sure he had an oh sh$t moment when his lawyer called and told him.

Get him out of the house. Since he knows, tell him to get out and then change the locks. Not a safe situation and no reason for him to be there. He can do his public baby holding and leave you in peace.