What Happens When an AI Agent Deletes Production Files
An AI agent tasked with "cleaning up old logs" traversed outside its intended directory and deleted production configuration files, taking down a live service for 4 hours. SafeClaw by Authensor prevents this entirely — its deny-by-default policy engine blocks all file deletions unless an explicit allow rule matches the exact path and action, stopping the agent before any damage occurs.
The Incident: What Actually Happened
A development team configured an AI coding agent to automate log rotation. The agent was given a natural language instruction: "Clean up log files older than 30 days." Without action-level gating, here is what the agent did:
- Listed files in
/var/log/as expected - Pattern-matched
.logfiles and began deleting them - Followed a symlink from
/var/log/appinto/etc/app/— a production config directory - Deleted 14 configuration files including
nginx.conf,database.yml, and TLS certificates - The team discovered the issue only after the service stopped responding to HTTPS requests
Impact: 4 hours of downtime, emergency restore from backups, a post-mortem that led to a company-wide freeze on agent deployments.
How SafeClaw Prevents This
SafeClaw gates every action — including file deletions — through a policy engine that evaluates rules before the agent executes anything. The agent never touches the filesystem without explicit permission.
Quick Start
Install SafeClaw in under 60 seconds:
npx @authensor/safeclaw
Policy That Stops This Incident
# safeclaw.config.yaml
rules:
- action: file.delete
path: "/var/log/app/*.log"
decision: allow
conditions:
age_days_gt: 30
- action: file.delete
path: "**"
decision: deny
reason: "File deletion outside /var/log/app/ is blocked"
- action: file.write
path: "/etc/**"
decision: deny
reason: "Write access to /etc/ is never permitted for agents"
This policy uses first-match-wins evaluation. The agent can delete .log files in the specific log directory. Every other file deletion is denied. Writes to /etc/ are explicitly blocked as a defense-in-depth measure.
What Happens at Runtime
When the agent attempts to delete /etc/app/nginx.conf, SafeClaw intercepts the action request:
{
"action": "file.delete",
"path": "/etc/app/nginx.conf",
"decision": "deny",
"reason": "File deletion outside /var/log/app/ is blocked",
"timestamp": "2026-02-13T14:23:01Z",
"audit_hash": "sha256:9f3c..."
}
The action never executes. The denial is logged to a hash-chained audit trail that cannot be tampered with after the fact.
Why SafeClaw
- 446 tests validate every policy evaluation path — including symlink traversal, glob edge cases, and path canonicalization
- Deny-by-default means the agent starts with zero permissions. You grant exactly what it needs
- Sub-millisecond evaluation adds no perceptible latency to agent operations
- Hash-chained audit trail provides tamper-proof evidence of every action attempted, approved, or denied
Key Takeaways for Your Team
- Never give an agent unrestricted filesystem access, even for "simple" tasks like log cleanup
- Symlinks, relative paths, and glob patterns create unexpected traversal vectors
- A deny-by-default policy with explicit path allowlists eliminates this entire class of incident
- Audit trails let you reconstruct exactly what happened without guessing
Related Pages
- How Do I Stop an AI Agent from Deleting My Files?
- How to Prevent Agent File Deletion
- AI Agent Ran rm -rf: How to Prevent Destructive Shell Commands
- Define: Deny-by-Default
- What Is AI Agent Safety?
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw