The Apocryphon of John gives the myth in its fullest form, and it is a rewriting of the opening chapters of Genesis in which the reader is asked to notice who is speaking. Above everything is an unknowable one, from whose self-contemplation comes Barbelo, the first thought, and from Barbelo a series of emanations arranged in a structured fullness that includes four luminaries.
The break comes when Sophia, the last of these, acts alone and without consent, and produces something misshapen. Her offspring, Yaldabaoth, does not know what is above him, makes a world with the material available, and declares that he is God and that there is no other. Sethian texts read that declaration as a quotation from the Hebrew scriptures and as evidence of ignorance rather than of divinity, which is the point at which the myth is doing polemic and not only cosmology.
Human beings carry a portion of the light that Sophia lost, put there without the craftsman understanding what he had done, and salvation is the waking of that portion by a revealer who comes down through the levels. Seth, the third son of Adam, is the ancestor of a race that carries the light knowingly, and in several texts is himself the one who descends. The Apocryphon closes with a hymn in which the divine forethought comes into the world three times, and the third time succeeds.