audit-agent-worktrees
Skill11 starsChanged 24 days agoMITView on GitHub
Audit old git worktrees and clones that coding agents left behind, and delete only the ones whose work is safe. Use before you remove agent worktrees, prune worktree pools, or reclaim disk space from old agent checkouts.
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- karanmrn/karanagentskillsword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- karanmrn/karanagentskills★ 11100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository155 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 14-day stale PR closeSkill
- AhoySkill
- api-and-interface-designSkill
- architectSkill
- arenaSkill
- ask-mattSkill
- automate-meSkill
- axiSkill
- babysit-prSkill
- benchmark-checklistSkill
- blast-radiusSkill
- broSkill
- browser-testing-with-devtoolsSkill
- cache-architectureSkill
- chief-of-staffSkill
- chrome-devtools-axiSkill
- ci-cd-and-automationSkill
- claude-handoffSkill
- codebase-designSkill
- code-review-and-qualitySkill
- code-reviewSkill
- code-simplificationSkill
- compact-adviserSkill
- constraint-driven-developmentSkill
- context-engineeringSkill
- correctSkill
- councilSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- debugging-and-error-recoverySkill
- delegate-to-modelSkill
- deprecation-and-migrationSkill
- diagnosing-bugsSkill
- documentation-and-adrsSkill
- domain-modelingSkill
- doubt-driven-developmentSkill
- figure-it-outSkill
- file-prSkill
- frontend-ui-engineeringSkill
- full-sendSkill
- full-stopSkill
- gh-axiSkill
- git-guardrails-claude-codeSkill
- git-workflow-and-versioningSkill
- gnhfSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- hill-climbSkill
- howSkill
- idea-refineSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- incremental-implementationSkill
- interrogateSkill
- interview-meSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Run these checks inside the worktree.
- Very specific: line 51
Remove each safe worktree with its tool: git -C <repo> worktree remove <path>.
- Very specific: line 52
Run git -C <repo> worktree prune to clear stale records.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audit agent worktrees
Agents leave many worktrees behind. Some hold the only copy of real work. This skill sorts each worktree into safe to delete, keep or ask, and deletes only the safe ones.
Unlanded work is work that is not on the default branch and not on a pushed branch. Never delete unlanded work without a human's explicit approval for that worktree.
1. Make the inventory
For each repository, list every worktree:
git -C <repo> fetch --all --prune
git -C <repo> worktree list --porcelainAlso find loose clones and copies outside git worktree list, for example under the agent tool's worktree directory. Record for each one: path, branch, HEAD commit, last change time, size (du -sh).
Skip any worktree that a running agent uses. Check for live processes with lsof +D <path> or the agent tool's own status command. A slot that looks unused is not proof that it is free.
Done when every worktree has one inventory row.
2. Classify each worktree
Run these checks inside the worktree. Each check gives evidence. Write the evidence into the row.
| Check | Command | Unlanded work if |
| Uncommitted changes | git status --porcelain --untracked-files=all | output is not empty (ignore build output that .gitignore covers) |
| Stashes | git stash list | a stash entry belongs to this branch |
| Commits not on the default branch | git log --oneline origin/<default>..HEAD | the list is not empty |
| Commits not pushed | git log --oneline @{upstream}..HEAD | the list is not empty, or the branch has no upstream |
| Squash-merged | gh pr list --state merged --head <branch> | no merged PR includes these commits |
| Open PR | gh pr list --state open --head <branch> | an open PR exists: keep the worktree |
A squash merge or rebase merge changes commit hashes. So origin/<default>..HEAD can list commits that are already landed. If a merged PR exists for the branch, compare its final diff with the branch tip (git diff <merge-commit>^..<merge-commit> against git diff origin/<default>...HEAD) before you call the work landed.
Sort each row:
- Safe to delete: clean tree, no own stash, and every commit is on the default branch, or on a pushed branch, or in a merged PR.
- Keep: an open PR, a live process, or recent activity.
- Ask: any unlanded work. Show the human the branch, the commits and the diff summary.
3. Back up, then delete
- Push any branch whose commits exist nowhere else:
git push origin <branch>. If you cannot push, make a bundle:git bundle create <backup-dir>/<branch>.bundle origin/<default>..<branch>. - Remove each safe worktree with its tool:
git -C <repo> worktree remove <path>. Use the agent tool's own remove command when it manages a pool. Never use--forceon a worktree that has unlanded work. - Run
git -C <repo> worktree pruneto clear stale records. - Record what you removed, the space it freed and every backup path.
Done when every row is deleted with evidence, kept with a reason, or waiting for a human answer.
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
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.

