The Doctor (Peter Capaldi) is teleported into a glass chambre in an empty castle in the sea on an unknown planet. He is pursued through the corridors by a cloaked and veiled figure (Jami Reid Quarrell). Cornered, the Doctor admits he is afraid to die. The figure stops and the castle reconfigures itself. The Doctor jumps out the window into the sea and finds the seafloor covered in skulls. He realizes the castle is a torture chambre.

The Veil is slow in reaction time, which allows the Doctor to explore the entire castle, where he finds hints of previous occupants—clothing, skulls, and the word “bird” written in dust. Clues lead him to room 12. He claims knowledge of the Hybrid. In room 12, he finds a wall of azbantium, harder than diamond, which he believes hides the TARDIS. The thinks the word “bird” refers to a Brothers Grimm tale in which a shepherd boy tells the Emperor that a second of eternity is the time it takes a single bird to chip away a diamond mountain with its beak.

The Doctor realizes that the castle was made for him, the skulls are his of various regenerations and, judging by the movement of the stars, he has been there for 7000 years. Encouraged by a vision of the dead Clara, he begins punching the diamond wall. The Veil injures the Doctor. He crawls to the teleportation chambre and burns his body to start the teleport. A copy of himself is inside. He writes “bird” in the dust and disintegrates into a skull. A new Doctor appears.

After some four billion years, the Doctor breaks through the wall. He is on Gallifrey, outside the capitol. The castle was inside his confession dial. He tells a young boy to alert the Time Lords that he knows what they did, and he came for them the long way round. He says the Hybrid prophesied by the Time Lords is his friend “Me.”

The episode was filmed in Cardiff Castle and Caerphilly Castle. The highly unusual story was universally praised as the perfect capper to the season. It was nominated for a Hugo. An entire disc of Murray Gold’s music for this episode was included in the 4-disc album released in 2018. A portrait of Clara was supposed to have been painted by the Doctor. The skulls were patterned after Peter Capaldi’s head, used to create his ghost’s skull in Under the Lake and Before the Flood. The stars move appropriately as the millennia go by.