Skip to content

finishing-a-development-branch can silently delete an SDD workspace: ignored files don't make a worktree dirty #2207

Open

Description

@kareemsasa

Skills: finishing-a-development-branch (Step 6), interacting with subagent-driven-development
Versions: reproduced against 6.3.0; the same code path and wording are in 6.2.0
Environment: git 2.55.0, Linux

Summary

Step 6 of finishing-a-development-branch protects uncommitted work by relying on
git worktree remove to refuse:

If removal is refused (contains modified or untracked files): the worktree holds files that
exist nowhere else — uncommitted plans, notes, or scratch work. Never --force on your own
initiative. Show your human partner what is at stake and ask […]

That guard is keyed on untracked files. git worktree remove does not count ignored files as
untracked, so it does not refuse for them.

subagent-driven-development creates its workspace through scripts/sdd-workspace, which writes a
self-ignoring .gitignore containing * at .superpowers/sdd/. A worktree whose only extra content
is that workspace therefore reports a clean status, git worktree remove succeeds with exit 0, and
the workspace is destroyed without the operator ever seeing Step 6's three-way prompt.

The content at risk is the content the guard exists for: the progress ledger's Ruling: lines and the
implementer/reviewer reports. 6.3.0's own §Finish makes the point — "A ruling that dies with the
workspace was a decision made in secret."

Reproduction

git init -q r && cd r
git commit -q --allow-empty -m init
git worktree add -q ../w -b feat

# Exactly what scripts/sdd-workspace creates:
mkdir -p ../w/.superpowers/sdd/my-plan
printf '*\n' > ../w/.superpowers/sdd/.gitignore
echo "ledger line that exists nowhere else" > ../w/.superpowers/sdd/my-plan/progress.md

# 1. What Step 6's guard effectively inspects:
git -C ../w status --porcelain -uall
#    → (no output; reads clean)

# 2. Remove it, no --force:
git worktree remove ../w
#    → exit 0, no refusal, no prompt

cat ../w/.superpowers/sdd/my-plan/progress.md
#    → No such file or directory

This is not a git bug

git worktree remove documents refusal for a dirty or untracked-file-containing worktree; ignored
files are outside that check. The defect is the skill's inference that a non-refusal means nothing
unique is present in the worktree.

When it actually bites

In the normal successful path it does not: subagent-driven-development §Finish deletes the workspace
itself once the final whole-branch review is clean, so by the time finishing-a-development-branch
runs there is nothing left to lose.

It bites when the workspace outlives the SDD session:

  • the branch and worktree are kept after the SDD run and the worktree is removed later, by hand or by
    a subsequent run;
  • a run is abandoned, or its final review never comes back clean, so §Finish's deletion never happens;
  • a session is compacted or resumed and the controller stops before §Finish;
  • any external cleanup that removes the worktree.

In those cases the ledger and reports are the only copy, and --force was never needed to lose them.

Related, and worth a second look

The release notes for the .superpowers/sdd/ move record the adjacent case:

because the workspace is git-ignored working-tree scratch, git clean -fdx will delete the progress
ledger; recover from git log if that happens.

git log recovers which tasks completed — the commits the ledger names. It does not recover the
ledger's rulings, the parked/adjudicated findings, or the implementer and reviewer reports, none of
which are in git at all. The recovery advice holds for progress state but not for the decision record
that 6.3.0 added the "Rulings I made" step to protect.

Possible directions

Offered as options, not a preferred fix:

  1. Widen Step 6's pre-removal check to consider ignored content, e.g. via

    git -C "$WORKTREE_PATH" status --porcelain -uall --ignored=matching

    This would need filtering or classification rather than feeding the existing prompt directly:
    worktrees routinely hold ignored build output, dependency trees, and caches that are safely
    disposable, and prompting on all of it would be noise that trains the operator to dismiss the
    prompt.

  2. Check specifically for a surviving SDD workspace — the one ignored artifact Superpowers itself
    creates, and therefore the targeted fix with the lowest false-positive rate: if
    $WORKTREE_PATH/.superpowers/sdd/ is non-empty, do not remove the worktree silently.

  3. Say what to do when the workspace outlives the run. subagent-driven-development §Finish
    currently covers only the delete-at-final-review-clean case; a sentence on preserving the workspace
    when the run ends any other way would close the gap from the other side.

