Who can claim dependent student

2019 Separation Agreement says ex-wife and I will split college son's expenses alternating school years.  Also says 'As long as he is a student, she can claim him on her taxes'.  She paid all his expenses in 2021.  However, I paid all expenses in 2022 and now she may not be able to claim him.  She's willing to waive that sentence and let me claim him.  What needs to be done and can I now claim Head of Household? He lived entire year at school.