The Imams (a.s.) know their friends and that they are the in charge of their affairs

Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from ibn Mahbub from Salih ibn Sahl from abu 'Abdallah (a.s.) the following. "A man came to Amir al-Mu'minin Ali (a.s.) when he was in the company of his companions. The man offered greetings and said, "By Allah, I love you and acknowledge your Wilaya (Leadership with Divine Authority)." Amir al-Mu'minin Ali (a.s.) said to him, "What you say is not true."

He said, "Yes, by Allah, I love you and acknowledge your Wilaya. He repeated it three times." Amir al-Mu'minin Ali (a.s.) said, "What you say is not true. You are not what you say you are. Allah created the spirits two thousand years before creating the bodies. He then presented to us those who love us. By Allah, I did not see your spirit among those presented to us. Where were you." The man remained silent and did not talk back."

In an other hadith it is said that abu 'Abdallah (a.s.) said, "He was in thefire."

H , Ch. 110, h 2

Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from al-Hassan ibn Sa'id from 'Amr ibn Maymun from 'Ammar ibn Marwan from Jabir from abu Ja'far (a.s.) who has said the following. "We know men when we see them through the reality of faith and the reality of hypocrisy."

H , Ch. 110, h 3

Ahmad ibn Idris and Muhammad ibn Yahya havenarrated from al-Hassan ibn Ali al-Kufi from 'Ubays ibn Hisham from 'Abdallah ibn Sulayman who has said the following. "I asked abu 'Abdallah (a.s.) about the Imam. Has Allah made him the in charge of the and in full control (over the affairs of the people) as Sulayman ibn Dawud was?" The Imam (a.s.) said, "Yes, he is given control. It is because a man asked him a question and he gave the answer.

Another person asked the same question and he gave him a different answer (although the question was the same). A third person asked him the same question and he gave an answer that was different from both the previous answers. Then he said, "This is Our gift to you so give them away free or keep them as you like." (38:39). This is charity from us enjoy it with thanks or ( give to others) without being questioned. 

This is according to Imam Ali's recitation." The narrator has said that I said to him, "May Allah grant you well being, when the he gives such answers does the Imam know them?" The Imam (a.s.) said, "Glory belongs to Allah. Have you not heard Allah words? " In this there is evidence (of the Truth) for the discreet ones. (15:75) (Such people are the Imams (a.s.) That town lies on a road which still exists (15:76) (It will remain there for ever)." 

Then The Imam (a.s.) said to me, "Yes, when the Imam look at a person he recognizes him and his color. On hearing his words even from behind the wall he recognizes him and what he is. Allah has said, "Other evidence of His existence are the creation of the heavens and the earth and the differences of languages and colors. In this there is evidence (of the truth) for the worlds (mankind)." (30:22) 

The Imams are the scholars. Whatever they would hear that is spoken they recognize it, the one who has received salvation or one who is destroyed. For this reason they answer them as they answer them."