← Back to catalog
LoopEngineering↓ 0

Repository Cleanup Loop

Recovers valuable unmerged work and prunes stale branches and PRs until the repository is tidy.

Loops are usage routines — there is no install command. See how to run it just below.

This loop is a recurring janitor that keeps the branch and PR list honest without losing anything valuable.

The cycle lists branches and PRs by last activity, classifies each one (merged, abandoned, or holding salvageable work), saves what is worth keeping into an issue or fresh branch, and only then safely removes the rest.

It repeats until no stale branch or abandoned PR remains.

The golden rule is to never lose unmerged work.

When to use

  • For periodic cleanups of old branches and PRs.
  • When the repository has piled up loose ends.
  • To archive useful prototypes before deleting a branch.

How to use

Run the loop asking it to scan branches and PRs, decide between salvage or delete for each, and continue until the list is clean, never losing unmerged work.