A specter is haunting the world — the specter of a new kind of revolution. The Hong Kong protesters’ technology and tactics have baffled the Chinese authorities, leaving them apparently powerless to restore order, except by extreme and counter-productive violence. Hong Kong’s revolutionary template will be adopted by all groups wishing to destabilize existing orders.

The Hong Kong riots have unfolded despite the most intrusive surveillance state ever created. The Chinese government gathers information on every citizen, and is working to assign each a social credit score that will determine who may buy a house, get a promotion, or move to a different city. Yet this system has failed completely to stop the demonstrators gathering in their hundreds of thousands, month after month.

The world is watching and learning. American intelligence agencies have monitored thousands of online searches from individuals in dozens of countries, all seeking to understand and learn from what has unfolded in Hong Kong. Of course, many of these searches are perfectly innocent, but the assessment is that many are made by activists from left and right, with some searches coming from the dark web, where bad actors can hide their identities.

Already, authorities in New York, Chicago and Los Angeles have databases containing the names and profiles of hundreds of thousands of people who might, at some unspecified time in the future, pose some sort of risk. Most of these people have not committed a crime. This is the start of ‘predictive policing’. It will be augmented by various technologies, including facial and gesture recognition, and social profiling. AI algorithms will then suggest targeted preemptive action against the right people — or the wrong people.

The classic modern revolution had an identifiable leader — a Lenin, a Mao, a Castro — and an ideological program. But there have always been revolts which lacked a leader and a clear list of demands. The Luddites attacked the machinery of the Industrial Revolution in the name of Ned Ludd, who might not have existed at all, and the European revolutions of 1848, the ‘Spring of Nations’ that Marx claimed as his own, emerged almost as spontaneously as the popular uprisings that brought down the Soviet Union.

The Hong Kong demonstrators are the 21st century, hi-tech heirs of these decentered revolts. They have no identifiable leadership structure. There are no inspiring speeches, no rallies with leaders on a stage, and no party members for the secret police to arrest and torture. Instead, demonstrations are organized on Facebook, on an encrypted app called Telegram, and on a local website called LIHKG, known colloquially through the Cantonese word ‘Linden’.

On Linden, activists post ideas and tactics — a march on a government building today or a police station tomorrow, with umbrellas to defend against water cannon — and then users take a vote. The users can like a post or reply with the single word ‘push’. The more ‘pushes’ an idea gets, the higher it climbs in the forum. The most popular ideas become tomorrow’s tactics.

This new form of anti-establishment action combines the ‘up-vote’ of the online popularity contest with direct democracy in an encrypted environment. There are no obvious leaders to arrest, and the Chinese authorities are struggling to penetrate the encryption. They have attacked the Telegram app, but failed to shut it down. They have also tried to find, identify and arrest the leaders of the demonstrations but have failed. They have threatened military action too, but so far the demonstrators have called their bluff.

The classic revolutionary movements had clear political goals: bring down the Tsar of Russia, overthrow President Batista, establish the Cultural Revolution. By contrast, the Hong Kong demonstrators’ demands shift to reflect the ‘push’ votes on social media. One day, it’s the withdrawal of an extradition treaty with China; the next, it’s a demand that Carrie Lam, the chief executive who clumsily attempted to implement the treaty, resign; the next, an independent inquiry into police conduct. This evolving list of demands means that the Hong Kong authorities and their Chinese masters are always playing catch-up.

For the FBI domestically and the CIA overseas, there are worrying lessons for the future in the Chinese authorities’ struggle to control the Hong Kong drama. As the artificial intelligence revolution takes hold, unemployment is expected to rise dramatically. The impact will be felt not just among the poor and already disenfranchised, but also among the professional classes and across the political spectrum. Expect new kinds of technologically devolved activism.

Although many right-wing voters rally to President Trump as he travels the country, the devolved right lacks coherence and organization. Their antipathy to the left, however, and their willingness to physically fight for what they believe can be seen at every public gathering. And the right know how to rally the like-minded through sophisticated use of social media.

