Overview
Therecursive-worktree subskill protects your main branch by moving all implementation work into an isolated git worktree on a feature branch. Install and run it before Phase 1 of every recursive-mode run.
When to Use
Run this subskill at the very start of every recursive-mode run — before AS-IS analysis and before any planning or implementation phase begins. All subsequent phases, includingSTATE.md, DECISIONS.md, and memory updates, stay on the same feature branch until merge time.
Hard Rule
Default Worktree Location
When choosing where to create the worktree, use this priority order:- Existing
.worktrees/directory in the repo - Existing
worktrees/directory in the repo - A preference documented in repo instructions
- Ask the user
- Default to
.worktrees/if none of the above apply
~/.config/recursive-mode/worktrees/<project-name>/
Creating the Worktree
If you are currently onmain or master, create a feature branch worktree automatically:
.worktrees/<run-id> checked out on a branch named recursive/<run-id>. All work for the run happens there.
If the user explicitly wants to work on
main, record that exception in 00-worktree.md. This should be rare.Useful Commands
Check your current branch before creating the worktree:Project Setup
After creating the worktree, run the setup command that matches the repo’s toolchain:| Toolchain | Setup Command |
|---|---|
| Node.js | npm install |
| Rust | cargo build |
| Python | pip install -r requirements.txt |
| Go | go mod download |
| Maven | mvn compile -q |
| Gradle | ./gradlew compileJava |
| .NET | dotnet restore |
00-worktree.md.
Phase 0 Artifact: 00-worktree.md
The artifact lives at /.recursive/run/<run-id>/00-worktree.md. It must include all of the following:
Required checklist items
Required checklist items
- Selected worktree location
- Git-ignore verification result
- Branch name and full worktree path
- Setup commands executed and their output
- Baseline test command and result
- Explicit note that subsequent phases run from the worktree
Integration with Later Phases
After Phase 0 is complete and lock-valid:- Continue the run from inside the worktree directory.
- All phase artifacts go to
/.recursive/run/<run-id>/. - Later phase diffs compare against the baseline recorded in
00-worktree.md. - Do not move back to main until the run is fully closed out.