Doctor: David Tennant (Tenth Doctor)
Companion: Catherine Tate (Donna Noble)
Alex Kingston – Professor River Song
Colin Salmon – Dr Moon
Harry Peacock – Proper Dave
Steve Pemberton – Strackman Lux
Jessika Williams – Anita
O. T. Fagbenle – Other Dave
Eve Newton – The Girl
Mark Dexter – Dad
Jason Pitt – Lee
Eloise Rakic-Platt – Ella
Alex Midwood – Joshua
Talulah Riley – Miss Evangelista
Jonathan Reuben – Man
Directed by Euros Lyn
Written by Steven Moffat
Script editor Helen Raynor
Produced by Phil Collinson
Executive producer(s) Russell T Davies
Incidental music composer Murray Gold
Production code 4.10
Series Series 4
Length 2nd of 2-part story, 45 minutes
Originally broadcast 7 June 2008
The Doctor, River Song, Strackman Lux, and the remainder of their team flee the Vashta Nerada, microscopic carnivorous creatures that are thriving in the shadows of a planet-sized Library. Other team members are consumed by the Vashta Nerada, their suits and skeletons animated by the creatures who then chase down the survivors. During a respite, Lux explains that the Library was constructed by his grandfather for Lux's aunt, Charlotte Abigail Lux, who was diagnosed with an incurable disease at a young age. Lux's grandfather had a giant computer (CAL, from Charlotte's initials) constructed at the core of the Library to allow Charlotte's mind to live on among the collected works of humankind. The Doctor realises CAL represents Charlotte's mind, struggling to cope after "saving" the thousands of patrons by transferring their consciousnesses to the computer core when the Vashta Nerada attacked. Even the virus checker program housed in the Library's moon, nicknamed "Doctor Moon", is having difficulties helping CAL maintain control.
Within the simulation, an apparently normal contemporary Earth village, a trapped Donna Noble is tended to by Dr. Moon and introduced to Lee, whom she marries and with whom she raises two children. Aware that time seems to be skipping in the simulation, Donna is alerted to its computerized nature by Miss Evangelista, one of River's team members killed by the Vashta Nerada. Her corrupted consciousness makes her appear deformed, but allows her to see the reality for what it is. Donna returns home questioning her reality, which results in her children disappearing, much to her horror.
The Doctor, River and the others descend to the core. The Doctor attempts to talk with the Vashta Nerada. He learns that their home, forests from a different planet, were used to create the books of the Library. They now claim the Library as their own. The Doctor demands that he be allowed to free the people trapped in the computer core, including Donna, after which the Library will belong to the Vashta Nerada. The creatures agree and permit them one day. The Doctor prepares to hook himself to the computer terminal, aware this will likely kill him. River knocks him out, handcuffs him to a pillar, and takes his place. The Doctor tries to stop her, but River insists that his death now would prevent her meeting him in her own past, and whispers something to him that astounds him. River refuses to tell him who she is before activating the interface, much to the Doctor's anguish. As River initiates the connection, the simulation starts to fall apart. Donna desperately holds onto Lee as the simulation fades to white.
The patrons stored inside the computer rematerialise on the Library surface, and Lux evacuates them to transport ships. Separately, Donna and Lee attempt to find each other but fail to do so, leaving Donna heartbroken. As they prepare to leave the Library forever, the Doctor and Donna leave behind River's diary and sonic screwdriver, but the Doctor still wonders why his future self would give River his screwdriver. Running back to it, he finds a data recorder inside the mechanism which has preserved River's data ghost. He races down to the core and uploads her pattern before it dissipates. River wakes up in the Earth simulation and is greeted by Charlotte and River's team members who had fallen victim to the Vashta Nerada (including Miss Evangelista, who is no longer deformed). Charlotte assures her that the Earth simulation is now a "good place" where she will be safe as the Doctor fixed the data core.
The Doctor then goes back to the TARDIS and snaps his fingers to see if what River had said earlier - that she'd seen a future Doctor "swagger back to his TARDIS and open the doors with a snap of his fingers" - would really work. The TARDIS opens with Donna waiting inside. He snaps his fingers to close it as we see River in the Earth simulation reading her diary to her children.