# Wt Clear

> One-off sweep: closes every herdr workspace or tmux window whose git branch has a merged or closed GitHub PR, leaving checkouts and branches on disk. Use when the user wants their tabs tidied now that PRs are done: \"wt clear\", \"clear finished worktrees\", \"close the merged PR tabs\", \"clean up finished herdr workspaces\". Same skill on both multiplexers; there is no herdr-specific variant. F…

- **Type:** Skill
- **Install:** `agentstack add skill-ondrejdrapalik-worktree-management-skills-wt-clear`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [OndrejDrapalik](https://agentstack.voostack.com/s/ondrejdrapalik)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [OndrejDrapalik](https://github.com/OndrejDrapalik)
- **Source:** https://github.com/OndrejDrapalik/worktree-management-skills/tree/main/skills/wt-clear

## Install

```sh
agentstack add skill-ondrejdrapalik-worktree-management-skills-wt-clear
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Clear Windows With Finished PRs

```bash
wt clear
```

Display the output. Done.

## What it does

One sweep over everything currently rendered on the active surface: herdr
workspaces backed by a worktree, or tmux windows in the current session. For each
one it reads the git branch, derives `owner/repo` from the origin remote, and asks
`gh` whether that branch has a finished PR. Matching windows get closed.

`--merged-only` narrows the check to merged PRs, skipping closed-unmerged ones.
That is the conservative filter, and it is what `wt-cleanup-loop` uses on a
timer. A PR closed without merging often means the work is still wanted.

## Why this is safe to run casually

Nothing on disk changes. Checkouts stay in `~/_wt`, branches stay in git; only
the window or workspace closes. Re-open any of them with `wt open `.

The skips are structural rather than advisory, so you don't need to guard them
yourself: the focused window/workspace is never a candidate, `main` and `master`
are excluded, non-repo paths and branches without a finished PR fall through, and
a failing `gh`/`git`/`herdr` call skips that one entry instead of aborting the
sweep.

If the user actually wants the checkouts deleted too, that is `wt-remove` per
worktree. Say so rather than guessing.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [OndrejDrapalik](https://github.com/OndrejDrapalik)
- **Source:** [OndrejDrapalik/worktree-management-skills](https://github.com/OndrejDrapalik/worktree-management-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-ondrejdrapalik-worktree-management-skills-wt-clear
- Seller: https://agentstack.voostack.com/s/ondrejdrapalik
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
