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.
Grow calm, grow quiet after harmful noise... you will experience a certain movement towards eternity; gradually, like a still, small voice, a thought will come to you as to who you are and what is your end and purpose... this is a sign of the approach of the word of God in your soul.