git:20260713.d210701 to git:20260724.ba2c70f

11 added, 11 removed. Audit A to A.

---
name: resolve-merge
description: "Resolve an active merge or rebase conflict, including safe renumbering of colliding plans and chronicles."
user-invocable: true
allowed-tools: Glob, Grep, Read, Bash, Edit, Write, AskUserQuestion
---
# Resolve Merge Conflicts
- 1. Guard: run `git rev-parse -q --verify MERGE_HEAD || git rev-parse -q --verify REBASE_HEAD`; if neither resolves (no merge/rebase in progress), stop with "No merge in progress."
- 2. Plan read-only — make no writes until the gate (step 5). Run `git status --short` and classify each conflicted file AUTO or JUDGMENT.
- 3. AUTO = resolution provably safe by a mechanical check; **default everything else to JUDGMENT**. AUTO cases:
+ 1. Verify `MERGE_HEAD` or `REBASE_HEAD`; otherwise stop with `No merge in progress.`
+ 2. Before any write, list conflicts and classify each as AUTO or JUDGMENT.
+ 3. AUTO requires mechanical proof; default to JUDGMENT. AUTO cases:
- Sides byte-identical (`git show :2:<f>` vs `:3:<f>`) or differing only in whitespace/EOL → take either.
- AU → `git add`, but `git rm` if its slug already exists in theirs at another number (duplicate).
- Lock file → checkout one side, regenerate via the package manager.
- `CHANGELOG.md` → merge unique entries, dedupe, keep category order.
- 4. Numbered docs (`docs/plans/NNNN__*`, `docs/chronicles/NNNN__*`): use THEIRS numbering as base, place each OURS-unique file at the next free number on collision, leave no gaps or duplicates; then fix internal refs so each plan's research ref and each chronicle's self-ref match its own number and every cross-ref resolves.
- 5. Present the full plan (every conflicted file, untruncated: file · code · action · AUTO/JUDGMENT) and gate once via `AskUserQuestion`: Approve / Modify / Abort. Abort leaves all files untouched.
- 6. Execute approved AUTO actions silently; report only counts and errors.
- 7. For each JUDGMENT file, show only the OURS hunk, the THEIRS hunk, and your proposed merge (those exact bytes, no outer fence, invent nothing); ask Approve / Edit / Skip. Skip leaves the conflict.
- 8. Any single failure (e.g. lock-file regen) → leave that file conflicted, continue, list it under `Skipped`. Never abort the run for one file.
- 9. Verify: no conflict markers in tracked files, numbering and refs intact if docs changed, plus any known build/lint check.
- 10. Report a compact summary (`N resolved: X AUTO, Y JUDGMENT; Skipped: …`), then hand off to `/commit` — do not commit. If a check fails, report the failure and stop.
+ 4. For numbered plans/chronicles, keep THEIRS numbers. Renumber colliding OURS-only files from the next free number without gaps or duplicates; fix self, research, and cross-references.
+ 5. Show every conflict with file, code, action, and classification. Ask once: Approve / Modify / Abort. Abort writes nothing.
+ 6. Apply approved AUTO actions; report only counts and failures.
+ 7. For each JUDGMENT file, show exact OURS and THEIRS hunks plus the proposed merge. Ask Approve / Edit / Skip; Skip leaves it conflicted.
+ 8. A file failure stays conflicted and goes under `Skipped`; continue with others.
+ 9. Verify no tracked conflict markers, valid numbering and references when relevant, and known build/lint checks.
+ 10. Report `N resolved: X AUTO, Y JUDGMENT; Skipped: …`, then hand off to `/commit` without committing. Stop on failed checks.
- (Codex: replace each `AskUserQuestion` gate with a numbered list + STOP — see `../using-development-skills/references/codex-tools.md`.)
+ On Codex, translate gates with [codex-tools.md](../using-development-skills/references/codex-tools.md).