nyann:cleanup-branches

nyann:cleanup-branches is a command for Claude Code from thettwe/nyann. It costs 54 tokens per session (613 once invoked), scanned A, original, MIT.

A Claude Code command for finding local Git branches whose work has already been merged into a base branch and safely removing them.

In plain words
What is it for?
Use it to preview or prune merged local branches, with optional dry-run output or confirmed deletion using Git's safe branch-delete operation.
Why use it?
It helps reduce branch clutter while protecting unmerged work: the default mode only previews candidates, and deletion requires explicit confirmation.

Command for Claude Code

Written for Claude Code: arguments in frontmatter. Also seen: mentions Claude Code.

Part of the nyann plugin — 41 skills, 41 commands, 3 hooks shipped together

Good fit Use it to preview or prune merged local branches, with optional dry-run output or confirmed deletion using Git's safe branch-delete operation.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/thettwe/nyann/cleanup-branches
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.

Clone the repo
git clone --depth 1 https://github.com/thettwe/nyann

Made for: Claude Code.

Or install nyann, the plugin that ships this one along with the rest of its 41 skills, 41 commands, 3 hooks.

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 nyann:cleanup-branches

README.md
[![agentmods](https://agentmods.dev/badge/commands/thettwe/nyann/cleanup-branches.svg)](https://agentmods.dev/commands/thettwe/nyann/cleanup-branches)
Your own site
<a href="https://agentmods.dev/commands/thettwe/nyann/cleanup-branches"><img src="https://agentmods.dev/badge/commands/thettwe/nyann/cleanup-branches.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 613 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00054 $0.00613
Opus 5 $0.00027 $0.00307
Sonnet 5 $0.00011 $0.00123
Haiku 4.5 $0.00005 $0.00061

Measured 7d ago against content hash 87f6457303ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

nyann:cleanup-branches 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 7d 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.

commands/cleanup-branches.md · 58 lines

What it actually says

Plugin root: This is a Claude Code plugin, NOT a CLI tool. Do NOT search via which, npm list, pip list, or brew list. This file is at <plugin_root>/commands/. All scripts: <plugin_root>/bin/. Read the matching skills/*/SKILL.md for the full flow.

/nyann:cleanup-branches

Wraps bin/cleanup-branches.sh. Same --yes-required-to-mutate contract as /nyann:undo and /nyann:migrate-profile.

When to invoke

  • "clean up branches" / "delete merged branches" / "prune local branches" → run this.
  • "I see N merged branches in /nyann:doctor's output" → exact same flow.

Output

A CleanupBranchesResult JSON:

Mode Triggered by What happens
preview (default) List candidates + warn "re-run with --yes". Nothing deleted.
dry-run --dry-run Same shape, no warn. Nothing deleted.
applied --yes git branch -d per candidate. Failures land in errors[].

Safety

  • git branch -d (lowercase d) refuses to delete an unmerged branch even if the candidate list says it should be safe — race conditions between preview and apply can't drop unmerged work.
  • Current branch and base branch are never candidates.
  • Remote-tracking refs aren't touched. Use git push --delete origin <branch> separately if you want to mirror to the remote.

See also:

  • /nyann:doctor — shows the merged-branch count alongside other hygiene signals.
  • /nyann:undo — undo the last commit (different shape, same preview-mutate contract).
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. 7d ago First seen · 58 lines · 54 tokens per session scan A 87f6457303ce

Subscribe to this mod's changes

nyann:cleanup-branches is a command published in the GitHub repository thettwe/nyann (6 stars, last pushed 8d ago), licensed MIT. It adds 54 tokens to every session and 613 once invoked, about $0.0003 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 commands, from other repositories

composite-actions

Generate, review, secure, and test composite GitHub Actions following best practices — full repo scaffold, interview-driven generation, PR creation on existing repos, SHA pinning, secrets-as-inputs, job summaries, and actionlint validation.

nitinjain999/platform-skills · 51 tokens

gitops

Flux CD and Argo CD — two modes. debug: five structured debug workflows for live clusters (installation, source, HelmRelease, Kustomization, ResourceSet) producing a five-section report. audit: six-phase read-only repo analysis (discovery, validation, API compliance, best practices, security) producing a prioritised…

nitinjain999/platform-skills · 76 tokens

triage

Triages a PR comment — from a bot (Copilot, CI) or a human reviewer. Fetches the comment and diff via gh CLI, classifies it, applies the fix directly to the file if valid, posts a reply on the thread, and resolves it. Run from inside the repo.

nitinjain999/platform-skills · 64 tokens

commit

Analyze git diffs or staged changes and generate conventional commit messages that explain WHY a change was made. Supports auto-detecting type and scope, intelligent file staging, and interactive overrides. Use when asked to "write a commit message", "generate a commit", "describe my changes", "commit this"…

nitinjain999/platform-skills · 74 tokens

genshijin-commit

A command that writes a commit message for changes already placed in Git's staging area. It follows the repository's existing language and uses a short imperative subject without AI attribution.

InterfaceX-co-jp/genshijin · 16 tokens

commit

Smart conventional commit with security validation, branch flow enforcement, and auto-detection. Use for git commit, commit changes, save work, stage and commit.

fusengine/agents · 31 tokens