The '7 stages of purification' (satta-visuddhi) form the substructure of Upatissa's Vimutti-Magga (The Path To Freedom), preserved only in Chinese, as well as of Buddhaghosa's monumental work, Visuddhi-Magga (The Path of Purification), based on the former work.
The only place in the Canon where these 7 kinds of purification are mentioned is M.24, "The Simile of the Stage-coach" (s. 'Path', §64), wherein their purpose and goal are illustrated. There it is said that the real and ultimate goal does not consist in purification of morality, or of mind, or of view, etc., but in total deliverance and extinction. Now, just as one mounts the first coach and travels to the second coach, then mounts the second coach and travels with it to the third coach, etc., in exactly the same way the goal of
(I) "Purification of morality (sīla-visuddhi) consists of the 4-fold purity of morality (catu-pārisuddhi-sīla), namely: restraint with regard to the Disciplinary Code (pātimokkhasamvara-sīla), sense-restraint (indriysamvara-sīla), purity of livelihood (ājīvapārisuddhi-sīla), morality with regard to the 4 requisites (paccaya-sannissita-sīla)" (Vis.M. XVIII). On these 4 terms, s. sīla. - In the case of a layman, it entails the observance of whatever moral rules (5 or more) he has taken upon himself.
(II) "Purification of mind (citta-visuddhi) is a name for the 8 attainments (= absorptions: jhāna, q.v.), as well as for neighbourhood-concentration (upacāra-samādhi; s. samādhi)." (ib.).
(III) "By purification of view (ditthi-visuddhi) is meant the understanding, according to reality, of mind and corporeality (nāmarūpa, q.v.)... which is founded on undeludedness (wisdom) as base, and which in manifold ways determines mind and corporeality after overcoming all belief in a persollality (attā: self, ego.)." (ib.).
(IV) "By purification by overcoming doubt (kankhā-vitarana-visuddhi) is meant the understanding which, by grasping the conditions of this mind and corporeality, has escaped from all doubt with regard to the 3 times (past, present, future)." (ib. XIX)
(V) "By purification by knowledge and vision of what is path and not-path (maggāmagga-ñānadassana-visuddhi) is meant that understanding which knows the right path from the wrong path: 'This is the right path, that the wrong path.' " (ib. XX)
In order to attain this 5th stage of purification, one at first should develop methodical insight (naya-vipassanā), i.e. through contemplation of the 5 groups of existence (khandha, q.v.). For whosoever does not yet possess a perfectly developed insight, to him such phenomena as effulgence of light, etc. (see below), arising during insight, may become impediments in the 3 kinds of full understanding here considered (s. pariññā).
'As soon as the manifold ways and characteristics of the 4 Truths (sacca) and the dependent origination (paticcasamuppāda) have become clear to the meditating disciple, he says to himself: Thus do these things never before arisen arise, and having arisen they disappear again. Thus do the formations of existence ever and again arise as something quite new. But not only are they something new, they are moreover also of limited duration, like a dew-drop at sunrise, like a bubble, like a line drawn with a stick in the water, like a mustard seed placed on the point of an arrow, or like a flash of lightning. Also as something unsubstantial and empty do they appear, as jugglery, as a mirage .... Merely something subject to vanishing arises, and having arisen disappears again.' "
During such insight practice, however, may arise the 10 imperfections (or defilements) of insight (vipassanūpakkilesa): effulgence of light (obhāsa), knowledge (ñāna), rapture (pīti), tranquillity (passaddhi), happiness (sukha), determination (adhimokkha), energy (paggaha), awareness (upatthāna), delight (nikanti). - See Vis.M. XX, 105f. (App.).
Excepting the last one, 'delight', they are not imperfections or defilements in themselves, but may become a basis for them through the arising of pride or delight or by a wrong conclusion that one of the holy paths has been attained. He, however, who is watchful and experienced in insight practice, will know that these states of mind do not indicate attainment of the true path, but are only symptoms or concomitants of insight meditation.
"Thus far the meditating disciple has determined 3 of the truths, namely while determining the corporeal and mental phenomena he has, through purification of view (ditthi-visuddhi), determined the 'truth of suffering'. While grasping the conditions he has, through purification by overcoming doubt (kankhā-vitarana-visuddhi), determined the 'truth of the origin of suffering'. While determining the right path, he has, through purification by knowledge and vision of what is path and not-path (maggāmagga-ñānadassana-visuddhi), determined the 'truth of the path' (leading to the extinction of suffering)."
(VI) Purification by knowledge and vision of the path-progress (patipadā-ñānadassana-visuddhi) is the insight perfected in 8 kinds of knowledge, together with the 9th knowledge, the 'knowledge adapting itself to truth'.
By the 8 kinds of knowledge are here meant the following, which are freed from defilements, follow the right process, and are considered as insight, namely:
(1) consists in the meditative observation of the 3 characteristics of existence (impermanence, suffering, no self) in one's own bodily and mental processes. As long as the mind is still disturbed by the 10 imperfections (s. V), the 3 characteristics will not become fully clear in their true nature. Only when the mind is free from these imperfections can the characteristics be observed clearly.
(2) When through such repeated practice, knowledge and mindfulness have grown keen and the bodily and mental formations become apparent quickly, at that stage the phase of dissolution of these formations will become prominent.
"Consciousness with (e.g.) materiality as its object arises and dissolves. Having reflected on that object, he contemplates the dissolution of (reflecting) consciousness." (Pts.M. I, 57, quoted in Vis.M. XXI, 11).
The 8 blessings of this knowledge are: abandoning the belief in eternal existence (bhava-ditthi), giving up attachment to life, constant right application (of mind to meditative endeavour), a purified livelihood, overcoming of anxiety, absence of fear, acquisition of forbearance and gentleness, conquest of discontent and sensual delight (Vis.M. XXI, 28).
(3) Knowledge consisting in awareness of terror (or fearfulness) is the seeing of terror in the conditions as well as the continuity of existence. For whoso considers the formations as impermanent, to him the conditions of existence (i.e. the karma-formations producing ever new existence) appear as terror, as driving towards death. Whoso considers the formations as misery, to him the continuity of existence appears as terror, as something oppressive. Whoso considers the formations as impersonal, to him the karmaformations, as well as the continuity of existence, appear as terror, as an empty village, as a mirage, etc.
(4) Contemplation of misery (or danger) is another aspect of the awareness of terror: "The origin (of existence) is terror ... continuance of existence is terror ... arising is suffering', such understanding in the awareness of terror is the knowledge of misery. 'Non-arising is bliss', this is knowledge of the peaceful state (Pts.M. I, 59); that is, the no-more-arising is safety, is happiness, is Nibbāna.
(5) Contemplation of aversion means: aversion for all formations as terror, therefore its name 'awareness of terror' has come into use. Because it has made known the misery of all these formations, therefore it has received the name of 'contemplation of misery' (ādīnavānupassanā). Because it has arisen through aversion for those formations, therefore it is known as 'contemplation of aversion' (nibbidānupassanā).
(6) Knowledge consisting in the desire for deliverance means: the desire for freedom and escape from all formations of existence.. For feeling aversion for all formations, becoming weary of them, finding no more delight in them, the mind does not cling to a single one of all these formations.
(7) Reflecting contemplation is the repeated meditative discernment of the formations of existence, attributing to them the 3 characteristics of existence, with the desire to find deliverance from all forms of existence.
(8) Equanimity regarding all formations: "When the meditator (through reflecting contemplation) has discerned the formations by applying the 3 characteristics to them and sees them as void, he abandons both terror and delight, and becomes indifferent and equanimous with regard to all formations; he neither takes them as I nor as 'mine'; he is like a man who has divorced his wife" (Vis.M. XXI, 61).
Now, while continuing to contemplate the 3 characteristics of existence and perceiving the tranquil lot of Nibbāna as the peace, this equanimity-knowledge becomes the triple gateway to liberation. As it is said (Pts.M. II, p. 48):
"Three gateways to liberation (vimokkha-mukha; s. vimokkha I) lead to escape from the world, namely: that the mind is contemplating all formations as limited, and is rushing forward to the condition less element (animitta-dhātu); that the mind is stirred with regard to all formations of existence, and is rushing forward to the desire less element (appanihita-dhātu); that the mind sees all things as something foreign, and is rushing forward to the void element (suññatā-dhātu)."
At this stage, and through the triple gateway, the diversification of path attainment takes place, according to the 7 kinds of noble persons (ariya-puggala, q.v.); on this see Vis.M. XXI, 74ff.
The 6th, 7th and 8th knowledge, according to Vis.M. XXI, form really only one single knowledge in its first, middle and final stages of development. This knowledge is also known as the 'insight leading to path ascent' (vutthāna-gāminī-vipassanā, q.v.).
(9) Adaptation to truth (or conformity with truth) is called that knowledge which, while contemplating impermanency, etc. adapts itself to the preceding 8 kinds of insight-knowledge, as well as to the immediately following supermundane path and to the 37 elements pertaining to enlightenment (bodhipakkhiya-dhamma, q.v.). It is identical with adaptation-knowledge (anulomañāna).
"Whosoever has cultivated, developed, and frequently practised 'equanimity regarding all formations' in him arises very strong faith known as determination (adhimokkha-saddhā) and his energy is better exerted, his mindfulness better established, his mind better concentrated, and a still stronger 'equanimity regarding the formations' arises. 'Now the path will reveal itself', thus thinking, the meditator contemplates with his equanimity-knowledge all formations as impermanent, etc., and thereafter that knowledge sinks into the subconscious stream of existence (s. bhavanga-sotā). Immediately afterwards there arises advertence at the mind-door (s. viññāna-kicca). And just like equanimity-knowledge, the adaptation-knowledge, too, takes as its object the formations, regarding them as something impermanent, miserable and impersonal. Thereupon, while continuing the uninterrupted continuity of consciousness (citta-santati), there arises the 1st impulsive moment (javana, q.v.), called 'preparation' (parikamma), taking the same formations as object. Immediately thereafter, with the same formations as object, there arises the 2nd impulsive moment, known as 'access' (upacāra). And again immediately after that, there arises the impulsive moment called 'adaptation' (anuloma)."
(VII) Purification of knowledge and vision (ñānadassana-visuddhi) is the knowledge associated with any of the 4 kinds of supermundane path-consciousness (s. ariyapuggala).
"Immediately upon this adaptation-knowledge there arises the 'maturity-knowlege' (gotrabhū-ñāna; s. gotrabhū) taking as object the Unconditioned, the standstill of existence, the absence of becoming, cessation, Nibbāna, while at the same time transcending the rank (gotta = gotra: lineage), designation and plane of the worldling (puthujjana, q.v.), and entering the rank, designation and plane of the Noble Ones (ariya), being the first turning towards Nibbāna as object, the first thinking of it, the first concentration on it, and the condition for the path ... forming the culmination of insight, and never as such coming back again.
''As the immediate continuation following upon that maturity knowledge (gotrabhū-ñāna), there arises the first path-consciousness (Stream-entrance) forever destroying the first 3 of the 10 fetters of existence (samyojana, q.v.), and closing the entrance to the lower worlds. Immediately after this path-knowledge, there arise, as its result, 2 or 3 path-produced states of consciousness, the fruitional consciousness (phala-citta). Immediately after the sinking of this consciousness into the subconscious stream of existence, the retrospective knowledge (paccavekkhana-ñāna, q.v.) arises, having the path-consciousness as its object" (Vis.M. XXI). For the 3 higher paths, s. ariya-puggala.
Each of the 4 kinds of path-consciousness performs at the one and the same time 4 functions, namely: the function of full understanding (pariññā, q.v.) of suffering, the function of overcoming (pahāna, q.v.) the origin of suffering, the function of realizing (sacchikiriyā) the extinction of suffering, the function of developing (bhāvanā, q.v.) the supermundane Noble Eightfold Path (magga, q.v.).
See Path of Purification, by Buddhaghosa, tr. by Ñyanamoli (BPS); Path of Freedom, by Upatissa (BPS).