switch Command
What It’s For
Section titled “What It’s For”Move into the right worktree quickly without manually changing directories.
What It Does
Section titled “What It Does”- Selects an existing worktree and opens a new terminal context there.
- Supports parent-only, child-repo-only, or combined worktree scopes.
- Uses terminal-aware launch behavior (tmux, Herdr, cmux, VS Code, Cursor, Kiro, managed Kitty, and common terminal apps).
arashi switch [filter] [options]Key Options
Section titled “Key Options”--repostarget child repositories in the current workspace only.--alltarget parent workspaces and nested child repo worktrees.--cdrequest parent-shell directory switching for one invocation.--launchforce launch behavior while preserving a configured named launcher.--ignore-configured-launcherignore a configured named launcher without erasing configured or contextual launch behavior.--pathtreat the argument as an exact worktree path instead of a fuzzy filter.--tabrequest a tab in the selected supported terminal or managed context for this invocation.--tmuxopen the selected worktree in a new plain tmux window for this invocation.--seshrun sesh mode in tmux (requires active tmux session andsesh).--herdropen or focus the selected existing worktree in a running Herdr session.--vscode,--cursor,--kiroexplicitly open the selected worktree in that IDE for one invocation.-j, --jsonoutput machine-readable results when the selected mode can be represented safely.
Examples
Section titled “Examples”# Pick from parent workspace worktreesarashi switch
# Match child repos by repository name firstarashi switch --repos docs
# Include parent workspaces plus child repo worktreesarashi switch --all
# Select one exact worktree by full patharashi switch --path /path/to/worktree
# Force the selected worktree to open in Cursorarashi switch --cursor feature-auth
# Change the current shell directory when shell integration is activearashi switch --cd feature-auth
# Use sesh/tmux switching modearashi switch --sesh
# Force a new plain tmux window instead of another configured or detected launcherarashi switch --tmux feature-auth
# Request a tab in the current supported terminal or managed contextarashi switch --tab feature-auth
# Open or focus the selected worktree in Herdrarashi switch --herdr feature-auth
# Force launch behavior while preserving a configured named launcherarashi switch --launch
# Request generic automatic launch, ignoring a configured named launcherarashi switch --launch --ignore-configured-launcher
# Ask for a structured result instead of human-oriented outputarashi switch feature-auth --json- Default scope is parent repository worktrees only.
- In
--reposmode, filter text matches repository names first:- exact repo match wins
- otherwise a unique partial repo match is selected
- If
--reposhas no repo matches, Arashi prints available child repositories. - Configure one default under
defaults.switch.mode. The complete mode vocabulary isauto | cd | launch | sesh | herdr;tmuxis deliberately not a configured value.--tmuxis a per-invocation-only override, while configuredautochooses plain tmux contextually inside an active tmux session. --pathrequires an exact worktree path and skips fuzzy branch/path matching.launchalways uses automatic launcher selection without preferring parent-shell switching.seshandherdralways select that launcher, even when shell integration or another managed context is active.- An absent mode preserves automatic launch and does not newly prefer parent-shell
cdin configured or standalone repositories. --tabis a CLI-only, one-invocation disposition. It overrides configured or contextual parent-shellcdand bypasses configuredseshorherdrlaunch defaults, so--tabalone uses automatic launcher resolution. It conflicts only with explicit--cd; canonical--launchand--ignore-configured-launcherremain compatible. It composes with explicit launcher selectors, which stay authoritative while--tabcontrols disposition; unsupported selected adapters fail without opening a window or falling through. See the launch disposition workflow for the complete matrix, JSON behavior, and safety boundaries.- Configured
autouses this order: tmux → Herdr → cmux → integrated IDE → Kitty → parent-shellcd→ terminal/platform fallback. Parent-shell switching is considered only when no managed context is strictly detected; it requires shell integration. - Explicit launcher flags take precedence over configuration and environment detection.
--tmuxtherefore overrides configuredcd,sesh, orherdrbehavior and detected Herdr, cmux, or IDE contexts.--tmuxconflicts with--cd,--sesh,--herdr,--vscode,--cursor, and--kiro; Arashi reports the complete set instead of choosing by flag order. --tmuxrequires a non-emptyTMUXvalue after trimming. Run the command from an active tmux client/session or choose another launcher. If the prerequisite is missing ortmux new-windowfails, explicit tmux does not fall back to sesh, Herdr, cmux, an IDE, parent-shellcd, or a platform terminal.--tmux+--launchis compatible launch intent.--tmux+--ignore-configured-launcherremains explicit and authoritative, bypassing any configured named launcher rather than disabling tmux.- Arashi invokes
tmux new-window -c <worktree-path>without a shell; even paths containing spaces, quotes, or shell-significant characters remain the exact single argument aftertmux new-window -c. - Explicit tmux has the same behavior in a zero-config standalone repository: Arashi discovers the standalone target and opens it without creating or persisting Arashi configuration. Configured-only
--reposand--allrestrictions are unchanged. --launchpreserves configuredseshorherdr. With only--ignore-configured-launcher, configuredauto,cd, orlaunchbehavior remains unchanged, while configuredseshorherdrkeeps launch behavior but uses automatic launcher resolution. Combining them as--launch --ignore-configured-launcherrequests generic automatic launch.--cdconflicts with--launch,--tab, and every explicit launcher selector. Canonical and compatibility synonyms for the same intent remain redundant but compatible.- Explicit
--cdwarns and does not launch if parent-shell switching is unavailable. Configuredcdwarns and falls back to automatic launch in that situation. - Automatic Herdr detection requires
HERDR_ENVto trim to the exact string1. Similar values such as0ortruedo not select Herdr, and automatic tmux keeps precedence when both environments are active. --herdrconflicts with--sesh, explicit IDE flags, and--cd. Arashi rejects the combination instead of choosing one implicitly.- Herdr launch requires v0.7.4 on
PATH, a reachable running default session/socket, and a Git-resolved non-bare main checkout for the selected repository. Bare-only repositories fail before invoking Herdr. - Herdr opens the existing target through
herdr worktree open, focuses it, and reuses an already-open workspace. The requested label is<repo-name>: <branch-name>and can rename a reused workspace. - A missing CLI/socket, non-zero process exit, invalid JSON, protocol mismatch, or missing workspace ID produces actionable
LAUNCH_FAILEDoutput. Once Herdr is selected, Arashi does not fall through to another launcher. - In a cmux-managed terminal, automatic launch creates and focuses a new cmux workspace at the exact selected worktree. Arashi detects cmux from
CMUX_WORKSPACE_IDorCMUX_SURFACE_ID, not from Ghostty’s sharedTERM_PROGRAMvalue. - cmux launch requires cmux v0.64.18 or newer and local CLI socket access. If the CLI/socket is unavailable or its structured response cannot be validated, Arashi reports
LAUNCH_FAILEDinstead of opening standalone Ghostty. - An active tmux session inside cmux or Herdr keeps tmux precedence during automatic launch. Explicit
--sesh,--herdr,--vscode,--cursor, and--kirobehavior remains authoritative. - In Kitty 0.43+ with permitted remote control, automatic launch reuses and focuses the exact live worktree window or creates one managed session-backed tab. Once Kitty is selected, prerequisite, inspection, focus, launch, or validation failure reports
LAUNCH_FAILEDand does not fall back. See the Kitty workflow guide for safe setup, live-only ownership, and troubleshooting. - Install shell integration with
arashi shell installor print manual wrapper code witharashi shell init <bash|zsh|fish>. - If
--cdcannot act on the parent shell because the wrapper is inactive, Arashi warns and skips launch fallback for that invocation. - When automatic launch reaches an integrated IDE and its optional CLI is unavailable, Arashi continues to terminal/platform fallback without returning to
cd. A selected tmux, Herdr, or cmux failure—or an available IDE CLI that fails—remains an actionable launch failure and does not try another launcher orcd. - The VS Code extension passes the matching IDE flag automatically and uses exact-path switching for selected worktrees so duplicate branch names do not cause ambiguous matches.
- JSON mode does not launch editors, terminals, tmux, sesh, or parent-shell
cdbehavior unless the command can return a safe non-mutating plan.switch --json --tmuxreturns exactly one JSON document withJSON_UNSUPPORTED_FOR_MODEand the existinglaunchmode label before launcher-conflict or tmux-context validation, including whenTMUXis blank. It does not switch or invoke tmux.
Deprecated compatibility spellings
Section titled “Deprecated compatibility spellings”The legacy --no-cd maps to --launch, and --no-default-launch maps to --ignore-configured-launcher. They remain parseable only as deprecated compatibility metadata throughout Arashi 1.x; preferred options, examples, and automation should use the canonical spellings above. Removal may happen no earlier than Arashi 2.0 and requires a separately approved breaking-change issue.
Related Commands
Section titled “Related Commands”switch supports standalone repository worktrees; multi-repository scopes such as --repos and --all are configured-mode features. See the Standalone Repository workflow.