A compulsive habit is nothing but a message that you send to yourself that something is somehow off. You certainly don't help yourself if you attack yourself over it, or that you bemoan your lack of will-power, or your irrationality. Instead, ask yourself what exactly triggered your reaction? And what can you do differently next time around?
Consider this example that Caroline Knapp quotes in her book, Appetites - Why Women Want: "Not long ago I heard a story about a woman who went to visit her mother for a weekend. Their relationship was, and still is, stormy and complicated, but she got through it with relative serenity - counted to ten under her breath a lot, recounted like mantras lesson learned in decades of therapy, kept her cool. But then, on her way to the airport, this grown, self-aware woman - a paragon of reason and maturity - was overcome with the compulsion to pull her rental car into the parking lot of a 7-Eleven, walk in, and steal a bottle of water. She could not resist; she snagged eight ounces of Evian and fled, embarrassed and confused."
What would you do if you were in her shoes? Along a spiritual path we want to understand why we react the way we do. Fact of the matter is that all of us carry pain bodies around and particular circumstances and people can trigger them for us, which in turn is quite painful. So the compulsive action is nothing but an instinctive reaction to run away from or rebel against these aroused painful memories.
So we would be asking ourselves what exactly we could do to deal with that shattered self, and we would face our mother next time around with even more commitment to heal our relationship and our past somehow. Perhaps we would use less escape mechanisms when we deal with her, and would take in the pain just as it hits us. Maybe, just maybe we would figure out a thing or two about ourself with every visit. And if in this process and we end up stealing a few more bottles of water or candy bars to get to this point, so be it.
Shadow work is all about identifying what unresolved issues we have and how we can reposition ourself to do things a little differently next time around. Whatever you do to heal the past, please don't shoot the messenger.