repo-janitor

Automate cleanup of stale worktrees and repository checkouts using Git state.

Updated Jun 11, 2026
One-click install
npx skills add https://github.com/antondelafuente/automated-researcher --skill repo-janitor-antondelafuente
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repo-janitor
Source: https://github.com/antondelafuente/automated-researcher/tree/main/plugins/repo-janitor/skills/repo-janitor
Command: npx skills add https://github.com/antondelafuente/automated-researcher --skill repo-janitor-antondelafuente

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python, and includes scripts (resource) components.

What problem does it solve?

This Skill automates the cleanup of stale and abandoned worktrees and repositories, keeping your codebase organized and reducing clutter.

Core Features & Use Cases

  • Automated Cleanup: Removes abandoned worktrees and stale repository checkouts based on specific criteria.
  • Three-tier Classification: Categorizes worktrees into 'safe to reap', 'owner investigation', and 'researcher residual' tiers.
  • Detailed Reporting: Provides detailed reports on the state of worktrees, including age, cleanliness, and potential actions.
  • Use Case: Use this Skill after a long period of inactivity to clean up old worktrees and ensure that only active and relevant code is present in your repositories.

Quick Start

Run the repo-janitor skill on the 'repo-janitor' repository with the following command:

python3 scripts/worktree_sweep.py --repo path/to/repo-janitor

Frequently Asked Questions about repo-janitor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate git worktree cleanup for abandoned checkouts?

Automate git worktree cleanup by running a Python script that analyzes Git state information to identify and remove abandoned worktrees. The script categorizes stale checkouts into tiers to determine which are safe to reap.

What is the best way to identify stale worktrees in a repository?

The best way to identify stale worktrees is using an automated repository sweep that classifies them into 'safe to reap', 'owner investigation', and 'researcher residual' tiers based on age, cleanliness, and Git state data.

Do I need Python and Git to remove abandoned worktrees automatically?

Yes, you need Git to access repository state and Python to execute the cleanup scripts. These dependencies are required to run the automated worktree sweep and generate detailed reports on checkout status.

How to generate a report on stale repository checkouts and worktree status?

Generate a report on stale repository checkouts by running the worktree sweep script, which provides detailed information on the age, cleanliness, and potential actions for each worktree categorized into safe, investigational, and residual tiers.

Can automated worktree cleanup remove active checkouts by mistake?

Automated worktree cleanup mitigates accidental removal by using a three-tier classification system that separates 'safe to reap' worktrees from those requiring 'owner investigation', preventing the deletion of active checkouts.