It may not have occurred to people that New York City needed to deploy an undercover detective to spy on Occupy Sandy, a relief operation run by activists that delivered food and supplies to parts of the city ruined by the hurricane. But Detective Wojciech Braszczok, who embedded with the Occupy Wall Street forces under the nom de activist Albert, was putting posts on Twitter last November about the Sandy operation, which, by the way, received consistently high grades from people for its nimble, effective work.

The city now has a sturdy legion of undercover officers who have taken up residence in many surprising regions of civic life. Much of this began in early 2003, when a federal judge lifted many restraints on spying by the Police Department. The city had been failed by the federal intelligence services, and thousands died on Sept. 11. Police Commissioner Raymond W. Kelly and Mayor Michael R. Bloomberg created an independent intelligence capacity.

So before and during the Iraq War, the organization of antiwar rallies was regarded as a fit matter for police surveillance; so were the monthly Critical Mass bicycle rallies, as well as groups protesting at the Republican National Convention in 2004, and a range of Islamic facilities, from mosques to college student clubs. Undercover New York police officers showed up at activists’ meetings all over the country, carrying guitars and knapsacks. Handlers left money for them in the wheel wells of cars. Field reports were stamped “NYPD Secret.” Anyone who left a scrap of paper on the desk at the Intelligence Division’s headquarters in Chelsea was apt to get his or her knuckles rapped by the commander, a former Central Intelligence Agency man who brought that agency’s custom of fastidiousness to the mess of the city.

The unrestrained surveillance in New York public life is the physical embodiment of what has been taking place online over the last decade under operations of the National Security Agency revealed by Edward J. Snowden. To borrow the title of a 1918 novel about nosy Irish villagers, we have become The Valley of the Squinting Windows.