The history of the Communist movement is full of intrigue, espionage, and infiltration. One of my go-to examples is from the United States, where in the 1960s an already-weak movement was divided and browbeaten by FBI agents pretending to be ultra-principled, far-left agitators:
Among the Maoist organizations to arise out of the political tumult of the 1960s was a group known as the Ad Hoc Committee for a Marxist-Leninist Party (initially called the Ad Hoc Committee for a Scientific Socialist Line). […] As hyper-radical as the AHC came across, the force behind the program was an FBI Special Agent named Herbert K. Stallings. Stallings, in an internal FBI memo, is described as an “agent of high intelligence and tremendous imagination” whose “knowledge of Marxism-Leninism is broad and outstanding” (SAC Chicago, To FBI Director 1/22/1964). Under Stallings’s tutelage the Ad Hoc program continued for fifteen years, targeting not only the CPUSA, but the emergent New Left. 
On RS we’ve published essays about Gene Sharp’s decades-long weaponization of “non-violence,”  and also about Sharp’s role in the colour-revolution effort against China in 1989 Beijing,  exposing how what has been invariably and universally portrayed as grassroots in fact was helped along by a great deal of orchestration and aid from American intelligence agencies.
The CIA and other capitalist entities seem to have been one step ahead of many socialists in their understanding that the Communist movement isn’t a simple straightforward outgrowth of worker organizing, but rather the product of an alliance between workers and socialists.  Workers and socialists are natural allies, and one individual can easily belong to both groups by upbringing, but history is full of instances where this was not the case. Among the most notorious is Marx himself — a petty-bourgeois would-be lawyer married to an aristocrat, forever in partnership with Engels, a proper bourgeois. Far from burying this autobiographical detail, Marx defends himself by warning his readers: we must not imagine that “representatives of the petty-bourgeoisie” are “all shopkeepers or enthusiastic champions of shopkeepers.” 
Nevertheless, the CIA historically exploited ignorance about this fact among leftists, decisively pitting socialists and workers against each other, to the fatal detriment of both. The first target is always the socialists — they are a smaller group of people. Socialists can be outlawed and assassinated, whereas the worker movement is large and arises organically from resentment against exploitation. More importantly, workers themselves are absolutely necessary for the operation of capitalist enterprises, so they can only be managed, never eliminated.
Socialists, then, can then be attacked easily from two well-known flanks: left-adventurism on the one hand, right-opportunism on the other. The “Shining Path” terrorist movement in Peru, a splinter of the Communist Party which often turned some of its harshest ultra-violence against Party members and various other leftist organizations, has been charged by some Peruvian historians of being a product of the CIA.  The Black Panthers were also infamously infiltrated by violent provocateurs. However, left-adventurism doesn’t always take the form of non-methodical militance, it very often comes dressed in philosophical or cultural garb, dealing out smug and aloof denunciations of compromise and tactics from a position of “principle.” Writers such as Gabriel Rockhill and Zhao Dingqi have documented how various cultural initiatives were historically used to peel off socialism away into a more abstract and less militant direction. 
More spectacular, however, have been the fractures provoked by right-opportunism. One notorious example is from 1973 Chile, where transport workers were bribed in order to paralyze Allende’s socialist government, which set the stage for widespread social discontent, and would very soon after help legitmize Pinochet’s brutal fascist dictatorship:
The Central Intelligence Agency secretly financed striking labor unions and trade groups in Chile for more than 18 months before President Salvador Allende Gossens was overthrown, intelligence sources revealed today. 
Similarly, throughout the 1980s in Poland, the US- and Vatican-backed “independent” ship-builders labour union Solidarity received all sorts of international accolades for its opposition to Communist rule, including a 1983 Nobel Peace Prize for its leader Lech Walesa (who later became Poland’s president). Poland today remains one of the most reactionary countries in Europe. Once socialists are out of the picture, it proves very easy to claw back concessions from workers, to remove prestige from opportunistic worker-leaders in capitalist payroll, and to replace them with more suitably pure-blooded liberal managers. 
The issue is not restricted to the so-called “Cold War,” however. One of Karl Marx’s less celebrated works, Herr Vogt (1860), was the outcome of Marx spending a great deal of time exchanging accusations of betrayal with a white supremacist politician posing as a leftist, only later exposed as on Bonapartist payroll…
But, wait a moment. It would seem like I am convincing readers to be from here onwards on a suspicious look-out, ready to accuse every deviationist at the earliest possible moment. Or, worse: implying that there’s simply nothing we can do against such infiltration, that the socialist movement is simply constitutionally incapable of defending itself against saboteurs.
I think it is useful here to cite a segment from Domenico Losurdo’s book on Stalin, dealing with his appraisal of the Stalin-Trotsky dispute. It has produced loud condemnation from Trotskyists, and some grumbles from fans of Stalin, due to the way he ultimately disparages both. Losurdo says:
On both sides, rather than engage in the laborious analysis of objective contradictions and opposed alternatives, and of the political conflicts that develop on their basis, the protagonists preferred to hastily resort to the category of treason — and in its most extreme configuration at that, such that the traitor becomes a conscious mercenary agent on behalf of the enemy. Trotsky never tires of denouncing the “conspiracy of the Kremlin bureaucracy against the working class,” and this plot is all the more despicable for the fact that the “Stalinist bureaucracy” is nothing more than “a transmissive mechanism of imperialism.” It is hardly necessary to point out that Trotsky was generously repaid in kind. He complained of being branded as an agent “of this and that power,” but in turn labeled Stalin an “agent provocateur in the service of Hitler.” 
Losurdo, a trained Hegelian, takes his cue from Marx’s denunciation of Proudhon,  and accuses both Trotsky and Stalin of “philosophical poverty” for their inability to articulate their problems with each other outside of this kind of accusation of servility. I think this is a correct diagnosis: the movements listed above could be charged with generally dismissing the importance of philosphy in order to focus on more “practical” matters. The result is that, unable to concretely articulate problems with particular tactical lines, said lines are simply labelled, and this mere labelling is deemed sufficient for dismissal. In reality, however, if a sinister operator is skilled enough to formulate valid critiques, does it matter that he is an agent? And if they aren’t an agent, but rather a genuinely well-meaning revolutionary that happens to just be extremely ignorant and short-sighted, then does it matter that they are sincere?
Since Marxism is a science, we could here look briefly to scientific institutions for guidance. Fake scientists can and do cause chaos. However, the community tends to self-correct through increasing rigour (clinical trial rules, public data requirements, trial pre-registration, etc.), and adapts. Communists need to adapt too. We can fault the scientific community to greater or lesser measure for its failures, but the self-corrective mechanism exists, and it exists because scientists tend to all submit themselves to a fairly democratic criterion of objectivity. Conversely, the historical ability of agents to infiltrate Communist organizations is directly linked to their theoretical slovenliness.
What about the argument that the CIA’s stated strategy to disrupt organizations is to mire them in pointless debates? People often cite the OSS’s “Simple Sabotage Field Manual,” which gives advice such as “bring up irrelevant issues as frequently as possible” and “haggle over precise wordings of communications, minutes, resolutions.”  There’s absolutely no question: this tactic is at play, and we must learn to counter it. But how? One cannot simply invoke fear of disruptors to quash all discussion and demand obedient submission. Rather than retreat from arguments in fear, we must learn to navigate them swiftly and efficiently.
Lenin wrote in 1921, in the context of recommending that the newly-founded Soviet Union teach Hegelian-materialist dialectics, that “no natural science and no materialism can hold its own in the struggle against the onslaught of bourgeois ideas and the restoration of the bourgeois world outlook unless it stands on solid philosophical ground.”  Mao went perhaps even further when he stated that
Marxists should not be afraid of criticism from any quarter. Quite the contrary, they need to temper and develop themselves and win new positions in the teeth of criticism and in the storm and stress of struggle. Fighting against wrong ideas is like being vaccinated — a man develops greater immunity from disease as a result of vaccination. 
Among Communists, intellectual courage in the vein of science — philosophy — should replace a series of habits that currently owe more to the profession of faith of the fervent religious believer, who is constantly on the lookout to ex-communicate threats on the basis of perceived sacrilege. A serious scientist would not dismiss a strong argument due to its questionable provenance, nor would they embrace a poor one by kowtowing to some tradition or rank. If the movement is theoretically able, any crude agent will be spotted instantly, while sophisticated agents will be producing critiques that, due to their legitimacy, once addressed, will only strengthen the movement.
In conclusion, learn to defeat Herbert K. Stallings in argument. If you can’t, your Marxist organization is doomed either way.
 Gabriel Rockhill and Zhao Dingqi, “Imperialist Propaganda and the Ideology of the Western Left Intelligentsia: From Anticommunism and Identity Politics to Democratic Illusions and Fascism” (2023). [web]