@chrono-meta/fh-gate 3.15.0 → 3.17.0

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.
Files changed (60) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +27 -0
  3. package/CATALOG.md +60 -0
  4. package/CLAUDE.md +5 -0
  5. package/README.ja.md +2 -2
  6. package/README.ko.md +2 -2
  7. package/README.md +2 -2
  8. package/README.zh.md +2 -2
  9. package/docs/OUTPUT_EVIDENCE.md +1 -1
  10. package/docs/codex-compat.md +24 -0
  11. package/knowledge/shared/harness-core/checkout_layer_drift.md +301 -0
  12. package/knowledge/shared/learnings/subagent_invocations_log.yaml +66 -0
  13. package/package.json +13 -1
  14. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +42 -0
  17. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-preprep/skills/preprep/SKILL.md +5 -0
  19. package/plugins/fh-preprep/skills/preprep/lane_font_embed.py +235 -0
  20. package/plugins/fh-preprep/skills/preprep/ooxml/gate.py +67 -5
  21. package/plugins/fh-preprep/skills/preprep/ooxml/test_gate_exitcodes.py +136 -0
  22. package/plugins/fh-preprep/skills/preprep/preprep.py +16 -1
  23. package/plugins/fh-preprep/skills/preprep/presentation_checklist.md +108 -6
  24. package/plugins/fh-preprep/skills/preprep/safe_install.py +22 -3
  25. package/plugins/fh-preprep/skills/preprep/surfaces.example.yaml +11 -0
  26. package/plugins/fh-preprep/skills/preprep/test_lane_font_embed.py +117 -0
  27. package/plugins/fh-preprep/skills/preprep/test_safe_install_app_xml.py +77 -0
  28. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  29. package/scripts/count_check.sh +46 -14
  30. package/scripts/daily_report.sh +17 -1
  31. package/scripts/env_layer_fingerprint.sh +309 -0
  32. package/scripts/gate_bootstrap_ephemeral.sh +248 -0
  33. package/scripts/governor_board.sh +841 -0
  34. package/scripts/map_postprocess.py +89 -4
  35. package/scripts/multibyte_bracket_lint.sh +135 -0
  36. package/scripts/outbound_pr_gate.sh +12 -0
  37. package/scripts/package_coverage_check.sh +34 -0
  38. package/scripts/selfcheck.sh +263 -0
  39. package/scripts/session_close_check.sh +96 -1
  40. package/scripts/stale_ref_scan.py +511 -0
  41. package/scripts/test_count_check_decl_lanes.sh +176 -0
  42. package/scripts/test_env_layer_fingerprint_lanes.sh +192 -0
  43. package/scripts/test_gate_bootstrap_ephemeral_lanes.sh +262 -0
  44. package/scripts/test_locale_invariance_lanes.sh +581 -0
  45. package/scripts/test_map_postprocess_lanes.sh +84 -4
  46. package/scripts/test_marker_crossfamily_lanes.sh +5 -1
  47. package/scripts/test_marker_defense_lanes.sh +5 -1
  48. package/scripts/test_marker_standpoint_lanes.sh +5 -1
  49. package/scripts/test_marker_thirdparty_lanes.sh +5 -1
  50. package/scripts/test_multibyte_bracket_lint_lanes.sh +107 -0
  51. package/scripts/test_outbound_pr_gate_lanes.sh +133 -0
  52. package/scripts/test_preprep_drift_anchor.sh +34 -9
  53. package/scripts/test_preprep_drift_anchor_lanes.sh +64 -2
  54. package/scripts/test_session_close_chain_lanes.sh +45 -0
  55. package/scripts/test_stale_ref_close_lanes.sh +197 -0
  56. package/scripts/test_stale_ref_scan_lanes.sh +134 -0
  57. package/scripts/test_worktree_reclaim_lanes.sh +267 -1
  58. package/scripts/worktree_reclaim.sh +246 -11
  59. package/templates/.git-hooks/pre-commit +108 -27
  60. package/templates/settings.PreToolUse.snippet.json +54 -1
@@ -706,6 +706,26 @@ fi
706
706
  # ⚠️ **채널 검사다**: 「그 값이 옳은가」가 아니라 「이 기록이 템플릿 자신인가」를 묻는다.
707
707
  # 🟥 좁게 잡는다 — 꺾쇠를 정당하게 쓰는 기술 서술을 안 막으려고, **힌트에 실제로 등장하는
708
708
  # 문자열**만 본다. 목록이지 정규식 일반화가 아니다. 힌트를 바꾸면 여기도 같이 바꿔라.
