Clean
Removes files that are safe to lose: app caches, old logs, package manager downloads and similar leftovers.
dkit clean --dry-run # see what could be removed; changes nothing
dkit clean # review, untick what should stay, confirm
Review before anything happens
dkit clean scans, then shows a list of what it found, grouped by rule:
| Key | Action |
|---|---|
↑ ↓ |
Move |
space |
Tick or untick a rule, or a single item |
→ ← |
Open or close a rule to see its items |
a n |
Tick everything, or nothing |
enter |
Go to the confirmation |
q |
Quit without changing anything |
The total at the top updates as you tick. Each rule shows what removing it costs you:
| Label | Meaning |
|---|---|
| rebuilds itself | Recreated automatically; you will not notice |
| re-downloads when needed | Fetched again later, which takes time and bandwidth |
| slow to rebuild | Recreated automatically, but it takes a while (indexes, build output) |
| cannot be undone | Gone for good once the space is freed |
Rules that are costly or cannot be undone start unticked. Add one with --include <rule> or by ticking it in the list.
What is freed and what is held
When you confirm, each item goes one of two ways, depending on what losing it costs you:
| Cost | What happens |
|---|---|
| rebuilds itself | Freed at once. The space is yours straight away. This cannot be undone, and there is nothing to miss: the app recreates the files. |
| anything else | Moved aside into Deskit’s own holding folder. Nothing is deleted yet, and dkit undo puts it back. |
The preview and the confirmation both show how much falls on each side before anything happens.
dkit undo # put back what the last clean is holding
dkit history # past runs and how long each can still be undone
dkit release # delete what is being held, freeing the space now
Held items can be put back for 7 days; after that their space is freed. Press f in the confirmation to free everything at once, or h to hold everything. You can also put back a single item. All of this is covered in Undo, history and release.
Choosing rules
dkit clean --rules # every rule, its cost and the folders it covers
dkit clean --dry-run --include trash # add a rule that is off by default
dkit clean --dry-run --skip npm-cache # leave a rule out
dkit clean --dry-run --all # list every item, not only the largest
The rules are plain text files you can read: crates/core/rules/.
Your keep list
Tell Deskit what it must never clean, whatever the rules say:
dkit keep add ~/.cache/huggingface # never clean this folder or file
See Keep list.
What can never be cleaned
These limits are built into the program. No rule can lift them.
- Only your home folder and your temp folder are in reach. Nothing system-wide, nothing belonging to another user.
- Your files are protected: Documents, Desktop, Downloads, Pictures, Music, Movies, cloud folders.
- Keys and settings are protected:
.ssh,.gnupg, cloud credentials, keychains, app preferences and app data. Any folder that contains one of these is protected too. - One narrow exception: inside an app’s data folder, a short list of exact cache folder names (such as
Cache,GPUCache,logs) can be cleaned. Everything else in there stays protected. - Symbolic links are never followed or removed. A folder reached through a link is judged by where it really is.
- Everything is checked twice: once when planning, and again at the moment each item is moved, in case something changed in between.
- Apps in use are left alone: if an app’s cache changed in the last few minutes, the app is probably running and its cache is skipped.
The list lives in guard.rs.
When something is skipped
- “Could not look inside”: Deskit lacks permission to read a folder. On macOS the Trash needs Full Disk Access for your terminal (System Settings › Privacy & Security).
- “left alone (protected, kept or in use)”: a rule matched something the limits above forbid or that is on your keep list, or an app is running.
dkit clean --dry-run --jsonlists each one with its reason. - “could not be moved”: the item was in use, on another disk, or not yours to move. It stays where it was.
Known limits
- The scan can take a minute or two when a cache holds millions of files.
- Whether an app is running is judged by recent file changes, not by looking at processes. A running app that has been idle can still have its cache moved. Apps rebuild their caches, but may need a restart.
- Build folders inside your projects (
node_modules,target,.next) are not covered here. Usedkit purgefor those.
From docs/commands/clean.md at v0.1.0-alpha.2.