R. Chaim Vital's guide to prophetic and mystical attainment describes the spiritual preparations required to ascend to the level of Ruach HaKodesh and engage with the Merkavah tradition. Part 3 details the inner structure of the soul's connection to the supernal worlds.
נמצא כי כשיעסוק בתורה ובמצות ובמדות טובות הנקרא חסיד כנזכר לעיל, אם התערבה בו כונת קבול איזה שכר, הוא חסיד לעצמו. כמו שכתוב (משלי י"א י"ז) גומל נפשו איש חסד. כי בקיימו המצות, גומל חסד לנפשו. ולכן אינו נקרא חסיד אלא איש חסד, כי החסד הוא אל האיש עצמו הגומל לנפשו, אך הגומל חסד עם קונו נקרא חסיד וקדוש, יען כי נזדכך מכל מיני טומאה וקידש עצמו בקדושתו יתברך. כי לשון קדושה, לשון הכנה והזמנה כמו (במדבר י"א י"ח) התקדשו למחר ואכלתם, כי עושה עצמו מרכבה אל קדושתו יתברך ואינו חושש לכבוד עצמו אלא לכבוד קונו כנזכר לעיל: ואל זה נתכון רבי פנחס בן יאיר במה שאמר (במשנה סוף סוטה) פרישות מביאה לידי טהרה וכו' וקדושה לידי חסידות וחסידות לידי רוח הקדש, כי זו חסידות שלימה הבאה אחר הקדושה והיא המביאה לידי רוח הקדש כי נתדבק בו דבוק גמור וישיג לגלוי רזי תורה ולהתנבא עתידות כמו שאמר רבי מאיר (אבות פ"ו משנה ה') כל העוסק בתורה לשמה, רצונו לומר לשמה של התורה שהיא היא הקדוש ברוך הוא, כי כל התורה שמותיו של הקדוש ברוך הוא. זוכה לדברים הרבה וכו' ומגלין לו רזי תורה ונעשה כמעין המתגבר וכו':
From this we see that when a Chassid is occupied in the study of Torah or in performing the mitzvot or in good character traits; if even a hint of motivation to receive a reward is mixed into it, he is a Chassid for himself, as in the verse, “A man of kindness (Ish Chessed) brings goodness upon himself.” This is because when he fulfills the mitzvot, he brings goodness upon himself. Therefore, he is called a “Man of Chessed” rather than a “Chassid,” because he does himself the kindness. Only a person whose sole motivation is to do a kindness for his Master can be truly called a “Chassid” and a “Holy Man.” This is because he has become purified from all impurities and has sanctified himself in HaShem’s-יהו"ה holiness, blessed is He. We find that the term קדושה-Kedushah (holiness) means “preparation,” as in the verse, “Prepare yourselves for tomorrow and you shall eat meat.” This is because such a person makes himself the vehicle for HaShem’s-יהו"ה holiness, blessed is He. As mentioned above, rather than caring about his own glory, he only cares about his Master’s glory. When Rabbi Pinchas ben Yair said, “Caution brings to zeal, zeal brings to cleanliness, cleanliness brings to separateness, separateness brings to purity, purity brings to holiness, holiness brings to fear of sin, fear of sin brings to humility, humility brings to Chassidut, Chassidut brings to the Holy Spirit and the Holy Spirit brings to resurrecting the dead” – he was referring to this. This, specifically, is the perfect Chassidut that follows holiness and leads to the Holy Spirit. Because he totally cleaves to HaShem-יהו"ה, he will merit to attain the revelation of the secrets of Torah and to prophesy about the future. This is as Rabbi Meir said, “Whosoever is occupied in Torah for the sake of its name (that is, for its sake, rather than for his own sake) merits many things. Moreover, the existence of the whole world is worthwhile because of him. He is called friend, beloved, a lover of God, a lover of the creatures, the delight of God and the delight of the creatures. The Torah garbs him in humility and awe. It prepares him to be a Tzaddik, a Chassid, upright and trustworthy. It distances him from sin and brings him close to merit. He benefits others with counsel and wisdom, understanding and strength, as it says, ‘Mine is counsel and wisdom; I am understanding, strength is mine.’ The Torah gives him kingship, governance and penetrating judgment. The secrets of the Torah are revealed to him. He becomes like an overflowing spring and like an ever-flowing river. He becomes modest, long-suffering and forgiving of insults. The Torah magnifies him and elevates him above all things.” Moreover, when Rabbi Meir said, “For its name (Lishmah-לשמה),” he meant for the “Name” of the Torah, in that it is the Torah of HaShem-יהו"ה, that is, the name of the Holy One, blessed is He, in that the entire Torah is composed of the names and titles of HaShem-יהו"ה, the Holy One, blessed is He.