From the treatise On Spiritual Perfection by Diadochus of Photice, bishop
The mind has a spiritual sense which teaches us to distinguish between good and evil
The light of true knowledge makes it possible to discern without error the difference between good and evil. Then the path of justice, which leads to the Sun of Justice, brings the mind into the limitless light of knowledge, since it never fails to seek the love of God with all confidence.
Therefore, we must maintain great stillness of mind, even in the midst of our struggles. We shall then be able to distinguish between the different types of thoughts that come to us: those that are good, those sent by God, we will treasure in our memory; those that are evil and inspired by the devil we will reject. A comparison with the sea may help us. A tranquil sea allows the fisherman to gaze right to its depths. No fish can hide there and escape his sight. The stormy sea, however, becomes murky when it is agitated by the winds. The very depths that it revealed in its placidness, the sea now hides. The skills of the fisherman are useless.
Only the Holy Spirit can purify the mind: unless the strong man enters and robs the thief, the booty will not be recovered. So by every means, but especially by peace of soul, we must try to provide the Holy Spirit with a resting place. Then we shall have the light of knowledge shining within us at all times, and it will show up for what they are all the dark and hateful temptations that come from demons, and not only will it show them up: exposure to this holy and glorious light will also greatly diminish their power.
This is why the Apostle says: Do not stifle the Spirit. The Holy Spirit is the Spirit of goodness: do not grieve him by your evil actions and thoughts, and so deprive yourself of the defense his light affords you. In his own being, which is eternal and life-giving, he is not stifled, but when he is grieved he turns away and leaves the mind in darkness, deprived of the light of knowledge.
The mind is capable of tasting and distinguishing accurately whatever is presented to it. Just as when our health is good we can tell the difference between good and bad food by our bodily sense of taste and reach for what is wholesome, so when our mind is strong and free from all anxiety, it is able to taste the riches of divine consolation and to preserve, through love, the memory of this taste. This teaches us what is best with absolute certainty. As Saint Paul says: My prayer is that your love may increase more and more in knowledge and insight, and so enable you to choose what is best.