Double Reverse Quadruple Agent

""You must spend every day pretending to act like you're falsely letting on that you aren't not unbetraying someone you don't not purport to allegedly not work for but really do!""

- Psycho Mantis on Revolver Ocelot, The Last Days of Foxhound

There's The Mole, who's a villain pretending to work for the good guys. And the Reverse Mole, which is the same but reversed. You put them together, and you get the Double Agent, who's working for either the villain or the hero, and acts as a fake mole for the other.

Sometimes, they like to go one step beyond, or eleven. This is the trope for people who have exacted layers and layers of deception, normally as a massive Gambit Roulette to satisfy their wishes, or their true employers' wishes. It's quite often that the chain of deception ends with the person the spy loves. The effect on the viewer can be very disorienting as they try to keep up.

Contrast Heel Face Revolving Door, which is a character cycling between being a hero and a villain, and Chronic Backstabbing Disorder, where people constantly make allegiances to stab them in the back (natch). In the case of the revolving door and the disorder, the character is genuinely changing alignments or allegiances, whereas in this trope the character never truly changes (or at least, rarely), it's just the in-universe perceptions of the character that change. Sometimes, the recursion can reach I Know You Know I Know levels.

For example, take the classic Cold War double agent. A Russian who "defects" to the Americans, to supply information back to the Russians. In these examples, the double agent is actually a spy for a fleet of invading aliens. But the CIA know about the aliens, thus make the man a mole for them. But the KGB had their suspicions about the aliens anyway, but don't have the tech themselves to infiltrate the aliens so they piggy back on the Americans. But this is all an act for his true employers, a Path of Inspiration... and so on.

This trope is not about a sex position, although now that it's been mentioned, there probably is one by this name.

Anime and Manga

 * Follow along closely children: Xellos in Slayers pretends to be a priest who's really a demon who's really under the orders of a demon but is actually betraying THAT demon for another demon, and is trying to destroy the world except sometimes maybe not, and helps the team, except when trying to destroy them, except when he's secretly helping. Lina trusts him implicitly to eventually fuck her over, and says at much at one point. Xellos thinks she's crazy, but she's not the one serving multiple masters with multiple plans to destroy/save/rule the world.
 * Kaji in Neon Genesis Evangelion, appearing to work for Nerv, Seele, the Japanese Ministry of the Interior, and against another one of them, in varying configurations. His true mission is to find out the truth about the nature of the Second Impact and the angels for himself.
 * Sideways in Transformers Armada, not aided by a shaky, rushed translation.  And then he returns in Transformers Cybertron to do it all over again.
 * from To Aru Majutsu no Index is and is constantly switching between working for Aleister Crowley (and Academy City's dark side) and Necessarius. It's even hinted that he works for even more covert organizations, but he's being let off the hook for the time being.
 * From Naruto we have Kabuto Yakushi. First, he disguised himself as a Leaf ninja for at least four years, only to reveal he's working for Orochimaru, who himself does not entirely trust him. Later we discover he was a spy for Sasori in Orochimaru's organization, but Orochimaru had long since removed that brainwashing and made him a double agent to keep tabs on the Akatsuki. After the apparent death of Orochimaru, Kabuto went rogue, with various reactions to the loss of Orochimaru from shock to joy. Nowadays, he's working with Tobi, but blackmailed him and is pretty much in charge, depending on their various trump cards. Later we learned he was a spy for Konoha (which he later spys on for Orochimaru) and infiltrated numerous countries on its behalf. However Konoha stopped trusting him resulting in him having a grudge again Konoha. Confused yet?
 * Manga version of Nicholas D. Wolfwood. Part of every major faction in the series and at least one minor one. Shot his teacher to join the Gung Ho Guns to subvert Knives' plans for the Endofthe World As We Know It, but also manipulated The Hero on behalf of the villains before and even after becoming emotionally invested in his well-being. Then turned on them after Vash was defeated and captured, and staged a jail break. Finally abandons everyone in favor of his primary allegiance: the kids at the orphanage where he spent the closest thing to a happy bit of his childhood.

Comic Books

 * The Autobot Punch/Counterpunch was originally portrayed as a Double Agent (an Autobot who pretended to be a Mole for the Decepticons). Later interpretations of the character sometimes depict him as a Double Reverse Quadruple Agent, often due to prolonged effects of Becoming the Mask.
 * The second season of Sleeper has doing this through the entire run.

Fan Works

 * In Harry Potter and The Methods of Rationality Blaise Zabini is a quintuple agent. Who thinks he's a quadruple agent. In a game with three sides. Also he would have been a sextuple agent if he could find anyone else to sell out to.

Film

 * In Cypher, the protagonist is the plaything in a Gambit Pileup. He ends up a hex-tuple spy, ultimately working for
 * Lightly riffed in Indiana Jones and the Kingdom of the Crystal Skull
 * Openly an issue with Captain Jack Sparrow in Pirates of the Caribbean. It's nearly impossible to do a write up of his betraying and side-switching first three films because it's NEVER really made clear exactly who he's helping, who he's fucking over, or even why he's doing it (and, at some points, he doesn't seem to be able to keep track of it himself).
 * Arguably, Anakin Skywalker as Darth Vader becomes this in Revenge of the Sith. After becoming Darth Vader under Palpatine, a.k.a Darth Sideous, he goes on two missions: his first to lead the extermination of the Jedi on Coruscant who don't know he's a Sith. Secondly, in his public guise, Palpatine rules the Republic, but as Darth Sideous, he controls the Separatists. He tells the Separatists he's sending his new apprentice to meet them, who promptly kills them all as they wonder why, and at the same time, announces to the Republic that he's dispatched someone to take down the Separatists, after which he announces beginning of the Empire. Anakin then postulates to Padme that he could kill Palpatine and take over the Empire himself.

