worktree-beads-tmux-orchestrator
npx skills add https://github.com/bowtiedswan/worktree-beads-tmux-skill --skill worktree-beads-tmux-orchestrator
Agent 安装分布
Skill 文档
Worktree-Beads-Tmux Orchestrator
Overview
This skill orchestrates a professional-grade development workflow by combining four powerful tools:
- Git Worktrees: Parallel development environments without context loss
- Beads: Git-backed graph task tracker for AI agents
- Beads Viewer (bv): TUI and analysis engine for task visualization
- Tmux: Persistent terminal sessions that survive disconnects
The skill automatically identifies the user’s scenario and recommends optimal workflow patterns.
Workflow Decision Tree
User Request
â
ââ⺠"Setup new project workflow" âââââââ⺠Setup Workflow
â
ââ⺠"Switch to different task" âââââââââ⺠Context Switch Pattern
â
ââ⺠"Working on multiple features" âââââ⺠Parallel Development Pattern
â
ââ⺠"Hotfix needed" ââââââââââââââââââââ⺠Interrupt Response Pattern
â
ââ⺠"Organize my terminal" âââââââââââââ⺠Tmux Session Pattern
â
ââ⺠"Track tasks/Create task" ââââââââââ⺠Beads Task Management
â
ââ⺠"View tasks/What's next" âââââââââââ⺠Beads Analysis
â
ââ⺠"Review PR/Check branch" âââââââââââ⺠Review Workflow Pattern
Scenario Detection
Pattern 1: Long-Running Feature Development
Signals: “Working on epic”, “big refactor”, “feature will take weeks” Approach:
- Create dedicated worktree:
git worktree add ../feature-name -b feature/name - Initialize beads:
bd init - Break down with beads: Create epic â tasks â subtasks
- Setup tmux session:
tmux new-session -d -s feature-name - Daily: Use
bv --robot-planfor parallel execution tracks
Pattern 2: Interrupt-Driven Development
Signals: “Need to fix bug”, “hotfix”, “urgent issue”, “interrupt” Approach:
- Check if hotfix worktree exists:
git worktree list - If not:
git worktree add ../hotfix-{issue} main - Switch to hotfix:
cd ../hotfix-{issue} - No stash/checkout/pop needed – zero context loss
- Fix, commit, push, return to original worktree
Pattern 3: Multi-Branch Code Review
Signals: “Review PR”, “check someone’s branch”, “review code” Approach:
- Create temporary worktree:
git worktree add --detach ../pr-{number} - Fetch PR:
git fetch origin pull/{number}/head:pr-{number} - Checkout:
git checkout pr-{number} - Review in tmux window:
tmux new-window -n pr-{number} - Delete when done:
rm -rf ../pr-{number} && git worktree prune
Pattern 4: Terminal Organization
Signals: “Organize terminal”, “persistent session”, “disconnected”, “SSH” Approach:
- Create tmux session:
tmux new-session -d -s {project} - Setup windows: editor, beads, terminal, logs
- Start bv in beads window
- Attach:
tmux attach -t {project} - Detach with
Ctrl+b d– session persists
Pattern 5: Task Management & Planning
Signals: “Create task”, “track issue”, “what to work on”, “prioritize” Approach:
- Human mode: Run
bvfor TUI - AI mode: Run
bv --robot-triagefor JSON analysis - Create:
bd create "Title" -p 0 - Claim:
bd update {id} --claim - Check dependencies:
bv --robot-insights | jq '.CriticalPath'
Core Capabilities
1. Automated Workflow Setup
For new projects, execute setup sequence:
#!/bin/bash
# setup-workflow.sh - Generated by this skill
PROJECT_NAME=$1
REPO_URL=$2
# Create directory structure
mkdir -p ~/worktrees/${PROJECT_NAME}
cd ~/worktrees/${PROJECT_NAME}
# Clone as bare repo
git clone --bare ${REPO_URL} .git
cd .git
# Create main worktree
git worktree add ../main
# Initialize beads
cd ../main
bd init
# Create AGENTS.md entry
cat >> AGENTS.md << 'EOF'
## Workflow Tools
This project uses worktree-beads-tmux workflow:
- `bd ready` - List available tasks
- `bv --robot-triage` - AI task analysis
- `git worktree list` - Show worktrees
- `tmux attach -t {project}` - Attach to session
EOF
# Setup tmux session
tmux new-session -d -s ${PROJECT_NAME} -c ~/worktrees/${PROJECT_NAME}/main
tmux new-window -t ${PROJECT_NAME}:2 -n beads
tmux send-keys -t ${PROJECT_NAME}:2 "bv" Enter
echo "Setup complete! Attach with: tmux attach -t ${PROJECT_NAME}"
2. Context Switch Helper
When user needs to switch contexts:
# List all worktrees with their beads status
for dir in ~/worktrees/${PROJECT}/*/; do
if [ -d "$dir/.beads" ]; then
echo "Worktree: $dir"
(cd "$dir" && bd ready 2>/dev/null | head -5)
echo "---"
fi
done
3. Smart Tmux Session Management
# Check if session exists, create if not
if ! tmux has-session -t ${PROJECT} 2>/dev/null; then
tmux new-session -d -s ${PROJECT} -c ${WORKDIR}
tmux new-window -t ${PROJECT}:2 -n beads -c ${WORKDIR}
tmux new-window -t ${PROJECT}:3 -n logs -c ${WORKDIR}
fi
tmux attach -t ${PROJECT}
4. Beads Integration Commands
Human Workflow:
bv # Launch TUI
# Press 'r' for ready tasks
# Press 'i' for insights
# Press 'g' for graph view
AI Agent Workflow:
# Always use --robot-* flags in agent context
bv --robot-triage # Full analysis
bv --robot-next # Top pick only
bv --robot-plan # Parallel execution tracks
bv --robot-insights # Graph metrics
bv --robot-diff --diff-since HEAD~7 # Recent changes
Quick Reference
Git Worktree Commands
| Command | Purpose |
|---|---|
git worktree add <path> <branch> |
Create new worktree |
git worktree add -b <new-branch> <path> |
Create worktree + branch |
git worktree list |
List all worktrees |
git worktree prune |
Clean up stale entries |
rm -rf <path> |
Remove worktree (then prune) |
Beads Commands
| Command | Purpose |
|---|---|
bd init |
Initialize beads |
bd ready |
List unblocked tasks |
bd create "Title" -p 0 |
Create P0 task |
bd show <id> |
Show task details |
bd update <id> --claim |
Claim task |
bd dep add <child> <parent> |
Add dependency |
bd sync |
Sync with remote |
Beads Viewer Commands
| Command | Purpose |
|---|---|
bv |
Launch TUI (human only) |
bv --robot-triage |
Full analysis (AI) |
bv --robot-next |
Top pick (AI) |
bv --robot-plan |
Execution plan (AI) |
bv --robot-insights |
Graph metrics (AI) |
Tmux Commands
| Command | Purpose |
|---|---|
tmux new-session -s name |
New session |
tmux attach -t name |
Attach to session |
tmux ls |
List sessions |
Ctrl+b d |
Detach |
Ctrl+b c |
New window |
Ctrl+b % |
Split vertical |
Ctrl+b " |
Split horizontal |
Installation
One-Time System Setup
# Install beads
curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
# Install beads viewer
brew install dicklesworthstone/tap/bv
# Install tmux
brew install tmux # macOS
sudo apt-get install tmux # Ubuntu/Debian
# Verify git version (need 2.5+)
git --version
Per-Project Setup
# In your project directory
cd ~/projects/my-project
# Initialize beads
bd init
# Create tmux session
tmux new-session -d -s my-project
tmux new-window -t my-project:2 -n beads
tmux send-keys -t my-project:2 "cd ~/projects/my-project && bv" Enter
# Add to AGENTS.md
echo "Use 'bd' for task tracking. See 'bv --robot-triage' for planning." >> AGENTS.md
Common Patterns
Pattern: Daily Standup Prep
# Get project health
bv --robot-insights | jq -r '.quick_ref'
# See what changed
bv --robot-diff --diff-since yesterday
# Check blockers
bv --robot-insights | jq '.Blockers'
Pattern: Sprint Planning
# Get parallel execution tracks
bv --robot-plan
# Identify critical path
bv --robot-insights | jq '.CriticalPath'
# Find cycles (must fix!)
bv --robot-insights | jq '.Cycles'
Pattern: End-of-Day Sync
# Sync beads
bd sync
# Export current state
bv --export-md ~/beads-reports/$(date +%Y-%m-%d).md
# Detach tmux session
Ctrl+b d
Troubleshooting
Worktree Issues
Problem: Worktree already exists error
# Remove stale worktree reference
git worktree prune -v
# Or force remove
git worktree remove <path> --force
Problem: Permission denied when removing worktree
# Manually remove then prune
rm -rf <path>
git worktree prune
Beads Issues
Problem: bd command not found
# Add to PATH
export PATH="$HOME/.beads/bin:$PATH"
# Or reinstall
curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
Problem: bv TUI not displaying correctly
# Check terminal supports Unicode
echo -e '\u2500\u2502\u250c\u2510'
# Use ASCII mode if needed
bv --ascii
Tmux Issues
Problem: Session already exists
# Attach to existing
tmux attach -t session-name
# Or kill and recreate
tmux kill-session -t session-name
tmux new-session -d -s session-name
Problem: Tmux key bindings not working
# Check prefix key
tmux list-keys | grep prefix
# Common prefixes: Ctrl+b (default), Ctrl+a (custom)
Best Practices
Worktree Organization
~/worktrees/
âââ project-a/
â âââ .git/ # Bare repo
â âââ main/ # main branch
â âââ feature-auth/ # feature branch
â âââ hotfix-bug/ # hotfix branch
âââ project-b/
âââ .git/
âââ main/
âââ experiment/
Tmux Session Naming
- Use project names:
{project}for main - Use descriptive names:
{project}-{feature}for features - Use temporary names:
pr-{number}for PR reviews
Beads Workflow Integration
- Always claim tasks before working:
bd update <id> --claim - Use robot mode in agent contexts:
bv --robot-* - Check for cycles regularly:
bv --robot-insights | jq '.Cycles' - Sync at end of day:
bd sync
Resources
- Beads: https://github.com/steveyegge/beads
- Beads Viewer: https://github.com/Dicklesworthstone/beads_viewer
- Git Worktrees: https://git-scm.com/docs/git-worktree
- Tmux: https://github.com/tmux/tmux/wiki
References
See references/ directory for:
workflow-guide.md– Comprehensive workflow documentationcommands-reference.md– Full command referencescenario-patterns.md– Common patterns by scenario