Wiki / Cleanup & arr rules

Cleanup Rules

kustos · your server
A cleanup rule open for editing — match conditions, exclusions, the live preview of what it would remove, and the dry-run controls
A cleanup rule open for editing — match conditions, exclusions, the live preview of what it would remove, and the dry-run controls.

Desired-state deletion, with the safety rails in front.

A rule is: match conditions → a delete scope → a schedule, plus exclusions and protection.

Write your first rule without losing anything

Do it in this order. The point of the order is that nothing can delete until you have seen, in writing, exactly what it would delete.

kustos · your server
The rules list with nothing selected
The rules list with nothing selected. Read the line on the right: picking a rule shows what it would remove, and every rule previews as a dry run before anything is deleted. The safety-limits card at the foot states the ceiling currently in force.
  1. **Create the rule and turn Dry run only ON before you save it. It is off** on a new rule, which also starts switched on and set to unmonitor, delete and remove files. The switch sits at the bottom, beside Save. While it is on, the rule cannot delete or unmonitor anything at all.
  2. Set the match level — per episode, per season, or per show. This is what gets tested, not what gets removed.
  3. Add your conditions. Start with one. A rule with one condition you understand beats a rule with six you are guessing at.
  4. Set the delete scope under When Matched — episode, season, or the whole show. This is the one that decides what disappears. Choose Show only if you mean "one matching season deletes the entire series", because that is what it does.
  5. Read the Live Preview. It lists exactly what the rule matches right now. If that list surprises you, the rule is wrong — fix it before going further.
  6. Turn on Multi-user protection and select everybody who watches. Anything one of them has started and not finished is then kept.
  7. Set a grace period inside Multi-user protection, so something one of those people watched recently is kept. It only works with protection on and at least one person selected.
  8. Set the cleanup safety limits (the blast-radius caps). A maximum number and a maximum percentage per run.
kustos · your server
Cleanup safety limits: a per-rule ceiling in titles and in percent, then a separate cap across ALL rules for one pass
Cleanup safety limits: a per-rule ceiling in titles and in percent, then a separate cap across ALL rules for one pass. The per-rule numbers bound one rule; the bottom one bounds the whole run, and anything over it waits in Leaving Soon rather than being deleted.
  1. Leave it in dry run for a few days. It reports what it would have done, tagged DRY RUN on the Dashboard. Read those reports.
  2. **Only then turn Dry run only off.**

If you remember one thing: the delete scope in step 4 is not the same as the match level in step 2. Matching per season and deleting scope Show is a rule that removes a whole series because one season qualified. That combination is correct for some libraries and a disaster in others, and it is the single easiest thing to set by accident.

Match level — per episode, per season, or per show:

  • Per episode. Matching runs per episode; series-level fields (tags, quality) still apply to each one.
  • Per season. Matching runs per season, aggregated over its episodes.
  • What actually gets removed is the Delete scope you pick under When Matched — episode, season or the whole show. Pick Show to delete a whole series when one season matches.

Conditions cover watch state (watched by anyone / by a named user, in progress, watched the finale, watched all episodes on disk, last watched N days ago, total plays, watch percentage), requests (requested by anyone / by a user, number of requests), collections, acquisition status, size on disk, episode counts, unaired episodes, season number and more.

Safety, in layers

LayerWhat it does
Dry run only (safe mode)The rule never deletes or unmonitors. It reports what it would do, tagged DRY RUN on the Dashboard. Off on a new rule. Turn it on, and leave it on for a few days before letting a rule act.
ExclusionsTitles listed here are never touched by this rule, whatever the conditions say. Re-include from the collapsible Excluded list.
Multi-user protectionAnything one of the selected people has started but not finished is kept. Every selected person is checked before anything below runs.
Grace periodsPart of Multi-user protection (Grace after last activity (days)), and does nothing with protection off. A title any selected person played within the last N days is kept. Activity by people the rule does not protect does not count. The wait between a title matching and being removed is Act after (days) under When Matched.
Cleanup safety limitsA ceiling on how much may be deleted, as a count and as a percentage. Three limits in two groups, which behave differently — see cleanup safety limits.
OrderRules are listed and evaluated in name order; there is no separate priority. Only matters when one rule acts on the state another leaves behind.

Three tabs: Rules, Queue and History.

kustos · your server
The Queue tab: what is leaving, its size, its countdown and why each title matched, with Keep on every row to pull one out
The Queue tab: what is leaving, its size, its countdown and why each title matched, with Keep on every row to pull one out.

Queue is what's due to be removed, with countdowns. Kustos can build a Plex "Leaving Soon" collection from it, and there's a matching Leaving Soon Countdown overlay that re-renders daily so the number ticks down.

History is what actually went. Titles deleted in the last 24 hours and the last 7 days, with the space freed, then one line per deletion naming the episode or title, the rule that did it and why. It answers the question the queue cannot: did this rule ever actually delete anything. If rows are sitting past their date and nothing is in History, the rule is being stopped before it acts, and its badge on the Rules tab says why.

Two run buttons, and they are not the same. Run now evaluates the rule and queues what it finds. Run & delete now re-runs the rule and then deletes everything of that rule's that is still eligible, immediately — skipping the countdown entirely. See Collections & cleanup for exactly what that second one touches. Nothing pauses a countdown. A queued row that stops being deletable — it gets protected, or somebody watches it — is dropped rather than frozen, and starts over from the full Act after (days) countdown if it ever matches again. That is more warning than a paused clock, not less, but banked days are not kept. The Queue tab still has a "Held back" heading; it is permanently empty.

Being in a collection never causes a deletion. Only a title's own cleanup rules act on it.