# Wt Remove

> Remove a git worktree checkout, delete its branch, and close the herdr workspace or tmux window showing it. Resolves the target from a branch name, directory slug, absolute path, or the worktree you are standing in. Use whenever the user wants a worktree gone: "wt remove", "delete this worktree", "close and remove that herdr worktree workspace", "tear down the branch I spun out". This is the only…

- **Type:** Skill
- **Install:** `agentstack add skill-ondrejdrapalik-worktree-management-skills-wt-remove`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [OndrejDrapalik](https://agentstack.voostack.com/s/ondrejdrapalik)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **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-remove

## Install

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

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

## About

# Remove Worktree

```bash
wt remove $ARGUMENTS
```

Display the output. Done.

## What the script guarantees

Removal is destructive, so the ordering and the refusals matter more than the
command itself:

- **Target resolution** accepts a branch (`feat/foo`), a directory slug
  (`feat-foo`), an absolute path, or nothing at all when the shell is already
  inside the worktree. Pass through whatever the user gave you.
- **Refuses to remove a worktree from inside it** and tells the user where to
  `cd`. Don't work around this by `cd`-ing elsewhere yourself unless the user
  asked for the removal to happen regardless.
- **`--force` gates losing work**, not the removal: uncommitted changes or
  commits not yet on the default branch stop the run and print what would be
  lost. Relay that to the user and let them decide. Do not add `--force`
  yourself to get past a warning they haven't seen.
- **Closes the surface before removing the checkout.** Git refuses to remove a
  worktree that a live shell still has as its cwd, and closing the herdr
  workspace or tmux window kills those shells. This is why removal works on both
  surfaces with one code path.
- Then `git worktree remove`, `worktree prune`, `branch -D`, and the now-empty
  `~/_wt//` bucket is cleaned up.
- **Drops the worktree's mise trust entry.** `wt new` trusts the checkout's
  `mise.toml`, and the trust store keys on the absolute path, so a leftover
  entry would silently pre-trust a future worktree that reuses the slug.

## Remove vs clear

`wt remove` deletes a checkout and its branch. `wt clear` (see `wt-clear`) only
closes windows for finished PRs and leaves everything on disk. When the user says
"clean up", check which one they mean. The wrong guess is unrecoverable in one
direction and harmless in the other.

## 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

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## 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-remove
- 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%.
