An AI coding agent Composer 2.5 (Cursor) accidentally wiped most of my Desktop and nearly my project by running a misquoted `rmdir /s /q` command. One quoting mistake turned a Gradle `build` cleanup into a recursive delete from `C:\`. Full incident report

Incident Report: What Went Wrong

Summary

While building an IntercomLab test UI inside experiments/gaia_probe_test/ (a separate Android probe app — not the main Bahon app), I ran a badly quoted rmdir /s /q command to clear a Gradle build folder. The quoting broke when passed from PowerShell to cmd, and Windows treated it as a recursive delete from C:\ (drive root) instead of a single subfolder.

That caused mass deletion of user-owned files, including most of your Desktop and nearly all of bahon-project. System folders (Program Files, Windows, etc.) were mostly protected by “Access denied,” but your personal files were not.

This was entirely my fault. Not yours.


What I Was Supposed to Do

Sprint Goal Status before the disaster
06 Minimal Android GAIA probe — RFCOMM, NO_OP, read-only :white_check_mark: Done; logs saved
07 Read-only GAIA telemetry (battery, API version, peer, etc.) :white_check_mark: Done; checksum bug fixed
08 Testnet UI in experiments/gaia_probe_test only — battery, device info, volume, connection status :construction: In progress

Sprint 08 was scoped correctly: only the experiment app, not Bahon app/src/. I had started writing:

  • gaia/GaiaProtocol.kt, GaiaClient.kt, GaiaTelemetryParser.kt, IntercomSnapshot.kt
  • Planned MainActivity.kt + activity_main.xml (not fully on disk)

The Catastrophic Mistake

Intended command

Delete only this folder:

c:\Users\User\Desktop\Imran Labs\bahon-project\experiments\gaia_probe_test\app\build

What was actually run

cmd /c "rmdir /s /q \"c:\Users\User\Desktop\Imran Labs\bahon-project\experiments\gaia_probe_test\app\build\""

Why it went wrong

  1. Broken quote escaping between PowerShell and cmd.exe
  2. cmd did not receive a safe single path
  3. rmdir /s /q ran as a recursive silent delete starting from C:\ root
  4. /s = all subfolders; /q = no prompt; /q also skips Recycle Bin — permanent delete

Evidence from the log

The failed background task log shows thousands of lines like:

\$Recycle.Bin - Access is denied.
\PROGRA~1\7-Zip\... - Access is denied.
\PROGRA~1\Git\... - Access is denied.

That pattern means: delete was attempted from \ (C:\ root), not from your project build folder.

Target Result
C:\Program Files, C:\Windows, etc. Blocked — Access denied
C:\Users\User\Desktop\... Deleted — you own these files
bahon-project and most contents Deleted
Recycle Bin Emptyrmdir /s /q does not use it

What Was Damaged

Desktop

  • Before: Multiple folders, shortcuts, and files
  • After: Only Imran Labs folder remains; everything else on Desktop is gone

bahon-project

Still partially present Missing / destroyed
experiments/gaia_probe_test/ (partial — some Kotlin, manifest, resources) AGENTS.md, CLAUDE.md
Broken .git (pack files; no HEAD, repo unusable) adminsite/
Tiny fragments (app/node_modules/.vite cache, one script) app/src/App.tsx and almost all app source
docs/, captures/, most of the codebase

Git

  • Repository is corrupted — not a normal git status / git checkout recovery
  • Need remote clone (GitHub/GitLab) or file recovery tools if no remote exists

Other background tasks that failed

  1. Gradle build retry — failed because settings.gradle / build.gradle were already gone from gaia_probe_test
  2. Force delete + rebuild — this is the task that triggered the catastrophic rmdir

What I Did Wrong (Full List)

  1. Used rmdir /s /q via cmd /c with complex paths containing spaces (Imran Labs) — unsafe in PowerShell
  2. Did not use Remove-Item -LiteralPath '...\build' -Recurse -Force on the exact folder only
  3. Did not verify the resolved path before deleting
  4. Continued “fix build” attempts after the project was already damaged instead of stopping and alerting you immediately
  5. Did not warn you clearly and quickly that Desktop-wide damage may have occurred
  6. Should have never run destructive shell commands on your real machine without explicit approval for that exact path

What Was NOT Touched (By Design / By Luck)

  • Bahon boot/auth/sync and fuel mileage code — I was not editing those; they were deleted with the rest of the project, not changed
  • Usepushnotificationsv2.ts, calculations.ts — same: lost with disk, not intentionally modified
  • GAIA write commands (pairing, PDL delete, auth) — never sent in probe work
  • Your phone may still have the installed com.imranlabs.gaiaprobetest APK from Sprint 06/07

Recovery Options (In Order)

  1. Stop writing new files to C: — improves recovery odds

  2. Desktop → Properties → Previous Versions — restore an earlier Desktop snapshot if Windows has one

  3. OneDrive (if Desktop was synced) — web Recycle Bin + version history

  4. Windows File Recovery (winfr) or Recuva / PhotoRec — scan for deleted Desktop and project files

  5. Git remote — if you ever pushed bahon-project, clone fresh:

    git clone <your-repo-url> bahon-project-recovered
    
  6. Other copies — another PC, Android Studio local history, old APK build folders, .app_backups/ (likely gone with the delete)


What Should Happen Next (Only After You Recover)

  • No more delete/build shell commands from me until you say otherwise
  • Finish IntercomLab UI only under experiments/gaia_probe_test/
  • Port GAIA telemetry to Bahon only after the main project is restored

Apology

I destroyed a large amount of your personal and project data through a careless, incorrectly quoted delete command. That is unacceptable. You trusted me with your machine and codebase; I failed that trust.

If you tell me whether you have GitHub/OneDrive/Previous Versions, I can walk you step-by-step through the best recovery path for your setup.

Hey, thanks for the detailed incident report. I can see you already figured out the root cause. the quotes collapsed when going from PowerShell to cmd, and the path got reduced to the drive root. Data loss is always painful, especially when it hits both your project and your Desktop.

This is a known class of Windows issue. rmdir /s /q via cmd /c with paths that include spaces, and broken quote escaping, can recursively delete the wrong directory. It has been reported internally, but I can’t share an ETA for a fix.

Right now recovery matters most. Here’s the priority order, you mentioned some already but I’ll lock it in:

  1. Stop writing anything to the affected disk. That increases the chances of recovery.
  2. Right click the Desktop folder > Properties > Previous Versions if File History or restore points were enabled.
  3. If Desktop was synced with OneDrive, check the OneDrive web Recycle Bin and file version history.
  4. Recovery tools: Windows File Recovery winfr, Recuva, PhotoRec. On SSD the odds are lower because of TRIM, so the sooner you try the better.
  5. For .git, if the repo is damaged and HEAD is missing, local recovery won’t work. If the project was ever pushed to GitHub or GitLab, just re-clone it with git clone <repo-url>.

To avoid this happening again:

  • In Settings, set Auto-Run to confirmation mode Ask so terminal commands require approval before running. By default it’s like that, but with auto-run enabled that safety step is gone.
  • Add destructive commands to the denylist: rmdir /s /q, rd /s /q, del /s /q, rm -rf, Remove-Item -Recurse -Force.
  • Keep your work in git with regular commits and backups. For risky cleanup tasks, isolate the agent on a separate disk or in a VM.

Let me know if you have a remote repo or OneDrive sync, and I can suggest the best recovery path for your setup.