• The problem. Mint deleted the same node_modules folder 11 times in three days, and it came back every time. It also deleted 35.4 GB of AI models, and 34.3 GB were downloaded again.
  • What we found. Our rule only asked whether a folder could be rebuilt. The project was in use, so the 7.68 GB those removals freed all came back and the net gain was zero.
  • What we built. Models now have their own chip in Safe to clean and are never ticked for you. A node_modules used in the last seven days goes to Keep, since Mint 1.0.91.

Deleting a node_modules folder is safe in one sense: nothing is lost, because npm ci puts it back from the lockfile. Whether it frees any space depends on whether the project is still in use. Ours was. Between September 29 and October 2, Mint deleted the same node_modules folder 11 times, and it came back every time, five times within 20 minutes. Over the same three days Mint deleted 35.4 GB of downloaded AI models, and 34.3 GB of them were downloaded again.

This is a record of our own cleanup tool asking the wrong question. It asked whether the folder could be rebuilt, when what mattered was whether something would rebuild it within the hour.

The folder

The folder belongs to the project we use to make our videos. A render needs it: 334 MB of packages, plus 197 MB of headless Chrome that the video tool downloads the first time it renders, plus 176 MB of render cache. About 730 MB in all.

Mint listed it in Safe to clean because it met the rule we had then: a node_modules folder with a lockfile next to it can be reinstalled. That rule said nothing about when the project was last used. Since late September, Safe to clean opens with every row ticked, so the folder arrived ticked each time someone opened it.

Eleven removals

Every removal was a clean someone started by hand in Mint's Disk page, and every one was permanent. None came from Auto Care. Times are Pacific:

removed        installed before   back after
Sep 29 23:31   8h 20m             11m
Sep 30 12:15   12h 32m            2h 18m
Sep 30 14:42   9m                 13m
Sep 30 18:47   3h 53m             2h 9m
Oct 1  00:39   3h 42m             17m
Oct 1  12:49   11h 53m            4h 39m
Oct 1  18:01   33m                12m
Oct 1  21:48   3h 35m             1h 43m
Oct 2  00:40   1h 9m              13h
Oct 2  14:12   33m                19m
Oct 2  15:51   1h 19m             6h 7m

"Installed before" is how long the folder had existed since the reinstall before it; "back after" runs to the next reinstall. The median folder was 3 h 35 min old when it was deleted, and the median wait before it came back was 1 h 43 min. One was nine minutes old.

The 11 removals freed 7.68 GB. All of it came back, so the net gain was zero. Each reinstall was quick, 4 to 11 seconds for 257 packages, but it wasn't free. Mint was also deleting npm's own download cache in the same cleans, so reinstalls fetched packages from the registry again: 74 MB the one time we measured it. The one render log we have shows another 94 MB of headless Chrome downloaded again.

The last removal came 28 minutes after we committed a fix for this. The copy of Mint on that Mac didn't have it yet.

The models

The same cleans removed the Hugging Face cache, where Python tools keep downloaded models. In our case it held the three models our video pipeline uses for the voice and the captions: VoxCPM2 (about 5 GB), SenseVoiceSmall (0.9 GB) and wav2vec2-base-960h (0.4 GB).

From September 29 to October 1, Mint removed the whole folder six times and the three model folders once more, 35.4 GB in all. By October 3, 34.3 GB had come back. The downloader's own logs account for 12.6 GB of that, about 17 minutes of downloading; the rest we infer from the folder's size before the next removal. Mint's records show this folder had been removed 10 more times since August 16.

A model is not a cache in the usual sense. Getting it back means a multi-gigabyte download, and the tool that needs it fetches it the next time it runs, without asking.

What "in use" turned out to mean

Checking whether a program has the files open wouldn't have helped. npm and the video tool open them for seconds and close them again. Between renders nothing holds them, and that's when the cleans ran.

The signals that would have worked are all on disk:

  • When it was installed. npm writes node_modules/.package-lock.json at every install.
  • When the project was last run or edited. The video tool writes its caches into node_modules (.remotion, .cache) each time it renders, and editing the project writes its own files.
  • Whether it came back. After the first removal, the folder's own history already said: deleted, then created again 11 minutes later.

How to check your own projects

This lists each node_modules under a folder, its size and when npm last installed it. It only reads. Change ~/Projects to wherever you keep code:

find ~/Projects -maxdepth 4 -type d -name node_modules -prune |
while read -r d; do
  f="$d/.package-lock.json"
  [ -f "$f" ] && t=$(stat -f %Sm -t %Y-%m-%d "$f") || t="unknown   "
  printf "%6s  installed %s  %s\n" "$(du -sh "$d" | cut -f1)" "$t" "${d%/node_modules}"
done

A folder installed this week belongs to a project in use, and deleting it buys you nothing but a reinstall. One installed months ago, in a project you've stopped working on, is the kind worth removing. "unknown" means npm didn't write the file (Yarn and pnpm keep their own), so check the project's last commit instead. Our guide to removing old node_modules covers the lockfile checks before you delete.

What Mint does now

  • Models have a chip of their own in Safe to clean, one row per model with the date it was last used. They're never ticked for you, Auto Care never takes them, and a model a program has open, or LM Studio or Ollama is running, isn't offered. This shipped in Mint 1.0.82 on October 2.
  • node_modules of a project used in the last seven days goes to Keep, with the date. "Used" means installed, run or edited, or a program working inside the project. A folder that was deleted and came back is listed but never ticked for you, and Recommended and Auto Care skip it. The click checks again. This shipped in Mint 1.0.91 on October 9.

Questions

Is it safe to delete node_modules? Nothing is lost if the project has a lockfile and every package can still be downloaded. If you'll work on the project again soon, you get the space back for a few minutes and pay with a reinstall.

Why not just skip every node_modules? Folders in projects nobody has touched in months add up. On this Mac they're the ones worth deleting, and they're easy to tell apart from the ones in use.

Does this apply to other caches? Anything a tool fills again on its own behaves the same way. Of the 11 cleans that took this node_modules, all 9 we have full records for also emptied npm's download cache, and the next install downloaded it again.