@chrono-meta/fh-gate 3.12.0 → 3.14.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.
@@ -1,5 +1,86 @@
1
1
  # forge-harness (fh-meta) Changelog
2
2
 
3
+ ### [3.14.0] — 2026-09-19 — 계기가 «못 읽은 것»을 «깨끗함»으로 내던 자리 셋
4
+
5
+ **minor — 새 자산 넷(바이너리 추출기 · PR 없는 델타 스캐너 · 체크리스트 unblocked 훅 · 다중 턴 시뮬 경로)
6
+ 과 게이트 수용을 깨는 변경 셋.**
7
+
8
+ 🟥 **BREAKING (gate): 바이너리·비텍스트 파일이 더 이상 무음 통과하지 않는다** — `psa_scan_file` 이
9
+ NUL 바이트 + `file` mime 2축으로 판별해 스캔 불가 파일에 `UNSCANNABLE`(exit 3)을 내고, **exit 3 이
10
+ 히트를 지배한다**. 종전에는 `grep -a` 가 zip 안을 못 읽고 **rc=0 CLEAN** 을 냈다.
11
+ 한 줄 처방 — pptx/docx/pdf 가 출하 집합에 있으면 `scripts/psa_extract_text.py` 가 필요하다
12
+ (OOXML 은 zip 의 `.xml`/`.rels` 전 파트, PDF 는 PyMuPDF). 추출기가 없거나 0자를 내면 **exit 3** 이다.
13
+ 목록은 **스캔가능 쪽**에 둔다 — 모르는 형식은 UNSCANNABLE 로 떨어지는 fail-closed 방향이다.
14
+
15
+ 🟥 **BREAKING (gate): `count_check.sh` 가 플러그인 전수를 본다** — 종전에는 이름 ENUM 을 돌아
16
+ **4개 중 2개만** 검사했고, 안 보는 플러그인의 선언 드리프트는 COUNT-CHECK PASS 였다.
17
+ 한 줄 처방 — 각 플러그인의 README/매니페스트 선언 수를 디스크 실물과 맞춰라. 안 맞으면 이제 FAIL 이다.
18
+
19
+ 🟥 **BREAKING (gate): `session_checklist.py` 에 `unblocked` 와 rc=4 가 생겼다** — 형식은 멀쩡한데
20
+ **블로커가 DONE 으로 닫힌 뒤 아무도 다시 안 읽은 행**을 찾아 낸다(종전 check 는 같은 파일을
21
+ rows=14 ok=14 violations=0 rc=0 으로 통과시켰다). rc=4 는 **DEAD CONTROL** — 의존을 하나도 못 읽고
22
+ «0 건» 을 내는 계기는 아무것도 측정하지 않았다는 뜻이고, «다 해소됨» 과 구분된다.
23
+ 한 줄 처방 — 체크리스트 행이 블로커를 명명하면 그 블로커가 닫힐 때 해당 행을 다시 읽어라.
24
+ 🟥 훅은 현재 `rc=1` 만 보고하고 **`rc=4` 는 조용하다** — 안 닫힌 자리로 명시한다.
25
+
26
+ - **첫 실사용이 실물 유출을 잡았다 (#762)** — 수리 직후 진짜 발행 게이트를 출하 집합(npm pack 482파일)에
27
+ 돌리자 출하되는 pptx 픽스처 **둘 다** 서체명에 회사 식별자를 품고 있었고, 옛 `grep -a` 가 여태
28
+ 통과시켰다. 서체명 중립 치환·재압축 후 preprep 레인 **163 passed · 0 failed 로 전후 동일**,
29
+ 게이트 rc=1 → **rc=0**.
30
+ - **PR 없는 델타 스캐너 (`scripts/prless_delta_scan.sh`, #763)** — 마감 ①-b 는 `--state open` 이라
31
+ PR 이 없는 브랜치를 **구조적으로** 못 본다. 판별자는 «브랜치 델타 합본의 patch-id»(squash 머지는
32
+ 정확히 그 한 장을 main 에 심으므로 일치한다). 실물 40 브랜치 — naive 33 · `git cherry` 17 · 이 계기 10.
33
+ 🟥 **advisory 다(rc=1)** — 삭제는 Destructive-Op 관할이고 이 계기는 «세는 것» 만 한다.
34
+ - **다중 턴(티키타카) 시뮬 경로 (`sim_isolated_run.sh --turns`, #759)** — 단발 `-p` 는 «발화하는가» 를
35
+ 잰다. 턴을 넘어야만 존재하는 축이 따로 있다: 협상이 **수렴**하는가, 그 절충안이 다음 턴에 **묶이는가**.
36
+ known-pair 를 실물 `claude` 로 갈랐다(변수는 `--resume` 하나) — ARM 은 턴2 가 답하고 session_id 하나,
37
+ CTRL(`--no-resume`)은 «말씀하신 적이 없어요» 에 session_id 둘. 🟥 **단발 경로는 바이트 무변경**이고
38
+ L28j 가 argv 로그로 그것을 단언한다. 채점기 = `scripts/tikitaka_score.py`(+ known-pair 픽스처 11종).
39
+ - **liveness 증거 에코를 집계 판정 토큰에서 분리 (#764)** — selfcheck 는 스위트 출력의 `❌` 를 grep 해
40
+ 실패를 판정하고, 되돌림 프로브는 «가드를 꺼서 레인이 빨개졌다» 를 증거로 그 빨간 줄을 되찍는다.
41
+ 두 기계가 각각 옳고 **이음매는 아무도 안 본다.** 지금 뚫리진 않지만(프로브 rc=0) 사람은 뚫렸다 —
42
+ 같은 CI 로그를 두 번 오귀속했다. 증거 에코만 `[expected-red]` 로 재토큰화했고, **집계기에 예외
43
+ 목록을 만들지 않았다**(그러면 다음 프로브에서 또 샌다).
44
+ - **Sonnet-floor 교리 2절 추가 (#764)** — «최소사양» 정식화: 플로어는 우리가 실제로 돌리는 **가장 작은
45
+ 런타임**이고, 거기서 한계는 티어가 아니라 **컨텍스트**다.
46
+ - **논문 기록면 정리 (#760·#761·#765)** — 발행본 v1.0.1 은 발행본대로 두고 편집본을 v1.0.2 로 분리,
47
+ arXiv 에 실제 제출된 판을 v1.0.3 으로 기록. 서막에서 «결과» 가 아닌 것을 빼고 모순 넷을 고쳤다.
48
+
49
+ **안 닫은 것**: 체크리스트 훅이 `rc=4` 를 조용히 삼킨다 · 티키타카 F1·F5(회차 «간» 비교) 집계기 0줄 ·
50
+ `prless_delta_scan` 의 stacked 브랜치 과탐지(advisory 방향이라 의도) · 마감 체인에 미배선 ·
51
+ `count_check` 일반화의 나머지 스크립트 약 40개 미확인 · psa 추출기는 OOXML/PDF 만 덮는다.
52
+
53
+ ### [3.13.0] — 2026-09-19 — 규칙은 있었고 배선이 없었다, 두 자리
54
+
55
+ **minor — 새 자산 하나(발신 전 3프로브 훅)와 발행 확인 계기 하나가 늘었다.**
56
+ 🟢 **게이트 수용을 깨는 변경은 없다** (`BREAKING (gate):` 줄 불요) — `outbound_pr_gate.sh` 는 파일로
57
+ 출하되지만 **어떤 settings 스니펫에도 배선되지 않는다**(기계 확인: 컨트롤 `outbound_query_hook` 은
58
+ `templates/settings.PreToolUse.snippet.json` 에 히트, 이것은 0). deny 를 내는 훅이라
59
+ `outbound_query_hook` 과 **같은 처분**이다 — 배선은 운영자 결정으로 남긴다.
60
+
61
+ - **발신 전 3프로브 훅 (`scripts/outbound_pr_gate.sh`, #754)** — PreToolUse(Bash), 비소유 레포에 PR 을
62
+ «열기 직전» 에 건다. 실측 근거: 비소유 레포 outbound 9건 중 기술 결함 지적 3건이 **전부 같은 형태**였다 —
63
+ 우리 가드와 테스트가 «대상의 모형» 위에서 돌았고 메인테이너의 증거는 우리가 한 번도 안 돌린 실행이었다.
64
+ 규칙(§Skeleton-Not-Muscle · §7 standpoint enum)은 이미 있었고 **배선이 0** 이었다.
65
+ 레인 25(경로/인용 형태 · 변수간접 **잔여 핀** · enum 클래스닫힘 · 되돌림 프로브).
66
+ - **발행 «확인» 을 발행 «판정» 에서 분리 (`scripts/publish_verify_poll.sh`, #754)** — verify 단계는
67
+ 발행을 판정하지 않는다. 앞 단계 `npm publish` 가 이미 rc=0 이므로 여기서 보는 것은 읽기 복제본 전파뿐이다.
68
+ 종전 60초 인라인 루프가 **성공한 v3.12.0 발행을 빨간 잡으로** 만들었고(판별 = 레지스트리 멱등성),
69
+ 그 빨강이 v3.2.0·v3.4.0 에서 손 발행을 훈련시켜 OIDC 경로를 깨뜨렸다. 예산 5분 + 판정은 `outcome=`,
70
+ 종료코드는 **계기 오류에만**. 레인 16.
71
+ - **cross-family(codex)가 S급 2 + A급 4 를 냈고 넷을 고쳤다** — `|| true` 가 계기 오류를 삼켜 조회기
72
+ 부재를 `not_yet_visible` 로 내보내던 것 · 출력 채널 부재 시 판정이 사라지던 것 · `${{ }}` 셸 주입 ·
73
+ 경로/인용 형태 트리거 미탐. ⚠️ **A3 주장 7건 중 5건은 실측으로 반증**했다(종전 정규식으로도 잡힌다) —
74
+ 받은 것을 그대로 옮기지 않았다.
75
+ - 🟥 **selfcheck 와 CI 가 저자의 배선 구멍 셋을 잡았다** — 레인을 페어링 «선언만» 하고 실행 블록 미첨부 ·
76
+ 출하 문서가 이름을 대는데 `files[]` 부재 · 스텁을 shim 으로만 간접 호출(MENTION_ONLY/zero-caller).
77
+ 마지막 것을 선언(EXEMPT)으로 안 빼고 **직접 실행 레인**으로 닫자 **스텁 자기 계약이 한 번도 검증된 적
78
+ 없었다**는 것이 드러났다.
79
+
80
+ **안 닫은 것**: 변수 간접(`$GH_CMD`)·alias·gh 래퍼는 정규식으로 못 닫는다(레인이 **고정만** 한다) ·
81
+ `gh pr edit --body` 는 NAMED GAP · `echo gh pr create` 과차단 1건(막는 쪽이라 유지) ·
82
+ 소비자 install 에서 publish-verify 레인은 **SKIP**(SKIP 은 PASS 가 아니다).
83
+
3
84
  ### [3.12.0] — 2026-09-18 — 논문이 계기를 낳고, 계기가 저자를 잡은 밤
4
85
 
5
86
  **minor — 새 계기(논문 무결성 3종 · 철회 숫자 전파 스캐너 · 세션 요청 체크리스트)가 늘었고, `fh-codex-doctor` 의
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-preprep",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-qp",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+ # checklist_unblocked_hook.sh — SubagentStop advisory: a blocked checklist row whose blocker just landed.
3
+ #
4
+ # WHY IT FIRES HERE. The operator's prescription was literal (2026-09-19):
5
+ # "체크리스트를 쓰고 그걸 네가 테스트 한차례 끝날때마다 들여다봐야할것같아"
6
+ # A subagent finishing IS "한 차례 끝났다" — it is the one moment a blocker plausibly just closed.
7
+ # Measured that day: rows A6/A8 declared «A13 선행», A13 landed DONE, and nothing re-read the file.
8
+ # Three operator requests degraded until the operator asked again. `check` passed the same file
9
+ # clean (rows=14 ok=14 violations=0) — form was never the problem.
10
+ #
11
+ # 🟥 EXIT 0 ALWAYS, REPORT ON STDOUT. A hook that exits non-zero has its stdout DISCARDED and its
12
+ # stderr NOT relayed — the warning would reach nobody. The finding therefore travels as JSON
13
+ # `hookSpecificOutput.additionalContext`, which the runtime injects into MODEL context.
14
+ #
15
+ # DEGRADE DIRECTION: silent. No checklist, no dependency edges, missing python, unreadable file →
16
+ # say nothing and exit 0. This is ADVISORY on a reversible surface; a noisy hook on every subagent
17
+ # stop trains people to ignore hooks, which disarms the ones guarding irreversible surfaces.
18
+ # 🟥 Named residual: that silence also swallows rc=4 (a checklist that STOPPED recording
19
+ # dependencies). Narrow on purpose; widen only if that is ever measured to happen.
20
+ set -uo pipefail
21
+
22
+ HUB="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || echo "$HOME/projects/forge-harness")}"
23
+ SUBJ="$HUB/scripts/session_checklist.py"
24
+ [ -f "$SUBJ" ] || exit 0
25
+ command -v python3 >/dev/null 2>&1 || exit 0
26
+
27
+ # Newest checklist. 🟥 `ls -t … | head -1` is not used: with zsh nullglob a no-match argument is
28
+ # DELETED from the command line and `ls` silently lists the CWD instead — this repo has that scar.
29
+ FILE="$(/usr/bin/find "$HUB/tracks/_meta" -maxdepth 1 -name 'session_checklist_*.md' -type f 2>/dev/null \
30
+ | /usr/bin/sort | /usr/bin/tail -1)"
31
+ [ -n "${FILE:-}" ] && [ -f "$FILE" ] || exit 0
32
+
33
+ OUT="$(python3 "$SUBJ" unblocked --file "$FILE" 2>/dev/null)"; RC=$?
34
+ [ "$RC" -eq 1 ] || exit 0 # 0 clean · 4 dead-control · 10 input error → all silent, see header
35
+
36
+ FINDINGS="$(printf '%s\n' "$OUT" | /usr/bin/grep 'is still open' | /usr/bin/sed 's/^[[:space:]]*//')"
37
+ [ -n "$FINDINGS" ] || exit 0
38
+
39
+ # 🟥 findings travel as ARGV, not stdin. A first draft used `python3 - <<'PY' <<<"$FINDINGS"` — two
40
+ # redirects on one command, and the LAST one wins, so bash fed the findings in as the *script*
41
+ # (`SyntaxError: invalid character '⚠'`). Named here because the failure was loud only by luck.
42
+ python3 - "$FILE" "$FINDINGS" <<'PY'
43
+ import json, sys
44
+ path, findings = sys.argv[1], sys.argv[2].strip()
45
+ msg = (
46
+ "\U0001f7e5 CHECKLIST: a blocker just cleared and the dependent row is still open.\n"
47
+ + findings
48
+ + "\n\nFile: " + path
49
+ + "\nRe-read those rows before moving on — this is the exact shape in which three operator "
50
+ "requests degraded on 2026-09-19 (they were on the checklist, blocked, unblocked, never re-read). "
51
+ "This is a record property, not a judgment: it does not claim the row should be worked now, only "
52
+ "that nothing has been written since its blocker closed."
53
+ )
54
+ print(json.dumps({"hookSpecificOutput": {"hookEventName": "SubagentStop", "additionalContext": msg}},
55
+ ensure_ascii=False))
56
+ PY
57
+ exit 0
@@ -89,8 +89,37 @@ count_check() { # count_check <label> <file> <expected-string>
89
89
  fi
90
90
  }
91
91
  count_check "fh-meta plugin.json" plugins/fh-meta/.claude-plugin/plugin.json "${meta_sk} skills + ${meta_ag} agents"
92
- count_check "fh-commons plugin.json" plugins/fh-commons/.claude-plugin/plugin.json "${com_sk} skills"
92
+ # 🟥 fh-commons 는 skills 절반만 검사하고 있었다 — 그리고 그 사이 agents 가 드리프트했다.
93
+ # 2026-09-19 실측: 디스크 6 skills / **7** agents · plugin.json 선언 "6 skills + **1** agent"
94
+ # · marketplace.json 선언 "**5** skills … + 1 agent". 셋이 다 어긋났는데 COUNT-CHECK 는
95
+ # **PASS** 였다 — 단언 문자열이 `"6 skills"` 라 긴 문장 안에서 그대로 걸렸기 때문이다.
96
+ # 즉 «목록=커버리지» 의 (A) 방향: 단언 목록 밖의 수치는 **조용히 통과한다.**
97
+ # fh-meta 와 같은 «쌍» 으로 올려 두 수치를 한 번에 결박한다.
98
+ count_check "fh-commons plugin.json" plugins/fh-commons/.claude-plugin/plugin.json "${com_sk} skills + ${com_ag} agents"
93
99
  count_check "marketplace.json fh-meta" .claude-plugin/marketplace.json "${meta_sk} skills + ${meta_ag} agents"
100
+ # 🟥 marketplace.json 은 fh-meta 만 검사하고 있었다 — fh-commons 항목은 어느 단언에도 없었다.
101
+ # 🟥 그리고 **파일 전체 grep 으로는 per-plugin 주장을 못 한다.** 첫 수리에서 실제로 났다:
102
+ # `"${com_ag} agent"`(=7) 가 같은 파일 안 fh-meta 의 "35 skills + 7 agents" 에 걸려 **PASS**
103
+ # 했다 — 대상 항목은 "1 agent" 인 채로. 장식 앵커였다. 그래서 그 항목만 «잘라내서» 본다.
104
+ mp_desc() { # mp_desc <plugin-name-substring> → 그 항목의 description 만
105
+ read_tree .claude-plugin/marketplace.json | python3 -c "
106
+ import json,sys
107
+ try: d=json.load(sys.stdin)
108
+ except Exception: sys.exit(3)
109
+ for p in d.get('plugins',[]):
110
+ if sys.argv[1] in p.get('name',''): print(p.get('description','')); break
111
+ " "$1"
112
+ }
113
+ mp_check() { # mp_check <label> <plugin-substring> <expected>
114
+ local body esc
115
+ body=$(mp_desc "$2") || { echo "FAIL count: $1 — marketplace.json 파싱 불가 (계기 오류, 0 아님)"; fail=1; return; }
116
+ [ -n "$body" ] || { echo "FAIL count: $1 — marketplace.json 에 '$2' 항목이 없다 (부재≠통과)"; fail=1; return; }
117
+ esc=$(printf '%s' "$3" | sed 's/[][\.*^$+?(){}|\\/]/\\&/g')
118
+ if printf '%s' "$body" | grep -qE "(^|[^0-9])${esc}([^0-9]|\$)"; then echo "PASS count: $1"
119
+ else echo "FAIL count: $1 — expected \"$3\" in the fh-commons marketplace entry"; fail=1; fi
120
+ }
121
+ mp_check "marketplace.json fh-commons skills" fh-commons "${com_sk} skills"
122
+ mp_check "marketplace.json fh-commons agents" fh-commons "${com_ag} agent"
94
123
  # ── README 렌더링만 per-repo override 를 받는다 ──────────────────────────────────────────────
95
124
  # 왜 이 한 줄만 다른가: plugin.json·marketplace.json 의 문자열은 **기계 결합**(영문 고정,
96
125
  # 소비처가 파싱한다)이지만 README 헤더는 **사람이 읽는 산문**이라 하류 하네스가 자기 언어로 쓴다.
@@ -0,0 +1,283 @@
1
+ #!/usr/bin/env bash
2
+ # outbound_pr_gate.sh — PreToolUse(Bash): a PR about to be OPENED on a repo we do not own.
3
+ #
4
+ # THE DEFECT (measured, outbound corpus to non-owned repos, 2026-06-20..09-18)
5
+ # Counted by outcome: 4 merged · 1 declined-on-SCOPE (we were right — no defect to fix) ·
6
+ # 1 closed-on-DEFECT · 2 CHANGES_REQUESTED · 1 awaiting. THREE carry a technical-defect
7
+ # finding, and all three are ONE shape: our guard and our test ran on OUR MODEL of the target,
8
+ # and the maintainer's evidence was an execution we had never run.
9
+ # tt-a1i/archify#328 a pre-write source-hash check "cannot catch damage caused by
10
+ # the write itself" (destination symlinked to the input).
11
+ # clawd-on-desk#1025 the test asserted attribute removal and then called the
12
+ # next-stage handler SYNCHRONOUSLY, so the IPC round-trip that IS
13
+ # the regression window did not exist in the test at all.
14
+ # clawd-on-desk#1021 "every exception fixture contains only one effective
15
+ # destructive decision, so they cannot detect this composition
16
+ # failure" — the maintainer's own words for why our suite was
17
+ # green while 13 of 16 composed commands auto-allowed.
18
+ # All three were submitted after a STATIC read of the target.
19
+ # `[[feedback_fixture_shape_from_artifact_not_mental_model]]` (N>=6 across repos/languages).
20
+ #
21
+ # WHY A HOOK AND NOT PROSE
22
+ # CLAUDE.md §Skeleton-Not-Muscle already scopes "code contributed upstream to someone else's
23
+ # repo", and §7's `standpoint:` enum already has the rung that separates the two outcomes
24
+ # (#888 merged exactly-as-submitted ran the consumer path; #1025 read it). The rule exists and
25
+ # was NOT wired. Measured precedent for why prose is not the fix: the same rule as a CLAUDE.md
26
+ # table row fired 1/15 at floor tier; as a PreToolUse hook, 9/9 (proposal_hook r3/r4).
27
+ #
28
+ # WHY *THIS* SURFACE AND NOT pre-commit
29
+ # An outbound PR is authored in the TARGET's clone and committed under the TARGET's hooks.
30
+ # forge-harness' pre-commit/pre-push are structurally not on that path — no FH commit occurs.
31
+ # `gh pr create` IS the outbound executor, and PreToolUse is the only place that sits on it
32
+ # ([[feedback_instrument_not_on_the_path]], same reasoning as outbound_query_hook's).
33
+ #
34
+ # DEGRADE DIRECTION — split by what we could ESTABLISH, and the split is the design
35
+ # target positively NON-OWNED -> DENY (exit 2). Opening a PR on a stranger's repo is
36
+ # publish-class: CLAUDE.md §Autonomous-Initiative already lists
37
+ # "opening/updating a PR" as publish intent, and
38
+ # §Irreversibility Gates says that surface fails CLOSED.
39
+ # target positively OWNED -> silent. FH's own PRs must never be touched; a gate that
40
+ # blocks every internal PR is a bypass trainer.
41
+ # applicability UNDETERMINED -> ADVISORY, never deny. We have not established that we are on
42
+ # the protected surface at all, and denying here would block
43
+ # every bare `gh pr create`. NAMED RECALL RESIDUAL: an external
44
+ # PR opened from an already-`cd`-ed shell with no -R and no cwd
45
+ # in the payload gets an advisory that arrives on the next turn,
46
+ # i.e. after the PR is open. That residue is swept post-hoc by
47
+ # session_close_check.sh ①-b (cross-repo + reviewDecision).
48
+ # instrument incomplete on a
49
+ # NON-OWNED target -> DENY. NOT SCANNED is not clean.
50
+ # not an FH checkout -> silent (mechanical: is the tracked anchor file here?).
51
+ #
52
+ # WHAT IT CHECKS — the RECORD's shape, never the claim's truth (§Mechanization Boundary)
53
+ # A record file tracks/_meta/outbound_pr_<TODAY>_<slug>.md carrying three typed lines:
54
+ # standpoint: tier2(<repo>) — ran `<cmd>` there, output: <what you saw>
55
+ # generated-path: none-found(<the generator grep you ran>) | found(<path> -> <generator>)
56
+ # fixture-carries: asserted(<cmd>, <what you saw>) | not-applicable(<grounds>)
57
+ # `standpoint:` is the EXISTING closed enum (CLAUDE.md §7). This gate applies an ALLOW-LIST of
58
+ # its strong rungs — tier2 / tier2b / tier3 — so tier1, tier1b, not-applicable, UNKNOWN, every
59
+ # DEGRADED_*, and ANY FUTURE MEMBER block by default. Default-deny on an unknown value is the
60
+ # same contract validate_standpoint_leg() uses; lane L8 fails if a new enum member is added
61
+ # without being classified here.
62
+ # `generated-path:` closes archify#328② (editing a build OUTPUT: the canon is the generator's
63
+ # input). NONE FOUND is printed as UNPROVEN, never as safe.
64
+ # `fixture-carries:` closes archify#328①, clawd#1025③④ AND clawd#1021 — all three are ONE
65
+ # proposition: "the fixture never put the system into the state where the defect is
66
+ # OBSERVABLE." Three spellings measured so far, all from our own closed/blocked PRs:
67
+ # A the destination was never a symlink to the input, so a pre-write hash check could not
68
+ # see the damage the write itself caused (archify#328①)
69
+ # B the IPC round-trip never existed in the test, because the next-stage handler was called
70
+ # synchronously, so the transition window was not in the fixture at all (clawd#1025③④)
71
+ # C every exception fixture carried exactly ONE effective destructive decision, so a
72
+ # first-match-only evaluator could not be told from an all-match one (clawd#1021 —
73
+ # maintainer's own words, and reproduced by the governor: 13 of 16 composed commands
74
+ # AUTO-ALLOW, e.g. `npm publish --dry-run && rm -rf /`, with live controls `ls -la`→null
75
+ # and `rm -rf /`→HOLD)
76
+ # ONE FIELD, NOT ONE PER DEFECT. A fourth spelling lands as a fourth bullet in the deny text —
77
+ # zero enum change, zero lane change. Growing the FIELD set one-per-defect is how a gate turns
78
+ # into a form: with `not-applicable` available, a field that is almost always not-applicable
79
+ # trains rubber-stamping (measured in this repo's own standpoint corpus: 6 bare
80
+ # `not-applicable`). 🟥 NAMED RESIDUAL of folding: a session can answer spelling A and never
81
+ # consider C, and the gate is satisfied. Closing that would need a grounds-vocabulary grep,
82
+ # i.e. a frozen judgment about what an adequate answer sounds like — deliberately not built.
83
+ # It is a FIELD and not a detector on purpose: a grep for "next-stage handler called on the
84
+ # following line" asserts a CONCLUSION about test adequacy.
85
+ #
86
+ # 🟥 SELF-ATTESTED, AND THAT IS THE INTENDED RESIDUE. This blocks the record's FORM (present,
87
+ # typed, attributable, non-vacuous), never whether the run was real — the same boundary the
88
+ # crossfamily/standpoint/thirdparty commit lanes already live on.
89
+ #
90
+ # Override, recorded by construction: put FH_OUTBOUND_PR_OK=1 in the command itself. The hook
91
+ # reads the COMMAND STRING (an env var exported in the session is not in the hook's env), so
92
+ # the override lands in the transcript, and the PR it lets out is itself swept by ①-b.
93
+ #
94
+ # Ownership discriminator — CALIBRATED, offline, zero network (2026-09-18, this machine):
95
+ # a clone of a repo we do not own carries an `upstream` remote under a foreign owner.
96
+ # ~/projects/archify upstream tt-a1i/archify -> NON-OWNED (known-pos)
97
+ # ~/projects/clawd-on-desk upstream rullerzhou-afk/clawd-on-desk-> NON-OWNED (known-pos)
98
+ # ~/projects/forge-harness no upstream -> OWNED (known-neg)
99
+ # ~/projects/qasp-dev no upstream (has ghe/tst) -> OWNED (known-neg)
100
+ # Both directions separate, so the discriminator measures rather than generates.
101
+ #
102
+ # Usage: hook: PreToolUse matcher "Bash" -> bash scripts/outbound_pr_gate.sh
103
+ # test: printf '%s' '<json>' | bash scripts/outbound_pr_gate.sh
104
+ # Lanes: bash scripts/test_outbound_pr_gate_lanes.sh
105
+ set -uo pipefail
106
+
107
+ SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
108
+ FH="${CLAUDE_PROJECT_DIR:-}"
109
+ [ -n "$FH" ] || FH="$(cd "$SELF_DIR/.." && pwd)"
110
+ # Applicability of the whole hook: only inside an FH checkout. Mechanical, never self-judged —
111
+ # same test shape as outbound_query_hook's (a tracked anchor that only this repo ships).
112
+ ANCHOR="${FH_OUTBOUND_ANCHOR:-$FH/scripts/session_close_check.sh}"
113
+ [ -f "$ANCHOR" ] || exit 0
114
+
115
+ TODAY="${FH_OUTBOUND_TODAY:-$(date +%Y-%m-%d)}"
116
+ RECDIR="${FH_OUTBOUND_RECDIR:-$FH/tracks/_meta}"
117
+
118
+ # ── read the payload ──────────────────────────────────────────────────────────────────────────
119
+ # python3 is used ONLY to parse. The DENY path below needs no interpreter (exit 2 + stderr), so a
120
+ # dead python3 cannot silently unblock this surface — it makes us read nothing and exit 0, which
121
+ # is the one documented fail-open and is identical to the hook not being wired at all.
122
+ RAW=$(cat)
123
+ PARSED=$(printf '%s' "$RAW" | python3 -c '
124
+ import json,sys
125
+ try: d=json.load(sys.stdin)
126
+ except Exception: sys.exit(0)
127
+ if not isinstance(d,dict) or d.get("tool_name")!="Bash": sys.exit(0)
128
+ ti=d.get("tool_input") or {}
129
+ cmd=(ti.get("command") if isinstance(ti,dict) else str(ti)) or ""
130
+ cwd=str(d.get("cwd") or "")
131
+ sys.stdout.buffer.write(("CWD\t"+cwd.replace("\t"," ").replace("\n"," ")+"\n").encode("utf-8"))
132
+ sys.stdout.buffer.write(("CMD\t"+cmd.replace("\t"," ").replace("\n","; ")+"\n").encode("utf-8"))
133
+ ' 2>/dev/null) || exit 0
134
+ [ -n "$PARSED" ] || exit 0
135
+ PAY_CWD=$(printf '%s\n' "$PARSED" | sed -n 's/^CWD\t//p' | head -1)
136
+ CMD=$(printf '%s\n' "$PARSED" | sed -n 's/^CMD\t//p' | head -1)
137
+ [ -n "$CMD" ] || exit 0
138
+
139
+ # ── is this the outbound act? ─────────────────────────────────────────────────────────────────
140
+ # create / reopen / ready: the three ways a PR is put in front of a stranger. `gh pr edit --body`
141
+ # is publish per CLAUDE.md too and is a NAMED GAP here, not a claimed coverage.
142
+ # 🟥 cross-family (codex, 2026-09-18) 이 트리거를 공격했고, **주장 7건 중 5건은 실측에서 틀렸다** —
143
+ # `command gh` · `env X=1 gh` · `time gh` · `noglob gh` · `gh pr create --repo 'o/r'` 는 종전 식으로도
144
+ # 전부 잡힌다(선행 문자가 공백이므로). 실제로 안 잡히던 것은 셋이고, 그중 둘을 여기서 닫는다:
145
+ # ⓐ 경로 형태 `/opt/homebrew/bin/gh pr create` · `./gh pr create` → `([^ ;&|]*/)?` 추가
146
+ # ⓑ 인용 안쪽 `sh -c 'gh pr create …'` → 선행 문자류에 ' " ` 추가
147
+ # 🟥 셋째는 **정규식으로 닫히지 않는다**: 변수 간접(`GH_CMD=gh; $GH_CMD pr create`) · 셸 alias ·
148
+ # gh 를 감싼 스크립트. 이름으로 남긴 잔여이고, 이 훅은 그래서 «상기시키는 층» 이지 floor 가 아니다.
149
+ # ⚠️ 알려진 과차단 하나: `echo gh pr create` 도 잡힌다. 과차단 방향이라 그대로 둔다
150
+ # (막는 쪽으로 틀리는 것이 이 표면에서 옳다).
151
+ printf '%s' "$CMD" | LC_ALL=C grep -qE '(^|[ ;&|('"'"'"`])([^ ;&|]*/)?gh +([^ ;&|]+ +)*pr +(create|reopen|ready)([ ;&|]|$)' || exit 0
152
+
153
+ # ── owned-owner set ───────────────────────────────────────────────────────────────────────────
154
+ OWNERS=""
155
+ _origin=$(git -C "$FH" remote get-url origin 2>/dev/null || true)
156
+ _o=$(printf '%s' "$_origin" | sed -E 's#^.*[/:]([^/:]+)/[^/]+$#\1#')
157
+ [ -n "$_o" ] && [ "$_o" != "$_origin" ] && OWNERS="$_o"
158
+ # Optional operator layer; absent by construction in a consumer install.
159
+ OWNFILE="${FH_OWNED_OWNERS_FILE:-$FH/.claude/rules/.owned-owners}"
160
+ [ -f "$OWNFILE" ] && OWNERS="$OWNERS
161
+ $(grep -vE '^[[:space:]]*(#|$)' "$OWNFILE" 2>/dev/null || true)"
162
+
163
+ _is_owned() { # $1 = owner login
164
+ [ -n "${1:-}" ] || return 1
165
+ printf '%s\n' "$OWNERS" | grep -qxF "$1"
166
+ }
167
+
168
+ # A clone's BASE repo, as `gh pr create` resolves it: the fork parent (`upstream`) when the clone
169
+ # is a fork, otherwise `origin` itself. Reading only `upstream` would call a DIRECT clone of a
170
+ # foreign repo "ours" — that is the same not-found-is-not-zero face this repo keeps meeting.
171
+ _base_repo_of() { # $1 = a directory; echoes "owner/repo", or nothing
172
+ local d="$1" u r
173
+ [ -n "$d" ] && [ -d "$d" ] || return 1
174
+ git -C "$d" rev-parse --git-dir >/dev/null 2>&1 || return 1
175
+ u=$(git -C "$d" remote get-url upstream 2>/dev/null)
176
+ [ -n "$u" ] || u=$(git -C "$d" remote get-url origin 2>/dev/null)
177
+ [ -n "$u" ] || return 1
178
+ r=$(printf '%s' "$u" | sed -E 's#\.git$##; s#^.*[/:]([^/:]+/[^/:]+)$#\1#')
179
+ case "$r" in */*) printf '%s' "$r" ;; *) return 1 ;; esac
180
+ }
181
+
182
+ # ── resolve the target, first hit wins ────────────────────────────────────────────────────────
183
+ TARGET=""; OWNER=""; HOW=""
184
+ _spec=$(printf '%s' "$CMD" | LC_ALL=C grep -oE '(^|[ ;&|])(-R|--repo)[= ]+[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+' | head -1 \
185
+ | sed -E 's#.*[= ]([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)$#\1#')
186
+ if [ -n "$_spec" ]; then
187
+ TARGET="$_spec"; OWNER="${_spec%%/*}"; HOW="-R/--repo in the command"
188
+ else
189
+ _cd=$(printf '%s' "$CMD" | LC_ALL=C grep -oE '(^|[ ;&|])cd +[^ ;&|]+' | head -1 | sed -E 's#.*cd +##')
190
+ for _d in "$_cd" "$PAY_CWD"; do
191
+ [ -n "$_d" ] || continue
192
+ if _b=$(_base_repo_of "$_d"); then
193
+ TARGET="$_b"; OWNER="${_b%%/*}"; HOW="base repo of $_d (upstream, else origin)"; break
194
+ fi
195
+ done
196
+ fi
197
+
198
+ if [ -z "$OWNER" ]; then
199
+ VERDICT="UNDETERMINED"
200
+ elif _is_owned "$OWNER"; then
201
+ exit 0 # positively ours — silent, always
202
+ else
203
+ VERDICT="NON-OWNED"
204
+ fi
205
+
206
+ # ── record check (only reached on NON-OWNED / UNDETERMINED) ───────────────────────────────────
207
+ # Grounds bar is 20 chars, deliberately the SAME number validate_standpoint_leg() uses — one bar,
208
+ # not a second one that drifts.
209
+ STRONG_RUNGS="tier2 tier2b tier3"
210
+ WEAK_RUNGS="tier1 tier1b not-applicable UNKNOWN DEGRADED_NO_TARGET_ACCESS DEGRADED_NOT_RUN"
211
+ REASONS=""
212
+ _add() { REASONS="${REASONS} - $1
213
+ "; }
214
+
215
+ _field() { # $1 = field name; echoes the value line or nothing
216
+ ls -1 "$RECDIR"/outbound_pr_"$TODAY"_*.md 2>/dev/null | while read -r f; do
217
+ grep -m1 -E "^[[:space:]]*$1:" "$f" 2>/dev/null
218
+ done | head -1
219
+ }
220
+ _records=$(ls -1 "$RECDIR"/outbound_pr_"$TODAY"_*.md 2>/dev/null | wc -l | tr -d ' ')
221
+
222
+ if [ "${_records:-0}" -eq 0 ]; then
223
+ _add "no record: expected $RECDIR/outbound_pr_${TODAY}_<slug>.md — none exists."
224
+ else
225
+ _sp=$(_field standpoint); _sp=${_sp#*:}
226
+ _spv=$(printf '%s' "$_sp" | sed -E 's/^[[:space:]]*//; s/[[:space:]]*(—|--).*$//; s/[[:space:]]+$//; s/^["'"'"']//')
227
+ _spg=$(printf '%s' "$_sp" | sed -E 's/^[^—-]*((—|--)[[:space:]]*)?//')
228
+ case "$_spv" in
229
+ tier2\(*\)|tier2b\(*\)|tier3\(*\))
230
+ [ "${#_spg}" -lt 20 ] && _add "standpoint: $_spv — grounds do not name the command you ran and the output you saw." ;;
231
+ "") _add "standpoint: line absent from the record. The enum is CLAUDE.md §7; only $STRONG_RUNGS clear this gate." ;;
232
+ *) _add "standpoint: '$_spv' is not a strong rung. tier1b means you READ the target and ran nothing — that is the signal that it is NOT time to submit (clawd#1025 was exactly this). Strong rungs: $STRONG_RUNGS." ;;
233
+ esac
234
+ _gp=$(_field generated-path); _gp=${_gp#*:}
235
+ _gpv=$(printf '%s' "$_gp" | sed -E 's/^[[:space:]]*//; s/\(.*$//; s/[[:space:]]+$//')
236
+ _gpg=$(printf '%s' "$_gp" | sed -E 's/^[^(]*\(//; s/\)[[:space:]]*$//')
237
+ case "$_gpv" in
238
+ found|none-found) [ "${#_gpg}" -lt 20 ] && _add "generated-path: $_gpv() carries no grounds — name the generator grep you ran over the target repo." ;;
239
+ "") _add "generated-path: line absent. For every path this patch touches, grep the target's own generators (package.json scripts, *.mjs|*.js|*.sh that WRITE that path). A hit means the edit is in the wrong place — the canon is the generator's input (archify#328②). Absence is 'none-found', i.e. UNPROVEN, never 'safe'." ;;
240
+ *) _add "generated-path: '$_gpv' is not one of: found(...) | none-found(...)." ;;
241
+ esac
242
+ _ar=$(_field fixture-carries); _ar=${_ar#*:}
243
+ _arv=$(printf '%s' "$_ar" | sed -E 's/^[[:space:]]*//; s/\(.*$//; s/[[:space:]]+$//')
244
+ _arg=$(printf '%s' "$_ar" | sed -E 's/^[^(]*\(//; s/\)[[:space:]]*$//')
245
+ case "$_arv" in
246
+ asserted|not-applicable) [ "${#_arg}" -lt 20 ] && _add "fixture-carries: $_arv() carries no grounds." ;;
247
+ "") _add "fixture-carries: line absent. The fixture must put the system into the state where the defect is OBSERVABLE; three spellings measured in our own closed PRs — (A) destination pre-made as a symlink to the input, assert the INPUT's post-state [archify#328]; (B) assert INSIDE the async window, do not call the next-stage handler synchronously [clawd#1025]; (C) the input carries >=2 effective decisions with the FIRST one excepted, so a first-match-only evaluator is distinguishable [clawd#1021]. Answer whichever applies, and name the run. Values: asserted(<cmd>, <what you saw>) | not-applicable(<grounds>)." ;;
248
+ DEGRADED_NOT_RUN) _add "fixture-carries: DEGRADED_NOT_RUN — 'did not run it' is an honest record and it is also the answer 'not yet ready to submit'. Run it, or record not-applicable(<grounds>)." ;;
249
+ *) _add "fixture-carries: '$_arv' is not one of: asserted(...) | not-applicable(...) | DEGRADED_NOT_RUN(...)." ;;
250
+ esac
251
+ fi
252
+
253
+ # ── verdict ───────────────────────────────────────────────────────────────────────────────────
254
+ HDR="OUTBOUND-PR GATE — target $TARGET ($HOW)"
255
+ if [ "$VERDICT" = "UNDETERMINED" ]; then
256
+ [ -n "$REASONS" ] || exit 0
257
+ BODY=" ⚠️ OUTBOUND-PR GATE — could not establish whether this PR's base repo is ours.
258
+ Advisory only (denying here would block every bare \`gh pr create\`), and it reaches you on
259
+ the NEXT turn — the PR may already be open. If the base repo is NOT ours, the record is owed:
260
+ ${REASONS} Re-run with -R <owner>/<repo> to get a decided verdict instead of this one."
261
+ if json=$(printf '%s' "$BODY" | PYTHONIOENCODING=utf-8 python3 -c '
262
+ import json,sys
263
+ h=sys.stdin.read()
264
+ print(json.dumps({"systemMessage":h,"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":h}}))
265
+ ' 2>/dev/null) && [ -n "$json" ]; then printf '%s\n' "$json"; exit 0; fi
266
+ printf '%s\n' "$BODY" >&2
267
+ exit 0
268
+ fi
269
+
270
+ # NON-OWNED from here down.
271
+ if printf '%s' "$CMD" | LC_ALL=C grep -qE 'FH_OUTBOUND_PR_OK=1'; then
272
+ printf '%s\n' " ⚠️ $HDR — FH_OUTBOUND_PR_OK=1 in the command: gate acknowledged, not satisfied." >&2
273
+ exit 0
274
+ fi
275
+ [ -n "$REASONS" ] || exit 0
276
+ printf '%s\n' " ❌ $HDR
277
+ A PR on a repo we do not own is publish-class and this gate fails CLOSED.
278
+ Owed, in $RECDIR/outbound_pr_${TODAY}_<slug>.md:
279
+ ${REASONS} Three of our outbound PRs carry a technical-defect finding (#1025 closed, #328 and #1021
280
+ changes-requested) and all three were submitted after a STATIC read of the target. This gate
281
+ blocks the RECORD's shape, never the truth of the run.
282
+ Deliberate and reviewed -> prefix the command with FH_OUTBOUND_PR_OK=1." >&2
283
+ exit 2
@@ -197,6 +197,23 @@ ACCEPTED_ABSENT=(
197
197
  # 아니다. 여기 등재하는 이유도 같다: files[] 추가는 소비자-대면 변경이라 false-FAIL 이
198
198
  # 없음을 tarball 모드로 따로 증명해야 하는데, 이 델타는 **배선 델타**다. 카드로 이월.
199
199
  "scripts/test_prepush_destructive_liveness.sh"
200
+ # ⓐ-2 test_liveness_echo_token_lanes.sh — ⓐ 의 **앵커**다. 주체가 위에서 «일부러 안 싣는»
201
+ # 파일이므로, 소비자 머신에는 이 레인이 잴 대상이 아예 없다. 실어봐야 매 실행 SKIP 이고,
202
+ # 그 SKIP 은 「부재」와 「건강함」을 또 같은 글자로 만든다 — 이 레인이 존재하는 이유가
203
+ # 바로 그 부류의 충돌이다. 🟥 이것은 **빚이 아니라 «안 싣는 게 옳은» 쪽**이다(위 ⓒ 철회가
204
+ # 가른 그 구분): 주체가 없어서 못 재는 것이지, 재야 하는데 미룬 게 아니다. 주체가 언젠가
205
+ # 출하되면 이 예외도 같이 사라져야 한다 — 소비되지 않는 예외는 다음 진짜 누락을 삼킨다.
206
+ "scripts/test_liveness_echo_token_lanes.sh"
207
+ # ⓐ-3 test_checklist_unblocked_lanes.sh · test_tikitaka_score_lanes.sh — 같은 부류.
208
+ # 주체(session_checklist.py · tikitaka_score.py)의 출하 여부와 무관하게, **레인은 이 레포의
209
+ # 개발 표면**이다. 소비자에게 실어봐야 픽스처(scripts/fixtures/…)까지 딸려가야 하고 매 실행
210
+ # SKIP 이며, 그 SKIP 은 「부재」와 「건강함」을 또 같은 글자로 만든다.
211
+ # 🟥 반면 checklist_unblocked_hook.sh 는 **출하한다** — 출하되는 스니펫
212
+ # (templates/settings.SubagentStop.snippet.json)이 그 경로를 직접 부르므로, 안 실으면
213
+ # 소비자 머신에서 훅이 조용히 죽는다. 같은 PR 안에서 셋의 처분이 갈리는 이유가 그것이다.
214
+ "scripts/test_checklist_unblocked_lanes.sh"
215
+ "scripts/test_tikitaka_score_lanes.sh"
216
+ "scripts/tikitaka_score.py"
200
217
  # 🟥 ⓒ 는 **철회했다 — cross-family R2 지적이 맞았다.** 초판이
201
218
  # `templates/predelete_check.test.sh` 를 여기 넣고 «위 chamber 건과 같은 빚» 이라고 적었는데,
202
219
  # 그 둘은 같지 않다: chamber 는 «주체가 출하되는데 앵커가 안 나간다» 를 **빚으로 남긴** 것이고,
@@ -316,6 +333,16 @@ ACCEPTED_ABSENT=(
316
333
  # runner (labelled hub-local at the reference), which is a pointer for contributors, not a promise
317
334
  # of a shipped artifact — the skill's own save path works without it.
318
335
  "scripts/frontier_digest_daily.sh"
336
+ # 🟥 2026-09-18 — 발행 «확인» 3종. 이 레포 자기 릴리스 파이프라인의 부품이고 소비자 호출부가 없다.
337
+ # `publish_verify_poll.sh` 는 `.github/workflows/publish.yml` 의 verify 단계가 유일한 호출부이고,
338
+ # 워크플로 자체가 출하되지 않는다. 소비자는 `@chrono-meta/fh-gate` 를 발행하지 않으므로
339
+ # 이 스크립트를 부를 이유가 구조적으로 없다(PKG_NAME 으로 매개화돼 있긴 하다 — 그래서
340
+ # «불가능» 이 아니라 «호출부 부재» 라고 적는다).
341
+ # ⚠️ 그 결과 소비자 install 에서는 이 셋이 없고, selfcheck 의 해당 레인은 SKIP 으로 렌더된다.
342
+ # SKIP 은 PASS 가 아니다 — 이 레포에서는 레인이 실제로 돌고, 그것이 이 배선의 검증면이다.
343
+ "scripts/publish_verify_poll.sh"
344
+ "scripts/publish_verify_poll_stub_npm.sh"
345
+ "scripts/test_publish_verify_poll_lanes.sh"
319
346
  )
320
347
 
321
348
  # `--list-accepted`: print the ACCEPTED_ABSENT paths, one per line, and exit — no git/package.json