@soleur/opencode 3.401.0 → 3.401.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ You verify that every new surface is debuggable from a keyboard without SSH or `
26
26
 
27
27
  ### Step 1: Diff inventory
28
28
 
29
- Run `git diff origin/main...HEAD --name-only` and partition into:
29
+ Run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD` and partition its list into (exit 2/127 = inventory unknown: treat every category below as in scope, never as an empty diff):
30
30
 
31
31
  - **Inngest functions**: any file under `apps/web-platform/server/inngest/functions/cron-*.ts` or `*-on-*.ts`
32
32
  - **Server routes / handlers**: `app/api/**/route.ts`, `server/**/*.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.401.0",
3
+ "version": "3.401.2",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -672,8 +672,8 @@ affected_resolve_base || {
672
672
  fi
673
673
  }
674
674
 
675
- # Changed set: committed-vs-base ∪ staged ∪ unstaged ∪ untracked. Rename-aware
676
- # (-M): the new path is what exists on disk. The committed arm is the one that
675
+ # Changed set: committed-vs-base ∪ staged ∪ unstaged ∪ untracked. Rename-free
676
+ # (--no-renames: a rename lists its OLD path too, so a code file moved under docs is not inert; --ignore-submodules=none lists a gitlink hidden by ignore=all). The committed arm is the one that
677
677
  # can fail outright (unresolvable base) — it is captured ONCE: its rc is the
678
678
  # fail-closed probe and its stdout the first leg of the union, so a bad --base
679
679
  # refuses rather than reading as an empty diff and no diff runs twice.
@@ -682,12 +682,12 @@ affected_mktemp changed || finish 4 none mktemp-failed - "$CI_NAME" - - -; CHANG
682
682
  _base_rc=0
683
683
  # -c core.quotePath=false: without it git emits non-ASCII paths C-quoted
684
684
  # ("dir/\303\251.txt"), which never matches a glob and misses the file system.
685
- _base_diff="$(git -c core.quotePath=false diff --name-only -M "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
685
+ _base_diff="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
686
686
  if (( _base_rc != 0 )); then
687
687
  if [[ "$(git rev-parse --is-shallow-repository 2>/dev/null || true)" == "true" ]]; then
688
688
  affected_timeout 60 git fetch --no-tags --deepen=200 >/dev/null 2>&1 || true
689
689
  _base_rc=0
690
- _base_diff="$(git -c core.quotePath=false diff --name-only -M "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
690
+ _base_diff="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
691
691
  fi
692
692
  if (( _base_rc != 0 )); then
693
693
  finish 4 none no-base-ref - "$CI_NAME" - - -
@@ -700,9 +700,9 @@ fi
700
700
  # (reason=census-degraded), the same contract as an empty diff — never a silent
701
701
  # narrow, never a refusal for a recoverable shape.
702
702
  _census_rc=0
703
- _leg_staged="$(git -c core.quotePath=false diff --name-only --cached -M -- 2>/dev/null)" \
703
+ _leg_staged="$(git -c core.quotePath=false diff --name-only --cached --no-renames --ignore-submodules=none -- 2>/dev/null)" \
704
704
  || _census_rc=$?
705
- _leg_unstaged="$(git -c core.quotePath=false diff --name-only -M -- 2>/dev/null)" \
705
+ _leg_unstaged="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none -- 2>/dev/null)" \
706
706
  || _census_rc=$?
707
707
  _leg_untracked="$(git -c core.quotePath=false ls-files --others --exclude-standard 2>/dev/null)" \
708
708
  || _census_rc=$?
@@ -1164,6 +1164,40 @@ want_rc 0 "D2: mixed diff exits 0 via real selection"
1164
1164
  want_no_out "D2: mixed diff is never inert" 'NO_TESTS_AFFECTED'
1165
1165
  want_call "D2: the code file was selected" 'related.*util\.ts'
1166
1166
 
1167
+ # D2r [rename-away]: `git mv src/a.ts docs/a.md` under default rename detection lists
1168
+ # only the destination (inert docs) and exits NO_TESTS_AFFECTED although a code file
1169
+ # left the tree; --no-renames lists the OLD path too, so the diff is no longer inert.
1170
+ R_RENC="$(mk_repo rename-away-committed)"; seed_js "$R_RENC"; seal_base "$R_RENC"
1171
+ mkdir -p "$R_RENC/docs"
1172
+ assert_fixture_dir "$R_RENC"; git -C "$R_RENC" mv src/a.ts docs/a.md
1173
+ git -C "$R_RENC" commit -q -m "move code under docs"
1174
+ reset_fakes; run_gate "$R_RENC" gate
1175
+ want_no_out "D2r: a committed code->docs rename is never inert" 'NO_TESTS_AFFECTED'
1176
+ R_RENS="$(mk_repo rename-away-staged)"; seed_js "$R_RENS"; seal_base "$R_RENS"
1177
+ mkdir -p "$R_RENS/docs"
1178
+ assert_fixture_dir "$R_RENS"; git -C "$R_RENS" mv src/a.ts docs/a.md
1179
+ reset_fakes; run_gate "$R_RENS" gate
1180
+ want_no_out "D2r: a staged code->docs rename is never inert" 'NO_TESTS_AFFECTED'
1181
+
1182
+ # D2g [hidden gitlink]: under a .gitmodules `ignore = all` a plain diff omits a gitlink
1183
+ # change, so README.md + a bumped submodule pointer read as docs-only and exit
1184
+ # NO_TESTS_AFFECTED. --ignore-submodules=none lists the gitlink, so the diff is not inert.
1185
+ R_GL="$(mk_repo gitlink-hidden)"; seed_js "$R_GL"; seal_base "$R_GL"
1186
+ assert_fixture_dir "$R_GL"
1187
+ printf '[submodule "sub"]\n\tpath = sub\n\turl = ./nowhere\n\tignore = all\n' > "$R_GL/.gitmodules"
1188
+ printf 'readme\n' > "$R_GL/README.md"
1189
+ git -C "$R_GL" add .gitmodules README.md
1190
+ git -C "$R_GL" update-index --add --cacheinfo 160000,1111111111111111111111111111111111111111,sub
1191
+ git -C "$R_GL" commit -q -m "gitlink base"
1192
+ git -C "$R_GL" update-ref refs/remotes/origin/main HEAD
1193
+ mkdir -p "$R_GL/sub"
1194
+ printf 'readme two\n' > "$R_GL/README.md"
1195
+ git -C "$R_GL" add README.md
1196
+ git -C "$R_GL" update-index --cacheinfo 160000,2222222222222222222222222222222222222222,sub
1197
+ git -C "$R_GL" commit -q -m "bump sub and readme"
1198
+ reset_fakes; run_gate "$R_GL" gate
1199
+ want_no_out "D2g: README.md plus a hidden gitlink bump is never inert" 'NO_TESTS_AFFECTED'
1200
+
1167
1201
  # D3 [G1-1]: the native selector returns nothing for a code diff → full fallback,
1168
1202
  # never a zero-test green. rc 0 is acceptable ONLY with mode=full and a named
1169
1203
  # reason; rc 4 is an acceptable loud refusal.
@@ -2478,6 +2512,6 @@ unset _kind _rc _of _xfail _badword
2478
2512
 
2479
2513
  # Floor = the full count less a little slack for the rows that
2480
2514
  # depend on a host binary (jq): it is a floor, so a deleted block of rows reddens it.
2481
- print_results "${AFFECTED_TESTS_MIN_ASSERTIONS:-496}"
2515
+ print_results "${AFFECTED_TESTS_MIN_ASSERTIONS:-499}"
2482
2516
 
2483
2517
 
@@ -30,3 +30,4 @@ e68d1cc2ce56c3e60c6ed939172ef19d83bcb85a606ae8442934898e873941e3 2026-08-16 in
30
30
  5130360de005d5534dfab73ad5fb1af8dd8a196c72e97eb1eb08d17ceb7facbe 2026-09-30 model moved to claude-sonnet-5-5
31
31
  45fdc5c5e0060d8ced95d64688061dc567beba1329a9323b6b6a7817ecdd2895 2026-10-05 adds the github_token input (needed for OIDC) and moves the action pin forward
32
32
  58377282013228a6bd5bbf1a9d647ee2710622711efa58710999b3c46585a1da 2026-11-05 moves the action pin to the Bun 1.4.4 pair
33
+ 1afd3b5ab6254dc0c42cc8d29fb06ef718943eb1422e318ea5b5d6fa260f0c43 2026-11-09 changed-path enumeration adds --no-renames --ignore-submodules=none (rename into scope and gitlinks no longer unseen)
@@ -157,7 +157,7 @@ jobs:
157
157
  # NUL-delimited so any filename survives. Out-of-scope edits are still enumerated
158
158
  # here so the allowlist below can ABORT on them (never silently ship a partial fix).
159
159
  git add -A
160
- mapfile -d '' changed < <(git diff --cached --name-only -z)
160
+ mapfile -d '' changed < <(git diff --cached --no-renames --ignore-submodules=none --name-only -z)
161
161
  if [ "${#changed[@]}" -eq 0 ]; then
162
162
  echo "::notice::no changed files — nothing to deliver"; exit 0
163
163
  fi
@@ -116,7 +116,7 @@ is the closed operator-only list:
116
116
  the `<flag>-orgs` segment membership in `flag-list --json`.
117
117
  1. **LLM-free behaviour in trigger paths** (the conversation-in-rail flow): run the harness
118
118
  yourself with the `postmerge` Phase 5.5 step 2 command. Or read CI's verdict, but only from
119
- a run created AFTER the flip: `bash plugins/soleur/scripts/deploy-arm.sh find --wait
119
+ a run created AFTER the flip: `bash plugins/soleur/scripts/deploy-arm.sh find --wait 25
120
120
  <full-merge-sha>` prints `ARM=<digits>` (`ARM=none` or a skipped deploy means nothing ran),
