/godmode:merge-protocolfrom GodMode
Guides safe branch completion: merge locally, open a PR, park, or abandon. Validates test suite green, captures environment, identifies trunk, and presents four clean teardown paths.
Ships in GodMode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The last step of a run decides what happens to the branch: merge it locally, open a pull request, keep it as it is, or abandon it. Each path is easy to get slightly wrong (merging into the wrong base, deleting a worktree that held the only copy of a file, force-pushing over someone's commits), and most of those mistakes are expensive to undo.
Core principle: prove the suite is green on the exact tree you are about to land, let the user choose the path, execute it exactly, and tear down only what this run created. Integration is the user's decision; your job is to make each option safe.
NO LANDING ON A RED SUITE, NO ABANDONING WITHOUT THE TYPED WORD
No exceptions. No workarounds. No shortcuts.
Required:
godmode:delegated-execution or godmode:inline-execution finished and the final review is clean.godmode:parallel-execution or godmode:team-orchestration integrated their results.Skip:
Run the project's full test command in the worktree, plus its other machine checks if it has them (lint, type check, build). Read the output.
Also check git status --porcelain. Uncommitted changes are either committed now (they belong to the work) or reported to the user (they do not).
git_dir=$(cd "$(git rev-parse --git-dir)" && pwd -P)
git_common=$(cd "$(git rev-parse --git-common-dir)" && pwd -P)
worktree_path=$(git rev-parse --show-toplevel) # capture now; later steps change directory
branch=$(git branch --show-current)
| State | Paths offered | Teardown |
|---|---|---|
Normal checkout (git_dir equals git_common) | all four | none needed |
| Linked worktree on a named branch | all four | only if this run created it |
| Linked worktree, detached HEAD | PR (push as a new branch), keep, abandon | the host manages it; leave it |
The trunk is the branch this work forked from: named in the plan, the ledger, the branch's upstream, or git merge-base. If it is not certain, ask one question: "This branch split from <best guess>, correct?" Merging into the wrong base is expensive to undo.
Present exactly this, with the real names filled in:
The work on <branch> is complete. Suite: <command> -> <counts>.
1. Merge into <trunk> locally
2. Push <branch> and open a pull request against <trunk>
3. Keep the branch as it is for later
4. Abandon the work (deletes the branch and its commits)
Which path?
Wait for the answer. If the run made rulings or left deferred minors, list them above the menu so the user decides with them in view.
Path 1: Merge locally
main_root=$(git -C "$git_common/.." rev-parse --show-toplevel)
cd "$main_root"
git switch "$trunk"
git pull --ff-only # if the trunk has a remote; stop if it cannot fast-forward
git merge --no-ff "$branch"
<full test command>
If the merged result is red, stop. The merge is local and nothing is pushed: leave the branch and worktree in place, report, and investigate. If green: tear down (step 6), then git branch -d "$branch". Do not push the trunk unless the user asked for that too.
Path 2: Pull request
git push -u origin "$branch"
# detached HEAD: git push origin HEAD:refs/heads/<new-branch>
Open the pull request against the trunk with the forge's command-line tool if one is installed, or the creation link the push prints. Follow the repository's pull-request template. The body says what changed, how it was verified (commands and counts), the rulings made, and the deferred minors. Report the URL. Keep the worktree: review feedback gets fixed there.
Path 3: Keep as it is
Report: Keeping <branch>. Worktree at <path>. Resume with the ledger at <ledger path>. Change nothing.
Path 4: Abandon
Show exactly what will be lost and require the typed word:
This permanently deletes:
- branch <branch>
- commits: <git log --oneline trunk..branch>
- worktree at <path>, including uncommitted files: <list or "none">
Type "abandon" to confirm.
Only the exact word authorises it. "Yes", "sure" or "get rid of it" do not; ask again. On confirmation: change to the main root, tear down (step 6), then git branch -D "$branch". If the branch was pushed, ask separately before deleting the remote branch.
Runs after path 1 and confirmed abandonment only.
.worktrees/ or worktrees/ that this run created: git worktree remove "$worktree_path", then git worktree prune.git -C "$worktree_path" status --porcelain -uall and offer: commit them to the branch, move them to the main checkout, or delete them. Act on the user's choice.Delete the run's plan workspace (.godmode/runs/<plan-slug>/) after the rulings have been reported.
Path: <1-4> Branch: <name> Trunk: <name>
Suite: <command> -> <counts> (on the merged tree for path 1)
Result: <merge commit | PR URL | kept at path | deleted>
Teardown: <what was removed, what was left and why>
| Rationalisation | Truth |
|---|---|
| "Tests passed earlier in the session" | A green run proves only the tree it ran on. Run it on this one. |
| "They obviously want it merged" | Integration is the user's call. Present the paths and wait. |
| "The trunk is obviously main" | Confirm the fork point. Wrong-base merges are costly to unwind. |
| "'Get rid of it' is confirmation enough" | Only the typed word authorises deletion. |
| "Removal refused, force it to finish cleanup" | Refusal means files exist only there. Forcing destroys them. Ask. |
| "Push rejected, force-push fixes it" | The remote moved. Investigate; force-push only when the user explicitly asks. |
| "The PR is open, the worktree is clutter" | Review fixes happen in that worktree. Keep it until the work lands. |
Never:
Always:
godmode:delegated-execution, godmode:inline-execution: hand off here after their final review.godmode:completion-gate: the evidence rule behind "suite green".godmode:cross-model-review: run before this skill when the user wants a second model family to review first.godmode:workspace-isolation: created the worktree this skill tears down.godmode:review-response: handling pull-request feedback after path 2.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub noobygains/godmode --plugin godmode33 skills in this plugin
/agent-briefingUse when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff report between agents, or sending a message to another agent mid-task./codebase-conventionsUse when about to add or change code in an existing codebase: a new file, module, route, component, service, test, migration, error path or dependency, especially in a project the agent did not write or has not yet surveyed in this session./code-reviewUse when a task, feature or bug fix is implemented and before it is committed, merged or handed back to the user, and when the user asks for a review of a change, a branch or a pull request.Other plugins' skills for the same job