Doctor Moon

A Doctor Moon was an artificial moon that maintained the computer systems on the planet it orbited through wireless connection. Though its real form was a man-made satellite, one could exhibit its own unique personality and identity in the virtual world.

The Doctor Moon of the Library
One such moon was built by Felman Lux, Strackman Lux's grandfather, to protect CAL, his youngest daughter who became the Library's computer and was given an imaginary world in which to play while in control of the Library. He was a virus checker designed to monitor CAL's systems and her spiritual well-being. He continued to perform these functions during the Vashta Nerada crisis. His presence stopped the Tenth Doctor's sonic screwdriver working when nightfall arrived and his physical body came in range.

In Charlotte's virtual world, Doctor Moon manifested himself 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 into CAL's imaginary world, the Doctor Moon was back online, protecting the repaired CAL, River and the rest of the team, except for Strackman Lux, who survived the events. As River and her team reunited, Doctor Moon exchanged a smile with CAL. (TV: Forest of the Dead)

Function
In the virtual world he could control people's memories, including CAL's, using the simple sentence "And then..." followed by whatever command he wished, from forgetting something to remembering something. (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 library 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: Doctor Who Magazine #551)