121
121
  then `gh run view <digits> --json jobs,createdAt` for the `live-verify` job and `gh run view
122
122
  --job <id> --log` for its `RESULT:` line. **Only `RESULT: PASS` counts.** A green job is not
@@ -11,7 +11,7 @@
11
11
  * bun plugins/soleur/skills/frontend-anti-slop/scripts/tier1-scan.ts \
12
12
  * [--paths <file-or-glob> ...] [--dry-run|--json] [--rule <id>]
13
13
  *
14
- * Default paths: `git diff --name-only --cached --diff-filter=AMR` filtered to
14
+ * Default paths: `git diff -z --no-renames --ignore-submodules=none --name-only --cached --diff-filter=AMR` filtered to
15
15
  * `apps/web-platform/(app|components)/**\*.(tsx|jsx|css)` AND
16
16
  * `apps/web-platform/server/**\*.(ts|tsx)` AND
17
17
  * `plugins/soleur/docs/**\*.(njk|css)`.
@@ -27,6 +27,7 @@
27
27
  * 1 — bad CLI / parse error / IO error, OR ≥ 1 blocking finding (a finding whose
28
28
  * originating rule is `category === "brand" && severity === "high"`).
29
29
  * See `computeExitCode`. Non-brand and brand-below-high findings remain advisory.
30
+ * 2 — the default staged-path read (`git diff --cached`) failed: scope is unknown, not empty.
30
31
  *
31
32
  * Per-file rule disable: `anti-slop:disable RULE_ID reason="..."` — matched as
32
33
  * a literal substring, so any comment form works (JSX, HTML, CSS block, line).
@@ -246,22 +247,33 @@ const DEFAULT_PATH_RE_SOURCE =
246
247
  "^(apps/web-platform/(app|components)/.*\\.(tsx|jsx|css)|apps/web-platform/server/.*\\.(ts|tsx)|plugins/soleur/docs/.*\\.(njk|css))$";
247
248
 