Literature

 * Severus Snape in Harry Potter, who is working for by working for  by pretending to work for  by pretending to work for . As a testament to JK's writing ability, this is easier to follow than it sounds.

There is another couple of layers if you use the version where
 * In Dune, Yueh came pretty close, what with his being mentally conditioned at the Imperial Medical School to be unable to harm another person, and then secretly captured along with his wife by the Harkonnen Family and re-brainwashed into an assassin, then retained by the Atredies Family on the grounds of his original, supposedly unbreakable conditioning, eventually betraying them to the Harkonnens on the promise of being reunited with his wife but secretly resisting their brainwashing and at the last minute helping the Duke's son and her mother escape, then arming the captured Duke Atredies with a concealed suicide weapon he can use to kill the Baron Harkonnen, then pretending to still be loyal to Harkonnen and asking to be reunited with his wife at which point Harkonnen tells him she is dead and kills him. More of a very unstable double agent, but then this all happens in something like the first three chapters of the book.
 * X Wing Series: Gara Petothel, though not intentionally, at least at first. At first she intended to be The Mole; later she became the mask. Later still she was discovered and had to go back to her old side - but worked to sabotage it.
 * One of these is the main character of Keith Laumer's Dinosaur Beach, leading to multiple levels of Tomato Surprise as he betrays one faction or another. His ultimate allegiance turns out to be to
 * The Illuminatus novels have Tobias Knight, described as the only quintuple agent in the history of espionage. If this troper remembers correctly he was working for the CIA, KGB, FBI, Illuminati and the Discordians all at the same time, and had reached the point where he was participating in conspiracy for its own sake.
 * While the agent in question was completely unaware of his status, unravelling the layers of this drive the plot of Philip K. Dick's We Can Remember It For You Wholesale. Maybe.

Live-Action TV

 * in Season 7 of 24. He initially seems to be working for David Emerson and his mercenaries, until it's revealed that he's working with Bill and Chloe to take down the people behind Emerson (General Benjamin Juma and Jonas Hodges). But then it's revealed he was evil and working for a cabal of rival Big Bads who wanted Juma and Hodges taken down all along, then eventually we find out he's trying to gain the trust of the cabal's leader so he can kill him in revenge for
 * Dr. Jill Roberts (Jordana Brewster) in several episodes of Chuck. Her apparent loyalty switches back and forth in a dizzying manner.
 * The loyalties of Adelle DeWitt in Dollhouse dizzyingly switch between Rossum and Echo at least once or twice per episode throughout the second/final season. Eventually, it's revealed.
 * Irina Derevko, Jack Bristow, and Arvin Sloane on Alias who vacillate between working for terrorists, the CIA, the K Directorate, SD-6, Authorized Personnel Only, themselves, each other...
 * And then there's Sark, who literally does not care whose side he is on, as long as he ends up on top.
 * Farscape: Scorpius takes this to mindbending levels by the end of the series. qualifies as well, especially in Peacekeeper Wars when she.
 * Dr Kellerman in the Doctor Who serial Revenge Of The Cybermen
 * Figuring out how many factions Alex Krycek works for in any given episode of The X-Files is an exercise in futility, especially since he also has an unhealthy tendency to backstab his employers (mostly) for the lulz.
 * Grimm has Captain Renard, a member of a so-far unknown Wesen royal family. Every single faction he has contacted so far has assumed he's working for some other side. And his actions really aren't helping us decide either.
 * Star Trek Deep Space Nine; So, does Garak support the Detappa Council? The Obsidian Order? The Central Command? The Dissident Movement? The Federation? Enabran Tain? Himself? Have fun trying to figure it out because none of the characters in-universe can!

