We often think of compulsions as behaviors in response to our obsessions and the discomfort those obsessions create. For example, after sitting on a friend's couch for a couple of hours, I stand up and excessively check that I didn't drop anything on her couch by scanning the couch intently for a few seconds. I also reach into the crevices of the couch to make sure nothing fell into them. I pat my pockets to make sure I have all my stuff and proceed to go home. All this checking was triggered by my obsession with possibly losing something, and the idea of losing something makes me anxious. Perhaps I lost something important years ago by not checking after standing up, or maybe I just know losing things is a possibility. Regardless of the cause, the checking is driven by anxiety or the prevention of anxiety, and it's something I feel compelled to do.
In another scenario, my OCD therapist noticed I always check behind me after leaving his office and asked me about it. I told him I typically check behind me every time I stand up after sitting down. This happens at home, school, friend's homes, in cars, and in restaurants. He asked me if I think I would actually lose something if I didn't check and I told him "Probably not, but checking behind me is just something I've done for a long time; I can't even remember when, how, or why it started. I know it might be a bit excessive but it doesn't take up that much time." At one point my checking may have been driven by a fear of losing something but has since turned more into a rule (or habit) I follow. My therapist asked me, if as an experiment I'd be willing to keep a tally or log of times I check behind me. I keep track on a notepad on my phone and notice I checked more than I thought. The following week he asked me to tally the urge to check behind me but try not to check. I am able to do this successfully although I notice it feels a bit odd at first not to check. The next week he asks me to try this without tallying. After the third week, I realize I don't check behind me after standing up anymore, and if I do it's rare and short-lived. In retrospect, it doesn't seem like I had to go through multiple bouts of anxiety in order to stop this compulsion but rather just bring some awareness to it.
Sometimes we can have compulsions that aren't heavily driven by anxiety, guilt, fear, disgust, or avoidance of feelings but exist more out of habit. In these instances, simply tallying or logging the experience in real time can be useful. This process helps bring mindful awareness to our behavior, which is often lacking when we're engaging in habits that are governed by autopilot. Mindful awareness can be the space between an event and our response that gives us the ability to choose how we are going to respond. Through logging, we can also get additional information about the driving force behind our behavior. Our "habit" may actually be something that is anxiety/disgust/avoidance-driven however we don't realize it until we make an honest attempt at not engaging in the compulsion.