In "Pandora," Castle and Beckett are driven into the water by an unseen assailant. Their car plunges into the murky depths below. Beckett's gun has fallen to the floor. Castle dives into the water that's rapidly filling the car. He needs to find the gun to break the window and save his partner who is held captive by jammed seatbelt. Castle has been under far too long. Beckett struggles until she's completely submerged. Eventually, her grip on the steering wheel is lost as her hands go limp.
FLASH! FLASH! Shots are fired. Castle got the gun. He and Beckett are safe, but they still can't tell the rest of their team the classified details behind Dr. Martin Blakely's murder at the docks. CIA operative Sophia Turner brings them back to the secret bunker to inform them that they are no longer part of the investigation. She chastises Castle with a personal attack that has Beckett realizing that these two slept together in the past. This new info has our favorite homicide cop feeling conflicted, as evidenced by the way she steps up to the wrong desk. But that's not going to stop Beckett from going after a killer. Castle, too.
The CIA swipes Blakely's body. The ensuing conversation in the morgue has a seemingly jealous Beckett bringing up the fact that Castle slept with Sophia. Unfortunately for everyone, Alexis overhears the whole thing. Castle deflects her queries about Sophia, who sneaks into his place to inform him that she wants him to continue with the investigation. The dressing down she gave him at headquarters was just a ruse for her colleagues. She even provides him with a lead because she knows Castle won't ever stop until he knows how the story ends.
Castle shows Beckett bank account info on Blakely that Sophia provided. He may have received some big money payoffs for consulting on Pandora. Esposito and Ryan track down a chess playing pal of Blakely's who grilled him on economic theories. This leads Castle and Beckett to an apartment with a side room. Inside is a spider web of newspaper clippings and complex equations strung from one wall to another. The message that's to be taken away from all the various nexus points is that their domino effect will lead to World War III.
Castle realizes that a photo of a young Asian girl is the first domino that will fall. She's the linchpin. He's about to call Sophia when a gun-wielding Thomas Gage orders them to run. He leads them out of a firefight as unseen assailants with automatic machine guns attack. Castle and Beckett thought Gage was the bad guy. In fact, he's the person being set up by someone inside the agency. Speaking of the CIA, they've just arrived to take everyone back to the underground headquarters.
Sophia questions Gage about the identity of the young girl. She gets no answers. Chances of a follow-up interrogation disappear when Gage is found shot to death in his holding room. Sophia orders the bunker be put on lockdown. They trace the person who altered the video system in the holding room. It's linked to an operative, but he's a decoy. The real mole is revealed to be Agent Martin Danberg, who takes hostage before making a daring escape.
Sophia says that Danberg is likely not working alone. They need to find the linchpin. Castle suggests they use topographical analysis to identify the mountains behind the young girl in the photo. Sophia has a chat with Beckett while the computer does its search. She reveals that after she slept with Castle the tension and longing that had been between them for so long was suddenly gone. That wasn't a good thing. This newsflash appears to have Beckett feeling even more conflicted.
The young girl in the photo is identified as the daughter of a Chinese businessman, Xiang Ganghong, who is extremely influential in shaping his government's economic policy. America's government would shut down if this man used his influence to end China's purchase of U.S. debt. That could happen if his daughter was killed in a botched assassination attempt that was orchestrated by a CIA operative like Gage. As it turns out, Xiang is currently head to the U.N. for a trade conference. His daughter is also making the trip.
Sophia, Castle and Beckett meet with Agent Corrigan, the head of another CIA field team, at the U.N. basement. They end up in an empty utility room where Sophia draws her gun. She's the mole and Agent Corrigan is her partner. Corrigan heads off to kill the girl as Sophia explains that Castle and Beckett will be killed by Danberg as they tried to stop the assassination. She'll make it sound heroic. Sophia tells Castle that it's the type of story that would make his dad proud. She's surprised to see that he has no idea what she's talking about as she points the gun to his head. Beckett screams for her to stop.
BANG! Sophia falls to the ground dead. She's been shot by Danberg, who needs help to stop the assassination. It's just the three of them. No backup. Beckett races off, but Castle stays behind, stunned by all that's happened. In the U.N. lobby, Corrigan takes aim at the young girl. He's about to pull the trigger when he's tackled by Danberg and Beckett. They shuffle him out of the building before anyone knows how they came to the end of the world as we know it.
When Castle wonders about his dad's possible CIA connection, Beckett says Sophia was traitor who told a lot of lies. She knows this must be tough for her partner. After all, he based Clara Strike on Sophia. Castle says, "Clara started off as Sophia, but she ended up being more like you. You know...smart...fierce...kind. I think that's one of the reasons I was drawn to you...as a muse." It's a nice thing to say to someone who just helped him save the world. Hey, did you notice that little friendly bump Beckett gives Castle as they walk away discussing the possible resurrection of Derrick Storm? It was subtle, but it was there.