agentleFS
VforValVforVal/lumberjack/skills/cleanup/SKILL.md

cleanup

Skill0 starsChanged 24 days agoMITView on GitHub

Remove landed worktrees in this repository, then remove unverified and landed-probable ones only after the maintainer confirms each

71 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chips, react-query-best-practices and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • udecodeSkill

    chips

    Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    react-query-best-practices

    Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    you-might-not-need-a-callback

    Analyze and fix useCallback anti-patterns in your code

    Also in 3 projects that use this

  • Scylla23Skill

    redo

    Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.

    Also in 3 projects that use this

  • Aetheria-Labs1Skill

    plan-page

    Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.

    Also in 3 projects that use this

  • SocialKit-APISkill

    video-transcripts

    Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.

    Also in 3 projects that use this

  • +3 more from bibektimilsina00

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 0 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 61 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run every command from the repository root with Python 3.11+ as python or python3.

    line 15
  2. Very specific:

    Keep the worktree lines whose tier= is unverified or landed-probable, plus any worktree step 1 reported as blocked ...: dirty.

    line 38
  3. Very specific:

    Only the answer for that group counts.

    line 77
  4. Very specific:

    Read docs, doc_strategy and trash.

    line 87
  5. Very specific:

    When doc_strategy is {}, ask in one message, with these choices, then save the answers:

    line 93
  6. Very specific:

    Write them as JSON with keys scope, trash_days and grace_days (plus roots, a table of root to keep, when they named any) to a temporary …

    line 100
  7. Very specific:

    If --clear answers no Markdown in scope, only other files are left: say so and do not offer it again.

    line 114

“Common” is measured: kept by at least 6 in 10 of the 61 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

lumberjack cleanup

Clear old worktrees in the repository this command runs in. The sweep script does all removal; you relay its lines and ask. Never remove a worktree the maintainer did not confirm by name, and never pass --force to git.

Resolve the script at ../../scripts/sweep_worktrees.py relative to this skill's directory. Use its absolute path in place of SWEEP below, quoted for the active shell. Run every command from the repository root with Python 3.11+ as python or python3; use the name that reports 3.11+ in place of python below. If missing or older, stop and point to https://www.python.org/downloads/ .

1. Sweep

python "SWEEP" --cleanup
git worktree prune --verbose

--cleanup fetches origin and removes landed worktrees (integrated, content-integrated, landed-pr) that nothing blocks, keeping their branches. git worktree prune drops records whose directories are gone. Relay both outputs verbatim. A skipped line or a lumberjack: config error ends the sweep step; still go on to step 2.

2. List what is left

python "SWEEP"

Keep the worktree lines whose tier= is unverified or landed-probable, plus any worktree step 1 reported as blocked ...: dirty. Show them as one numbered list: branch, path, tier and reason. The path is everything after the branch, already absolute; use it as PATH below. If there are none, say so and stop.

3. Ask about each one

One worktree at a time, in list order. Ask whether to remove it, and say its branch is kept. Only an explicit yes for that worktree counts; anything else, silence included, means keep it. A yes to one is not a yes to the next. On a yes, run:

python "SWEEP" --remove "PATH"

Relay its one line verbatim: a cleaned line and exit 0 (directory left means the maintainer deletes the leftover directory by hand), or a blocked line with its reason and exit 1, after which the worktree stays and you move on. Do not work around a block (commit, stash, delete files or cd away) unless the maintainer asks for that step by name; a per-group answer under "Stray files" below is that request.

Stray files (dirty or ignored files)

An ignored files line names up to three entries; for all of them, and for dirty, run git -C "PATH" status --porcelain -uall --ignored. Stray entries are the untracked (??) ones and the ignored (!!) ones other than caches (node_modules, .venv, __pycache__, tool caches, .coverage, Claude's .claude/settings.local.json). Modified tracked files (M, D) are not stray: show them and leave them. Group the stray entries by what produced them: one tool's output, one file type, one directory. Never ask file by file. Ask one question per group, naming its files and the three choices:

  • delete: git -C "PATH" clean -f -x -- <files>; removal would delete them anyway.
  • ignore (?? entries only): add one pattern to .git/info/exclude in the primary checkout, which covers every worktree of this clone without a commit, or to .gitignore on the primary branch through its own pull request; then delete the copies as above.
  • commit: git -C "PATH" add -f -- <files>, commit on the branch and push; the files reach the primary branch through its pull request, a new one if the old one merged.

Only the answer for that group counts; silence keeps its files, and the worktree stays while any group is kept. Once every group is settled, run --remove "PATH" again and relay its line.

4. Work documents

python "SWEEP" --json

Read docs, doc_strategy and trash. When no doc has state linked and trash is empty, skip to step 5. Never remove a bundle outside this step's commands, and never by hand.

Strategy (first run only)

When doc_strategy is {}, ask in one message, with these choices, then save the answers:

  • scope: markdown (only .md files) or bundle (whole entries, run output included)
  • trash days: whole days a trashed folder is kept (suggest 30)
  • grace days: whole days a bundle must stay linked before session start trashes it, 0 or more (suggest 7)
  • doc roots to always keep, if any (saved as roots, each root mapped to keep)

Write them as JSON with keys scope, trash_days and grace_days (plus roots, a table of root to keep, when they named any) to a temporary file and run python "HELPER" strategy FILE, where HELPER is ../../scripts/setup_lumberjack.py relative to this skill's directory. Relay its output and say the maintainer commits .lumberjack.toml. If they decline, remove nothing and go to step 5. A saved strategy is never asked for again; follow it.

Offer

Take the linked docs whose action is not keep; the sweep sets action from the strategy, so never work it out yourself. Ask once per group (same action and doc root), never bundle by bundle, listing the paths, tickets and sizes. Only an explicit yes counts. With cleanup = "prune" the session start already trashed the trash ones (step 1 relayed the cleared lines); any left were over the time budget, blocked or inside grace_days, so offer them as below. If --clear answers no Markdown in scope, only other files are left: say so and do not offer it again.

  • trash: the bundle moves to the trash, kept trash_days days. On a yes, run python "SWEEP" --clear "PATH" "PATH" ... once with the group's paths.
  • promote: offer only promote or keep; keep is the default. To promote, write the findings into a document without naming the bundle's folder and get it tracked on origin/<primary_branch> through its pull request, or push the work as a prototype_prefix branch. Only then run python "SWEEP" --clear "PATH" --promoted "REF" with that document's path or branch name; it fetches origin first, so a just-merged pull request counts.

Relay each line verbatim. A blocked line (exit 1 when any path is blocked) means that bundle stays; do not work around it.

Trash

With cleanup = "prune" the session start already purges trash past trash_days (step 1 relayed the purged lines); any folder trash still lists was over the time budget, blocked or kept by cleanup. Show those with their age and ask once whether to purge them now. On a yes, run python "SWEEP" --purge-trash (everything past retention, in one run) and relay its lines. Without a yes, leave them.

5. Report

List what was removed, what was kept and what was blocked with its reason (worktrees, bundles and trash). Mention that a removed worktree comes back with git worktree add <path> <branch>. Then run python "SWEEP" --tally and relay its three tally: lines: bundles trashed and files purged since the session start and in all, and what the trash still holds. If the maintainer asks which files, run it again with --files <bundle path> (or bare --files) and relay the file lines.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.