L'esprit de l'escalier or l'esprit d'escalier (literally, staircase wit) is a French term that describes the predicament of thinking of the perfect comeback too late.
Merriam-Webster dictionary defines it as follows:
A witty remark thought of too late, on the way home; the clever comment you wish you had delivered
"When he bragged about sleeping like a baby, I should have added the bit about waking up crying every two hours, but that's just esprit de l'escalier. At the time I just nodded and said nothing."
Is there an English term for that?