resolve-conflicts
The procedure an agent follows when it runs resolve-conflicts. For people, the resolve-conflicts guide explains it.
When git combines two lines of work (a merge, a rebase, a cherry-pick or a revert) and both changed the same lines, it stops and leaves the file with conflict markers around each region it could not combine. Resolving them by reading the markers alone fails in recurring ways: one side’s change is silently dropped (taking one side’s whole file also discards that side’s other edits git had already merged cleanly), “ours” and “theirs” are confused (in a rebase they mean the opposite of a merge), lockfiles are merged line by line instead of being rebuilt, the resolver never learns why each side changed the code, nothing tells a reviewer what was decided, and a genuine product disagreement is settled by an agent without anyone noticing.
This skill gives the resolution a structure and checks it before it is concluded. It belongs to the pull-request lifecycle of Jig module M7 (PR lifecycle & review): a pull request that conflicts with its base cannot merge, and the resolution is part of the change its reviewers see.
The invariant. A conflict resolution keeps the intent of both sides, or records which side’s change it dropped and why. Derived files (lockfiles and generated artifacts) are regenerated from their resolved sources, never merged by hand. Every decision is recorded where reviewers see it: the merge commit message. Only changes attributable to the operation may be staged for its commit. Repository obligations apply to the entire resolved diff, including parts git merged without a conflict. The resolution is validated before it is concluded and pushed. A conflict whose right answer is a product decision goes to a human.
Jig maintains this procedure and ships it in the jig plugin.
A repository adds its own generated files and merge obligations in .config/jig.yaml
(the consumer overlay),
and the skill also reads the generated: entries of its change-area catalog
(drive.change_areas_catalog), so a generator declared there is not stated
twice; without that file the skill works on its defaults.
Paths and working directory
${CLAUDE_SKILL_DIR} in the commands below stands for the absolute path of the
directory containing this SKILL.md. Claude Code fills it in. In any other
harness, replace it with that path yourself before running a command: a shell
would expand the unset variable to an empty string.
Git 2.41 or newer is required: to reconstruct the automatic merge result
without trusting already staged content, and to read every attribute from
the staged .gitattributes files alone (Git’s --attr-source option).
Cherry-picking or reverting a merge commit with -m is unsupported: Git
does not reliably retain the selected parent for reconstruction. The mapper
refuses it before writing a snapshot; resolve and validate that operation
manually. Merges recreated by
a rebase using --rebase-merges are supported through their replayed parents.
Run every command from the root of the repository with the conflicts. Never
cd into the skill directory: the scripts find the repository, its
configuration and the operation in progress from the working directory.
Commands that run the repository’s hooks
A commit, a merge that completes without a conflict and a continued rebase
run the repository’s git hooks, whose length Jig does not know. The command
wrapper (shared/command.ts) kills a command and its hooks at 120 seconds
unless told otherwise, so every such command below passes
--timeout-seconds 3600: an hour lets a slow hook finish and still ends one
that hangs. Give your shell tool’s call a timeout to match. Where the tool’s
own ceiling is shorter, run the command where the wait can outlast it: in a
pass that has no next turn (a drive pass), drive-pr’s
foreground wait;
in an interactive session, the tool’s background mode, or Codex’s own
command session, waited on until the command ends. A command killed at its
deadline exits 124; what that leaves and
how to finish from it is in Step 7.
Arguments
$ARGUMENTS — optional: the base branch to bring the current branch up to
date with (Step 1). Without it, the skill works on the merge, rebase,
cherry-pick or revert that has already stopped.
Terms
Ours and theirs are git’s names for the two sides of a conflict. Their
meaning depends on the operation; conflict-map.ts states the role of each
side so you never have to work it out:
| Operation | ours is | theirs is |
|---|---|---|
| merge | the checked-out branch | the branch being merged in |
| rebase | the upstream being rebased onto, plus this branch’s commits already replayed | this branch’s commit being replayed |
| cherry-pick | the checked-out branch | the commit being picked |
| revert | the checked-out branch | the state before the commit being reverted |
The merge base is the commit both sides started from; a side’s change
is what it did relative to the merge base. The integration side is the
side that carries the base branch or upstream: theirs when you merge the
base branch into a feature branch, ours in a rebase. Derived files start
from this side before they are regenerated.
Scripts
| Script | What it does | Exit codes |
|---|---|---|
bun "${CLAUDE_SKILL_DIR}/scripts/start-merge.ts" --base <base> [--remote <remote>] [--pr <number>] [--json] | Merges <remote>/<base> into the checked-out branch, with the earlier base’s merge base when the pull request’s earlier base was squash- or rebase-merged into <base> (Step 1) | 0 merged and committed; 1 a step failed; 2 usage or not in a git work tree; 3 refused, nothing touched; 9 stopped on conflicts, the merge open |
bun "${CLAUDE_SKILL_DIR}/scripts/conflict-map.ts" [--json] [--integration <side>] | Maps the stopped operation and writes the snapshot. The integration side is ours or theirs; read-only otherwise | 0 mapped; 2 usage, not in a git work tree, or invalid configuration; 3 nothing in progress, or the stored snapshot is unreadable (it is never replaced) |
bun "${CLAUDE_SKILL_DIR}/scripts/migration-plan.ts" | Prints the migration sequence, renames and regeneration inputs as JSON from the current map and committed trees | 0 planned; 1 a sequence needs attention; 2 usage or invalid configuration; 3 nothing in progress or no current map |
bun "${CLAUDE_SKILL_DIR}/scripts/record.ts" "<path>" <decision> [--reason "<reason>"] [--command "<command>"] [--dropped "<reason>"] | Records one path’s decision in the snapshot | 0 recorded; 2 usage (unknown path or decision, missing reason, no known regeneration command, or regenerated for a path that is not a lockfile or generated file); 3 nothing in progress, or no snapshot for this operation |
bun "${CLAUDE_SKILL_DIR}/scripts/check-resolution.ts" [<output-option>] | Verifies the resolution; prints the commit-message section. Output options are --json, --message and --commit-message | 0 passes; 1 problems; 2 usage or invalid configuration; 3 nothing in progress, or no snapshot for this operation; 4 needs a human (wins over 1) |
bun "${CLAUDE_SKILL_DIR}/scripts/events.ts" [--json] | Records the conflicts of the operation just concluded in the live record | 0 recorded, already recorded, or nothing to record; 1 the record could not be written (the conclusion stands); 2 usage or not in a git work tree; 3 the operation is still in progress |
Step 1: Start or find the operation
If an operation has already stopped on conflicts, go to Step 2.
Before merging, only where the repository has opted in. Fetch the base
and let the changelog skill say whether the branch edited the changelog’s
Unreleased or release sections or a version file. It reads the repository’s
configuration as the base holds it, so a branch forked before the repository
adopted the skill is covered too (<remote> here and below is the
repository’s git remote: repository.remote, else origin):
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git fetch <remote> <base>
bun "${CLAUDE_SKILL_DIR}/../changelog/scripts/convert.ts" --base <remote>/<base> --dry-runWhen it prints not configured (the base did not turn the skill on) or
reports nothing to convert, go straight to the merge. When it reports a note,
a file to put back or a placeholder, convert for real and commit the result
before merging, so those files cannot conflict and no resolution made to
another file is thrown away:
bun "${CLAUDE_SKILL_DIR}/../changelog/scripts/convert.ts" --base <remote>/<base>
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git add -A
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git commit -m "chore(changelog): move the branch's changelog edits into a change note"convert.ts refuses on uncommitted changes, so commit or set aside anything
else first, and prints attention: lines for entries it could not move
cleanly: fix those before committing.
To bring a branch up to date with its base (the conflict-resolve round of
/jig:drive-pr is this case), fetch the base and
merge it in with start-merge.ts, which writes conflicts with a base
section in the markers:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git fetch <remote> <base>
bun "${CLAUDE_SKILL_DIR}/scripts/start-merge.ts" --base <base> --remote <remote>It reads the pull request from $DRIVE_PR_TARGET, else the checked-out
branch’s; --pr <number> names another. When that pull request was stacked on another branch that has since
landed on <base> by squash or rebase, the forge records the move onto
<base>, and the script takes the point where this branch left the earlier
branch as the merge base: the earlier branch’s changes, on both sides under
different commits, then cannot conflict, and only this branch’s own changes
can. The prepared merge message names the earlier branch and the pull
request that landed it, and records the base as a Merge-base: line, which
Step 2’s map reads and the merge commit keeps. In every other case it runs
git’s own merge, and says why the earlier base did not apply.
It exits 0 merged and committed (nothing to resolve: go on to validate and
push), 9 stopped on conflicts with the merge open (go on to Step 2), 3
refused before touching anything (an operation already open, staged
changes, or local changes the merge would overwrite: finish or set those
aside first), 1 a step failed (its message names which; a merge left open
after a refused commit is concluded with a commit, or ended with an abort
of the merge). --json prints the report on stdout.
Never rebase or force-push a branch that has an open pull request under a drive: the drive syncs by merging, and rewriting the branch’s history invalidates the review state it tracks.
Step 2: Map the conflicts
Before you change any conflicted file:
bun "${CLAUDE_SKILL_DIR}/scripts/conflict-map.ts"It prints which operation stopped, each side’s commit and role, the integration side and the merge base, and for every conflicted path:
- its kind:
both-modified,both-added,deleted-by-ours,deleted-by-theirs,added-by-ours,added-by-theirsorboth-deleted; - its class:
lockfile(by file name),generated(by the repository’s configuration or its change-area catalog),migration(a sequenced SQL file),binaryortext, with the regeneration command for the derived classes; - its conflict regions (line ranges);
- the intent of each side: the commits that changed the path since the
merge base (at most 20 per side), and, for a path one side deleted, where
that side moved it (
renamedTo).
Read the warning line first when there is one: in a rebase, ours is the
upstream. If the merge guessed the integration side wrong (two feature
branches, say), run it again with --integration ours or --integration theirs.
Inspect the output of bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git diff --cached before resolving. Every staged path must belong
to this operation, and every staged hunk outside your recorded decisions
must match what git merged automatically. Keep unrelated staged work out of
the operation without discarding it; do not conclude while it is present.
Then read the intent behind every path: the commit messages it lists, and for
a commit whose subject names a pull request, the pull request itself
(bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- gh pr view <number>). You are looking for why each side changed the code,
which decides the resolution.
Markers without a base section hide what each side changed. While a path is still unmerged and before you edit it, re-create its markers with one:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git checkout --conflict=zdiff3 -- <path>--json prints the full map, including each region’s ours, base and theirs
text.
Step 3: Resolve each path
Decide from the intents, never from which side “looks newer”.
Before resolving individual paths, capture the migration plan. It finds
sequenced SQL and metadata that Git merged cleanly as well as conflicted
paths. Use an absolute scratch file outside the worktree for <plan-file>:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdout-file "<plan-file>" --stdout-exit-code 1 -- bun "${CLAUDE_SKILL_DIR}/scripts/migration-plan.ts"- Sequenced database migration. Apply each migration plan
before resolving that sequence’s SQL, journal or snapshots individually.
The
movesandregeneratelists name the work, including cleanly merged paths that need to move or be rebuilt. - Lockfile or generated file. Take the integration side
with
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git checkout <side-option> -- "<path>", substituting--oursor--theirsfor<side-option>as the map requires. Resolve the sources it is built from first, then run the regeneration command the map printed (in the directory it names) and stage the result. Never edit a derived file by hand. - Deleted on one side, changed on the other. Find where the code went:
renamedTo, or a search for the changed symbol. Carry the change there, or record why it no longer applies, then remove the old path withbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git rm -- "<path>"(decisiondeleted) or keep it (decisionours,theirsorcombined). - Text. Combine both changes where both intents still hold (
combined). Keep one side only when the other change is superseded by it or already contained in it (oursortheirs). Write new code when neither side works verbatim but both intents must be served (rewritten). - Binary. Pick a side with a reason, or escalate.
- A product decision. When the two sides want incompatible behaviour and
the code cannot tell you which is right, do not choose: record
escalatewith the question (Step 8).
Then look beyond the markers. A clean textual merge can still break a caller on the other side: search for uses of anything either side renamed, removed or changed the signature of, and fix them as part of the resolution.
Stage every resolved path with bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git add -- "<path>",
or record its removal with bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git rm -- "<path>".
Apply a migration plan
A migration runs in the order its filename’s leading number names. A different migration on the same number must run after the integration side’s migrations. When a branch addition would run within the integration history, the plan keeps that history and assigns the pending branch migrations the next numbers in their original order.
For a plan with moves, read each move’s committed from from its recorded
commit, so a shared filename or a chain of renames cannot overwrite a
source. Restore the files in integration.paths from integration.commit,
remove the obsolete paths listed in remove, and write the committed
migration bytes and executable bit at each move’s to. Stage those paths.
If the plan reports a problem, resolve its cause before proceeding. A
detected migration directory without a suitable regeneration command needs a
repository command configured in resolve_conflicts.sequenced_migrations
before renumbering.
Once the sources are ready, if regenerate lists paths and the sequence
supplies a command, run it from the repository root. Its input is the
saved JSON plan. Each entry is keyed by
directory, and regenerate names the files to rebuild. Use the command
for the host and pass the configured shell command unchanged as one
argument to that shell.
On Unix:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdin-file "<plan-file>" -- sh -c "<command>"On Windows:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdin-file "<plan-file>" -- cmd.exe /d /s /c "<command>"For a sequence with no moves, start a conflicted metadata path from the
integration version listed in integration.paths. If there is no
sequence command, the plan’s fallback lists the existing per-path
generators from the configuration or change-area catalog. Run those
commands in their listed directories under the generated-file rule.
For a path with no declared command, find the repository generator
that rebuilds it and record regenerated with --command. If no
generator can rebuild a required path, report the missing
capability and go to Step 8. Record escalate on an affected mapped
path when one exists.
Preserve the integration side’s existing snapshots when renumbering.
Preserve the committed integration journal as the prefix, its entries in
their committed order even where that is not sequence order. Append the
migrations the integration side does not commit, in sequence order; with a legacy Drizzle journal, give
them strictly increasing timestamps greater than every integration entry’s.
Stage the rebuilt files and record regenerated for each one that
conflicted. Never combine a journal or snapshot by hand.
Record any old migration path kept at the integration content with the
corresponding side and say where the branch’s migration moved. Record
an old path removed by renumbering as deleted, with the new path as
the reason. The check verifies the exact committed migration at each planned
destination and accepts verified new paths as part of the operation.
Step 4: Record each decision
bun "${CLAUDE_SKILL_DIR}/scripts/record.ts" src/a.ts combined --reason "kept the retry limit from main and this branch's new timeout option"
bun "${CLAUDE_SKILL_DIR}/scripts/record.ts" src/b.ts theirs --reason "main already renamed the helper this branch edited; the edit moved to src/c.ts"
bun "${CLAUDE_SKILL_DIR}/scripts/record.ts" bun.lock regenerated| Decision | Meaning | Reason |
|---|---|---|
combined | both sides’ changes are kept (the default expectation) | optional |
ours / theirs | the other side’s change is dropped, because this side supersedes or already contains it | required |
rewritten | neither side verbatim: new code serving both intents | required |
regenerated | a derived file (lockfile or generated file) rebuilt by its command; --command defaults to the mapped one. Refused for any other path | optional |
deleted | the path is removed; say where a carried-over change went | required |
escalate | needs a human; the reason is the question to put to them | required |
Write each reason for the reviewer, in one or two sentences. A path that
merged cleanly can also need a manual edit: record.ts accepts it when it
belongs to the operation and recovers its inputs from the committed sides.
It refuses unrelated paths and conflicted paths whose original snapshot
was lost.
references/decisions.md has a worked example of
each decision.
The record lives in the Git-path snapshot jig/conflicts.json, which is never committed. Its shape:
{
"version": 1,
"operation": { "kind": "merge", "head": "<sha>", "incoming": "<sha>", "base": "<sha>" },
"sides": {
"ours": { "commit": "<sha>", "ref": "feature", "subject": "…", "role": "the checked-out branch (feature)" },
"theirs": { "commit": "<sha>", "ref": "main", "subject": "…", "role": "the branch being merged in (main)" },
"integration": "theirs",
"integrationWhy": "main is the default branch"
},
"warning": null,
"catalogIncomplete": null,
"mappedAt": "2026-01-01T00:00:00.000Z",
"paths": {
"src/a.ts": {
"kind": "both-modified",
"class": "text",
"markerSize": 7,
"regenerate": null,
"stages": {
"base": { "mode": "100644", "blob": "<sha>" },
"ours": { "mode": "100644", "blob": "<sha>" },
"theirs": { "mode": "100644", "blob": "<sha>" }
},
"hunks": [{ "start": 2, "end": 9, "oursLabel": "HEAD", "baseLabel": "…", "theirsLabel": "main", "ours": "…", "base": "…", "theirs": "…" }],
"intent": {
"ours": { "commits": [{ "sha": "<sha>", "subject": "…", "pr": null }], "truncated": false, "renamedTo": null },
"theirs": { "commits": [{ "sha": "<sha>", "subject": "… (#15)", "pr": 15 }], "truncated": false, "renamedTo": null }
},
"resolution": {
"decision": "combined",
"reason": "…",
"command": null,
"dropped": null
}
}
}
}resolution is the part you fill in; record.ts writes it, and you may
edit it by hand to the same shape. regenerate is
{ "command", "cwd", "source": "built-in" | "configuration" | "catalog" } for
a derived file, and null for a generated path whose catalog entry declares
no command (then record.ts needs --command). catalogIncomplete says why
the generated files the configuration and the change-area catalog declare
could not all be read when the map was written (the configuration was
unmerged, the catalog could not be read, or an entry’s outputs are
malformed), and keeps the check refusing until a map that reads them all
clears it. dropped is { "why": "…", "lines": [{ "side": "theirs", "text": "…" }] }.
The snapshot belongs to one operation (its kind, HEAD, and the incoming
commit). Running conflict-map.ts again for the same operation classifies
every mapped path afresh (a staged one from its stored conflict stages), maps
paths that are newly unmerged, and keeps each recorded decision while the
path’s class and regeneration command are the ones it was recorded under. A
decision recorded under another class or command is cleared, the output names
the path, and you record it again. A snapshot of a different operation is
replaced, and the output says so. Each stop of a
rebase is a different operation. An unreadable snapshot is never replaced
(exit 3): once a path is staged, git no longer knows its conflict stages, and
only the snapshot does. Restore it, or, if nothing has been staged since it
was written, move it aside and map again.
Step 5: Check the resolution
bun "${CLAUDE_SKILL_DIR}/scripts/check-resolution.ts"It fails (exit 1), listing each problem with its file and line, when:
- a path is still unmerged;
- conflict markers remain in a mapped path, or in any other staged change;
- a mapped path has no decision, an unknown one, or lacks a required reason;
- what is staged for a mapped path differs from the working tree. The
configuration, the change-area catalog (read through the symbolic links the
index holds; a link whose target leaves the repository is refused, never
read from disk) and the
.gitattributesfiles are read from the index, as the commit carries them: a change to one of them takes effect once it is staged, and a working-tree change that is not staged, an untracked file, an ignored one, a staged link named.gitattributes,$GIT_DIR/info/attributes, the filecore.attributesFilenames or the system’s attributes file decides nothing. Git’s automatic result is reconstructed under no configuration but the repository’s rename-detection settings (merge.renames,merge.directoryRenames,merge.renameLimit,diff.renames,diff.renameLimit), its renormalization (merge.renormalize,core.autocrlf) andcore.useReplaceRefs, so a merge driver configured for the repository, the user, the system or the environment does not run. Everything else in the repository’s git directory is read as it stands: its references (replace refs among them),HEAD, the index,shallow,info/graftsand themodulesdirectory, in a linked worktree too, so a submodule git fast-forwarded is not reported as a conflict, whether or not.gitmodulesis in the working tree. Conflict markers are looked for at the size git wrote them with as well, and in other staged changes on every added line, whatever an attribute says the file is; - a lockfile or generated file is not recorded as
regenerated, or any other path is; - a staged path is outside the operation’s changed-file set, or its staged content does not match git’s automatic result and has no recorded decision;
- a change is dropped. For every text path it takes the lines each side
added relative to the merge base, across the whole file, and looks for each
in the staged result (trimmed, exact match; blank and punctuation-only
lines are ignored). A missing line is allowed only when the decision says
so: the other side’s lines under
oursortheirs; anything underrewrittenordeleted(reported, not failed; a deleted path reports every line either side added); and undercombined, only lines acknowledged withbun "${CLAUDE_SKILL_DIR}/scripts/record.ts" "<path>" combined --dropped "<why>", which records the lines missing at that moment. An acknowledgement edited by hand counts only with a nonemptywhy. A side’s own lines under its own decision always fail.
The check also verifies every sequenced migration added on either side. The staged SQL and file mode must match the committed input at the required path, even when a decision acknowledges deletion or rewriting. It checks that the journal keeps the integration journal’s entries as committed and then lists every staged migration the integration side does not commit once in order, that the required snapshots are present, and that renumbering preserves the integration side’s snapshots.
Fix what it reports and run it again. Exit 4 means a path is recorded as
escalate: go to Step 8. Exit 3 means the snapshot is missing or belongs to
another operation: run bun "${CLAUDE_SKILL_DIR}/scripts/conflict-map.ts",
then record again.
Step 6: Validate
Read every resolve_conflicts.obligations entry reported by
check-resolution.ts. Check its check text against the whole staged
diff (bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git diff --cached), including conflict-free files and hunks git
merged automatically. Record the evidence and outcome for each obligation
in the resolution report. An optional command supplements this review; a
passing command does not establish that its prose obligation is satisfied.
Fix violations, stage and record any manual changes, and repeat Step 5.
For a base merge inside a drive, refresh the worktree’s dependencies before running the validation plan. The command compares the staged resolution with the pre-merge branch, so it also sees dependency inputs Git merged cleanly.
bun "${CLAUDE_SKILL_DIR}/../drive-pr/scripts/dependency-install.ts"Keep the JSON outcome for the resolution and round reports. Record each attempted install’s directory, command and outcome. If it fails, stop before validation or committing and name the dependency install failure and its diagnostic in the round report. Report a detection or configuration error as such if the install never started. If a repair changes staged dependency inputs, run the install check again before validation.
Never conclude a merge that does not build. Run the repository’s checks over the resolved tree:
- inside a drive, the round’s validation plan from drive-pr
(
bun "${CLAUDE_SKILL_DIR}/../drive-pr/scripts/round-plan.ts"), which covers the uncommitted tree: an open merge whose conflicts are all resolved is planned against the merge base its commit will have; - otherwise the repository’s gate command,
gates.command(bun "${CLAUDE_SKILL_DIR}/../fix-ci/scripts/consumer-config.ts"prints it), or the checks its instruction file names.
If a check fails because of the resolution, fix it, stage it, and run Step 5 again.
Step 7: Conclude
For a merge, a cherry-pick or a revert, commit with git’s prepared message
plus the recorded section. --commit-message runs the check again and prints
nothing unless it passes:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdout-file conflict-message.txt -- bun "${CLAUDE_SKILL_DIR}/scripts/check-resolution.ts" --commit-message
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git commit -F conflict-message.txt
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git clean -f -- conflict-message.txt
bun "${CLAUDE_SKILL_DIR}/scripts/events.ts"When Step 6 ran a dependency install, append its directory and command to
the prepared commit message after --commit-message succeeds and before
committing, so the resolution record carries the same evidence as the round.
Run these commands in order, starting the next only after the preceding
command exits 0; a commit that exits 124 is finished as
A command killed at its deadline says.
Before the first, confirm that no conflict-message.txt
exists in the worktree: if one does, it is not this run’s, so stop and report
it rather than overwrite it and then clean it away. The message file is written only on success and removed
once the commit has used it, so the worktree is left clean; record the
events only after the commit succeeds. If event recording fails, the committed
resolution stands: report the failure and retry recording. The section reads:
Conflicts resolved:
- src/a.ts: combined [cause: overlap] — kept the retry limit from main and this branch's new timeout option.
- src/b.ts: theirs [cause: adjacent] — main already renamed the helper this branch edited; the edit moved to src/c.ts.
- bun.lock: regenerated [cause: derived] (bun install)The cause is why the path conflicted, from the same rules as the history report (the path’s most telling cause when its regions have several). A path whose cause cannot be told is written without one.
For a rebase, save each stop’s section to a file of its own, numbered from
1 in stop order, so a later stop cannot replace an earlier one’s:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdout-file conflict-section-1.txt -- bun "${CLAUDE_SKILL_DIR}/scripts/check-resolution.ts" --message
for the first stop, conflict-section-2.txt for the second, and so on.
Before writing each one, confirm that no file of that name exists yet: if one
does, it is not this run’s, so stop and report it rather than overwrite it and
later clean it away.
After that command succeeds, run bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 --env GIT_EDITOR true -- git rebase --continue,
which keeps the replayed commit’s own message without opening an editor the
wrapper gives no terminal. Every
further stop is a new operation: map, resolve, record and check it again.
When the rebase is done, post every saved section on the pull request, in
stop order, or report them to the user when there is none, then remove each
file with
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git clean -f -- conflict-section-1.txt
and its numbered siblings.
The concluding sequence above records merges, cherry-picks and reverts. For a rebase, run the recorder once its last stop has been continued:
bun "${CLAUDE_SKILL_DIR}/scripts/events.ts"It appends one event per conflicted path to the live record. Run it again and it adds nothing; run it before the operation has concluded and it exits 3. A failure to write the record (exit 1) leaves the conclusion standing: say so in your report. Mapping the next stop of a rebase records the earlier stop first, so a rebase that stops several times leaves its events even when only the last one is recorded by hand.
Before any push of the concluded operation, put the issue key in its
commits where the repository sets pull_requests.commit_prefix; it does
nothing where it does not:
bun "${CLAUDE_SKILL_DIR}/../drive-pr/scripts/commit-prefix.ts" [--branch <head branch>]It rewords each unpushed commit that lacks the prefix, the merge commit and
replayed commits included, keeping trees, parents and authors; pass
--branch with the pull request’s head branch on a detached tree. Exit 4
names a commit already pushed without it: report it, since rewriting it needs
a force-push a person decides on. Run it after the events are recorded: a
recorded conflict stays identified by its operation when its commit is
reworded.
Inside a drive, carry on with the drive’s own steps (validation and push) after concluding.
A command killed at its deadline
A hook-running command that
exits 124 was killed at its deadline, its hooks with it. Read
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git status first: a
hook killed midway can leave a change of its own (a formatter’s edit, a stash
it never restored), and that change is settled before anything is run again.
Then finish from where the command stopped, by the state git shows, running
a command again with a longer deadline, --timeout-seconds 7200, in place of
the hour. Never commit outside this procedure or skip the hooks
(--no-verify) to get past it. Inside a drive pass, whose own deadline the
longer one would outrun, still take every step below that runs no hook (the
clean-up after a commit that landed), but run no
hook-running command again: stop there as for a hung hook, below. A reset
runs the hook for an index change, so it carries the hour’s deadline and,
killed there, is a hung hook too.
- The concluding commit of a merge, a cherry-pick or a revert. Look at
the commit first, never at the operation’s marker: git moves the branch
before its last hook and removes
MERGE_HEAD,CHERRY_PICK_HEADorREVERT_HEADafter it, so a marker can outlive a commit that landed. Whenbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git log -1shows the concluding commit with the recorded section, it landed and only a later hook was killed. First look for a pending autostash (bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git rev-parse --git-path MERGE_AUTOSTASHnames the file): when it exists, stop and report it as for a hung hook, because a quit would save it to the stash list instead of restoring the changes. Otherwise clear a leftover marker with the operation’s quit (bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git merge --quit, or the same withcherry-pickorrevert; a quit deletes refs, which runs the reference-transaction hook, so it is a hook-running command), then rungit cleanandevents.tsas above. Otherwise the commit was not made. The staged resolution, the snapshot andconflict-message.txtare intact, and the message file is this run’s, so start again at the commit, not at the command that wrote the file: commit with the longer deadline, then rungit cleanandevents.ts. - The changelog conversion commit (Step 1). When
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git log -1shows the conversion commit, it landed and only a later hook was killed: go on to the merge. Otherwise the converted files are still staged: commit them with the longer deadline, then merge. - The merge (Step 1). A merge can run a hook even when it stops on
conflicts (a cached resolution written to the index runs the hook for an
index change), so where it was killed decides the state.
Read the ancestry first, because git moves the branch before its last hook
and removes
MERGE_HEADafter it:- The base already in the branch
(
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git merge-base --is-ancestor <remote>/<base> HEADexits0): the merge landed and only a later hook was killed, withMERGE_HEADpossibly still in place. Commit nothing, which would add a second, empty commit. Look for a pending autostash first (merge.autoStash; theMERGE_AUTOSTASHcheck above): when it exists, stop and report it, since a quit would save it to the stash list and the working changes would stay absent. Otherwise clear the leftover state withbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git merge --quit(a quit deletes refs and can run the reference-transaction hook, so in a drive pass it is a hook-running command: stop there as for a hung hook instead of running it). Nothing else is left to do. - Otherwise, with
MERGE_HEADin place and no unmerged path (killed while the commit message was prepared or checked): conclude it withbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 7200 -- git commit --no-edit, which keeps git’s prepared merge message. - Otherwise, with
MERGE_HEADin place and unmerged paths still listed (the merge stopped on conflicts, and a hook was killed after a cached resolution covered some of them): the merge is under way. Reset nothing; map and resolve the remaining conflicts from Step 2. - Otherwise the index holds the base’s changes, staged, with no
MERGE_HEAD(killed in the hook that runs before a merge commit, or after the index write of a merge, before git recorded it). Committing would make a single-parent commit that hides the merge, so return the index and the working tree to the branch’s commit withbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git reset --mergeand run the merge again with the longer deadline; the conflicts, if there are any, show again and are resolved from Step 2.
- The base already in the branch
(
- The continued rebase. When the rebase still stands at the same stop
with its resolution staged, continue it with the longer deadline. When it
has moved on, take what it shows as you would after a continue that
exited
0: a further stop, or the rebase done. When it is still in progress with commands remaining and no conflicted path (killed in a hook while it made a pick’s commit or after), continue it with the longer deadline. When the last pick committed and no commands remain but the head is still detached (killed before the branch was attached again), continue it with the longer deadline: that finishes the rebase. Whengit statusstill reports a rebase in progress but with no commands remaining and the branch checked out again, the rebase finished and only its last hook was killed; a further continue fails on the moved branch. The rebase’s own closing steps (restoring an autostash, moving the branches an--update-refsrebase carries) run after that hook, and clearing the state discards the queue of them: when the rebase’s state directory still holds anautostashorupdate-refsfile (bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git rev-parse --git-path rebase-mergenames it), stop and report it, as for a hung hook. Otherwise clear the leftover state withbun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git rebase --quitand go on as after a rebase done.
A command killed at the longer deadline too is treated as a hung hook: stop
with the operation open (or the merge reset, or the conversion still
staged), the message and section files
and the snapshot in place, and report the command, its deadline and what
git status shows.
Inside a drive, the round ends there and its report says so.
Step 8: Escalation
A path recorded as escalate makes check-resolution.ts exit 4 and print
each question.
-
Interactive session: put each question to the user with the options you see (keep ours, keep theirs, a combination you describe), then record their answer as the decision and continue from Step 5.
-
Unattended (a drive’s repair round): abort with
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --timeout-seconds 3600 -- git <operation> --abort, substituting the stopped operation (merge,rebase,cherry-pickorrevert). Then verify the tree is clean:bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git status --porcelain --untracked-files=normal --ignore-submodules=nonemust exit 0 and print nothing. For a merge,bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" -- git rev-parse -q --verify MERGE_HEADmust exit nonzero. Report the questions, any abort failure and any paths still present on stderr. Under a drive, write the round report to.context/scratch/round-report.json, with the reason the operation could not conclude, then record it before returning a nonzero exit:bash bun "${CLAUDE_SKILL_DIR}/../drive-pr/scripts/round-report.ts" .context/scratch/round-report.jsonThe driver checks for files the round created even if the pass already aborted its merge.
The live record
events.ts keeps the live conflict record, what the replay cannot see: the rebases, cherry-picks and
reverts, and the resolutions themselves. It appends one JSON line per
conflicted path to jig/conflict-events.jsonl under Git’s common directory,
which every worktree of the clone shares and nothing commits. The file holds
this clone’s events only: an operation resolved in another clone, or in a
workspace since discarded, leaves none here.
An operation counts as concluded when a commit on HEAD’s first-parent line
sits directly on the commit the operation stopped at and is what the
operation makes: a merge commit with the merged commit as its second parent,
the picked or replayed commit with its author and date (the merge a
--rebase-merges rebase recreates, with the rebased side as its second
parent), the revert with its This reverts commit line. A fixup! or
squash! commit that conflicted is folded into the commit before it, so its
conclusion stands beside the stopped commit instead of above it, and counts
too, also when the rebase replayed further commits after it. An aborted operation leaves its snapshot behind, and the next ordinary
commit is not taken for its conclusion. One conflict is one record,
identified by that commit and the path, or by the operation (its kind, its two
sides and the commit it applied) and the path, so a commit amended afterwards, or a rebase stop run
again after an abort, counts once. A path the operation merged cleanly, mapped
only because record.ts recorded a decision for an adjustment to it, has no
event and no cause in the Conflicts resolved: section.
When conflict-map.ts replaces the snapshot of an operation whose events
cannot be written, it keeps that snapshot as pending in
the worktree’s Git directory under jig/pending/, with the commit the operation
concluded with, so the next events.ts records it from any checkout. It
removes a pending snapshot only once its events are recorded, and exits 1
while one still cannot be recorded. A pending snapshot without its commit
stays until that commit is found above HEAD.
Each line is an event of type merge_conflict:
| Field | Meaning |
|---|---|
type, ts | merge_conflict; when the operation concluded (the committer date) |
operation | merge, rebase, cherry-pick or revert |
path | the conflicted path |
cause, causes, regions | the cause that stands for the path (overlap or structural when it has one, else the cause of most regions), all its causes, and how many conflicting regions it had; null, empty and null when the cause could not be derived |
decision, reason | what record.ts stored for the path |
resolution_ms | from the last conflict-map.ts run to the conclusion |
source | drive-pr when $DRIVE_PR_ROUND_TASK was conflict-resolve (a drive’s conflict-resolve round) when conflict-map.ts first mapped the operation, else session |
pr | the pull request being driven ($DRIVE_PR_TARGET) when source is drive-pr, else null |
commit, branch | the concluding commit, and the branch the operation ran on |
ours_commit, ours_ref, theirs_commit, theirs_ref | the two sides as git names them for the operation (in a rebase, ours is the upstream) |
incoming_commit | the commit the operation applied: the one merged, picked, replayed or reverted (a revert’s theirs_commit is its parent) |
The regions are found again from the path’s three versions with
git merge-file and the histogram diff git merge uses (Git before 2.44
cannot choose the diff, so there the default diff is used and region
boundaries can differ), not read from the snapshot’s hunks, and run through
the replay’s cause rules. A repository’s
merge drivers and renormalization do not apply to that second merge, so a
cause is derived from the three versions, not read from git’s own run.
What this skill never does
- Force-push, or rebase a branch with an open pull request under a drive.
- Take one side’s whole text file with
git checkoutusing--oursor--theirswithout recording that decision and its reason. - Edit a lockfile or generated file by hand.
- Conclude with conflict markers left, or before
check-resolution.tspasses. - Resolve an
escalateon its own.
Configuration
One optional section in .config/jig.yaml:
resolve_conflicts:
obligations:
- check: "All changed callers still use the shared validation helper."
command: bun run check:validation
generated:
- paths: ["docs/index.md", "src/generated/**"]
command: bun run generate
sequenced_migrations:
- directory: db/migrations
journal: db/migrations/journal.json
snapshots: ["db/migrations/meta/{sequence}.json"]
command: bun run rebuild:migrationssequenced_migrations declares directory-specific migration sequences and
the commands that rebuild their metadata. A tracked legacy Drizzle
meta/_journal.json supplies the directory, journal and snapshot template
when no entry declares that directory. The
configuration reference defines
the supported paths and journal formats.
obligations defaults to an empty list. Each entry has nonempty check
text and an optional nonempty command, run from the repository root with
a deadline. The checker reports every obligation; a failed command blocks
conclusion. Each command runs only while every tracked file on disk matches
the staged tree, checked before every command and after the last, with
submodules compared whatever their ignore settings and assume-unchanged or
skip-worktree files compared too, including those inside initialized
submodules. A command that changes the staged tree
or a tracked file stops the commands after it and fails the check, so no
result certifies a tree its command did not see. Text-only entries require the agent’s review in Step 6.
Each generated entry’s paths are globs over repository-relative paths (* and ?
stay within one directory; ** spans any number; {a,b} matches either
alternative; [...] matches one character of a class, [!...] or [^...]
one outside it, and never /), and command rebuilds them, run from the repository
root. Unknown keys, wrong types and a glob that cannot compile (an
unclosed {, a backwards range such as [z-a]) are refused with the field
named (exit 2). hotspot_min_merges (a whole number, 3 by default) is the
history report’s hotspot threshold
(below). JIG_OVERLAY
points the scripts at another configuration file.
The change-area catalog is read too. When drive.change_areas_catalog
names a catalog, every generated[].outputs path of every area (a literal
file path, matched exactly, never a glob) is a generated file, rebuilt by that entry’s command (run from the repository root), the
class generated and the source catalog in the map. The catalog states what
a generator writes once; resolve_conflicts.generated is for the files it does
not declare. A path is classified by the first of these that matches:
- a declared or detected migration sequence;
resolve_conflicts.generated, in the order written;- the catalog’s
generated[].outputs, in the catalog’s order; - the built-in lockfile table below.
An entry in the list above therefore overrides the catalog and the table, and
the catalog overrides the table. The following problems are reported, never
skipped: a catalog entry with no command still claims its outputs as
generated files (never hand-merged) and the map warns that no command is
known, so record.ts needs --command for it; an entry whose outputs are
not a list of literal file paths is named in the warning and its outputs are
classified by the other rules; and a catalog that cannot be read (it may be
among the conflicted paths) is named in the warning while the map goes on
without it. In the last two cases check-resolution.ts refuses until a later
map reads every entry. Resolve or correct the catalog first, then run
conflict-map.ts again: it reclassifies every mapped path, a staged one
included, gives every derived path the command that now applies, and clears
each decision recorded under a class or command that changed, so
check-resolution.ts asks for that path’s decision again. The check itself
classifies every mapped path again from the configuration and catalog as they
stand when it runs: a path whose class or command differs from the map’s (a
declaration added, changed or removed since the map) fails until the map runs
again, and so does a catalog that cannot be read at that point. A drive.change_areas_catalog that is not a path is
refused (exit 2).
Built-in lockfiles, matched by file name in any directory and regenerated in that directory:
| File | Command |
|---|---|
bun.lock, bun.lockb | bun install |
package-lock.json, npm-shrinkwrap.json | npm install --package-lock-only |
pnpm-lock.yaml | pnpm install --lockfile-only |
yarn.lock | yarn install |
Cargo.lock | cargo update --workspace |
go.sum | go mod tidy |
uv.lock | uv lock |
poetry.lock | poetry lock |
Gemfile.lock | bundle lock |
composer.lock | composer update --lock |
Limits
- The dropped-change check compares lines, not meaning. A change that was
kept but reformatted counts as dropped (record
rewritten, or acknowledge it); a removed line that also exists elsewhere in the file is not noticed. The semantic search in Step 3 is still yours to do. - The conflict-marker size is the size of the markers git wrote into the
path when it is first mapped (the
conflict-marker-sizeattribute, default 7, when no complete region is found in the file), and stays that size for the operation; the check also looks for markers of the size the attributes give at check time. Map before editing a conflicted file. - A
git amsession is not mapped.
Where past merges conflicted: the history report
Run it to see where a repository’s merges keep conflicting and why, before deciding what to change; it is not part of resolving a conflict.
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" # the last 30 days
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --days 90
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --since 2026-01-01 --until 2026-03-31
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --all --json
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --propose-serialize # areas to serialize
bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --rates --out <file> # conflict rates per path--propose-serialize prints, instead of the report, each area of the
change-area catalog (drive.change_areas_catalog) that a hotspot lies in
alone and that is not yet serialized, as the serialize: true line to add,
with the hotspots behind it; hotspots no single area holds are listed
apart. It writes nothing: show the lines to the person, who decides.
--rates prints, instead of the report, the range’s conflict rates as
merge-conflict-rates/v1 JSON: for each path, merged, the merged pull
requests that changed it and whose conflicts were observed, conflicted, how
many of those met a conflict before they merged, and unknown, those that
were not observed. The merged pull requests come from the forge, one listing
of the range through its governed transport; --cohort-cache <file> keeps
that listing, so the next run lists only what changed since. A pull request
counts as conflicted when a replayed merge or the live record names it or
lies in its own history, and as clean only when the replay reached its head,
replayed every merge of that history and the forge records no force-push of
its branch. --out <file> writes the rates there whole instead of printing
them. When the listing fails or reaches its bound of 1,000 pull requests, it
writes nothing, keeps a file already at --out, says why, and exits 3. The
dispatcher refreshes these rates itself once a day; run it by hand to see
which files conflict most often per pull request.
A bare date (YYYY-MM-DD) is a day in UTC: --since starts at its
midnight, and --until ends after it. A time carries its offset from UTC
(2026-01-01T09:00:00+02:00, or Z for UTC itself), so no range depends on
the machine’s time zone.
It replays every merge commit the repository’s refs reach in the range
(fetched pull-request heads such as refs/pull/*/head included; the stash
and a forge’s synthetic refs/pull/*/merge commits, under refs/remotes/
too, left out): it merges the
merge’s two parents again with git merge-tree using --write-tree, which needs no
working tree, in diff3 style so every conflicting region carries its
merge base. Git’s
new objects go to a temporary object directory, removed afterwards, so no
ref, index, working tree or object of the repository changes. Today’s
attributes do not reach a past merge: the working tree’s and the index’s
.gitattributes are read from the empty tree instead, and the system’s and a
person’s attributes files are not read. The exception is
.git/info/attributes, which git always reads: a built-in driver
(merge=union, merge=binary) set there still applies, and the report reads
regions at the conflict-marker-size set there, as the running git reads the
value. Every configured merge driver is replaced by false and
renormalization (merge.renormalize) is off, so no merge driver or filter
command of the repository’s runs, whichever file names it. It reads git only and never
fetches: it needs git 2.43 or later, and
refuses a partial clone below git 2.45, which cannot be kept from fetching
the objects it lacks. A merge with more than two parents is skipped; in a
shallow clone, so is a merge whose history the clone cuts (its merge base
hidden), and the report says its results are partial. A merge git cannot
replay (an object missing) is skipped too. Every skipped merge is listed
with its reason.
Each conflicting region gets one cause, the first of these that matches; a
path git reports as conflicting without text regions, including one it names
only in a message (a directory rename’s file location), gets structural for
the whole path, with git’s own kind of conflict (modify/delete, binary,
…); a lockfile or generated file is derived whatever its regions.
| Cause | The region | The change that removes it |
|---|---|---|
derived | the path is a lockfile or a generated file, as conflict-map.ts classes it | regenerate it; keep it out of pull requests if a step after the merge can write it |
structural | git reports the conflict without text regions: modify/delete, rename, binary, file/directory, mode (a text conflict whose regions cannot be read is overlap) | none from the regions; resolving it stays a decision |
echo | the sides are identical, or one side’s edit (adding at least one line) is already in the other, in the same order | keep the side that contains the other; rebuild a branch on its base once the branch it was built on merges |
version | the sides differ only in release versions the changelog skill’s release step writes (changelog.version, each key configured for the file), at the one place that step writes each and can move it on its own, or in a last-updated date | move the version after the merge; take a date from git |
sequence | both sides only add lines, among them an entry with the same next ordinal, one past the base’s highest | identifiers that cannot collide, or one renumbering step |
tally | only numbers differ, and each side’s number moved by the lines that side added to the file, or added above the line it names | derive the number where it is used; key a register by name, not line |
append | the base side is empty: both sides added lines at the same place (not in a file both sides added, which had no base) | one file per entry, or a sorted list with one entry per line; in source code the report asks whether it is the same fix written twice |
packed-list | one line in every side, and each side only adds whole items to a list in it, each placed where an item ends or starts and closing every bracket it opens, changing no item or separator; a quoted literal is one item, read as the line’s language reads it (in prose a code span runs to the next run of as many backticks; in code a backslash escapes inside a string or template literal), and a line with a quote that closes nowhere, or a code line holding a / or a template literal’s ${, is not read (in prose, a closing and or or may move) | one item per line |
adjacent | the lines each side changed touch but do not overlap | split what changes for different reasons onto lines or files of its own |
overlap | none of the above | two pieces of work changed the same thing: plan them apart, or land one first |
A rule matches only on evidence it can settle, so a region it cannot settle
falls to overlap. A merge counts as mechanical when no path is structural
and no region is overlap.
It prints, for the range: how many merges conflicted of how many; the paths,
most often first, each with its causes and the remedy for its most frequent
one (--limit <n> paths, 25 by default, 0 for all); the
conflict hotspots,
the paths that conflicted in at least resolve_conflicts.hotspot_min_merges
merges (3 by default); each cause’s count and remedy; per week, the
conflicted merges by cause; how often each cause was right when a sample of
regions was checked by hand
(references/cause-accuracy.json); and its
limits. It sees only merge commits that still exist: a conflict resolved
during a rebase, a cherry-pick or a revert, or on a branch deleted after a
squash merge, leaves nothing to replay (the live record
keeps those, from the day events.ts runs), and a conflict met again in a
later merge counts again.
--json prints the same as a merge-conflicts/v1 object: range,
shallow, totals, causes, paths, hotspots, weeks (every week of the
range, one without a merge as zeros), confidence, limits, skipped (each
with its reason: octopus, shallow or replay-failed), and merges, one
record per replayed merge (operation: "merge", its commit, both parents
and the pull-request heads each is the tip of, its date, subject, the pull request and the branches the
subject names, and each conflicted path with its kind (null for a path git
names only in a message),
git’s kinds of conflict, class, causes, regions, and the decision and reason
its Conflicts resolved: section recorded).
| Exit | Meaning |
|---|---|
| 0 | the report was printed |
| 1 | a git call failed |
| 2 | usage error, not inside a git repository, invalid configuration, git older than 2.43, or a partial clone with git older than 2.45 |
Hotspots into the learning loop
When the person asks for the hotspots to be acted on, and
reflection is on,
turn each hotspot into a finding of the reflect
skill, its cause as the finding’s class. Write the report to a file outside
the repository’s tracked files (<scratch>), then pass it on:
bun "${CLAUDE_SKILL_DIR}/../../shared/command.ts" --stdout-file <scratch>/merge-conflicts.json -- bun "${CLAUDE_SKILL_DIR}/scripts/history.ts" --json
bun "${CLAUDE_SKILL_DIR}/../reflect/scripts/reflect.ts" hotspots <scratch>/merge-conflicts.jsonEach hotspot becomes one finding in the worktree’s reflection journal: the
path as its target, its most frequent cause as its class, its count,
range and causes in its title and description with what the measurement
could not see (skipped merges, the cause’s hand-checked accuracy, and the
report’s own limits, a shallow clone included, so the finding still says
them once the report file is gone), and the report’s remedy as its suggested_fix. The output lists each hotspot with what happened to it:
noted, updated (the journal held it, and it now has the new count),
unchanged, sending (a cut-off send may have stored it), or stored (the
store already records it, with its status). A stored hotspot gets a new
finding only once its fix is implemented and the report’s range starts
after that decision, so every merge measured came after the fix. With
reflection off it prints {"on": false} and writes nothing. Exit 2 means
the file is not a merge-conflicts/v1 report, or one this version of
history.ts could not have written: a time without its offset, a merge
outside the range, or totals, paths, hotspots or limits other than the ones
its merges give; exit 3, that the store is
unavailable; exit 1, that the store answered with something that is not its
events. On exit 2, 3 or 1 nothing was noted.
Then run /jig:reflect: its plan escalates a cause
that recurs across hotspots to one tracker issue like any other class, and
/jig:review-reflections proposes the
change. Keep each hotspot finding’s class: it is the measured cause.
Related skills
/jig:drive-prruns this skill in itsconflict-resolveround and when itsbase-sync.tsreports a conflict (exit 9). The round’s environment ($DRIVE_PR_ROUND_TASK,$DRIVE_PR_TARGET) is how the live record marks a resolution the drive started./jig:fix-cifor checks that fail after the merge for reasons the resolution did not cause.