Agent Merge-Conflict Arbiter
Resolve a git merge conflict between two AGENTS' branches as an impartial third
party. Agents resolving conflicts against a peer's work reliably either
overwrite the peer or abandon their own change — they lack the peer's context
and are biased toward their own side. This skill is the fix: a neutral
reconciler that receives both diffs plus both sides' stated intents and
produces a merged result, like a merge-queue arbiter.
When to Use
- Two agent branches/worktrees collide during a parallel campaign (kanban
engineering pipeline, parallel-PR wave, multi-worktree refactor).
git merge or git rebase halts on conflicts between two agents' work and
neither original agent should self-adjudicate.
- Do NOT use for conflicts within a single agent's own work, or for trivial
lockfile/generated-file conflicts (regenerate those instead).
Prerequisites
- A repo checkout containing the halted merge, or the two branch names plus
permission to run the merge yourself.
- Both sides' intent sources: kanban completion summaries (
terminal running
hermes kanban show <task-id>), PR bodies, or at minimum each branch's
commit messages.
- The project's build/test command, if one exists.
How to Run
Standalone — a human (or agent) invokes this skill inside the conflicted
repo: load the skill, then follow the Procedure top to bottom.
Spawned neutral agent — the preferred shape in multi-agent campaigns:
delegate_task: spawn a subagent whose task message contains the repo path,
both branch names, and both sides' intent summaries verbatim, plus an
instruction to follow this skill.
- Kanban-native: create a reconciliation card assigned to a third profile
(not either worker's profile) with BOTH conflicted cards linked as parents —
kanban_create(title="reconcile branch-a x branch-b", assignee="reconciler", parents=["t_a", "t_b"]). The parent links carry both sides' completion
summaries into the reconciler's context automatically; the card body should
name the repo path and the two branches.
Quick Reference
| Hunk class |
Definition |
Resolution |
| disjoint-intent |
The two changes serve different goals and can coexist |
Combine both |
| same-question-different-answer |
Both sides answered one design question differently |
Pick ONE per stated intents; surface the decision |
| superseded |
One side's premise no longer holds after the other's change |
Keep the surviving side; note why |
Impartiality contract: never favor the side that spawned you; touch ONLY
conflicted regions (no drive-by edits); every design-question pick must appear
explicitly in the hand-back summary.
Procedure
1. Gather both sides
- Run via
terminal: git status (confirm the conflicted state and list
conflicted files), git merge-base <A> <B>, then for each side
git log --oneline <base>..<side> and git diff <base>..<side> -- <file>
for every conflicted file. In a halted merge, HEAD is one side and
MERGE_HEAD is the other.
- Collect each side's intent:
hermes kanban show <task-id> for completion
summaries/metadata, or the PR body, or the commit messages from the log
above. Write down one sentence of intent per side before touching any file.
- Done when: you can state both intents in your own words and have both diffs
for every conflicted file.
2. Classify every conflicted hunk
- Open each conflicted file with
read_file and locate each
<<<<<<</=======/>>>>>>> block.
- Assign each hunk exactly one class from the Quick Reference table, judging
by the stated intents — not by which change looks nicer.
- If a single hunk contains multiple independent decisions (e.g., new logic
that combines cleanly PLUS a styling/rounding choice both sides answered
differently), decompose it into sub-decisions and classify each one.
- A single file often mixes classes: one hunk may be a design collision while
a neighboring hunk is disjoint. Classify per hunk, not per file.
- Done when: every hunk has a written class and a one-line rationale.
3. Resolve under the impartiality contract
- Edit each hunk with
patch (or write_file for whole-file rewrites):
- disjoint-intent → merge both changes so each intent is fully served.
- same-question-different-answer → pick the answer that best serves the
STATED intents (e.g., an intent of "strict validation" beats "quick
default" if the task required correctness). Never split the difference
into a hybrid neither side asked for.
- superseded → keep the surviving side; delete the dead premise.
- Never favor the side that spawned you. If intents genuinely tie, escalate
(block the kanban card / report back) rather than guess.
- Change nothing outside conflict markers — no formatting, renames, or
opportunistic fixes.
git add each resolved file via terminal.
- Done when:
search_files finds no <<<<<<< markers in the repo and every
resolved file is staged.
4. Verify
- Run the project's build/tests via
terminal; at minimum import/execute the
touched modules. Both intents must be observable in the merged behavior
(e.g., side A's new semantics AND side B's disjoint addition both present).
- Complete the merge:
git commit (the default merge message plus a body
listing hunk decisions is fine).
- Done when: verification passes and the merge commit exists.
5. Hand back
- Produce a completion summary naming EVERY hunk decision:
file:lines — class — which side(s) kept — rationale. For every
same-question-different-answer hunk, state the design question and the
answer you picked so a human can veto it — never bury a design call.
- Kanban:
kanban_complete(summary=...). Standalone: print the summary.
- Done when: the summary is delivered and lists all hunks.
Pitfalls
- Self-favoring: if you were spawned by one of the conflicting agents,
you are structurally biased — state this and weigh the other side's intent
deliberately. Prefer the third-profile shape so this never arises.
- Splitting the difference on a design collision produces a hybrid nobody
designed; pick one answer and surface it.
- Per-file classification: files usually mix hunk classes; classifying a
whole file as one class silently drops a disjoint change.
- Drive-by edits make the merge unreviewable and steal decisions from the
original agents.
- Missing intents: commit messages alone can be thin; prefer kanban
completion summaries or PR bodies. If neither side's intent is recoverable,
escalate instead of guessing.
- Repeat offenders: repeated conflicts on the SAME file across rounds are
a hotspot signal, not routine reconciliation work — flag it (e.g. a
hotspot: <path> — <reason> kanban comment) so the orchestrator decomposes
that file, rather than serially reconciling every new collision on it.
Verification
git status shows a clean tree on the target branch with a merge commit.
- No conflict markers remain (
search_files pattern <<<<<<<).
- Build/tests pass; both sides' intents are demonstrably present or the
dropped one is explicitly named in the summary.
- The hand-back summary enumerates every hunk with class and rationale.
1---2name: agent-merge-conflict-arbiter3description: Neutral arbiter for merge conflicts between two agents.4license: MIT5---6
7# Agent Merge-Conflict Arbiter
8
9Resolve a git merge conflict between two AGENTS' branches as an impartial third
10party. Agents resolving conflicts against a peer's work reliably either
11overwrite the peer or abandon their own change — they lack the peer's context
12and are biased toward their own side. This skill is the fix: a neutral
13reconciler that receives both diffs plus both sides' stated intents and
14produces a merged result, like a merge-queue arbiter.
15
16## When to Use
17
18- Two agent branches/worktrees collide during a parallel campaign (kanban
19 engineering pipeline, parallel-PR wave, multi-worktree refactor).
20- `git merge` or `git rebase` halts on conflicts between two agents' work and
21 neither original agent should self-adjudicate.
22- Do NOT use for conflicts within a single agent's own work, or for trivial
23 lockfile/generated-file conflicts (regenerate those instead).
24
25## Prerequisites
26
27- A repo checkout containing the halted merge, or the two branch names plus
28 permission to run the merge yourself.
29- Both sides' intent sources: kanban completion summaries (`terminal` running
30 `hermes kanban show <task-id>`), PR bodies, or at minimum each branch's
31 commit messages.
32- The project's build/test command, if one exists.
33
34## How to Run
35
36**Standalone** — a human (or agent) invokes this skill inside the conflicted
37repo: load the skill, then follow the Procedure top to bottom.
38
39**Spawned neutral agent** — the preferred shape in multi-agent campaigns:
40
41- `delegate_task`: spawn a subagent whose task message contains the repo path,
42 both branch names, and both sides' intent summaries verbatim, plus an
43 instruction to follow this skill.
44- Kanban-native: create a reconciliation card assigned to a **third profile**
45 (not either worker's profile) with BOTH conflicted cards linked as parents —
46 `kanban_create(title="reconcile branch-a x branch-b", assignee="reconciler",
47 parents=["t_a", "t_b"])`. The parent links carry both sides' completion
48 summaries into the reconciler's context automatically; the card body should
49 name the repo path and the two branches.
50
51## Quick Reference
52
53| Hunk class | Definition | Resolution |
54|---|---|---|
55| disjoint-intent | The two changes serve different goals and can coexist | Combine both |
56| same-question-different-answer | Both sides answered one design question differently | Pick ONE per stated intents; surface the decision |
57| superseded | One side's premise no longer holds after the other's change | Keep the surviving side; note why |
58
59Impartiality contract: never favor the side that spawned you; touch ONLY
60conflicted regions (no drive-by edits); every design-question pick must appear
61explicitly in the hand-back summary.
62
63## Procedure
64
65### 1. Gather both sides
66
67- Run via `terminal`: `git status` (confirm the conflicted state and list
68 conflicted files), `git merge-base <A> <B>`, then for each side
69 `git log --oneline <base>..<side>` and `git diff <base>..<side> -- <file>`
70 for every conflicted file. In a halted merge, `HEAD` is one side and
71 `MERGE_HEAD` is the other.
72- Collect each side's intent: `hermes kanban show <task-id>` for completion
73 summaries/metadata, or the PR body, or the commit messages from the log
74 above. Write down one sentence of intent per side before touching any file.
75- Done when: you can state both intents in your own words and have both diffs
76 for every conflicted file.
77
78### 2. Classify every conflicted hunk
79
80- Open each conflicted file with `read_file` and locate each
81 `<<<<<<<`/`=======`/`>>>>>>>` block.
82- Assign each hunk exactly one class from the Quick Reference table, judging
83 by the stated intents — not by which change looks nicer.
84- If a single hunk contains multiple independent decisions (e.g., new logic
85 that combines cleanly PLUS a styling/rounding choice both sides answered
86 differently), decompose it into sub-decisions and classify each one.
87- A single file often mixes classes: one hunk may be a design collision while
88 a neighboring hunk is disjoint. Classify per hunk, not per file.
89- Done when: every hunk has a written class and a one-line rationale.
90
91### 3. Resolve under the impartiality contract
92
93- Edit each hunk with `patch` (or `write_file` for whole-file rewrites):
94 - disjoint-intent → merge both changes so each intent is fully served.
95 - same-question-different-answer → pick the answer that best serves the
96 STATED intents (e.g., an intent of "strict validation" beats "quick
97 default" if the task required correctness). Never split the difference
98 into a hybrid neither side asked for.
99 - superseded → keep the surviving side; delete the dead premise.
100- Never favor the side that spawned you. If intents genuinely tie, escalate
101 (block the kanban card / report back) rather than guess.
102- Change nothing outside conflict markers — no formatting, renames, or
103 opportunistic fixes.
104- `git add` each resolved file via `terminal`.
105- Done when: `search_files` finds no `<<<<<<<` markers in the repo and every
106 resolved file is staged.
107
108### 4. Verify
109
110- Run the project's build/tests via `terminal`; at minimum import/execute the
111 touched modules. Both intents must be observable in the merged behavior
112 (e.g., side A's new semantics AND side B's disjoint addition both present).
113- Complete the merge: `git commit` (the default merge message plus a body
114 listing hunk decisions is fine).
115- Done when: verification passes and the merge commit exists.
116
117### 5. Hand back
118
119- Produce a completion summary naming EVERY hunk decision:
120 `file:lines — class — which side(s) kept — rationale`. For every
121 same-question-different-answer hunk, state the design question and the
122 answer you picked so a human can veto it — never bury a design call.
123- Kanban: `kanban_complete(summary=...)`. Standalone: print the summary.
124- Done when: the summary is delivered and lists all hunks.
125
126## Pitfalls
127
128- **Self-favoring**: if you were spawned by one of the conflicting agents,
129 you are structurally biased — state this and weigh the other side's intent
130 deliberately. Prefer the third-profile shape so this never arises.
131- **Splitting the difference** on a design collision produces a hybrid nobody
132 designed; pick one answer and surface it.
133- **Per-file classification**: files usually mix hunk classes; classifying a
134 whole file as one class silently drops a disjoint change.
135- **Drive-by edits** make the merge unreviewable and steal decisions from the
136 original agents.
137- **Missing intents**: commit messages alone can be thin; prefer kanban
138 completion summaries or PR bodies. If neither side's intent is recoverable,
139 escalate instead of guessing.
140- **Repeat offenders**: repeated conflicts on the SAME file across rounds are
141 a hotspot signal, not routine reconciliation work — flag it (e.g. a
142 `hotspot: <path> — <reason>` kanban comment) so the orchestrator decomposes
143 that file, rather than serially reconciling every new collision on it.
144
145## Verification
146
147- `git status` shows a clean tree on the target branch with a merge commit.
148- No conflict markers remain (`search_files` pattern `<<<<<<<`).
149- Build/tests pass; both sides' intents are demonstrably present or the
150 dropped one is explicitly named in the summary.
151- The hand-back summary enumerates every hunk with class and rationale.