attach

A command for creating independent Git worktree environments from existing local or remote branches. A worktree is a separate directory where you can work on another branch without changing your current one.

In plain words
What is it for?
Attaching to a local or remote branch, optionally fetching updates, opening an editor, running a command, setting up the environment, or entering a shell.
Why use it?
It avoids manually creating worktrees and setting up an environment when joining existing branch work.

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/attach
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 1,827 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.01827
Opus 5 $0.00000 $0.00914
Sonnet 5 $0.00000 $0.00365
Haiku 4.5 $0.00000 $0.00183

Measured 2d ago against content hash 7a646ae1f0a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

attach 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 2d 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.

docs/commands/attach.md · 337 lines

How it starts

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

🔸 attach

Command to create orchestra members (Git worktrees) from existing branches. Allows you to attach to local or remote branches to create independent development environments.

Overview

mst attach [branch-name] [options]
mst a [branch-name] [options]  # alias

Usage Examples

Basic Usage

# Interactive branch selection from available branches
mst attach

# Attach to specific local branch
mst attach feature/existing-feature

# Include remote branches in selection
mst attach --remote

# Attach to specific remote branch
mst attach origin/feature/remote-branch --remote

Advanced Usage

# Fetch latest remote data before listing branches
mst attach --fetch --remote

# Attach and open in editor with environment setup
mst attach feature/api --open --setup

# Attach and execute command
mst attach bugfix/issue-123 --exec "npm test"

# Attach and enter shell session
mst attach feature/new --shell

Options

Option Short Description Default
--remote -r Include remote branches in selection false
--fetch -f Fetch from remote before listing branches false
--open -o Open in editor (Cursor/VSCode) after attachment false
--setup -s Run environment setup (npm install) false
--shell Enter shell session after attachment false
--exec <command> Execute command after attachment none

Branch Selection

Interactive Mode

When no branch name is provided, displays an interactive menu:

? Which branch would you like to attach to?
❯ [local] feature/authentication
  [local] bugfix/login-issue
  [remote] origin/feature/api-v2
  [remote] origin/hotfix/security-patch

Available Branches

Read the full file on GitHub · 337 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. 2d ago First seen · 337 lines · 0 tokens per session scan A 7a646ae1f0a7

Subscribe to this mod's changes

attach 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 1,827 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.