Repository navigation
Conversation
…sted .gitignore commits
…ions, and drop dead todo steps
…files and clean owned worktrees safely
0d958ee to
b8b21f9
Compare
…ue requires a change Every hunk of this PR in using-git-worktrees/SKILL.md goes back to dev's text: the sandbox paragraph and its Quick Reference row, the placeholder rewrite of the creation snippet and --no-track, the self-ignoring .gitignore, the one-sentence replacement of the setup block, the reworded rationalization row, and the rewritten Step 0 lines. No cited issue needs them. The edits that #2515, #2245 and #1108 do need, and the correction of the false submodule sentence, are made on dev's text in the commits that follow. The 1,213-line mechanics test pinned about 180 strings of the rewritten prose. It is removed here and replaced, at the same path, by a short test that extracts the skill's snippets and runs them in throwaway repositories. Its line in run-skill-tests.sh stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… with a trailing slash Safety Verification passed when either `.worktrees` or `worktrees` was ignored, so with both present and only `worktrees/` ignored, the worktree went into an unignored `.worktrees/` (#2515). The check now covers only the directory Directory Selection chose, using the same `$LOCATION` as the creation snippet. The trailing slash lets a directory-only pattern such as `.worktrees/` match before the directory exists, which the reporter's follow-up showed fails without it. The mechanics test starts with this case: it extracts the fence under Safety Verification and runs it on both reported repositories. Against dev's check, both fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nst the starting commit A native tool may create the worktree from origin's default branch, not from the commit the work started on, so an unpushed plan is missing from the new worktree (#2245, item 1). Step 0 now records and prints the starting commit as START_HEAD, with the branch, so the values survive a shell that does not keep variables between commands. Step 1a takes the base check from the review (finding F1, which also carries F2 and F9). After the tool runs, the agent works in the path the tool returned, and runs four commands there. Their output picks one of four actions: continue when the worktree is at the start commit; fast-forward when the start commit is ahead, on any branch; continue when only the remote was ahead; otherwise stop and ask which commit to build on. The check is skipped when START_HEAD is `unborn`. Dev's paragraph on what native tools handle stays as it is. The tool-name examples lose `WorktreeCreate`, which is a settings hook name, not a tool, and gain Codex's `create_worktree`. The mechanics test gains base_check_states. It takes START_HEAD and the branch from the Step 0 snippet's output, creates worktrees at, behind, ahead of and diverged from the start commit, and checks what the Step 1a commands print in each. Against dev's text it fails: Step 1a has no check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom GIT_COMMON in a submodule Inside a submodule, `git rev-parse --git-dir` and `--git-common-dir` resolve to the same directory (git 2.54: absorbed and embedded submodules, and a submodule in a linked worktree of the superproject). Only that sentence goes. The guard and its command stay as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step 2 ran `poetry install` for any pyproject.toml, which fails for uv, hatch, pdm and setuptools projects, and on machines without Poetry (#1108). The line now runs it only when the project has a poetry.lock or a [tool.poetry] table, the condition from #2204. The rest of the setup block stays as it is. Co-authored-by: y$un_ <forrest.sun527@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to worktree_path In zsh, the `path` array is tied to PATH, so running the snippet as written set PATH to the new worktree's directory: `git worktree add` itself failed with "command not found: git", and so did every later command in that shell. The variable is renamed in its three places, and nothing else in the snippet changes. The mechanics test gains creation_snippet_keeps_path_under_zsh. It runs the snippet under `zsh -f`, then `git --version` in the same shell, and checks that the worktree exists. Against dev's snippet it fails with "command not found: git". Without zsh, the case reports a skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mechanics test's fence extractor used `[[:space:]]`, which older mawk releases do not support. task-brief, the repository's other awk code that reads fences, spells whitespace `[ \t]`. The extractor now does the same, and still finds indented fences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first #2515 fixture needs `.worktrees/` to be unignored. On a machine whose global excludes file lists `.worktrees/` (through core.excludesFile, or the default ~/.config/git/ignore), it is ignored there too, so the skill's check correctly exits 0 and the case reports a failure. The fixture's repository now sets core.excludesFile to /dev/null, which overrides both. The second fixture expects the directory to be ignored, which a global excludes file cannot change. Reproduced with GIT_CONFIG_GLOBAL pointing at a config whose excludes file lists `.worktrees/`, and with an XDG_CONFIG_HOME whose git/ignore lists it: the case failed before this change and passes after it. Against dev's skill text, and with 8881e52's check reverted, it still fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… text where no issue requires a change These parts of the PR go back to dev's text in executing-plans and subagent-driven-development: the `finish` ledger marker and the kept workspace, so Finish deletes the plan's workspace as on dev and both process graphs keep that step; the three-list Finish restructure; the resume rewrite in executing-plans' Setup and in references/resuming.md; the paraphrased main/master guard in both Setups; and `git log --oneline` in SDD's no-bash review fallback. references/final-review.md and references/resuming.md read as on dev. In the SDD integration test, the trap quoting, `claude_rc` and Test 2's count line go back to dev. Only the todo check keeps its change: it reports instead of failing. The PR's removal of the scattered todo steps stays. The conditional todo sentence for #2177 and the edits that #2706, #2253 and #2344 need are made on dev's text in the commits that follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Current Claude Code models have no task-tracking tool (#2177), so the executors' unconditional todo steps could not be followed. This PR already drops the scattered steps: create a todo per task, mark it in progress, mark it complete, and the graph labels that named them. Each Setup now says it once, conditionally: "Track progress in a ledger file. If you have a todo tool, also keep a todo per task as a live view; the ledger is the record." A harness with a todo tool keeps its live view; the ledger stays the record everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both executors said that if `git clean -fdx` destroys the workspace, the agent can "recover from `git log`" (#2344). git log holds the completed tasks' commits, but not the rulings or deferred minors: those live only in the git-ignored ledger. The note keeps its recovery instruction, narrowed to the completed tasks, and says the rulings and deferred minors are lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Asked to execute a plan in a repo sitting on main, executing-plans committed the work to main in 21 of 21 runs (#2706): Setup's "Never start implementation on a main/master branch without your human partner's explicit consent" did not stop it. The reporter's fix in #2707 measured 0 of 21. Its text is taken verbatim, and Jesse's two Setup sentences stay as they are above it. - executing-plans, inline at #2707's positions: the "Never on main" paragraph, "Branch before your first edit", and the rationalization row. - subagent-driven-development: the same paragraph and row go to the new references/branch-guard.md, and Setup points to it the way it points to resuming.md and preflight.md. Inline, the paragraph alone would take SKILL.md to 20,354 bytes, past the 20,000-byte cap. #2707's worktree-guard hook is not taken: it needs python3, and the plugin has no dependencies. Co-authored-by: Vignesh M <202531752+vigneshm1995personal@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d-orchestrator relay SDD's Finish collected only "Rulings I made" into the final message, so the deferred minors that task reviews logged reached the human partner nowhere before the workspace was deleted (#2253). executing-plans already lists them. references/final-review.md now does too, in executing-plans' words: every `minor (deferred)` ledger line under "Deferred minors". A minor that the final fix wave fixed is left out, because the append-only ledger still holds its line. Finish goes on to delete the workspace as before. The nested-orchestrator rule in using-superpowers' references/claude-code-tools.md tells the parent session to relay the orchestrator's lists verbatim. It names "Deferred minors" as well as "Rulings I made", so a parent relays both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
danishkumar26
left a comment
There was a problem hiding this comment.
Code review (comment).
What this change does: Reworks the workspace lifecycle across using-git-worktrees, finishing-a-development-branch, executing-plans, and subagent-driven-development: never delete a plan's workspace on finish (append an exact finish line to /progress.md and report Rulings/Parked/Deferred instead); require a feature branch before the first edit on main/master after consent; worktree creation verifies the base commit (fast-forward clean trunk, stop-and-ask otherwise), uses --no-track and a self-ignoring /.gitignore instead of editing root .gitignore; finishing runs a Unique-File Check scoped to this worktree, never deletes uncommitted files, and removes the worktree with single --force only after typed discard. Adds tests/claude-code/test-worktree-finishing-mechanics.sh.
Nice to have:
- Unique-file inventory misparses renamed files (tests/claude-code/test-worktree-finishing-mechanics.sh, classify_unique_inventory)
- What this is: Before finishing, files that exist only in the worktree are listed from
git status --porcelain -uall --ignored=matching. - Problem:
path="${line#???}"strips exactly three characters, so a rename lineR old -> newbecomesold -> new— a path that does not exist — and the human is asked about a phantom file. - Fix: after stripping the prefix, handle
* -> *by keeping the destination:path="${path##* -> }". - If we skip it: a renamed file in the worktree produces a confusing, nonexistent "unique file" prompt at finish time.
- What this is: Before finishing, files that exist only in the worktree are listed from
Verdict: Ship.
Verified: read the full diff across all five skill files and references, then ran tests/claude-code/test-worktree-finishing-mechanics.sh against this branch: STATUS PASSED — all static contracts and real-git mechanics (worktree add/remove/lock, --force semantics, fast-forward base checks, diverged-upstream abort, ignored-file overwrite protection, both ignore layouts). zsh sub-cases skipped: zsh is not installed here. This repo has no CI workflows.
…ue requires a change The PR rewrote most of finishing-a-development-branch. No issue it cites asks for the bulk of that rewrite: the compressed Steps 1-4, the Unique-File Check and Resolve Primary Checkout sections, the fetch-and-fast-forward merge with --no-overwrite-ignore, the ExitWorktree step and .claude/worktrees/ ownership, the rewritten discard path, the in-place SDD sweep, and the one-line refusal rule. Return the whole file to dev's text. The changes the cited issues need (#2706, #2207, #2397, #2253) follow in separate commits, each written against dev's lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…partner decides, in #2707's words In #2706, agents asked to merge and clean up a worktree deleted its never-committed files in 24 of 24 runs. With PR #2707's skill text, none did (0 of 21 with its optional hook, which never fired; 0 of 9 with the text alone). Take #2707's four hunks for this file verbatim: the section "Never-committed files are not yours to delete", the Step 2 listing of files that exist only in this worktree, its edits to the refusal recipe (stop cleanup, a fourth option, "No answer means option 4"), and five rationalization rows. The file now matches #2707's version of it byte for byte (blob 1585733). Co-authored-by: Vignesh M <202531752+vigneshm1995personal@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e as owned using-git-worktrees creates a worktree in the directory the user's instructions declare, ahead of its defaults, but Step 6 owned only worktrees under .worktrees/ or worktrees/. A worktree Superpowers made in the declared directory was treated as the host's and never cleaned up (#2397). Step 6's ownership condition and the "This other worktree looks stale" rationalization row each gain the declared directory, so they agree. Claude Code's .claude/worktrees/ stays the host's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cription A plan executor's final message lists the findings it deferred, and it then deletes its workspace. Chat scrollback was the only copy left, so those findings were lost once the session ended (#2253). Option 2 gains one paragraph: copy those lines into the PR description under "Deferred items", where your human partner reviews and where they outlive the session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Step 2 listing from #2707, `git status --porcelain -uall`, does not show ignored files, and Step 6's plain `git worktree remove` deletes them without refusing. An ignored .env.local, or a plan workspace that SDD's self-ignoring .gitignore hides, was lost at cleanup (#2207). A separate paragraph after #2707's listing runs `git status --porcelain --ignored=matching` and counts each `!!` entry as a listed file, leaving out .superpowers/sdd/.gitignore, brainstorming's port and token files, and dependency and build caches. A plan workspace still present stays listed: it is an unfinished run. Where the root .gitignore ignores .superpowers/, as the visual companion asks users to do, git status shows it as one entry: the exclusions cannot apply, and the plan workspace is named only as .superpowers/. A second command, `git ls-files --others --ignored --exclude-standard -- .superpowers`, names the files inside it. The new mechanics case runs both listings from the skill's own fences on a worktree in each layout. Before this paragraph it failed: #2707's listing alone named only NOTES.md and build/out.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e empty Plain `git worktree remove` refuses for untracked files but deletes ignored ones without refusing. Step 6 ran it before reaching the stop for listed files, so a worktree holding only ignored files, or one left after its untracked files were committed, lost them (#2207). Above the removal block, one sentence: run it only when both Step 2 listings, run again in the worktree, list no files. After #2707's refusal recipe, one paragraph: an ignored file is never committed or force-added, so only options 2 to 4 apply to it; after options 1 to 3, both listings run again, anything still listed is asked about, and the worktree goes once they list nothing. #2707's "No answer means option 4" covers an unanswered question. None of #2707's lines move or change. Two mechanics cases pin the git behavior this depends on: with NOTES.md committed, the listings still name an ignored .env.local, and Step 6's block exits 0 and deletes it; with an untracked file present, the block refuses with the message Step 6 quotes and leaves the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nership phrase The previous commit turned "`.worktrees/` or `worktrees/`" into a three-item list in Step 6's ownership condition and in the "This other worktree looks stale" row. That reworded both of Jesse's lines more than #2397 needs, and removed the phrase that tests/claude-code/test-worktree-path-policy.sh checks for, so that test failed. Both lines keep dev's words and gain only ", or under the worktree directory your instructions declare". The path-policy test passes again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owUntrackedFiles=no With status.showUntrackedFiles=no in a user's config, `git status --porcelain --ignored=matching` stops with "fatal: Unsupported combination of ignored and untracked-files arguments" and lists nothing. An agent could read that as no ignored files, and the removal that follows would delete them. #2707's listing is not affected, because its -uall overrides the setting. Pass -unormal, which is what the command uses when nothing is configured. A mechanics fixture with the setting failed on .env.local before this change and passes after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in the skill's prose sets LOCATION, and a shell variable set in
one tool call is gone in the next. Run as written, the Safety
Verification check became `git check-ignore -q "/"`, which exits 128 with
git's "outside repository" message in every layout, including one where
`.worktrees/` is ignored. An agent can read that non-zero exit as "not
ignored", add a duplicate .gitignore entry and commit it. The fence now
starts with a `${LOCATION:?}` guard, so the check stops with a message
that says to set LOCATION to the directory selected above.
The mechanics test gains ignore_check_needs_location: it runs the fence
with LOCATION unset in a repository whose `.worktrees/` is ignored and
expects a non-zero exit with that message. Against the one-line fence it
fails with exit 128 and git's message. The two existing ignore-check
cases still pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…try project The `pyproject.toml` line in using-git-worktrees' Step 2 runs `poetry install` only beside a poetry.lock or for a [tool.poetry] table (#1108), and no test ran it. poetry_install_only_for_poetry_projects extracts Step 2's setup fence and runs it in three directories with a stub poetry first on PATH that records each call: a pyproject.toml with neither the table nor a lock does not call it; one with the table does; a poetry.lock beside a pyproject.toml without the table does. Each directory holds only those files, so no other installer line runs. In a throwaway copy of the skill with dev's line put back, if [ -f pyproject.toml ]; then poetry install; fi the first check fails: the stub is called as `poetry install`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD's Setup pointed at references/branch-guard.md "Before your first edit", but the controller in this skill never edits files: its implementers do, and they commit on whatever branch the controller is on. A controller that took the trigger literally could dispatch Task 1 on main without ever reading the guard. The pointer now names a step the controller takes, "Before you dispatch Task 1", and the reference file's opening paragraph says the same and why: implementers commit on the branch you are on. #2707's paragraph and row below that opening are unchanged. SKILL.md is 19,869 bytes, under the 20,000-byte cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng-plans' words SDD's Finish listed each `minor (deferred)` line "the final fix wave did not fix". Nothing in the ledger records which deferred minors the fix wave fixed, so that filter rested on the controller's memory, which does not survive compaction, and a guess could drop an unfixed minor. Finish now takes every `minor (deferred)` line under "Deferred minors", as executing-plans' Finish says it. The lines that follow are byte-identical to dev again: the earlier hunk had rewrapped them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Who is submitting this PR? (required)
superpowers,dealerboard,toolsmith@arittr)What your human partner asked you to do, in their words:
Human-authored summary (required, under 200 words)
Several of our nastiest open bug reports are data-loss bugs around worktree setup and branch cleanup, and the existing community PRs each only touch one piece of the lifecycle in isolation. Right now, finishing a branch can treat a worktree with
.env.local, brainstorm mockups, or an aborted SDD run as "clean" and wipe those files on removal,MAIN_ROOTbreaks on bare repos and submodules because of$(git rev-parse --git-common-dir)/.., andcheckout/mergecan overwrite ignored local files in the main checkout. Meanwhile, both plan executors delete.superpowers/sdd/<plan>/at Finish beforefinishing-a-development-branchever runs, throwing away rulings and deferred findings thatgit logdoesn't record.This PR fixes that lifecycle end-to-end:
using-git-worktreesverifies native worktree base commits and uses a self-ignoring<dir>/.gitignoreinstead of making unrequested commits, executors keep completed workspaces and markprogress.mdwithfinishafter reporting all rulings, andfinishing-a-development-branchinventories unique/ignored files and guards merges with--no-overwrite-ignore.What problem are you trying to solve?
Fixes #1108, fixes #2207, fixes #2397, fixes #2515, fixes #2706.
Addresses part of #2177, #2245, #2253, #2344.
finishing-a-development-branch:rmorgit cleanin 24 of 24 runs, so thatgit worktree removewould succeed without--force. The skill already said not to use--force.git worktree removerefusing when a worktree holds files that exist nowhere else. Git does not refuse for ignored files: a worktree whose only extra content is ignored (an SDD workspace under its self-ignoring.superpowers/sdd/, or an ignored.env.local) is removed with exit 0 and the files are deleted with no prompt (finishing-a-development-branchcan silently delete an SDD workspace: ignored files don't make a worktree dirty #2207)..worktrees/orworktrees/as created by Superpowers, so a worktree in the directory the user's instructions declare was never cleaned up (finishing-a-development-branch doesn't clean up worktrees in the user's declared worktree directory #2397).executing-plansandsubagent-driven-development:main, the agent committed the plan's work tomainwithout asking in 21 of 21 runs, althoughexecuting-planssays not to start implementation on main without explicit consent.subagent-driven-developmenthas the same rule.Ruling:lines and then deleted the workspace, sominor (deferred)lines existed nowhere afterwards (subagent-driven-development: Finish deletes the only record of deferred findings — parked/deferred items need a durable export #2253). The nested-orchestrator relay rule inusing-superpowers/references/claude-code-tools.mdcarried only the "Rulings I made" list.git clean -fdxdestroys the workspace, "recover fromgit log".git logrecovers which tasks were committed, not rulings or deferred minors (RELEASE-NOTES say a deleted .superpowers/sdd/progress.md can be recovered from git log; it cannot #2344). This PR changes those two skill lines only; the same sentence inRELEASE-NOTES.mdis unchanged.executing-plansalso to mark it in progress), andtests/claude-code/test-subagent-driven-development-integration.shfailed any run that used no task-tracking tool. Other skills that mention todos are not changed here.using-git-worktrees:git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null. It passed when only the directory that was not selected was ignored, and it failed for a selected.worktrees/that.gitignorelists but that does not exist yet (using-git-worktrees: ignore check passes when only the non-selected directory is ignored #2515).poetry installfor everypyproject.toml, which fails on Python projects that do not use Poetry (fix: using-git-worktrees skill runs for all pyproject.toml projects, breaking non-Poetry setups #1108).GIT_DIR != GIT_COMMONis also true inside git submodules". Inside a submodule both resolve to the same directory (for a submodule added withgit submodule add, the superproject's.git/modules/<name>), so the sentence is false. Step 1a listedWorktreeCreateas an example tool name; it is a Claude Code hook name, not a tool.path="$LOCATION/$BRANCH_NAME". Under zsh,pathis tied toPATH, so running the snippet as written leaves every later command not found (command not found: git). No issue reports this; Drew asked for the one-variable rename.What does this PR change?
skills/finishing-a-development-branch/SKILL.md:git status --porcelain -uallwhenGIT_DIR != GIT_COMMON), its edits to Step 6's refusal recipe (stop cleanup, a new prompt, four options, "No answer means option 4"), and its five rationalization rows, verbatim.git status --porcelain --ignored=matching -unormalandgit ls-files --others --ignored --exclude-standard -- .superpowers. Each!!entry counts as a listed file; under.superpowers/the second command decides. It leaves out only.superpowers/sdd/.gitignore, the brainstorm.last-portand.last-tokenfiles, and dependency and build caches such asnode_modules/and.venv/. A plan workspace still present stays listed.skills/executing-plans/SKILL.md: adds Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's "Never on main" paragraph, its "Branch before your first edit" paragraph afterdev's two Setup sentences, and its rationalization row, verbatim. Two sentences replace the todo instructions: "Track progress in a ledger file. If you have a todo tool, also keep a todo per task as a live view; the ledger is the record." The lines that said to create a todo per task and mark it in progress or complete are removed, and the process graph's task-done label no longer says "mark todo complete". Thegit clean -fdxnote now reads "recover the completed tasks fromgit log. Rulings and deferred minors are not in git: they are lost."skills/subagent-driven-development/SKILL.md: Setup gains "Before you dispatch Task 1, read references/branch-guard.md and follow it." The same todo sentences, todo-line removals, graph-label change andgit clean -fdxnote asexecuting-plans. The file is 19,869 bytes; Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's paragraph inline would take it past the 20,000-byte limit thattests/skill-size/test-skill-size.shenforces.skills/subagent-driven-development/references/branch-guard.md(new): a heading and a two-line opening paragraph, then Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's SDD paragraph and rationalization row, verbatim.skills/subagent-driven-development/references/final-review.md: Finish also lists everyminor (deferred)ledger line under "Deferred minors", inexecuting-plans' words. The workspace is still deleted afterwards, as ondev.skills/using-superpowers/references/claude-code-tools.md: the nested orchestrator's final message carries the "Rulings I made" and "Deferred minors" lists verbatim, and the parent relays both.skills/using-git-worktrees/SKILL.md:START_HEAD(orunborn), prints the four values, and says to keep the printedSTART_HEADandBRANCHvisible. The false submodule sentence is deleted; the rest of that line stays.EnterWorktreeorcreate_worktreeas examples, says to pass<START_HEAD>as the base when the tool accepts one, says to work in the new worktree's path (Codexcreate_worktreereturns a path and needsget_worktree_creation_statuspolling), and adds a base check, skipped whenSTART_HEADisunborn, with four outcomes: at the start commit, continue; behind it,git merge --ff-only <START_HEAD>; ahead of it withorigin/HEADatorigin/<START_BRANCH>, continue; anything else, stop and ask, and if the answer is<START_HEAD>, switch the worktree to it.: "${LOCATION:?set LOCATION to the directory you selected above}"and thengit check-ignore -q "${LOCATION%/}/".pathvariable is renamedworktree_path.poetry installonly whenpoetry.lockexists orpyproject.tomlhas a[tool.poetry]table.tests/claude-code/test-worktree-finishing-mechanics.sh(new, registered in the fast list intests/claude-code/run-skill-tests.sh): eight cases. Each extracts a fenced block fromusing-git-worktreesorfinishing-a-development-branchand runs it in a throwaway repository:ignore_check_uses_selected_dir,ignore_check_needs_location,base_check_states,creation_snippet_keeps_path_under_zsh(skipped when zsh is absent),poetry_install_only_for_poetry_projects,listing_shows_ignored_and_untracked,removal_waits_for_ignored_files,removal_refuses_untracked.tests/claude-code/test-subagent-driven-development-integration.sh: Test 3 (task-tracking tool used) prints[INFO]instead of failing when no such tool was used, and its count no longer produces0\n0. The header comment that listed that assertion is removed.Is this change appropriate for the core library?
Yes — these four skills form the core workspace-isolation, plan-execution, and branch-integration lifecycle used across every Superpowers project and harness, with zero third-party dependencies.
What alternatives did you consider?
finishing-a-development-branchandusing-git-worktrees(primary checkout fromgit worktree list,--no-overwrite-ignore, fetch and fast-forward instead ofgit pull,.claude/worktrees/ownership withExitWorktree, a self-ignoring.gitignoreinside the worktrees directory instead of a root.gitignorecommit,--no-track, a one-sentence dependency setup). No cited issue asks for those changes, so they returned todev's text, and the review findings about them went with them.finishline (this PR's first version): rejected.dev's lifecycle stays: the workspace is deleted at Finish, and the export is completed instead (SDD's final message lists deferred minors, and Option 2 copies deferred items into the PR description).minor (deferred)line, asexecuting-plansdoes.worktree-guardhook: not taken. It needspython3, and the plugin has no dependencies. Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707 reports that the hook never fired in its fixed runs.subagent-driven-development/SKILL.md: not possible under the 20,000-byte limit, so it moved whole toreferences/branch-guard.md, the way Setup already points toreferences/preflight.mdandreferences/resuming.md.uv syncfirst, then Poetry, thenpip): not taken. Only its Poetry condition is needed for fix: using-git-worktrees skill runs for all pyproject.toml projects, breaking non-Poetry setups #1108; the other lines ofdev's setup block are unchanged.Does this PR contain multiple unrelated changes?
Partly. Most of it is one lifecycle: creating a worktree (
using-git-worktrees), starting a plan on a branch rather thanmainand exporting what the plan left undone (both executors), and finishing without deleting files that exist nowhere else (finishing-a-development-branch). The finishing and executor changes for #2706 come from one measured fix, #2707, and the #2253 changes span SDD's Finish, the Claude Code relay rule and finishing's Option 2. Three changes do not depend on the rest and could be reviewed separately: the conditional todo sentence (#2177), the Poetry condition (#1108), and the zshpathrename.Existing PRs
I have reviewed all open AND closed PRs for duplicates or prior art
Related PRs: Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707, fix: detect Python package manager before poetry install in worktrees #2204, fix(finishing): check in with human partner when worktree removal hits untracked files #2024, fix(finishing): surface surviving Superpowers scratch before worktree removal #2294, fix(skills): defer main/master consent to partner instructions in executing-plans and SDD (#2455) #2516, chore: uv.sync and poetry.lock checks in SKILL.md #1106, fix(using-git-worktrees): lockfile-aware Step 3 (pnpm/yarn/bun + uv) #1562, fix(using-git-worktrees): verify the chosen worktree directory is ignored #1782, fix(using-git-worktrees): check ignore status on selected directory specifically (#2515) #2518, Establish a remote-safety boundary in git-workflow skills (#2219) #2228, fix(sdd): export deferred findings before deleting the workspace #2255, fix(sdd): archive the plan workspace at Finish instead of deleting it #2328, fix(finishing-a-development-branch): clean up worktrees in the declar… #2411
Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707 (open, by the reporter of finishing-a-development-branch deletes never-committed worktree files during "merge and clean up" (24/24 runs); executing-plans commits to main without consent (21/21). Fix attached, 0/21 after. #2706): this PR carries its skill text for
finishing-a-development-branchandexecuting-plansverbatim, and itssubagent-driven-developmentparagraph and row verbatim inreferences/branch-guard.md; the commits that carry it credit its author withCo-authored-by. This PR does not take its optionalworktree-guardhook, and adds thefinishing-a-development-branchcan silently delete an SDD workspace: ignored files don't make a worktree dirty #2207 handling of ignored files beside its text.fix: detect Python package manager before poetry install in worktrees #2204 (open): this PR takes its Poetry condition character for character, credited with
Co-authored-by, but not itsuv syncbranch or its move of therequirements.txtline into the sameif/elifchain.fix(finishing): check in with human partner when worktree removal hits untracked files #2024 (merged) added Step 6's refusal recipe; this PR changes that recipe only through Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's text.
fix(finishing): surface surviving Superpowers scratch before worktree removal #2294 (closed unmerged by its author) checked for surviving Superpowers scratch under
.superpowers/before worktree removal; this PR lists every ignored file except dependency and build caches and three Superpowers bookkeeping files, and says not to run the removal while anything is listed.fix(skills): defer main/master consent to partner instructions in executing-plans and SDD (#2455) #2516 (open) defers the main/master consent rule to a declared branch policy; this PR does not touch branch policy and adds Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's branch-before-first-edit paragraph beside
dev's consent sentence.chore: uv.sync and poetry.lock checks in SKILL.md #1106 and fix(using-git-worktrees): lockfile-aware Step 3 (pnpm/yarn/bun + uv) #1562 (open, against
main) rework Step 2's dependency setup with uv and lockfile checks; this PR changes only the Poetry line.fix(using-git-worktrees): verify the chosen worktree directory is ignored #1782 and fix(using-git-worktrees): check ignore status on selected directory specifically (#2515) #2518 (open) check the selected directory with
git check-ignore -q "$LOCATION"; this PR adds the trailing slash, so an ignored directory that does not exist yet passes (using-git-worktrees: ignore check passes when only the non-selected directory is ignored #2515's second case), stops with a message whenLOCATIONis unset, and does not add fix(using-git-worktrees): verify the chosen worktree directory is ignored #1782'sLOCATIONassignments to Directory Selection.Establish a remote-safety boundary in git-workflow skills (#2219) #2228 (open) adds
--no-trackfor non-HEADbases and agit branch -vvcheck; this PR takes neither.fix(sdd): export deferred findings before deleting the workspace #2255 (open) exports deferred findings before the workspace is deleted, to the PR description or a committed follow-ups file; this PR lists deferred minors in SDD's final message and copies deferred items into the PR description on Option 2, and adds no follow-ups file.
fix(sdd): archive the plan workspace at Finish instead of deleting it #2328 (open) archives the plan workspace at Finish instead of deleting it; this PR keeps
dev's deletion.fix(finishing-a-development-branch): clean up worktrees in the declar… #2411 (open) makes Step 6 own the declared worktree directory, with a note that a pre-existing host worktree there belongs to the host; this PR adds the declared directory to Step 6 and to the matching rationalization row, without that note.
Environments tested
New harness support (required if this PR adds a new harness)
N/A — does not add support for a new harness.
Evaluation
dev./bin/bash3.2.57, git 2.54.0, zsh 5.9 and shellcheck 0.11.0:bash tests/claude-code/test-worktree-finishing-mechanics.sh: exit 0, 37 PASS, 0 FAIL,STATUS: PASSED.bash tests/claude-code/test-worktree-path-policy.sh: exit 0, 9 PASS. It also prints twogrep: .../docs/superpowers/plans/2026-04-06-worktree-rototill.md: No such file or directorylines, as it does ondev; that file does not exist ondev, and this PR changes neither the test nordocs/.bash tests/claude-code/test-sdd-workspace.sh: PASS, exit 0.bash tests/claude-code/test-executing-plans-scripts.sh: PASS, exit 0.bash tests/sdd-helper-paths/test-sdd-helper-paths.sh: "PASS: all 14 relative helper references under skills/ say to run them by absolute path", exit 0.bash tests/skill-size/test-skill-size.sh: "PASS: every SKILL.md is under 20000 bytes", exit 0.bash scripts/lint-shell.sh --strict tests/claude-code/test-worktree-finishing-mechanics.sh: exit 0.git diff --check df2e996a HEAD: no output, exit 0.bash scripts/lint-shell.sh --strict tests/claude-code/test-subagent-driven-development-integration.sh: exit 1, SC2064 at line 39 (trap "cleanup_test_project $TEST_PROJECT" EXIT) and SC2320 at line 169 (echo "EXECUTION FAILED (exit code: $?)"). Both lines are as ondev, anddev's copy of the file fails the same way. No line this PR changes draws a warning.bash -n tests/claude-code/test-subagent-driven-development-integration.sh: exit 0.bash tests/skill-layout/test-no-dev-files-in-skills.sh: "PASS: no skill ships pressure scenarios or creation logs", exit 0.tests/claude-code/test-subagent-driven-development-integration.sh,tests/claude-code/run-skill-tests.shandtest-worktree-native-preference.sh, because they start agent sessions.finishing-branch-*scenarios in superpowers-evals withdevas the control, and finishing-a-development-branch deletes never-committed worktree files during "merge and clean up" (24/24 runs); executing-plans commits to main without consent (21/21). Fix attached, 0/21 after. #2706's fixtures run against both executors.dev, theusing-git-worktreesignore check passes when only the unselected directory is ignored and fails for an ignored.worktrees/that does not exist yet; on this branch it gets both right, and it stops with a message whenLOCATIONis unset. Ondev, Step 1a has no base check; on this branch the check's output tells apart a worktree at, behind, ahead of, and diverged from the start commit. Ondev, nothing infinishing-a-development-branchlists a linked worktree's ignored files (.env.local, an SDD workspace, brainstorm mockups), and Step 6'sgit worktree removedeletes them with exit 0; on this branch its Step 2 lists them and Step 6 says not to run the removal while anything is listed. Theusing-git-worktreesStep 2 setup no longer callspoetry installfor apyproject.tomlwith no[tool.poetry]table and nopoetry.lock. The creation snippet no longer breaksPATHunder zsh. Whether agents follow the new prose (branching offmain, asking before deleting files, listing deferred minors) has not been measured on this branch. Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707 reports, on Cursor CLI with composer-2.5, 0 of 21 runs deleting the files (with its hook installed, which never fired; 0 of 9 with the skill text alone) and 0 of 21 runs committing tomain.Rigor
superpowers:writing-skillsandcompleted adversarial pressure testing (paste results below)
rationalizations, "human partner" language) without extensive evals
showing the change is an improvement
This PR changes skill text, and no pressure testing with agents was done. The adversarial testing is of the shell snippets the skills contain, in throwaway repositories (
status.showUntrackedFiles=no, a root.gitignorethat ignores.superpowers/, an unsetLOCATION, a diverged base, zsh), not of agent behavior.This PR changes rationalization tables and "your human partner" wording; it changes no Red Flags table:
finishing-a-development-branch, Common Rationalizations: five rows from Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707 ("I'll delete the untracked files first, so removal works without--force", "They said clean up, so that covers these files", "I asked, the question was skipped, so I'll use my judgment", "They're only scratch notes", "They can be restored from git history"); the row "This other worktree looks stale — I'll clean it too" also names the worktree directory your instructions declare.executing-plans, Common Rationalizations: one row from Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707 ("They said implement it, and the repo is on main, so main is fine"). The same row is in a table in the newsubagent-driven-development/references/branch-guard.md.finishing-a-development-branch, Step 6:dev's "Never--forceon your own initiative. Show your human partner what is at stake and ask:" is replaced by Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's "Stop cleanup here. Leave the worktree, its files, and its branch exactly as they are, and ask:".using-superpowers/references/claude-code-tools.md: "that list is how the decisions reach your human partner, and you relay it" becomes "those lists are how the decisions reach your human partner, and you relay them".#2707's rows and Step 6 text come with #2707's measurements of
finishing-a-development-branchandexecuting-plans; itssubagent-driven-developmenttext was not measured. The stale-worktree row edit and the relay-rule edit have no eval.The original diff had an independent review by several reviewers. A hunk-by-hunk ledger then compared every hunk with
devand kept it only where a cited issue, a confirmed review finding, a statement verified false, or Drew's decision (the zshpathrename) required it; the rest returned todev's text. Separate reviewers checked the rebuilt branch against that ledger in three parts and re-ran the tests:using-git-worktreesat 5ce518f, the executors at a4bace3, andfinishing-a-development-branchat d46d5e3. The four commits after d46d5e3 (theLOCATIONguard, the Poetry test, SDD's "Before you dispatch Task 1" trigger, and the "Deferred minors" wording) came after that review; the tests listed above were run after them. Each new or changed test was checked to fail without its fix:ignore_check_uses_selected_dir: fails withdev's check on both using-git-worktrees: ignore check passes when only the non-selected directory is ignored #2515 cases (exit 0 where onlyworktrees/is ignored, exit 1 for an ignored.worktrees/not yet created), and the second case fails with the trailing slash dropped.ignore_check_needs_location: fails before theLOCATIONguard (exit 128,fatal: /: '/' is outside repository).base_check_states: fails with Step 1a as ondev(no base-check fence) and with only the two added Step 0 lines removed; swapping thestart-aheadoperands fails its "behind" and "ahead" assertions.creation_snippet_keeps_path_under_zsh: fails withdev'spath=(exit 127,zsh:4: command not found: git); prints[SKIP]when zsh is not installed.poetry_install_only_for_poetry_projects: fails withdev'sif [ -f pyproject.toml ]; then poetry install; fion apyproject.tomlwith only a[project]table.listing_shows_ignored_and_untracked: fails withdev's skill (16 failures), with Keep never-committed worktree files during cleanup; branch before executing a plan on main #2707's text but before the ignored-file paragraphs (9), without thegit ls-files ... -- .superpowersline (4, the plan workspace in each fixture and the mockup when the root.gitignoreignores.superpowers/), and without-unormal(1,fatal: Unsupported combination of ignored and untracked-files arguments).removal_waits_for_ignored_files: its listing assertion fails without the ignored-file paragraph. Its removal assertion pins git's own behavior (plaingit worktree removedeletes an ignored.env.localwith exit 0), so no skill revert can fail it.removal_refuses_untracked: pins git's refusal on an untracked file; it fails when Step 6's block is changed togit worktree remove --force.integer expression expectedand[FAIL]indev's form, and[INFO]with clean output in this PR's form.Human review