(Proverbs 16:3 KJV) Commit thy works unto the LORD, and thy thoughts shall be established.
There is an indication of cause and effect in this verse. First, accept that the Holy Spirit is the Prime Mover. He speaks to us. He works in us.
Having said that, one point that comes across to me in this verse is that there is hope for people who have a hard time with their attitudes but have a desire to obey. This is saying that some times it is a matter of developing a habit and the mind will follow.
Why do we have rules? What is one purpose of the Law? It gives us guidelines in how to act. Have people mentioned that your language is a bit too colorful? Your four letter words seem natural to you. Everyone around you is doing it. You don’t see how you can change. You change by disciplining your behavior. You “commit” (1556) your “works” (4639). You consciously put your words into discipline.
A strange thing happens. Over time your vocabulary changes. The habitual responses change. Through your obedience the Holy Spirit helps you get “established” (3559).
So? Rules have at least two purposes. One is to keep you from the actual sin. The other is to develop your character by guiding your behavior. Let it happen.