Skip to content

Starter kits

post-merge-cleanup — the loose-ends sweeper

Sweeps for what a merge leaves behind — a merged branch nobody deleted, an issue a PR fixed but never closed, a preview environment with no PR left to…

Sweeps for what a merge leaves behind — a merged branch nobody deleted, an issue a PR fixed but never closed, a preview environment with no PR left to serve. Reports what it would clean up; never deletes, closes, or tears anything down until a human says so.

Category: A · Repo maintenance · Heartbeat: schedule (every few hours, inside the 1d–6h band) · Level: L1 (report-only) · Cost: Low

Quickstart

1. Read LOOP.md — the six parts, the prompt, the limits, the three stops.
2. post-merge-cleanup-state.md is your spine — already committed with empty
   last-seen marks.
3. Claude Code: point a Routine or `claude -p` cron at
   .claude/skills/loop-task/SKILL.md. OpenCode: rename
   opencode.json.example → opencode.json, add the AGENTS.md line, wire
   skills/loop-task.md into a cron + wrapper script.
4. Rehearse once, by hand, before the schedule ever fires:
   "Run the post-merge-cleanup skill now, exactly as the schedule would."
5. Grade the rehearsal with the loop-verifier agent — it confirms each
   flagged item is genuinely orphaned. PASS → arm the schedule. FAIL → fix
   the skill, never the report.

What's in this kit

FileRole
LOOP.mdthe definition — six parts, prompt, limits, ownership, three stops
post-merge-cleanup-state.mdthe spine — per-item last-seen marks across branches/issues/environments
loop-budget.mdcaps: 20 runs/day, 60k tokens/day, 80% tripwire
loop-constraints.mdthe constitution — never deletes, closes, or tears down
loop-run-log.mdappend-only, one line per beat
.claude/skills/loop-task/SKILL.mdthe procedure (Claude Code)
.claude/agents/loop-verifier.mdthe read-only reviewer — confirms each flagged item is genuinely orphaned
opencode.json.example · skills/loop-task.mdthe OpenCode twin — same skill text, cron + wrapper heartbeat

Loop Ready checklist

  • Provable success condition — cleanup-report.md lists every newly-orphaned item with a verified reason
  • Run limit — 20/day
  • Spine written first, committed empty
  • Report-only (L1) start — writes only the report + spine + log
  • Human gate placed — you approve every deletion, closure, or teardown
  • One log line per beat, no silent runs
  • Kill switch — loop-pause-all in loop-budget.md

How this relates to the course

The heartbeat, level, and cost come from the Part V §15A catalog entry, which also names this loop directly in the fleet's own priority order — *"ci-sweeper

pr-babysitter > dependency-sweeper > post-merge-cleanup > daily-triage."* This kit's shape (scheduled poll, per-item last-seen marks, a five-line report, a read-only reviewer, a human gate) is the same mold Step 13a names explicitly for reuse: "swap the skill and the report name and out comes a security sweeper, a dependency scout, a docs-drift detector" — here, a post-merge cleanup sweeper.


Source: Panaversity's Loop Engineering: A Crash Course (S1). Full attribution: resources/sources.md.