Vessel merge protocol

From The-AgenticFlow/openflows · View interactive version

Vessel merge protocol is an AI agent skill from the GitHub repository The-AgenticFlow/openflows. Protocol for safely merging approved PRs

How to use this skill

Skill file

Merge Protocol Skill

Pre-Merge Checklist

Before merging, verify:

Merge Process

Step 1: Fetch Latest

git fetch origin main

Step 2: Check Divergence

BEHIND=$(git rev-list --count HEAD..origin/main)
if [ "$BEHIND" -gt 0 ]; then
  # Need rebase or merge
fi

Step 3: Merge

Use merge_pr MCP tool with:

Step 4: Verify

Step 5: Sync Active Worktrees

After a successful merge into main, all active FORGE worktrees MUST be rebased

onto the updated main to prevent drift and merge conflicts.

Policy: No branch may fall behind main. All branches must be at main or ahead of main.

# Fetch the latest main (now including the merge we just performed)
git fetch origin main

# Sync every active worktree
for wt in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
  BRANCH=$(git -C "$wt" branch --show-current)
  if [ "$BRANCH" != "main" ] && [ -n "$BRANCH" ]; then
    BEHIND=$(git -C "$wt" rev-list --count "HEAD..origin/main" 2>/dev/null || echo "0")
    if [ "$BEHIND" -gt 0 ]; then
      echo "Syncing worktree $wt ($BRANCH) — $BEHIND commits behind main"
      git -C "$wt" rebase origin/main
      if [ $? -ne 0 ]; then
        git -C "$wt" rebase --abort
        echo "CONFLICT in $wt on branch $BRANCH — requires manual resolution"
        # Report conflict to NEXUS
      fi
    else
      echo "Worktree $wt ($BRANCH) is up to date"
    fi
  fi
done

Alternatively, use the dedicated sync script:

bash scripts/sync-worktrees.sh

Conflict handling:

Step 6: Report

Merge Methods

| Method | Use When |

|--------|----------|

| squash | Single logical change (recommended) |

| merge | Multiple commits should be preserved |

| rebase | Linear history preferred |

Post-Merge

  1. Sync: Rebase all active worktrees onto updated main (Step 5)
  2. Cleanup: Remove worktree for the merged branch only
  3. Notify: Emit event for NEXUS (include sync results)
  4. Update: Set worker slot to Idle

Failure Handling

If merge fails:

  1. Check for conflicts
  2. Report to NEXUS with deploy_failed
  3. Do NOT attempt to resolve conflicts automatically

If worktree sync fails (rebase conflict):

  1. Abort the rebase immediately
  2. Report to NEXUS with worktree path and branch name
  3. Set affected worker STATUS.json to BLOCKED with reason REBASE_CONFLICT
  4. Do NOT attempt to resolve conflicts automatically — assign a fresh FORGE or human
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.