The way to attain compunction is an attentive life. ‘The beginning of repentance comes from the fear of God and attention,’ as the holy martyr Boniface says.
According to the degree to which the intellect is stripped of the passions, the Holy Spirit initiates the intellect into the mysteries of the age to be.
Fear God and keep His commandments both in your feelings and in your intellect. If you force yourself to keep them in your intellect, bit by bit you will attain to fulfilling them in your feelings.
Compunction comes when you consider how much you have grieved God Who is so good, so sweet, so merciful, so kind, and entirely full of love; Who was crucified and suffered everything for us. When you meditate on these things and other things the Lord has suffered, they bring compunction.