The Veil

The Veil was a clockwork construct within the castle inside the Twelfth Doctor's confession dial. It took the form of an old woman who died when he was "a very little boy"; she was covered in white veils, but it was a hot summer day and her body attracted flies, which gave the Doctor nightmares for years.

The Veil pursued the Doctor at exactly the same, slow pace, never relenting. Monitors located throughout the castle showed its viewpoint, letting the Doctor know where it was at any given time. The Doctor deduced that it was designed to force him to confess his deepest secrets. Whenever he did so, the Veil would freeze and the castle would reconfigure itself, bringing him closer to Room 12 and the way out.

Within Room 12, the Doctor found a wall of solid azbantium, 400 times harder than diamond, marked with the word "Home". He realised the ultimate secret his captors wished him to confess: the true identity of the hybrid prophesied to conquer Gallifrey. Unwilling to give up such dangerous knowledge, the Doctor began to punch the wall, allowing the Veil to catch up and fatally injure him. In the day and a half it would take him to die, the Doctor hauled himself back into the teleport room and wired himself into the controls, burning up his current body to bring an identical copy of himself into the castle. He left himself a single clue, the word "Bird" written in the sand, to remind himself of a story about the meaning of infinity. This allowed each version of the Doctor to realise what he needed to do. Bit by bit over two billion years, the Doctor struck the wall until it finally shattered. When it did, the Veil collapsed into clockwork parts. (TV: Heaven Sent)

Behind the scenes
The Veil was never named on screen, only in the credits of Heaven Sent, where it was credited simply as "Veil". In the Doctor Who Extra clip Behind the Veil, actor Peter Capaldi and director Rachel Talalay both refer to the creature as "the Veil". The creature's bio on the BBC Doctor Who website consistently refers to it as "the Veil".