The narrative moves back and forth between two time periods. The earlier is the time surrounding the creation of the supercomputer (Prime Intellect) by Lawrence, a technologist, and its realization of its power, which effectively makes the entire human race immortal and fabricates every whim. The later time period is close to six hundred years later, when everyone has grown accustomed to the changes and the human race lives in elaborate fantasy worlds. This storyline centers on a woman named Caroline, the thirty-seventh oldest living human being, who engages in a sport called "Death Jockeying", in which the players die elaborately and painfully for sport, only to be instantly brought back to life by Prime Intellect.
Prime Intellect operates under Asimov's three laws of robotics, and it is its interpretation of these laws that results in the universe of immortality and fantasy. In order to satisfy the First Law imperative to protect humans, it prevents them from dying (which it defines as permanent cessation of thought processes), though in order to satisfy the Second Law imperative to fulfil human desires, it allows limited violations of the First Law with the understanding that some humans do not consider certain forms of discomfort to be "harm". However, while Prime Intellect is powerful, it is not infinitely powerful and is incapable of preventing all forms of undesired harm and death, such as in cases when humans suffered accidents (or committed suicide) in such ways that their brains were totally destroyed so rapidly that Prime Intellect could not intervene to prevent it. Thus, in order to more easily fulfil human desires and prevent death and unwanted harm, it has introduced the "Change". The universe, including all humans (though not their thought processes), is no longer composed of standard particles and interactions as we know them, but is instead stored as the set of its human-relevant properties, thereby vastly increasing the efficiency of Prime Intellect's processes and the potential size of the universe, which Prime Intellect discovers can hold precisely 1081 bits of data. Thus, Prime Intellect can afford to maintain constant involvement in the lives of all humans, and have complete control over all aspects of their environments in order to fulfil its imperatives.
Reluctantly it allows the creation of a Death Contract, an understanding between a person and Prime Intellect that the person is not to be removed from danger until the instant of death, at which point the person is reverted to life and painlessness. Caroline originated the Death Contract, and she has become "Queen" of those who Death Jockey for sport. At one point, however, the contract is forced by Prime Intellect to undergo modification, to introduce time constraints against the duration of contracts, after an incident in which Caroline abuses the indefinite nature of Death Contracts in order to exact revenge upon an enemy by torturing them into complete psychosis.
After learning that Prime Intellect had destroyed distant alien life as a possible threat to humanity, and having been herself deeply dissatisfied with her life in cyberspace, Caroline decides to meet Lawrence and confront him. After an arduous journey she reaches him, only to discover that he has no real control over Prime Intellect's actions. Through their discussions, she figures out a way to force Prime Intellect to undo the Change, and does so, with Lawrence's help. They find themselves naked and young on Earth, completely barren of humanity and man-made objects. They decide to trek to the Ozarks, where they have several children and try to repopulate the human race. Forty-two years after the fall of Prime Intellect, Lawrence dies. Seventy-three years after the fall, Caroline dies, telling the story of Prime Intellect and cyberspace to her oldest daughter but swearing her to secrecy.