The novel is set in a futuristic world where molecular nanotechnology is an integrated part of life. It begins with events that led to Nell getting the Young Lady's Illustrated Primer. The idea of creating the primer comes from an engineer John Hackworth and Neo-Victorian Lord Finkle-McGraw. The world in the novel is basically divided into tribal metropolises called "phyles", largest of which are Han, New Atlantis and Nippon.
The first part of the novel also tells about Nell's origins, about her criminal father who got executed and about her brother Harv and how her mother Tequila was left pregnant with her. Nell and Harv are living with their mother in terrible conditions; they are "thete", or poor who don't belong to any tribe. Their mother often brings new men into their lives who are often violent and don't refrain from beating them.
The story is told from two main perspectives, that of Nell and of engineer John Hackworth. Hackworth creates two copies of the primer, one intended for Lord Finkle-McGraw's granddaughter, one for his own daughter Fiona. While trying to deliver the primer to Lord Finkle McGraw into New Chusan, Hackworth gets robbed and the primer is taken from him. The primer ends up in Nell's hand as Harv is the one who was a part of the attack on Hackworth. What primer actually is, is a live-action book that interacts with its owner and their environment teaching and developing the young girls, almost like a parental figure (which will turn to be not far from the truth at the end). Nell uses the primer all the time and there is a story within the story, within the primer to be exact, of Princess Nell and her adventures which are allegorically connected to Nell's own experiences and stories of her toys.
There is another perspective intertwined into the novel, that of a young woman Miranda, who is working as a ractor. Ractor is a person who acts out various plot requests based on clients' wishes. Their acting is transferred onto the machines. Miranda is the true living voice behind the voice of the book that leads Nell through life.
After a terrible experience with one of Tequila's boyfriend Harv and Nell decide to escape, and they end up in Dovetail which is a part of Neo-Victorian territory. Being involved in criminal activities, Harv has to leave, but Nell stays there and begins her Neo-Victorian education.
In the story of Hackworth, he is acquainted with Dr. X, an engineer on the black market, and discovers a tremendous secret that he's been hiding. Dr. X is hiding hundreds of thousands of abandoned infant girls, and he asks of Hackworth to take care of their future by creating primers for each one. Hackworth finds himself conflicted between his political Neo-Victorian duties and what his moral choice is. He ends up choosing the latter and due to conflicting circumstances ends up imprisoned with Drummers for ten years. Drummers are an independent tribe which uses nanotechnology to set themselves up into an unconscious state of mind to be a part of a collective network.
After ten years pass, Nell decides to leave Dovetail to search for her own path. She ends up working in a brothel in Pudong as a programmer and developer of desired plots of clients. Miranda ends up joining the Drummers so that she can locate Nell. There is another perspective, that of Carl Hollywood, who is Miranda's friend and previously boss who continues to tell Miranda's story.
Princess Nell is nearing the end of her quest; she defeated the final king and took the final key. Mouse army, that has been showing itself throughout her journey, approaches her asking her to free them. Princess Nell frees the proud army, and they all bow to her.
There is an uprising of a group called Fists of the Righteous Harmony, who are slowly taking over entire Han. The girls of the brothel, wanting to be taken in by the Fists, tie and trap Nell to give her over to them. Nell manages to escape and ends up on the roof. It is then that she sees her Mouse army, which was freed by Princess Nell. There are thousands of girls approaching the building to take their queen.
The Pudong is slowly being taken over and Queen Nell and her army are on the shoreline tending the wounded. Nell is trying to find her mother, Miranda. She is aware that Miranda is with Drummers who are situated in the underwater structure. Carl Hollywood is there as well, and he tells Nell Miranda's story.
Nell designs underwater equipment for her army who slowly all descend into the water to escape. Finally, all the refugees on the shoreline are gone and Nell and Hollywood enter the Drummer's facility to look for Miranda. They find her in the midst of a deadly ritual and free her. The three of them escape the Drummers and swim towards New Chusan with the help of Mouse Army.