End-to-end guide for running parallel Claude Code agents with stacked PRs.
Prerequisites:
- Go
- git
- tmux
- gh CLI with the
gh-stackextension
# Install gh-stack
gh extension install timrogers/gh-stack
# Clone and install amp
git clone https://github.com/mdawess/amp
cd amp
make installMake sure ~/go/bin is in your PATH:
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcVerify: amp --help
Each feature gets its own tmux session and git worktree. Worktrees are created as sibling directories to your repo.
# Start tmux (or attach to an existing server)
tmux new-session -s main
# Create a worktree + tmux session for a feature
amp worktree new <branch>
# e.g. amp worktree new 0-auth-base
# This creates the branch, a sibling worktree directory, and opens a new tmux sessionFor customer-specific work that branches off a non-main base:
git checkout ward
amp worktree new 0-ward-featureEach agent should get its own session so they run fully isolated.
| Action | Keybinding |
|---|---|
| Switch to previous session | Option+p |
| Switch window up | Option+k |
| Switch window down | Option+j |
| New tmux window | Alt+t |
Tmux prefix is Ctrl+a.
Open the worktree session for the feature you want to work on, then launch Claude Code:
claudeClaude will pick up the global CLAUDE.md guidelines automatically, including the stacked PR workflow.
For parallel features, create a separate worktree and session per feature, then run claude in each:
# Terminal 1
amp worktree new 0-feature-a
# navigate to that session, run: claude
# Terminal 2
amp worktree new 0-feature-b
# navigate to that session, run: claudeEach agent works in isolation and will create its own local stack.
Agents manage the stack themselves, but here's what's happening under the hood and how to interact with it.
Each stack is scoped to one feature. Layers build on each other:
main
└── 0-auth-base ← foundational layer (types, schema)
└── 1-auth-middleware ← depends on base
└── 2-auth-routes ← depends on middleware
amp stack init 0-<feature> # start the stack
amp stack add 1-<next> # add a layer
amp stack ls # inspect the stackamp stack push # push all branches to remote
amp stack submit # open PRs for the full stackAgents never push or open PRs — that's always a human step.
Agents are fully autonomous within their session but require human action at two points:
When an agent finishes, it outputs a concise summary of what changed. Review this summary, then inspect the stack:
amp stack ls # see the layers
git log --oneline # review commits per branch
git diff main...HEAD # diff against baseOnce you're satisfied:
amp stack push # push all branches
amp stack submit # open PRs (one per layer, stacked)Review each PR in order from bottom to top before merging. Merge the base layer first, then each layer above it in sequence.
amp worktree rm <branch> # remove worktree and session when done