worktree-cleanup

worktree-cleanup is a skill for Claude Code from ishida-supsys/oretachi. It costs 96 tokens per session (924 once invoked), scanned A, original, MIT.

A worktree cleanup guide for reviewing Git worktrees, which are separate working directories for branches, and finding ones that may be safe to remove.

In plain words
What is it for?
Use it to audit unused worktrees, identify cleanup candidates, and remove approved worktrees.
Why use it?
It helps avoid deleting active work or uncommitted changes. It groups worktrees by merge status, recent activity, changes, and terminal state, then waits for approval before removal.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ishida-supsys/oretachi/worktree-cleanup
Any agent
npx skills add ishida-supsys/oretachi --skill worktree-cleanup
Clone the repo
git clone --depth 1 https://github.com/ishida-supsys/oretachi

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 worktree-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/ishida-supsys/oretachi/worktree-cleanup.svg)](https://agentmods.dev/skills/ishida-supsys/oretachi/worktree-cleanup)
Your own site
<a href="https://agentmods.dev/skills/ishida-supsys/oretachi/worktree-cleanup"><img src="https://agentmods.dev/badge/skills/ishida-supsys/oretachi/worktree-cleanup.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 924 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00096 $0.00924
Opus 5 $0.00048 $0.00462
Sonnet 5 $0.00019 $0.00185
Haiku 4.5 $0.00010 $0.00092

Measured 6d ago against content hash 73ff58a4a302, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

worktree-cleanup scanned grade A with 0 findings 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 6d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src-tauri/skills-home/worktree-cleanup/SKILL.md · 56 lines

What it actually says

worktree-cleanup スキル

ワークツリー追加先ディレクトリ配下のワークツリー群を棚卸しし、不要になったものを ユーザーの承認を得てから削除する。

手順

  1. oretachi_get_worktree_status で全ワークツリーを取得する。 isHome: true(ホーム自身)と isRepository: true(リポジトリのルート)は対象外。
  2. 各ワークツリーについて oretachi_inspect_worktree を呼び、 dirtyCount / mergedInto / lastCommitAt を取得する。
  3. ターミナルが残っているものは oretachi_list_terminals で状態を確認し、 停止しているものは oretachi_read_terminal で末尾を読んで停止理由を把握する。
  4. 下記の判定基準で分類し、表にして提示する。根拠(マージ先・dirty 数・最終コミット)を必ず添える。
  5. ユーザーが承認したものだけ oretachi_close_worktree を呼ぶ。

判定基準

区分 条件
削除推奨 対象ブランチにマージ済み・dirtyCount == 0・ターミナルが停止済み
要確認 未マージだが 30 日以上更新なし・dirtyCount == 0
残す dirtyCount > 0、またはターミナルが動作中

提示フォーマット

区分      ワークツリー      ブランチ            根拠
削除推奨  oretachi-k3p1     fix/tray-focus      merged→main / dirty 0 / 12 日前
要確認    oretachi-z0f4     worktree/spike-ui   未マージ / 31 日更新なし
残す      oretachi-jaqo     worktree/home-...   dirty 3

そのうえで「削除推奨の N 件を削除しますか?」と尋ね、返答を待つ。

禁止事項

  • ユーザーの承認なしに oretachi_close_worktree を呼ばない
  • dirtyCount > 0 のワークツリーを削除推奨に入れない
  • 「要確認」を勝手に削除推奨へ格上げしない
  • ホーム(isHome: true)とリポジトリ(isRepository: true)を削除しようとしない(サーバー側でも拒否される)

削除時のオプション

oretachi_close_worktree には次を渡せる。ユーザーの意向を確認してから決める。

  • merge_to: 削除前にマージするターゲットブランチ
  • delete_branch: ブランチも削除するか(マージ済みなら通常 true)
  • force_branch: 未マージブランチを強制削除するか(既定は使わない)
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. 6d ago First seen · 56 lines · 96 tokens per session scan A 73ff58a4a302

Subscribe to this mod's changes

worktree-cleanup is a skill published in the GitHub repository ishida-supsys/oretachi (2 stars, last pushed 2d ago), licensed MIT. It adds 96 tokens to every session and 924 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

add-new-agent-support

Add a new agent (tool) support to agent-command-sync following the registry pattern.

skill-mill/agent-skill-porter · 21 tokens

neo4j-snowflake-graph-analytics-skill

Run Neo4j Graph Analytics algorithms (PageRank, Louvain, WCC, Dijkstra, KNN, Node2Vec, FastRP, GraphSAGE) directly inside Snowflake without moving data. Use when running graph algorithms against Snowflake tables via the Neo4j Snowflake Native App ("GDS Snowflake", "graph algorithms in Snowflake", "Neo4j Graph…

neo4j-contrib/neo4j-skills · 222 tokens

neo4j-document-import-skill

Ingests unstructured and semi-structured documents into Neo4j as a knowledge graph. Use when chunking PDFs, HTML, plain text, or Markdown; extracting entities and relationships from text with an LLM (SimpleKGPipeline, neo4j-graphrag); loading JSON via apoc.load.json; building Document→Chunk→Entity graph structures; or…

neo4j-contrib/neo4j-skills · 187 tokens

neo4j-driver-dotnet-skill

Neo4j .NET Driver v6 — IDriver lifecycle, DI registration (singleton), ExecutableQuery fluent API, ExecuteReadAsync/ExecuteWriteAsync managed transactions, IResultCursor (FetchAsync/ ToListAsync), record value access (.Get /As ), null safety, UNWIND batching, temporal types, await using, EagerResult, object mapping…

neo4j-contrib/neo4j-skills · 187 tokens

neo4j-getting-started-skill

Orchestrates zero-to-running-app in 8 stages — prerequisites → context → provision → model → load → explore → query → build. Each stage reads its own reference file. Supports HITL and fully autonomous operation. Use when starting a new Neo4j project from scratch, provisioning Aura, generating synthetic data, building…

neo4j-contrib/neo4j-skills · 157 tokens

neo4j-import-skill

Import structured data into Neo4j — LOAD CSV, CALL IN TRANSACTIONS, neo4j-admin database import full (offline bulk), apoc.load.csv/json, apoc.periodic.iterate, driver batch writes. Covers method selection, header file format, type coercion, null handling, ON ERROR modes, CONCURRENT TRANSACTIONS, pre-import constraint…

neo4j-contrib/neo4j-skills · 177 tokens