The Mysticism or irfan that Imam Ali and the Household of the prophet present does not contradict Islam or the Quran, it is rather the true essence of Islam and the core of Islamic law. From this viewpoint, true mysticism will address all dimensions of life; external, internal, social and individual. Based on such an interpretation of Mysticism, being able to put a difference between sayings of Imam Ali (as) related to mysticism and other sayings both in the Nahjul-Balaghah and other books proves to be very difficult. This is while the imam mentions mystical things in all situations, the reason being that all inner and outer problems of people stem from the fact that they do not truly have irfan (knowledge and understanding) towards Allah, and true Mysticism is the only way out of such difficulties for humankind.
As the imam of the mystics, Imam Ali (as) has had the most effect and influence on Islamic Mysticism throughout history. Even the greatest Muslim mystics have seen him as the Qotb of all mystics, and this influence goes back to even when the Nahjul-Balaghah hadn’t been compiled yet.
The Nahjul-Balaghah has always remained a rich source that consists of innumerous theoretical and practical mystical teachings that many scholars have given serious attention to. Due to the fact that all parts of Nahjul-Balaghah contain teachings about putting aside desire and love for this world, by just reading this valuable book one's Taqwa will increase towards Allah and this itself is a vital element for one who wants to start the path of mysticism and self-purification.
In order to explain the answer to this question in an organized manner we will explain in three different categories:
1- The Mysticism of the Household of the Prophet
Briefly, one can say that the Mysticism of the Ahlul-Bayt is the core of Islam and its law that circles around the character of the imams, with imamate essentially being the complete individual which is the manifestation of divine names and qualities. The Mysticism of the Ahlul-Bayt covers all aspects of human life and is the straight path of the spiritual journey of man which culminates in the vicegerency of Allah in this world.
In order to tell apart the Mysticism the Ahlul-Bayt speak of from the false Mysticisms, all we need to know is what the imams’ mysticism is not. The irfan or mysticism of the imams is one based on love and understanding. In this school of thought, metaphysical and extraordinary things happen, but they are never the ultimate objective. Thus the imams were always against false mysticisms that existed even in their time and gave them no value whatsoever.
The union of Shariah, Tarighah (the path) and Hagighah (the truth) is another fundamental principle of Shia Mysticism, meaning that Mysticism is nothing but the core and perfection of the Shariah (Islamic law). In this mysticism, laws and worship take on more richness and depth and their true essence becomes manifest, not that the Shariah is put aside and loses all value for petty excuses.
Another element that makes Islamic Mysticism significant is that those who follow the Mysticism of the Ahlul-Bayt try hard and strive to help the community move towards Allah. They also feel extremely responsible about what takes places in the society. The highest level of this Mysticism is the status of "Shahadah", and one who follows true Mysticism that comes from the imams is a living "Shahid" (Martyr).
A comprehensive discussion on true Islamic mysticism is beyond the scope of this article, all that can be said is an introduction to it so that those interested know what to do and where to go. Many great Mystics throughout the history of Islam have engaged in these discussions. Also, regarding practical Mysticism one needs to be in touch with an individual who has mastered the Mysticism the imams promoted in practice and can lead those who seek Mysticism to the right path.
2- Mystics and Imam Ali (as)
Despite the fact that Nahjul-Balghah has always been a great source of knowledge regarding Mysticism, but we should know that the immense effect Imam Ali has had on Mystics comes mostly from his own personality and mystical character. Moreover there are a large amount of teachings of Mysticism we have inherited from the Imam that do not exist in the Nahjul-Balaghah.
For example Imam Ali's answer to Komeil when asked about ‘the truth’ is astonishing. But because it is not considered one of the Imam's Sermons it cannot be found in Nahjul-Balaghah. There are many other examples like Dua Komeil and the Imam's prayers and supplications to Allah that have not made their way into the Nahjul-Balaghah.
Therefore, it is necessary to remember that the Nahjul-Balaghah consists of those of the Imam's Sermons that are mostly related to warning people that could barely tolerate the justice of the Imam, let alone seeing him as a great mystic and spiritual mentor. Although on certain occasions the Imam has explained his mystical status so that the people would have no excuse about not understanding the greatness of his personality, these sayings have seldom been recorded or gathered over the centuries due to Taqiyyah or potential opposition. Even those who rarely did so were accused of being Ghalis (exaggerating about the status of the Imam). Therefore when speaking about the mystical teachings of Imam Ali we must also pay attention to the course the history of Islam has taken throughout the centuries and how such thoughts were extremely criticized and opposed amongst Muslims.
When examining the lives of the Imams we find that all of them have had "Ashabe Sirr" (companions whom they would tell their secrets to). They would teach them things that have played great roles in the formation of mysticism. Almost all chains of mystics eventually trace back to one of these companions of the imams.
Therefore even though the Nahjul-Balaghah has always remained a rich source that consists of various theoretical and practical mystical teachings and scholars have scrutinized it to unveil the valuable truths it contains, but the Imam has had an impact on the mystics even before its compilation, not to mention that after its compilation, the imam’s influences on mysticism aren't limited to what is in this book. For example Ibne Arabi is one of the mystics that was impressed by the Imam and his Mysticism, to the extent that he believed the Imam to be the soul and core of all prophets. As the Imam himself says: "معرفتی بالنورانیة معرفة الله عزوجل و معرفة الله عزوجل معرفتی بالنورانیة و هو الدین الخالص" in a hadith considered very important in Islamic mysticism.
Jalaluddin Rumi (Mowlavi), the famous Muslim Mystic, believed that Shamse Tabrizi was the manifestation of Imam Ali for him, and that it was by the will of the Imam that he had met Shamse Tabrizi. He has mentioned this belief in different poems of his. 
Attar has also quoted a sermon of Imam Ali (as) from Ibn Abbas that speaks of similar issues regarding the imam.
In most of his works and especially in "Mathharol Aja’ib", the book which he claims to have written by the imam’s command, Attar, the famous Iranian poet and mystic, explains deep Mystical teachings that are considered the inner and core issues of Imamate.
The mystics’ understanding and familiarity with Ali (as), and the impact he has had on them is beyond books and hadiths, and naming these three Islamic Mystics was only to give a few examples, otherwise there are so many other Mystics that have either directly or indirectly stated that they viewed the Imam the same way Attar, Jalaluddin Rumi and Ibn Arabi did.
Certainly the Imam never had the chance to expose this knowledge and the people of his time did not seek these teachings, in fact as was said before, they couldn’t even tolerate his justice, but the presence of this magnanimous soul has always had its affect throughout the ages and all mystics, in some way associate themselves with him and his teachings.
3- Mysticism and the Nahjul-Balaghah
Many mystical sayings have been narrated from the imam and only a portion of them have been gathered in the Nahjul-Balaghah. Of course we must keep in mind that putting a difference between mystical teachings and other teachings of the imams is wrong, because the Mysticism they promote results in the unity of Shariah, Tarighah (the path) and Haghighah (the truth) and covers all three aspects [in contrast to other forms of mysticism that put a difference and separate all these dimensions]. In any event, the sayings of the infallibles can be classified into different categories, their mystical sayings and teachings being very special and of a profound status.
The Nahjul-Balaghah is full of teachings that call people to put away love and desire for this world. Just reading this valuable book can help increase one’s Taqwa towards Allah and this itself is a vital requirement for one who looks to start the journey of Mysticism. But other than that the Imam has explained very deep mystical teachings in the Nahjul-Balaghah which relate to Tohid, Knowledge of the Hereafter, the Day of Resurrection, etc. One of the most notable hadiths in this regard is the first Sermon of the Nahjul-Balaghah which is viewed as the greatest hadith of "Mystical Tohid" (The oneness of Allah from Mysticism's point of view).
To find out more about Imam Ali's sayings regarding practical and theoretical Mysticism you can refer to Question 6709 (website: 6913) Practical and Theoretical Mysticism in the Nahjul-Balaghah.
 Motahhari, Morteza, Ashnayi ba Ulume Eslami, the chapter on mysticism.
 Sharh Fususul-Hekam, Muhammad Dawud Qeysari Rumi, pg. 54.
 “إنه لا یستکمل أحد الایمان حتى یعرفنی کنه معرفتی بالنورانیة فاذا عرفنی بهذه المعرفة فقد امتحن الله قلبه للایمان وشرح صدره للاسلام وصار عارفا مستبصرا ، ومن قصر عن معرفة ذلک فهو شاک ومرتاب .... معرفتی بالنورانیة معرفة الله عزوجل ومعرفة الله عزوجل معرفتی بالنورانیة وهو الدین الخالص” Biharul-Anwar, vol.26, pg. 1.
 The book of Shamse Tabrizi, pg. 1188.
 Qomshe’I, Mohammad Reza, Resale’i darbareye Velayat, under فص شیثی
 Attar Neyshabouri, Si Fasl, pg. 22.