The hard left have an umbrella organization in Antifa (shortened from ‘anti-fascist’), a loose grouping of far-left individuals, communities, and small groups. Their stated philosophy is that if anti-Nazi Germans had opposed the Nazis with violence before 1933, then Hitler might never have come to power. This is historically naive and politically deceptive; the Nazis rose as a law and order party by street-fighting against Antifa’s ideological ancestors the Communists, and the ‘anti-fascist’ slogan is a mask for pro-communist policies. But it’s enough to bring thousands to Antifa rallies where everyone accepts that violence is at the core of Antifa’s ethos.

Amid an increasingly polarized political environment, America’s law enforcement and intelligence agencies are struggling to keep pace with the tactics used by groups on the radical left and right. In the early days of the web, when encryption began to emerge as a privacy tool, the intelligence community, with rare foresight, set up a number of encryption solutions for sale using front companies that sold software to with built-in ‘back doors’. Russian and Chinese agencies did the same thing. This worked for a while, but today, companies like Telegram and Signal are effectively closed to anyone but their users. Their software is constantly updated, and their encryption constantly strengthened.

Antifa has been heavily infiltrated by different law enforcement agencies, using the old model of recruiting informants with threats or money. Bu, such successes will prove of limited value as organizations evolves through encrypted technology and new, unrelated, groups on arrive on the scene. If anti-government groups follow the Hong Kong example and grow without leadership, plans and strategy, relying instead on spontaneity, encryption and collective decision-making, how will the forces of law and order retain control?

The answer lies with predictive policing, and a new generation of surveillance and data management tools. Every American city and business deploys monitoring devices: traffic cameras, cameras in elevators to protect women from assault, cameras in every store to catch shoplifters. In isolation, each device performs a simple task. Combined, their data is a huge resource.

Facial recognition software is still in its infancy in the US, but is growing fast in China, where there are no privacy laws. Even when white males write most of the algorithms, the American software still struggles to accurately identify African American faces. But refinement is constant and accuracy is rising. Gait recognition is already in use, and has successfully prevented demonstrations from turning violent.

Surveillance is not a one-way street. Activists can also spy on the spies. A Russian organization tied to the groups that attacked America during the 2016 election has created a spy software called Monokle. This can be inserted into any Android phone, and perhaps into iPhones as well. It can make and record calls, gain access to any data, and allow one individual to take over another’s digital life. Monokle was re-released into the wild two years, and is now widely available.

Activists also have access to policing information courtesy of Google. They know that it is relatively easy to disguise your face or your gait. To counter this, the Pentagon has developed a heart recognition tool that can detect an individual’s heartbeat through clothes from 200 feet away. There is one obstacle to the tool’s viability: a database of cardiac signatures. Expect your pulse to be taken the next time you’re arrested, along with your ‘gait signature’.

Civil libertarians will complain but, as always, there will be a trade-off between private peace and intrusive policing. Already, attorney general William Barr has called for the installation of a backdoor into encryption software. The spread of warrant-proof encryption, Barr has said, is ‘already imposing huge costs on society’, by degrading law enforcement’s ability to detect and pre-empt criminality.

‘If,’ Barr said in July, ‘the choice is between a world where we can achieve a 99 percent assurance against cyberthreats to consumers, while still providing law enforcement 80 percent of the access it might seek; or a world where we have boosted our cybersecurity to 99.5 percent but at a cost of reducing law enforcement’s access to zero percent — the choice for society is clear.’

Barr is a leading advocate of preventive policing. His language marks a significant shift in how law enforcement see its role. The intelligence community used to spy overseas, looking for predictive intelligence to prevent a terrorist attack or a nuclear strike. At home, the police used to investigate crimes and arrest criminals. Now, with activists on the left and right gathering strength and technological capacity, Barr now advocates a huge shift towards a surveillance state that uses predictive policing against its own citizens. We are entering a different world. While the initiative rests with the light-footed agents of change, governments retain the crushing organizational power and budgets of the state. The first casualty of predictive policing is privacy. Will the second be democracy?