709
+ # ── 문자 수 — 로케일에 의존하지 않는다 (2026-09-21) ───────────────────────────
710
+ # 🟥 `${#var}` 도 `wc -m` 도 **로케일이 센다.** `LC_CTYPE` 이 UTF-8 이 아닌 기계
711
+ # (베어 컨테이너 · 많은 CI 러너 · `LANG` 이 안 걸린 셸)에서는 둘 다 **바이트**를 센다:
712
+ # `대상이 없다` → ${#var} 16 · wc -m 16 (실제 문자 6)
713
+ # `운영자가 승인했다고 한다` → ${#var} 35 (실제 문자 13)
714
+ # 방향이 **fail-OPEN 이다** — 한글 근거가 약 3배로 크레딧돼 `-lt 20` 류 하한을 공짜로
715
+ # 넘는다. 영어로 쓴 같은 길이의 근거는 막히는데 한글 근거는 통과한다. #780 의 `wc -w`
716
+ # 결함과 **같은 클래스, 방향만 반대**(저쪽은 과차단, 이쪽은 fail-open).
717
+ # 🟥 이 레포의 하한 주석들은 전부 «chars» / «자» 라고 적고 있다 — 의도는 처음부터
718
+ # 문자였고, 계기가 그것을 구현하지 않았을 뿐이다. 이 훅 자신도 두 자리에서 이미
719
+ # 그렇게 적어두고( `${#}` is locale-dependent ) 열두 줄 뒤에 어겼다.
720
+ # 셈법: UTF-8 의 이어지는 바이트(0x80–0xBF)를 지우면 문자당 선두 바이트 하나만 남으므로,
721
+ # 남은 바이트 수가 곧 문자 수다. **UTF-8 기계에서는 `${#var}` 와 같은 수**이고(한글
722
+ # 포함, 실측) 따라서 기존 문턱값이 한 칸도 안 움직인다 — 바뀌는 것은 바이트 로케일뿐.
723
+ # ⚠️ 명시된 잔여: 결합 문자(NFD)와 이모지 ZWJ 열은 코드포인트 단위로 세진다. 그것은
724
+ # `${#var}` 가 UTF-8 기계에서 하던 셈법 그대로이므로 회귀가 아니라 동등이다.
725
+ _charlen() { # $1 = 문자열 → 문자 수 (로케일 무관)
726
+ printf '%s' "${1-}" | LC_ALL=C tr -d '\200-\277' | LC_ALL=C wc -c | tr -d ' '
727
+ }
728
+
709
729
  _marker_template_residue() { # $1 = 줄 내용 → 0 = 템플릿 잔여
710
730
  # 🟥 **세 번째 설계다. 앞의 둘이 왜 틀렸는지 남긴다** (cross-family 3라운드, 자력 적발 0).
711
731
  # v1 손목록 → 규칙 문서가 새 자리표시자를 실을 때마다 어긋났다(구조적 desync).
@@ -814,7 +834,7 @@ validate_defense_leg() { # $1 = marker path — fires ONLY at the floor tiers (s
814
834
  v=$(printf '%s' "$v" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')
815
835
  case "$(printf '%s' "$v" | tr 'A-Z' 'a-z')" in
816
836
  ok|yes|y|n/a|na|none|done|true|-|tbd|todo) bad="$bad $k(vacuous:'$v')" ;;
817
- *) [ "${#v}" -ge 12 ] || bad="$bad $k(too short:'$v')" ;;
837
+ *) [ "$(_charlen "$v")" -ge 12 ] || bad="$bad $k(too short:'$v')" ;;
818
838
  esac
819
839
  done
820
840
  if [ -n "$bad" ]; then
