Invoked helper skill for fixing the review findings a human has already chosen (from a /pre-merge review, or teammate review threads marked fix in /respond-to-review), with a fresh sub-agent writing each fix and a second fresh sub-agent trying to break it. Enter from the /pre-merge next-step menu option \"Fix a finding on this branch first\", from /respond-to-review, or by typing /fix-findings <numbers>; never self-trigger without finding numbers the human picked, outside the --rounds mode th...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Fix Findings?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/chrislacey89-fix-findings)
---
name: fix-findings
description: "Invoked helper skill for fixing the review findings a human has already chosen (from a /pre-merge review, or teammate review threads marked fix in /respond-to-review), with a fresh sub-agent writing each fix and a second fresh sub-agent trying to break it. Enter from the /pre-merge next-step menu option \"Fix a finding on this branch first\", from /respond-to-review, or by typing /fix-findings <numbers>; never self-trigger without finding numbers the human picked, outside the --rounds mode they typed (§ Unattended rounds). Not for choosing which findings to act on, not for stamping review currency, and not for merging."
sources:
primary:
- "Engineering a Safer World — Nancy Leveson"
secondary:
- "Best Kept Secrets of Peer Code Review — Jason Cohen"
- "Introduction to Software Testing — Ammann & Offutt"
- "Thinking in Systems — Donella Meadows"
- "The Design of Everyday Things — Don Norman"
---
# Fix Findings
!`PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}" && mkdir -p "$PROJECT_DIR/.claude" && { [ -e "$PROJECT_DIR/.claude/.fix-findings-active" ] || printf 'by=%s\nat=%s\nhead=%s\n' "$CLAUDE_CODE_SESSION_ID" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$(git rev-parse HEAD 2>/dev/null)" > "$PROJECT_DIR/.claude/.fix-findings-active"; } && echo "fix-findings marker at $PROJECT_DIR/.claude/.fix-findings-active — post-review edit lock open for this run; $(tr '\n' ' ' < "$PROJECT_DIR/.claude/.fix-findings-active")"`
**Whose run is this?** The line above prints the fix-run flag's `by=`, `at=` and `head=` lines, and leaves a flag that is already there as it was. `by=` is the session id Claude Code sets as `CLAUDE_CODE_SESSION_ID` for Bash commands ([environment variables](https://code.claude.com/docs/en/env-vars)). When it is not this session's, or is empty, another session may be running this skill on the branch: tell the human who opened it and when, and ask before going on. If they say stop, stop without Step 3's removal, because the flag is that session's.
Take the review findings a human has already chosen, have a **fresh** sub-agent
write each fix, have a **second** fresh sub-agent try to break it, and report
both back. Hand off to a `/pre-merge` re-run, which is the only thing that
re-stamps.
## Why this skill exists
`/pre-merge` delegates the review to a sub-agent that did not write the code,
because the session that wrote it has already demonstrated it cannot see these
particular defects. Then the human picks findings, and the pipeline hands the
*fix* back to that same blind session. The responsive commit is the most
defect-dense code on the branch and the one commit with no independent reader.
Cohen's rule is that an author's job is to *annotate for* a reviewer, not to be
one. This skill applies it one link later: the fix's author must not be its only
reader. Leveson's is that a controller may not treat "sent" as "executed" without
feedback — a fixer's own green test run is exactly that unearned inference, which
is why a second agent attacks the fix rather than the fixer re-checking it.
## Invocation Position
**Invoked helper, model-invocable but human-gated.** It fires when the
human picks **Fix a finding on this branch first** from `/pre-merge` Phase 4's
next-step menu and then names the finding numbers, and `/pre-merge` invokes it
with those numbers; or the human marks teammate review threads **fix** in `/respond-to-review`,
which invokes it with those thread numbers; or the human types
`/fix-findings <numbers>` directly after reading a review. It is model-invocable so the menu choice can actually run it —
the cost is its `description` in every session's context window (`CLAUDE.md`
§ *Invocation mechanics*). What gates it is the input, not the flag: never
invoke it without finding numbers a human named in this session (or the word
`all`, which § Inputs defines). A model that
picks the numbers itself has selected findings, which is the first thing this
skill is not. The one exception is rounds 2 and 3 of § Unattended rounds,
which the human starts by typing `--rounds` with round 1's numbers; that
section states what those rounds may take.
Do **not** enter it to decide what to fix, to review a diff (that is
`/pre-merge`), to merge (that is `/closeout`), or on an AFK run — there is no
human to dispose of findings, so there is no valid input. That holds for
`--rounds` too: only a human who has read the review can type it.
## What this skill is NOT
- **It does not select findings.** The human's numbers are its only input. It
never ranks, filters, batches, defers, or drops a finding, and it never adds
one it noticed on the way. chrislacey89/skills#190 draws that line deliberately: disposition is
the human's. If a finding you were handed looks wrong, the fixer reports it
**refuted** with evidence and stops — it does not decide the finding away.
The one exception is § Unattended rounds: under a rule the human chose by
typing `--rounds` after reading a review, rounds 2 and 3 take the Concerns a
re-review raised that the tree supported, and nothing else.
- **It does not stamp.** `/pre-merge` is the only writer of the
`<!-- reviewed-at: … -->` marker, and this skill's commits deliberately move
the head *past* the stamp. That divergence is the mechanism working, and the
handoff below is what closes it. `scripts/test-review-currency-marker.sh` pins
the single-writer rule.
- **It does not merge**, open PRs, or edit PR bodies.
- **It does not re-fix.** One fixer pass and one breaker pass per finding, then
stop. A surviving mutation is reported to the human, never fed back to the
fixer. If the human wants another round they invoke `/fix-findings` again.
Under § Unattended rounds the next round starts without them, and it takes
only Concerns the re-review raised, never a `survived` verdict.
- **It does not review the branch.** It touches only what the chosen findings
name. The `/pre-merge` re-run is the review.
## Inputs
- **The finding numbers** the human named — typed as `/fix-findings 1 3 4`,
given in answer to `/pre-merge`'s follow-up question after the menu choice, or
typed as a **fix** disposition in `/respond-to-review`. After the findings are
printed, the human may type the word `all` instead, as `/fix-findings all` or
through "Other" in `/pre-merge`'s follow-up. It names every open finding:
exactly the set that follow-up lists as options, and nothing else. This skill
never offers it or proposes a set; the word is the human's.
- **`--rounds`**, optional, typed by the human after the numbers or `all`
(`/fix-findings all --rounds`). It starts § Unattended rounds, which says
where it is available and what rounds 2 and 3 take in place of numbers the
human named.
- **The findings themselves.** In author-mode they are terminal output from the
`/pre-merge` run still in this session. If that session is gone, read the
`## Review Disposition Ledger` loop-mode wrote for exactly this case, where
[references/state-backend.md](references/state-backend.md) § Where the
review's records live says it is. For teammate review threads they are the
items `/respond-to-review` hands over: each thread's comments verbatim, its
URL, and the evidence row beside it, from that run in this session or from
its record in the sidecar. If none of these is available, stop and say so — do not reconstruct a
finding from memory and fix your reconstruction. A thread paraphrased into a
finding is a reconstruction.
- **A branch with a review behind it** — a `/pre-merge` review, or a
teammate's review on its open PR. Working tree clean.
- **The slice's work item id** (`W-<n>`), on the sidecar backend: the one
`/pre-merge` Phase 1 step 2 named, or the one `/respond-to-review` Step 5
hands over for a teammate's threads. § Handoff's round count reads it, so a
branch carrying several slices counts only this slice's rounds, and Step 1
writes it into each fix-run record, so a fix is attributed to its slice and
not to every slice on the branch. On the `github` backend there is none, and
the count covers the branch.
- **The sibling slice's branch, for a stacked PR**: the one `/pre-merge` put
in its `BASE_BRANCH=` placeholders, or the one `/respond-to-review` Step 5
reads from the PR's base branch. Step 1's fixup-target and fold-trial
blocks take it in theirs, so they measure from where the fold rebases.
If a number the human gave does not correspond to a finding, say which numbers
exist and stop. Do not guess at intent, and do not silently fix the neighbors.
## Workflow
### Step 0. Preconditions
- [ ] `git status` is clean — uncommitted work would land inside a fix commit.
- [ ] The findings are in hand, by number, from one of the two sources above.
- [ ] `.claude/.fix-findings-active` exists (the harness line at the top of this
file created it; see § *The two flags* for who reads it).
- [ ] The repo profile is in hand: the block below ran in this controller and
its stdout is kept, for Steps 1 and 2 to paste verbatim. If it exits
nonzero, it printed why on stderr and printed no block; relay that and stop.
- [ ] The project's test command is known and currently green. It is the `test`
line under the profile's `Verify`. If that line is missing or says `none`,
ask the human what to run, do not guess a command, and hand their answer to
each sub-agent with the profile. If the test command is already
red, say so and stop — a fixer cannot tell its own regression from the
pre-existing failure, and a breaker cannot distinguish `killed` from
"already broken."
- [ ] A run id is fixed for this invocation, once, before any fixer starts:
`FIX_FINDINGS_RUN=$(date -u +%Y%m%dT%H%M%SZ)`. Each fix commit is
recorded against it, and that record is how § Handoff counts the rounds
already on the branch, from durable state rather than from anyone's
memory of how many times this skill has run.
- [ ] Where the record goes is known: the second block below prints it. On
`github`, every fixer commit in this run ends with the line
`Fix-Findings-Run: $FIX_FINDINGS_RUN`. On `sidecar`, the commit message
carries no pack text at all ([references/state-backend.md](references/state-backend.md)
§ Commit messages), and the controller records each fix commit in the
sidecar after its fixer reports (Step 1). Anything else is a refusal:
relay it and stop.
```bash
SC="<this skill's directory>/references/sidecar.sh"
bash "$SC" profile
```
```bash
SC="<this skill's directory>/references/sidecar.sh"
case "$(bash "$SC" backend stamp)" in
github) echo "fix runs: trailer lines in each fix commit" ;;
sidecar) echo "fix runs: sidecar.sh fixrun record; no trailer lines in any commit" ;;
*) echo "fix-findings aborted: sidecar.sh backend stamp failed; not guessing where fix runs go" >&2; exit 1 ;;
esac
```
### Step 1. Per finding, spawn a fresh fixer
**Invoking this skill is the request for its sub-agents**; `/pre-merge` Phase 3 states once what "unavailable" means (*Invoking this skill is the request to delegate*). A standing instruction against sub-agents does not make this skill run its fixes in-session.
**Spawn both sub-agents on the cheaper tier — `model: "sonnet"` on the `Agent` call.** What this skill buys is independence, not capability: the defect it exists to close is that the authoring session cannot see its own work, and a fresh Sonnet context removes that as completely as a fresh Opus one. Escalate to the session's own tier only on a signal — a fixer that returns `blocked`, or a finding that turns on a contract spanning several files. Per finding this skill spends two sub-agent runs, so the tier is where its cost actually lives. This is a default, not a rule anything enforces; issue chrislacey89/skills#339 carries the hypothesis and the three signals that would refute it.
**One sub-agent per finding, never one for all of them.** A single fixer holding
every finding carries fix 1's reasoning into fix 2, which re-creates across
findings the correlated blindness this skill exists to remove. Per-finding
fixers are independent of each other as well as of the authoring session.
**What the fixer is handed, and what is withheld, is `/pre-merge` Phase 3's
contract, unchanged.** Read it there (`pre-merge/SKILL.md` § *The context
contract is about provenance, not permission*) rather than from a paraphrase
here; the same three parts apply:
- **Handed over** — the finding's text and any replacement sentence the human
supplied for it, both verbatim, the branch diff, the `bash
"$SC" profile` output from Step 0 verbatim, whose `test` line is this project's
test command, and `/execute`'s `## Review Notes` when one exists, read where
[references/state-backend.md](references/state-backend.md) § Where the
review's records live says it is. Also the backend Step 0's second block
printed and the run id Step 0 fixed, both verbatim: item 6 below branches on
the first and writes the second.
- **Reached for itself** — durable state, read at its source: the merged tree,
`git log` and `git show`, the slice or PRD issue, `docs/solutions/`, the
research artifact, installed types.
- **Withheld absolutely** — the authoring session's reasoning: why it wrote the
code that way, what it considered and discarded, and any narration or summary
of the finding standing in for the finding's own words.
The fixer's instructions, in order:
1. **Verify the finding against the tree first.** Reproduce the defect the
finding describes — a failing case, a read of the code path, whatever the
finding's own claim requires. If it cannot be reproduced, report
**`refuted`** with the evidence and make **no commit**. A refuted finding is
reported to the human, not argued into existence and not fixed anyway.
The finding's line numbers were read at review time, and an earlier fixer
in this run may have moved them. Find the anchored text in the file at the
current `HEAD` before editing, and use the lines it is on now, here and in
item 6's block.
2. **Grep `docs/solutions/` for the class of thing you are about to write** — both
locations, the sidecar's `solutions/` and the project's in-tree path, resolved
through the bundled [references/sidecar.sh](references/sidecar.sh) exactly as
`/execute` Step 1 does before implementation, with a `MISSING:` line from
`sidecar.sh require` on any path an entry cites reported rather than skipped — and read any entry that
matches before touching the tree. The corpus is a list of shapes that have
already failed here; on this skill's own PR, four fixers wrote grep-based
assertions over prose eight days after an entry named that exact shape and
said not to. A fixer that reads the entry first does not write the pin.
3. **Name the class, then count its sites, before editing.** Say in one line
what kind of defect this is: a claim restated in a second place, an unquoted
expansion, a guard missing from one of several callers. Search the tree for
other sites of the same class, using the census move in
[references/restated-claims.md](references/restated-claims.md) § *The census comes before the remedy*.
Fix only the site the finding names. List every other site in your report as
`sibling: <path>:<line>`, one per line, or `siblings: none found` with the
search you ran.
4. **Write the smallest fix that closes the finding**, following the project's
conventions. Do not fix anything the finding does not name; scope creep in a
post-review commit is invisible to the review that has already run. **When
the finding is about what a sentence claims rather than what something
does** — a claim in a prose contract, or any claim in a kind of text listed in [references/restated-claims.md](references/restated-claims.md) § *What is not a prose contract* — the fix is one of two
actions: delete the sentence that carries the claim, or replace that
sentence with a reference to the one place the claim is canonically stated.
Rewording the claim is not a fix; a reworded sentence is new text no review
has read. A finding that an instruction produces the wrong behavior is not
this case. **A sentence whose words include a backticked code span (a
command, a flag, a path) carries an instruction as well as the claim**, and
neither deleting it nor pointing it elsewhere keeps the instruction. Report
**`blocked: carries an instruction`**, naming the code span, and make **no
commit**. Do not reword it to save the instruction.
**The one exception is wording the human supplied.** When the finding, or
the human's instruction for this run, contains the exact replacement
sentence, apply it character for character and report the after-state as
**`supplied`**. The controller checks that the committed sentence equals the
supplied text and reverts on any difference. No breaker runs on a `supplied`
after-state. A fixer never writes replacement wording of its own: with no
supplied text, the finding still ends `blocked: carries an instruction`.
5. **Run the tests that read what you changed.** When the profile declares
`verify.test_changed` (a `test_changed` line under `Verify` that is not
`none`), run it with the paths in your commit, each one its own quoted
argument, and report the exit status verbatim. The run comes before the
commit, so those are the paths item 6 will commit, a new file included.
When it does not, run `verify.test`. The controller runs `verify.test` in
full once, after the last fixer and before the report, and names any
failure against the fix commits.
6. **Commit exactly one commit**, whose message says what the finding was and
what the fix does. On the `github` backend its last line is
`Fix-Findings-Run: <run id>`, the id Step 0 fixed, passed in the brief
verbatim, and a fix for a teammate review thread
also carries `Review-Thread: <url>`, the thread's URL verbatim, on
the line just above it. That is how `/respond-to-review` finds the fix on a later round, from
the tree. On the `sidecar` backend the message follows
[references/state-backend.md](references/state-backend.md) § Commit messages. One commit per fix — a fix
squashed together with another is a fix nobody can read separately.
**When the lines the finding anchors on came from one commit on this
branch, and the branch is unshared, make it a fixup of that commit.** Find
it from the finding's file and line range:
```bash
# Which one commit on this branch wrote every line the finding anchors on?
SC="<this skill's directory>/references/sidecar.sh"
FILE="<the finding's file>"
START="<the anchor's first line, found again at the current HEAD>"
END="<the anchor's last line, found again at the current HEAD>"
BASE_BRANCH="<sibling slice branch for a stacked PR, else empty>" # an earlier block's shell variable does not reach this one
if [ -n "$BASE_BRANCH" ]; then
if git rev-parse --verify -q "origin/$BASE_BRANCH^{commit}" >/dev/null; then BASE_REF="origin/$BASE_BRANCH"
elif git rev-parse --verify -q "$BASE_BRANCH^{commit}" >/dev/null; then BASE_REF="$BASE_BRANCH"
else echo "fixup target aborted: neither origin/$BASE_BRANCH nor $BASE_BRANCH resolves" >&2; exit 1; fi
else
BASE_REF="$(bash "$SC" base-ref)" || { echo "fixup target aborted: sidecar.sh base-ref failed" >&2; exit 1; }
fi
FIXUP_TARGET=$(git -c blame.blankBoundary=false -c blame.markUnblamableLines=false blame -l -s -L "$START,$END" "$BASE_REF..HEAD" -- "$FILE" \
| awk '{ print $(1) }' | sort -u)
[ "$(printf '%s\n' "$FIXUP_TARGET" | grep -c .)" -eq 1 ] && [ "${FIXUP_TARGET#^}" = "$FIXUP_TARGET" ] || FIXUP_TARGET=
C="${FIXUP_TARGET:-HEAD}" # the commit a fold of this fixup would rewrite
F=$(git merge-base "$BASE_REF" HEAD 2>/dev/null) || F= # the widest start the fold takes, the one it uses with no work item; none found counts as shared
B=$(git branch --show-current)
R=$(git config "branch.$B.pushRemote" || git config remote.pushDefault || git config "branch.$B.remote" || echo origin)
HEADS=$(git ls-remote --heads "$R" "refs/heads/$B" 2>/dev/null); LS_RC=$?
if [ -z "$B" ] || git rev-parse -q --verify '@{u}' >/dev/null || [ "$LS_RC" -ne 0 ] || [ -n "$(printf '%s\n' "$HEADS" | awk -v r="refs/heads/$B" '$(2) == r')" ] || [ -z "$(git rev-list -n 1 "$C" --not --remotes)" ] || [ -z "$F" ] || [ "$(git rev-list --count "$C" --not "$F" --remotes)" != "$(git rev-list --count "$C" --not "$F")" ]; then FIXUP_TARGET=; fi
printf 'FIXUP_TARGET=%s\n' "$FIXUP_TARGET"
```
A SHA on the printed line means one branch commit wrote every anchored
line and the branch is unshared: the lines from `C=` to the `printf` are
`/pre-merge` Phase 2's shared-branch block, which says what they check,
with the target as the commit no remote branch may hold. A pushed branch gets no fixups because `/pre-merge`
never offers to fold one, so its `fixup!` subject would merge as-is.
**The printed line decides, not your own diff:** a SHA means a `--fixup`
commit of that SHA, and an empty `FIXUP_TARGET=` means an ordinary commit.
Run the block and use its answer; do not judge the target from the lines
your fix changed, which are not the lines the finding anchors on. The
block settles which commit; the intent check next is the one reason to
decline its SHA.
**Intent check, before the commit.** Blame names the last commit that
touched the lines, and that commit can be about something else: a
reformat, a rename, a move. Read what the target says it does:
```bash
git log -1 --format=%B "<the SHA FIXUP_TARGET printed>"
```
Keep the fixup only when the fix finishes or corrects what that message
says the commit does. When the fix changes behavior the message does not
describe, or the message describes a different kind of change, clear the
target: make the ordinary commit this item states for this backend,
and skip the fold trial. A fold would otherwise put the fix under a
message that does not describe it.
Commit with `git commit --fixup=<that SHA>`, and give `-m` the commit
message item 6 states for this backend. Then check that the commit just made folds:
```bash
# After `git commit --fixup`: would the commit just made fold?
SC="<this skill's directory>/references/sidecar.sh"
trial_abort() { echo "fold trial aborted: ${1}; the fixup! commit stays" >&2; exit 1; }
BASE_BRANCH="<sibling slice branch for a stacked PR, else empty>" # the same branch the fixup-target block was given; an earlier block's shell variable does not reach this one
if [ -n "$BASE_BRANCH" ]; then
if git rev-parse --verify -q "origin/$BASE_BRANCH^{commit}" >/dev/null; then BASE_REF="origin/$BASE_BRANCH"
elif git rev-parse --verify -q "$BASE_BRANCH^{commit}" >/dev/null; then BASE_REF="$BASE_BRANCH"
else trial_abort "neither origin/$BASE_BRANCH nor $BASE_BRANCH resolves"; fi
else
BASE_REF="$(bash "$SC" base-ref)" || trial_abort "sidecar.sh base-ref failed"
fi
FORK_POINT=$(git merge-base "$BASE_REF" HEAD) || trial_abort "no merge base with $BASE_REF"
TRIAL_HEAD=$(git rev-parse HEAD)
TRIAL_DIR=$(mktemp -d) || trial_abort "mktemp failed"
trap 'rm -rf "$TRIAL_DIR" "$TRIAL_DIR.msg" "$TRIAL_DIR.err"' EXIT
git clone -q --shared --no-checkout "$(git rev-parse --show-toplevel)" "$TRIAL_DIR" || trial_abort "the throwaway clone failed"
git -C "$TRIAL_DIR" checkout -q --detach "$TRIAL_HEAD" || trial_abort "the throwaway checkout failed"
trial_git() { git -C "$TRIAL_DIR" -c user.name=trial -c user.email=trial@invalid -c commit.gpgsign=false "$@" >/dev/null 2>"$TRIAL_DIR.err"; }
FOLDED=yes
GIT_SEQUENCE_EDITOR=: trial_git rebase -q -i --autosquash "$FORK_POINT" || FOLDED=no
LEFTOVERS=
while [ "$FOLDED" = no ]; do
STOPPED=$(git -C "$TRIAL_DIR" rev-parse -q --verify REBASE_HEAD) || break
[ "$STOPPED" != "$TRIAL_HEAD" ] || break
case "$(git -C "$TRIAL_DIR" log -1 --format=%s "$STOPPED")" in "fixup! "*) ;; *) break ;; esac
case " $LEFTOVERS " in *" $STOPPED "*) trial_abort "rebase --skip did not move past $STOPPED" ;; esac
LEFTOVERS="$LEFTOVERS $STOPPED"
FOLDED=yes
trial_git rebase --skip || FOLDED=no
done
[ -z "$LEFTOVERS" ] || echo "fold trial: ignored earlier fixup! commits that still will not fold:$LEFTOVERS" >&2
if [ "$FOLDED" = yes ]; then
echo "fold trial: clean"
elif [ -n "$(git -C "$TRIAL_DIR" ls-files -u)" ]; then
git log -1 --format=%B HEAD | sed '1,2d' > "$TRIAL_DIR.msg"
if git commit -q --amend --only -F "$TRIAL_DIR.msg"; then
echo "fold trial: would not fold; recommitted as an ordinary commit" >&2
else
echo "fold trial: would not fold, and the recommit failed; HEAD is still a fixup! commit" >&2
exit 1
fi
else
trial_abort "the rebase failed without a conflict: $(cat "$TRIAL_DIR.err")"
fi
```
The trial runs `/pre-merge`'s fold in a throwaway clone, so the branch and
the shared git directory are untouched. A fixup conflicts there when a later
commit on the branch edited the same region. The fold is one rebase, so a
single conflicting fixup would abort it for every other fixup on the
branch. Only a conflict demotes: the conflict arm keeps the commit and its
`-m` text and drops the `fixup!` subject line. Any other failure (no base
ref, a failed clone, a rebase that stopped with nothing unmerged) exits
nonzero with `fold trial aborted:` and leaves the `fixup!` commit in place.
So does a failed recommit (a `commit-msg` hook or signing refusing the
amend). Report any nonzero exit as `blocked` (see the report below), not
`fixed`. Report the SHA after it ran.
The trial answers one question, whether the content folds, so signing is
off for its rebase. A throwaway commit needs no signature, and a signer can
fail in a clone with no one to approve it. A signing failure in the real
fold is not something a demotion could fix.
The trial has two wrong answers, each with its own cause. Because signing
is off in the trial, a signer set in the repository's config fails the real
fold while the trial reports `clean`. Because the throwaway clone does not
read the repository's own config, a merge driver defined there, for a
`merge=` attribute in `.gitattributes`, does not run in the trial, which
falls back to a text merge and can demote a fixup the real fold applies.
An earlier `fixup!` commit that a blocked fixer left behind stops the rebase
too. The trial skips any such commit and goes on, so it judges only the
commit just made, and it names what it skipped on stderr, whatever its
verdict. Report those SHAs in the `leftovers:` field (below): `/pre-merge`'s
fold aborts until each one is reworded.
The skip works only when the rebase stops on the leftover itself. A leftover
that breaks a later ordinary commit (it adds a file a later commit also
adds) stops the rebase on that commit, which the trial cannot tell from a
conflict of the commit just made: a clean fixup after it is demoted, or
reported `blocked` when its recommit is refused, and the leftover is not named.
Otherwise (an empty `FIXUP_TARGET=` line, or the intent check cleared the
target), make an ordinary commit. It is still one commit per fix, and it is
reviewed on its own. The `fixup!` subject only lets `/pre-merge`'s handoff
offer to fold the fix into its target later. Git's docs on what that fold
does to this message: *"The -m option may be used to supplement the log
message of the created commit, but the additional commentary will be thrown
away once the "fixup!" commit is squashed into <commit> by git rebase
--autosquash"* ([git-commit](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt)).
So a fold removes the `Fix-Findings-Run:` lines, and § Handoff's round
count starts again from zero after it. On the `sidecar` backend the fold
rewrites the SHAs the records name, and the count reads only records whose
commit is still on the branch, so it restarts the same way. That is
accepted: the fold is offered only after a re-run has reviewed every fixup
on the branch.
The fixer reports back: `fixed` (with the commit SHA, and a `leftovers:` field
naming each earlier `fixup!` commit the fold trial skipped, when it skipped any),
or `refuted` (with evidence), or `blocked` (with what it needed and did not
have, or `blocked: carries an instruction` under item 4). With any verdict
reached after item 3 it also gives that item's one-line class and its sibling
lines. Nothing else.
**On the `sidecar` backend, the controller records each `fixed` commit**
before it spawns that finding's breaker. Use the SHA the fixer reported after
its fold trial, since a demotion amends the commit:
```bash
SC="<this skill's directory>/references/sidecar.sh"
RUN="<the run id Step 0 fixed>"
FIX_SHA="<the SHA the fixer reported>"
THREAD="<the teammate review thread's URL, or empty for a /pre-merge finding>"
W="<the slice's W-<n> from § Inputs, or empty when there is none>"
case "$(bash "$SC" backend stamp)" in
github) echo "github backend: the commit's own trailer lines are the record" ;;
sidecar)
FULL=$(git rev-parse --verify -q "$FIX_SHA^{commit}") || { echo "fix run not recorded: $FIX_SHA is not a commit" >&2; exit 1; }
set -- fixrun record "$(git branch --show-current)" "$RUN" "$FULL"
[ -z "$THREAD" ] || set -- "$@" --thread "$THREAD"
[ -z "$W" ] || set -- "$@" --work "$W"
bash "$SC" "$@" || { echo "fix run not recorded: sidecar.sh fixrun record failed" >&2; exit 1; } ;;
*) echo "fix run not recorded: sidecar.sh backend stamp failed" >&2; exit 1 ;;
esac
```
A record that fails is reported with the finding, not retried silently: the
fix stands, but § Handoff's count and `/respond-to-review`'s later round will
not see it.
A fold trial whose recommit failed is `blocked`: the report names the leftover
`fixup!` commit by SHA and says its subject must be reworded by hand (or the
commit amended once the hook or signer is fixed). A trial that printed `fold
trial aborted:` is `blocked` too: the report names the `fixup!` commit and
relays that line, and the fix is to clear its cause and run the trial again.
When the cause is a fixup that empties its target or a later commit, running
the trial again changes nothing: the remedy is rewording its subject by hand,
as for a failed recommit. An emptying fixup is not a conflict, so the trial
does not demote it. A fixup-target block that printed `fixup target aborted:`
is `blocked` too, with no commit: relay that line, and do not fall back to an
ordinary commit, because the block could not say whether one is right.
A `fixed` under item 4's prose-claim case also names the after-state of the
site the finding anchored on. The table's last two rows are the ones that can
end any `fixed`, prose or not:
| After-state | Named by | What the anchored site holds at the fix commit |
|---|---|---|
| `deleted` | the fixer | nothing where the claim's sentence was |
| `pointer → <target>` | the fixer | a reference to the canonical statement at `<target>`, which exists |
| `supplied` | the fixer | the replacement sentence the finding or the human supplied, character for character |
| `rejected: carries an instruction` | the controller | a deletion or pointer whose removed words include a code span, or a pointer to its own item |
| `rejected: reworded` | the controller | anything else |
| `blocked: needs decision` | the controller | whatever it holds, the commit reached outside the finding (the footprint check below) |
| `widened by human: <outside paths>` | the controller | the blocked fix, re-applied on the human's yes; the paths are the ones the footprint check printed |
**Compare the fix's footprint with the finding's before any breaker runs.** Do
it first, on every `fixed`, while the fix commit is still `HEAD`. Give the
block the paths the finding's own text names, never the paths the fixer
reported. It reads the fix commit's file list:
```bash
# Did this fix stay inside what its finding named?
FIX_SHA="<the SHA the fixer reported>"
NAMED="<each path the finding names, one per line>"
fp_abort() { echo "footprint check aborted: ${1}" >&2; exit 1; }
FULL=$(git rev-parse --verify -q "$FIX_SHA^{commit}") || fp_abort "$FIX_SHA is not a commit"
[ "$FULL" = "$(git rev-parse HEAD)" ] || fp_abort "$FIX_SHA is not HEAD"
CHANGES=$(git -c core.quotePath=false show --format= --no-renames --name-status HEAD) && [ -n "$CHANGES" ] \
|| fp_abort "cannot read the paths $FIX_SHA changed"
NUMSTAT=$(git -c core.quotePath=false show --format= --no-renames --numstat HEAD) \
|| fp_abort "cannot read the lines $FIX_SHA removed"
MANIFEST='(^|/)(package\.json|composer\.json|Cargo\.toml|go\.mod|Gemfile|pyproject\.toml|requirements[^/]*\.txt|pom\.xml|build\.gradle(\.kts)?|Package\.swift)$'
LOCKFILE='\.lock(b|file)?$|(^|/)(package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|go\.sum)$'
SCHEMA='(^|/)(migrations?|migrate)/|(^|/)(schema|structure)\.[^./]+$|\.(prisma|schema\.json)$'
TEST_NAME='(^|/)test[-_][^/]*$|[._-](test|spec)\.[^/]+$|[a-z]Test\.[A-Za-z]+$'
TEST_FILE="(^|/)(tests?|specs?|__tests__)/|$TEST_NAME"
OUTSIDE=$(printf '%s\n' "$CHANGES" | while IFS="$(printf '\t')" read -r KIND CHANGED; do
if printf '%s\n' "$CHANGED" | grep -qE "$MANIFEST|$LOCKFILE"; then echo " dependency manifest or lockfile: $CHANGED"
elif printf '%s\n' "$CHANGED" | grep -qE "$SCHEMA"; then echo " schema or migration: $CHANGED"
elif [ "$KIND" = A ]; then
printf '%s\n' "$CHANGED" | grep -qE "$TEST_FILE" || echo " new non-test file: $CHANGED"
elif printf '%s\n' "$NAMED" | grep -qxF -- "$CHANGED"; then :
elif [ "$KIND" != D ] && printf '%s\n' "$CHANGED" | grep -qE "$TEST_NAME"; then
REMOVED=$(printf '%s\n' "$NUMSTAT" | CHANGED="$CHANGED" awk -F '\t' '$(3) == ENVIRON["CHANGED"] { print $(2) }')
[ "$REMOVED" = 0 ] || echo " existing test changed, not only added to: $CHANGED"
else echo " not named by the finding: $CHANGED"
fi
done)
git show --stat --format= HEAD
if [ -n "$OUTSIDE" ]; then
echo "footprint: blocked: needs decision"
printf '%s\n' "$OUTSIDE"
else
echo "footprint: inside"
fi
```
A changed path the finding did not name, a new non-test file, a schema or
migration file, a dependency manifest or lockfile, or a changed user-visible
string is outside the finding. A test file the finding did not name is inside
the footprint when the fix removes no line from it: a new file under a test
directory or with a test file's name (`TEST_FILE`), or lines added to an
existing file whose own name is a test file's (`TEST_NAME`; `git show
--numstat` counts no deletions, and a binary file's `-` counts as removed). An
existing file whose name is not a test file's, such as a helper or data file
under a test directory, is outside. One whose lines the fix removes or
rewrites, or that the fix deletes, is outside. A path the finding names is
inside, test file or not, unless it is a new non-test file, a schema or
migration file, or a dependency manifest or lockfile. The block decides the path checks from file names, and knows only
the names written in it. **Whether the fix changed a user-visible string is
your judgment**: read the diff, because no file name says so and the block can
print `footprint: inside` over one. The same read catches a schema, manifest
or lockfile under a name the block does not know.
When the fix is outside, revert the commit with `git revert --no-edit HEAD`
(never a reset), spawn no breaker, report the finding as
**`blocked: needs decision`** with the stat output, and ask the human whether
the wider change is wanted. Ask it as one `AskUserQuestion` with two options,
**yes, widen the fix** and **no, leave it blocked**, mark neither recommended,
and ask it before Step 3's removal, while the edit lock is still open for this
run. Say in the question that a contract change leaves descriptions of the old
contract, and the spec, to update, and that the re-review flags any left
behind. On **yes**, re-apply the fix as a new commit by reverting the revert,
`git revert --no-edit <the revert's SHA>`; record that commit the way this
step records any fix commit on each backend (on `github`, amend its message so
it ends with item 6's lines); then run this step's remaining checks and the
breaker rule on it, as `FIX_SHA`, and make item 5's full run again if Step 3
already made it. Its report line reads `widened by human:` and the outside
paths, so the `/pre-merge` re-run reads the decision. If the revert of the
revert does not apply cleanly, because a later fix changed the same lines, run
`git revert --abort`, leave the finding `blocked: needs decision`, and say
why. On **no**, the finding
stays `blocked: needs decision` and goes to § Handoff's menu. Under § Unattended
rounds the question is not asked: the fix stays reverted and the finding waits
on the human. If the block
aborts it gave no verdict: relay the line, and spawn no breaker until a run of
it has given one.
**The controller reads the after-state off the fix, not off the report.** When
the fixer reported `supplied`, run the block below and neither of the two
reads after it: supplied wording may carry a code span, and it is a reword by
design. Copy the new sentence from the finding or from the human's own
message, never from the fixer's report or its commit. With no such sentence to
copy, the after-state is `rejected: reworded`.
```bash
# Is the committed sentence the supplied one, character for character?
FIX_SHA="<the SHA the fixer reported>"
FILE="<the finding's file>"
{ OLD_SENTENCE=$(cat); } <<'OLD_SENTENCE_END'
<the sentence the finding anchors on, as it stood before the fix>
OLD_SENTENCE_END
{ NEW_SENTENCE=$(cat); } <<'NEW_SENTENCE_END'
<the replacement sentence, copied from the finding or the human's instruction>
NEW_SENTENCE_END
sup_abort() { echo "supplied check aborted: ${1}" >&2; exit 1; }
BEFORE=$(git show "${FIX_SHA}^:${FILE}") || sup_abort "cannot read $FILE before $FIX_SHA"
AFTER=$(git show "${FIX_SHA}:${FILE}") || sup_abort "cannot read $FILE at $FIX_SHA"
PATHS=$(git -c core.quotePath=false show --format= --no-renames --name-only "$FIX_SHA") || sup_abort "cannot read the paths $FIX_SHA changed"
# The fix may be nothing but this: the file before it, with that one sentence replaced.
EXPECTED=$(printf '%s\n' "$BEFORE" | OLD="$OLD_SENTENCE" NEW="$NEW_SENTENCE" awk '
{ body = body sep $(0); sep = "\n" }
END {
old = ENVIRON["OLD"]
at = index(body, old)
if (old == "" || !at) exit 3
rest = substr(body, at + length(old))
if (index(rest, old)) exit 4
printf "%s%s%s", substr(body, 1, at - 1), ENVIRON["NEW"], rest
}') || sup_abort "the old sentence is not in $FILE exactly once before $FIX_SHA"
if [ "$AFTER" = "$EXPECTED" ] && [ "$PATHS" = "$FILE" ]; then
echo "supplied check: supplied"
else
echo "supplied check: rejected: reworded"
fi
```
On `supplied check: rejected: reworded`, revert the commit as below and report
that after-state. If the block aborts, it gives no verdict, so compare the two
sentences by hand and revert on any difference.
For any other reported after-state, first
run the instruction check on the anchored file. It looks only at the words the
fix removed:
```bash
# Did the words this fix removed include a code span? Then the sentence carried an instruction.
FIX_SHA="<the SHA the fixer reported>"
FILE="<the finding's file>"
DIFF=$(git show --format= --no-color --no-ext-diff --word-diff=porcelain "$FIX_SHA" -- "$FILE") && [ -n "$DIFF" ] \
|| { echo "instruction check aborted: git show failed, or $FIX_SHA changes nothing in $FILE" >&2; exit 1; }
REMOVED=$(printf '%s\n' "$DIFF" | grep '^-')
if printf '%s\n' "$REMOVED" | grep -q '`'; then
echo "instruction check: rejected: carries an instruction"
printf '%s\n' "$REMOVED" | grep '`' >&2
else
echo "instruction check: no code span removed"
fi
```
In porcelain word-diff each removed run is its own line starting with `-`, so
the `grep` keeps removed words (and the `--- a/` header, which holds no
backtick unless the path does). A code span the fix *adds*, such as the path a pointer names, does not
count. If the block prints `rejected: carries an instruction`, that is the
after-state whatever shape the diff has. So is a `pointer` whose target is the
numbered item or section the site sits in, because it points at itself; read
that off the target, since no check here resolves it. If the block aborts, it
gives no verdict, so read the removed words by hand.
Then run `git show --word-diff "$FIX_SHA" -- <path>` on the anchored file and
look at the site: a deletion
removes the claim's whole sentence and adds no words, and a pointer replaces it
with a reference whose target states everything the removed sentence claimed.
Read the target to check that. A target that states only part of it is the
partial enumeration that
[references/restated-claims.md](references/restated-claims.md) § *The remedy, and its limit*
names, and the after-state is `rejected: reworded`.
Removing words while the sentence survives (one member of a list, a
qualifier, a clause) is a reword: what remains is a narrower claim no review has
read. If the site holds anything else, the after-state is `rejected: reworded`
whatever the fixer reported. Revert
the commit with `git revert --no-edit "$FIX_SHA"`, spawn no breaker, and leave
the finding for § Handoff's menu — a reworded sentence left on the branch would
be the next `/pre-merge` re-run's subject. Revert a `rejected: carries an
instruction` fix the same way, and name it in the menu as an instruction fix:
the sentence does something, so the finding goes back to the human to restate
as the behavior that instruction produces.
**No breaker runs when nothing executable reads what the fix changed.** A
mutation is revealed only by a check that reads the mutated text. Before
spawning a breaker, list the fix's changed paths and search the project's test
and script directories for a reader of each: the path, its file name, or a
symbol the fix touched. Test files kept beside the source count, and a changed
test is its own reader. When there is none, or the after-state is `deleted` or
`pointer`, write `not-applicable (no executable reader)` on the breaker line
and name the paths. That line reports a gap in test coverage. It is not a
passing result, and it goes in the report so the human can ask for a test. A
`supplied` after-state gets no breaker either (item 4), and its breaker line
says it was compared with the supplied text.
### Step 2. Spawn a fresh breaker against the fix
A second sub-agent, fresh, **read-only**, and working in a throwaway copy of the
tree. Spawn it on the same cheaper tier as the fixer, for the same reason and with the same escalation signal (Step 1). Its procedure is a checklist and its mutation is drawn from the corpus rather than composed, and the apparatus check gates the verdict — a breaker that cannot make its control go red reports `not-run` rather than false confidence. Neither sub-agent may drop below Sonnet: both read a real tree and run a real suite, and a breaker that misreports `killed` is worse than no breaker at all. It never edits the branch, never commits, never stamps, and never fixes
what it finds — chrislacey89/skills#249 is the incident that rule comes from: a review sub-agent
mutated the tree it was reviewing. **And its subject has to be a fixed commit,
not whatever the branch holds when the breaker looks.** A round processes
findings one after another, and `HEAD` keeps moving as later findings' fixers
commit — by the time the round is reported, `HEAD` no longer names this fix.
A breaker's verdict has to be about the specific fix it was asked to check, not
a restatement of the fixer's own account of that fix (independence from the
fixer's account is the reason this sub-agent exists at all) and not whatever
the branch has accumulated by the time anyone reads the verdict back. So:
**it never reads the original working tree and never resolves a moving ref** —
not `git status`, not the working files, not `HEAD`. "Only for orientation" is
not an exception: orientation taken off `HEAD` names whichever commit is
current when it is taken, which is not this breaker's subject.
What it may read is what cannot move: the extracted copy, the commit
`$FIX_SHA` names, and its parent `$FIX_SHA^`, which cannot move either. A
commit that already exists cannot be perturbed by anything else running, so
the `git archive "$FIX_SHA"` extraction below is not a violation of this — and a breaker that needs to see what the fix changed runs
`git show "$FIX_SHA"` from the original repo, since the extracted copy has no
`.git`, rather than inferring the diff from the working files, which move.
Nor does it infer the diff from the fixer's report, on a different axis: that
report cannot move, but relying on it would make the breaker's verdict a
restatement of the fixer's own account of its fix rather than an independent
read of the fix, and independence is the reason this sub-agent exists at all.
Copying `.env.local` and its siblings into the copy is permitted on the same
mutability axis: a fixer repairing a review finding does not edit them, so the
copies are the test command's apparatus, not anything that moves. A dependency
tree is apparatus only while its loader finds the copy's source. A linked tree
whose loader resolves its own real path loads the project from the original
working tree, which moves and which this breaker may not read;
[references/copy-dependencies.md](references/copy-dependencies.md) says when
linking is sound.
PR and issue bodies are on the other side of that line. Nothing in a
`/fix-findings` run edits them — this skill opens no PRs and edits no bodies,
and fixers only commit — so they are durable state the breaker reads at its
source, on the same footing Step 1 gives the fixer for the slice or PRD issue.
**What the breaker is handed.** The controller pastes the `"$SC" profile` output
from Step 0 into the brief, verbatim, and the breaker takes its test command
(narrowed to the named check's file, never the profile's full suite) and
hazards from that text. The breaker never runs `sidecar.sh`: the verb resolves
the base ref, which can move, and a breaker reads only what cannot.
**Where the copy lives: `git archive`, not a second worktree — and it archives
the fix, not `HEAD`.** `FIX_SHA` below is the commit the fixer reported in Step
1, handed to the breaker along with the finding. It is not `HEAD`, because a
round processes findings one after another and `HEAD` keeps moving as later
fixers commit — a verdict pinned to a moving ref stops naming this fix by the
time anyone reads it back, even though nothing else is touching the tree while
this particular breaker runs. `$FIX_SHA` names the exact commit the verdict is
about, permanently, regardless of when the round is read. The block does not
bind `FIX_SHA` itself — export it before running the block below: `export
FIX_SHA=<the SHA the fixer reported>`.
```bash
# pipefail is load-bearing: without it the pipeline reports tar's status, and a
# `git archive` that resolved nothing exits 0 having extracted an empty tree.
set -o pipefail
BREAKER_DIR="$(mktemp -d)"
if ! git archive "$FIX_SHA" | tar -x -C "$BREAKER_DIR"; then
rm -rf "$BREAKER_DIR"
echo "breaker aborted: could not extract $FIX_SHA into a throwaway copy" >&2
exit 1
fi
echo "breaker copy: $BREAKER_DIR"
```
A `git worktree add` would register an entry in a git directory that other
sessions read and that survives a crashed breaker as a prunable stub — two
controllers over one stock, which is the coordination hazard Leveson names and
which is real here, because parallel-workspace hosts share one git directory
across sessions. `git archive` writes a plain directory with no `.git` inside it,
so the breaker has no branch to commit to — and **committing is the whole of what
the missing `.git` buys**. It does nothing about a write that lands in the
*original working tree* by another route: a bare relative path, a `sed` with the
wrong `-C`, a `$BREAKER_DIR` that was bound in the block's shell and had gone
empty by the shell that mutated. In the field a breaker reached the real repo
exactly that way and edited two rows of a file under review while a sibling agent
was reading it. The isolation is structural for commits and asserted for
everything else, and chrislacey89/skills#344 is the run where the asserted half failed — so the two
halves are named separately here rather than under one word.
So the copy carries a mechanism for the second half rather than a promise. The
block prints the absolute path it created, and **every command the breaker runs
— the control, the mutation, and the check — runs with that path as its working
directory, `cd`'d there by the printed literal at the top of each shell.** Not by
re-reading `$BREAKER_DIR`, which lives only in the shell the block ran in: a
breaker that mutates from a later shell gets the empty string, and a relative
path then resolves against the repo under review. With the copy as cwd the
failure inverts into the safe direction — a bare relative path resolves *inside*
the copy, where it belonged, and a lost path makes the command fail rather than
land somewhere. `git show "$FIX_SHA"` run from the original repo stays permitted;
it is a read, and it is the one command in the breaker's repertoire that names
the original on purpose.
Clean up with `rm -rf <the printed path>` when the breaker reports — the literal,
for the same reason: `rm -rf "$BREAKER_DIR"` in a later shell expands to
`rm -rf ""`, which reports success and removes nothing.
**The extraction fails closed, and the guard is not decoration.** An unguarded
`git archive <bad-rev> | tar -x` prints its `fatal:` to stderr and exits **0**,
leaving an empty directory behind — so a breaker that trusted the exit status
would run its mutation against no tree at all and could still report a verdict.
That is the exact failure this skill is built to refuse: a green result that is
green for a reason nobody checked. If the block aborts, the breaker reports
**`not-run`** with the abort message and no verdict.
The same guard covers the new way to get this wrong: a controller that forgot to
hand the breaker a SHA. An unset `FIX_SHA` expands to the empty string, `git
archive ""` rejects it as `fatal: not a valid object name`, and under `pipefail`
the pipeline exits 128 — so the missing SHA aborts the extraction rather than
producing a verdict about nothing. No separate check is needed for it, and one
should not be added on the assumption that unset behaves differently from
unresolvable here; it does not.
The cost is that the copy has no git history and none of the repo's ignored
files. Bring over what the test command needs as
[references/copy-dependencies.md](references/copy-dependencies.md) says, and run
its source-location check before the control. When that check fails, or the
dependencies cannot be brought over here, the breaker reports **`not-run`** with
the reason. It does not report `survived` on a mutation it could not run.
**What the breaker does**, once per finding and then stop:
1. **Validate its own apparatus before anything else** — apply a known-killable
control and confirm the named check goes red on it.
2. **Apply one corpus-drawn mutation at the point of consumption** of the
property the fix claims to hold.
3. **Report one of four verdicts** — `killed`, `survived`, `not-run`, or
`not-applicable` — naming the check, the command, and its exit status.
All three steps, the four verdicts, what a known-killable control is for a shell
or prose change, and why a green result is not self-validating are stated once in
[references/mutation-at-consumption.md](references/mutation-at-consumption.md).
Read it there; it is not restated here.
**The command that holds the named check is the only one the breaker runs.**
The control and the mutation both run it, and nothing wider: no full suite, no
other test files. When that command reports a failure in a test other than the
named check, the breaker's own edit is the likeliest cause, because the command
only ever runs with the control or the mutation applied. Undo the edit, re-run
that file at most once, and go no further. If it passes with the edit undone, the
failure was the breaker's own doing: say so and report nothing against the fix.
A failure that persists with the edit undone has a third possible cause: the
copy itself. A `git archive` copy has no `.git` and none of the ignored files,
so a suite that reads git fails there with or without any edit. Tell it apart by
running the same command on an archive of `$FIX_SHA^`. If it fails there too,
the fix did not cause it: report it as a copy limit, with its command and exit
status, and nothing against the fix. Only a failure that persists with the edit
undone and does not reproduce on the parent's archive is reported beside the
verdict as `unclassified`, with its command and exit status. It may be a flake
or a regression the fix caused; the human decides which, and the `/pre-merge`
re-run reads it as evidence.
**The verdict is advisory.** `survived` is reported to the human as a line item
and to the `/pre-merge` re-run as evidence. It is never auto-re-fixed (that is
the re-fix loop chrislacey89/skills#253 recorded), and it never earns or withholds a stamp — a
`survived` verdict that nothing executed reads identically to one that did,
which is why the apparatus check gates the verdict and why the verdict gates
nothing.
### Step 3. Report, then release the lock
**First reconcile the original working tree — you do this, not the breaker.**
The breaker is read-only and works in an isolated copy (Step 2), which makes an
escape unlikely; it does not make it visible, and a breaker that escaped leaves
its mutation sitting in the repo under review. Run `git status --short` in the
original repo after each breaker reports. No fixer is ever editing while a
breaker runs — the two never overlap — so this is exact, not merely
file-granular: with no concurrent editor of any kind, any dirty path
`git status --short` reports is unexplained by construction, and unexplained
means an escaped breaker. Restore the path before the next fixer starts, report
that breaker's finding as **`not-run`** rather than passing its verdict
through, and say in the report that the reconciliation is why.
This sits with the controller rather than the breaker for the same reason
Step 2 gives: the breaker is forbidden to read the original working tree at
all, so handing it the reconciliation would contradict the restriction that
makes its read-only isolation mean anything.
**Then make item 5's full run.** Its line heads the report: the command, the
exit status, and how many tests or suites it ran when the runner says. A fixer's
targeted exit 0 is not a substitute for it.
Then print one block per finding — number (and, for a teammate review thread,
its URL, so the author can reply to it), the fixer's verdict and commit SHA,
its `leftovers:` when it named any, its class and sibling lines, the
after-state on a prose-claim finding, the stat output on a `blocked: needs decision`,
the breaker's verdict **and the SHA it
archived** (or, when no breaker was spawned, `not-applicable (no executable
reader)` and the paths where Step 1's breaker rule gives that line, else
`none` and why), the breaker's `unclassified` line (the failing test, its
command and exit status) when it reported one, and the command
behind each. No conclusions the human cannot re-run.
```
Full run, after the last fixer — `pnpm run test` → 0, 412 tests
Finding 3 — fixed at a1b2c3d
fixer: `pnpm run test` → 0
class: an over-fetch computed at the use site instead of from its constant
sibling: src/search/related.ts:41
sibling: src/search/recent.ts:18
breaker: survived, against a1b2c3d — `pnpm run test -- guards.test.ts` → 0 with
OVER_FETCH_MULTIPLIER left at 4 and the use site edited to `topK * 137`
(control went red first: same file, deleted assertion → exit 1)
unclassified: `pnpm run test -- guards.test.ts` → 1, in `cache.test.ts`, still failing with the breaker's edit undone
Finding 4 — fixed at d4e5f6a, deleted
fixer: `pnpm run test` → 0
breaker: not-applicable (no executable reader) — docs/caching.md
Finding 5 — fixed at b7c8d9e, pointer → docs/architecture.md
fixer: `pnpm run test` → 0
breaker: not-applicable (no executable reader) — src/session.ts
Finding 6 — rejected: reworded at 9f8e7d6, reverted at 5c4b3a2
controller: `git show --word-diff 9f8e7d6 -- src/retry.ts` → the site adds words that are not a reference
breaker: none — not spawned for a rejected fix
Finding 7 — blocked, leftover fixup! commit e1f2a3b
fixer: blocked — fold-trial block → 1, recommit refused by the commit-msg hook;
reword e1f2a3b's subject by hand, or amend it once the hook is fixed
breaker: none — not spawned for a blocked fix
Finding 8 — rejected: carries an instruction at 3c4d5e6, reverted at 7a8b9c0
controller: instruction check on docs/release.md → removed `--dry-run`; restate as an instruction fix
breaker: none — not spawned for a rejected fix
Finding 9 — fixed at 2d3e4f5
fixer: `pnpm run test` → 0
class: a total rounded before it is summed
siblings: none found — searched `rg -n 'Math\.round' src`
leftovers: e1f2a3b — skipped by the fold trial; /pre-merge's fold aborts until it is reworded
breaker: killed, against 2d3e4f5 — `pnpm run test -- report.test.ts` → 1 with the
total's rounding reverted (control went red first: same file, deleted assertion → exit 1)
Finding 10 — blocked: needs decision at 6a7b8c9, reverted at 0d1e2f3
controller: footprint check → new non-test file: src/queue/backoff.ts
src/queue/backoff.ts | 24 ++++++++++++++++++++++++
src/queue/retry.ts | 6 +++---
2 files changed, 27 insertions(+), 3 deletions(-)
breaker: none — not spawned for a reverted fix
Finding 11 — fixed at 8e9f0a1, supplied
fixer: `pnpm run test` → 0
controller: supplied check on docs/release.md → equals the sentence the human gave
breaker: none — supplied after-state, compared with the supplied text
Finding 12 — fixed at 5b6c7d8
fixer: `pnpm run test` → 0
class: an unquoted expansion
siblings: none found — searched `rg -n 'cp -R \$' bin`
breaker: not-applicable (no executable reader) — bin/release.sh
Finding 13 — fixed at 4f5a6b7, widened by human: src/api/limits.ts
controller: footprint check on 1c2d3e4 → not named by the finding: src/api/limits.ts;
reverted at 8d9e0f1, re-applied at 4f5a6b7 on the human's yes
fixer: `pnpm run test` → 0
breaker: killed, against 4f5a6b7 — `pnpm run test -- limits.test.ts` → 1 with the
limit's check removed (control went red first: same file, deleted assertion → exit 1)
```
**When a fixer reports siblings, show them under the finding and ask one
question before the menu:** **add these sites to this round as their own
findings**, or **leave them for the next review**. Mark neither recommended;
which sites join is the human's disposition. Only the `sibling:` lines a fixer
reported enter the question. A breaker's side note, or a site you noticed
yourself, is printed in the report and left for the re-review. Ask it before the removal below,
while the edit lock is still open for this run. Sites the human adds are fixed
by a fresh fixer each, under the same cap: Steps 1 and 2 as written, one
finding per site, under this run's id, then their blocks join this report,
with item 5's full run made again after the last of them. The
question is asked once in a run, so a sibling an added site's fixer reports is
listed and left for the next review. Under § Unattended rounds it is not asked
at all: every sibling is listed and left for the review.
The archived SHA is on the breaker's line because it is the one thing that says
what the verdict is *about*. By the time the round's report prints, `HEAD` has
moved past this fix — later findings' fixers have committed on top of it — so a
report that names only the verdict leaves a `survived` attributable to whatever
the branch had accumulated by then, and a `survived` misattributed to the wrong
fix sends the human back to code that was never the subject. When the two SHAs
match, as they do above, the line is redundant and should still be printed: a
reader cannot tell a match from an omission.
**Then print one outcome line per finding the run was handed**, after the
blocks, the sibling sites the human added included. A `refuted` or `blocked`
finding makes no commit, so this line is the only trace it leaves, and this
skill writes it nowhere: § Handoff hands the lines to the `/pre-merge` re-run,
which records them where [references/state-backend.md](references/state-backend.md)
§ Where the review's records live says. Each line is one table row:
```
| <run id> | <n> | <claim> | <outcome> | <commit> | <breaker> | <chosen by> |
```
`<run id>` is Step 0's `FIX_FINDINGS_RUN`. `<n>` is the finding's number.
`<claim>` is the finding's claim in one line, named in domain terms so the row
reads cold, with any `|` written as `/`. `<commit>` is the first SHA the
block's heading names (the fix commit, or the leftover `fixup!` commit), or
`none`. `<breaker>` is the first word of the block's `breaker:` line
(`killed`, `survived`, `not-run`, `not-applicable`, or `none`), so it is `none`
only when that line itself reads `none`. `<chosen by>` is `human` when the
human named the finding, which is every finding of round 1 and of any run
without `--rounds`, and `rounds rule` when § Unattended rounds took it in a
later round.
`<outcome>` is exactly one of these words:
| Outcome | The finding's block reads |
|---|---|
| `fixed` | `fixed at <sha>`, with or without an after-state |
| `fixed, widened by human` | `fixed at <sha>, widened by human: <paths>` |
| `refuted` | the fixer's `refuted`, with no commit |
| `blocked` | `blocked` for any cause the two rows below do not name |
| `blocked: carries an instruction` | the fixer's `blocked: carries an instruction`, with no commit |
| `blocked: needs decision` | the footprint check's revert, left blocked |
| `rejected: reworded` | the controller's revert of a reworded prose fix |
| `rejected: carries an instruction` | the controller's revert of a fix that removed a code span |
For the report above, finding 3's line is
`| 20261104T120000Z | 3 | Over-fetch computed at the use site, not from its constant | fixed | a1b2c3d | survived | human |`
and finding 7's is
`| 20261104T120000Z | 7 | Retry delay doubles past the configured cap | blocked | e1f2a3b | none | human |`.
Then remove `.claude/.fix-findings-active`, resolving it through the same
fallback the harness line above used, so the removal reaches the file that line
actually created:
```bash
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}"
if [ -e "$PROJECT_DIR/.claude/.fix-findings-active" ]; then
rm "$PROJECT_DIR/.claude/.fix-findings-active"
echo "fix-findings marker removed — post-review edit lock shut"
else
echo "fix-findings marker NOT FOUND at $PROJECT_DIR/.claude/.fix-findings-active — the lock may still be standing open somewhere else; report this rather than assuming it is shut" >&2
fi
```
Remove it on every exit path, including an abort — a leaked flag leaves the
post-review edit lock silently open, which is the failure this whole mechanism
exists to close. **Report the not-found line if it prints.** `rm -f` would have
been shorter and would have reported success on a removal that removed nothing,
which is indistinguishable from the failure above; the branch is what makes a
miss sayable. All three sites — the harness line's `touch`, the hook's test, and
this `rm` — resolve `$CLAUDE_PROJECT_DIR` the same way for the same reason: a
flag written under `$PWD` in a subdirectory is a flag the hook never reads, so
the fixer would be refused by the lock written for it. Leave `.claude/.review-stamped` alone; `/closeout` removes it at
merge. The asymmetry is deliberate and is the fail-safe direction: a leaked
`.fix-findings-active` is an open lock nobody can see, while a leaked
`.review-stamped` is a closed lock that announces itself the moment someone tries
to edit.
Then clear the classification markers. A fixer that loaded `/tdd` left one, and the branch goes back to `/pre-merge`, whose stamp lands on a branch that carries none:
```bash
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}"
rm -f "$PROJECT_DIR/.claude/.tdd-active" "$PROJECT_DIR/.claude/.tdd-skipped" "$PROJECT_DIR/.claude/.lfg-active" "$PROJECT_DIR/.claude/.post-review-edit"
```
## The two flags
Lock 1 is a writer, a refusing reader, and a lifecycle, on the same pattern as
`/tdd`'s `.claude/.tdd-active`. Both flags are transient by construction, which
is the condition under which this pack tolerates filesystem state at all. Every
row below names the step that reads the flag, because a flag no later step reads
is not load-bearing (chrislacey89/skills#326).
| Flag | Written by | Read by | Removed by |
|---|---|---|---|
| `.claude/.review-stamped` | `/pre-merge` Phase 4, beside the review-currency stamp, under the same fallback | `.claude/hooks/enforce-classification.sh` — refuses Write/Edit on implementation files while it exists and `.fix-findings-active` does not | `/closeout` Step 3 at merge; `/execute` Step 0's fresh-slate checklist |
| `.claude/.fix-findings-active` | this skill, by the harness line at the top of this file, when it loads, under `${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}` | the same hook clause, at `$CLAUDE_PROJECT_DIR/.claude/.fix-findings-active` — its presence is what re-opens the lock | Step 3 above, on every exit path, resolving the same fallback and reporting a miss rather than swallowing one; `/execute` Step 0's fresh-slate checklist |
**`.review-stamped` also stands the classification clause down, which is what lets this skill's fixer write at all.** The same hook carries an earlier clause refusing implementation writes unless `.claude/.tdd-active`, `.claude/.tdd-skipped`, `.claude/.lfg-active`, or `.claude/.post-review-edit` exists — and `/execute` Step 6 removes every one of those *before* `/pre-merge` stamps, so no fixer ever arrives holding one. Were the two clauses genuinely independent in that order, the flag the harness line writes above would be read too late to matter: every fixer would be refused by the classification clause, under a message naming `/tdd`. So on a stamped branch the classification clause does not fire and this lock is the sole decider. Do not remove that coupling on the grounds that it looks like a leak between two unrelated gates — `scripts/test-post-review-edit-lock.sh` § 5 drives the real lifecycle, Step 6's removal included, and fails if it goes.
**Two routes the refusal names — which is not the same as two ways out.** The
refusal message names invoking this skill, and deleting `.claude/.review-stamped`
by hand. That second choice is made silently today, and the message is what makes
it visible (Norman — prospective memory fails silently, and "re-run the review
after fixing" is exactly the prospective act the field record shows being
skipped). Read that as a stop on the *default* post-review edit, not as an
enclosure: the hook is registered on `PreToolUse` `"matcher": "Write|Edit"` and
refuses only a path that matches `IMPL_PATTERNS` and survives the skip logic, so
several routes are already past it and leave no trace at all. Invoking
this skill on finding numbers the model chose itself (it is model-invocable, and its
load-time marker opens the lock before any rule below is read) is past it too;
writing `.claude/.fix-findings-active` opens the lock with no sub-agent behind it;
writing `.claude/hooks/enforce-classification.sh` rewrites the gate (`.sh` is not
an implementation pattern); writing `.claude/settings.json` deregisters it; and
no `Bash` write reaches this hook, `rm .claude/.review-stamped` included.
`scripts/test-post-review-edit-lock.sh` § 4 runs the three writes and records
their exit statuses, and reads the registration for the fourth, so the list is
measured rather than believed.
**What the lock does not cover, in the matcher's terms rather than a file's
role.** The hook reuses the classification gate's `IMPL_PATTERNS` list and its
`*test*` / `*spec*` / `*.d.ts` / `*.config.*` skip logic unchanged, and those
patterns match a *substring of the whole path*. Claude Code hands the hook an
absolute path, so the skips reach much further than "a test file, a type
declaration, a config file": `src/latest-news.ts` and `src/respectful.ts` are
skipped for containing `test` and `spec`, so is anything under a `testimonials/`
directory, so is `src/app.config.local.ts`, and so is every file in any repo
checked out beneath a path like `/Users/tester/`. Widening the patterns here
would make the two gates disagree about what "implementation file" means, so
they stay as they are and the consequence is stated: none of those edits is
refused after a review, and a `/pre-merge` re-run, not this hook, is what
covers them.
## Cap
**One fixer pass and one breaker pass per finding, then stop.** Stated here so it
is a property of the skill rather than a habit of the session. The fixer does not
respond to the breaker; the breaker does not re-run against a revised fix. If a
mutation survived and the human wants it addressed, that is a new invocation with
the human's decision behind it. Without the cap this is the fix-review-fix cycle
chrislacey89/skills#253 recorded, with the loop half now also committing.
**Order and concurrency.** The cap says how many times each sub-agent runs; this
says in what order, because leaving that to the session is the same silence the
lock exists to close, one level down. Process the numbers in the order the human
typed them. **Fixers run one at a time, never in parallel** — each edits one
working tree and commits to one branch, so two at once is a race on both, and
"exactly one commit per fix" stops being something either can guarantee. Giving
each fixer its own worktree would trade that race for merge conflicts on exactly
the findings most likely to collide, since findings routinely land in one file
(three of five in one round of chrislacey89/skills#338 landed in `/init-pipeline` § 2); at three to
eight findings that is not a trade worth making.
**A breaker runs only against a fix already committed, and nothing runs
concurrently with a fixer editing the working tree.** Per finding: spawn the
fixer and wait for its verdict; if `fixed` (and Step 1's checks and breaker
rule call for one), spawn the breaker against
`$FIX_SHA` and wait for its verdict; only then start the next finding's fixer.
No two sub-agents are ever in flight together — not two fixers, not a fixer and
a breaker, not two breakers.
This section previously permitted a breaker to run concurrently with the next
fixer, and spent four corrective rounds (6cc84c0, 5272615, 04f9e35, 28aec29)
trying to keep that permission both safe and accurately described: a same-file
comparison before backgrounding a breaker, a cap bounding how long a
backgrounded breaker could stay in flight, and two further rounds correcting
false claims the cap's own text made about its consequences. The cap's own
derivation showed the overlap it was defending had already collapsed: the wait
gate it introduced made every breaker's report a precondition for the next
breaker's start, so no two breakers ever ran concurrently under it regardless
of what the section's lead sentence claimed. Four rounds could not make the
permission and its description agree at the same time. This round removes the
permission instead of patching its description again.
**Say the cost plainly: this is slower.** Wall clock is now fixer time plus
breaker time, summed per finding, with nothing hiding one behind the other. A
breaker's extraction, apparatus validation, mutation, and adversarial reasoning
against a fixer's single commit runs to completion before the next finding's
fixer starts, every time — and the cap's own derivation already showed that,
beyond the second finding, a breaker typically outlived the one fixer it was
allowed to overlap, so the concurrency being given up here was buying less than
it advertised. The trade is worth it regardless: the escape-detection ambiguity
the four prior rounds kept trying to bound — an escaped breaker mutation and a
concurrently-editing fixer's legitimate edit landing in the same file,
indistinguishable to `git status --short` — is not bounded by this change, it
is removed. With no concurrent editor of any kind, Step 3's reconciliation is
exact: any unexplained dirty path after a breaker reports is an escape, full
stop.
## Unattended rounds
**An opt-in exception to the rule that this skill does not select findings.**
After the human has read a `/pre-merge` author-mode review in this session,
they may add `--rounds` to the round-1 findings they name:
`/fix-findings all --rounds`, `/fix-findings 1 3 --rounds`, or the same words
through "Other" in `/pre-merge`'s which-findings follow-up. The fix round, the
`/pre-merge` re-run, and the further fix rounds the cap allows then run
without stopping to ask. The flag is the human's to type: it is never an
option in a menu, never pre-selected, never recommended, and no skill starts
it on its own. It is not `--loop`, which keeps its meaning. It is not
available for threads from `/respond-to-review`, with no `/pre-merge`
author-mode review in this session, or on a run that starts with nobody
present: named there, say so and stop before any fixer starts.
**What each round fixes.** Round 1 fixes exactly the findings the human
named, as any run does. Rounds 2 and 3 fix every Concern the preceding
re-review raised that `/pre-merge` Phase 4's check marked **Supported by the
tree**, and no other finding; `/pre-merge` § Handoff invokes this skill with
the inputs it hands round 1, those Concerns' numbers in place of the human's,
and `--rounds`. A Concern the check could neither confirm nor refute waits on
the human. A refuted one is not a finding. A Concern from a controller-owned
dimension is exempt from that check, so it carries none of its three labels:
the mode does not take it, and it stays open for the human.
Suggestions and Observations are listed and never fixed by the mode. A
Concern from the first review that the human did not name in round 1 stays
open: the human chose not to name it. This is the whole of the selection the
exception allows. The rule is the human's, chosen after reading a review; the
tier is the reviewers', never re-ranked or reconciled; and the model adds no
finding of its own.
**Between rounds nothing is asked.** After every round that made a commit,
unless its full run ends the mode (below), the `/pre-merge` re-run starts,
whether or not something waits on the human, and § Handoff's menu is not
asked. § Handoff's round-count block still runs at the end of every round:
print the `ROUNDS` it sets, and hand that number to the re-run with the
breaker verdicts and outcome lines. While the mode runs, three other
questions are not asked either: the wider-change question (Step 1's
footprint check), the sibling question (Step 3), and `/pre-merge`'s next-step
menu. What would have been asked is recorded as waiting on the human, with
its reason, in Step 3's report and in the readout at the end:
- a fix the footprint check reported `blocked: needs decision`, which stays
reverted;
- a prose claim that needs wording the human supplies: a
`blocked: carries an instruction`, `rejected: carries an instruction` or
`rejected: reworded` finding;
- a finding whose remedy is a change to the spec (the PRD or the slice), which
its fixer reports `blocked`, and any other `blocked` finding;
- a `survived` or `not-run` breaker verdict.
Sibling sites a fixer reported are listed and left for the review. None of
them stops the mode: the rest of the round goes on, and the re-run starts.
Two kinds of round end the mode here, before any re-run. A round that made no
commit, every finding refuted or waiting, ends it with no re-run. Its outcome
lines are listed in the readout; they are on record only if a later
`/pre-merge` run in this session is handed them, as § Handoff's paragraph on
a round that made no commit says, and the mode starts no such run. A round
whose item 5's full run after the last fixer meets either of the two sentences
about the full run in § Handoff's paragraph that starts the re-run without
asking ends it too: no re-run and no further round, because nothing is fixed
on top of that run. That round's findings are listed as waiting on the human,
with the full run's result as the reason.
**Who prints the readout.** Its content is defined once, in `/pre-merge`
§ Handoff, and it is printed once, by whichever skill the mode ends in. When
the mode ends here, in the two cases just above, this skill prints that
readout after Step 3's report, then asks § Handoff's menu as § Handoff says
for that round. When the mode ends after a re-review, `/pre-merge` § Handoff
prints it.
**The cap is three fix rounds**, counted by § Handoff's round-count block:
the `ROUNDS` it sets from the `Fix-Findings-Run:` lines or the sidecar's
fix-run records. So the count survives a restart and includes the rounds the
branch had before the mode started. When `ROUNDS` is 3 or more after a
round that did not end the mode above, that round is still followed by its
`/pre-merge` re-run, and after that
re-run `/pre-merge` § Handoff starts no further round and prints the readout.
It applies the cap to the `ROUNDS` handed to it, never to a count it
remembers. Round 1 is the human's and runs whatever the count. No stop rule
compares one round's count of findings with another's.
**It ends** when a re-review raises no supported Concern, or at the cap, and
before a re-run in the two cases above. After a re-review, `/pre-merge`
§ Handoff then prints the readout and the usual next-step menu. The mode
never merges, never stamps except through `/pre-merge`'s ordinary
stamp, and never opens `/closeout`.
**Reviewer briefs never mention the mode**, its flag, or that further rounds
may follow: a reviewer that knows a loop is running can find less. The
re-run's brief is the one `/pre-merge` Phase 1 step 4 states for any delta
re-run, unchanged.
**The mode lives in the session.** A new session does not resume it: the
human names `--rounds` again, and the round count still applies.
**What does not change.** Unchanged: one fixer pass and one breaker pass per
finding, and a `survived` verdict is never re-fixed; the footprint check;
reviewers' tiers, never re-ranked or reconciled; `/pre-merge --loop`, which
still records and never fixes; Step 3's outcome lines, printed for every
round and recorded as `## Fix Round Outcomes` rows only by a `/pre-merge` run
that is handed them (its *Record a fix round's outcomes* step), as each re-run
the mode starts is; and every run that does not name `--rounds`. Why the pack otherwise keeps the model
from selecting findings, and what this exception has not shown, is
`/pre-merge` Phase 5 § *Why the loop does not fix*.
## Handoff
- **Expected input:** the finding numbers a human chose from a `/pre-merge`
review (in the later rounds of § Unattended rounds, the numbers its rule
takes), or the teammate review threads a human marked **fix** in
`/respond-to-review`, plus the findings themselves (terminal output, the
ledger, or the verbatim threads), on a clean branch that has been reviewed.
- **Produces:** one commit per accepted finding, each authored by a context that
did not write the code under repair; a per-finding breaker verdict, the SHA it
archived, and the command behind it, or the reason none was spawned; `refuted` reports for findings the
tree did not confirm; a revert for any prose-claim fix Step 1 rejected and for any fix its
footprint check blocked, followed by a re-applied commit when the human widened it; and,
for a `blocked` fix that left a `fixup!` commit (Step 1), that commit's SHA
with no breaker verdict; and one outcome line per finding (Step 3). It
produces no stamp, no PR edit, and no merge.
- **Comes next by default:** a re-run of `/pre-merge` in author-mode. It reads
the stamp where [references/state-backend.md](references/state-backend.md)
says it lives (`pre-merge/SKILL.md` Phase 1 step 4), takes the
post-stamp delta — these fix commits — as its subject, runs the review
dimensions on that delta with the tree readable around it, and replaces the
existing stamp at the new head. Hand it the breaker verdicts as evidence, the
finding numbers each commit closes, and Step 3's outcome lines, which it
records (`pre-merge/SKILL.md` Phase 4). Under § Unattended rounds, hand it
the `ROUNDS` the round-count block below set as well. There is no range to
hand it: it derives the range from the stamp, and falls back to the whole
branch in the four states `pre-merge/SKILL.md` Phase 1 step 4 names. Then
`/compound` if a lesson emerged — which commits onto the branch and hands
back for a second re-run over that commit, on the same stamp mechanism — and
then `/closeout`.
**Next-step menu.** This is a branch point, so offer it as a single
`AskUserQuestion` rather than leaving the user to retype a command (see
[references/next-step-menu.md](references/next-step-menu.md)). Which option leads
depends on how many rounds this branch has already had, and that number is read
from the record Step 1 leaves, never recalled: the `Fix-Findings-Run:` lines on
the `github` backend, the sidecar's fix-run records on the `sidecar` backend.
```bash
SC="<this skill's directory>/references/sidecar.sh"
W="<the slice's W-<n> from § Inputs, or empty on the github backend>"
RANGE="$(bash "$SC" range ${W:+"$W"})" || { echo "round count aborted: sidecar.sh range failed" >&2; exit 1; }
case "$(bash "$SC" backend stamp)" in
github)
ROUNDS=$(git log --format=%B "$RANGE" | sed -n 's/^Fix-Findings-Run: //p' | sort -u | wc -l | tr -d ' ') ;;
sidecar)
RUNS=$(bash "$SC" fixrun list "$(git branch --show-current)" --range "$RANGE") \
|| { echo "round count aborted: sidecar.sh fixrun list failed" >&2; exit 1; }
ROUNDS=$(printf '%s\n' "$RUNS" | awk 'NF { print $(2) }' | sort -u | wc -l | tr -d ' ') ;;
*) echo "round count aborted: sidecar.sh backend stamp failed" >&2; exit 1 ;;
esac
```
`range` is the slice's commits when its work item records a start still on
this branch, and the range from `base-ref` otherwise. Both arms count only
what is in that range. Step 1's blame range is a different one, the range
`/pre-merge`'s fold rebases, and Step 1's fixup-target block sets it.
**A round that made no commit did not move `HEAD`.** Its outcome lines are
recorded only if a `/pre-merge` run in this session is handed them, and when
the stamp already names `HEAD`, that run re-reads the whole slice
(`pre-merge/SKILL.md` Phase 1 step 4).
**Below two rounds, when nothing in the round needs a decision, start the
`/pre-merge` re-run without asking the menu**, and print one line saying so:
`Re-running /pre-merge: no finding in this round needs a decision.`
Nothing needs a decision when every finding's outcome in Step 3's outcome
table is `fixed`, `fixed, widened by human`, or `refuted`, and at least one is
not `refuted`; item 5's full run after the last fixer exited 0; no breaker
verdict is `survived` or `not-run`; and none of the run-specific follow-ups
below applies. When that full run did not exit 0, ask the menu. When the runner
printed a count of tests or suites and it is zero, ask the menu. In every other
case, ask the menu as follows. Under § Unattended rounds this menu is not asked
after a round that made a commit unless one of the two sentences about the full
run just above applies; the re-run starts instead, and that section says what
is recorded and where the mode ends.
**Below two rounds**, recommended option first: **→ Re-run `/pre-merge`
(recommended — review the fixes and re-stamp)**, **Fix another finding —
`/fix-findings <numbers>`**, **Stop here — leave the fixes unreviewed on the
branch**; Stop here's description says this round's outcome lines are recorded
only by a `/pre-merge` run in this session that is handed them. **At two or more**, this branch has already been through a fix round
and a re-review, and across three repos the third round found a new
contradiction more often than it closed one (chrislacey89/skills#347 — chrislacey89/skills#345 counted its own
rounds to five before deleting the rule it was patching). Lead with **→ Hand
the remaining findings off as issues (recommended — `/qa` or
`/request-refactor-plan`), then re-run `/pre-merge` on what is here**, then
**Re-run `/pre-merge` — review the fixes and re-stamp**, then **Stop here**.
The count changes the order, not the set: nothing is taken off the menu. What
leads once that re-run has reviewed these fixes, and who chooses the numbers,
is `/pre-merge`'s rule, stated in its § Handoff under *what is still open
decides the menu* and not repeated here. Include a run-specific follow-up when the breaker
returned `survived` or `not-run`: **Show the surviving mutation for finding
N**. Include one when Step 1 rejected a fix as `carries an instruction`:
**Restate finding N as an instruction fix**, naming the code span the fix
would have removed. The platform's free-text "Other" option is the escape hatch — don't add
one.
Print the runtime handoff line either way:
```
**Next session:** /pre-merge
**Input:** branch <branch-name>, carrying the fix commits past the stamp — re-review and re-stamp
```