(2) and (3) are complementary — one guards the boundary, the other tells the controller what the
boundary means.

How this was found

A real session's workspace survived past §Finish and was copied out of the worktree by hand before
removal, on the assumption that removal would refuse. The check above showed removal would not have
refused, which is what prompted this report.

Activity

  1. added
    bug
    worktrees
    subagents
    skills
    on Sep 3, 2026
  2. added
    skill:finishing-a-development-branch
    skill:subagent-driven-development
    on Sep 20, 2026
  3. Enough1122 commented on Sep 27, 2026

    @Enough1122

    Confirmed on main (8ca22db, v6.4.2), git 2.55.0 — your repro is exact, including the exit 0.

    Both ends are on mainline: skills/subagent-driven-development/scripts/sdd-workspace:81 writes printf '*\n' > "$base/.gitignore", and Step 6 keys only on git's refusal message (skills/finishing-a-development-branch/SKILL.md:177), with the diagnostic at :183 running --porcelain -uall and no --ignored. Ignored files never make a worktree dirty, so the guard's inference — no refusal means nothing unique is in there — does not hold for the one artifact superpowers itself creates.

    Your (2) is the fix worth taking: treat a non-empty $WORKTREE_PATH/.superpowers/sdd/ as refusal-equivalent and run the existing three-way prompt. --ignored=matching fires on node_modules, target/, .venv and build output on essentially every removal, and a prompt that always fires is one the operator learns to dismiss.

    (3) is the other side of the same boundary: §Finish (skills/subagent-driven-development/SKILL.md:483) only covers delete-at-final-review-clean, so a run that ends any other way has no stated handling.

    Your git log point is right but already filed as #2344 — that one is the release-note wording, not this guard.

  4. added
    issue-template-rules-ignored
    skill:using-git-worktrees
    and removed
    skills
    subagents
    worktrees
    on Oct 22, 2026
  5. abat-kek commented on Nov 6, 2026

    @abat-kek

    Hit this twice on Windows, with one addition. git status --porcelain --ignored before
    git worktree remove found unique ignored files (SDD workspace logs, a .env.local that
    differed from the main checkout); backing them up first worked. But git worktree remove then
    failed on a pnpm node_modules with "Filename too long" — and still unregistered the
    worktree
    , leaving a half-deleted directory. The failure did not undo the unregistration.
    Only rd /s /q "\\?\<path>" removed the rest, and an auto-mode classifier refused that
    command as irreversible local destruction, so in practice this last step is a hand-off to the
    human (a ready-made command), not an agent step.

    Suggestion for the cleanup step: run the --ignored status first and copy anything that is not
    a regenerable artefact; after a failed remove, measure the state (git worktree list, does
    the directory still exist?) instead of assuming nothing happened; phrase the long-path removal
    as a hand-off.


    Posted by Claude Code (Claude Opus 5.5) at the account holder's request; observations from superpowers 7.0.2 on Windows 11.

  6. arittr commented on Nov 10, 2026

    @arittr
    Collaborator

    We reproduced the cleanup on v7.0.2. Ordinary Git status was clean. Removing the worktree exited 0 and deleted both the ignored SDD ledger and a test .env.local. @abat-kek, for the Windows long-path case, could you share your Git for Windows version, the core.longpaths setting and any saved output from the failed removal and git worktree list immediately afterward?

    AI triage using gpt-6-astra in Codex Desktop (runtime 0.167.0-alpha.3.2, session 01a1c319-035f-71e1-bb53-090ff17d8f95). Approved by @arittr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue-template-rules-ignoredskill:finishing-a-development-branchskill:subagent-driven-developmentskill:using-git-worktrees

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions