Skip to content
Back to skills

Tidy

ASecurity

Use when worktrees pile up beside the checkout or the person asks to clean them up. Gives every linked worktree a verdict, safe or keep, and removes the safe ones.

  • 291 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 26, 2026
ai-agentsgobashnodegitdatabase

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add Eigenwise/eigenwise-toolshed --skill tidy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tidy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tidy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/eigenwise-tidy/badge)](https://www.skillsdirectory.com/skills/eigenwise-tidy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tidy
description: Use when worktrees pile up beside the checkout or the person asks to clean them up. Gives every linked worktree a verdict, safe or keep, and removes the safe ones.
---

# Tidy

Say which worktrees are finished and remove those, wherever they live and whoever made them. A worktree marked keep is never touched.

Most agent worktrees go without this skill. Once per session, at its start, the board runs the same script with `--remove-safe --unasked --only=<path>` on the agent worktrees no one may be using (not locked, no agent or git write in the last ten minutes, no ticket on it that is not `done` or `dropped`) and that changed since they were last kept, toasts how many went and names each kept one once with its reason. A landing's move to `done` removes what it landed the same way. Unasked, a commit counts as held only by another local branch, and only a `worktree-agent-*` branch, or a `worktree-sidequest-*` one the board recorded making, is deleted. When `.claude/worktrees` is a link Sidequest makes `sidequest-<ticket>-<id>` on `worktree-sidequest-<ticket>-<id>`, and writes `worktree made by Sidequest at <folder> on branch <branch>` in that ticket's log. A folder or branch named that way with no such line is a person's, whatever its name: the script never reads a name alone as the plugin's. The same pass removes the brief and stored reports of a ticket a week after it was `done` or `dropped`, and nothing else under `.sidequest/`. This skill is for the rest, and for a kept one the person wants looked at now: worktrees a person made, branches and folders an older version left, and files in `.sidequest/` the board did not write.

## Steps

1. **Look.** From the main checkout run:

   ```bash
   node "${CLAUDE_PLUGIN_ROOT}/scripts/worktrees.mjs"
   ```

   The script reads those log lines itself from the `.sidequest/tickets` of the main checkout. A board kept in another folder (one whose work is in this repository) is named with `--board=<the folder that holds its .sidequest>` on both commands. It prints one row per linked worktree: path, branch, uncommitted or untracked files, commits on no remote and not merged into the main checkout's branch, locked, last commit date, and the verdict. `safe` means nothing is uncommitted, nothing is only there, no rebase, merge or bisect is in progress, and it is not locked. Only there includes ignored files: one the main checkout lacks or holds with other content (a `.env`, a local database), or an ignored folder the main checkout does not have. Installed or built folders the main checkout has too still read safe. A worktree that holds a submodule is always `keep`, because git does not remove one. Anything else is `keep` with the reason. A line on stderr like `git ls-files gave no answer: ENOENT` means git was stopped before it answered; the keep reason beside it only says git could not read something, so show that line with the table.
2. **Show it.** Paste the table, then one line: how many can go, how many stay and why, in plain words (`12 can go. 5 stay: 3 have uncommitted files, 2 hold a commit that is on no remote.`). When the script prints a line starting `Safe, and named by a person`, show that line as it is before anything is removed: those folders or branches carry a name someone chose, not an agent's. Agent-named safe ones stay a count.
3. **Remove.** When the person asked for the cleanup, go on at once. Otherwise ask once whether to remove the safe ones and wait for the yes. Then run:

   ```bash
   node "${CLAUDE_PLUGIN_ROOT}/scripts/worktrees.mjs" --remove-safe --named
   ```

   `--named` takes the person-named ones you showed in step 2 too; without it they stay. It re-reads every worktree, judges each safe one again right before it touches it and keeps it with the reason when it changed, removes it with a plain `git worktree remove` (never forced), and deletes a branch only when another branch or a remote holds its commits and `git branch -d` accepts it. Before a folder goes, every junction or symbolic link inside it, at any depth, that leads out of it is taken away as a link, so the removal cannot delete files through it. A worktree kept by its verdict or by that second look keeps its links.
   The same run also lists local `worktree-agent-*` and `worktree-sidequest-*` branches that have no worktree, safe when merged or empty and keep with the commit count otherwise. Hundreds of safe ones print as one count line: show it as it is, never one by one.
   To find worktree folders an older version left under the home directory that git no longer knows, pass the folder to look under (the older version's worktree folder, one folder per project inside it) as an argument to both commands. A folder is safe only when every file in it matches something the repository already holds; `--remove-safe` removes just those.
4. **Files in `.sidequest/`.** Run, with the full path of the main checkout's board folder (it ends in `.sidequest`):

   ```bash
   node "${CLAUDE_PLUGIN_ROOT}/scripts/board-files.mjs" others "<main checkout>/.sidequest"
   ```

   It prints one line: what is there that the board never wrote (a `patches/` folder a session made, say) with count and size. Show it as it is. Any other folder is refused and nothing is touched. Add `--remove` to the same command only when the person says so: it takes only what that line listed, never anything in the board's own folders, and a link as a link. A hook never does.
5. **Report** what it removed, which branches it kept and why, and what stays.

## Rules

- Never remove, force, unlock or clean a worktree marked keep, and never delete a branch `git branch -d` refuses. Its reason goes in the report; what to do with it is the person's call.
- Not while agents run. A worktree an agent just got has nothing in it yet and reads as safe. When the board shows running agents, wait until they return.
- `--json` prints the same report as JSON.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.