Skip to content

feat: /sdd-close for the close-out and the clean-up after the merge - #55

Merged
sebastian-iancu merged 2 commits into
mainfrom
feat/sdd-close
Oct 13, 2026
Merged

sebastian-iancu merged 2 commits into
mainfrom
feat/sdd-close

Conversation

@sebastian-iancu

Copy link
Copy Markdown
Contributor

Summary

  • New skill /sdd-close. It takes the close-out out of /sdd-deliver:
    • REQ shipped, acceptance ticks, the changelog line, generate, the full gate, the PR body, a draft marked ready;
    • one question: carry this pull request's open suggestions and outside lines to docs/backlog.md in the pull request itself (recommended), or leave them for the next /sdd-triage --backlog.
  • Run it again after you merge on the forge and it cleans up. It never merges or closes a pull request, and never deletes a remote branch.
  • New sdd-pr clean [<branch>] [--pr N] [--dry-run]. It removes a merged branch's worktree, the local branch and its findings file and delivery notes.
    • Every check runs before any change, and a refusal changes nothing.
    • It refuses while the pull request is open, a line would be lost, a worktree holds uncommitted work or is locked, or the branch holds a commit the pull request lacks.
    • It also refuses the base, the default branch and, when no branch is named, a branch with no findings file or notes.
    • A worktree the command or the shell runs in is left alone, with the commands to remove it printed.
  • /sdd-deliver ends at the maintainer's review. --close-out points to /sdd-close for this release. /sdd-triage --backlog becomes an occasional run.
  • Everything that names the close-out now names /sdd-close: the router, sdd-trace, sdd-triage, the session-start hook, the edit reminder, the Cursor rule, the references, the process templates, the docs, and upgrading.md (0.13.x to 0.14.0).

Why

  • Context cost. A close-out loaded all of sdd-deliver (1,616 words) to use about 230 of them. In the multi-PR sessions sampled, 31 of 53 sdd-deliver invocations were close-outs. A close-out now loads 867 words, and a delivery 1,393.
  • Backlog in the PR. Carrying the lines in the pull request removes the separate commit on the default branch after each merge. Running the full harvest in the pull request was rejected: it moves the watermark and rewrites the backlog's themes, so concurrent pull requests would conflict.

Word budgets

File Before After
sdd-close — 867 (new)
sdd-deliver 1,616 1,393
router 584 606
review.md 2,556 2,671
ai-workflow.md 1,151 1,162

Review

Two reviews ran before this PR, and their findings are fixed:

  • The skill review:
    • The merged-before-close-out path committed onto the merged branch.
    • On the default branch, after a merge, and with forge: none, the skill picked the wrong steps.
    • It did not respect the maintenance lane.
    • The changelog line was never committed.
  • The code review of clean:
    • It deleted a long-lived branch such as develop.
    • --pr overrode a named branch.
    • The "runs inside the worktree" check ignored the shell's own directory.
    • A failed switch of the main checkout was misreported.
    • It could not run from a detached checkout.
    • Locked and hand-deleted worktrees gave raw git errors.
    • Smaller fixes: the scratch worktree is no longer listed for removal, and file-deletion errors are caught.

Test plan

  • python3 -m unittest discover -s tools/tests: 574 pass, 15 of them in the new TestClean. A mutation check shows each of the seven new guards is pinned by a test.
  • ./scripts/validate.sh, python3 tools/sdd-check.py selftest, claude plugin validate .
  • Real git, forge: none, seven cases:
    • a linked worktree with an ignored .env;
    • the main checkout;
    • --root elsewhere with the shell inside the worktree;
    • unmerged;
    • develop with nothing delivered;
    • a detached checkout;
    • locked and hand-deleted worktrees.
  • On a GitHub pull request: /sdd-close before the merge (the carry question, resolve, ready), then after the merge, including after a squash merge with GitHub deleting the head branch.
  • The same on Cursor.

🤖 Generated with Claude Code

sebastian-iancu and others added 2 commits October 13, 2026 18:32
…and findings

`sdd-pr clean [<branch>] [--pr N] [--dry-run]` runs after the merge from
any checkout, a detached one included. It removes the branch's worktree
(the main checkout steps onto the base instead; one the command or the
shell runs in is left, with the commands), deletes the local branch only
when it holds no commit the merged pull request lacks (with forge: none,
once in the base), then its findings file, delivery notes and pass note.

Every check runs before any change: the pull request merged, no line in
the findings file that would be lost, no uncommitted work, no locked
worktree, not the base or the default branch, and, when unnamed, a
branch that has a findings file or notes. A worktree deleted by hand is
pruned. It never touches the pull request or the remote branch.

`status` points a ready draft and a merged pull request at /sdd-close and
names the lines that wait for /sdd-triage --backlog instead of putting
the harvest first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns up after the merge

The close-out loaded all of sdd-deliver (1616 words) to use about 230 of
them; in multi-PR sessions more than half the sdd-deliver invocations
were close-outs. sdd-close (867 words) does the close-out in the pull
request, asks once whether to carry the lines that do not block to
docs/backlog.md there, and, run again after the maintainer merges on the
forge, cleans up with sdd-pr clean. It never merges or closes a pull
request. sdd-deliver ends at the maintainer's review (1393 words);
--close-out points to sdd-close for this release.

The router, sdd-trace, sdd-triage, the hooks, the Cursor rule, the
references, the process templates and the docs name /sdd-close;
/sdd-triage --backlog becomes an occasional run. Word budgets: sdd-close
new at 867, sdd-deliver 1616 -> 1393, router 584 -> 606, review.md
2556 -> 2671, ai-workflow.md 1151 -> 1162.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sebastian-iancu
sebastian-iancu merged commit b70cb71 into main Oct 13, 2026
2 checks passed
@sebastian-iancu
sebastian-iancu deleted the feat/sdd-close branch October 13, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant