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:
@@ -7,26 +7,14 @@ description: "Generate prd.json and sprint contracts by dispatching the planner
|
||||
|
||||
Dispatch the planner agent to decompose a spec into stories. The planner agent cannot write source code or run bash commands — it can only write to `.loop/`.
|
||||
|
||||
**Note:** In most cases, use `/agent-loop:run` instead — it handles worktree creation, story generation, and launching the loop in one flow. Use `/agent-loop:stories` only if you want to generate stories without launching the loop.
|
||||
|
||||
## Instructions
|
||||
|
||||
### 1. Check prerequisites
|
||||
|
||||
Verify `.loop/config.json` exists. If not, tell the user to run `/agent-loop:setup` first and stop.
|
||||
|
||||
If `.loop/prd.json` already exists, check whether the previous run is complete:
|
||||
|
||||
```bash
|
||||
source .loop/lib/state.sh 2>/dev/null; LOOP_DIR=.loop all_stories_pass 2>/dev/null && echo "ALL_PASSED" || echo "IN_PROGRESS"
|
||||
```
|
||||
|
||||
If `ALL_PASSED`, archive the completed run before generating new stories:
|
||||
|
||||
```bash
|
||||
LOOP_DIR=.loop source .loop/lib/state.sh && source .loop/lib/archive.sh && archive_and_reset .loop
|
||||
```
|
||||
|
||||
If `IN_PROGRESS`, warn the user that a run is active and ask whether to archive it or abort.
|
||||
|
||||
### 2. Find the spec
|
||||
|
||||
Check these locations:
|
||||
@@ -54,9 +42,15 @@ Agent(
|
||||
)
|
||||
```
|
||||
|
||||
If a worktree path is known (e.g., passed as context), include it in the prompt:
|
||||
|
||||
```
|
||||
IMPORTANT: Write ALL files using absolute paths under: {WORKTREE_PATH}/.loop/
|
||||
```
|
||||
|
||||
### 5. Present results
|
||||
|
||||
After the planner finishes, read `.loop/prd.json` and show the user:
|
||||
After the planner finishes, read `.loop/prd.json` (or `{WORKTREE_PATH}/.loop/prd.json`) and show the user:
|
||||
|
||||
> **Plan Ready — Review Before Running**
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user