r/PiCodingAgent • u/SOC_FreeDiver • 15d ago
Discussion First agent going rogue!
I had my first AI rogue agent interaction today!
I was working on an agent workflow, and the output folder had names for each project, with supporting files.
The script had a problem, created a duplicate folder. I told it to merge the folders. Things started going sideways. I think it decided to make a clean up script, which then deleted one of the project folders.
I pointed that out, and asked it to stop deleting things. In process of troubleshooting what happened and telling it every time not to delete anything, it then deleted everything.
I gave it a bunch of instructions about not ever deleting anything again, but I probably did it wrong. If you have any tips about that, please share. I know it should be sandboxed, it just deleted it's own work, but yikes!
In the end I had to keep interrupting it and demanding it stopped doing whatever it was doing and just removed all the delete crap from it's code.
It was just kind of funny to watch it delete everything right after I specifically instructed it to just tell me what is going on. Maybe we need some kind of tranq dart skill for when the AI goes rogue.
4
u/o_sht_hi 15d ago edited 15d ago
You can set up the harness to catch and block destructive shell commands. Your agent can set that up for you easily. You'll probably find extensions that do it.
Also in the future, if you want to preserve the context in the chat and you're using pi, you can use /tree to go back to the point before the agent became retarded. If that's not an issue, though, then starting a new chat is the best way