Hayley works with Marcus Yanek to put skyward on Ned Warner, Manchester Energy’s CEO’s computer for an old spy pal ex-MI-6, Bryce Roberts, who says he needs it for a cheating spouse case. In the morning, Hayley tags along with Castle to a crime scene where she finds Marcus dead in the CEO’s office. Bryce tells Hayley this is a code 44 which sends her running to find her hidden passports, cash and a gun.
Alexis convinces Hayley not to go on the run. Hayley asks to watch interrogation of Ned Warner and after he lies to Esposito and Ryan, she pulls him into the bathroom and semi-waterboards him until he’s willing to admit he was in the office with a woman he picked up at a bar named Carla.
Beckett and Castle interrogate Hayley who admits her role in the case. She brings them to Bryce’s home where they find him dead, stabbed in the back. Then Hayley finds that $10 million was wired into her account just as a cyber attack hits London through Manchester Energy. It’s considered an act of terror with Hayley as the prime suspect.
MI-6 says that Hayley is a ruthless operative who let her own partner die and is the main person in this conspiracy. They tell Castle that she could turn on him or Alexis if they aren’t careful. Hayley claims it is all lies but that her old partner, Wesley did die but she says it’s complicated.
Esposito and Ryan find Carla, aka Beth Wynn and arrest her. She says she was the bait to make sure that Ned was at the office to log into the computer. She claims a man named Edgar Patton was behind the scheme. They find a laptop which they let Hayley work on. She says she helped design the computer worm, then she disappears.
MI-6 admits to Beckett and Castle that the worm was designed by Hayley and Wesley years ago and used to knock an Iranian uranium reactor off-line. The extraction point was compromised and Wesley supposedly died. That’s why Hayley left MI-6.
Beckett figures out that Hayley must have figured out that Edgar is really Wesley Connors, her supposedly dead partner. Hayley finds Wesley who says that their plan worked. Wesley was tortured while being held captive. Apparently they talked about taking $10 million so they could run off and retire. He killed Bryce and plunged London into darkness because they left him behind. Hayley thinks he’s gone mad.
Hayley tries to take Wesley in and they fight and Hayley has to shoot him to save herself. The charges are dropped against Hayley and she helps dismantle the computer worm that has London in the dark. MI-6 asks Hayley to come back but she tells them to piss off. Castle tells her she doesn’t have to mourn her friends alone. Alexis tells her she doesn’t have to do anything alone.
Beckett takes Espo and Ryan out for beers. Back home, Castle reveals he has been keeping a secret. He got Beckett’s motorcycle restored and bought one for himself. He suggests they take a cross-country trip together. Kate is thrilled.