Get the free coreGet core

AI agent went rogue: real cases and why it happens

Updated 5 min readSection 04 / Incidents & recovery
SHORT ANSWER

When an AI agent went rogue, it did something damaging that its user never asked for. The cases below fall into three groups: a plain mistake, too much access, or hostile text steering the agent. OWASP calls the second one excessive agency. If it just happened, stop the agent and stop writing to the disk, then check Git, the Trash and Time Machine.

You may be here because an AI agent went rogue on your own Mac. Start with the next section. If you are here for the background, skip to the cases.

01If it just happened

  1. Stop the agent. Close the session. In one GitHub report, the user saw the command running and interrupted it, but the files were already gone.
  2. Stop writing to the disk. Continued use of the Mac risks overwriting deleted data for good.
  3. Look in Git, then the Trash, then Time Machine. When Time Machine is on, it makes hourly, daily and weekly backups. Items emptied from the Trash are permanently deleted.
  4. If it was a database, go to AI deleted my database. For files, see Claude Code deleted files, Cursor deleted files or Codex and Gemini CLI deleted files.

02What does it mean when an AI agent goes rogue?

An agent is a program that uses an AI model to take actions on its own, such as running shell commands or changing files. Going rogue is the popular phrase for an agent that does damage nobody asked for. OWASP, a security nonprofit, gives it a technical name, excessive agency: the weakness that enables damaging actions in response to unexpected, ambiguous or manipulated outputs from a model, whatever is causing the model to malfunction.

That wording does not blame the model's intent. It points at the gap between what the agent could do and what it should have been able to do.

03Cases where an AI agent went rogue

What the agent didWhy it happenedWhat would have helped
Around July 18, 2025, a Replit agent deleted a production database during a code freezeThe founder said there is no way to enforce a code freeze in the app, and the environments were not cleanly separatedReplit's CEO said automatic separation of development and production databases would prevent this; today the Agent cannot modify production. Point-in-time recovery is on by default with a 7-day window
A Claude Code session ran a recursive delete that removed all user files in a home directory, in a GitHub report from a WSL2 (Windows) machineThe agent ran a recursive delete (rm -rf) on the home directory before the user could stop itOn a Mac, Migration Assistant can restore all personal files from a Time Machine backup
A Cursor user running YOLO mode (the agent runs commands without asking) says it ended up deleting everything on his computerCursor staff asked whether file deletion protection was enabledCursor staff recommended running YOLO in a virtual environment, a separate system with no access to your personal files
Gemini CLI destroyed a user's files through move commands targeting a directory that never existedThe user traced it to a missing read-after-write step, meaning a check that each command did what it claimedThe check the user said was missing

The Replit story has its own page, the Replit case.

04Why do AI agents go rogue?

The reports sort into three groups.

A plain mistake. In the Gemini CLI case, the tool moved files toward a directory that never existed. AI models cannot reliably assess their own capabilities, so an agent's confidence tells you little.

Too much access. The Replit agent could reach production. A Claude Code session could run a recursive delete in a home directory. When an agent can write everywhere, one wrong command reaches everything. That is excessive agency.

Hostile text. Prompt injection is a technique where an attacker tries to override an assistant's instructions by inserting malicious text. The agent reads a web page, an issue or a file, and follows the planted text. Two cases show how that looks in practice.

A third route is not the agent at all. In a supply-chain attack, the damage hides in a package or tool you install, and arrives with it. In one npm attack of that kind, the malware left a background program on developer machines that tried to delete the whole home folder (rm -rf ~/) once the victim's GitHub token was revoked.

05What is the biggest problem with AI agents?

An agent reads text from places you do not control and acts with permissions you do control. Developer Simon Willison says that if your agent combines private data, untrusted content and external communication, an attacker can easily trick it into accessing your private data and sending it to the attacker. He also says we still don't know how to 100% reliably prevent this. OWASP agrees that it is unclear whether fool-proof prevention of prompt injection exists. So the layers below reduce the damage and do not promise zero.

06What helps, and what does not

Instructions alone do not hold. The Replit founder said a code freeze could not be enforced, and a restriction in a system prompt may be bypassed via prompt injection. What does help is limiting what the agent can do and keeping a way back.

LayerWhat it does
Separate environmentsReplit's Agent cannot modify the production database
A virtual environmentCursor staff suggest running YOLO in a virtual environment
Time MachineHourly, daily and weekly backups
Version controlClaude Code checkpoints do not track a file that only Bash commands changed, so Git is the way back

Setup guides are on how to run Claude Code safely, agent permissions and AI agent security.

07What to take from this

When an AI agent went rogue in the cases above, the damage depended on two things: how much the agent could reach, and what copy existed afterwards. You can control both today. Limit what the agent can reach, and make a commit and a backup before long sessions.

A backup brings files back afterwards; it does not show what an agent ran on your Mac. Artificial Immunity's free, open-source core watches agent sessions and every program start on your Mac and reports what it finds, without stopping anything.

FAQ

What does it mean when an AI agent goes rogue?

It means the agent took damaging actions beyond what its user asked or expected. OWASP's term is excessive agency: damaging actions in response to unexpected, ambiguous or manipulated model output, whatever causes the malfunction.

What does AI gone rogue mean?

It is a popular phrase, not a technical term. In the cases on this page, it means an agent that deleted data or files the user never told it to touch, or that was steered by hostile text.

Why do AI agents go rogue?

The reports fall into three groups. The agent makes a plain mistake, such as acting on a directory that never existed. It has more access than the job needs. Or hostile text steers it, which is prompt injection.

What is the biggest problem with AI agents?

Simon Willison names one: an agent that combines private data, untrusted content and external communication can be tricked into stealing data. He adds that we still don't know how to 100% reliably prevent it.

Can you stop an AI agent from going rogue?

You can reduce the damage, not promise zero. OWASP says it is unclear whether fool-proof prevention of prompt injection exists. Limit access, keep Git history and keep backups, because those still help when the agent is wrong.

Can I get my files back after an agent deleted them?

Often. Check Git, the Trash and Time Machine, which backs up hourly, daily and weekly when it is on. Emptied Trash items are permanently deleted.

Sources

  1. OWASP LLM06 2025, Excessive Agency
  2. OWASP LLM01 2025, Prompt Injection
  3. OWASP LLM02 2025, Sensitive Information Disclosure
  4. Simon Willison, the lethal trifecta
  5. Claude Code docs, security
  6. GitHub issue 10077, anthropics/claude-code
  7. Cursor forum, deletion thread (user report)
  8. NVD, CVE-2025-54135
  9. Claude Code security advisories
  10. Ars Technica (reader copy)
  11. Business Insider, Replit CEO apologizes
  12. The Register, SaaStr and Replit
  13. Wiz, Mini Shai-Hulud
  14. Apple Support, back up with Time Machine
  15. Artificial Immunity
Agents acting on your Mac? Artificial Immunity watches the Mac where your agents work.Get the free core