feat: worktree-based run isolation for parallel loops
Each /agent-loop:run now creates a git worktree for the feature branch before generating stories. This provides full isolation: - Multiple loops can run in parallel on different specs in the same project - Main working directory stays on main, always available - Each worktree has its own .loop/ state, tmux session, and branch - Completed runs are archived to main's .loop/archive/ with runs.log Changes: - setup.sh: add --init-worktree mode for initializing worktree .loop/ - archive.sh: add archive_from_worktree() for cross-directory archiving - loop.sh: replace branch checkout with validation (worktree is pre-checked-out) - agents/planner.md: accept absolute path prefix for worktree .loop/ writes - skills/run/SKILL.md: full rewrite — worktree creation in Phase 2, launch in Phase 3, archive on completion, .active-worktree tracking file - skills/stories/SKILL.md: worktree-aware, defer to /run for full flow Bump to 0.12.0.
This commit is contained in:
6
loop.sh
6
loop.sh
@@ -181,12 +181,14 @@ if [ -f "$LOOP_DIR/init.sh" ]; then
|
||||
bash "$LOOP_DIR/init.sh"
|
||||
fi
|
||||
|
||||
# Ensure correct git branch
|
||||
# Verify we're on the expected branch (worktree should already be on it)
|
||||
BRANCH=$(prd_branch_name 2>/dev/null || echo "")
|
||||
if [ -n "$BRANCH" ]; then
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
||||
if [ "$CURRENT_BRANCH" != "$BRANCH" ]; then
|
||||
log "Switching to branch: $BRANCH"
|
||||
log "WARNING: Expected branch '$BRANCH' but on '$CURRENT_BRANCH'"
|
||||
log "If running in a worktree, the branch should already be checked out."
|
||||
log "Attempting to switch..."
|
||||
git checkout "$BRANCH" 2>/dev/null || \
|
||||
git checkout -b "$BRANCH" "origin/$BRANCH" 2>/dev/null || \
|
||||
git checkout -b "$BRANCH"
|
||||
|
||||
Reference in New Issue
Block a user