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.
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.
An old man was asked, 'How can I find God?' He said, 'In fasting, in watching, in labors, in devotion, and, above all, in discernment. I tell you, many have injured their bodies without discernment and have gone away from us having achieved nothing. Our mouths smell bad through fasting, we know the Scriptures by heart, we recite all the Psalms of David, but we have not that which God seeks: charity and humility.'