Time to take the fight back to those who have accused the Doctor of horrible war crimes! The TARDIS team needs to break into a remote prison to get the tech that will allow them to pull off an incredible heist... Sounds like they'll need some expert help!
The Doctor enter the Stormcage Containment Facility to ask River Song for help. He needs her diary to find out if he is guilty of the war crimes he is charged of and if the Squire has been or not his companion. River Song knew about Alice Obiefune but she doesn't believe the Squire had been a companion of the Doctor. She agrees to lend her diary, despite the risk the Doctor could read "spoilers" about his own future; eventually, he decides not to risk and employs River Song for her escaping and piloting abilities.
They travel the TARDIS to a place forgotten by the Time Lords for their own decision and their aim seems to be the Master's TARDIS; the Doctor knows he has been there but can't remember any detail. They are followed by the Then and the Now, which attacks the TARDIS from the outside; under the Doctor's suggestion, River Song pulls the brakes and the enemy is thrown on the quantum wall that contains the hidden place, breaking it. Beyond the breach they land on a planet where the Then and Now is attacked by security robots. The Doctors remembers they are on Shada, the forgotten prison planet of the Time Lords.
Within the story, it is said that the Doctor had previously wiped the discovery of Shada from his own memory, not even being sure of the prison's name. This is likely a reference to the fact that TV: Shada was never completed or aired in its entirety.