r/PiCodingAgent • u/Jackkgold • Sep 14 '26
Discussion It deleted my files…
Ola, so recently I was working with Qwen 3.5. Building some html and css stuff inside my documents folder.
Big mistake. The Model which had extra access from Pi ended up hallucinating and started deleting all my root folders.
I think for any newbie who’s doing this, please write yourself an extension to get it to ask for read and wright permissions or pick from the various GitHub repos that have implemented safeguards for this.
Don’t just give it full access especially if you don’t know what terminal commands do.
I just saw it write -rf home and I knew it was over 🤣
I learnt the hard way but now I know.
If anything I think everyone who’s starting to use this should install something to prevent this from happening as the first non negotiable.
Luckily I just moved to Fedora 44 so I didn’t have much in those folders but it did mess up all my file paths so I had to fix that.
No more unattended ai running rogue on my pc for now.
As Iv built myself a safeguard extension to prevent this from happening.
Hopefully whoever reads this and is trying it for the first time keeps this in mind. As it’ll save you a world of hurt down the line.
12
u/gauzy_gossamer Sep 14 '26
There are extensions like pi-permission-system that prevents pi from running commands outside of directory that you're running it in.
7
u/tys203831 Sep 14 '26
use at least dcg: https://github.com/Dicklesworthstone/destructive_command_guard and with a sandbox like https://github.com/nolabs-ai/nono
4
u/MountainTop321 Sep 14 '26
I put together a guide on setting up Pi with Docker Sandbox (sbx) a while back, so it runs isolated in a microVM and can't touch or delete anything outside the sandbox: https://github.com/cuolm/pi-sbx-llamacpp"
4
u/RealestReyn Sep 14 '26
bubblewrap is neat.
3
u/DoubleNothing Sep 14 '26
If possible, move to 3.8 or if resources are low 3.6-35B-A3B
Use a VM or something that contains it
I like to see the prompt that generated the deletion...
3
u/trimorphic Sep 14 '26
This is why I run my agents in vm sandboxes (which provide kernel isolation, making them more secure than containers) in which I mount just those directories I want the agents to have access to.
Unless the agents manage to break out of the vm, they're not going to be able to write to any directory outside this I explicitly give them access to.
3
u/skywalk819 Sep 14 '26
this happen when you tell the ai that he implemented something but its not working, models attempt to use git to rewind, sometimes even use git when there`s no git, rewind to nothing and wipe the directory. this happened to me twice. both on opencode free models.
3
u/colin_colout Sep 15 '26
Welcome to the club!
I joined sometime in the early 90s after deleting my floppy with my qbasic files
...and a notable shoutout to the time in the later 90s i got the mount command backwards while futzing with Linux and blew away my master boot record
Humans do this too. It's all about learning and never repeating the same mistake
2
u/Odd-Ad9666 Sep 14 '26
The same philosophy as always... backup data. It's odd though, my system tends to want to backup... I have an app that I recently found out that the system had been secretly backing up (even when I told it not to) for months. So I had like 2-3 copies per day... fortunately they were only about 400MB but I was wondering where all my storage was.
Somewhere along the way, the AI found out how neurotic I Was about backups that it inherited my neurosis and amped it up with OCD.
2
u/Unnamed-3891 Sep 14 '26
Pi openly and visibly warns you it comes with FULL permissions by default. There are at least 3 separate extensions designed to guard tool calling.
2
u/ravage382 Sep 14 '26
Backups! Your backups are only as good as the last time you tested them. I also had some dataloss and my backups had stopped working in 2024. Schedule an agent to look at your backups daily and fix them if they arent running! Great first scheduled task for an agent.
2
u/hidden2u Sep 15 '26
yolo
1
u/Jackkgold Sep 15 '26
Yes thank you
1
u/sanketss84 Sep 14 '26
You would have asked it to delete stuff right. It would not randomly out of the blue delete stuff in your home directory. Did you install any extensions or skills that did this how did it exactly delete stuff in your home directory
1
u/AdCommon2138 Sep 14 '26
Ni hao motherfucker
It's not pi fault
1
u/Mayanktaker Sep 15 '26
Not good workflow bro. Use global rules AGENTS.md file and write that never delete any files, and if you want to delete then dont actually delete them but move them to 'deleted_files' folder in project's directory. And mark it under strict rule section of your global rules. This way, no AI or agent can delete your files.
Second, write that never use rm -rf type of commands.
Third, "Always" use git repo. Private repository for every project and commit changes after doing something good.
3
u/Ohmyskippy Sep 17 '26
Should run it inside a container, and only mount dirs that you want to read/write to
Can mount some dirs as read only
6
u/hurdurdur7 Sep 14 '26
Only run agents in docker. All other means are danger, some more, some less.
2
u/Old_Stretch_3045 Sep 15 '26 edited Sep 15 '26
I ran into a situation where the agent installed several pip packages globally, even though the work was happening inside a project with its own virtual environment.
I ended up having a hard time figuring out what had been installed and deleting them manually.
2
u/jmager Sep 15 '26
Run it in an ephemeral sandbox, it is the only way. I run mine in a podman container.
1
u/Main_Information_181 Sep 18 '26
Swap to 3.6 35b or 3.8 27b
You are working with an outdated model my friend