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 Dr 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 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 the virtual reality, the Doctor Moon manifested as Dr Moon, a human physician charged with checking up on Charlotte's health at frequent intervals. He advised her to save the others in the Library, but 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, saving CAL, River, and the members of River's team killed by the Vashta Nerada. As River and her team reunited, Dr Moon exchanged a smile with CAL. (TV: Forest of the Dead)

Function
In the virtual reality, Dr 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
At the time of production, Moffat privately intended Dr 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 Library'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)