#Republic: Divided Democracy in the Age of Social Media. By Cass Sunstein. Princeton University Press; 310 pages; $29.95 and £24.95.

LAST June Facebook announced a change to its newsfeed. Henceforth it would rejig the way stories were ranked to ensure that people saw “the stories they find most meaningful”. But what does “most meaningful” actually mean? Posts from family and friends, apparently, as well as those users you frequently “like”. Your newsfeed should be “subjective, personal and unique”, Facebook went on, promising to work on building tools to give users “the most personalised experience”.

Cass Sunstein, a law professor at Harvard University and Barack Obama’s former regulation tsar, is one of Facebook’s dissatisfied customers. “Facebook can do better,” he writes in “#Republic”, his new book about democracy in the age of social media. Mr Sunstein is disturbed by some aspects of ultra-customised information, yet he shows himself a master of restraint in his criticism. He clearly wants to influence Mark Zuckerberg and other tech titans without alienating them. Although Mr Zuckerberg dropped out of Harvard, perhaps he can still pick up the occasional book by a Harvard professor—along with his new honorary degree.

In some ways, “#Republic” is a kind of Democracy 101, a review of the basic requirements for those who may have skipped the course. These requirements include, among other things, that citizens be exposed to a wide range of ideas and perspectives—even, and especially, those they would not choose to see or hear. Unplanned, chance encounters—with a protest as one wanders down the street, or a competing argument aired on the evening news—help guard against “fragmentation, polarisation and extremism”. They ensure that people are not hearing only an echo of their own voice. They reduce the likelihood that people will be stirred to extremes, such as terrorism. And they promote shared information and experiences, making it easier to solve problems and govern in a heterogeneous society.

This is the positive side of the free- speech principle, Mr Sunstein writes. It means not only forbidding censorship, but also creating a culture where people engage with the views of fellow citizens.

In the digital age social media function as the public forums where ideas are exchanged. But when people filter what they see—and providers race towards ever greater “personalisation” in the name of consumer choice—democracy is endangered. People live in separate worlds. Even hashtags, meant to help users find information on a certain topic, lead them to different bubbles. Democrats use #ACA and #blacklivesmatter; Republicans use #Obamacare and #alllivesmatter. Partyism might be said to exceed racism in America, Mr Sunstein argues. Whereas in 1960 only 5% of Republicans and 4% of Democrats said they would be “displeased” if their child married outside their political party, by 2010, those numbers had reached 49% and 33%, a far higher percentage than those who would be “displeased” if their child married outside their race.

Mr Sunstein wants an “architecture of serendipity” to combat these forces: that is, media that promote chance encounters and democratic deliberation like the public forums of old. Facebook might design “serendipity buttons”, he suggests, allowing users to click for opposing viewpoints or unfiltered perspectives. Conservative news sites could feature links to liberal sites and vice versa, alerting people to material beyond their usual sources. A site like deliberativedemocracy.com—the domain is not yet taken—could offer a space for people of divergent views to discuss issues. Democracies should take their cue from Learned Hand, an American judge who said the spirit of liberty is that “spirit which is not too sure that it is right”.

It is not just up to Mr Zuckerberg, then, to foster a culture of curiosity and openness. Citizens must demand it, Mr Sunstein argues, and they must seek out those serendipitous encounters. “#Republic” is full of constructive suggestions. It should be required reading for anyone who is concerned with the future of democracy—in Silicon Valley and beyond.