feat(commit-next): look for the same fix on other branches first

A bundle was committed on the assumption that it was new. Nobody checked
whether another branch already carried the same fix, so the same defect got
solved twice and the second solution had to be reconciled by hand at merge
time - or worse, silently won.

The search that answers this already exists in merge-fix, but merge-fix
refuses a dirty tree and commit-next is dirty by definition. So only its
search steps are borrowed: fetch every ref, then grep the log by message, by
symbol and by path. No cherry-pick, no merge, no touching the staging index.

A hit is a stop, not a warning. The staged version and the foreign commit go
into dialectic as thesis and antithesis, and the operator gets sha, branch,
both diffs, the verdict and one recommended move - keep staged, take theirs,
or combine. Committing anyway would decide that question by accident.

Nothing found, or the operator picks the staged version, and the old flow
continues unchanged from commit-no-verify onwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5 committed 2026-08-11 21:19:24 +02:00
1 parent 9c97861dc1
commit d7e2827511
1 file changed
+21 -10
+21 -10
View File
@@ -1,20 +1,31 @@
---
name: commit-next
description: >
Commit the staged bundle with --no-verify, then stage the next logical
bundle and brief the operator on it. Trigger on /commit-next or when the
operator asks to commit and stage the next bundle in one step. Portable
across projects.
Fetch every branch and check whether the staged fix already exists
elsewhere, then commit the staged bundle with --no-verify, stage the next
logical bundle and brief the operator on it. Trigger on /commit-next or
when the operator asks to commit and stage the next bundle in one step.
Portable across projects.
---
1. Run the commit-no-verify skill on the currently staged changes
(comments-clean audit first, then `git commit --no-verify`, exact
staging index only).
2. Group the remaining uncommitted changes into logical bundles (one
1. `git fetch --all --prune --tags`, then hunt the staged fix across every
ref with the merge-fix search steps (`git log --all` by `--grep`, by
`-S<symbol>`, by path). Describe the staged bundle in one line first so a
wrong search intent is visible. Only the search runs here — never
cherry-pick or merge, and never touch the staging index or the tree.
2. A similar fix on another branch is a stop: run the dialectic skill on the
two candidates (staged version as thesis, foreign commit as antithesis)
until one survives, then present sha, branch, both diffs, the verdict and
the recommended move (keep staged / take theirs / combine). Wait for the
operator's decision; do not commit.
3. Nothing similar found, or the operator picked the staged version: run the
commit-no-verify skill on the currently staged changes (comments-clean
audit first, then `git commit --no-verify`, exact staging index only).
4. Group the remaining uncommitted changes into logical bundles (one
concern per bundle: same failure class, same mechanism, or same role)
and stage the next one; never mix concerns to save a commit.
3. For the newly staged bundle run the explain skill (what the changes do
5. For the newly staged bundle run the explain skill (what the changes do
and how the pieces interact, file:line-anchored) followed by the
confidence skill (fix confidence, break risk, evidence, residuals).
4. Close with what remains unstaged and wait for the operator's commit
6. Close with what remains unstaged and wait for the operator's commit
decision; never auto-commit the newly staged bundle.