Worktree Safety Protocol — Isolated Execution
Defines the mandatory 4-step protocol (Ignore, Setup, Baseline, Commit) for creating, managing, and destroying git worktrees.
The 4-Step Safety Protocol
2. SETUP_AFTER_CREATE
Manifests are auto-detected (package.json, Cargo.toml, etc.) and the corresponding installation commands (npm install, cargo build) are run to prepare the isolated environment.
3. VERIFY_BASELINE
The project's full test suite is run before any modifications.
- Failures Found: Results are reported to the user. DO NOT PROCEED with implementation without explicit human authorization.
- Goal: Distinguishes between pre-existing issues and pipeline-introduced regressions.
4. COMMIT_BEFORE_DESTROY
All changes are added and committed before any worktree is removed, preserving the work-in-progress state.
cd "$WORKTREE_PATH" && git add -A && git commit -m "wip: pipeline checkpoint"
git worktree remove "$WORKTREE_PATH"
Pattern Integration
Detection Signals
Red Flags — STOP
- "I'll skip the baseline test, it'll be fine." → STOP. Pre-existing failures will corrupt the pipeline metrics.
- "Just force-remove the worktree, the pipeline failed." → STOP. Commit partial findings first to aid debugging.
Reference Files
sk-pipeline-patterns/SKILL.md— Topology selection.sk-pipeline-state/SKILL.md—metadata.worktree_roottracking.finishing-a-development-branch/SKILL.md— Final merge protocol.