Scrupulosity is a recognized subset of OCD in which intrusive thoughts attach to religious content — sin, blasphemy, worthiness, the unforgivable sin, God's judgment. The pattern is the same as all OCD: intrusive thought triggers anxiety, anxiety triggers a compulsion (confession, prayer, reassurance-seeking, mental review), compulsion temporarily reduces anxiety, anxiety returns stronger. The religious content is not the illness. It is the subject matter the illness chose.
The pastoral history of scrupulosity is long. Martin Luther's confessor John Staupitz famously told him "God is not angry with you; you are angry with God." Luther's tortured conscience — confessing for hours, never finding peace — was not resolved by more theology. It was resolved when he encountered a different theology: justification by faith, the finished work of Christ, the complete sufficiency of grace. Whether that resolution constituted a clinical improvement or simply gave the OCD a new subject is debated. But the encounter with finished grace is still the theological anchor.
Jesus' statement about the unforgivable sin — blasphemy against the Holy Spirit — has generated centuries of fear in people who fear they've committed it. The consistent observation of theologians and clinicians alike is this: the person who fears they have committed the unforgivable sin almost certainly has not. The sin Jesus describes involved a specific act of attributing the work of the Holy Spirit to Satan. The ongoing anguish about possibly having committed it is evidence of a conscience that is still working, still concerned with God — which is the opposite of what blasphemy against the Spirit looks like.
Commentary is from a charismatic Protestant perspective, drawing on KJV text and public-domain sources including Spurgeon, Andrew Murray, and Matthew Henry.