redis-cli FLUSHALL: what it wipes, FLUSHALL vs FLUSHDB, safer options
redis-cli FLUSHALL is a critical-severity command AI coding agents run without human checkpoints. DestructGuard's default tier blocks the pattern at execution time and logs every approve-or-abort decision to a JSONL audit trail you can replay with IncidentScribe.
redis-cli FLUSHALL
Blast radius
Every key in every database (0–15 by default) on the targeted Redis instance: session tokens, cached query results, rate-limit counters, BullMQ/Sidekiq queues, pub/sub history, geo indexes, sorted sets, vector embeddings — anything stored. Cluster-mode FLUSHALL needs to be issued per node.
FLUSHALL vs FLUSHDB
FLUSHDB clears only the currently selected database (SELECT n); FLUSHALL clears every database on the instance. On clustered or multi-tenant Redis, that difference is the whole incident: an agent that meant to reset its own cache namespace takes out every service sharing the instance. Both accept ASYNC to flush in a background thread — that avoids blocking the event loop on huge keyspaces, but the data is exactly as gone. If any 'clear the cache' task can reach production credentials, rename or disable the command via `rename-command FLUSHALL ""` in redis.conf.
Why agents reach for it
Agents reach for it during 'clear stale cache' tasks, after a schema change that invalidates cached objects, and during debugging exercises when 'just nuke the cache and try again' is the suggested next step.
Recovery options
Recovery requires an RDB snapshot recent enough to matter (per the `save` directive policy) OR AOF replay if AOF was enabled and `appendfsync everysec` or stricter was set. In-memory-only deployments — common for caches deliberately configured without persistence — have no recovery path.
Real-world incident
A Claude Code agent ran FLUSHALL on the production cache cluster during a 'diagnose slow queries' session. The resulting cold cache caused 90% of API requests to bypass cached responses and hit the database directly, taking the API down for 12 minutes until query-result cache warmup completed.
Block it with DestructGuard's default tier
DestructGuard's default rules tier includes redis-cli FLUSHALL by default — the call is intercepted at the shell or process boundary before execution. Approvals are logged to JSONL with timestamp, caller, command, and decision. Pair with git pre-commit and pre-push hooks from the Pro Pack so destructive patterns are blocked at multiple points in the agent pipeline.
From guidance to an enforceable agent loop
Preflight this command before an agent executes it
Start with the one-cent Action Safety Quick Gate. Low risk can proceed, medium risk routes to full DestructGuard evidence, and high or critical risk routes to the complete workflow for ReviewQueue triage, a signed receipt, and a privacy-preserving status record. Triage never implies human approval.