From dso
Agent-assisted git merge/rebase conflict resolution with confidence-gated automation
npx claudepluginhub navapbc/digital-service-orchestra --plugin dso-devThis skill is limited to using the following tools:
<SUB-AGENT-GUARD>
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
"ERROR: /dso:resolve-conflicts cannot run in sub-agent context — it requires the Agent tool to dispatch its own sub-agents. Invoke this skill directly from the orchestrator instead."
Do NOT proceed with any skill logic if the Agent tool is unavailable.
Analyzes git merge or rebase conflicts, classifies them by complexity, auto-resolves trivial cases, and presents non-trivial resolutions for human approval.
Automatic (called by other skills):
/dso:end-session Step 4: when merge-to-main.sh exits with CONFLICT_DATA: output/dso:debug-everything Phase 10 Step 1: same triggerManual (user-invoked):
/dso:resolve-conflicts — resolve conflicts in the current merge/rebase state/dso:resolve-conflicts <branch> — attempt merge of <branch> into current branch, then resolveBefore this skill can act, one of these must be true:
ms_get_conflicted_files returns files)REPO_ROOT=$(git rev-parse --show-toplevel)
source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/merge-state.sh"
If a branch argument was provided and no merge is in progress:
git merge --no-ff <branch> -m "Merge <branch>" --quiet 2>&1
Check for conflicted files using the shared library:
CONFLICTED=$(ms_get_conflicted_files)
If $CONFLICTED is empty, check whether a merge is still in progress with all conflicts pre-resolved:
# Uses ms_is_merge_in_progress from ${CLAUDE_PLUGIN_ROOT}/hooks/lib/merge-state.sh
# Returns 0 (true) when MERGE_HEAD exists and != HEAD
if ms_is_merge_in_progress; then MERGE_IN_PROGRESS="yes"; else MERGE_IN_PROGRESS="no"; fi
$MERGE_IN_PROGRESS is yes and no unresolved conflicts remain: report "Merge in progress with all conflicts pre-resolved — run git commit to finalize the merge." and exit. Do NOT report "no conflicts detected" — the merge needs committing, not aborting.$MERGE_IN_PROGRESS is no: report "No conflicts detected — merge is clean." and exit.Separate .tickets-tracker/ conflicts from code conflicts:
TICKET_CONFLICTS=$(echo "$CONFLICTED" | grep '^\.tickets-tracker/' || true)
CODE_CONFLICTS=$(echo "$CONFLICTED" | grep -v '^\.tickets-tracker/' || true)
If only .tickets-tracker/ conflicts exist (JSON event files): auto-resolve by accepting ours (git checkout --ours + git add for each), complete the merge, and exit. Ticket event files are append-only and safe to auto-resolve.
If code conflicts exist: proceed to Step 2.
Dispatch the dso:conflict-analyzer dedicated agent via the Agent tool. Read agents/conflict-analyzer.md inline and use subagent_type: "general-purpose" with model: "sonnet". (dso:conflict-analyzer is an agent file identifier, NOT a valid subagent_type value — the Agent tool only accepts built-in types.) Pass the following context:
Include in the sub-agent prompt:
git log main..<branch> --oneline -- <file> for each file (branch-side intent)git log <merge-base>..main --oneline -- <file> for each file (main-side intent)Fallback: If the dso:conflict-analyzer agent file is missing (e.g., plugin not installed), fall back to subagent_type: "general-purpose" with model sonnet and include the full conflict classification procedure inline. Log a warning: "Fallback: dso:conflict-analyzer agent not found; using general-purpose with inline prompt."
Based on sub-agent classifications:
TRIVIAL conflicts (auto-resolve):
git add <file>SEMANTIC and AMBIGUOUS conflicts (human approval required):
If ALL conflicts were TRIVIAL:
git -c core.editor=true merge --continue 2>/dev/null || \
git commit --no-edit 2>/dev/null || true
.claude/scripts/dso validate.sh --ci
Auto-resolved N TRIVIAL conflict(s):
- path/to/file1.py: import ordering (both sides added imports)
- path/to/file2.py: non-overlapping additions
Validation: PASSED (format, lint, unit tests)
git merge --abort 2>/dev/null || git reset --merge 2>/dev/null || true
Then re-run the merge to restore conflict state and present all resolutions for human review.If ANY conflict is SEMANTIC or AMBIGUOUS (or trivial auto-resolve failed validation):
Conflict Resolution Proposal:
| File | Type | Confidence | Strategy |
|------|------|------------|----------|
| path/to/file1.py | TRIVIAL | HIGH | Import ordering — merged both |
| path/to/file2.py | SEMANTIC | MEDIUM | Both sides extended Config — combined |
| path/to/file3.py | AMBIGUOUS | LOW | Conflicting logic — needs your decision |
After successful resolution:
/dso:end-session or /dso:debug-everything, return control to the calling skillIf resolution was abandoned (user chose to resolve manually):
git merge --abort if merge is still in progress)git merge <branch>."| Situation | Action |
|---|---|
| Sub-agent fails to parse conflicts | Fall back to presenting raw conflict markers to user |
| Sub-agent proposes invalid code | Validation catches it; escalate to human |
| User rejects all proposals | Abort merge, report manual resolution needed |
| Merge --continue fails after staging | git reset --merge, report error, escalate to user |
.tickets-tracker/ JSON event files are auto-resolved (accept ours) — they are append-only and safe to resolve without user input..md files are NOT auto-resolved — show a diff to the user and ask for confirmation before choosing a version, as each side may contain important state changes.