๐จ EXECUTION NOTICE FOR CLAUDE
When you invoke this command via SlashCommand, the system returns THESE INSTRUCTIONS below.
YOU are the executor. This is NOT an autonomous subprocess.
- โ
The phases below are YOUR execution checklist
- โ
YOU must run each phase immediately using tools (Bash, Read, Write, Edit, TodoWrite)
- โ
Complete ALL phases before considering this command done
- โ DON't wait for "the command to complete" - YOU complete it by executing the phases
- โ DON't treat this as status output - it IS your instruction set
Immediately after SlashCommand returns, start executing Phase 0, then Phase 1, etc.
See @CLAUDE.md section "SlashCommand Execution - YOU Are The Executor" for detailed explanation.
Arguments: $ARGUMENTS
Goal
Create isolated git worktree for each spec, enabling parallel development without conflicts. All agents working on a spec share the same worktree.
Modes:
<spec-name> - Single spec (e.g., 001-red-seal-ai)
--all or --bulk - All specs at once (100+ specs supported)
Performance Optimization: Use pnpm for Multi-Worktree Development
Recommended for projects creating multiple worktrees:
If your project uses Node.js/npm, consider converting to pnpm for dramatic performance improvements:
# Convert your project (one-time setup)
/foundation:use-pnpm
# Or manually:
npm install -g pnpm
cd /path/to/your/project
rm -rf node_modules package-lock.json
pnpm install # Creates pnpm-lock.yaml
Benefits for Worktree Workflows:
- โก 80-90% faster installs - 5-10s instead of 30-60s per worktree
- ๐พ 75% less disk space - 600MB instead of 2GB for 4 worktrees
- ๐ Still isolated - Each worktree gets correct dependency versions
- ๐ค Auto-detected - Worktree system automatically uses pnpm if available
How it works:
- First worktree: Downloads to global cache (
~/.pnpm-store/)
- Subsequent worktrees: Create hardlinks from cache (near-instant)
- Each worktree still has isolated
node_modules/ with correct versions
System automatically detects and uses pnpm - no changes to workflow needed!
Phase 1: Discovery
Actions:
- Check if bulk mode requested (--all or --bulk in arguments)
Single Spec Mode
- Parse spec name from arguments: $ARGUMENTS (e.g., F001 or 001-red-seal-ai)
- Find spec directory (phase-nested first, then legacy):
!{bash find specs/phase-* -type d -name "$ARGUMENTS" 2>/dev/null | head -1 || find specs -type d -name "$ARGUMENTS" 2>/dev/null | head -1}
- Verify spec directory exists
- Extract spec number (e.g., "001" from "F001-red-seal-ai")
- Extract spec name (e.g., "red-seal-ai" from "F001-red-seal-ai")
- Get current git branch and verify clean working directory
Bulk Mode (--all or --bulk)
- Scan all specs across all phases:
specs/phase-*/F*
- Fall back to legacy:
specs/*/
- Extract spec numbers and names
- Count total worktrees to create (one per spec)
- Show summary and confirm with user
Phase 2: Worktree Creation & Mem0 Registration
Single Spec Mode
Actions:
- Invoke worktree-coordinator agent to:
- Create single git worktree for the spec
- Install dependencies in worktree (Node.js, Python)
- Register worktree in Mem0 for global tracking
- The agent handles:
- Extract spec number (e.g., "001" from "001-red-seal-ai")
- Extract spec name (e.g., "red-seal-ai")
- Create branch: spec-{spec-number}
- Create worktree: git worktree add ../{project}-{spec-number} -b spec-{spec-number}
- Register in Mem0:
register-worktree.py register --spec {spec} --spec-name {name} --path {path} --branch {branch}
- Install dependencies:
register-worktree.py setup-deps --path {path} (auto-detects npm/pnpm/yarn/pip)
- Display created worktree with git worktree list
Bulk Mode
Actions:
Phase 3: Verification
Actions:
- Verify all worktrees created successfully
- Check each worktree is on correct branch
- Ensure layered-tasks.md symlinks are valid
- Count total worktrees created
Phase 4: Mem0 Verification
Actions:
- Query Mem0 to verify all registrations successful
- Run:
register-worktree.py list to show active worktrees
- Confirm agents can query their assignments
Phase 5: Summary
Display:
- Spec name and number
- Worktree path and branch
- Dependencies installation status
- Registered in Mem0 for agent discovery
- How agents query:
register-worktree.py get-worktree --spec {number}
- Next steps: Any agent working on this spec will automatically use the worktree