The following is an amazing excerpt from The Yoga Sutras of Patanjali: Translation and Commentary by Sri Swami Satchidadanda (1978/2012), pp. 88-9.
What is in bold is a translation of a Patanjai sutra; what is unbolded after the bolded statement is Swami Satchidadanda’s illuminating commentary.
* * *
In the active state, they [these obstacles or klesas–AT] can be destroyed by meditation.
The hindering thoughts come in two stages: the potential form, before they come to the surface and get converted to action, and the manifesting ones which are being put into action. It is easier to control manifested things first; then from the more gross, we can slowly get into the more subtle. Thought forms in the potential state (samskaras) cannot be removed by meditation. When you meditate on these impressions, you bring them to the surface. You can’t destroy them by this means, but you can see and understand them well and gain control over whether or not they should manifest in action. You can trace them back into their subtle form and see directly that the ego is the basis of the obstructing thoughts. Then, when you transcend the mind in the higher samadhi, even the ego is lost. When you let go of the ego, all the impressions [samskaras–AT] in it will be lost also. But until that occurs, the impressions will not go away.
It is something like using the herb asafoetida. Asafoetida is a product that aids digestion and helps control gas. In India it is used in curries and kept in a mud pot. But it smells so much that even if you clean the pot hundreds of times, the smell will stay. How can you get rid of the smell? The only way is to break the pot. The ego has the “smell” of your thoughts in a subtle form. But you can only understand the smell and see that the thoughts are there when they are manifest. To get rid of the impressions completely, you have to break the ego. So, first you clean the superficial things, and ultimately you break the pot. By meditation you understand the thought forms and clean them up. Then you have gotten a glimpse of where and how they are, you can slowly trace them to their root and finally cut it [namely, the ego–AT] out. When you want to uproot a tree, you cut the branches first and then dig to the very root. (My italics)