Usul al-Kafi
Book 4:
The Book of Divine Proof

Chapter 90
The knowledge of an Imam about his own status

475. 4. Imam Ali ar-Reza (p) was asked: Kindly tell me as to when an Imam (p) comes to know that he has become a practicing Imam (p)? Is it when the news of the demise of the previous Imam (p) reaches him or is it immediately after the death (of the previous Imam (p))?
The Imam (p): Immediately after the death.
The Imam (p) was asked: How does he come to know?
The Imam (p): God inspires him to this effect.

476. 5. Haroon Ibn al-Fadl reports that the day Imam Muhammad at-Taqi (p) died, he heard his son Imam Ali an-Naqi (p) suddenly reciting the verse: ... Verily to God we belong and verily to Him shall we return (Q, 2:156). This occurred in Medina, whereas Imam Muhammad at-Taqi (p) was martyred in Baghdad. Then he informed those who were present that his father Imam Muhammad at-Taqi (p) has died.
He was asked by some people: How did you come to know of this?
The Imam (p): I have experienced a feeling of grief which I have never experienced before.
477. 6. When Imam Musa al-Kazim (p) was forcibly being taken to Baghdad by the government, he sent for his son Imam Ali ar-Reza (p) and told him to sleep every night at the threshold (adjacent to the main entrance) of his house until the news of his death reaches him. Under these orders, his bed was made every night at the specified place. He used to come regularly after the night prayer and sleep on the bed. This routine continued for about four years and one night the Imam (p) did not come to sleep, causing much apprehension among the members of his family. They had a premonition of some catastrophe. Imam Ali ar-Reza (p) came in the morning, went inside his house and addressed a member of his household: Give me the articles which my father had entrusted to you.
On hearing this, the members of the household realized that Imam Musa al-Kazim (p) had passed away. Weeping and wailing ensued but the Imam (p) advised them to exercise restraint and not say anything about this incident until the news reached them through proper official channel. After a few days the sad news of the demise of Imam Musa al-Kazim (p) was conveyed to the family members officially…