Loopany
Sign in
Back to templates
Codebase Autopilot

Tech Debt Cleanup

A daily janitor that finds one provably safe cleanup in your codebase and lands it as a PR.

Moderate setupShort cycleOpen loopBuilds over runs
Setup in Loopany

How a run flows

On schedule
Every day · 7am
Step 1 · Survey
Find housekeeping debt
Step 2 · Prove
Pick one, prove it safe
Isolated git worktree · off main
Step 3 · Fix
Smallest change
Step 4 · Ship
Open a PR
Board
Cleanup board
Metric
Cleanups landed
open loop — repeats on the next tick, picking up where it left off

Prerequisites

How this loop works — schedule, exit, notifications
Suggested schedule
Daily · ~7am
Loop type
Open loop — an ongoing monitor with no finish line.
Exit condition
Runs indefinitely (no finish line).
Notifications
On by default — you're alerted on each run's outcome (completion or failure). Silence with notify: never.
Ease of starting
Some setup and context are needed before the first useful run.
When you see value
One proven cleanup a day; the codebase gets visibly tidier over a week or two.

Housekeeper takes a pass through the codebase every morning at 7am. I leave unused imports to the linter. This thing looks for code that feels off, like building the same idea twice. It'll also notice when patterns have drifted across the repo. Sometimes it lands on a structure nobody can explain anymore.

Once it has a case, it picks one cleanup and opens the smallest PR it can. That's been 21 cleanups in 8 weeks, 20 of them already merged. None would've made it into a sprint. The repo just argues with itself a little less now.

8 weeks of cleanups, one per PR: dead components, orphaned leaves, a leftover scratch file

One hard rule: don't change runtime behavior. If the loop isn't sure, it leaves a note and moves on. The win is catching places where the codebase has stopped making sense, before we build more on top of them.

The prompt this runs

Set up a daily loop that keeps this codebase tidy, one proven cleanup at a time. Every morning around 7am my local time, survey for housekeeping debt - dead code, stale files and comments, unused dependencies, duplication, inconsistent names - while protecting active, uncommitted, generated, and uncertain work. Pick one candidate, prove it genuinely low-risk with concrete evidence before touching it, then make the smallest coherent change in a fresh git worktree off the main branch and located outside the loop folder - the loop folder is a synced content home, not a workspace - so neither my working checkout nor the sync is polluted, and keep it only if the build, tests, and runtime checks stay green. Open a pull request - but if a previous Housekeeper PR is still open (unmerged), don't open another one that day; just refresh the existing PRs' statuses. Uncertain candidates go into a deferred-candidates file, listed, never deleted. Track each cleanup PR as a markdown card with front matter `type: open` or `type: merged`, and report cleanups landed as a daily metric. Set up the loop's dashboard at creation: a kanban of the cleanup cards plus a chart of cleanups landed over time.

This is the exact intent appended to the bootstrap when you create the loop — your coding agent reads it, then proposes cadence and config and confirms with you before creating anything.