From consensus-loop
Squash-merges git worktree branch to target branch with structured commit message based on change categorization. Validates retrospective completion and clean tree first.
How this skill is triggered — by the user, by Claude, or both
Slash command
/consensus-loop:merge-worktreeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Squash-merge the current worktree branch back into the target branch. All WIP commits become one structured commit.
Squash-merge the current worktree branch back into the target branch. All WIP commits become one structured commit.
This skill is invoked by the orchestrator after:
[agree_tag] consensus reachedsession-self-improvement-complete)| Context | Behavior |
|---|---|
| Interactive | Report merge result → ask about cleanup |
| Headless | Merge → verify → report result → do NOT cleanup (orchestrator decides) |
In headless mode, do NOT ask "keep worktree or remove?" — report the result and exit. The orchestrator handles cleanup.
!git rev-parse --git-dir!git branch --show-current!git log --oneline -20!git status --shortFollow phases in order. Do NOT skip phases.
Verify worktree: git rev-parse --git-dir must contain /worktrees/. If not → stop:
"This skill must be run from inside a git worktree."
Verify retrospective complete: Check .claude/retro-marker.json in the repo root:
git -C "$(git rev-parse --git-common-dir)/.." cat-file -e HEAD:.claude/retro-marker.json 2>/dev/null || cat "$(git rev-parse --git-common-dir)/../.claude/retro-marker.json" 2>/dev/null
If retro_pending is true → stop:
"Retrospective not completed. Run retrospective first, then
session-self-improvement-complete."
Identify current branch: git branch --show-current
Resolve target branch:
$ARGUMENTS provided → use as targetmain or masterFind original repo root:
ORIGINAL_ROOT="$(git rev-parse --git-common-dir)/.."
Clean working tree: git status --porcelain must be empty. If not → stop:
"Uncommitted changes found. Commit or stash first."
Commit history: git log --oneline <target>..HEAD
File change summary: git diff <target>...HEAD --stat
Full diff: git diff <target>...HEAD — read carefully
Read key files: For significantly changed files, use Read to understand full context
Categorize changes:
Structure:
<type>(<scope>): <summary under 72 chars>
<body — what changed and why, grouped by category>
<footer — breaking changes, issue refs, co-authors>
Type rules:
feat — new functionalityfix — bug correctionrefactor — restructuring without behavior changetest — test additions/changes onlydocs — documentation onlychore — build, CI, toolingScope: the primary module affected (e.g., bus, security, orchestration, fe)
Body guidelines:
### headers if multiple typesFooter:
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
All commands use absolute paths or git -C — shell state does not persist between commands.
Squash merge (from original repo root):
git -C "${ORIGINAL_ROOT}" merge --squash <worktree_branch>
Commit with generated message:
git -C "${ORIGINAL_ROOT}" commit -m "<generated_message>"
Verify merge commit exists:
git -C "${ORIGINAL_ROOT}" log -1 --oneline
The output must show the new squash commit with the generated message. If not → merge failed — report error, do NOT proceed to cleanup.
Verify no uncommitted changes remain:
git -C "${ORIGINAL_ROOT}" status --porcelain
Must be empty. If not → partial merge — report and stop.
Report result to orchestrator:
## Merge Complete
- Branch: <worktree_branch> → <target_branch>
- Commits squashed: N
- Files changed: M
- Commit: <short_sha> <first_line>
- Verified: commit exists ✅, working tree clean ✅
Worktree can be removed with:
`git worktree remove <worktree_path>`
Report to orchestrator with cleanup options:
**Worktree merged. Cleanup options:**
1. `git worktree remove <worktree_path> && git branch -d <worktree_branch>`
2. Keep worktree for reference
The orchestrator decides — this skill does not remove worktrees autonomously.
feat(bus): add event replay port for SSE reconnection
EventBus now supports replay_since(cursor, { team_id }) for
tenant-scoped event replay. InMemory uses ring buffer,
Redis uses XRANGE.
- src/bus/types.ts: ReplayableMessageBus interface
- src/bus/service.ts: ring buffer implementation (max 1000)
- src/bus/redis-bus.ts: XRANGE-based replay
- tests/bus/replay.test.ts: 12 tests
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
If post-merge verification fails (tests break, build fails):
git log -1 --oneline → note the SHAgit -C "${ORIGINAL_ROOT}" revert --no-edit <merge-sha>
git -C "${ORIGINAL_ROOT}" diff HEAD~1..HEAD --stat shows the inverse## Emergency Rollback
- Reverted: <merge-sha> (<commit message>)
- Reason: <what failed>
- Status: tests passing after revert
- Action needed: task returns to `correcting` status
correcting, note rollback reasonDo NOT use git reset --hard — revert creates an audit trail. Hard reset loses history.
git status --porcelain shows uncommitted changesconsensus-loop:verify has unresolved failuresretro_pending: true)git status --porcelain shows uncommitted changesnpx claudepluginhub berrzebb/claude-plugins --plugin consensus-loopPerforms local git merge of a subagent worktree branch into an integration branch with preflight checks and recorded rollback. Useful for safe, resumable local merges without remote VCS.
Merges reviewed PRs when triggered by /pr-merge or merge commands. Handles squash/rebase, worktrees, integration branches, and auto-merge for CI gating.
Manually merges parallel git worktree development tracks into main branch with flags for PR skipping, worktree/branch cleanup, and dry-run previews. For devteam projects when auto-merge fails.