wt

wt is a command for Claude Code from KaimingWan/oh-my-kiro. It costs 0 tokens per session (616 once invoked), scanned C, original, MIT.

A worktree-management command for listing Git worktrees and checking whether their branches have been merged into the main branch.

In plain words
What is it for?
Use it to inspect worktree branches, identify their related repositories, and find merged worktrees that can be removed.
Why use it?
It shows which worktrees are active and which ones are safe to clean up after their work has reached the main branch.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is git -C <submodule> worktree remove ../worktrees/<name>.

Good fit Use it to inspect worktree branches, identify their related repositories, and find merged worktrees that can be removed.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/KaimingWan/oh-my-kiro
agentmods
npx agentmods add commands/kaimingwan/oh-my-kiro/wt

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wt

README.md
[![agentmods](https://agentmods.dev/badge/commands/kaimingwan/oh-my-kiro/wt.svg)](https://agentmods.dev/commands/kaimingwan/oh-my-kiro/wt)
Your own site
<a href="https://agentmods.dev/commands/kaimingwan/oh-my-kiro/wt"><img src="https://agentmods.dev/badge/commands/kaimingwan/oh-my-kiro/wt.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 616 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00616
Opus 5 $0.00000 $0.00308
Sonnet 5 $0.00000 $0.00123
Haiku 4.5 $0.00000 $0.00062

Measured 8d ago against content hash c13594d14966, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade C, and why

wt scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Use `git -C <submodule> worktree remove` (not rm -rf)
commands/wt.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Manage worktrees: list status, clean up merged branches.

Step 1: List all worktrees with status

Run:

echo "=== Worktrees in worktrees/ ==="
for dir in worktrees/*/; do
  [ -d "$dir" ] || continue
  dir="${dir%/}"
  BRANCH=$(git -C "$dir" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
  echo "  $dir → branch: $BRANCH"
done

Step 2: Check merge status

For each worktree, detect its submodule by reading .git file and check merge status:

for dir in worktrees/*/; do
  [ -d "$dir" ] || continue
  dir="${dir%/}"
  NAME=$(basename "$dir")
  BRANCH=$(git -C "$dir" rev-parse --abbrev-ref HEAD 2>/dev/null || continue)

  # Detect submodule from worktree's git common dir
  COMMON=$(git -C "$dir" rev-parse --git-common-dir 2>/dev/null)
  SM=$(basename "$(dirname "$COMMON")" 2>/dev/null)
  [ -d "$SM" ] || { echo "  ⚠️ $dir — cannot detect submodule, skipping"; continue; }

  # Check if branch is merged into main
  git -C "$SM" fetch origin main --quiet 2>/dev/null
  if git -C "$SM" branch --merged origin/main 2>/dev/null | grep -q "$BRANCH"; then
    echo "  ✅ $dir ($BRANCH) — MERGED into $SM/main → safe to remove"
  else
    echo "  🔄 $dir ($BRANCH) — NOT merged into $SM/main"
  fi
done

Step 3: Confirm and clean up

Show the list to the user. For worktrees marked "MERGED":

  • Ask user to confirm which ones to remove
  • For each confirmed removal:
git -C <submodule> worktree remove ../worktrees/<name>
  • If .active-submodule exists and its worktree field matches the removed path, clear it:
if [ -f .active-submodule ] && command -v jq >/dev/null 2>&1; then
  WT=$(jq -r '.worktree // ""' .active-submodule 2>/dev/null)
  [ "$WT" = "worktrees/<name>" ] && : > .active-submodule
fi

Important rules

  • Only manage worktrees under worktrees/ directory (not external paths)
  • Always confirm with user before removing — never auto-delete
  • Use git -C <submodule> worktree remove (not rm -rf)

User's message (the text after @wt):

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 65 lines · 0 tokens per session scan C c13594d14966

Subscribe to this mod's changes

wt is a command published in the GitHub repository KaimingWan/oh-my-kiro (103 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 616 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.