cmux-and-worktrees
cmux and Worktrees
Run concurrent coding sessions safely by isolating each task in a git worktree.
Non-Negotiable Command Rule
- Use
cmuxfor every command in this skill. - Do not substitute
git worktreein normal operation. - If a
cmuxcommand fails, verify availability withtype cmuxfirst.
Preflight
- Verify current directory is inside a git repo:
git rev-parse --is-inside-work-tree
- Verify
cmuxis available:
type cmux
- Ensure worktrees are ignored in git:
rg -n '^\.worktrees/$' .gitignore || echo '.worktrees/' >> .gitignore
- Inspect active worktrees:
cmux ls
Core Commands
- Create new isolated task:
cmux new <branch> - Resume existing task:
cmux start <branch> - Jump to worktree:
cmux cd [branch] - List worktrees:
cmux ls - Merge into primary checkout:
cmux merge [branch] [--squash] - Remove worktree + branch:
cmux rm [branch | --all] [--force] - Generate setup hook:
cmux init [--replace] - Show/set layout config:
cmux config,cmux config set layout <nested|outer-nested|sibling> [--global] - Update tool:
cmux update - Show version:
cmux version
Exact Workflows
Existing Branch -> Worktree
cd /path/to/repo
cmux ls
cmux start <existing-branch>
cmux cd <existing-branch>
bash .cmux/setup
Example:
cmux start eng-1296-onboarding-v2-question-view-context-dedupe
cmux cd eng-1296-onboarding-v2-question-view-context-dedupe
bash .cmux/setup
New Branch + New Worktree
cd /path/to/repo
cmux new <new-branch>
cmux cd <new-branch>
bash .cmux/setup
Example:
cmux new codex/pr1-onboarding-demographics-profile-report
cmux cd codex/pr1-onboarding-demographics-profile-report
bash .cmux/setup
Setup Hook Workflow
- Generate a project-specific setup hook:
cmux init
- If needed, regenerate:
cmux init --replace
- Commit
.cmux/setupso future worktrees inherit setup automatically. - Run setup after every
cmux newandcmux start:
bash .cmux/setup
Branch and Path Behavior
- Treat
newas "new branch + new worktree". - Treat
startas "reuse existing worktree/session". - Expect worktree paths under
.worktrees/<branch>/in nested layout. - Expect branch sanitization (e.g.,
feature/foobecomesfeature-foopath name). - One branch can only be checked out in one worktree at a time.
Safety Rules
- Ask for confirmation before
cmux rm --all. - Ask for confirmation before
cmux rm --force. - Prefer
cmux merge <branch> --squashfor compact history unless user requests full merge commits. - Ensure worktree changes are committed before merging.
- Remove finished worktrees after successful merge to reduce branch/worktree drift.
Troubleshooting
Not in a git repo: move to repo root, then rerun.Worktree not found: runcmux ls, then choose correct branch or create withcmux new <branch>.Branch already checked out: runcmux lsand use the existing worktree path.- Merge blocked by uncommitted changes: commit or stash inside the worktree, then retry.
- Remove blocked by dirty tree: clean state first, or use
cmux rm --forceonly with explicit confirmation. - Expo Router shows "Welcome to Expo" unexpectedly: kill stale
expo/metroprocesses, restart from the target worktree with--clear, and reopen dev client. - Mobile dev from a worktree:
cd apps/mobile
npm run dev -- --clear --host lan
More from psycho-baller/ai-agents-config
letterly-automation
Comprehensive automation for Letterly transcriptions. This skill exports the latest CSV from Letterly, processes "magic" notes into Obsidian markdown with custom metadata, semantically links them using a vector database, and moves them to the final Transcriptions directory. Use when the user asks to "process new letterly transcriptions", "sync letterly", or "import magic notes from letterly".
6letterly-exporter
Automates the process of exporting data from Letterly and saving it to your Obsidian vault.
6letterly-export
Automates the process of exporting your data from Letterly as a CSV file to your Obsidian vault's unprocessed directory. Used as the first step in the Letterly automation pipeline.
1letterly-process
Reads the Letterly CSV export in the unprocessed folder, extracts "magic" notes, and converts them into Markdown notes with frontmatter.
1intent-calendar-planner
Plan Rami's day or tomorrow from conversation, Google Calendar, and Obsidian project context. Use this whenever the user wants to plan the day, schedule tasks, patch `Actions`, decide what to work on, prioritize competing work, or turn loose intentions into time blocks, even if they do not explicitly mention calendars.
1