Flatline ( TV story ) Flatline was the ninth episode of the eighth series of " Doctor Who " produced by BBC Wales . For scheduling reasons , it was a " Doctor - lite " episode . " Flatline " was Jamie Mathieson ' s first script for the show . Two years before writing it , he had pitched his ideas for a story to Steven Moffat , but was unsuccessful . When he again met with the executive producer , he showed him four ideas for episodes , complete with his own illustrations , aided by his background in art college . Taking an interest in the monster he had created for what would become " Flatline " , Moffat asked Mathieson to produce a story outline and he got the job to script the episode . It was only after writing several drafts that he was told the episode would need to lock the Doctor away in a single location , as Peter Capaldi ' s scenes for the episode needed to be filmed quickly to bide by the production schedule . Mathieson decided to write a script where the Doctor was " in the dark " . For this to be successful , he had to create an unknown quantity to feature as his alien enemy . Much like his next creation , the Foretold , he elected to have no dialogue for the aggressors , allowing something about them to remain " unknowable " . ( DWM 479 ) This is also an episode where the psychic paper has failed to show someone what the user wants . Unlike Shakespeare , who was immune due to his genius , Fenton suffers from a severe lack of imagination . Synopsis . Separated from the Doctor , Clara discovers a new menace from another dimension . But how do you hide when even the walls are no protection ? With people to save and the Doctor trapped , Clara comes up against an enemy that exists beyond human perception . Plot . A man is on the phone with the police , explaining in whispers that he knows what happened to the people who went missing . When they ask him to speak up , the man tells them he cannot ; he needs the police to protect him as the culprits will be coming for him . Hearing something , he screams in fear and vanishes from the room . The officer on the line asks the man if he is okay , getting no response . The camera pans to the trim on the wall of the room , showing an image of the man stretched through the trim , screaming . After some adventures , the Doctor is piloting the TARDIS back to Clara ' s time to return her home . She is hurriedly packing her things , to which the Doctor tells her is not necessary as there is LITERALLY infinite space in the TARDIS for her possessions . However , Clara says Danny has gotten possessive , and doesn ' t want any of her things in the TARDIS . Not really caring , the Doctor lands the TARDIS , telling her it ' s the same time the left . However , he then adds " same place - ish " . Realising something is wrong , Clara demands the Doctor not give her that ; however , he retorts that the readings he ' s getting are " ishy " . As he looks at the monitor , Clara heads to the door . She stops , shocked ; she calls the Doctor to her . He looks at the door as well , stating it ' s very not good : it ' s shrunk ! The Doctor and Clara exit the TARDIS , albeit with some difficulty as the exterior shell has shrunk to almost half it ' s original size . Amazed , the Doctor begins wondering what happened and starts scanning with the sonic screwdriver . Clara looks over at the nearby tracks , reading the sign ; they ' re in Bristol rather than London . She states it ' s annoying ; he retorts she ' s annoying . What ' s happening here is huge ; something near by is draining the dimensions of the TARDIS . The Doctor tells her " my house isn ' t going anywhere " until what ' s leeching off it has been stopped . He gets back inside for equipment , directing Clara to look around for the source of the problem . She meets Rigsy , a graffiti artist working community service for his art ; he tells her that locals are disappearing , and mystery murals of them have appeared in a nearby pedestrian tunnel . Clara calls the Doctor , bringing him up to speed . She asks where he is since she can ' t see the TARDIS . However , he tells her he hasn ' t taken off . To her amusement . the TARDIS as shrank to size of a toy . The Doctor lightens the TARDIS , allowing Clara to carry it her her purse . He hands Clara his psychic paper , the sonic screwdriver , and an audio / visual earpiece so he can keep in touch with her . Clara takes this as being chosen to act as his stand - in ; that itself is a complete honour . Annoyed , the Doctor tells Clara that she ' s not being him . Clara goes back to the mural tunnel , scanning around to give stats to the Doctor in the TARDIS . Rigsy finds her again , asking for her name . Clara calls herself " the Doctor " . When Rigsy asks Clara what of , the actual Doctor states " of lies " . However , Clara decides to get back at him by saying " I ' m not sure . I think I just chose the title because it makes me sound important . " Being a blow to the Doctor ' s ego , he sneers " why Dr . Oswald , you ' re hilarious . " She asks Rigsy to take her to where someone vanished . Rigsy leads her to flat of the mopst recent missing person , where there ' s a strange desert mural . Rigsy gains help from a police officer to gain access to the flat of the first known missing person . The Doctor instructs Clara to tear out the walls , believing the energy source to be within them . While they work , PC Forrest is sucked into the ground out of view of Clara and Rigsy , and when they reach her screams she has disappeared . They look around the room and find another strange mural , and the Doctor realises it ' s likely to be PC Forrest ' s nervous system , and believes the first mural was a closeup of human skin of the latest victim . Clara shows the TARDIS to Rigsy , getting him on the same page . Hearing a bizarre sound , the Doctor shuts the TARDIS doors as the creatures behind draining it of its dimensional energy is at it again . Clara and Rigsy see what appears to be air moving like fluid coming at them . The Doctor quickly explains his theory that their adversaries are creatures from a 2 - D universe , and must have been experimenting on the three - dimensional world , trying to understand it . As Clara and Rigsy try to avoid the entity , which is in the walls and ground , Danny phones Clara , and she manages to avoid questions of her whereabouts and quickly hangs up . The Doctor , who is listening in , recognises that Clara has lied to him about Danny accepting her continued travels in the TARDIS . Clara and Rigsy return to the rest of the community service group , who are about to paint over the murals in the pedestrian tunnel . The Doctor realises that the images are masquerades for the two - dimensional creatures , attempting to understand three dimensions ; after the creatures take one of the services workers , Clara leads the rest away with the creatures chasing them . They take shelter in a nearby engine repair warehouse , where the Doctor tells Clara that a leader will soon emerge , and that she must make sure it ' s her . When Fenton demands to know who she is , Clara coldly states she ' s his best option for staying alive . The Doctor is impressed ; he ' d do the exact same thing to make people listen . The Doctor helps Clara to try to communicate with the creatures using mathematics . When another worker is taken , Clara and the surviving members flee into a disused subway tunnel . As they explore , they find their only escape route has been flattened to two dimensions by the creatures . The Doctor provides Clara with a device to restore the dimensions , and they just manage to escape . The Doctor also tells Clara that he has worked out a way to stop the creatures and return them to their home dimension , but the TARDIS doesn ' t have enough power . In the chaos , the TARDIS is knocked down a shaft on to an active railway line , with an oncoming train heading right for the TARDIS and the Doctor . With some advice from Clara , the Doctor is able to get the TARDIS off the rails by using his hand to move it , resulting in the Doctor doing a little victory dance for saving his TARDIS and himself . However , his victory is short - lived , as the TARDIS tips over onto the rails again . In order to protect the TARDIS from the oncoming train , the Doctor activates its siege mode at the very last minute , but without power is unable to return it to normal . The lack of power is also causing the life support systems to fail . Clara uses the sonic screwdriver to stop an out - of - service train , and they attempt to use it to ram the creatures to prolong time to get back in contact with the Doctor . However , the train is simply transformed into two dimensions ; as they escape , Clara finds the TARDIS now looking like a plain cube with Gallifrey an symbols , and takes it with her . Taking shelter in a disused office space , Clara comes up with a plan to provide energy to the TARDIS by having Rigsy paint out a fake access door on the back of a large poster . Unsure if Clara can still hear him or even if she is still alive , the Doctor praises her performance , saying that she " Made a mighty fine Doctor . " When the creatures attempt to pull the fake door into three dimensions , they instead feed their energy into the TARDIS , restoring it to normal . Realising they have no interest in peace , the Doctor uses the sonic screwdriver to stop the creatures , whom he dubs the " Boneless " , sending them back to their own dimension with a warning to those who survive the trip that " You are not welcome here . This plane is protected . I am the Doctor . " The Doctor returns everyone to the surface safely in the TARDIS . Clara rejects a call from Danny , catching the Doctor ' s attention ; he notes that she enjoyed ' playing the Doctor ' for the day . She asks him to admit that she was a good Doctor ; he reluctantly tells her that she made an " exceptional Doctor , " but that " goodness " had nothing to do with it . As Clara watches the Doctor enter the TARDIS , , seated in a darkened room , is watching Clara on what appears to be a tablet . Missy says , with regard to " her " Clara , that she has " chosen well " . Story notes . Filming locations . " to be added " External links . " to be added "