The Collect for Purity is the name traditionally given to the collect prayed near the beginning of the Eucharist in most Anglican rites. Its oldest known sources are Continental, where it appears in Latin in the 10th century Sacramentarium Fuldense Saeculi X.

Though it appeared in The Cloud of Unknowing in English, Thomas Cranmer is credited as translating the prayer into English and from there it has entered almost every Anglican prayer book in the world.

Saint Philip Neri was also known to have prayed this during the Mass in Latin, whenever it was possible according to the rubrics.

Versions
The original Latin prayer may be found in Continental sources in the 10th century Sacramentarium Fuldense Saeculi X where it appears as the proper Collect for a Votive Mass of the Holy Spirit Ad Postulandum Spiritus Sancti Gratiam. It also appears as an alternate Collect for Votive Masses of the Holy Spirit in the Missale Romanum Mediolani, 1474.In England, the 11th century Leofric missal  and the later Sarum Rite include the Latin prayer as one of those said before Mass.

A version appears as the introduction to the 14th-century anonymous contemplative treatise, The Cloud of Unknowing:Cranmer's translation first appeared in the First Prayer Book of Edward VI (1549), and carried over unchanged (aside from modernisation of spelling) in the Second Prayer Book of Edward VI (1552) and The Book of Common Prayer (1559 and 1662), and thence to all Anglican prayer books based on The Book of Common Prayer, including John Wesley's recension for the Methodists in North America.  This translation is still used in many Anglican churches:Almighty God, unto whom all hearts be open, all desires known, and from whom no secretes are hid: cleanse the thoughts of our hearts by the inspiration of thy Holy Spirit, that we may perfectly love thee, and worthily magnify thy holy name: through Christ our Lord. Amen.The Latin prayer can be found as a preparatory prayer in a 1577 edition of the Tridentine Missale Romanum.

In the 1970s, the Liturgy of St Tikhon was produced for use by Episcopalians who wished to convert to Orthodoxy but retain the liturgy to which they were accustomed. It contains the version which appears in the 1892, 1928, and 1979 (Rite I) editions of the American Book of Common Prayer:Almighty God, unto whom all hearts are open, all desires known, and from whom no secrets are hid; cleanse the thoughts of our hearts by the inspiration of thy Holy Ghost, that we may perfectly love thee, and worthily magnify thy Holy Name; through Christ our Lord. Amen.The 1979 Book of Common Prayer published by The Episcopal Church includes a version in Rite Two with modern wording:

"Almighty God, to you all hearts are open, all desires known, and from you no secrets are hid: Cleanse the thoughts of our hearts by the inspiration of your Holy Spirit, that we may perfectly love you, and worthily magnify your holy Name; through Christ our Lord. Amen."

The 1978 Lutheran Book of Worship and the 1980 Alternative Service Book published by the Church of England contain the following version in contemporary English:

"Almighty God, to whom all hearts are open, all desires known, and from whom no secrets are hidden: cleanse the thoughts of our hearts by the inspiration of your Holy Spirit, that we may perfectly love you, and worthily magnify your holy name; through Christ our Lord. Amen."

The 1989 United Methodist Hymnal contains the following version, which varies only slightly from that contained in the 1979 Book of Common Prayer:

"Almighty God, to you all hearts are open, all desires known, and from you no secrets are hidden. Cleanse the thoughts of our hearts by the inspiration of your Holy Spirit, that we may perfectly love you, and worthily magnify your holy name, through Christ our Lord. Amen."

The 2015 Divine Worship Missal published by the Roman Catholic Church for the Personal Ordinariates of former Anglicans contains the following version, which follows Cranmer's translation:Almighty God, unto whom all hearts be open, all desires known, and from whom no secrets are hid: cleanse the thoughts of our hearts by the inspiration of thy Holy Spirit, that we may perfectly love thee, and worthily magnify thy holy Name; through Christ our Lord. Amen.''

References

Anglican liturgy