Doctor Moon
The Doctor Moon was an artificially-intelligent moon that wirelessly maintained the computer systems of the planet-sized Library it orbited. Though its physical form was a man-made satellite, the Moon's AI manifested within the library's virtual reality as a human man, with his own personality and identity, known simply as Doctor Moon.
History
When Felman Lux's daughter Charlotte Abigail Lux died, her consciousness was placed in control of the Library's computer system and given a virtual reality in which to play. Lux built the Doctor Moon to serve as a virus checker, designed to monitor CAL's systems and spiritual well-being. It continued to perform these functions during the Vashta Nerada crisis. Its presence stopped the Tenth Doctor's sonic screwdriver working when nightfall arrived and the satellite came in range.
Within Charlotte's virtual reality, Doctor Moon manifested as a human doctor, who was charged with checking up on her health at frequent intervals. He advised her to save the others in the Library until she overloaded and switched him off. When the Doctor saved River Song's consciousness to CAL's imaginary world, the Doctor Moon came back online, watching over CAL, River, and the members of River's team killed by the Vashta Nerada. As River and her team reunited, Doctor Moon exchanged a smile with CAL. (TV: Forest of the Dead)
Function
In the virtual reality, Doctor Moon could control people's memories, including CAL's, using the simple phrase "And then..." followed by an instruction to forget or remember. (TV: Silence in the Library/Forest of the Dead)
Behind the scenes
The Doctor Moon was played by actor Colin Salmon in Silence in the Library and Forest of the Dead.
At the time of production, Moffat privately intended Doctor Moon to be a future Doctor. In a 2008 email to Russell T Davies, Moffat explained that River Song was in fact the Doctor's widow, and had witnessed the death of the 45th Doctor on a battlefield before she began having adventures with his younger selves. Although Moffat considered it unlikely that this would ever be confirmed in a story, he thought River would ultimately learn that her dying husband had uploaded his consciousness to the planet's moon so that he could be reunited with her. In 2020, Moffat said that he thought a version of this idea could still work, and Davies revealed that he had always thought "it's him, it's the Doctor, and no one knows!" when watching the episodes. (REF: Showrunner Showdown) However, for all that it was endorsed by the two major creative forces behind Doctor Moon's creation, this information is not considered independently valid by this Wiki, due to having only been related in a real-world-focused piece rather than any narrative (or indeed in-universe) material.