Praise be to Allah, and peace and blessings be upon the Messenger of Allah.
The texts indicate that the angels may become aware of what is in a person’s heart insofar as Allah allows them to know it. Allah is able to inform them of this in whatever manner He wills. As for passing thoughts and fleeting inner whispers, a person is not held accountable for them unless he acts upon them or speaks about them. Remembering Allah in the heart is a righteous deed for which a person is rewarded, but it differs from remembrance expressed verbally by the tongue, for which specific rulings and virtues have been prescribed.
It is authentically reported from the Prophet ﷺ, relating from his Lord, the Almighty:
“Whoever intends to do a good deed but does not do it, Allah records it for him as one complete good deed...”
Narrated by al-Bukhari and Muslim.
Some scholars cited this hadith as evidence that an angel can know the intention of a servant.
Al-Hafiz Ibn Hajar stated that this may occur through Allah informing the angel of it, or by Allah creating in the angel knowledge through which he perceives it.
Shaykh al-Islam Ibn Taymiyyah, may Allah have mercy on him, said regarding this matter:
“The correct view is that Allah is capable of informing the angels of what is within the servant’s soul in whatever manner He wills.”
Therefore, we are not required to know how this occurs, because it is among the matters of the unseen.
The angels’ knowledge of some of what is within a person’s heart does not mean that they independently possess knowledge of the unseen. Absolute knowledge of the unseen belongs only to Allah.
Rather, the angels know what Allah informs them of or enables them to know in order to carry out the duties with which He has entrusted them.
Whoever remembers Allah in his heart is rewarded for his remembrance and intention. However, the forms of remembrance for which the Islamic law has prescribed a specific reward or ruling based on saying them with the tongue are not fulfilled merely by thinking of the words without pronouncing them.
For this reason, scholars distinguish between remembrance of the heart and remembrance of the tongue.
They have differed regarding the amount of verbalization required. The majority of scholars hold that a person should pronounce the remembrance so that he can hear himself, provided that his hearing is normal and there is no impediment. Some scholars, however, hold that moving the tongue with the letters is sufficient even if no sound is heard.
A person is not held accountable merely for fleeting thoughts and passing inner whispers that he does not settle upon, act upon, or speak about.
Conversely, a person may be rewarded for a sincere intention to do good, as indicated by the aforementioned hadith: whoever intends to do a good deed but does not carry it out may have a complete good deed recorded for him.
The angels may know some of what is in a person’s heart through Allah informing them of it and by whatever means He wills. This is not independent knowledge of the unseen. A person is not held accountable merely for passing thoughts and fleeting inner whispers, while a sincere intention to do good may earn a person reward from Allah.
As for the forms of remembrance that have been prescribed to be spoken, the basic principle is that they should be uttered with the tongue in order to attain the specific rulings and virtues associated with them. It is not sufficient merely for their words to pass through the heart.
And Allah knows best.