# rd-cleanup

> Find the work the workflow left behind (open children under done parents, stale in-progress issues) and decide each on evidence.

`rd-cleanup` sweeps for issues the workflow stranded and proposes one action
per issue, each backed by something it found in Radial or in git. It shows you
everything before it writes, and it never deletes.

> Find the stranded work in Radial, the keyboard-first issue tracker: open
> children under a parent that is already done, and issues sitting in progress
> with no activity for weeks. Decide each one on evidence.

## When to use it

After a large tree merges, monthly, or when the board has issues nobody can
explain. Not to reprioritise: that is `/rd-triage`.

## What it asks you

Yes or no to the table, and how many days counts as stale if you have a number
in mind (it defaults to 21). It asks per row only when the evidence points both
ways, and that row is a feature rather than a failure: a wrong close is worse
than a question.

## What it writes

For a child it decided to close: `radial close <id> -m "<the evidence>"`, with
the evidence in the message because the message is what the next person reads.
For one it decided to promote: a detach, verified with a read-back, falling back
to a `related` link if the detach does not take. For a stale in-progress issue:
a move back to the team's todo status with a comment saying why. Never a delete.

## The two sweeps

The first looks for issues whose parent is in a completed status while the child
is not, and asks git and Radial what actually happened: a merged pull request
naming the id, a commit naming it, an implementation-notes comment, an activity
trail that reached in review. Evidence means close it. No evidence means the
work was never done and is now hidden under a parent nobody will reopen, so it
gets detached and becomes visible again.

It never infers "done" from the parent being done. That inference is the bug
this sweep exists to undo.

The second looks for issues in a started status whose last real activity is
older than the cutoff. It reads `radial activity`, not `updatedAt`, because a
bulk label change bumps the timestamp without anything happening.

## Extension points

<hook-table skill="rd-cleanup">
</hook-table>

## A worked wrapper

```markdown
---
name: strict-cleanup
description: Stricter evidence rules on top of rd-cleanup.
extends: rd-cleanup
---

Read rd-cleanup first, then apply the sections below at their hooks.

## evidence-bar

- A commit naming the id is not enough on its own. Close only on a merged pull
  request, or on a notes comment that names an acceptance line.
- Anything labelled `customer` is never auto-closed; it goes in the ask column.

## extra-sweeps

- Sweep for open issues with no assignee older than 60 days and propose the
  team lead.
- Sweep for two open issues whose titles differ by fewer than three words and
  propose a duplicate link.

## after-sweep

- Post the counts to #eng-ops and open a follow-up issue for anything left in
  the ask column.
```

## What it never does

It never deletes an issue: closing is reversible and deleting is not. It never
closes on the parent's status alone; every close quotes its evidence. It never
writes before a yes, and never touches issues outside the team it was given.
