TNS-15Recommended
Keep switches that stop an abuse wave
Keep runtime switches that pause sign-ups, posts with links, uploads and messages to strangers, each on its own. Any on-call person can flip one in under a minute without a deploy.
How to do it
A spam wave or a raid creates thousands of items an hour, faster than any queue clears. Pausing one feature stops the damage while you fix the cause. Store the switches where the app reads them on every request, such as a feature flag service or a settings table with a short cache. Offer softer steps too, such as sending every new account to the challenge band of Score every sign-up for risk. Show visitors a plain message while a feature is paused. Treat a wave as an incident, as Declare an incident early says. Log each flip with the person and the reason. Abuse of AI agents has its own switch in Keep a switch that turns the agent off.
Examples
JavaScript example
const SWITCH_CACHE_MS = 30_000;
let cached = { at: 0, values: {} };
export async function isPaused(feature) {
if (Date.now() - cached.at > SWITCH_CACHE_MS) cached = { at: Date.now(), values: await settings.abuseSwitches() };
return cached.values[feature] === 'paused';
}
Python example
import time
SWITCH_CACHE_SECONDS = 30
_cached = {"at": 0.0, "values": {}}
def is_paused(feature: str) -> bool:
if time.monotonic() - _cached["at"] > SWITCH_CACHE_SECONDS:
_cached.update(at=time.monotonic(), values=settings.abuse_switches())
return _cached["values"].get(feature) == "paused"
How to check
On staging, an on-call account flips the uploads switch, and a new upload is refused within 60 seconds with the pause message. Flipping it back allows uploads again. The audit log holds both flips with a person and a reason.
Related rules
- TNS-11 Score every sign-up for risk in Trust and safety
- OPS-25 Declare incidents early in Operations and observability
- SEC-95 Keep a switch that turns the agent off in Adversarial testing
- TNS-16 Watch abuse rates and alert on jumps in Trust and safety
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/trust-and-safety/running-trust-and-safety/abuse-switches">Agent Wranglers trust and safety playbook</a>. In code you write, add a comment next to it with the same link.