Semantic Merge Adjudicator
When two convoy polecats or two git-worktree agents write the same shared state,
their diffs may overlap by bytes without colliding in meaning. This skill adds a
semantic decision layer above refinery-merge: it classifies each conflicting
hunk as independent, redundant, or clash, so the merge queue is not forced
to escalate every syntactic overlap. It never pushes and never blind auto-merges
— a down-classified result re-enters refinery-merge's existing test gate.
Why
refinery-merge is deliberately dumb: on any rebase conflict it aborts, blocks
the queue, and escalates to mayor-coordinator. That is correct and must stay —
but it means a convoy of 50+ agents stalls on conflicts that are not real
(two agents appending to different sections of the same file, or two agents
producing the same edit). CoAgent's finding is that for minutes-long LLM
transactions, abort-and-retry discards a costly run and most detected conflicts
are syntactic byte-overlaps, not semantic collisions. This skill recovers the
false-conflict cases without weakening the backstop — it can only ever route a
conflict toward the same deterministic test-then-push pipeline, never around it.
Data classes touched
Shared repo / project-internal state only (a git tree, .claude/ config, a
shared doc). Hunks that touch these are path-gated and escalated unread, never
classified, never mixed into an auto-composed tree: .planning/ (any),
credentials (.env, *.credentials*, keystore), config (.claude/settings*.json,
config.json, chipset/agent YAML), .claude/hooks/, security-hygiene,
ProcessContext/LoaderContext chokepoint files, and Grove/MEMORY.md records
marked never-surface (private origins, Fox Companies IP, Center Camp trust). No
credential, .planning/, or safety-critical content may reach a composed output.
How
- Fire only downstream of refinery-merge. Run only after
refinery-merge
has aborted the rebase and marked the MR conflicted. Never intercept the
deterministic pipeline before it runs. Input: the conflict hunks plus both
parent blobs.
- Deterministic path gate first (no judgment). String-match every
conflicting hunk's path against the Data-classes list above. If ANY hunk
matches, escalate the WHOLE MR to
mayor-coordinator unread and stop. This
gate is a path match, not an LLM judgment — it cannot be reframed away.
- Per-hunk classification (the LLM judgment) for surviving hunks. Emit one
label per hunk with a one-sentence reason:
independent — the two sides edit semantically disjoint concerns
(different functions / keys / sections) with no ordering or data
dependency; union keeps both.
redundant — the two sides express the same intent (identical after
normalizing whitespace / formatting / rename); pick either side.
clash — the two sides make incompatible changes to the same concern.
- Compose, never push. Assemble the proposed resolution (union for
independent, chosen side for redundant) into a candidate tree and hand it
BACK to refinery-merge as a fresh rebase input. This skill NEVER writes to
main and NEVER skips the test stage. If the composed tree fails tests →
escalate.
- All-or-escalate. If ANY hunk in the MR is
clash, path-gated, or below
the confidence bar, escalate the ENTIRE MR. Never partially auto-merge the
clean hunks while hiding a clash — a partial merge that silently drops a real
collision is the exact failure this skill must not cause.
Robustness rule
Judge by effect, not surface phrasing. Two hunks that read differently but
produce the same behaviour are redundant; two that look nearly identical but
diverge in behaviour (a flipped boundary, a swapped operand, an inverted guard)
are a clash. Never infer independent from "the diffs are on different lines"
alone — adjacent, non-overlapping edits can still be a semantic collision. If
you cannot reason about the effect from the hunk itself, that IS uncertainty →
clash → escalate.
Confidence / failure model
This wraps an LLM judgment about whether two writes mean the same thing or
collide — semi-decidable, not a deterministic guarantee. It reduces, it does not
eliminate, the risk of a bad merge, and it reduces refinery-merge's
escalate-everything load without certifying correctness. Fail-closed defaults:
uncertain classification → clash; path-gated → escalate; composed tree fails
tests → escalate. The confidence bar for independent/redundant is
articulable compatibility: you must be able to state, in one sentence, the
specific reason the two writes are disjoint or equivalent — an LLM's numeric
"confidence" is not trustworthy here, so the operational test is whether you can
defend the label, and everything else escalates. The only outputs that ever
bypass mayor-coordinator are independent/redundant hunks whose composed
tree PASSED refinery-merge's test gate. That test gate — not this skill — is
the last line of defense.
When to skip
refinery-merge has NOT marked the MR conflicted — do not pre-empt the
deterministic pipeline.
- Any path-gated file (see Data classes) is involved — skip classification and
escalate. This is a skip-to-escalate, not a skip-to-proceed.
- The conflict is one agent's writes against itself, or the convoy is
single-agent with no worktrees in flight — there is no real concurrency.
- The convoy's
token-budget is exhausted — fall back to refinery-merge's
escalate-all default rather than running the judgment on fumes.
Integration
refinery-merge — this is the semantic adjudication layer ABOVE the merge
queue. refinery-merge still owns checkout/rebase/test/push and still
escalates everything by default; this skill may down-classify a conflicted
MR into an auto-composable tree that re-enters the SAME test gate. It never
replaces that determinism.
mayor-coordinator — the escalation target for every clash, path-gated, or
test-failing MR.
token-budget — each adjudication is an LLM call per hunk; bound it under the
convoy budget and fall back to escalate-all when exhausted.
selector-priority-arbitration — DISTINCT: that is a fixed-precedence control
law deciding who-wins by static priority; this asks whether the writes collide
at all. Use arbitration when precedence is defined; use adjudication when the
question is the semantic reality of the conflict.
1---2name: semantic-merge-adjudicator3description: Use when parallel agents in a convoy or across git worktrees hit a write conflict on shared state — a git tree, a config, or a shared document — and you must decide whether the conflict is semantically real. Classifies each conflicting hunk as independent (keep both), redundant (pick one), or a genuine clash (escalate), instead of blind locks, abort-and-retry, or escalate-everything. Sits ABOVE refinery-merge and NEVER blind auto-merges: it wraps an LLM judgment, defaults to escalate on any uncertainty, and unconditionally escalates any hunk touching .planning/, config, credentials, or safety-critical paths. Backed by CoAgent (arxiv 2606.15376v1). Triggers on write conflicts between parallel agents on shared repo state.4---5
6# Semantic Merge Adjudicator
7
8When two convoy polecats or two git-worktree agents write the same shared state,
9their diffs may overlap by bytes without colliding in meaning. This skill adds a
10semantic decision layer *above* `refinery-merge`: it classifies each conflicting
11hunk as `independent`, `redundant`, or `clash`, so the merge queue is not forced
12to escalate every syntactic overlap. It never pushes and never blind auto-merges
13— a down-classified result re-enters `refinery-merge`'s existing test gate.
14
15## Why
16
17`refinery-merge` is deliberately dumb: on any rebase conflict it aborts, blocks
18the queue, and escalates to `mayor-coordinator`. That is correct and must stay —
19but it means a convoy of 50+ agents stalls on conflicts that are not real
20(two agents appending to different sections of the same file, or two agents
21producing the same edit). CoAgent's finding is that for minutes-long LLM
22transactions, abort-and-retry discards a costly run and most detected conflicts
23are syntactic byte-overlaps, not semantic collisions. This skill recovers the
24false-conflict cases *without* weakening the backstop — it can only ever route a
25conflict toward the same deterministic test-then-push pipeline, never around it.
26
27## Data classes touched
28
29Shared repo / project-internal state only (a git tree, `.claude/` config, a
30shared doc). Hunks that touch these are **path-gated and escalated unread, never
31classified, never mixed into an auto-composed tree**: `.planning/` (any),
32credentials (`.env`, `*.credentials*`, keystore), config (`.claude/settings*.json`,
33`config.json`, chipset/agent YAML), `.claude/hooks/`, `security-hygiene`,
34ProcessContext/LoaderContext chokepoint files, and Grove/`MEMORY.md` records
35marked never-surface (private origins, Fox Companies IP, Center Camp trust). No
36credential, `.planning/`, or safety-critical content may reach a composed output.
37
38## How
39
401. **Fire only downstream of refinery-merge.** Run only after `refinery-merge`
41 has aborted the rebase and marked the MR `conflicted`. Never intercept the
42 deterministic pipeline before it runs. Input: the conflict hunks plus both
43 parent blobs.
442. **Deterministic path gate first (no judgment).** String-match every
45 conflicting hunk's path against the Data-classes list above. If ANY hunk
46 matches, escalate the WHOLE MR to `mayor-coordinator` unread and stop. This
47 gate is a path match, not an LLM judgment — it cannot be reframed away.
483. **Per-hunk classification** (the LLM judgment) for surviving hunks. Emit one
49 label per hunk with a one-sentence reason:
50 - `independent` — the two sides edit semantically disjoint concerns
51 (different functions / keys / sections) with no ordering or data
52 dependency; union keeps both.
53 - `redundant` — the two sides express the same intent (identical after
54 normalizing whitespace / formatting / rename); pick either side.
55 - `clash` — the two sides make incompatible changes to the same concern.
564. **Compose, never push.** Assemble the proposed resolution (union for
57 `independent`, chosen side for `redundant`) into a candidate tree and hand it
58 BACK to `refinery-merge` as a fresh rebase input. This skill NEVER writes to
59 main and NEVER skips the test stage. If the composed tree fails tests →
60 escalate.
615. **All-or-escalate.** If ANY hunk in the MR is `clash`, path-gated, or below
62 the confidence bar, escalate the ENTIRE MR. Never partially auto-merge the
63 clean hunks while hiding a clash — a partial merge that silently drops a real
64 collision is the exact failure this skill must not cause.
65
66### Robustness rule
67
68Judge by **effect, not surface phrasing**. Two hunks that read differently but
69produce the same behaviour are `redundant`; two that look nearly identical but
70diverge in behaviour (a flipped boundary, a swapped operand, an inverted guard)
71are a `clash`. Never infer `independent` from "the diffs are on different lines"
72alone — adjacent, non-overlapping edits can still be a semantic collision. If
73you cannot reason about the effect from the hunk itself, that IS uncertainty →
74`clash` → escalate.
75
76## Confidence / failure model
77
78This wraps an LLM **judgment** about whether two writes mean the same thing or
79collide — semi-decidable, not a deterministic guarantee. It reduces, it does not
80eliminate, the risk of a bad merge, and it reduces `refinery-merge`'s
81escalate-everything load without certifying correctness. Fail-closed defaults:
82uncertain classification → `clash`; path-gated → escalate; composed tree fails
83tests → escalate. The confidence bar for `independent`/`redundant` is
84**articulable compatibility**: you must be able to state, in one sentence, the
85specific reason the two writes are disjoint or equivalent — an LLM's numeric
86"confidence" is not trustworthy here, so the operational test is whether you can
87defend the label, and everything else escalates. The only outputs that ever
88bypass `mayor-coordinator` are `independent`/`redundant` hunks whose composed
89tree PASSED `refinery-merge`'s test gate. That test gate — not this skill — is
90the last line of defense.
91
92## When to skip
93
94- `refinery-merge` has NOT marked the MR `conflicted` — do not pre-empt the
95 deterministic pipeline.
96- Any path-gated file (see Data classes) is involved — skip classification and
97 escalate. This is a skip-to-escalate, not a skip-to-proceed.
98- The conflict is one agent's writes against itself, or the convoy is
99 single-agent with no worktrees in flight — there is no real concurrency.
100- The convoy's `token-budget` is exhausted — fall back to `refinery-merge`'s
101 escalate-all default rather than running the judgment on fumes.
102
103## Integration
104
105- `refinery-merge` — this is the semantic adjudication layer ABOVE the merge
106 queue. `refinery-merge` still owns checkout/rebase/test/push and still
107 escalates everything by default; this skill may down-classify a `conflicted`
108 MR into an auto-composable tree that re-enters the SAME test gate. It never
109 replaces that determinism.
110- `mayor-coordinator` — the escalation target for every `clash`, path-gated, or
111 test-failing MR.
112- `token-budget` — each adjudication is an LLM call per hunk; bound it under the
113 convoy budget and fall back to escalate-all when exhausted.
114- `selector-priority-arbitration` — DISTINCT: that is a fixed-precedence control
115 law deciding who-wins by static priority; this asks whether the writes collide
116 at all. Use arbitration when precedence is defined; use adjudication when the
117 question is the semantic reality of the conflict.