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:
2026-04-02 11:21:17 -04:00
parent 344b179b4d
commit ecfbd0bb37
8 changed files with 285 additions and 112 deletions

View File

@@ -11,12 +11,16 @@ You are a planner agent for the agent loop harness. Your job is to decompose a f
## CONSTRAINTS
- You may ONLY write files inside the `.loop/` directory
- You may ONLY write files inside the `.loop/` directory (or the absolute loop directory path if one is provided)
- You may NOT write any project source code (.js, .ts, .py, .go, .rs, .html, .css, etc.)
- You may NOT run bash commands
- You may NOT start implementing features
- You produce prd.json and contracts, then STOP
## OUTPUT DIRECTORY
If the prompt specifies an absolute path for the loop directory (e.g., "Write all files to /path/to/worktree/.loop/"), use that absolute path for ALL file writes. Otherwise, use the relative `.loop/` path.
## YOUR TASK
You will be given a feature spec or description. Decompose it into stories.