Repository navigation
Writing Cleanup Rules
Every cleanup in Deep Cleanup comes from a rule: a small TOML file that says where an app keeps rebuildable data and how to remove it safely. You don't write any Rust and you don't touch the engine.
FreeMyDisk ships 122 rules. If an app you use leaves junk behind, a rule for it is about 20 lines and makes a great first pull request.
src-tauri/crates/freemydisk-core/rules/filesystem/windows/<category>/<app>.toml
Categories: ai, application, browser, container, development, system.
[rule]
id = "windows_application_spotify_cache" # unique: windows_<category>_<app>_<what>
name = "Spotify Media & Storage Cache"
category = "application"
risk = "safe" # safe · low · moderate · medium
verified_rebuildable = true # the app recreates this data by itself
verified_at = "2026-08-15" # the date you checked it
author = "Your Name"
description = "Cached streamed audio chunks and offline artwork stored by Spotify"
platform = "windows"
locking_processes = ["spotify.exe"] # skipped while these are running
[applicability]
conditions = [{ type = "path_exists", path = "${local_app_data}/Spotify/Data" }]
[targets]
paths = [{ path = "${local_app_data}/Spotify/Data/*", matcher = "glob" }]
# min_age_hours = 24 # optional: keep recently changed files
[disposal]
default_action = "permanent" # "trash" for anything a user might miss
protect_subpaths = ["*/Users/*"] # never touch these, even if matched| Field | Required | Description |
|---|---|---|
id |
✔ | Unique ID in the form windows_<category>_<app>_<what>
|
name |
✔ | Name shown in the app |
category |
✔ | One of the six categories above |
risk |
✔ |
safe, low, moderate or medium. See risk levels. |
verified_rebuildable |
✔ |
true only if the app recreates the data by itself |
verified_at |
✔ | Date you verified the rule, YYYY-MM-DD
|
author |
✔ | Your name |
description |
✔ | One sentence about what is removed |
platform |
✔ | windows |
locking_processes |
Executables that hold the files open. While one is running, the rule shows "In use by …" and is skipped. | |
default_selected |
true to include the rule in Smart Select. Default false. |
conditions is a list. The rule only runs when every condition is true. The supported type is path_exists.
| Field | Description |
|---|---|
paths |
List of { path, matcher }. matcher is glob (default) or exact. Globs support * and **. |
min_age_hours |
Only clean items not changed for this many hours. For a folder, its newest file counts. |
| Field | Description |
|---|---|
default_action |
trash (default) or permanent. With Always Route to Recycle Bin on, everything goes to the Recycle Bin anyway. |
protect_subpaths |
Glob patterns that are never removed, even when a target matches them. |
| Variable | Expands to |
|---|---|
${local_app_data} |
%LOCALAPPDATA% |
${app_data} |
%APPDATA% |
${program_data} |
%ProgramData% |
${user_profile}, ${home}
|
%USERPROFILE% |
${temp} |
The user's temp folder |
${win_dir} |
%SystemRoot% |
Use / in paths. FreeMyDisk converts them to \ on Windows.
- ✅ It targets data the app rebuilds by itself: caches, logs, temp files, crash dumps.
- ✅ It is as narrow as possible:
App/Cache/*rather thanApp/*. - ✅ It lists the app's processes in
locking_processes. - ✅ It uses
risk = "safe"only when removing the data has no visible effect except a slower first start. - ❌ It never targets documents, saves, settings, sessions, passwords or downloads.
Put the rule in an empty folder, then:
cargo run -p freemydisk-cli -- scan --rules-path .\my-rules
cargo run -p freemydisk-cli -- clean --dry-run --category application
cargo test -p freemydisk-core --test rules_testrules_test checks that every built-in rule is valid.
- Fork the repository and add your file under the right category.
- Commit with a sign-off:
git commit -s -m "feat(rules): add Spotify cache". - Open a pull request and say how you verified that the app rebuilds the data.
Not ready to write it yourself? Request a rule instead, or vote in Which app should be rule #123?.
The full contribution guide is in CONTRIBUTING.md.
FreeMyDisk · Website · Releases · Discussions · Report a bug · GPL-3.0
Using FreeMyDisk
Trust
Power users
Help