# `mix mailglass.inbound.prune`
[🔗](https://github.com/szTheory/mailglass/blob/v2.3.0/lib/mix/tasks/mailglass.inbound.prune.ex#L1)

Manually run the inbound retention sweep.

Runs `MailglassInbound.Internal.Prune.prune/0` SYNCHRONOUSLY whether or not Oban
is installed — only *scheduling* needs Oban; the batched sweep is the
workhorse. Deletes happen in batches of 1000 (`FOR UPDATE SKIP LOCKED`) under a
`pg_try_advisory_lock` single-run guard, child-first across the four retention
windows (replay_runs 30d, execution_runs 90d, evidence 30d, records 90d), with
`:infinity` on any class disabling that window.

## Usage

    mix mailglass.inbound.prune              # interactive typed confirmation
    mix mailglass.inbound.prune --dry-run    # report scope, delete nothing
    mix mailglass.inbound.prune --yes        # skip confirmation (cron/CI)

Because the sweep DELETES rows, the confirmation tier is stronger than replay's
`[y/N]`: it requires a typed `yes`. `--yes`/`-y` skips it for cron/CI;
`--dry-run` reports scope without deleting.

Emits `[:mailglass_inbound, :prune, :sweep, :stop]` with per-table deletion
counts (no PII).

## Scheduled pruning

An optional `MailglassInbound.Prune.Worker` Oban cron worker exists but is NOT
auto-registered. Operators wire `0 3 * * *` in their own Oban config
(operator guide). Oban-less adopters run this task from system cron.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
