The Mahavihara chronicle tradition tells that Buddhaghosa came from India to Sri Lanka in the fifth century CE seeking the old Sinhala commentaries on the canon, preserved at the Great Monastery in Anuradhapura and no longer available on the mainland. Before entrusting him with them, the story goes, the elders set him a test: to demonstrate his competence by composing a treatise on a single verse.
The Visuddhimagga was the answer, and legend improves the tale, relating that deities twice hid his finished manuscript so that he wrote the whole work three times, and that the three copies, compared, did not differ by a syllable. Test passed, he was given the commentaries, and the body of Pali exegesis attributed to him, on the Vinaya, the four Nikayas and the Abhidhamma, cross-references the Visuddhimagga constantly, using it as the shared doctrinal core so that each commentary would not repeat the whole system. Scholarship treats the attribution of some of those commentaries as a workshop's rather than one man's, but the Visuddhimagga itself is securely his, and its debt to an older manual tradition is visible in its relation to the earlier Vimuttimagga, a similar path-treatise surviving in Chinese translation. In the Theravada world its authority became second only to the canon: monastic curricula, meditation lineages and doctrinal examinations in Sri Lanka and Southeast Asia have been built on it for fifteen centuries.