@@ -903,7 +923,14 @@ validate_crossfamily_leg() { # $1 = marker path
903
923
  # `panel(codex,` — a well-formed panel rejected as malformed. An over-block on the
904
924
  # correct shape is the failure that teaches --no-verify, so it is a defect, not strictness.
905
925
  val=$(printf '%s' "$line" | sed -E 's/[[:space:]]*(—|--).*$//' | sed -E 's/[[:space:]]+$//')
906
- reason=$(printf '%s' "$line" | sed -E 's/^[^—-]*(—|--)[[:space:]]*//')
926
+ # 🟥 `[^—-]*` 금지 — 브래킷은 비-UTF-8 로케일에서 바이트 집합이 된다
927
+ # (scripts/multibyte_bracket_lint.sh 가 이 자리를 막는다). `val` 이 이미 «구분자 앞» 이므로
928
+ # 그 접두를 떼면 부정 클래스 없이 구해지고, 구분자가 맨 앞이라 앵커로 벗길 수 있다.
929
+ # 부수 효과로 로케일과 무관한 실물 버그가 닫힌다: 값에 하이픈이 있고 ASCII 이중대시를 쓰면
930
+ # (`panel(a) -- 근거`) 옛 식은 아무것도 못 벗겨 reason 이 통째로 남았고, 바로 아래 비교가
931
+ # 그것을 **빈 근거**로 렌더해 정상 마커를 과차단했다(2026-09-21 실측).
932
+ reason=${line#"$val"}
933
+ reason=$(printf '%s' "$reason" | sed -E 's/^[[:space:]]*(—|--)[[:space:]]*//')
907
934
  [ "$reason" = "$line" ] && reason=""
908
935
 
909
936
  # residency= token — computed once, consumed by whichever branch below needs it (REQUIRED for
@@ -1000,7 +1027,7 @@ validate_crossfamily_leg() { # $1 = marker path
1000
1027
  fi ;;
1001
1028
  esac
1002
1029
  done
1003
- if [ "${#reason}" -lt 20 ] || [ -z "$_cf_cited" ]; then
1030
+ if [ "$(_charlen "$reason")" -lt 20 ] || [ -z "$_cf_cited" ]; then
1004
1031
  echo " ❌ FAIL — 'declined' must cite a record that EXISTS on disk."
1005
1032
  echo " declined = the OPERATOR declined sidecars, a chosen floor. It does NOT mean"
1006
1033
  echo " 'I judged decorrelation unnecessary here' — that is a CHOICE the author made"
@@ -1010,7 +1037,7 @@ validate_crossfamily_leg() { # $1 = marker path
1010
1037
  echo " crossfamily: declined — chosen floor per CLAUDE.local.md §sidecar"
1011
1038
  echo " No such record → you are not describing an operator declination:"
1012
1039
  echo " crossfamily: DEGRADED_PANEL_UNUSED — codex+agy reachable, not recruited (<why>)"
1013
- [ "${#reason}" -ge 20 ] && echo " (grounds were substantive but named no resolvable path)"
1040
+ [ "$(_charlen "$reason")" -ge 20 ] && echo " (grounds were substantive but named no resolvable path)"
1014
1041
  return 1
1015
1042
  fi
1016
1043
  if [ "$_res_active" -eq 1 ] && [ "$_res_ntok" -gt 0 ]; then
@@ -1178,7 +1205,7 @@ validate_crossfamily_leg() { # $1 = marker path
1178
1205
  SHARED|MIXED)
1179
1206
  # 문자 수 기준(공백 제외). 4자 미만이면 «diff» 같은 한 토큰이고, 그건 어느 산출물인지
1180
1207
  # 말하지 않는다. 🟥 낱말 수로 세지 않는다 — CJK 와 하이픈 복합어가 전부 1 낱말이 된다.
1181
- if [ "$(printf '%s' "$_ev_strip" | wc -m | tr -d ' ')" -lt 6 ]; then
1208
+ if [ "$(_charlen "$_ev_strip")" -lt 6 ]; then
1182
1209
  echo " ❌ FAIL — evidence=$_ev_kind(...) body too thin to identify the artifact: '$_ev_body'"
1183
1210
  echo " Name it (\"same staged diff\", \"one findings.jsonl\", \"동일 프롬프트 파일\")."
1184
1211
  echo " A bare $_ev_kind(diff) records the weak arm as if it were documented."
@@ -1191,7 +1218,7 @@ validate_crossfamily_leg() { # $1 = marker path
1191
1218
  # A degrade is allowed; being silent about WHICH degrade, or about its grounds, is not.
1192
1219
  # Two conditions, because either alone is porous: enough substance to be a statement
1193
1220
  # (length) AND a token naming what was actually looked at.
1194
- if [ "${#reason}" -lt 20 ] \
1221
+ if [ "$(_charlen "$reason")" -lt 20 ] \
1195
1222
  || ! printf '%s' "$reason" | grep -qiE 'prob(e|ed|ing)|reachab|unreach|not reachable|0 |none reachable|empty|absent|declin|consent|codex|gemini|agy|copilot|gateway|cli|panel|scope|budget|offline'; then
1196
1223
  echo " ❌ FAIL — $val without substantive grounds on the same line."
1197
1224
  case "$val" in
@@ -1321,7 +1348,11 @@ validate_standpoint_leg() { # $1 = marker path
1321
1348
  'standpoint: tier2' misses it; drop the quotes next time]";; esac
1322
1349
  line=$(printf '%s' "$line" | sed -E 's/^["'"'"']//; s/["'"'"']$//')
1323
1350
  val=$(printf '%s' "$line" | sed -E 's/[[:space:]]*(—|--).*$//' | sed -E 's/[[:space:]]+$//')
1324
- reason=$(printf '%s' "$line" | sed -E 's/^[^—-]*((—|--)[[:space:]]*)?//')
1351
+ # 🟥 `[^—-]*` 금지 — 위 crossfamily 자리와 같은 이유·같은 처방(lint 가 막는다).
1352
+ # 옛 식은 구분자가 없으면 `[^—-]*` 가 값의 첫 하이픈까지만 먹고 옵셔널 그룹을 건너뛰어
1353
+ # `not-applicable — 근거` 를 `-applicable — 근거` 로 **깨진 근거**로 만들었다(실측).
1354
+ reason=${line#"$val"}
1355
+ reason=$(printf '%s' "$reason" | sed -E 's/^[[:space:]]*(—|--)[[:space:]]*//')
1325
1356
  # Cross-axis contamination. `crossfamily:` and `standpoint:` each carry a three-way degrade
1326
1357
  # triad and the doctrine says the literals are DISTINCT ON PURPOSE. Borrowing the other axis's
1327
1358
  # token records the wrong axis while looking well-formed.
@@ -1346,7 +1377,7 @@ validate_standpoint_leg() { # $1 = marker path
1346
1377
  # ⓒ «출력» 의 형태(`30/30`, `rc=`, `./path`)도 실행의 증거로 받는다.
1347
1378
  # ⚠️ 방향: 이건 **느슨하게** 만드는 변경이다. 막고 싶은 것은 «명령도 출력도 안 적은 줄» 이고,
1348
1379
  # 길이 20 자 하한은 그대로 남는다.
1349
- if [ "${#reason}" -lt 20 ] || ! printf '%s' "$reason" \
1380
+ if [ "$(_charlen "$reason")" -lt 20 ] || ! printf '%s' "$reason" \
1350
1381
  | grep -qiE '(^|[^[:alpha:]])(ran|run|runs|exec|invoke[ds]?|call|calls|called|exit|output|suite|test|tests|tested|bash|sh|zsh|grep|npm|pnpm|yarn|pytest|python|python3|cargo|make|go|gradle|mvn|dotnet|node|command)([^[:alpha:]]|$)|실행|돌렸|돌린|돌려|호출|출력|스위트|커맨드|rc=|[0-9]+/[0-9]+|\./'; then
1351
1382
  # Grace: markers dated before STANDPOINT_GROUNDS_GRACE_DATE keep the old advisory
1352
1383
  # behaviour (no retro-blocking), same pattern as the residency=/evidence= tokens.
@@ -1382,7 +1413,7 @@ validate_standpoint_leg() { # $1 = marker path
1382
1413
  not-applicable)
1383
1414
  # §7: asserting non-applicability without naming what was checked is indistinguishable from
1384
1415
  # UNKNOWN wearing a permissive label. Measured: 6 bare instances in this corpus.
1385
- if [ "${#reason}" -lt 20 ]; then
1416
+ if [ "$(_charlen "$reason")" -lt 20 ]; then
1386
1417
  echo " ❌ FAIL — bare 'not-applicable' with no grounds on the same line."
1387
1418
  echo " That is UNKNOWN wearing a permissive label. Name what you checked:"
1388
1419
  echo " no named peer carries this surface AND it changes no consumer-visible behavior."
@@ -1390,7 +1421,7 @@ validate_standpoint_leg() { # $1 = marker path
1390
1421
  fi
1391
1422
  echo " ✅ standpoint leg: not-applicable$quoted" ;;
1392
1423
  DEGRADED_NO_TARGET_ACCESS*|DEGRADED_NOT_RUN*|UNKNOWN*)
1393
- if [ "${#reason}" -lt 20 ]; then
1424
+ if [ "$(_charlen "$reason")" -lt 20 ]; then
1394
1425
  echo " ❌ FAIL — $val without substantive grounds on the same line."
1395
1426
  echo " could-not / did-not / did-not-look are separate values on purpose; collapsing"
1396
1427
  echo " them renders an unrun probe as a zero finding. Name what you probed."
@@ -1479,7 +1510,7 @@ validate_thirdparty_leg() { # $1 = marker path
1479
1510
  return 1 ;;
1480
1511
  esac
1481
1512
  reason=$(printf '%s' "$line" | sed -E 's/^[^(]*\(//')
1482
- if [ "${#reason}" -lt 12 ]; then
1513
+ if [ "$(_charlen "$reason")" -lt 12 ]; then
1483
1514
  echo " ❌ FAIL — '$val(...)' grounds are vacuous. Name what was searched and what came back."
1484
1515
  return 1
1485
1516
  fi
@@ -1632,7 +1663,7 @@ validate_defeater_leg() { # $1 = marker path
1632
1663
  esac
1633
1664
  # 비공허성 — 한글 코퍼스이므로 **낱말 수**로 센다. `${#}` 는 로케일 의존이고, 긴 한글 한 덩어리가
1634
1665
  # 문자 수 검사를 그냥 통과한 전례가 있다(A6 레인).
1635
- words=$(printf '%s' "$body" | wc -w | tr -d ' '); words=${words:-0}
1666
+ words=$(printf '%s\n' "$body" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.'); words=${words:-0}
1636
1667
  if [ "$words" -lt 6 ]; then
1637
1668
  echo " ❌ FAIL — defeater 가 공허하다 ($words 낱말). **무엇이 관측될 것인가**를 적어라."
1638
1669
  echo " '틀렸을 수 있다' 는 반증 조건이 아니다 — 관측 가능한 사건이어야 한다."
@@ -1640,8 +1671,12 @@ validate_defeater_leg() { # $1 = marker path
1640
1671
  fi
1641
1672
  # 🟥 기록의 속성 하나 더: defeater 가 ①영혼 줄의 **복붙**이면 두 필드가 한 필드다.
1642
1673
  # (이것은 «내용이 옳은가»가 아니라 «두 칸이 서로 다른 값을 담는가»다 — 채널 검사.)
1643
- soul_line=$(grep -m1 -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul)[[:space:]]*[:—-]' "$m" 2>/dev/null \
1644
- | sed -E 's/^[^:—-]*[:—-][[:space:]]*//; s/[[:space:]]+$//')
1674
+ # 🟥 A multibyte character inside a BRACKET EXPRESSION is a byte set under LC_CTYPE=POSIX, so
1675
+ # `[:—-]` there matches the lead byte of 「①」 and `[^:—-]*` stops on it. Measured 2026-09-21:
1676
+ # lane D9-copy-of-soul-blocks went BLOCK → **PASS** with LANG unset — a fail-OPEN, unlike the
1677
+ # word-count defect above. Alternation is byte-safe in every locale; brackets are not.
1678
+ soul_line=$(grep -m1 -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul)[[:space:]]*(:|—|-)' "$m" 2>/dev/null \
1679
+ | sed -E 's/^[[:space:]]*#*[[:space:]]*(①영혼|soul)[[:space:]]*(:|—|-)[[:space:]]*//; s/[[:space:]]+$//')
1645
1680
  if [ -n "$soul_line" ] && [ "$body" = "$soul_line" ]; then
1646
1681
  echo " ❌ FAIL — defeater 가 ①영혼 줄과 글자 그대로 같다. 두 칸이 한 칸이 되었다."
1647
1682
  echo " 성공 정의와 그 반증 조건은 다른 문장이다."
@@ -1731,7 +1766,7 @@ validate_affected_leg() { # $1 = marker path
1731
1766
  echo " ❌ FAIL — affected 가 힌트의 자리표시자 그대로다 (기록이 아직 안 쓰였다)."
1732
1767
  return 1
1733
1768
  fi
1734
- words=$(printf '%s' "$body" | wc -w | tr -d ' '); words=${words:-0}
1769
+ words=$(printf '%s\n' "$body" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.'); words=${words:-0}
1735
1770
  if [ "$words" -lt 3 ]; then
1736
1771
  echo " ❌ FAIL — affected 가 공허하다 ($words 낱말). 건드리는 것 · 열린 질문을 적어라."
1737
1772
  return 1
@@ -1855,7 +1890,7 @@ validate_oracle_leg() { # $1 = marker path
1855
1890
  echo " ❌ FAIL — oracle 근거가 힌트의 자리표시자 그대로다 (기록이 아직 안 쓰였다)."
1856
1891
  return 1
1857
1892
  fi
1858
- words=$(printf '%s' "$rest" | wc -w | tr -d ' '); words=${words:-0}
1893
+ words=$(printf '%s\n' "$rest" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.'); words=${words:-0}
1859
1894
  if [ "$words" -lt 2 ]; then
1860
1895
  echo " ❌ FAIL — oracle 근거가 공허하다 ($words 낱말). 무엇을 무엇과 대조했는지 적어라."
1861
1896
  return 1
@@ -1919,7 +1954,7 @@ validate_soul_present_leg() { # $1 = marker path
1919
1954
  # corpus writes «## ①영혼 — 설계 전에 쓴 …» as a heading, and P7 flipped to BLOCK when the first
1920
1955
  # version of this regex forbade it. The known-pair caught that in one run).
1921
1956
  # Prose inside a field VALUE can no longer vote.
1922
- _soul_src=$(grep -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*[:—-]' "$m" 2>/dev/null \
1957
+ _soul_src=$(grep -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*(:|—|-)' "$m" 2>/dev/null \
1923
1958
  | grep -vE '^[[:space:]]*soul-check[[:space:]]*:')
1924
1959
  n=$(printf '%s\n' "$_soul_src" | grep -cE '①영혼|^[[:space:]]*soul:|성공 ?정의|절대 안 함'); n=${n:-0}
1925
1960
  if [ "$n" -eq 0 ]; then
@@ -1937,7 +1972,7 @@ validate_soul_present_leg() { # $1 = marker path
1937
1972
  f && /^[[:space:]]*$/{exit}
1938
1973
  f && seen && /^[[:space:]]*[A-Za-z][A-Za-z0-9_-]*:/{exit}
1939
1974
  f{print; seen=1}' <<< "$_soul_src")
1940
- words=$(printf '%s' "$body" | wc -w | tr -d ' '); words=${words:-0}
1975
+ words=$(printf '%s\n' "$body" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.'); words=${words:-0}
1941
1976
  # 🟥 A DECLARED ABSENCE IS A VALUE, not a gap. CLAUDE.md §자기 대조 explicitly permits
1942
1977
  # «없으면 `없음`», and the first version of this leg BLOCKED a bare `soul: 없음` (2 words) while
1943
1978
  # PASSING a 33-word paragraph whose content was «I did not write one». That punishes the honest
@@ -1948,7 +1983,7 @@ validate_soul_present_leg() { # $1 = marker path
1948
1983
  # 🟥 `$body` — this leg's own local. The first version read `$soul_body`, which is the OTHER
1949
1984
  # leg's variable name; unset here, so the case never matched and the fix was inert while the
1950
1985
  # lane suite stayed green ([[feedback_unedited_parts_of_my_own_file]] · half-fix).
1951
- _sbare=$(printf '%s' "$body" | sed -E 's/^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*[:—-]*//' | tr -d '[:space:].·]')
1986
+ _sbare=$(printf '%s' "$body" | sed -E 's/^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*(:|—|-)*//' | tr -d '[:space:].·]')
1952
1987
  case "$_sbare" in
1953
1988
  없음|없음—|none|None|NONE|n/a|N/A|-|해당없음)
1954
1989
  echo " ⚠️ ①영혼: 없음 — declared absent. Recorded, not silent."
@@ -2072,7 +2107,7 @@ DEGRADED_SINGLE_FAMILY|DEGRADED_PANEL_UNUSED|DEGRADED_NO_TARGET_ACCESS|DEGRADED_
2072
2107
  # corpus writes «## ①영혼 — 설계 전에 쓴 …» as a heading, and P7 flipped to BLOCK when the first
2073
2108
  # version of this regex forbade it. The known-pair caught that in one run).
2074
2109
  # Prose inside a field VALUE can no longer vote.
2075
- _soul_src=$(grep -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*[:—-]' "$m" 2>/dev/null \
2110
+ _soul_src=$(grep -E '^[[:space:]]*#*[[:space:]]*(①영혼|soul|절대 안 함|성공 ?정의)[[:space:]]*(:|—|-)' "$m" 2>/dev/null \
2076
2111
  | grep -vE '^[[:space:]]*soul-check[[:space:]]*:')
2077
2112
  soul_n=$(printf '%s\n' "$_soul_src" | grep -cE '①영혼|^[[:space:]]*soul:|성공 ?정의|절대 안 함'); soul_n=${soul_n:-0}
2078
2113
  # Body = the ①영혼 block only: stop at a blank line OR at the next ASCII field key. An earlier
@@ -2080,16 +2115,35 @@ DEGRADED_SINGLE_FAMILY|DEGRADED_PANEL_UNUSED|DEGRADED_NO_TARGET_ACCESS|DEGRADED_
2080
2115
  # scored as having content — the fixture G9 caught it.
2081
2116
  # 🟥 Counted in WORDS, not characters. `${#var}` on Korean text is bytes-or-chars depending on
2082
2117
  # locale, and this corpus is Korean — a char threshold silently changes meaning per machine
2083
- # ⚠️ Honest caveat, measured: `wc -w` is NOT a human word count on Korean either («①영혼: 완주»
2118
+ # ⚠️ Honest caveat, measured: this is NOT a human word count on Korean either («①영혼: 완주»
2084
2119
  # reports 3, not 2). It is stable per-machine and monotonic, which is all a floor needs — but
2085
2120
  # every threshold here was calibrated by RUNNING it, never by reasoning about word counts.
2086
- # ([[feedback_instrument_vs_target_and_budget]], 단위 혼동). Word count is locale-independent.
2121
+ # ([[feedback_instrument_vs_target_and_budget]], 단위 혼동).
2122
+ # 🟥 RETRACTED 2026-09-21 — this comment used to end «Word count is locale-independent.» and
2123
+ # that sentence was FALSE. `wc -w` splits on whitespace as the LOCALE classifies characters:
2124
+ # with LANG unset (LC_CTYPE=POSIX — the default in a bare container or CI runner) a Korean
2125
+ # grounds line counts **0** words and a mixed line counts only its ASCII tokens. Known pair,
2126
+ # measured in a clean clone of a9e9b29: `LC_ALL=POSIX` → 0, `LC_ALL=C.UTF-8` → 8, same bytes.
2127
+ # The whole point of choosing words over `${#var}` was locale-independence, so the instrument
2128
+ # was selected on a property it did not have. ⇒ counted by splitting on ASCII whitespace with
2129
+ # `tr` and counting non-empty lines under a forced `LC_ALL=C` — byte-level, identical in both
2130
+ # locales, and identical to the old `wc -w` numbers on any UTF-8 machine (so no threshold moves
2131
+ # where the gate already worked). Anchor: scripts/test_locale_invariance_lanes.sh.
2087
2132
  soul_body=$(awk '/①영혼|^[[:space:]]*soul:|성공 ?정의|절대 안 함/{if (!f) f=1}
2088
2133
  f && /^[[:space:]]*$/{exit}
2089
2134
  f && seen && /^[[:space:]]*[A-Za-z][A-Za-z0-9_-]*:/{exit}
2090
2135
  f{print; seen=1}' "$m" 2>/dev/null \
2091
- | sed -E '1s/^[[:space:]]*(①영혼|soul)[^[:alnum:]«]*//')
2092
- soul_words=$(printf '%s' "$soul_body" | wc -w | tr -d ' ')
2136
+ | sed -E '1s/^[[:space:]]*(①영혼|soul)([[:space:]]*(:|—|-))*[[:space:]]*//')
2137
+ # 🟥 2026-09-21 — 위 strip 은 `[^[:alnum:]«]*` 였다. `[:alnum:]` 은 `LC_CTYPE=POSIX` 에서
2138
+ # **ASCII 전용**이라, 「«」 도 ASCII 영숫자도 없는 **순한글 ①영혼 줄**이 부정 클래스에
2139
+ # 통째로 먹혀 soul_body 가 빈 문자열이 됐다. 방향이 둘이다 — 정상 한글 마커가 차단되고
2140
+ # (ⓐ), 영혼 줄이 멀쩡히 있는데 `DEGRADED_NO_SOUL` 을 적은 거짓 주장이 통과한다(ⓒ).
2141
+ # 측정된 known pair: 순한글 본문 `LC_ALL=POSIX` → 0 낱말 / `C.UTF-8` → 8, 같은 바이트를
2142
+ # ASCII 로 쓴 컨트롤은 두 로케일 모두 6. ⇒ 구분자를 **교차**로 적어 바이트 집합 퇴화를
2143
+ # 피한다. UTF-8 기계에서는 실제 마커 형태 전부에서 옛 식과 같은 수를 낸다(문턱값 불변).
2144
+ # 🟥 이 결함은 위 낱말 세기 수리 **뒤에야 관측 가능하다** — 그 전에는 셈법이 먼저
2145
+ # 죽어서 어느 쪽 원인인지 갈리지 않았다. 앵커: test_locale_invariance_lanes.sh L11.
2146
+ soul_words=$(printf '%s\n' "$soul_body" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.')
2093
2147
  soul_words=${soul_words:-0}
2094
2148
 
2095
2149
  case "$val" in
@@ -2108,7 +2162,7 @@ DEGRADED_SINGLE_FAMILY|DEGRADED_PANEL_UNUSED|DEGRADED_NO_TARGET_ACCESS|DEGRADED_
2108
2162
  # 🟥 agy (claims axis, 2026-08-21): this leg's own comment above condemns `${#var}` on
2109
2163
  # Korean text and then used `${#reason}` twelve lines later — [[feedback_citing_a_rule_is_not_obeying_it]],
2110
2164
  # verbatim. Inherited from the sibling legs, which does not excuse it here. Word count.
2111
- _rwords=$(printf '%s' "$reason" | wc -w | tr -d ' '); _rwords=${_rwords:-0}
2165
+ _rwords=$(printf '%s\n' "$reason" | tr -s ' \t\n' '\n' | LC_ALL=C grep -c '.'); _rwords=${_rwords:-0}
2112
2166
  if [ "$_rwords" -lt 3 ]; then
2113
2167
  echo " ❌ FAIL — '$val(...)' grounds are vacuous. Name what read the ①영혼 line back,"
2114
2168
  echo " against what, and what came back."
@@ -2258,7 +2312,15 @@ validate_first_use_leg() { # $1 = marker path
2258
2312
  echo " 읽는 사람과 기계가 같은 값을 보지 않는다. 한 줄에 한 번만 적어라."
2259
2313
  return 1
2260
2314
  fi
2261
- e_val=$(printf '%s' "$line" | sed -n 's/.*[[:space:]]ⓔ=\([^ⓕ]*\).*/\1/p' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
2315
+ # 🟥 2026-09-21 — 포착식은 `[^ⓕ]*` 였다. 브래킷 안의 「ⓕ」는 `LC_CTYPE=POSIX` 에서
2316
+ # **바이트 집합 {E2,93,95}** 이라, ⓔ 값이 E2 로 시작하면(`→…` · `①…` · 한글) 포착이
2317
+ # 빈 문자열이 되고 바로 아래 `''|none|…` 가지에 걸려 **채워진 필드가 «none» 으로 차단**된다.
2318
+ # 하필 fh_4axis_gate.md 가 권하는 포인터 형태와 `shadow(...)` 앞의 화살표가 그 모양이다.
2319
+ # 측정된 known pair: `ⓔ=→shadow(N=3, F=2)` → POSIX `[]` / UTF-8 `[→shadow(N=3, F=2)]`,
2320
+ # ASCII 컨트롤 `ⓔ=shadow(...)` 는 두 로케일 모두 포착된다. ⇒ 브래킷을 버리고 리터럴
2321
+ # 「ⓕ」로 자른다(리터럴은 바이트열 그대로 맞으므로 로케일 무관). `-n` 의 «맞을 때만
2322
+ # 출력» 의미는 주소 블록으로 보존한다. 앵커: test_locale_invariance_lanes.sh L12.
2323
+ e_val=$(printf '%s' "$line" | sed -E -n '/[[:space:]]ⓔ=/{ s/.*[[:space:]]ⓔ=//; s/ⓕ.*//; p; }' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
2262
2324
  case "$e_val" in
2263
2325
  ''|none|None|NONE|-)
2264
2326
  echo " ❌ MARKER — 이 커밋은 **새 계기를 추가**하는데 'axes-run' 의 ⓔ(첫 실사용)이 'none' 이다."
@@ -2445,8 +2507,27 @@ validate_marker_floor() {
2445
2507
  # Rubber-stamp guard: the ack must contain a QUOTED operator utterance
2446
2508
  # ("..." or “…”, ≥2 chars). A bare reason is agent-self-writable; a quote
2447
2509
  # ties the ack to a conversational event auditable in the session record.
2510
+ #
2511
+ # 🟥 2026-09-21 — the curly-quote arm was `“[^”]{2,}”` and that bracket is the
2512
+ # same locale defect as the two sites above. `”` is E2 80 9D; under a byte
2513
+ # locale `[^”]` becomes «not E2, not 80, not 9D», and Korean syllables carry
2514
+ # byte 80 as a continuation (`대` = EB 8C 80), so the negated class ends
2515
+ # inside the quoted utterance and the closing `”` is never reached. Measured
2516
+ # known pair on this machine, `below-floor-ack: “그대로 진행해” — 승인했다`
2517
+ # → LC_ALL=POSIX BLOCK / LC_ALL=C.utf8 pass; the ASCII-quote control passes
2518
+ # in both and the no-quote known-negative blocks in both, so the instrument
2519
+ # discriminates and only the Korean arm moves. Same fairness shape as the
2520
+ # word count: an operator utterance quoted in Korean typography reads as
2521
+ # «no quote present» on a machine without a UTF-8 locale, while the English
2522
+ # one passes. `.{2,}` carries no bracket, so both locales agree on every
2523
+ # realistic input (`“”` and `“a”` still block in both).
2524
+ # ⚠️ Named residual: under a byte locale the ≥2 is counted in BYTES, so a
2525
+ # single Korean character (`“가”`, 3 bytes) satisfies it where UTF-8 rejects
2526
+ # it — a one-character margin at a pathological input, and strictly narrower
2527
+ # than today's blanket rejection of every Korean-quoted ack.
2528
+ # Lane: scripts/test_locale_invariance_lanes.sh L13.
2448
2529
  if ! grep -m1 -E '^[[:space:]]*below-floor-ack:' "$m" \
2449
- | grep -qE '"[^"]{2,}"|“[^”]{2,}”'; then
2530
+ | grep -qE '"[^"]{2,}"|“.{2,}”'; then
2450
2531
  echo " ❌ BELOW-FLOOR ack without quoted operator utterance (rubber-stamp guard)"
2451
2532
  echo " The ack line must quote the operator's approval verbatim:"
2452
2533
  echo " below-floor-ack: \"<what the operator actually said>\" — <reason>"
@@ -125,7 +125,55 @@
125
125
  " printf '%s' '{\"tool_name\":\"WebSearch\",\"tool_input\":{\"query\":\"bash printf portability\"}}' \\",
126
126
  " | bash scripts/outbound_query_hook.sh # expect: NO output (a clean query is silent)",
127
127
  " bash scripts/test_outbound_query_lanes.sh # the CLI twin, for outbound paths this hook",
128
- " # does NOT cover (curl / external CLIs via Bash)"
128
+ " # does NOT cover (curl / external CLIs via Bash)",
129
+ "",
130
+ "SEVENTH GUARD, Bash matcher — outbound_pr_gate.sh (added 2026-09-21; the script shipped in v3.13.0",
131
+ "and was registered NOWHERE until now — control: outbound_query_hook above hits this file, that one",
132
+ "hit zero settings). The SECOND hook here that can emit permissionDecision:\"deny\".",
133
+ "",
134
+ "WHAT IT GUARDS: a PR about to be OPENED on a repo we do not own. Measured on our outbound corpus",
135
+ "(2026-06-20..09-18): of 9 PRs, THREE carry a technical-defect finding — archify#328,",
136
+ "clawd-on-desk#1025 (closed), clawd-on-desk#1021 — and all three are ONE shape: our guard and our",
137
+ "test ran on OUR MODEL of the target, and the maintainer's evidence was an execution we had never",
138
+ "run. All three were submitted after a STATIC read of the target. The gate demands a record file",
139
+ "tracks/_meta/outbound_pr_<TODAY>_<slug>.md carrying three typed lines — standpoint: (CLAUDE.md §7's",
140
+ "existing closed enum, allow-listed to the strong rungs tier2/tier2b/tier3, so tier1b \"I read it and",
141
+ "ran nothing\" blocks), generated-path:, fixture-carries:.",
142
+ "",
143
+ "WHY A HOOK AND NOT PROSE: the rule already existed — CLAUDE.md §Skeleton-Not-Muscle explicitly scopes",
144
+ "\"code contributed upstream to someone else's repo\" — and had zero wiring. Measured precedent on this",
145
+ "exact substitution: the same rule as a CLAUDE.md table row fired 1/15 at floor tier; as a PreToolUse",
146
+ "hook, 9/9 (proposal_hook r3/r4). WHY NOT pre-commit: an outbound PR is authored in the TARGET's",
147
+ "clone under the TARGET's hooks — no FH commit occurs, so this repo's pre-commit/pre-push are",
148
+ "structurally not on that path. `gh pr create` is the outbound executor and PreToolUse sits on it.",
149
+ "",
150
+ "DEGRADE DIRECTION — split by what could be ESTABLISHED, and the split is the design:",
151
+ " target positively NON-OWNED -> deny (publish-class; §Irreversibility Gates fails CLOSED)",
152
+ " target positively OWNED -> silent (a gate that blocks our own PRs is a bypass trainer)",
153
+ " applicability UNDETERMINED -> advisory (denying here would block every bare `gh pr create`)",
154
+ " instrument incomplete,",
155
+ " NON-OWNED target -> deny (NOT SCANNED is not clean)",
156
+ " not an FH checkout -> silent (mechanical: is the tracked anchor file here?)",
157
+ "",
158
+ "UNLIKE THE SIXTH GUARD, THIS ONE WRITES NOTHING — no event log, no notice file, so there is nothing",
159
+ "to add to .gitignore when you wire it. Verified by grep for a write on any path in the script.",
160
+ "",
161
+ "Override, recorded by construction: put FH_OUTBOUND_PR_OK=1 in the COMMAND ITSELF. The hook reads",
162
+ "the command string (a session-exported env var is not in the hook's env), so the override lands in",
163
+ "the transcript, and the PR it lets out is swept post-hoc by session_close_check.sh ①-b.",
164
+ "",
165
+ "hook command absent -> the tool RUNS. Same fail-OPEN trap the sixth guard names: a PreToolUse command",
166
+ "that cannot be found is a non-blocking error, so on a consumer install where the script is not at",
167
+ "$CLAUDE_PROJECT_DIR/scripts/ the deny you think you wired is not there. VERIFY after wiring:",
168
+ " echo '{}' | bash \"$CLAUDE_PROJECT_DIR/scripts/outbound_pr_gate.sh\"; echo rc=$?",
169
+ " rc=0 and no output = resolved and silent on an empty payload; 'No such file' = not wired.",
170
+ "",
171
+ "Verify after wiring (known pair, both directions):",
172
+ " bash scripts/test_outbound_pr_gate_lanes.sh # expect: all known pairs hold (count self-reported).",
173
+ " # L17 reads THIS file and fails if the entry below",
174
+ " # is dropped, and runs the gate under the timeout",
175
+ " # configured here — a hook killed by its own timeout",
176
+ " # is a non-blocking error, i.e. fail-OPEN (H23's lesson)."
129
177
  ],
130
178
  "project_settings_json": {
131
179
  "hooks": {
@@ -147,6 +195,11 @@
147
195
  "type": "command",
148
196
  "command": "bash \"$CLAUDE_PROJECT_DIR/scripts/backtick_guard.sh\"",
149
197
  "timeout": 5
198
+ },
199
+ {
200
+ "type": "command",
201
+ "command": "bash \"$CLAUDE_PROJECT_DIR/scripts/outbound_pr_gate.sh\"",
202
+ "timeout": 5
150
203
  }
151
204
  ]
152
205
  },