diff --git a/plugin/skills/implement/SKILL.md b/plugin/skills/implement/SKILL.md index c477300c..3d86efe3 100644 --- a/plugin/skills/implement/SKILL.md +++ b/plugin/skills/implement/SKILL.md @@ -13,9 +13,31 @@ Load plan, dispatch subagents per task in wave order, verify completion. - **Session metadata is the source of truth** — the session-start hook injects a metadata block with `epic-id`, `epic-slug`, `feature-id`, `feature-name`, `feature-slug`, parent artifacts, and `output-target`. Use these values verbatim — do NOT re-derive, re-extract, or generate alternatives. - **Wave ordering drives sequencing** — foundation before consumers; parallel-safe waves dispatch all tasks concurrently; reviews run sequentially after all implementations complete - **Model escalation** — start cheap (haiku), escalate on failure (sonnet, then opus). See Reference > Model Escalation. -- **Working directory isolation** — the CLI provides the working directory; skills don't manage worktrees; each phase commits to the feature branch at checkpoint; merge happens only at /release +- **Working directory isolation** — `/implement` always creates a dedicated git worktree so the main repo stays clean on its current branch and multiple features can run in parallel. The worktree persists until `/release` completes the squash-merge. - **Subagent safety** — one agent per task; parallel-safe waves dispatch all tasks simultaneously, non-parallel-safe waves dispatch sequentially; agents commit per task via `git add ` + `git commit`; agents must NOT read the plan file, modify files outside their task's file list, or push/switch branches +## Phase 0: Worktree Setup + +Before dispatching the taskplanner, ensure work happens in an isolated worktree. + +### 0a. Check for existing worktree + +```bash +git worktree list +``` + +If `.claude/worktrees/` already appears (interrupted prior session), use `EnterWorktree` with `path: ".claude/worktrees/"` to re-enter it, then skip to Phase 1. + +### 0b. Create worktree (first run) + +```bash +git worktree add .claude/worktrees/ -b feat/ +``` + +Then use `EnterWorktree` with `path: ".claude/worktrees/"` to switch the session into it. + +All subsequent work (taskplanner, implementers, reviewers, commits, tests) runs inside this worktree. The main repo working directory is never touched. + ## Phase 1: Execute Dispatch taskplanner, loop over waves dispatching implementers and reviewers. diff --git a/plugin/skills/release/SKILL.md b/plugin/skills/release/SKILL.md index 862d6925..7969130c 100644 --- a/plugin/skills/release/SKILL.md +++ b/plugin/skills/release/SKILL.md @@ -16,6 +16,27 @@ No release without passing validation. - **Bump type auto-detected, not user-prompted** — commit message conventions determine major/minor/patch automatically - **Warn-and-continue for non-blocking failures** — report problems, attempt fixes, only hard-stop on critical validation failures +## Phase 0: Pre-Execute + +### 0. Enter Worktree + +Release must run inside the implement worktree so that release-notes generation, the retro context walker, and the feature-branch checkpoint commit all operate on the feature branch's state. The squash-merge in Phase 3 still happens from the main repo via explicit `cd "$main_repo"`; this Phase 0 step only governs the parent skill's cwd and the cwd that subagents (notably the retro) inherit. + +```bash +git worktree list +``` + +If already inside `.claude/worktrees/` (current directory matches): skip to Phase 1. + +If at repo root, look for `.claude/worktrees/` in the worktree list. If found, use `EnterWorktree` with `path: ".claude/worktrees/"` to switch into it. + +If no matching worktree exists, STOP: + +``` +BLOCKED — no worktree found for . +Run /beastmode:implement and /beastmode:validate first, then retry. +``` + ## Phase 1: Execute ### 1. Stage Uncommitted Changes @@ -136,8 +157,6 @@ Run a context reconciliation pass across all phase artifacts before releasing. 4. **Apply BEASTMODE.md Updates** — If no L0 changes proposed, skip this step. Apply L0 changes and log. -> **TRANSITION BOUNDARY — Steps below operate from main repo, NOT the feature branch working directory.** - ### 2. Commit to Feature Branch Before merging to main, commit all release artifacts to the feature branch: @@ -147,6 +166,8 @@ git add -A git commit -m "release(): checkpoint" ``` +> **TRANSITION BOUNDARY — Steps below operate from main repo, NOT the feature branch working directory.** + ### 3. Squash Merge to Main ```bash diff --git a/plugin/skills/validate/SKILL.md b/plugin/skills/validate/SKILL.md index de4e1715..722e5fd0 100644 --- a/plugin/skills/validate/SKILL.md +++ b/plugin/skills/validate/SKILL.md @@ -20,6 +20,25 @@ No release without passing validation. ## Phase 0: Pre-Execute +### 0. Enter Worktree + +Validate must run inside the implement worktree where the feature code lives. + +```bash +git worktree list +``` + +If already inside `.claude/worktrees/` (current directory matches): skip to step 1. + +If at repo root, look for `.claude/worktrees/` in the worktree list. If found, use `EnterWorktree` with `path: ".claude/worktrees/"` to switch into it. + +If no matching worktree exists, STOP: + +``` +BLOCKED — no worktree found for . +Run /beastmode:implement first to create the worktree and build the feature. +``` + ### 1. Check Feature Completion Scan for implementation artifacts to verify all features have been implemented: