agentleFS
NoobyGainsNoobyGains/godmode/skills/merge-protocol/SKILL.md

merge-protocol

Skill107 starsChanged 9 months agoMITView on GitHub

Use when implementation is finished, tests are green, and you need to decide how to land the work - presents structured integration paths for local merge, pull request, deferral, or abandonment

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No exceptions. No workarounds.

    line 20
  2. Distinctive:

    All planned implementation work is done and committed

    line 24
  3. Distinctive:

    When a workspace-isolation branch needs teardown

    line 29
  4. Distinctive:

    Wait for the exact word.

    line 151
  5. Distinctive:

    Correction: Always verify the suite before presenting paths

    line 190
  6. Distinctive:

    Correction: Only tear down worktrees for Paths 1 and 4

    line 198
  7. Distinctive:

    Run suite before presenting paths

    line 213

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Merge Protocol

Overview

Coordinate the final step of development: moving finished work into the mainline or disposing of it cleanly.

Core principle: Validate first, present choices, execute the selected path, then tidy up.

Announce at start: "I'm using the merge-protocol skill to finalize this work."

Prime Directive

NO INTEGRATION WITHOUT PASSING TESTS

No exceptions. No workarounds. No shortcuts.

When to Use

  • All planned implementation work is done and committed
  • The test suite runs green on the current branch
  • Review feedback (if solicited) has been resolved
  • You are ready to land, shelve, or abandon the branch
  • Following delegated-execution or task-runner completion
  • When a workspace-isolation branch needs teardown

Cognitive Traps

RationalizationTruth
"Tests were green an hour ago, no need to re-run"Any commit since then invalidates stale results. Re-verify now.
"Merging is mechanical — nothing breaks"Conflicts and integration regressions are real. Test the merged state.
"I'll remove the worktree tomorrow"Orphaned worktrees pile up and create confusion. Remove them immediately.
"Let me just merge — skip the menu"Always present all four paths. The human picks the workflow.
"Abandonment is obvious — no confirmation needed"Destroying work permanently demands explicit typed confirmation. Always.

The Workflow

Phase 1: Validate the Suite

Run the full test suite before anything else:

# Execute the project's test runner
npm test / cargo test / pytest / go test ./...

On failure:

Suite failures detected (<N> failing). Resolution required before proceeding:

[Display failing tests]

Integration cannot continue until the suite is green.

Halt here. Do not advance to Phase 2.

On success: Proceed to Phase 2.

Phase 2: Identify the Trunk Branch

# Determine the ancestor branch
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null

Or confirm: "This branch diverged from main — correct?"

Phase 3: Offer Integration Paths

Present exactly these four choices:

Work is complete and verified. Select an integration path:

1. Merge into <trunk> locally
2. Push and open a Pull Request
3. Leave the branch untouched (I'll handle it myself)
4. Abandon this work entirely

Which path?

Keep it terse — no extra commentary.

Phase 4: Execute the Selected Path

Path 1: Local Merge

# Switch to trunk
git checkout <trunk>

# Sync with remote
git pull

# Integrate the feature branch
git merge <feature-branch>

# Validate the merged state
<test command>

# Remove the merged branch
git branch -d <feature-branch>

Then: Proceed to Phase 5 (Worktree Teardown)

Path 2: Pull Request

# Push the branch upstream
git push -u origin <feature-branch>

# Open the PR
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets describing the changes>

## Verification Steps
- [ ] <checklist items>
EOF
)"

Then: Proceed to Phase 5 (Worktree Teardown)

Path 3: Defer

Report: "Branch <name> preserved. Worktree remains at <path>."

Do not tear down the worktree.

Path 4: Abandon

Require explicit confirmation:

Permanent deletion warning:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>

Type 'abandon' to proceed.

Wait for the exact word.

After confirmation:

git checkout <trunk>
git branch -D <feature-branch>

Then: Proceed to Phase 5 (Worktree Teardown)

Phase 5: Worktree Teardown

Applies to Paths 1, 2, and 4:

Detect if the current branch lives in a worktree:

git worktree list | grep $(git branch --show-current)

If so:

git worktree remove <worktree-path>

Path 3: Worktree stays intact.

Decision Matrix

PathMergesPushesKeeps WorktreeRemoves Branch
1. Local mergeYesNoNoYes
2. Pull requestNoYesYesNo
3. DeferNoNoYesNo
4. AbandonNoNoNoYes (force)

Frequent Errors

Skipping validation

  • Consequence: Broken code lands on trunk, failing PR created
  • Correction: Always verify the suite before presenting paths

Open-ended prompting

  • Consequence: "What now?" leads to ambiguity and stalling
  • Correction: Present exactly four structured paths

Premature worktree removal

  • Consequence: Destroys workspace needed for PR or deferred work
  • Correction: Only tear down worktrees for Paths 1 and 4

Silent abandonment

  • Consequence: Work deleted without the human's awareness
  • Correction: Require typed "abandon" before any destructive action

Guardrails

Prohibited:

  • Proceeding when tests fail
  • Merging without validating the integrated result
  • Deleting branches without explicit confirmation
  • Force-pushing unless the human specifically asks

Mandatory:

  • Run suite before presenting paths
  • Present exactly four options
  • Obtain typed confirmation for Path 4
  • Tear down worktree only for Paths 1 and 4

Integration

Invoked by:

  • godmode:delegated-execution (final step) — After all delegated tasks finish
  • godmode:task-runner (final step) — After all execution batches complete

Complements:

  • godmode:workspace-isolation — Tears down the worktree created by that skill

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.