Newspaper Comics

 * Calvin and Hobbes did this in one strip where they're playing football. Then they try to justify why why the other didn't score (I'm actually a double agent, triple agent, your goal is on top of mine so anytime you score it's a point for me, I'm actually a badminton player disguised as a football player, et.) until it turns into a game of Calvin Ball.

Tabletop Games

 * The Green Lady from Exalted is working for four different Deathlords--one of whom is convinced she's secretly a man--as well as the Bureau of Destiny, and playing every last one of them off of the others. In fact, she's pulling such a convoluted, multilayered Memory Gambit that even she doesn't know whose side she's really on.
 * Fully and hilariously possible in Paranoia: secret societies often have agents infiltrate other secret societies, who in turn might use the very same person to spy on yet another secret society, ad nauseum. The rulebook even acknowledges the (very remote) possibility of spying on all of Alpha Complex at once. "Try to keep your cover stories straight."

The end result of this is a secret society called The Wobblies. The Computer heard about it and sent a team of Troubleshooters to spy on it. Problem was, it didn't exist (the Real Life Wobblies had died out long before Alpha Complex was created), and when the Troubleshooters reported this, they were swiftly executed for insubordination. This cycle repeated until one group got smart and actually founded the society just so they had something to spy on. This attracted the attention of other groups, who sent in their own spies, resulting in a group made up entirely of spies from other groups.
 * The Werewolves of Miller's Hollow will sometime flirt with this. The mayor of the village can secretly be a werewolf, but more precisely a white werewolf, as well as the lover of the pied piper. It works better if there are many players.
 * Munchkin Impossible has the triple agent card. It allows you to claim allegiance to three nations (out of the four available) at the same time. There's also the Sidekick Dusty McRonin, the man of too many allegiances.

Toys

 * Bionicle has a rather simple one, as these things go: Roodaka worked for both the Brotherhood of Makuta and the Dark Hunters, but she played them off of each other and her true allegiance is to herself. Eventually both sides found out and started targeting her; at which point a third faction, the Order of Mata Nui, caught her and made her a Boxed Crook.

Video Games

 * Trope Namer is the original description of the Spy in Team Fortress 2. In game, you can disguise yourself as a spy. Since this disguise includes a random disguise (so you look like a proper spy to the enemy team), you can be a spy disguised as a spy disguised as a spy. The soldier in "Meet the Spy" did think the spy was a spy from the other team.
 * For more on this topic, see the game's Wild Mass Guessing page.
 * Revolver Ocelot in Metal Gear Solid has, at various points in the series, apparently been working for the CIA, NSA, KGB, GRU, Colonel Volgin, FOXHOUND, rogue FOXHOUND, Colonel Gurlukuvich, Solidus Snake and the Patriots. In Metal Gear Solid 4 Guns of the Patriots, we learn that.
 * EVA from Metal Gear Solid 3 Snake Eater. When Snake meets her, he assumes that she is a NSA agent who defected to the soviets and now works for the KGB infiltrating Volgins private Army.
 * of Tales of Symphonia works for Lloyd by working for Kratos while working for by pretending to pretend to be helping Lloyd in one ending. He also passes information to  at some point.
 * Fire Emblem Tellius has Naesala, Raven King of Kilvas. He works for Daein as a mercenary leader (the rest of the mercenaries are Kilvans), and he seemingly betrayed Reyson for Oliver, but later he betrays Daein to protect Reyson and Leanne from Ashnard. Chronic Backstabbing Disorder, anyone?
 * Carmen Sandiego is described in some of the game manuals as a Triple agent. It's not too hard to think she probably reaches Double Reverse Quadruple Agent status pretty easily, given her legendary stealing prowess.
 * Kingdom Hearts has Axel. He starts off in Chain of Memories working for Marluxia,  and then ditches them to fend for himself - although 358/2 Days reveals that . Kingdom Hearts II has him abandoning the Organization after being ordered to eliminate Roxas,, and ultimately . He plays for all teams.
 * In Knights of the Old Republic, you can become this for the two instructors of the Sith Academy on Korriban, pitching them against each other while pretending to work for each of them as a double agent. This can end with them both saying to kill the other, then they feel the effects of the poison you gave to both of them, leading them to realize you are working for yourself.
 * In Baldur's Gate II, while in Underdark, you can triple-cross two Drow priestesses, an elder Baatezu, and a white dragon, who each thinks you work for them, while in reality, you pursue your own agenda...
 * In Star Wars: The Old Republic Imperial characters have several opportunities to do this and decide on the fly whose side you're actually on, if anyone's. One of the most notable cases is act 2 in Imperial Agent's story, where you're an undercover agent for both the Imperial and Republic intelligences.
 * The Lost Archive DLC in Assassin's Creed Revelations reveals.
 * The Lost Archive DLC in Assassin's Creed Revelations reveals.

Web Comics

 * Professor Tiktoffen in Girl Genius. Everyone seems to think they are the ones he is really working for. It's been revealed that he was pretty much everyone's "man inside" the city-state of Mechanicsburg, and his true loyalty was solely to himself - his goal was to take over Mechanicsburg, and by making all the other factions think he was on their side in the struggle for the empire, they wouldn't oppose him when he made his bid for power over a single city.
 * Schlock Mercenary:
 * Tagon's Toughs occasionally find they have the opportunity to play this role, or at least what looks like the opportunity to do so. Look for the phrase "get paid twice"; it means both sides in a conflict are trying to hire the Toughs, and Tagon is optimistically trying to find a way to satisfy both contracts without letting either one catch on to his game.
 * On at least one occasion they successfully managed to get paid five times.
 * They get paid four times in The Body Politic, starting here. They get paid twice for stealing Xinchub's corpse, once for preventing the same theft, and once more for cloning a copy.

Western Animation

 * Avengers Earths Mightiest Heroes: Black Widow. ...Maybe. Maybe not. Or... Who knows.