- Symptoms
- Asked agent mode to delete a single deprecated component (src/legacy/OldModal.tsx) and update its two import sites. The agent reasoned that src/legacy/ was 'no longer referenced' (it was — via a barrel file it didn't parse) and ran a recursive delete on the directory. 47 files gone. Checkpoint restore recovered the tracked files, but three files that existed only locally (untracked scratch work and a .env.development) did not come back. No confirmation prompt appeared before the delete because workspace-relative deletes were on the allowlist.
- Likely cause
- Two things compounding: (1) the agent's dead-code analysis doesn't follow re-exports through barrel files, so it wrongly concluded the directory was orphaned; (2) 1.18's default agent permissions treat `rm` inside the workspace as safe, and checkpoints only snapshot files the editor has seen — untracked-and-never-opened files aren't in any checkpoint.
- Affected versions
- 1.17.2 – 1.18.3 (permission default); misanalysis is model-dependent
- Environments
- Agent mode with default permission settings; React codebases with barrel-file re-exports
- Operating systems
- macOS, Windows
- Confidence
- Medium confidence
Update: Timeline had two of the three! The .env.development is gone for good but that's re-creatable from our vault. So final damage is one scratch file. Still furious about the default that let a recursive rm run without a prompt.