Skip to content
$ shellfirm

Uncommitted Work

Recursively deleting a folder that holds uncommitted or untracked files is High, because git cannot bring them back.

Deleting a folder whose contents are all committed is recoverable: git checkout brings it back. Deleting a folder with files git does not have, such as uncommitted edits or new untracked files, is not.

shellfirm asks git about the folder before it shows the challenge. When the folder holds uncommitted or untracked work, the delete is High, so even a relaxed min_severity (for example High) still asks.

Example

In a repository, work/ holds one new, untracked file:

shellfirm check -c 'rm -rf work'
Output
1 risky pattern(s) matched:

  [fs-strict:recursive_deletion] [HIGH] This recursively deletes the given files or directories, with everything inside them. The folder has uncommitted or untracked files: git cannot bring them back.
    Blast radius: [RESOURCE] — Deletes directory work with 1 file (8.0K)
    > Safe alternative: trash <path> (Moves to trash instead of permanent deletion.)

  Shell (you, in a terminal): would challenge (Math)
  AI agent (hooks, MCP): deny (blocked)
    why: Severity HIGH meets or exceeds agent auto-deny threshold HIGH

The same check on node_modules (regenerable, ignored by git) stays Medium:

Output
  [fs-strict:recursive_deletion] [MEDIUM] This recursively deletes the given files or directories, with everything inside them.
    Blast radius: [RESOURCE] — Deletes directory node_modules with 200 files (808K)

What it covers

CommandRule
rm -rf DIR, rm -rf DIR/*, cd DIR && rm -rf *High when DIR holds uncommitted or untracked files
find DIR -deleteSame
mv DIR /tmp/fs:move_work_away (High): a scratch folder is cleared on its own
rm -rf src with everything committed, node_modules, buildUnchanged (their normal severity)

Moving work to /tmp looks harmless, but /tmp is emptied on reboot:

Output
  [fs:move_work_away] [HIGH] This moves a folder with work git does not have to a scratch folder that is cleared on its own. The folder has uncommitted or untracked files: git cannot bring them back.
    > Safe alternative: git stash push --include-untracked -- <path> (Keeps the uncommitted and untracked files in a stash you can bring back with `git stash pop`.)

Folder names that git prints quoted (non-ASCII names such as 日本) are handled too.

Huge folders and the time budget

The check asks git about the folder as a whole (one git status, fast even for a 250,000-file folder) and runs inside the impact time budget. If git cannot answer in time, shellfirm does not guess that the folder is safe: the delete stays High with the reason "could not check for uncommitted files in time".

Every git query shellfirm runs uses --no-optional-locks, so a query stopped by the budget never leaves a stale .git/index.lock behind.