Sweep scratch leftovers (loop hygiene)
cleanup_scratchIdentify and optionally delete temporary or scratch records (TMP, tmp tag, '(delete me)'). Dry-run shows matches and references; confirm removes safe, unreferenced entries.
Instructions
Find records that scratch conventions mark as disposable — a name starting 'TMP ·', a 'scratch'/'tmp' tag, or '(delete me)' in the name; optionally '(diagnostic)' records and unnamed ones. DRY-RUN BY DEFAULT: reports every match, why it matched, and what (if anything) references it. confirm=true deletes only the safe candidates — unreferenced, not recently touched — through the same gated delete path as delete_resource. Content deletes are VC-recorded (restorable); db_modification deletes are NOT restorable and only ever match the explicit TMP/scratch markers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kinds | No | Kinds to sweep (default: query, block, db_modification). | |
| confirm | No | true = delete the safe candidates. Omit for the dry-run report. | |
| max_delete | No | Cap deletions per run (default 50); the remainder is reported. | |
| include_unnamed | No | Also flag null/empty-named records — content kinds only, never db_modifications. Default false. | |
| older_than_minutes | No | Only records untouched this long are candidates — a running loop may still need newer ones (default 60; 0 disables). | |
| include_diagnostics | No | Also flag '(diagnostic)'-suffixed records (e.g. 'SYS · Block Inspect (diagnostic)'). Default false. |