What explains undercover operations in the repression of protests? The use of undercover agents to infiltrate and repress protests is highly controversial, yet their operations remain poorly understood. This research examines how the spatial characteristics of protests shape undercover agents’ use of violence. We argue that undercover officers, typically lightly armed and operating in small units to avoid detection, must balance their objective to disrupt dissent against the risks of acting within dense assemblies, where arrests can provoke violent clashes and endanger officers’ safety. As a result, they tend to remain passive observers and intervene only when protesters are few in number and spatially isolated, giving them a tactical advantage to arrest targets without triggering mass confrontation. Analysis of unique data from Hong Kong’s largest anti-government protests (2019–20) supports these expectations: undercover officers are more likely to make arrests in locations where protesters are isolated, distant from main protest crowds or gathered in confined environments such as indoor spaces, where crowd density is low. The findings offer new insights into how covert infiltration fits within broader strategies of state coercion.