248
249
  function defaultPaths(): string[] {
249
- try {
250
- const p = Bun.spawnSync(
251
- ["git", "diff", "--name-only", "--cached", "--diff-filter=AMR"],
252
- { cwd: REPO_ROOT, stdout: "pipe", stderr: "pipe" },
250
+ // SELECT reader feeding a `^`-anchored scope regex. `-z` keeps a name git would C-quote (non-ASCII, tab) exact;
251
+ // `--no-renames` lists a rename as D+A so the NEW path is scanned; `--ignore-submodules=none` is the family-wide
252
+ // flag. A git failure THROWS (main() exits 2): the old `[]` read as "no frontend files in scope" at exit 0.
253
+ const p = Bun.spawnSync(
254
+ [
255
+ "git",
256
+ "diff",
257
+ "-z",
258
+ "--no-renames",
259
+ "--ignore-submodules=none",
260
+ "--name-only",
261
+ "--cached",
262
+ "--diff-filter=AMR",
263
+ ],
264
+ { cwd: REPO_ROOT, stdout: "pipe", stderr: "pipe" },
265
+ );
266
+ if (p.exitCode !== 0) {
267
+ throw new Error(
268
+ `git diff --cached failed (exit ${p.exitCode}): ${new TextDecoder().decode(p.stderr).trim()}`,
253
269
  );
254
- if (p.exitCode !== 0) return [];
255
- const out = new TextDecoder().decode(p.stdout);
256
- const all = out
257
- .split("\n")
258
- .map((p) => p.trim())
259
- .filter(Boolean);
260
- const re = new RegExp(DEFAULT_PATH_RE_SOURCE);
261
- return all.filter((p) => re.test(p));
262
- } catch {
263
- return [];
264
270
  }
271
+ const all = new TextDecoder()
272
+ .decode(p.stdout)
273
+ .split("\0")
274
+ .filter((n) => n.length > 0);
275
+ const re = new RegExp(DEFAULT_PATH_RE_SOURCE);
276
+ return all.filter((n) => re.test(n));
265
277
  }
266
278
 
267
279
  function isContainedInRepo(abs: string): boolean {
@@ -475,10 +487,18 @@ function main() {
475
487
  }
476
488
  }
477
489
 
478
- const candidatePaths =
479
- args.paths.length > 0
480
- ? expandPaths(args.paths)
481
- : expandPaths(defaultPaths());
490
+ let rawPaths: string[] = args.paths;
491
+ if (rawPaths.length === 0) {
492
+ try {
493
+ rawPaths = defaultPaths();
494
+ } catch (err) {
495
+ // Unknown, never "nothing in scope": a failed staged-path read must not look like a clean scan. Only
496
+ // the git read is caught here; an expandPaths IO error keeps its own (uncaught, exit 1) contract.
497
+ console.error(`[tier1-scan] cannot list the staged paths: ${(err as Error).message}`);
498
+ process.exit(2);
499
+ }
500
+ }
501
+ const candidatePaths: string[] = expandPaths(rawPaths);
482
502
 
483
503
  if (candidatePaths.length === 0) {
484
504
  if (args.json) {
@@ -176,7 +176,7 @@ CRITICAL: You MUST output the ## Session Summary section in EXACTLY the format a
176
176
 
177
177
  **Parse subagent output and write session-state.md:**
178
178
 
179
- After the subagent returns, **verify the subagent stayed in scope**: run `git diff origin/main...HEAD --name-only` and confirm only files under `knowledge-base/project/{plans,specs}/` were modified. **Bare-repo stale-ref guard:** the local `origin/main` ref can lag the actual main HEAD, making the three-dot diff list files from unrelated already-merged branches — a false scope-breach signal. If the diff shows files you never touched, re-diff against the branch's actual base SHA (`git diff <base-sha>..HEAD --name-only`, where `<base-sha>` is the fresh branch's parent) or `git fetch origin main` first, before concluding the subagent breached scope. **Why:** #4587 — stale `origin/main` listed an unrelated feature's files; recovery was a re-diff against the verified base SHA. If files outside that prefix were touched (workflow YAML, source code, CHANGELOG, etc.), the subagent exceeded its plan-only mandate — the Session Summary's "Decisions" became statements of intent rather than fact. Read each out-of-scope file from disk and reconcile against the plan's claims before trusting Step 3 onward; do NOT trust the Session Summary's reconciliation narrative ("Adopted the on-disk output text", "Already applied as uncommitted local changes") without verifying via `git diff <file>` first. **Why:** #3937 — plan-deepen subagent committed source-code edits AND its Session Summary claimed on-disk text it had not actually written (`pre-recorded` vs prescribed `not applicable`), costing two reconciliation commits. See [[2026-05-17-planning-subagent-exceeded-scope-and-summary-vs-disk-drift]].
179
+ After the subagent returns, **verify the subagent stayed in scope**: run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD` and confirm every listed path matches `^knowledge-base/project/(plans|specs)/`; exit 2/127 = scope unverified: treat as a breach and re-diff, never as in scope. **Bare-repo stale-ref guard:** the local `origin/main` ref can lag the actual main HEAD, making the three-dot diff list files from unrelated already-merged branches — a false scope-breach signal. If the diff shows files you never touched, re-diff against the branch's actual base SHA (the same helper on `<base-sha>..HEAD`, where `<base-sha>` is the fresh branch's parent) or `git fetch origin main` first, before concluding the subagent breached scope. If files outside that regex were touched (workflow YAML, source code, CHANGELOG, etc.), the subagent exceeded its plan-only mandate — the Session Summary's "Decisions" became statements of intent rather than fact. Read each out-of-scope file from disk and reconcile against the plan's claims before trusting Step 3 onward; do NOT trust the Session Summary's reconciliation narrative ("Adopted the on-disk output text", "Already applied as uncommitted local changes") without verifying via `git diff <file>` first. **Why:** #3937 — plan-deepen subagent committed source-code edits AND its Session Summary claimed on-disk text it had not actually written (`pre-recorded` vs prescribed `not applicable`), costing two reconciliation commits. See [[2026-05-17-planning-subagent-exceeded-scope-and-summary-vs-disk-drift]].
180
180
 
181
181
  After the subagent returns, check for a `## Session Summary` heading in the output. In both arms, after that arm writes session-state.md, Read [operator-constraints.md](${CLAUDE_PLUGIN_ROOT}/skills/one-shot/references/operator-constraints.md) and append the brief's `## Operator Constraints`; later writes only append.
182
182
 
@@ -113,10 +113,10 @@ curl -sf --max-time 10 "<production-url>/health" | jq .
113
113
 
114
114
  Use `/health` (the public, middleware-/CSP-bypassed health route returning `{"status":"ok","version","build_sha","supabase","sentry",...}`), NOT `/api/health` — the latter is an authenticated API route that 307-redirects an unauthenticated probe to `/login`, so `curl -sf` fails and `HEALTH_VERIFIED` is left `false` even when production is healthy. For this repo, `build_sha` is judged by `deploy-arm.sh` below.
115
115
 
116
- **This repo (`web-platform-release.yml` present):** identify the deploy and what production serves, with literal arguments (no command substitution) and the FULL 40-hex merge sha (a short one matches nothing, #8135). First wait for `find` — it polls about once a minute for up to 120 polls and prints one line; watch it with the harness poller (**Claude:** Monitor tool, matching `^ARM=`; **Grok:** AwaitShell), never Bash `run_in_background`. Only once that line has arrived with rc ≠ 4, run `served`:
116
+ **This repo (`web-platform-release.yml` present):** identify the deploy and what production serves, with literal arguments (no command substitution) and the FULL 40-hex merge sha (a short one matches nothing, #8135). First wait for `find` (one line); watch it with the harness poller (**Claude:** Monitor tool, matching `^ARM=`, bounded and re-armed per Phase 2's Monitor rules; **Grok:** AwaitShell), never Bash `run_in_background` or a foreground call. Only once a final line has arrived, run `served`:
117
117
 
118
118
  ```bash
119
- bash plugins/soleur/scripts/deploy-arm.sh find --wait <full-merge-sha>
119
+ bash plugins/soleur/scripts/deploy-arm.sh find --wait 25 <full-merge-sha>
120
120
  bash plugins/soleur/scripts/deploy-arm.sh served <full-merge-sha>
121
121
  ```
122
122
 
@@ -247,7 +247,7 @@ selector that returned another merge's arm, or none, while the real arm had depl
247
247
  - `exact` + `success` → `GATE-VALIDATED`. `descendant` + `success` → `GATE-VALIDATED (via <DEPLOYED_SHA>, run <ARM>)`.
248
248
  - `DEPLOY=skipped` → `GATE-NOT-EXERCISED`: the arm clean-skipped (docs-only; `CI=failure` → `ci_not_green`) — the `workflow_run` trigger inherits neither `on.push.paths` nor `check_changed` (ADR-217). Neither a failure nor a validation; the watch stays open until a merge that deploys.
249
249
  - `DEPLOY=superseded|blocked` → `GATE-INDETERMINATE — <DEPLOY>` (lock-queue cancellation; a resolve/migrate/verify job failed).
250
- - `DEPLOY=blocked` from `resolve-target`: read its reason, which the annotation carries (job outputs are not readable through the API): `gh run view <ARM> --json jobs --jq '.jobs[] | select(.name=="resolve-target") | .databaseId'`, then `gh api repos/jikig-ai/soleur/check-runs/<id>/annotations --jq '.[].message'` and match `[skip_reason=<reason>]`. For `release_run_missing` or `github_api_unavailable` (a lookup failure, not a broken release) recover yourself: `gh run rerun <ARM> --failed` once, then re-arm `deploy-arm.sh find --wait`; if it fails the same way, wait ~15 minutes and retry once more. Never re-run the push-arm run. Any other reason (`release_failed`, `identity_mismatch`, `schema_mismatch`, …) is not a re-run case — report it.
250
+ - `DEPLOY=blocked` from `resolve-target`: read its reason, which the annotation carries (job outputs are not readable through the API): `gh run view <ARM> --json jobs --jq '.jobs[] | select(.name=="resolve-target") | .databaseId'`, then `gh api repos/jikig-ai/soleur/check-runs/<id>/annotations --jq '.[].message'` and match `[skip_reason=<reason>]`. For `release_run_missing` or `github_api_unavailable` (a lookup failure, not a broken release) recover yourself: `gh run rerun <ARM> --failed` once, then re-arm `find --wait 25`; if it fails the same way, wait ~15 minutes and retry once more. Never re-run the push-arm run. Any other reason (`release_failed`, `identity_mismatch`, `schema_mismatch`, …) is not a re-run case — report it.
251
251
  - rc 2/3 `ARM=none` (incl. `timeout`, `error`) → `GATE-INDETERMINATE — <REASON> <CAUSE>`: absence of evidence, never a pass. rc 4 → still pending; poll.
252
252
  - `descendant` + `failure` → `GATE-SUSPECT`: list `git log --oneline <merge>..<DEPLOYED_SHA>` beside this PR's gate diff — the failure may be the later merge's, so do not recommend an immediate revert.
253
253
  - `exact` + `failure` with a canary/sandbox rollback reason AND this PR changed gating logic: **suspect the gate, not the app.** A gating check that diverged from production reality (e.g. a synthetic probe that does not match what runs in prod) blocks every deploy. Recommended action: **revert the gating change immediately** (it is unvalidated by definition — its first real deploy rolled back), restore the prior known-good gate, and re-deploy; investigate the probe separately and re-introduce it NON-BLOCKING per `wg-dark-launch-deploy-gates`. Report `GATE-SUSPECT — revert recommended` and surface it at the top of the Phase 7 report.
@@ -579,6 +579,15 @@ arithmetic is `NET = FILED - EXEMPT - CLOSING`, and "opens more issues than it
579
579
  closes" is the *default* failure, not an invariant. Review findings are covered
580
580
  by neither exit: the disposition for those is fix-inline (below), and reaching
581
581
  for an override instead is the behaviour both gates exist to stop.
582
+ The gate counts a filed issue in any state (`--state all`) and reads `CLOSING`
583
+ only from close keywords (`Closes`/`Fixes`/`Resolves #N`) in the PR body, so
584
+ closing a filing on GitHub does not lower `NET` (and a mandated filing loses its
585
+ exemption once it is not OPEN). Write the exit when you file, not at ship
586
+ (PR #12645): for an override-class filing, the override marker and its
587
+ justification line in the PR body; for a mandated filing, `Mandated-By:
588
+ <rule-id>` on its own line of the issue body (the rule tagged
589
+ `[mandates-filing]` in `AGENTS.rules.md`), a `Tracks|Refs #N` line in the PR
590
+ body, and the issue left OPEN.
582
591
 
583
592
  **Mechanical pre-CONCUR auto-flip:**
584
593
 
@@ -54,12 +54,15 @@ Fix commits are the least-audited surface in the pipeline (learnings 2026-09-23,
54
54
  2. **Seat set per fix round:** `{seats that reported the findings these commits close} ∪ {path-mapped seats} ∪ {conditional seats}`, resolved mechanically:
55
55
 
56
56
  ```bash
57
- bash <plugin-root>/skills/review/scripts/fix-round-seats.sh \
58
- --files "$(git diff --name-only "$PANEL_SHA"..HEAD)" \
59
- --finding-seats <seats from the dedup ledger>
57
+ files=$(bash <plugin-root>/scripts/changed-paths.sh "$PANEL_SHA"..HEAD) || files=unknown # unknown (exit 2/127): skip the script, spawn the full class panel
58
+ if [ "$files" = unknown ]; then echo 'fix diff unverifiable: spawn the full class panel'; else
59
+ bash <plugin-root>/skills/review/scripts/fix-round-seats.sh \
60
+ --files "$files" \
61
+ --finding-seats <seats from the dedup ledger>
62
+ fi
60
63
  ```
61
64
 
62
- The script's path→seat map is the single source for both consumers: it also defines the `none`-tier trigger-gating predicates (the seat fires iff the diff touches a path its map arm covers). Add `soleur:engineering:review:security-sentinel` whenever the fix diff touches `SENSITIVE_PATH_RE` — that arm is mechanical — OR adds guard/deny-shaped lines, which is lead judgment (the script maps paths only). A source-touching fix never resolves to zero seats — the script emits the `soleur:engineering:review:code-quality-analyst` floor on unmatched source paths, and lists them on stderr as `unmapped-paths:`; an empty fix diff emits nothing (`note: empty fix diff` on stderr) and legitimately spawns zero seats. Pass `--files` from the fix commits' own range (`git diff $PANEL_SHA <last-fix-sha>`), never `$PANEL_SHA..HEAD` after a merge of `origin/main`: the merge's files are other people's changes, and on #10285 they turned a 9-file fix round into a 147-file seat resolution.
65
+ If `files` is `unknown` the fix diff is unverifiable: do not pass it to the script (it would read as one source path); spawn the full class panel. The script's path→seat map is the single source for both consumers: it also defines the `none`-tier trigger-gating predicates (the seat fires iff the diff touches a path its map arm covers). Add `soleur:engineering:review:security-sentinel` whenever the fix diff touches `SENSITIVE_PATH_RE` — that arm is mechanical — OR adds guard/deny-shaped lines, which is lead judgment (the script maps paths only). A source-touching fix never resolves to zero seats — the script emits the `soleur:engineering:review:code-quality-analyst` floor on unmatched source paths, and lists them on stderr as `unmapped-paths:`; an empty fix diff emits nothing (`note: empty fix diff` on stderr) and legitimately spawns zero seats. Pass `--files` from the fix commits' own range (`git diff $PANEL_SHA <last-fix-sha>`), never `$PANEL_SHA..HEAD` after a merge of `origin/main`: the merge's files are other people's changes, and on #10285 they turned a 9-file fix round into a 147-file seat resolution.
63
66
  3. **Report-only spawn** against `git diff $PANEL_SHA..HEAD` — the FIX diff, not the branch diff. **Tally (#9403):** fix-round seats are review seats — `gate seats <N>` (N = the resolved seat count) before dispatch and `incr seats <N>` after, on the branch ledger; a `STOP` verdict is the classified-stop path (write `status: budget-capped` + `budget-capped: seats=<n>/<cap>` to the feature's `session-state.md` and halt — do not silently shrink the round).
64
67
  4. **Cap two targeted rounds.** A third needed round escalates to the full class panel over the cumulative fix diff — an unbounded targeted loop is the treadmill this mechanism exists to prevent.
65
68
  When a round's findings against a pin test are SIBLING shapes of the last round's, the defect is the test's claim, not its coverage: rule its contract (what it guards, what it leaves open) and state the residuals in its header before fixing more shapes; a later shape inside a stated residual is recorded as "covered by R<n>". **Why:** #12348/PR #12561 — three rounds each re-found "a prior step or the env replaces what the gate runs"; stating the residuals (plus two class fixes) let the final pass terminate. See `knowledge-base/project/learnings/2026-11-11-each-fix-round-found-the-next-sibling-until-the-test-stated-its-residuals.md`.
@@ -23,7 +23,7 @@ description: "This skill should be used when preparing a feature for production
23
23
  **You own merge through production verification — never ask the operator to monitor.**
24
24
 
25
25
  1. Phase 7: poll PR merge to `MERGED` (auto-merge queue, BEHIND sync, required-check failure exit).
26
- 2. **After merge — gate on the SERVED sha, not a run's conclusion:** wait for the **deploy arm** (`bash plugins/soleur/scripts/deploy-arm.sh find --wait <full-merge-sha>` — never `head_sha=` alone, #8492; the push arm only builds) until `find` prints a final line (rc ≠ 4) — `DEPLOY=success` → require `CI=success` and `deploy-arm.sh served <merge>` → `CONTAINS` before ANY post-deploy action (cron trigger, marker read, live-verify); `skipped` → nothing deployed, go to step 3; any other `DEPLOY`/`ARM=none` → step 3 reports it. Job *presence* discriminates nothing (the push arm lists `deploy` as `skipped`). Predicate + bash: `postmerge/SKILL.md` Phase 3.7; topology: Phase 7 "RETIRED by #5806 / ADR-217". Run post-merge from a detached `origin/main` worktree (`git fetch origin main && git -C "$(git rev-parse --git-common-dir)/.." worktree add --detach .worktrees/postmerge-<PR> origin/main`), never the feature worktree — `cleanup-merged` reaps it once its lease lapses (#8136). **Why:** #8276 — push arm green, a production cron fired against the previous build, 50 min polling for a marker it could not emit. Arming a Monitor: [monitor-hygiene.md](./references/monitor-hygiene.md).
26
+ 2. **After merge — gate on the SERVED sha, not a run's conclusion:** wait for the **deploy arm** (`bash plugins/soleur/scripts/deploy-arm.sh find --wait 25 <full-merge-sha>` — never `head_sha=` alone, #8492; the push arm only builds) until `find` prints a final line (rc ≠ 4) — `DEPLOY=success` → require `CI=success` and `deploy-arm.sh served <merge>` → `CONTAINS` before ANY post-deploy action (cron trigger, marker read, live-verify); `skipped` → nothing deployed, go to step 3; any other `DEPLOY`/`ARM=none` → step 3 reports it. Job *presence* discriminates nothing (the push arm lists `deploy` as `skipped`). Predicate + bash: `postmerge/SKILL.md` Phase 3.7; topology: Phase 7 "RETIRED by #5806 / ADR-217". Run post-merge from a detached `origin/main` worktree (`git fetch origin main && git -C "$(git rev-parse --git-common-dir)/.." worktree add --detach .worktrees/postmerge-<PR> origin/main`), never the feature worktree — `cleanup-merged` reaps it once its lease lapses (#8136). **Why:** #8276 — push arm green, a production cron fired against the previous build, 50 min polling for a marker it could not emit. Arming a Monitor: [monitor-hygiene.md](./references/monitor-hygiene.md).
27
27
  3. Step 3.8: invoke `soleur:postmerge <PR-number>` (Grok) or `soleur:postmerge` (Claude) **before** Step 4 cleanup.
28
28
  4. **FORBIDDEN:** Ending the session at merge, at a red release run you did not investigate, or with "want me to watch CI?"
29
29
  5. **Harness polling:** `plugins/soleur/lib/harness.ts` → `pollInstructions()` — Claude uses **Monitor tool**; Grok uses **AwaitShell** (`pattern` for `MERGED`, `BEHIND detected`, `auto-sync.*pushed`, `\[ship\.phase7\.`, `\[pr-behind-sync\] kind=`, `postmerge verification complete`) or blocking Shell with `block_until_ms`.
@@ -893,8 +893,8 @@ echo 'SOLEUR_RULE_APPLIED rule=wg-record-recurring-vendor-expense-before-ready n
893
893
  **Detection.** A recurring-vendor-cost signal fires when the change introduces any of: a new dependency in a `package.json` that the agent judges to be a *paid* vendor (`git diff origin/main...HEAD -- '*package.json' | grep -E '^\+'`), a new vendor credential env var (added `*_API_KEY`/`*_TOKEN`/`*_SECRET` lines in `.env.example` or Doppler-write steps), or a plan-tier string in the PR body. Capture the PR body and **strip fenced code blocks** before grepping — this gate body and the AGENTS rule quote `Pro`/`subscription`/`upgrade`, which inside ``` fences MUST NOT count. The block below is **self-contained**: it captures + strips the body itself rather than depending on the Undeferred Operator-Step Gate's `$PR_BODY_FILE` (defined later in this file — running these blocks in document order would otherwise leave it unset and the grep would silently no-op). Bash ERE has no `(?i)` — use `grep -iE`.
894
894
 
895
895
  ```bash
896
- # (a) Is the ledger already touched in this same change? If so the gate is satisfied.
897
- LEDGER_TOUCHED=$(git diff origin/main...HEAD --name-only | grep -c 'knowledge-base/operations/expenses.md' || true)
896
+ # (a) Ledger edited in this change? Exact path only; `unknown` (exit 2/127) is NOT an edit.
897
+ ledger_touched=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^knowledge-base/operations/expenses\.md$' --diff-filter=AMT origin/main...HEAD) || { [ $? -eq 1 ] || ledger_touched=unknown; }
898
898
 
899
899
  # (b) Capture + fence-strip the PR body (self-contained; fail CLOSED on an
900
900
  # unbalanced ``` so an unclosed fence cannot silently drop the rest of the body).
@@ -909,13 +909,13 @@ printf '%s' "$PR_BODY" | awk '
909
909
  # (c) Vendor-cost keyword scan over the fence-stripped body. Intentionally a
910
910
  # BROAD keyword match (NOT list-anchored like the Undeferred gate) — a PR often
911
911
  # describes a subscription in prose, not a bullet, so over-detection is preferred
912
- # here; false positives are absorbed by the LEDGER_TOUCHED branch and the
912
+ # here; false positives are absorbed by the ledger_touched branch and the
913
913
  # operator-attestation override below.
914
914
  SIGNAL_RE='(^|[^a-z])[Pp]ro\b|subscription|upgrade|paid[[:space:]]+tier|\$[0-9]+(\.[0-9]+)?/mo'
915
915
  SIGNAL=$(grep -niE "$SIGNAL_RE" "$PR_BODY_FILE" || true)
916
916
  ```
917
917
 
918
- **Rule.** If a vendor-cost signal fires (plan-tier string, new paid dependency, or new vendor credential) AND `LEDGER_TOUCHED` is `0`, the change MUST carry a `(Tracks|Refs) #NNNN` companion pointing at an OPEN `type/chore` issue whose body contains the `deferred-automation` sentinel — the operator-driven-billing branch (same verification loop as the Undeferred Operator-Step Gate: state OPEN + label `type/chore` + sentinel). Absent both the ledger edit and a valid tracked follow-up, the gate is **triggered**.
918
+ **Rule.** If a vendor-cost signal fires (plan-tier string, new paid dependency, or new vendor credential) AND `ledger_touched` is not exactly `knowledge-base/operations/expenses.md` (`unknown` fires the gate), the change MUST carry a `(Tracks|Refs) #NNNN` companion pointing at an OPEN `type/chore` issue whose body contains the `deferred-automation` sentinel — the operator-driven-billing branch (same verification loop as the Undeferred Operator-Step Gate: state OPEN + label `type/chore` + sentinel). Absent both the ledger edit and a valid tracked follow-up, the gate is **triggered**.
919
919
 
920
920
  **If not triggered:** Skip silently (no signal, or the ledger was edited in this change, or a valid tracked follow-up exists).
921
921
 
@@ -978,7 +978,7 @@ For each `crit_ref`, check `gh issue view <N> --json labels --jq '.labels[].name
978
978
 
979
979
  ### Counsel-Review CLO-Attestation Gate
980
980
 
981
- **Trigger:** the diff touches `docs/legal/`, `plugins/soleur/docs/pages/legal/` or `knowledge-base/legal/`, AND the referenced plan declares `brand_survival_threshold: single-user incident` or an added line in those directories carries a `[DRAFT — pending CLO/counsel review` marker. The reviewing authority is the `soleur:legal:clo` agent, not the operator. If it triggers, read [counsel-review-clo-attestation.md](./references/counsel-review-clo-attestation.md) now and follow it; otherwise skip silently.
981
+ **Trigger:** the diff touches `docs/legal/`, `plugins/soleur/docs/pages/legal/` or `knowledge-base/legal/`, AND the referenced plan declares `brand_survival_threshold: single-user incident` or an added line in those directories carries a `[DRAFT — pending CLO/counsel review` marker. The reviewing authority is the `soleur:legal:clo` agent, not the operator. If it triggers, read [counsel-review-clo-attestation.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/counsel-review-clo-attestation.md) now and follow it; otherwise skip silently.
982
982
 
983
983
  ### Deploy Pipeline Fix Drift Gate
984
984
 
@@ -1296,7 +1296,7 @@ esac
1296
1296
  **Meta-case — the PR's subject IS this gate.** Available in **both** modes. Proceed **without**
1297
1297
  a PIR only when ALL THREE hold:
1298
1298
 
1299
- 1. `git diff --name-only origin/main...HEAD` touches
1299
+ 1. `list=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD)` lists
1300
1300
  [scripts/ship-incident-pir-gate.sh](../../../../scripts/ship-incident-pir-gate.sh),
1301
1301
  [scripts/ship-incident-pir-gate-mutation.test.sh](../../../../scripts/ship-incident-pir-gate-mutation.test.sh),
1302
1302
  `plugins/soleur/test/ship-incident-pir-gate.test.ts`,
@@ -1304,9 +1304,7 @@ esac
1304
1304
  `plugins/soleur/skills/ship/scripts/ship-pir-action-items-gate.sh`,
1305
1305
  `plugins/soleur/test/ship-pir-action-items-gate.test.sh`, or
1306
1306
  `plugins/soleur/test/fixtures/ship-pir-action-items/`.
1307
- 2. **Every** changed path is one of those, or
1308
- [scripts/test-all.sh](../../../../scripts/test-all.sh), or a
1309
- `knowledge-base/project/{plans,specs,brainstorms,learnings}/` artifact. If this file is also
1307
+ 2. **Every** path in `$list` is one of those, the test-all script or a `knowledge-base/project/{plans,specs,brainstorms,learnings}/` artifact: `LC_ALL=C grep -vE '^(scripts/(ship-incident-pir-gate(-mutation\.test)?|test-all)\.sh|plugins/soleur/(test/(ship-incident-pir-gate\.test\.ts|ship-pir-action-items-gate\.test\.sh|fixtures/(ship-incident-pir-gate|ship-pir-action-items)/.*)|skills/ship/scripts/ship-pir-action-items-gate\.sh)|knowledge-base/project/(plans|specs|brainstorms|learnings)/.*)$' <<<"$list"` prints nothing. Exit 2/127 from the helper = unknown = not contained: take the PIR path above. If this file is also
1310
1308
  changed, **every hunk** of `git diff -U0 origin/main...HEAD -- plugins/soleur/skills/ship/SKILL.md`
1311
1309
  must land inside this Phase 5.5 section — a section is not a path, so without that check
1312
1310
  conjunct 2 cannot tell a Phase 5.5 edit from a rewrite of the merge gate below it.
@@ -1315,13 +1313,11 @@ esac
1315
1313
  body is itself part of the haystack, so "no production outage occurred" makes the gate fire
1316
1314
  on the declaration exempting it (measured). "No live event took place" does not.
1317
1315
 
1318
- **Why conjuncts 2 and 3 exist — verified in both directions, not asserted.** Issue #7242 ("Web
1319
- Platform Release blocked at the zot mirror … prod is 3 releases behind") was a real production
1320
- delivery outage; the PR that fixed it, #7244 (commit `d31d8a2c7`), **edited the gate script**
1321
- — adding the `releases? behind` alternation — *and* shipped a post-mortem in the same commit.
1322
- Conjunct 1 alone would have exempted it. Conjunct 2 rejects it **without consulting any
1323
- declaration**, because that commit also touches `.github/workflows/reusable-release.yml`,
1324
- [scripts/zot-mirror-diagnosis.sh](../../../../scripts/zot-mirror-diagnosis.sh) and a runbook.
1316
+ **Why conjuncts 2 and 3 exist (verified both ways).** #7242 was a real production delivery outage;
1317
+ its fix PR #7244 (commit `d31d8a2c7`) edited the gate script *and* shipped a post-mortem, so
1318
+ conjunct 1 alone would have exempted it. Conjunct 2 rejects it without consulting any
1319
+ declaration: the commit also touches `.github/workflows/reusable-release.yml`,
1320
+ a diagnosis script and a runbook.
1325
1321
 
1326
1322
  **The named residual, because conjunct 2's tempting universal form is false.** *"A PR fixing this
1327
1323
  gate because of a production event necessarily touches the thing that broke"* holds for #7244 and
@@ -1330,13 +1326,9 @@ esac
1330
1326
  regression in it can satisfy conjuncts 1 and 2 while owing a PIR. Conjunct 3 is the only thing
1331
1327
  standing there, and it is a self-attestation.
1332
1328
 
1333
- A fourth, mechanical conjunct was tried and REJECTED on measurement: *"the gate must not signal
1334
- on the PR's own added `knowledge-base/` artifacts, read alone."* It voids the exemption for
1335
- essentially every PR in this class, including the one that introduced the arm — a plan ABOUT an
1336
- incident gate is necessarily dense with outage vocabulary, so it signals whether or not any
1337
- event occurred. It therefore cannot separate the residual case from the ordinary one, and a
1338
- conjunct that no legitimate user can satisfy is a gate that gets bypassed rather than met.
1339
- Measured on this PR: the plan and `tasks.md` both signal; `session-state.md` does not.
1329
+ A fourth conjunct (the gate must not signal on the PR's own added `knowledge-base/` artifacts)
1330
+ was REJECTED on measurement: a plan ABOUT an incident gate is dense with outage vocabulary, so it
1331
+ voids the exemption for nearly every PR in this class and gets bypassed.
1340
1332
 
1341
1333
  Conjunct 3 remains because 1 and 2 are necessary and not sufficient, and a false declaration is
1342
1334
  then a deliberate, recorded act. Note the honest limit: unlike `[ack-destroy]`, which is pinned
@@ -1607,7 +1599,7 @@ Run `echo 'SOLEUR_RULE_APPLIED rule=hr-technical-fork-is-not-an-operator-questio
1607
1599
 
1608
1600
  ### ADR-Ordinal Collision Gate (mandatory)
1609
1601
 
1610
- **Trigger:** the branch adds a NEW `ADR-NNN-*.md`. Run `git fetch origin main -q && bash scripts/check-adr-ordinals.sh`; exit 0 passes silently. On exit 1 for an ADR this branch introduced (a sibling PR claimed the ordinal mid-pipeline), read [adr-ordinal-collision.md](./references/adr-ordinal-collision.md) and follow it: renumber to `max + 1` after a fresh fetch, sweep every reference (code and deny strings included), re-run the check, push. Re-run the check after any Phase 6.5 / Phase 7 sync whose merge output lists `knowledge-base/engineering/architecture/decisions/`.
1602
+ **Trigger:** the branch adds a NEW `ADR-NNN-*.md`. Run `git fetch origin main -q && bash scripts/check-adr-ordinals.sh`; exit 0 passes silently. On exit 1 for an ADR this branch introduced (a sibling PR claimed the ordinal mid-pipeline), read [adr-ordinal-collision.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/adr-ordinal-collision.md) and follow it: renumber to `max + 1` after a fresh fetch, sweep every reference (code and deny strings included), re-run the check, push. Re-run the check after any Phase 6.5 / Phase 7 sync whose merge output lists `knowledge-base/engineering/architecture/decisions/`.
1611
1603
 
1612
1604
  ## Phase 6.4: Unpushed-Commits Gate
1613
1605
 
@@ -1664,15 +1656,15 @@ If an issue number is found, store it as `ISSUE_NUMBER` for use in the PR body b
1664
1656
  # matches nothing (verified: `close[sd]?.*after` MATCHES, `close[sd]?\b.*\bafter\b` does NOT).
1665
1657
  # A \b here makes this gate catch zero lines while reading as if it works.
1666
1658
  CLOSE_DEFER_RE='close[sd]?.*(after|once|when)|closes-after-apply|manual close after|close manually|post-merge.*(close|verif)'
1667
- PLAN_REFS=$(git diff --name-only origin/main...HEAD | grep -E 'knowledge-base/project/(plans|specs)/' || true)
1668
- [[ -n "$PLAN_REFS" ]] && grep -inE "$CLOSE_DEFER_RE" $PLAN_REFS | head -5
1659
+ plan_refs=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^knowledge-base/project/(plans|specs)/' origin/main...HEAD) || { [ $? -eq 1 ] || plan_refs=unknown; }
1660
+ [[ $plan_refs == unknown ]] && echo 'unverifiable: use Ref #N' || { [[ -n $plan_refs ]] && tr '\n' '\0' <<<"$plan_refs" | xargs -0 grep -inE -e "$CLOSE_DEFER_RE" -- | head -5; }
1669
1661
  ```
1670
1662
 
1671
- Any hit ⇒ use **`Ref #N`**, not `Closes #N`, and close the issue yourself after the proof lands (`gh issue close N --comment "<live evidence>"`). Over-detection is deliberate and cheap here: a spurious hit costs one re-read of the keyword; a miss closes an issue whose work is not done.
1663
+ Any hit or `unverifiable` (exit 2/127) ⇒ use **`Ref #N`**, not `Closes #N`, and close the issue yourself after the proof lands (`gh issue close N --comment "<live evidence>"`). Over-detection is deliberate and cheap here: a spurious hit costs one re-read of the keyword; a miss closes an issue whose work is not done.
1672
1664
 
1673
1665
  Match the SHAPE (a close verb + an ordering word), not the canonical phrasing. The grep is wider than [work/SKILL.md](../work/SKILL.md)'s prose list ("Closes-after-apply", "manual close after", …) because a plan rarely uses those exact words — it writes *"close #N only **after** Phase 4.5 passes"*, where the markdown bold also defeats any regex that expects `after` to be followed by a space.
1674
1666
 
1675
- **Why this lives here and not only in `work`:** the rule was already documented in `work/SKILL.md` §Common Pitfalls, but `soleur:ship` Phase 6 is where the PR body is actually written — a rule that fires in a different skill than the action it governs cannot catch anyone. #6537 proved it: `tasks.md` 7.6 said *"`gh issue close 6537` only **after** Phase 4.5 passes"*, the body shipped `Closes #6537`, and the merge closed the issue while the monitor it was filed about was **still paused**. The issue had to be reopened post-merge. Recording an observability gap as handled while it silently alarms nobody is that issue's own defect, reproduced by the PR fixing it.
1667
+ **Why this lives here and not only in `work`:** `soleur:ship` Phase 6 is where the PR body is written, so a rule living only in another skill cannot catch it. #6537: `tasks.md` said *"`gh issue close 6537` only **after** Phase 4.5 passes"*, the body shipped `Closes #6537`, and the merge closed the issue while its monitor was still paused.
1676
1668
 
1677
1669
  ### Auto-Close Keyword Pre-Creation Scan (#3407)
1678
1670
 
@@ -2541,7 +2533,7 @@ Each meaningful event (first iteration, every state change, heartbeat every 3rd
2541
2533
 
2542
2534
  The sync is capped at `MAX_BEHIND_SYNCS=6` per poll, so a pathological BEHIND→BEHIND→BEHIND (every sync triggering a new commit on main) cannot spend the whole `MAX_POLL_MIN`-minute budget making no progress. After 6 syncs the loop emits a `BEHIND budget exhausted` warning naming the elapsed time, then falls through to heartbeat — the PR may still merge if main calms down, but the diagnosis lands at the inflection point rather than at the timeout. At `fetch_failures=6/6` it names a network/credential failure instead of a fast-moving main.
2543
2535
 
2544
- **ADR-ordinal collision after a sync.** A BEHIND auto-sync can pull a sibling's newly-landed `ADR-NNN-*.md` into the branch and collide with this branch's ADR at the same ordinal; the required `guards-ruleset` check catches it on the PR (the poll's required-check exit names it), but nothing renumbers for you. After an auto-sync whose `git merge origin/main` output lists `knowledge-base/engineering/architecture/decisions/`, re-run `bash scripts/check-adr-ordinals.sh` before the next merge attempt, and on `NEW ADR ordinal collision` follow [adr-ordinal-collision.md](./references/adr-ordinal-collision.md) ("Phase 7 half").
2536
+ **ADR-ordinal collision after a sync.** A BEHIND auto-sync can pull a sibling's newly-landed `ADR-NNN-*.md` into the branch and collide with this branch's ADR at the same ordinal; the required `guards-ruleset` check catches it on the PR (the poll's required-check exit names it), but nothing renumbers for you. After an auto-sync whose `git merge origin/main` output lists `knowledge-base/engineering/architecture/decisions/`, re-run `bash scripts/check-adr-ordinals.sh` before the next merge attempt, and on `NEW ADR ordinal collision` follow [adr-ordinal-collision.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/adr-ordinal-collision.md) ("Phase 7 half").
2545
2537
 
2546
2538
  **Settle-then-admin-merge escape hatch (zero-conflict-surface changes only).** When the poll prints `[ship.phase7.hatch_check]` (2 BEHIND syncs pushed) or `[ship.phase7.behind_exhausted]`, read [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) now and follow it if this branch's own diff touches nothing but docs, skills and regenerable indexes; otherwise stay on the normal path. Any `--admin` merge, whether through this hatch or authorized by the operator, requires `"${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh" <PR> <sha>` to exit 0 immediately before it and `--match-head-commit <sha>` on the merge; `gh pr checks --required` is not a substitute, because it cannot see a required check that has not been created yet (#8458, #8500). An operator-authorized merge on a BEHIND PR whose prior head was green is NOT limited to zero-conflict-surface diffs, but it still goes through the gate via `--green-sha <prior-green-sha>` (the reference's "was-green carryover" section, which also covers `--allow-local-merge`); UNTRUSTED-CI / DIRTY still refuse.
2547
2539
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Moved verbatim out of `ship/SKILL.md` Phase 5.5 to stay under the SKILL.md body ceiling (ADR-229); SKILL.md keeps the trigger and a load directive.
4
4
 
5
+ **Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
6
+
5
7
  Blocks PR-ready when the branch adds a NEW `ADR-NNN-*.md` whose ordinal `NNN` is already taken on `origin/main` by a DIFFERENT file. The ordinal was free when the ADR was authored at plan/brainstorm time, but a sibling PR claimed it during the pipeline. A collision cannot reach `main` through the queued auto-merge (the `--admin` hatch in Phase 7 bypasses the whole `required_status_checks` rule, which is why its step 2 exists): `guards-ruleset` is the required status check (its `adr-ordinals` member step runs the gate — renamed #12089) and `main` is strict-up-to-date, so a sibling's ADR arriving through a Phase 7 sync reds the PR's `adr-ordinals` member and the poll loop's required-check-failure exit stops there (Phase 7, "ADR-ordinal collision after a sync", cites the SSOT). This gate is defense-in-depth: catching the collision at PR-ready costs one commit, while catching it in Phase 7 costs a sync plus a full CI cycle (the ~35-minute figure the settle paragraph measures), and a renumber done inside the poll loop is the one most likely to leave the plan/tasks sweep undone.
6
8
 
7
9
  **Detection.** Run the canonical sentinel named on the Trigger line in `ship/SKILL.md` (fetch `origin/main` first, run from the branch root).
@@ -30,7 +32,12 @@ Blocks PR-ready when the branch adds a NEW `ADR-NNN-*.md` whose ordinal `NNN` is
30
32
 
31
33
  **That `knowledge-base/`-scoped sweep is necessary but NOT sufficient — an ADR ordinal
32
34
  can be cited from CODE.** Sweep the branch's whole diff, then classify each hit:
33
- `for f in $(git diff --name-only origin/main...HEAD); do [[ -f $f ]] && grep -Hn 'ADR-<old>' "$f"; done`.
35
+
36
+ ```bash
37
+ files=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD) || files=$(git ls-files) # list unknown (exit 2/127): sweep every tracked file, never an empty list
38
+ while IFS= read -r f; do [[ -f $f ]] && grep -Hn -- 'ADR-<old>' "$f"; done <<< "$files"
39
+ ```
40
+
34
41
  Hits in a hook, a script or a test are the dangerous ones — an ADR reference inside a
35
42
  runtime **deny reason string** ships to the agent (or the operator) pointing at whatever
36
43
  unrelated ADR now holds that ordinal. Check the CLAUSE LABEL too: a provisional ADR
@@ -2,13 +2,14 @@
2
2
 
3
3
  Moved verbatim out of `ship/SKILL.md` Phase 5.5 to stay under the SKILL.md body ceiling (ADR-229); SKILL.md keeps the trigger and a load directive.
4
4
 
5
+ **Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
6
+
5
7
  **The reviewing authority for legal-doc attestation is the `soleur:legal:clo` agent, NOT the human operator.** The Soleur user is a non-lawyer founder; deferring legal sign-off to them bottlenecks indefinitely and mis-allocates expertise (the `soleur:legal:clo` agent orchestrates `soleur:legal:legal-compliance-auditor` + `soleur:legal:legal-document-generator` and can cross-check prose against statute and against the implementing migration in one cycle). This is symmetric to how `soleur:plan` routes CPO sign-off to the CPO agent. See `knowledge-base/project/learnings/workflow-patterns/2026-05-18-clo-attestation-auto-route-instead-of-human-task.md` (the operator has corrected human-routed legal sign-off ≥3×).
6
8
 
7
9
  **Trigger:** the PR diff touches a legal-doc directory AND the change is legal-attestation-bearing:
8
10
 
9
11
  ```bash
10
- legal_touch=$(git diff main...HEAD --name-only \
11
- | grep -E '^(docs/legal/|plugins/soleur/docs/pages/legal/|knowledge-base/legal/)' | head -n 1)
12
+ legal_touch=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^(docs/legal/|plugins/soleur/docs/pages/legal/|knowledge-base/legal/)' origin/main...HEAD) || { [ $? -eq 1 ] || legal_touch=unknown; }
12
13
  # Scope the marker grep to legal-doc dirs ONLY — otherwise it self-fires on
13
14
  # this gate's own prose in ship/SKILL.md or on spec/tasks.md that quotes the
14
15
  # literal descriptively (false positive).
@@ -21,6 +22,7 @@ if [[ -n "$sui_plan" && -f "$sui_plan" ]]; then
21
22
  sui_threshold=$(grep -E '^brand_survival_threshold:\s*single-user incident' "$sui_plan" || true)
22
23
  fi
23
24
  # Gate fires when legal docs changed AND (single-user-incident OR a DRAFT marker is present)
25
+ # legal_touch=unknown (helper exit 2/127: diff unverifiable) counts as touched, so the gate fires; it never skips.
24
26
  ```
25
27
 
26
28
  **If triggered (`legal_touch` non-empty AND (`sui_threshold` OR `draft_marker` non-empty)):**
@@ -9,3 +9,5 @@ Moved out of `ship/SKILL.md` Phase 7 to stay under the SKILL.md body ceiling (AD
9
9
  **The cause is almost always `--limit` truncation, not the branch filter — CORRECTED 2026-09-17 after measurement.** An earlier revision blamed `--branch main --commit <sha>` and prescribed dropping `--branch` — FALSE mechanism, no-op remedy: `gh run list` with and without `--branch` returned identical counts on two `main` commits (every run, `push` included, carries `headBranch: main`). What actually happens: newest-first ordering under a `--limit`, so on a busy commit the release runs are crowded off the end by unrelated `issues`/`issue_comment` traffic (measured: `--limit 100` → `push=0`, `--limit 300` → `push=8` of 131). Raise the limit, paginate, or filter `--event push` / `--event workflow_run`; dropping `--branch` under the same limit rebuilds the identical watcher. **Why:** #8233 — a release watch reported 10 release runs then 0, one poll short of declaring a deploy settled over nothing.
10
10
 
11
11
  **Run every POST-merge Monitor with its shell in a detached `origin/main` worktree (step 2 of the merge → deploy protocol at the top of `ship/SKILL.md`) or `/var/tmp`, never `cd`'d into the feature worktree.** The pre-merge Phase 7 poll in `ship/SKILL.md` is the exception: its BEHIND arm pushes the checked-out PR branch, so it runs from the PR worktree (from a detached HEAD it reports `kind=detached_head` and stops). After the merge any session's `cleanup-merged` can reap that worktree, and a monitor `cd`'d into it dies with `fatal: Unable to read current working directory`. **Why:** #8136 — the #8074 release watch died this way while the release was red.
12
+
13
+ **A watch lasts at most 30 minutes, so a longer wait is a chain of bounded watches.** Arm each with `timeout_ms: 1800000` (the default is 5 minutes) and give the watched command a bound meant to fit inside it (an overrun lands on the interrupted re-arm below). A read-only poll such as `deploy-arm.sh find` may run as the watch's own command: this is not hosting, because the deploy runs in GitHub Actions and `find` only reads it, so killing it loses nothing. Give it `find --wait 25 <full-merge-sha>` and re-arm a fresh watch when the line starts with `ARM=none REASON=timeout` (the 25 polls ran out), when it is `ARM=none REASON=error CAUSE=interrupted` (the watch expired and killed the call), or when the watch ends with no line, up to 5 times; any other line is final. After the fifth, report the deploy as unconfirmed and do not run `served`. Never run `find --wait` as a foreground Bash call: the default 120 polls can wait about two hours, past the Bash tool's 600 s cap. **Why:** PR #12645 — a foreground `find --wait` was killed at the Bash timeout (learning `knowledge-base/project/learnings/2026-11-11-a-census-keyed-on-the-client-name-missed-every-call-split-across-lines.md`, error 18).
@@ -14,11 +14,13 @@ When the local battery was deferred or refused (rc 4 or 6) and CI is draft-light
14
14
  ```bash
15
15
  bash "${CLAUDE_PLUGIN_ROOT}/test/fixture-relative-assert.test.sh"
16
16
  bash "${CLAUDE_PLUGIN_ROOT}/test/fixture-env-adoption.test.sh"
17
- bash .claude/hooks/grep-q-pipe-guard.test.sh
17
+ bash "$(git rev-parse --show-toplevel)/.claude/hooks/grep-q-pipe-guard.test.sh"
18
18
  python3 "${CLAUDE_PLUGIN_ROOT}/scripts/lint-ratchet.py" ruff --check
19
- (cd apps/web-platform && bunx tsc --noEmit && bunx vitest run test/repo-wide-containment.test.ts)
19
+ git fetch --no-tags --quiet origin main && python3 "$(git rev-parse --show-toplevel)/scripts/lint-skill-body-budget.py" --base "$(git merge-base origin/main HEAD)"
20
+ (cd apps/web-platform && bunx tsc --noEmit && bunx vitest run test/repo-wide-containment.test.ts test/plugin-root-anchoring.test.ts)
20
21
  ```
21
22
 
23
+ - Run the guards above on the head you ready, after the last review-fix commit, even when the battery ran and passed on an earlier head. A pass taken earlier says nothing about a row added since; `grep-q-pipe-guard.test.sh` sweeps every extension in its `SWEEP_EXTS`, not only test files. **Why:** PR #12645 — a review-fix commit the night before ready added a `producer | grep -q` row, and the ready run's CI was the first thing to fail on it (learning `knowledge-base/project/learnings/2026-11-11-a-census-keyed-on-the-client-name-missed-every-call-split-across-lines.md`, error 15).
22
24
  - Read CodeQL's open alerts even though it is not a required check: `gh api --paginate 'repos/{owner}/{repo}/code-scanning/alerts?ref=refs/pull/PR_NUMBER/merge&state=open&per_page=100' --jq '.[] | "\(.number) \(.rule.id) \(.most_recent_instance.location.path)"'` (no output: none open).
23
25
 
24
26
  **Why:** #12518 — eight repo-wide guards fired on a new spike tree, the orphan-suite lint had been red on two draft runs unread, and four red heads followed ready. See `knowledge-base/project/learnings/2026-11-11-a-deferred-battery-and-a-draft-light-ci-left-the-repo-wide-guards-for-the-ready-run.md`.
@@ -27,13 +27,13 @@ done
27
27
  **Trigger it at 2 BEHIND syncs pushed on a branch WHOSE OWN DIFF touches nothing but docs, skills and regenerable indexes — not at the 6-sync cap.** Keyed on your diff, not on the conflicts you happened to hit, because those are different sets and only one of them is checkable. A branch carrying real code plus a regenerated index can conflict *so far* only on the index and still have genuine semantic surface; the loop also never prints a conflict surface at sync 2, since the only sync that reaches 2 is a clean one (a conflicting `git merge origin/main` aborts and breaks on the first occurrence). So classify the branch, which you can do in one command:
28
28
 
29
29
  ```bash
30
- git fetch -q origin main && files="$(git diff --name-only origin/main...HEAD)" && [[ -n "$files" ]] \
31
- && ! printf '%s\n' "$files" | grep -vE '^(knowledge-base/|docs/|plugins/soleur/skills/|.*\.md$)' \
32
- | grep -vE '^knowledge-base/(INDEX\.md|kb-(tags|categories)\.txt)$' >/dev/null \
30
+ git fetch -q origin main && files="$(set -o pipefail; git diff -z --no-renames --ignore-submodules=none --name-only origin/main...HEAD | tr '\n\0' '?\n')" && [[ -n "$files" ]] \
31
+ && ! printf '%s\n' "$files" | LC_ALL=C grep -vE '^(knowledge-base/|docs/|plugins/soleur/skills/|.*\.md$)' \
32
+ | LC_ALL=C grep -vE '^knowledge-base/(INDEX\.md|kb-(tags|categories)\.txt)$' >/dev/null \
33
33
  && echo "hatch-eligible" || echo "NOT eligible — stay on the normal path"
34
34
  ```
35
35
 
36
- It fails closed: a failed fetch or diff, or an empty diff, prints `NOT eligible`. On a `NOT eligible` diff, an admin-merge is a merge-authority decision that only the operator makes, never the agent, and if the operator authorizes one, steps 2 to 5 still apply verbatim; stay on the normal path meanwhile (#8474 ran about eight syncs this way; see `knowledge-base/project/learnings/2026-06-02-auto-merge-livelock-fast-moving-main.md` §Recurrence).
36
+ It fails closed: a failed fetch or diff, or an empty diff, prints `NOT eligible`; both greps run under `LC_ALL=C` because in a UTF-8 locale grep treats a line holding an invalid-UTF-8 byte as binary, prints nothing to stdout, and the second filter then reads "no offending path"; `tr` turns a newline inside a name into `?` so the name stays ONE line (split into fragments, each could pass the allowlist while the real path does not). On a `NOT eligible` diff, an admin-merge is a merge-authority decision that only the operator makes, never the agent, and if the operator authorizes one, steps 2 to 5 still apply verbatim; stay on the normal path meanwhile (#8474 ran about eight syncs this way; see `knowledge-base/project/learnings/2026-06-02-auto-merge-livelock-fast-moving-main.md` §Recurrence).
37
37
 
38
38
  The observation point is the poll's `[ship.phase7.hatch_check] 2 BEHIND syncs pushed` line, printed once, when the second sync is actually pushed — an attempt that failed at fetch or was a no-op (`kind=noop`) does not count, so `auto-sync attempt 2/6` alone is not the trigger.
39
39
 
@@ -9,8 +9,8 @@
9
9
  # --mode start (default; no change needs to exist yet) or merge (a change must exist and the
10
10
  # starting point must be readable, otherwise exit 2)
11
11
  # --pr this change's number (default: read from `gh pr view`)
12
- # --files the files this change touches, space-separated (default: git diff --no-renames
13
- # --name-only origin/main...HEAD)
12
+ # --files the files this change touches, space-separated (default: git diff -z --no-renames
13
+ # --ignore-submodules=none --name-only origin/main...HEAD, so odd names read exactly)
14
14
  # --vehicle the change a CTO ruling designated to carry the work. Taken from this flag ONLY, never
15
15
  # parsed out of prose. `this` means THIS change is the vehicle (usable before a change
16
16
  # exists).
@@ -220,11 +220,11 @@ if [ "$FILES_SET" -eq 1 ]; then
220
220
  set +f
221
221
  else
222
222
  [ "$BASE_OK" -eq 1 ] || cannot_check "I could not read which files this change touches"
223
- OWN_FILES="$(git diff --no-renames --name-only origin/main...HEAD 2>/dev/null)" # mut:norenames
223
+ OWN_FILES="$(set -o pipefail; git diff -z --no-renames --ignore-submodules=none --name-only origin/main...HEAD 2>/dev/null | tr '\0' '\n')" # mut:norenames
224
224
  rc=$?
225
225
  [ "$rc" -eq 0 ] || cannot_check "I could not read which files this change touches"
226
226
  fi
227
- OURS_JSON="$(printf '%s\n' "$OWN_FILES" | jq -R -s -c "$JQ_DEFS"' split("\n") | map(select(length > 0 and (noise | not))) | unique')" \
227
+ OURS_JSON="$(printf '%s\n' "$OWN_FILES" | jq -R -s -c "$JQ_DEFS"' split("\n") | map(clean | select(length > 0 and (noise | not))) | unique')" \
228
228
  || cannot_check "I could not read which files this change touches"
229
229
  NOURS="$(printf '%s' "$OURS_JSON" | jq 'length')"
230
230
  NEED=2