When you feel urged to do something compulsive, do the opposite: practice non-action. This is one of the surest ways to undo patterned behaviour. A practice in non-action could be meditation. Meditation is helpful because it’s an alternative behaviour, which conditions a new response. It also affects neurological and chemical changes in the brain, thereby creating new neural pathways to help you stick with your alternative responses (vs. compulsive reactions) over time.
Urges, such as chemical cravings for substances, as seen in addiction, or behavioural clinging for attachment in cases of relational trauma, only last at their peak intensity for about fifteen minutes. If we can do something else to ride the wave of discomfort, we can allow it to pass without acting reflexively, which gives us greater freedom to choose a mindful response. We may have to practice this again and again throughout a particularly difficult hour, day, or week, but it is not a futile effort, as it will help you gain mastery over the urges that once controlled you, just as one masters a tough meditation.
In this way, much of life can be seen as a walking meditation. Embrace it mindfully and learn to surf!