delete

A cleanup command for removing a Git worktree and its associated local branch. It also removes empty directories left behind and handles the related tmux session.

In plain words
What is it for?
Deleting an orchestra member by branch name, including its worktree directory, empty parent directories, local branch, and tmux session.
Why use it?
It removes the manual cleanup work and prevents finished branch environments from being left on disk.

Command

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 commands/mirinodev/maestro/delete
Clone the repo
git clone --depth 1 https://github.com/mirinodev/maestro
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 2,740 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 $0.00000 $0.02740
Opus 5 $0.00000 $0.01370
Sonnet 5 $0.00000 $0.00548
Haiku 4.5 $0.00000 $0.00274

Measured yesterday against content hash 76593b98cdf3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

delete 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 yesterday.

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.

docs/commands/delete.md · 390 lines

How it starts

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

🔸 delete

Command for orchestra members (Git worktrees) to exit the stage. Provides complete cleanup by removing both the worktree directory and associated local branch.

Overview

mst delete <branch-name> [options]
mst rm <branch-name> [options]  # alias

What gets deleted

When an orchestra member exits the stage, Maestro performs a complete cleanup:

  1. Worktree directory - The physical directory containing the branch's files
  2. Empty parent directories - Any empty directories left behind after worktree deletion
    • Automatically cleans up empty parent directories (useful for branches like feature/api which would leave empty feature/ directory)
    • Recursively removes empty directories up to the repository base directory
    • Provides visual feedback showing which directories were cleaned up with the message: 🧹 Removed empty directory: {directory-name}
  3. Local branch - The Git branch associated with the worktree
    • First attempts safe deletion with git branch -d
    • Automatically retries with git branch -D if the branch is not fully merged
    • Ensures complete cleanup without manual intervention
  4. tmux session - The tmux session with the same name as the worktree (if exists)
    • Default behavior: Automatically terminates the session when deleting the worktree
    • Session names are normalized to handle special characters (e.g., feature/api-auth becomes feature-api-auth)
    • Use --keep-session to preserve the tmux session after deletion

This ensures no orphaned branches, sessions, or empty directories remain after worktree deletion.

Usage Examples

Basic Usage

# Orchestra member exits the stage (removes both worktree and local branch)
mst delete feature/old-feature

# Force exit (even with uncommitted changes)
mst delete feature/old-feature --force

# Keep tmux session after worktree exits
mst delete feature/old-feature --keep-session

# Select with fzf for exit
mst delete --fzf

Read the full file on GitHub · 390 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. yesterday First seen · 390 lines · 0 tokens per session scan A 76593b98cdf3

Subscribe to this mod's changes

delete is a command published in the GitHub repository mirinodev/maestro (9 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,740 tokens. 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.