This is Neil Stephenson's The Diamond Age.
The protagonist in the story is Nell, a thete (or person without a tribe; equivalent to the lowest working class) living in the Leased Territories, a lowland slum built on the artificial, diamondoid island of New Chusan, located offshore from the mouth of the Yangtze River, northwest of Shanghai. At the age of four, Nell receives a stolen copy of an interactive book, Young Lady's Illustrated Primer: a Propædeutic Enchiridion, in which is told the tale of Princess Nell and her various friends, kin, associates, &c., originally intended for the wealthy Neo-Victorian "Equity Lord" Alexander Chung-Sik Finkle-McGraw's granddaughter. The story follows Nell's development under the tutelage of the Primer, and to a lesser degree, the lives of Elizabeth and Fiona, girls who receive similar books. The Primer is intended to steer its reader intellectually toward a more interesting life, as defined by "Equity Lord" Alexander Chung-Sik Finkle-McGraw, and growing up to be an effective member of society. The most important quality to achieving an "interesting life" is deemed to be a subversive attitude towards the status quo. The Primer is designed to react to its owner's environment and teach them what they need to know to survive and develop.
The Diamond Age is characterized by two intersecting, almost equally-developed story lines: Nell's education through her independent work with the Primer, and the social downfall of engineer and designer of the Primer, John Percival Hackworth, who has made two illegal copies of the Primer for his own young daughter, Fiona. (One copy is stolen by Nell's brother.) His crime becomes known both to Lord Finkle-McGraw and to Dr. X, the black market engineer whose compiler Hackworth used to create the copy of the Primer, and each man attempts to exploit Hackworth to advance the opposing goals of their tribes. A third storyline follows an actress, Miranda, who plays the voice of Nell's Primer and has almost become Nell's surrogate mother, in her attempts to find Nell. Later Miranda's storyline is taken over by Miranda's associate Carl Hollywood after Miranda disappears.
Part of Hackworth's punishment was having to infiltrate the Drummers, who are indeed an underwater cult that employs a hivemind.