The Nag Hammadi library (also known as the "Chenoboskion Manuscripts" and the "Gnostic Gospels"[a]) is a collection of early Christian and Gnostic texts discovered near the Upper Egyptian town of Nag Hammadi in 1945.
Thirteen leather-bound papyrus codices buried in a sealed jar were found by a local farmer named Muhammed al-Samman. The writings in these codices comprise 52 mostly Gnostic treatises, but they also include three works belonging to the Corpus Hermeticum and a partial translation/alteration of Plato's Republic. In his introduction to The Nag Hammadi Library in English, James Robinson suggests that these codices may have belonged to a nearby Pachomian monastery and were buried after Saint Athanasius condemned the use of non-canonical books in his Festal Letter of 367 A.D. The discovery of these texts significantly influenced modern scholarship's pursuit and knowledge of early Christianity and Gnosticism.
The contents of the codices were written in the Coptic language. The best-known of these works is probably the Gospel of Thomas, of which the Nag Hammadi codices contain the only complete text. After the discovery, scholars recognized that fragments of these sayings attributed to Jesus appeared in manuscripts discovered at Oxyrhynchus in 1898 (P. Oxy. 1), and matching quotations were recognized in other early Christian sources. The written text of the Gospel of Thomas is dated to the second century by most interpreters, but based on much earlier sources. The buried manuscripts date from the 3rd and 4th centuries.
Scholars first became aware of the Nag Hammadi library in 1946. Making careful inquiries from 1947-1950, Jean Doresse discovered that a peasant dug up the texts from a graveyard in the desert, located near tombs from the Sixth Dynasty of Egypt. In the 1970s, James Robinson sought out the peasant in question, identifying him as Muhammad 'Ali al-Samman. Al-Samman told Robinson a complex story involving a blood feud, cannibalism, digging for fresh soil for agricultural use, and superstitions about a jinn. His mother claimed that she burned some of the manuscripts; Robinson identified these with Codex XII. Robinson gave multiple accounts of this interview, with the number of people present at the discovery ranging from two to eight.  Jean Doresse's account contains none of these elements.
Later scholarship has drawn attention to al-Samman's mention of a corpse and a "bed of charcoal" at the site, aspects of the story that were vehemently denied by al-Samman's brother. It is suggested that the library was initially a simple grave robbing and the more fanciful aspects of the story were concocted as a cover story. Burials of books were common in Egypt in the early centuries AD, but if the library was a funerary deposit it conflicts with Robinson's belief that the manuscripts were purposely hidden out of fear of persecution. The blood feud, however, is well attested by multiple sources.
Slowly, most of the tracts came into the hands of Phokion J. Tanos, a Cypriot antiques dealer in Cairo, thereafter being retained by the Department of Antiquities, for fear that they would be sold out of the country. After the revolution in 1952, these texts were handed to the Coptic Museum in Cairo, and declared national property. Pahor Labib, the director of the Coptic Museum at that time, was keen to keep these manuscripts in their country of origin.
Meanwhile, a single codex had been sold in Cairo to a Belgian antiques dealer. After an attempt was made to sell the codex in both New York City and Paris, it was acquired by the Carl Gustav Jung Institute in Zurich in 1951, through the mediation of Gilles Quispel. It was intended as a birthday present to the famous psychologist; for this reason, this codex is typically known as the Jung Codex, being Codex I in the collection. Jung's death in 1961 resulted in a quarrel over the ownership of the Jung Codex; the pages were not given to the Coptic Museum in Cairo until 1975, after a first edition of the text had been published. The papyri were finally brought together in Cairo: of the 1945 find, eleven complete books and fragments of two others, 'amounting to well over 1000 written pages', are preserved there.
The first edition of a text found at Nag Hammadi was from the Jung Codex, a partial translation of which appeared in Cairo in 1956, and a single extensive facsimile edition was planned. Due to the difficult political circumstances in Egypt, individual tracts followed from the Cairo and Zurich collections only slowly.
This state of affairs did not change until 1966, with the holding of the Messina Congress in Italy. At this conference, intended to allow scholars to arrive at a group consensus concerning the definition of Gnosticism, James M. Robinson, an expert on religion, assembled a group of editors and translators whose express task was to publish a bilingual edition of the Nag Hammadi codices in English, in collaboration with the Institute for Antiquity and Christianity at the Claremont Graduate University in Claremont, California.
Robinson was elected secretary of the International Committee for the Nag Hammadi Codices, which had been formed in 1970 by UNESCO and the Egyptian Ministry of Culture; it was in this capacity that he oversaw the project. A facsimile edition in twelve volumes was published between 1972 and 1977, with subsequent additions in 1979 and 1984 from the publisher E.J. Brill in Leiden, entitled, The Facsimile Edition of the Nag Hammadi Codices. This made all the texts available for all interested parties to study in some form.
At the same time, in the German Democratic Republic, a group of scholars--including Alexander Böhlig, Martin Krause and New Testament scholars Gesine Schenke, Hans-Martin Schenke and Hans-Gebhard Bethge--were preparing the first German language translation of the find. The last three scholars prepared a complete scholarly translation under the auspices of the Berlin Humboldt University, which was published in 2001.
The James M. Robinson translation was first published in 1977, with the name The Nag Hammadi Library in English, in collaboration between E.J. Brill and Harper & Row. The single-volume publication, according to Robinson, 'marked the end of one stage of Nag Hammadi scholarship and the beginning of another' (from the Preface to the third revised edition). Paperback editions followed in 1981 and 1984, from E.J. Brill and Harper, respectively. A third, completely revised, edition was published in 1988. This marks the final stage in the gradual dispersal of gnostic texts into the wider public arena--the full complement of codices was finally available in unadulterated form to people around the world, in a variety of languages. A cross-reference apparatus for Robinson's translation and the Biblical canon also exists.
Another English edition was published in 1987, by Yale scholar Bentley Layton, called The Gnostic Scriptures: A New Translation with Annotations (Garden City: Doubleday & Co., 1987). The volume included new translations from the Nag Hammadi Library, together with extracts from the heresiological writers, and other gnostic material. It remains, along with The Nag Hammadi Library in English, one of the more accessible volumes of translations of the Nag Hammadi find. It includes extensive historical introductions to individual gnostic groups, notes on translation, annotations to the text, and the organization of tracts into clearly defined movements.
Not all scholars agree that the entire library should be considered Gnostic. Paterson Brown has argued that the three Nag Hammadi Gospels of Thomas, Philip and Truth cannot be so labeled, since each, in his opinion, may explicitly affirm the basic reality and sanctity of incarnate life, which Gnosticism by definition considers illusory.
See #External links for complete list of manuscripts.
The so-called "Codex XIII" is not a codex, but rather the text of Trimorphic Protennoia, written on "eight leaves removed from a thirteenth book in late antiquity and tucked inside the front cover of the sixth." (Robinson, NHLE, p. 10) Only a few lines from the beginning of Origin of the World are discernible on the bottom of the eighth leaf.
Although the manuscripts discovered at Nag Hammadi are generally dated to the 4th century, there is some debate regarding the original composition of the texts.