diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md
index bb16c1f..5ecd879 100644
--- a/.claude/memory/journal.md
+++ b/.claude/memory/journal.md
@@ -661,3 +661,4 @@ rules:
## 2026-10-27
- Phase 0 split STEP 6: opus/xhigh review 0 Critical 2 Important 8 Minor (extract rc 0 on failed rewrite; `###` granularity for faunosteo = 0b decision, TODO) → 0b59687, re-review 0 open, make test all GREEN. Capitalized BDR-128, LRN-232/233, EVAL-051. Next: doc-sync, merge on user go; user step still pending: `claude mcp remove -s user higgsfield`.
+- /feat rules-h3-extract (feature/rules-h3-extract): extract takes `'### title'`, sections --depth 3, split S4/S0 rows; 3 lenses SOLID/CONCERNS(2)/CONCERNS(1) + confirmation FATAL(2) (LC_COLLATE glob order, re-emission leaked to ##) → r3; feater DONE 116/116; GATE 0 MET; verifier ECARTS(1 floor: SC2016 suppression) → CONFORME 8/8; auditor PASS (3 pre-existing MEDIUM queued); ab5049e. LRN-234. Merge on user go, then 0b.
diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md
index 0a5c7b0..0578dba 100644
--- a/.claude/memory/learnings.md
+++ b/.claude/memory/learnings.md
@@ -249,6 +249,7 @@ rules:
| LRN-227 | 2026-10-23 | Root-commit author ≠ name the user remembers: check `git log --max-parents=0`; every root email the user ever used goes in `claude.identity` | code-origin claims, identity lists |
| LRN-232 | 2026-10-27 | Path rules load inside sub-agents (agent_id in hook log); a "does X load" proof prompt must name the Read tool call | per-repo split pass, any load proof |
| LRN-233 | 2026-10-27 | Bash under pipefail: head after producer = rc 141, blanked PATH hides bash (rc 127), unchecked mktemp+rewrite chain = rc 0 with source unchanged; compgen -G no braces, dotglob over-matches, globstar skips symlinks under ** | any bash lib with pipes, temp files, globs |
+| LRN-234 | 2026-10-27 | Bash glob order follows LC_COLLATE, make test pins no locale: tests count or name files, never assert a listing; a new-case behaviour fix is gated on the case and proven by an old-vs-new differential on real files | any test listing a dir; any change to a lib with an existing output contract |
---
@@ -1917,3 +1918,7 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
## LRN-233 — Bash under pipefail: `head` after a producer, blanked PATH, unchecked temp-file rewrite
- **Context**: `lib/project-rules.sh` 2026-10-26, caught by plan challenger r2 + opus review after 2 sonnet reviews. (1) `compgen -G '**/*' | head -3` → producer SIGPIPE on > pipe buffer of hits, pipeline rc 141 under `pipefail`. (2) `PATH=/nonexistent bash hook.sh` → rc 127: blank PATH applies to the lookup of `bash` itself. (3) `tmp=$(mktemp); f > "$tmp" && cat "$tmp" > src` unchecked → `TMPDIR=/nonexistent` gives rc 0, "moved" printed, src unchanged (I/O failure path untested by 5 reviewers). (4) `compgen -G`: no brace expansion; dotglob matches dotfiles the engine skips; globstar never descends a symlink met under `**` (`top/link/**` finds, `top/**` misses).
- **Apply**: a bounded reader after a producer is awk, reads to the end: `awk 'NR <= 3 { print } END { exit NR == 0 }'`. `"$BASH"` when PATH is blanked in a test. `tmp=$(mktemp) || return 2`; rewrite as `if ! { f > "$tmp" && cat "$tmp" > src; }; then rm -f "$tmp" "$out"; return 2; fi` (SC2015 forbids `a && b || c`). Plan Review Focus: one failure-path test per file-rewriting function (`TMPDIR=/nonexistent`, `chmod a-w`; root ignores chmod). One glob per extension; test names say what they prove (a guard the final `exit 0` swallows is unobservable). Links [[BDR-128]], [[LRN-096]].
+
+## LRN-234 — Glob order follows LC_COLLATE; gate a new-case fix on the case, prove the old contract by differential
+- **Context**: feat rules-h3-extract 2026-10-27. Confirmation challenger ran the planned suite under en_US.UTF-8: `printf '%s ' *` gave `sub2.md sub.md `, want `sub.md sub2.md ` (punctuation ignored in UTF-8 collation; C order differs). `make test` (Makefile) pins no `LC_ALL`. Same pass: `###` separator re-emission written as `RLENGTH - 1 < lvl` also fired for `##` ended by an H1 → 5 of 2,162 `##` extracts on this repo's md files changed vs develop, against the immutable REQUEST "`##` behaviour unchanged"; the suite (T7-T13) stayed green either way.
+- **Apply**: a test never asserts a glob listing order: count (`printf '%s\n' * | wc -l`), name files, or pin `LC_ALL=C` in the recipe. A fix for a new case is gated on that case (`lvl == 3 && …`) so the existing contract stays byte-identical, and the proof is an old-vs-new differential on real inputs (every `##` of every tracked md), not the suite alone. Also: a `# shellcheck disable` in a diff trips the floor guard unless the contract authorizes it; build the offending literal instead (`printf '\140\140\140'` for backticks). Links [[LRN-233]], [[BDR-128]], [[LRN-096]].
diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md
index 2f3eff3..e9ae187 100644
--- a/.claude/tasks/TODO.md
+++ b/.claude/tasks/TODO.md
@@ -22,7 +22,8 @@ Shared rules for every phase:
- [ ] User step: `claude mcp remove -s user higgsfield` (user-scope MCP, no toggle ownership, no doctor check; phase 5 `.mcp.json` owns it).
- [ ] Phase 2 folds: narrow the pre-commit `.claude/**` exemption so a rules-only commit cannot land on develop/main (deferred 2026-10-26).
- [ ] **Phase 0b, per-repo pass** (after phase 0 merges; via `/onboard split`, one `chore/claude-md-split` per repo off develop, approval per repo, never an automatic merge; `/context` before/after in that repo's journal). Order by size: faunosteo 52,322 chars (on feature/v1-1-clients-animals with 5 dirty files: finish or stash first, S1 refuses otherwise), zenquality 23,378, game 14,918 (on feature/replay-hint), robin_petier 12,895, config 4,990, integration_alphalink 4,249. None has `.claude/rules/` yet; all use the `.claude/*` file form (BDR-003). Sections a sub-agent needs stay always-on unless the phase 0 sub-agent proof says path rules load there (proof 2026-10-26: they do; verify per repo).
- - [ ] Before faunosteo: decide `###` granularity (STEP 6 review 2026-10-26). Its path-bound content (i18n, Schemas, Stores, PDF, Supabase, Storage, 12.6 KB) sits in `###` subsections of the always-on `## Project conventions`; `##`-only extract moves ~1.5% of the file. Option: `extract` accepts a `###` heading (section ends at the next heading of the same or higher level), `sections --depth 3`. User decides; `game` also has a `'` in `## 4. POINTS D'ATTENTION…` (S4 refuses it until renamed, or extract by index).
+ - [x] Before faunosteo: `###` granularity shipped 2026-10-27 (feature/rules-h3-extract ab5049e: `extract '### title'`, `sections --depth 3`, split rows `###
`). Was: decide `###` granularity (STEP 6 review 2026-10-26).
+ - [ ] /hotfix after 0b, lib/project-rules.sh `extract` (security gate 2026-10-27, pre-existing, non-blocking): check the `> "$out"` group and `mkdir -p` rc before rewriting `$src` (today a failed rule write still removes the section, rc 0); `[ -e "$out" ] || [ -L "$out" ]` and refuse `..`/absolute ``; onboarder S0.3 says `####x` is a bare title but the lib rejects it (align the prose). Its path-bound content (i18n, Schemas, Stores, PDF, Supabase, Storage, 12.6 KB) sits in `###` subsections of the always-on `## Project conventions`; `##`-only extract moves ~1.5% of the file. Option: `extract` accepts a `###` heading (section ends at the next heading of the same or higher level), `sections --depth 3`. User decides; `game` also has a `'` in `## 4. POINTS D'ATTENTION…` (S4 refuses it until renamed, or extract by index).
- [ ] **Phase 4a, memory v2 write side: shell, no mod** (shrunk 2026-10-25: the measured recall channels never read Meta; the measured status bug is a reconcile parser bug)
- Facts 2026-10-24 (scratchpad memeval, 434 entries): registries ~1M chars, never in always-on context, read only by /feat /bugfix /ship-feature (analyze-before-plan); Index drift 6 rows; status in 3 places (title tag, body Status line, Index column) → reconcile false-open BLK-032..034; no single writer (Edit needs a Read of a 357k file, so real writes are ad hoc python/bash); 8 projects on this machine hold v1 registries. Verified 2026-10-25: `lib/reconcile.sh:60-67` drops the entry's OWN header while BLK-032..034 carry `[resolved]` there (the false-open); nothing machine-reads `## Index` (analyze-before-plan.md:42, reconcile.sh:9, test T1); 1 of 1,290 entries across the 8 projects above a 1% accent ratio.
diff --git a/.claude/tasks/contracts/2026-10-27-rules-h3-extract-1326.md b/.claude/tasks/contracts/2026-10-27-rules-h3-extract-1326.md
new file mode 100644
index 0000000..b2e089d
--- /dev/null
+++ b/.claude/tasks/contracts/2026-10-27-rules-h3-extract-1326.md
@@ -0,0 +1,38 @@
+# CONTRACT — rules-h3-extract
+- date: 2026-10-27 | flow: feat | branch: feature/rules-h3-extract (off develop 925dafa)
+- status: active
+
+## REQUEST (verbatim — IMMUTABLE)
+lib/project-rules.sh: `extract` accepts a `###` heading (the section ends at the next heading of the same or higher level, outside a fence; `##` behaviour unchanged), `sections` gains `--depth 3` listing `###` subsections with their sizes (default stays `##` only), tests in lib/tests/project-rules.test.sh, and the /onboard split S4 text names the `###` option. Needed before the phase 0b split of faunosteo, whose path-bound content (12.6 KB) sits in `###` subsections of the always-on `## Project conventions`.
+
+(user, same turn: "ok merge it et enchaine sur les feat"; earlier gate answer: "Oui, /feat d'abord" to "extract accepte un titre ###, sections --depth 3; faunosteo passe ensuite".)
+
+## CLARIFICATIONS
+(pass A: none — request complete)
+Q: how does a row or an `extract` call name a `###` section? / A: the heading argument carries its prefix (`'### Supabase'`; a bare heading still means `##`), no `--level` flag [gated 2026-10-27]
+Q: `sections --depth 3`, a `##` parent's size? / A: whole section, children included (same number as depth 2) [gated 2026-10-27]
+
+## ACCEPTANCE CRITERIA
+1. `extract '### ' ` moves the `###` section: the rule holds `# ` + its body, the source loses exactly that section, the parent `##` and the next heading of level ≤ 3 stay.
+ CHECK: bash lib/tests/project-rules.test.sh | tail -1
+ EXPECT: FAIL=0
+ EVIDENCE: MET exit=0 marker-found :: PASS=116 FAIL=0
+2. A `###` section ends at the next `#`, `##` or `###` heading outside a fence; a `####` line or a fenced `### ` line never ends it.
+3. A bare heading argument still means `##` (every existing extract test unchanged); a heading argument of level 1 or ≥ 4 is rc 2 with nothing written.
+4. `sections ` output is unchanged (`##` only); `sections --depth 3 ` adds one `\t\t### ` line per subsection, lines in file order; `--depth` other than 2 or 3 is rc 2.
+5. `lib/project-rules.sh` stays shellcheck clean, every line ≤ 80 chars, functions ≤ 25 logic lines and ≤ 5 locals.
+ CHECK: shellcheck lib/project-rules.sh lib/tests/project-rules.test.sh && [ -z "$(awk 'length > 80' lib/project-rules.sh)" ] && echo WIDTH-OK
+ EXPECT: WIDTH-OK
+ EVIDENCE: MET exit=0 marker-found :: WIDTH-OK
+6. `skills/onboard/SKILL.md` § SPLIT MODE S4 names `sections --depth 3` and the `### ` row form; `agents/onboarder.md` MODE: split S0/S1 accept a `### ` row (uniqueness checked at depth 3, the prefix passed to `extract` as is).
+7. `make test` all GREEN (doctrine-citers, routing locks, project-rules).
+ CHECK: make test 2>&1 | tail -1
+ EXPECT: all suites green
+ EVIDENCE: MET exit=0 marker-found :: all suites green
+8. `bash lib/project-rules.sh check` still prints `4 rule(s) ok` on this repo and `sections CLAUDE.md` still lists 2 sections.
+ CHECK: bash lib/project-rules.sh check | tail -1 && [ "$(bash lib/project-rules.sh sections CLAUDE.md | wc -l)" = 2 ] && echo SECTIONS-OK
+ EXPECT: SECTIONS-OK
+ EVIDENCE: MET exit=0 marker-found :: project-rules: 4 rule(s) ok SECTIONS-OK
+
+## FILE SCOPE
+lib/project-rules.sh, lib/tests/project-rules.test.sh, skills/onboard/SKILL.md (§ SPLIT MODE S4/S5), agents/onboarder.md (§ MODE: split S0, S1)
diff --git a/.claude/tasks/plans/2026-10-27-rules-h3-extract-1326.md b/.claude/tasks/plans/2026-10-27-rules-h3-extract-1326.md
new file mode 100644
index 0000000..8fb9a16
--- /dev/null
+++ b/.claude/tasks/plans/2026-10-27-rules-h3-extract-1326.md
@@ -0,0 +1,303 @@
+# PLAN r3 — rules-h3-extract (feat, 2026-10-27)
+Contract: `.claude/tasks/contracts/2026-10-27-rules-h3-extract-1326.md`.
+Base develop 925dafa. Our code (strict): `lib/project-rules.sh` 80 cols,
+≤ 25 logic lines and ≤ 5 locals per function, shellcheck clean, mawk-safe
+awk (no `{n,m}` intervals), no `sed -i`. r2 folds the 3-lens challenge
+(S5 cell, separator loss, `#1 title` regression, arity, AC5 gate items,
+parent-with-children test); r3 folds the confirmation pass (T13r locale
+collation, re-emission gated on level 3, level-refusal flip, `####`+ arm,
+S0.3 wording, S5 anchor, 4-backtick fence). Edits anchor on TEXT, never
+on line numbers.
+
+## Approach
+- The heading argument carries its level: bare `` = `## `
+ (unchanged, including a title that starts with `#` such as `#1 priority`);
+ `### ` = a level-3 section; `## ` is accepted as the explicit
+ level-2 form. `# x` (H1) or `####`-and-deeper → rc 2 `heading level must
+ be ## or ###`. One helper
+ `_rules_heading_line` normalises the argument to the exact heading LINE;
+ every awk helper takes that line and derives the level inside awk as
+ `lvl = index(h, " ") - 1`.
+- A section of level L ends at the next heading of level ≤ L outside a
+ fence: awk test `match($0, /^#+ /) && RLENGTH - 1 <= lvl`.
+- Separator rule, level 3 ONLY: when a `###` section is removed and its end
+ is a heading of a LOWER level (`#`/`##`), the trailing run of blank/`---`
+ lines it carried is re-emitted in the source (it was the parent's closing
+ separator); when the end is a same-level heading, the run goes with the
+ section. A `##` section keeps today's behaviour exactly (its run always
+ travels with it, an H1 end included): the awk condition is
+ `lvl == 3 && RLENGTH - 1 < lvl`. The rule body trims the run either way.
+- `sections [--depth 2|3] `: depth 2 is today's output byte for byte;
+ depth 3 also lists each `###` subsection (its own chars, its line, the
+ `### ` heading). A `##` parent's chars keep counting through its
+ children (same number as depth 2). Exactly one positional argument after
+ the optional flag, else rc 2 (a flag after the file is an error, not a
+ silent depth 2). Lines come out in file order: awk prints at close, so the
+ output is piped through `sort -t "$(printf '\t')" -k2,2n`.
+- Rule title line: `# `.
+
+## Files
+### 1. `lib/project-rules.sh`
+Header: replace the block that starts at the line beginning
+`# sections ` and ends at the line before `# emit ` with:
+```
+# sections [--depth 2|3] chars, line, heading per ## section
+# (--depth 3 adds the ### subsections; a section
+# ends at the next heading of level ≤ its own)
+# extract move one section to a
+# rule (bare heading = ##; "### title" = a subsection;
+# a ### moved last keeps its parent's trailing ---)
+```
+Every header line ≤ 80 chars.
+
+Replace `_rules_heading_count`, `_rules_section_body` and
+`_rules_without_section` (they now take the heading LINE), and add
+`_rules_heading_line` before them:
+
+```bash
+_rules_heading_line() { # → "## t" | "### t" on stdout, rc 2
+ case "$1" in
+ '## '*|'### '*) printf '%s\n' "$1" ;;
+ '# '*|'####'*)
+ echo "project-rules: heading level must be ## or ###: $1" >&2
+ return 2 ;;
+ *) printf '## %s\n' "$1" ;;
+ esac
+}
+
+_rules_heading_count() { # → fence-aware count
+ awk -v h="$2" '/^```/ { fence = !fence }
+ !fence && $0 == h { n++ }
+ END { print n + 0 }' "$1"
+}
+
+_rules_section_body() { # → body, ---/blank trimmed
+ awk -v h="$2" '
+ BEGIN { lvl = index(h, " ") - 1 }
+ /^```/ { fence = !fence }
+ !fence && $0 == h { on = 1; next }
+ !fence && on && match($0, /^#+ /) && RLENGTH - 1 <= lvl { exit }
+ on { buf[++n] = $0 }
+ END { while (n > 0 && (buf[n] == "" || buf[n] == "---")) n--
+ for (i = 1; i <= n; i++) print buf[i] }' "$1"
+}
+
+_rules_without_section() { # → the file minus it
+ # a ### ended by a lower-level heading gives its trailing ---/blank run
+ # back to the source (the parent's closing separator); a ## keeps today's
+ # behaviour, its run travels with it
+ awk -v h="$2" '
+ BEGIN { lvl = index(h, " ") - 1 }
+ /^```/ { fence = !fence }
+ !fence && $0 == h { skip = 1; n = 0; next }
+ !fence && skip && match($0, /^#+ /) && RLENGTH - 1 <= lvl {
+ if (lvl == 3 && RLENGTH - 1 < lvl) for (i = 1; i <= n; i++) print buf[i]
+ skip = 0 }
+ skip { if ($0 == "" || $0 == "---") buf[++n] = $0; else n = 0; next }
+ { print }' "$1"
+}
+```
+(`'####'*` without a trailing space catches every level ≥ 4.)
+
+`project_rules_sections` becomes:
+```bash
+project_rules_sections() { # [--depth 2|3] → chars, line, heading
+ local depth=2
+ if [ "${1:-}" = "--depth" ]; then depth="${2:-}"; shift 2; fi
+ case "$depth" in 2|3) ;; *)
+ echo "project-rules: --depth takes 2 or 3" >&2; return 2 ;; esac
+ [ $# -eq 1 ] \
+ || { echo "project-rules: sections [--depth 2|3] " >&2; return 2; }
+ [ -f "$1" ] || { echo "project-rules: $1 not found" >&2; return 2; }
+ awk -v depth="$depth" '
+ function flush2() {
+ if (h2 != "") printf "%d\t%d\t%s\n", c2, l2, h2; h2 = "" }
+ function flush3() {
+ if (h3 != "") printf "%d\t%d\t%s\n", c3, l3, h3; h3 = "" }
+ /^```/ { fence = !fence }
+ /^# / && !fence { flush3(); flush2() }
+ /^## / && !fence { flush3(); flush2(); h2 = $0; l2 = NR; c2 = 0 }
+ /^### / && !fence && depth == 3 { flush3(); h3 = $0; l3 = NR; c3 = 0 }
+ h2 != "" { c2 += length($0) + 1 }
+ h3 != "" { c3 += length($0) + 1 }
+ END { flush3(); flush2() }' "$1" | sort -t "$(printf '\t')" -k2,2n
+}
+```
+(`shift 2` with a lone `--depth` and `set -u`: `${2:-}` is empty, the case
+refuses it before the shift matters; if shellcheck or bash complains about
+`shift 2` on one argument, guard with `[ $# -ge 2 ] &&`.)
+
+`project_rules_extract` becomes (locals: src out globs hline tmp):
+```bash
+project_rules_extract() { #
+ local src="$1" out="$3" globs="$4" hline tmp
+ hline=$(_rules_heading_line "$2") || return 2
+ [ "$(_rules_heading_count "$src" "$hline")" = 1 ] || {
+ echo "project-rules: heading must occur exactly once: $hline" >&2
+ return 2; }
+ [ -e "$out" ] && { echo "project-rules: $out exists" >&2; return 2; }
+ _rules_globs_all_match "$globs" || return 2
+ mkdir -p "$(dirname "$out")"
+ tmp=$(mktemp) || { echo "project-rules: no temp file" >&2; return 2; }
+ { printf -- '---\npaths: %s\n---\n\n# %s\n' "$globs" "${hline#* }"
+ _rules_section_body "$src" "$hline"; } > "$out"
+ if ! { _rules_without_section "$src" "$hline" > "$tmp" \
+ && cat "$tmp" > "$src"; }; then
+ rm -f "$tmp" "$out"
+ echo "project-rules: $src not rewritten, $out removed" >&2
+ return 2
+ fi
+ rm -f "$tmp"
+ echo "project-rules: moved '$hline' to $out"
+}
+```
+Main dispatch: `sections) project_rules_sections "${@:2}" ;;`. The usage
+`*)` arm becomes:
+```bash
+ *) echo "usage: project-rules.sh [-C dir] check [rules-dir] | matches" \
+ " | sections [--depth 2|3] | extract " \
+ " | emit " >&2
+ return 2 ;;
+```
+
+### 2. `lib/tests/project-rules.test.sh`
+No existing expectation changes (the "moved" message now prints the heading
+line; no test greps it). Insert the block AFTER the T12 block's closing
+`cd "$FIX" || exit 1` and BEFORE the `echo "PASS=$pass FAIL=$fail"` line:
+
+````bash
+# T13 ### subsections: hidden at depth 2, listed at depth 3, extractable,
+# a ### moved last gives its parent's --- back, a ## parent takes its ###
+mkdir -p "$FIX/d3/src" && cd "$FIX/d3" || exit 1
+echo x > src/a.ts
+cat > CLAUDE.md <<'EOF'
+# Top
+
+## P
+intro
+
+### Sub
+s1
+```
+### fenced
+```
+#### deep
+s2
+
+### Sub2
+s3
+
+---
+
+## Q
+q
+EOF
+cp CLAUDE.md "$FIX/orig3.md"
+check T13-depth2-unchanged "$(bash "$PR" sections CLAUDE.md | cut -f1,3 | tr '\t\n' ' |')" '74 ## P|7 ## Q|'
+out=$(bash "$PR" sections --depth 3 CLAUDE.md)
+check T13b-depth3-file-order "$(printf '%s\n' "$out" | cut -f3 | tr '\n' '|')" '## P|### Sub|### Sub2|## Q|'
+check T13c-sub-chars-and-line "$(printf '%s\n' "$out" | awk -F'\t' '$3=="### Sub"{print $1 "," $2}')" '44,6'
+check T13d-parent-same-as-depth2 "$(printf '%s\n' "$out" | awk -F'\t' '$3=="## P"{print $1}')" 74
+bash "$PR" sections --depth 4 CLAUDE.md 2>/dev/null; check T13e-bad-depth-rc "$?" 2
+bash "$PR" sections CLAUDE.md --depth 3 2>/dev/null; check T13f-flag-after-file-rc "$?" 2
+bash "$PR" extract CLAUDE.md '### Sub' .claude/rules/sub.md '["src/**"]' >/dev/null
+check T13g-extract-sub-rc "$?" 0
+check T13h-rule-title "$(sed -n '5p' .claude/rules/sub.md)" '# Sub'
+# shellcheck disable=SC2016
+check T13i-removed-lines "$(diff "$FIX/orig3.md" CLAUDE.md | grep '^< ' | cut -c3- | grep -vE '^(---)?$' | tr '\n' '|')" '### Sub|s1|```|### fenced|```|#### deep|s2|'
+check T13j-rule-ends-before-sub2 "$(tail -1 .claude/rules/sub.md)" 's2'
+cp CLAUDE.md "$FIX/mid3.md"
+bash "$PR" extract CLAUDE.md '### Sub2' .claude/rules/sub2.md '["src/**"]' >/dev/null
+check T13k-last-child-rc "$?" 0
+check T13l-last-child-removed-lines "$(diff "$FIX/mid3.md" CLAUDE.md | grep '^< ' | cut -c3- | tr '\n' '|')" '### Sub2|s3|'
+check T13m-parent-separator-kept "$(grep -c '^---$' CLAUDE.md)" 1
+check T13n-no-additions "$(diff "$FIX/mid3.md" CLAUDE.md | grep -c '^> ')" 0
+check T13o-q-kept "$(grep -c '^## Q' CLAUDE.md)" 1
+bash "$PR" extract CLAUDE.md '#### deep' .claude/rules/deep.md '["src/**"]' 2>/dev/null
+check T13p-level4-rc "$?" 2
+check T13p2-level4-msg "$(bash "$PR" extract CLAUDE.md '#### deep' .claude/rules/deep.md '["src/**"]' 2>&1 >/dev/null | grep -c 'heading level must be ## or ###')" 1
+bash "$PR" extract CLAUDE.md '# Top' .claude/rules/top.md '["src/**"]' 2>/dev/null
+check T13q-level1-rc "$?" 2
+check T13q2-level1-msg "$(bash "$PR" extract CLAUDE.md '# Top' .claude/rules/top.md '["src/**"]' 2>&1 >/dev/null | grep -c 'heading level must be ## or ###')" 1
+check T13r-nothing-else-written "$(cd .claude/rules && printf '%s\n' * | wc -l | tr -d ' ')" 2
+cp "$FIX/orig3.md" CLAUDE.md
+bash "$PR" extract CLAUDE.md 'P' .claude/rules/p.md '["src/**"]' >/dev/null
+check T13s-parent-takes-children "$(grep -c '^### Sub' .claude/rules/p.md)" 2
+check T13t-parent-extract-q-kept "$(grep -c '^## Q' CLAUDE.md)" 1
+printf '## #1 priority\nbody\n' > hash.md
+bash "$PR" extract hash.md '#1 priority' .claude/rules/hash.md '["src/**"]' >/dev/null
+check T13u-bare-title-starting-with-hash "$?" 0
+cd "$FIX" || exit 1
+````
+(T13r counts files instead of listing them: glob order follows
+LC_COLLATE, and `make test` does not pin the locale.)
+Hand counts (each line `length + 1`, the heading line counted in its own
+section): `### Sub` = `### Sub`(8) `s1`(3) "```"(4) `### fenced`(11)
+"```"(4) `#### deep`(10) `s2`(3) ``(1) = 44, at file line 6. `### Sub2` =
+9+3+1+4+1 = 18. `## P` = `## P`(5) `intro`(6) ``(1) + 44 + 18 = 74.
+`## Q` = 5+2 = 7. The rule file: lines 1-3 frontmatter, 4 blank, 5
+`# Sub`, 6-11 the body. T13l: the diff of the Sub2 extract deletes exactly
+`### Sub2` and `s3` (the blank, `---`, blank run is re-emitted), so the
+`<` lines are those two. Expected tally: 93 + 23 = 116.
+
+### 3. `skills/onboard/SKILL.md` § SPLIT MODE S4 and S5
+S4: the first sentence `` `bash ~/.claude/lib/project-rules.sh -C sections
+CLAUDE.md` lists every `##` section with its size.`` becomes
+`` `bash ~/.claude/lib/project-rules.sh -C sections --depth 3
+CLAUDE.md` lists every `##` section with its size and, under it, its
+`###` subsections with theirs (the parent's size includes them).`` and this
+text is added right after that sentence:
+`An always-on parent (conventions, overview) whose subsections are
+path-bound (one module, one tool) keeps its intro and the subsections move,
+one row each, heading written `### ` in the TABLE (the prefix marks
+the level; a bare heading means `##`). A `###` title must be unique across
+the whole file, like a `##` one, and a `###` row's parent is never itself a
+move row (the parent would carry the child away first; say so, the user
+picks one).`
+S5: after the Docker example row add the row
+`| 3 | ### Supabase | 2,210 | move | supabase.md | ["supabase/**"] |`
+and, AFTER the gate template's closing ``` fence and BEFORE the paragraph
+that starts `"keep everything" ends the mode`, add the sentence `A `###`
+row's section cell is the exact heading argument, prefix included, nothing
+else (no parent breadcrumb: the cell crosses to the onboarder verbatim).`
+
+### 4. `agents/onboarder.md` § MODE: split
+INPUTS: `(heading without `## `)` becomes `(heading without `## `; a
+subsection row starts with `### ` and is passed to `extract` as written)`.
+S0 step 3: after `the heading has no `'`;` add `a heading whose leading `#`
+run is followed by a space starts with `### `; any other leading `#` is a
+bare `##` title (`#1 priority`);`
+S0 step 4: `` `PR sections CLAUDE.md` lists `## ` exactly once`` becomes
+`` `PR sections --depth 3 CLAUDE.md` lists the row's heading exactly once
+(`## ` for a bare row; a `### ` row's heading as written); a `### `
+row whose parent `##` is also a row → STOP with both rows``.
+S1 first line: `(single quotes around the heading):` becomes `(single quotes
+around the heading, passed as the row wrote it: bare, or with its `### `
+prefix):`.
+
+## Edge cases
+- `### ` inside a fence: never a heading (fence-aware, T13i).
+- `####` under a `###`: body of the `###` (T13i/T13j), not extractable (T13p).
+- Same `###` title under two parents: count 2 → rc 2, user renames (the
+ existing "exactly once" rule, now across levels).
+- Last `###` of a parent: the parent's trailing `---` stays in the source
+ (T13l/T13m); a same-level end takes the run with the section, as `##`.
+- `sections --depth 3` on a file with no `###`: identical to depth 2.
+- A bare title starting with `#` (`#1 priority`): still `##` (T13u).
+- `sort` on an empty awk output: prints nothing, rc 0.
+
+## Tests
+- `bash lib/tests/project-rules.test.sh | tail -1` → `FAIL=0` (114).
+- `shellcheck lib/project-rules.sh lib/tests/project-rules.test.sh` clean.
+- `awk 'length > 80' lib/project-rules.sh` empty.
+- `make test` all GREEN (citers census sees the skill/agent edits).
+- `bash lib/project-rules.sh check` → 4 rule(s) ok; `sections CLAUDE.md` → 2 lines.
+
+## Disposition
+- honors BDR-128 by keeping one oracle, inline `paths:`, subtract-only
+ extract, the `##` contract unchanged (depth-2 output byte-identical).
+- honors LRN-233 by keeping the awk-reads-the-pipe shape, the checked
+ `mktemp` + `if !` rewrite, no `{n,m}` awk intervals.
+- honors LRN-096 by flip tests (T13e/f refusals, T13p2/q2 the level arm's
+ message, T13i/l/n conservation).
+- BDR-003 unaffected.