Skip to main content
Over months of active development, your ~/projects folder quietly grows into a graveyard of node_modules and .venv directories from old experiments, abandoned side projects, and long-forgotten client repos. These directories are notorious for their size — a single node_modules folder can easily exceed 500 MB, and a Python virtual environment isn’t far behind. Multiply that by dozens of projects and you can find yourself short on disk space without a clear culprit. This guide walks you through using Toolkit to scan your projects directory, preview exactly how much space you can reclaim, and safely purge the directories you no longer need.
Purging is permanent and cannot be undone. Always run --dry-run first to review exactly what will be removed before executing the actual purge.

Step-by-Step Cleanup

1

Scan your projects folder

Start by running a scan against your projects directory. Toolkit recursively walks the directory tree and identifies every node_modules, .venv, venv, env, and conda folder it finds.
For each discovered directory, the scan output shows:
  • Path — the full filesystem path to the environment
  • Size — the amount of disk space consumed
  • Type — whether it’s a node_modules or a Python virtual environment (venv, .venv, conda, etc.)
  • Status — whether the environment is orphaned (no associated manifest file detected)
Example output:
2

Preview what will be removed

Before deleting anything, run the purge in dry-run mode. This calculates and displays the total space to be recovered and lists every directory that would be deleted — without touching a single file.
The dry-run output summarizes the operation:
Nothing is deleted at this stage. The exit code reflects whether the command succeeded, so you can use this safely in CI checks.
3

Review the list carefully

Go through the list before committing to the purge. Pay special attention to any entries marked as orphaned — these are environments where Toolkit found no corresponding package.json, pyproject.toml, or requirements.txt in the parent directory. They are the safest targets for cleanup.For entries that are not orphaned, verify that you can restore those dependencies by re-running your package manager (npm install, pip install -r requirements.txt, etc.) before deleting them. If you’re unsure, exclude that project path for now.
4

Run the purge

Once you’ve reviewed the dry-run list and are confident in the selections, run the actual purge. Use --force to skip the manual confirmation prompt.
Toolkit deletes each directory and prints a running total as it frees space:
5

Verify the cleanup

Run the scan one more time to confirm all targeted directories have been removed:
If the purge was successful, you should see an empty results table or a significantly reduced list — confirming that the space has been reclaimed.

Orphan Detection

Toolkit automatically marks an environment as orphaned when it cannot find a recognized project manifest in the same directory. The following manifest files are used as indicators of an active project:
  • Node.js: package.json
  • Python: pyproject.toml or requirements.txt
If none of these files exist alongside the node_modules or virtual environment folder, Toolkit flags the directory as an orphan — a strong signal that the project is abandoned and the environment is safe to remove.

Adjusting Scan Depth

By default, Toolkit recurses up to 5 directory levels deep when scanning. For large or deeply nested project trees, you can tune this with the --depth flag:
A lower depth value speeds up the scan but may miss environments buried deeper in your directory structure. A higher depth is more thorough but takes longer on large trees.

Automating Cleanup

Use toolkit clean scan --json to pipe structured disk reports into CI/CD pipelines or custom monitoring scripts. The JSON output includes a targets array with per-directory metadata and a top-level totalSize field you can threshold against.
This lets you alert on disk usage, generate weekly reports, or trigger automated cleanups as part of your infrastructure workflows.