| name | ctf-clean |
| description | Safely GC stale agent cruft (worktrees, registrations, tmux windows, agent rows). Offers to PR un-merged work first; reports isolation clones. Usage: /ctf-clean [--dry-run] |
| metadata | {"version":"1.0.0"} |
ctf-clean — agent workspace janitor
Reclaim stale agent cruft from the task framework. Auto-removes only worktrees
whose task is done/merged with no real uncommitted work; offers to PR un-merged
work before removing it; reports (never deletes) /isolate clones.
Safety invariant: only cruft tied to a done task is ever touched. Anything
tied to todo/in-progress/in-review is left alone — that's agent-watcher's
job, not this skill's.
Steps
- Run the sweeper. If the user passed
--dry-run, pass it through, print the
output, and STOP — touch nothing else.
scripts/agent-clean ${ARGUMENTS}
- Show the summary block (worktrees removed + GB reclaimed, registrations
pruned, tmux windows killed, agent rows reset).
- Parse the
ATTENTION lines (tab-separated: ATTENTION <task_id> <branch> <status> <why>). These are un-merged / active worktrees that were NOT
removed. For each whose why contains "un-merged" (skip ones marked "active
task"), offer three choices:
- Print the
ISOLATION lines verbatim (tab-separated: ISOLATION <path> <size> <git summary>). These are user isolation clones — report only, never
act on them.
Boundaries
- Never deletes or modifies isolation clones.
- Never deletes
agents rows (the sweeper only resets orphaned running rows to
cancelled).
- Never touches anything tied to a non-terminal task.