@joefromchicago,
I can tell someone that I have spent a lot of time thinking about doing X (some "bad" thing, like, say, screwing my sister). That will often be condemned as "immoral" even though everyone understands that I haven't done it).
I might well be advised to "stop thinking such things, because those are "immoral thoughts."
They would be "correct" about what my thoughts are, because I told them. No real mystery there, is there?
I'm told that catholics are required to confess "impure thought" to priests, so that their "sins" in that respect can be atoned for.