An opinionated workflow for parallel AI-assisted feature development using cmux, git worktrees, Claude Code and LazyVim. This repo contains a couple of shell scripts for the workflow.
midnight.demo.mov
When working with agentic AI tools like Claude Code, context isolation matters. Switching branches mid-session or sharing a working directory across multiple features leads to confused agents and tangled diffs.
These scripts create a clean, reproducible workflow:
- Each feature gets its own git worktree — a fully isolated checkout of the repo on a dedicated branch
- Each feature gets its own cmux workspace — a separate terminal tab, named after the feature
- Each workspace launches Claude Code autonomously, scoped only to that feature's files
The result: multiple features in flight simultaneously, each with its own AI agent, zero context bleed.
- cmux — terminal with workspace/tab management CLI
- Claude Code —
claudeCLI available in PATH - Neovim —
nvimCLI available in PATH. I recommend LazyVim. - gum — renders the session controls TUI (menus, confirmations). Install with
brew install gum. - git 2.5+
Clone or copy the scripts into a directory on your $PATH:
git clone https://github.com/appendjeff/agentic-workflow.git ~/agent-binAdd ~/agent-bin to your PATH if needed (e.g. in ~/.zshrc):
export PATH="$HOME/agent-bin:$PATH"Run from anywhere inside a git repository. Creates a new isolated workspace for a feature.
$ new-feature
Feature name: user auth redesign
What it does:
- Prompts for a feature name (e.g.
"user auth redesign") - Slugifies it into a branch name:
feature/user-auth-redesign - Ensures
.worktrees/is in.gitignore(adds it if missing) - Fetches
originand creates a worktree branching fromorigin/main - Opens a new named cmux workspace pointed at the worktree
- Starts
claude --dangerously-skip-permissionsin the left pane - Opens LazyVim (in file picker mode) in a right split pane for browsing/reviewing files
- Opens a terminal in a bottom split under Claude (~20% height)
- Refocuses the Claude pane
Result: A new cmux tab named "user auth redesign" with Claude on the top-left, a terminal on the bottom-left (~20%), and nvim on the right — all scoped to .worktrees/user-auth-redesign/ on branch feature/user-auth-redesign.
Run from inside a feature worktree when the work is complete (merged or abandoned).
$ done-feature
Cleaning up:
Branch: feature/user-auth-redesign
Worktree: /path/to/repo/.worktrees/user-auth-redesign
Workspace: 5B485556-0051-4F7C-826D-189F4E61F199
What it does:
- Guards against running from outside a
.worktrees/directory - Navigates to the main repo root
- Removes the worktree directory
- Deletes the local branch (
-d; prompts before force-deleting if unmerged) - Closes the cmux workspace (last, since this kills the shell)
# Start a new feature from any directory inside your repo
$ new-feature
Feature name: redesign search
# ... Claude works in the isolated worktree ...
# ... you review, merge the PR ...
# Clean up from inside the worktree tab
$ done-feature
Multiple features can be in flight simultaneously — each in its own cmux workspace with its own Claude session.