@chrono-meta/fh-gate 3.23.1 → 3.25.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 (54) hide show
  1. package/.claude/rules/fh_4axis_gate.md +14 -1
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/CLAUDE.md +5 -4
  4. package/README.md +8 -6
  5. package/knowledge/shared/harness-core/claude_md_gate_details.md +34 -0
  6. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +30 -0
  7. package/knowledge/shared/harness-core/fh_integration_contract.md +0 -1
  8. package/knowledge/shared/harness-core/fh_opencode_governance_wrapper.md +0 -1
  9. package/knowledge/shared/harness-core/fh_three_layer_canon.md +172 -2
  10. package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +22 -0
  11. package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
  12. package/knowledge/shared/harness-core/harness_verification_core_extended.md +26 -0
  13. package/knowledge/shared/harness-core/ship_readiness_gate.md +3 -0
  14. package/knowledge/shared/harness-core/sonnet_floor_doctrine.md +19 -0
  15. package/knowledge/shared/learnings/subagent_invocations_log.yaml +30 -0
  16. package/package.json +12 -2
  17. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  19. package/plugins/fh-meta/CHANGELOG.md +17 -0
  20. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +17 -3
  21. package/plugins/fh-meta/skills/verify-bidirectional/SKILL.md +1 -1
  22. package/plugins/fh-preprep/.claude-plugin/plugin.json +2 -2
  23. package/plugins/fh-preprep/README.md +11 -0
  24. package/plugins/fh-preprep/skills/preprep/SKILL.md +47 -1
  25. package/plugins/fh-preprep/skills/preprep/lane_speech_coach.py +1080 -0
  26. package/plugins/fh-preprep/skills/preprep/test_lane_speech_coach.py +705 -0
  27. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  28. package/scripts/cluster_capability_scan.sh +17 -0
  29. package/scripts/compaction_probe.sh +102 -23
  30. package/scripts/count_check.sh +37 -10
  31. package/scripts/field_canon_preload.sh +84 -2
  32. package/scripts/marker_diff_sha.sh +13 -0
  33. package/scripts/mutation_probe.py +1541 -0
  34. package/scripts/resident_cost.py +371 -0
  35. package/scripts/revert_probe.sh +5 -6
  36. package/scripts/selfcheck.sh +62 -0
  37. package/scripts/test_axis23_skip_reason_lanes.sh +109 -0
  38. package/scripts/test_count_check_all_plugins_lanes.sh +130 -0
  39. package/scripts/test_field_canon_lanes.sh +33 -0
  40. package/scripts/test_hook_templates_copilot_compat_lanes.sh +250 -0
  41. package/scripts/test_marker_diff_sha_lanes.sh +129 -0
  42. package/scripts/test_mutation_probe_lanes.sh +786 -0
  43. package/scripts/test_preprep_speech_coach_lanes.sh +62 -0
  44. package/scripts/test_resident_cost_lanes.sh +182 -0
  45. package/scripts/test_skill_canon_preload_lanes.sh +148 -0
  46. package/scripts/universal_guard_check.sh +2 -0
  47. package/templates/.git-hooks/pre-commit +109 -5
  48. package/templates/goal-quench-hook-setup.md +3 -3
  49. package/templates/goal-quench-settings-merged.json +0 -1
  50. package/templates/settings.Compaction.snippet.json +0 -2
  51. package/templates/settings.FieldCanon.snippet.json +0 -1
  52. package/templates/settings.SessionStart.snippet.json +0 -2
  53. package/templates/settings.SubagentStop.snippet.json +0 -1
  54. package/templates/subagent-tally-hook.json +0 -1
@@ -0,0 +1,371 @@
1
+ #!/usr/bin/env python3
2
+ # resident_cost.py — 세션 시작 «전» 상주 비용을 한 번에 재는 읽기 전용 계기 (2026-10-01 신설).
3
+ #
4
+ # 왜: 경량화를 논의하기 전에 «얼마인가» 를 같은 정의로 재야 한다. 2026-09-30 하루에 두 번 틀렸다 —
5
+ # ① CLAUDE.md 를 `wc -c`(바이트)로 재서 «153k 자» 라고 말했다(실제 136,889자 — 한글 1자 = 3바이트)
6
+ # ② 스킬 설명 합을 한 줄 파싱으로 재서 25,488 이라 적었다(YAML 파싱 = 19,473 — 접힌 블록 `>-` 를 못 읽음)
7
+ # 둘 다 계기가 없어서 생긴 오류다(tracks/_meta/research_2026-09-30_fh-lightweight-environment.md 부록).
8
+ #
9
+ # 무엇을 세나 — 줄마다 «이름 · 문자 · 바이트 · 출처».
10
+ # 문자 = UTF-8 디코드 후 len(). Claude Code 의 150.0k 경고와 MEMORY 절단이 문자 단위다(아래 보정).
11
+ # 1 레포 CLAUDE.md (tracked) — 150,000자 경고선까지 여유
12
+ # 2 CLAUDE.local.md (gitignored) — 없으면 «없음»(0 아님)
13
+ # 3 사용자 전역 ~/.claude/CLAUDE.md + 그 파일들이 `@경로` 로 import 하는 파일(재귀, 깊이 5, 순환 차단)
14
+ # 4 자동 메모리 MEMORY.md — 전체 · 공식 상한(첫 200줄 또는 25KB) · 이 머신 실측 상한(25,000자)
15
+ # 5 스킬 목록 — plugins/*/skills/*/SKILL.md frontmatter 의 name + description, YAML 파싱(접힌 블록 포함).
16
+ # 한 줄 파싱 값이 다르면 둘 다 낸다
17
+ # 6 .claude/rules/*.md 중 `paths:` 가 없는 것(세션 시작에 상주). paths: 가 있으면 조건부라 0 이 아니라 «조건부»
18
+ # 합계 — 측정 못 한 칸은 0 으로 접지 않고 «미측정 N칸» 을 옆에 적는다.
19
+ #
20
+ # MEMORY 상한 보정 (known-pair, 실물 1건 — 2026-10-01): 이 세션의 로더가 «147 of 285 lines were cut off,
21
+ # starting at "[컨트롤 있음 ≠ 판별력 있음]"» 를 보고했다. 같은 파일에 규칙 셋을 대 보면
22
+ # 25,000 **문자** → 첫 절단 줄 = 바로 그 항목(147줄 절단, 일치) · 25,000 바이트 → 91번째 줄 · 25,600 바이트 → 94번째 줄.
23
+ # ⇒ 이 머신의 실제 상한은 «줄 단위로 25,000자» 다. 공식 문서 문구(200줄/25KB)도 같이 계산해 보인다 — 어긋남 자체가 정보다.
24
+ # 🟥 N=1 이다. 로더가 바뀌면 이 상수부터 다시 재라(--memory-cap-chars).
25
+ #
26
+ # 범위 밖(이름으로 남긴다): 시스템 프롬프트 · 이 레포 밖 플러그인의 스킬 목록 · MCP 도구 설명 · 토큰 수.
27
+ # 그래서 «합계» 는 «FH 가 좌우하는 상주분» 이지 세션 전체 비용이 아니다.
28
+ # CLAUDE.md 크기 «가드» 는 scripts/test_claude_md_size_lanes.sh 가 따로 한다(한계 145,000). 이건 계기지 게이트가 아니다.
29
+ #
30
+ # 사용: python3 scripts/resident_cost.py [--json] [--repo DIR] [--user-claude FILE] [--memory-dir DIR]
31
+ # [--memory-cap-chars N] [--no-user]
32
+ # 환경변수: RESIDENT_COST_REPO · RESIDENT_COST_USER_CLAUDE · RESIDENT_COST_MEMORY_DIR (레인이 픽스처로 돌린다)
33
+ # 종료 코드: 0 = 전 칸 측정 · 3 = 미측정 칸 있음(합계는 나오지만 «전부» 가 아니다) · 2 = 인자 오류
34
+ import argparse
35
+ import glob
36
+ import json
37
+ import os
38
+ import re
39
+ import sys
40
+
41
+ CC_WARN_CHARS = 150000 # Claude Code: «CLAUDE.md is over the 150.0k-char limit»
42
+ MEM_CAP_CHARS_MEASURED = 25000 # 이 머신 실측(위 보정)
43
+ MEM_CAP_LINES_OFFICIAL = 200 # 공식 문서: 첫 200줄
44
+ MEM_CAP_BYTES_OFFICIAL = 25 * 1024 # 공식 문서: 25KB (KiB 로 읽음 — 문서가 단위를 안 밝힌다)
45
+ IMPORT_MAX_DEPTH = 5
46
+
47
+
48
+ def nchars(s):
49
+ return len(s)
50
+
51
+
52
+ def nbytes(s):
53
+ return len(s.encode("utf-8"))
54
+
55
+
56
+ HOME = os.path.expanduser("~")
57
+ _OTHER_HOME = re.compile(r"^(/Users/|/home/)[^/]+")
58
+
59
+
60
+ def show(path, mangled=None):
61
+ """출력용 경로 — 홈은 ~ 로, 메모리 디렉터리의 cwd 변환 이름은 <project> 로 가린다(residency)."""
62
+ p = os.path.abspath(path)
63
+ if mangled and mangled in p:
64
+ p = p.replace(mangled, "<project>")
65
+ if p == HOME or p.startswith(HOME + os.sep):
66
+ return "~" + p[len(HOME):]
67
+ # 남의 홈 경로(인자로 넘어온 것)도 사용자명을 가린다(cross-family R1 #3)
68
+ return _OTHER_HOME.sub(r"\1<user>", p)
69
+
70
+
71
+ def read_text(path):
72
+ """(status, text, err). status ∈ ok · absent · unmeasured."""
73
+ if not os.path.exists(path):
74
+ return "absent", None, None
75
+ try:
76
+ with open(path, encoding="utf-8") as f:
77
+ return "ok", f.read(), None
78
+ except (OSError, UnicodeDecodeError) as e:
79
+ return "unmeasured", None, f"{type(e).__name__}: {e}"
80
+
81
+
82
+ def row(name, path, status, text=None, err=None, mangled=None, **extra):
83
+ r = {"name": name, "source": show(path, mangled), "status": status,
84
+ "chars": None, "bytes": None}
85
+ if status == "ok":
86
+ r["chars"] = nchars(text)
87
+ r["bytes"] = nbytes(text)
88
+ if err:
89
+ r["error"] = err
90
+ r.update(extra)
91
+ return r
92
+
93
+
94
+ # ── @import ────────────────────────────────────────────────────────────────────────────────────────
95
+ _FENCE = re.compile(r"^\s*(```|~~~)")
96
+ _INLINE_CODE = re.compile(r"`[^`]*`")
97
+ _IMPORT = re.compile(r"(?:(?<=\s)|^)@((?:~|\.{1,2})?/?[A-Za-z0-9_.\-/]+)")
98
+
99
+
100
+ def import_tokens(text):
101
+ out, fenced = [], False
102
+ for line in text.splitlines():
103
+ if _FENCE.match(line):
104
+ fenced = not fenced
105
+ continue
106
+ if fenced:
107
+ continue
108
+ for m in _IMPORT.finditer(_INLINE_CODE.sub("", line)):
109
+ tok = m.group(1).rstrip(".,;:)")
110
+ if tok:
111
+ out.append(tok)
112
+ return out
113
+
114
+
115
+ def path_shaped(tok):
116
+ """대상이 없을 때 «해석 실패» 로 보고할 만큼 경로처럼 생겼나. `@me` 같은 맨 낱말은 대상이 없으면 조용히 무시한다.
117
+ 대상이 «있으면» 모양과 무관하게 import 로 센다 — 확장자 없는 `@LICENSE` 도 import 다(cross-family R1 #1)."""
118
+ return "/" in tok or "." in tok
119
+
120
+
121
+ def resolve_import(tok, base_dir):
122
+ if tok.startswith("~"):
123
+ return os.path.expanduser(tok)
124
+ if os.path.isabs(tok):
125
+ return tok
126
+ return os.path.normpath(os.path.join(base_dir, tok))
127
+
128
+
129
+ def follow_imports(path, text, label, rows, unresolved, seen, depth=1):
130
+ if depth > IMPORT_MAX_DEPTH:
131
+ return
132
+ for tok in import_tokens(text):
133
+ target = resolve_import(tok, os.path.dirname(os.path.abspath(path)))
134
+ key = os.path.realpath(target)
135
+ if key in seen:
136
+ continue
137
+ st, t, err = read_text(target)
138
+ if st == "absent":
139
+ if path_shaped(tok):
140
+ unresolved.append({"from": show(path), "token": "@" + tok})
141
+ continue
142
+ seen.add(key)
143
+ rows.append(row(f"{label} → @{tok}", target, st, t, err, depth=depth))
144
+ if st == "ok":
145
+ follow_imports(target, t, label, rows, unresolved, seen, depth + 1)
146
+
147
+
148
+ def claude_file(name, path, rows, unresolved, seen):
149
+ st, t, err = read_text(path)
150
+ r = row(name, path, st, t, err)
151
+ rows.append(r)
152
+ if st == "ok":
153
+ seen.add(os.path.realpath(path))
154
+ follow_imports(path, t, name, rows, unresolved, seen)
155
+ return r
156
+
157
+
158
+ # ── MEMORY.md ──────────────────────────────────────────────────────────────────────────────────────
159
+ def prefix_lines(lines, limit, measure):
160
+ """상한 안에 «통째로» 들어가는 줄 수. 줄 단위로 자른다(로더가 줄을 반으로 자르지 않는다 — 보정 실측)."""
161
+ acc = 0
162
+ for i, ln in enumerate(lines):
163
+ n = measure(ln)
164
+ if acc + n > limit:
165
+ return i
166
+ acc += n
167
+ return len(lines)
168
+
169
+
170
+ def memory_row(mem_dir, cap_chars, mangled):
171
+ path = os.path.join(mem_dir, "MEMORY.md")
172
+ st, t, err = read_text(path)
173
+ r = row("MEMORY.md (자동 메모리)", path, st, t, err, mangled=mangled)
174
+ if st != "ok":
175
+ return r
176
+ lines = t.splitlines(keepends=True)
177
+ n_meas = prefix_lines(lines, cap_chars, nchars)
178
+ loaded = "".join(lines[:n_meas])
179
+ n_line_cap = min(len(lines), MEM_CAP_LINES_OFFICIAL)
180
+ n_byte_cap = prefix_lines(lines, MEM_CAP_BYTES_OFFICIAL, nbytes)
181
+ n_off = min(n_line_cap, n_byte_cap)
182
+ official_binds = ("없음(전체 적재)" if n_off == len(lines)
183
+ else "200줄" if n_line_cap < n_byte_cap
184
+ else "25KB" if n_byte_cap < n_line_cap else "200줄=25KB 동시")
185
+ off = "".join(lines[:n_off])
186
+ r.update({
187
+ "lines": len(lines),
188
+ "loaded_chars": nchars(loaded), "loaded_bytes": nbytes(loaded),
189
+ "loaded_lines": n_meas, "cut_lines": len(lines) - n_meas,
190
+ "cap_rule": f"줄 단위 {cap_chars:,}자 (이 머신 실측)",
191
+ "official": {"lines": n_off, "chars": nchars(off), "bytes": nbytes(off),
192
+ "binds_first": official_binds,
193
+ "rule": f"첫 {MEM_CAP_LINES_OFFICIAL}줄 또는 25KB({MEM_CAP_BYTES_OFFICIAL:,} bytes)"},
194
+ })
195
+ return r
196
+
197
+
198
+ # ── skills ─────────────────────────────────────────────────────────────────────────────────────────
199
+ _FM = re.compile(r"\A---\r?\n(.*?)\r?\n---\r?\n", re.S)
200
+
201
+
202
+ def oneline_value(fm_text, key):
203
+ for line in fm_text.splitlines():
204
+ if line.startswith(key + ":"):
205
+ return line[len(key) + 1:].strip()
206
+ return ""
207
+
208
+
209
+ def skills_row(repo):
210
+ pattern = os.path.join(repo, "plugins", "*", "skills", "*", "SKILL.md")
211
+ files = sorted(glob.glob(pattern))
212
+ src = os.path.join(repo, "plugins", "*", "skills", "*", "SKILL.md")
213
+ if not files:
214
+ return row("스킬 목록 (name+description)", src, "absent", files=0)
215
+ try:
216
+ import yaml # noqa: WPS433 — 없으면 YAML 칸만 미측정, 한 줄 값은 그대로 낸다
217
+ except ImportError:
218
+ yaml = None
219
+ y_name = y_desc = o_name = o_desc = 0
220
+ y_bytes = 0
221
+ bad = []
222
+ for p in files:
223
+ st, t, err = read_text(p)
224
+ m = _FM.match(t or "") if st == "ok" else None
225
+ if not m:
226
+ bad.append(show(p) + (f" ({err})" if err else " (frontmatter 없음)"))
227
+ continue
228
+ fm = m.group(1)
229
+ o_name += nchars(oneline_value(fm, "name"))
230
+ o_desc += nchars(oneline_value(fm, "description"))
231
+ if yaml is not None:
232
+ try:
233
+ d = yaml.safe_load(fm) or {}
234
+ except yaml.YAMLError as e:
235
+ bad.append(f"{show(p)} (YAML: {str(e).splitlines()[0]})")
236
+ continue
237
+ nm, ds = str(d.get("name", "") or ""), str(d.get("description", "") or "")
238
+ y_name += nchars(nm)
239
+ y_desc += nchars(ds)
240
+ y_bytes += nbytes(nm) + nbytes(ds)
241
+ r = {"name": "스킬 목록 (name+description)", "source": show(src), "files": len(files),
242
+ "oneline": {"chars": o_name + o_desc, "desc_chars": o_desc}}
243
+ if yaml is None:
244
+ r.update(status="unmeasured", chars=None, bytes=None,
245
+ error="PyYAML 없음 — YAML 파싱 칸 미측정(한 줄 파싱 값은 접힌 블록을 못 읽으니 대신 쓰지 않는다)")
246
+ elif bad:
247
+ r.update(status="unmeasured", chars=None, bytes=None, error="파싱 실패: " + "; ".join(bad))
248
+ else:
249
+ r.update(status="ok", chars=y_name + y_desc, bytes=y_bytes, desc_chars=y_desc)
250
+ r["oneline_differs"] = (o_name + o_desc) != (y_name + y_desc)
251
+ return r
252
+
253
+
254
+ # ── rules ──────────────────────────────────────────────────────────────────────────────────────────
255
+ def rules_rows(repo):
256
+ out = []
257
+ for p in sorted(glob.glob(os.path.join(repo, ".claude", "rules", "*.md"))):
258
+ st, t, err = read_text(p)
259
+ r = row(".claude/rules/" + os.path.basename(p), p, st, t, err)
260
+ if st == "ok":
261
+ m = _FM.match(t)
262
+ if m and re.search(r"^paths\s*:", m.group(1), re.M):
263
+ r["status"] = "conditional" # 그 경로를 읽을 때만 실린다 — 시작 상주 아님
264
+ out.append(r)
265
+ return out
266
+
267
+
268
+ def mangle(cwd):
269
+ return re.sub(r"[^A-Za-z0-9]", "-", os.path.abspath(cwd))
270
+
271
+
272
+ def main(argv):
273
+ ap = argparse.ArgumentParser(description="세션 시작 상주 비용 계기(읽기 전용)")
274
+ ap.add_argument("--json", action="store_true")
275
+ ap.add_argument("--repo", default=os.environ.get("RESIDENT_COST_REPO"))
276
+ ap.add_argument("--user-claude", default=os.environ.get("RESIDENT_COST_USER_CLAUDE"))
277
+ ap.add_argument("--memory-dir", default=os.environ.get("RESIDENT_COST_MEMORY_DIR"))
278
+ ap.add_argument("--memory-cap-chars", type=int, default=MEM_CAP_CHARS_MEASURED)
279
+ ap.add_argument("--no-user", action="store_true", help="사용자 전역 CLAUDE.md 줄을 뺀다")
280
+ a = ap.parse_args(argv)
281
+
282
+ repo = a.repo or os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
283
+ if not os.path.isdir(repo):
284
+ print(f"resident_cost: --repo 가 디렉터리가 아니다: {repo}", file=sys.stderr)
285
+ return 2
286
+ repo = os.path.abspath(repo)
287
+ mangled = mangle(repo)
288
+ mem_dir = a.memory_dir or os.path.join(HOME, ".claude", "projects", mangled, "memory")
289
+ user_claude = a.user_claude or os.path.join(HOME, ".claude", "CLAUDE.md")
290
+
291
+ rows, unresolved, seen = [], [], set()
292
+ main_row = claude_file("CLAUDE.md (레포, tracked)", os.path.join(repo, "CLAUDE.md"), rows, unresolved, seen)
293
+ claude_file("CLAUDE.local.md (gitignored)", os.path.join(repo, "CLAUDE.local.md"), rows, unresolved, seen)
294
+ if not a.no_user:
295
+ claude_file("~/.claude/CLAUDE.md (사용자 전역)", user_claude, rows, unresolved, seen)
296
+ mem = memory_row(mem_dir, a.memory_cap_chars, mangled)
297
+ rows.append(mem)
298
+ rows.append(skills_row(repo))
299
+ rows.extend(rules_rows(repo))
300
+
301
+ total_c = total_b = 0
302
+ unmeasured = []
303
+ for r in rows:
304
+ if r["status"] == "unmeasured":
305
+ unmeasured.append(r["name"])
306
+ elif r["status"] == "ok":
307
+ c = r.get("loaded_chars", r["chars"])
308
+ b = r.get("loaded_bytes", r["bytes"])
309
+ total_c += c
310
+ total_b += b
311
+ headroom = (CC_WARN_CHARS - main_row["chars"]) if main_row["status"] == "ok" else None
312
+ result = {
313
+ "rows": rows, "unresolved_imports": unresolved,
314
+ "claude_md_warn_line": CC_WARN_CHARS, "claude_md_headroom": headroom,
315
+ "total": {"chars": total_c, "bytes": total_b, "unmeasured_cells": len(unmeasured),
316
+ "unmeasured": unmeasured,
317
+ "note": "MEMORY 는 적재분만 · rules 는 paths 없는 것만 · 스킬은 이 레포 것만"},
318
+ "scope_excluded": ["시스템 프롬프트", "이 레포 밖 플러그인 스킬 목록", "MCP 도구 설명", "토큰 수"],
319
+ }
320
+ if a.json:
321
+ print(json.dumps(result, ensure_ascii=False, indent=2))
322
+ else:
323
+ render(result)
324
+ return 3 if unmeasured else 0
325
+
326
+
327
+ def fmt(n):
328
+ return "—" if n is None else f"{n:,}"
329
+
330
+
331
+ def render(res):
332
+ label = {"absent": "없음", "unmeasured": "미측정", "conditional": "조건부(paths)"}
333
+ print(f"{'이름':<44} {'문자':>9} {'바이트':>9} 출처")
334
+ for r in res["rows"]:
335
+ st = r["status"]
336
+ if st == "ok":
337
+ c, b = fmt(r["chars"]), fmt(r["bytes"])
338
+ else:
339
+ c, b = label[st], ""
340
+ print(f"{r['name']:<44} {c:>9} {b:>9} {r['source']}")
341
+ if "loaded_chars" in r:
342
+ o = r["official"]
343
+ print(f"{' └ 적재분 (' + r['cap_rule'] + ')':<44} {fmt(r['loaded_chars']):>9} {fmt(r['loaded_bytes']):>9}"
344
+ f" {r['loaded_lines']}/{r['lines']}줄 · 절단 {r['cut_lines']}줄")
345
+ print(f"{' └ 공식 문구 (' + o['rule'] + ')':<44} {fmt(o['chars']):>9} {fmt(o['bytes']):>9}"
346
+ f" {o['lines']}/{r['lines']}줄 · 먼저 걸리는 쪽 = {o['binds_first']}")
347
+ if "oneline" in r:
348
+ ol = r["oneline"]
349
+ if st == "ok" and r.get("oneline_differs"):
350
+ print(f"{' └ 한 줄 파싱 (접힌 블록 못 읽음)':<44} {fmt(ol['chars']):>9} {'':>9}"
351
+ f" {r['files']}파일 · YAML 설명만 {fmt(r['desc_chars'])} / 한 줄 설명만 {fmt(ol['desc_chars'])}")
352
+ elif st == "ok":
353
+ print(f"{' └ 한 줄 파싱 = YAML 파싱 (일치)':<44} {'':>9} {'':>9} {r['files']}파일")
354
+ else:
355
+ print(f"{' └ 한 줄 파싱 (참고용)':<44} {fmt(ol['chars']):>9}")
356
+ if r.get("error"):
357
+ print(f" ! {r['error']}")
358
+ for u in res["unresolved_imports"]:
359
+ print(f" (import 해석 실패 — 적재 안 됨: {u['token']} in {u['from']})")
360
+ if res["claude_md_headroom"] is not None:
361
+ print(f"CLAUDE.md 150,000자 경고선까지 여유: {res['claude_md_headroom']:,}자")
362
+ t = res["total"]
363
+ tail = f" · 미측정 {t['unmeasured_cells']}칸 ({', '.join(t['unmeasured'])})" if t["unmeasured_cells"] else " · 미측정 0칸"
364
+ if res["unresolved_imports"]:
365
+ tail += f" · 대상 없는 import 후보 {len(res['unresolved_imports'])}개(적재 안 됨 — CC 파서와 대조 안 함)"
366
+ print(f"합계 (FH 가 좌우하는 상주분): {t['chars']:,}자 / {t['bytes']:,} bytes{tail}")
367
+ print(f" ({t['note']} · 범위 밖: {', '.join(res['scope_excluded'])})")
368
+
369
+
370
+ if __name__ == "__main__":
371
+ sys.exit(main(sys.argv[1:]))
@@ -8,10 +8,9 @@
8
8
  # lines changed color) is a mechanization trigger, not a one-off. This is that mechanization.
9
9
  #
10
10
  # 🟥 FRONTIER WARNING — read before citing this tool's PASS as "the suite has detection power".
11
- # A single revert of a single file is ONE mutant. Mutation-testing research (arXiv 2607.22880,
12
- # and the companion Meta engineering write-up cited alongside it in
13
- # frontier_verification_map_2026-09-04.md §ⓕ) found that coverage/mutation SCORE loses its
14
- # correlation with real fault-detection effectiveness once suite size is controlled for — a
11
+ # A single revert of a single file is ONE mutant. The LLM-test replication study (https://arxiv.org/abs/2607.22880)
12
+ # finds coverage/mutation metrics are context-dependent, not universally uncorrelated after
13
+ # controlling suite size. Neither a score nor this one-file probe certifies a whole suite — a
15
14
  # single kill is evidence the ANCHOR under test is load-bearing for THIS ONE reverted file,
16
15
  # never a general claim that the suite "has good mutation coverage" or "catches regressions".
17
16
  # Run this against every file you actually care about; do not average or extrapolate from one.
@@ -106,8 +105,8 @@ echo "baseline: $BASELINE"
106
105
  echo ""
107
106
  echo "🟥 FRONTIER WARNING (arXiv 2607.22880): this run reverts EXACTLY ONE file — ONE mutant."
108
107
  echo " A ✅ verdict here means the anchor caught THIS mutant, not that the suite has general"
109
- echo " mutation-detection power. Coverage/mutation score decorrelates from real effectiveness"
110
- echo " once suite size is controlled for — do not average or extrapolate from a single run."
108
+ echo " mutation-detection power. Coverage/mutation metrics are context-dependent — do not average"
109
+ echo " or extrapolate from a single run."
111
110
  echo "되돌린 파일(뮤턴트) 수: 1 — $REL_PATH"
112
111
  echo ""
113
112
 
@@ -442,6 +442,19 @@ else
442
442
  fail=1
443
443
  fi
444
444
 
445
+ # The README header sum must cover every plugin on disk. It summed two of four until 2026-10-01
446
+ # and passed a README that was five skills stale — pinned here so a hand-picked sum cannot return.
447
+ if [ ! -f scripts/count_check.sh ]; then
448
+ _absent_subject_verdict "count_check all-plugins lanes" "scripts/count_check.sh" || fail=1
449
+ elif [ -f scripts/test_count_check_all_plugins_lanes.sh ]; then
450
+ if ! bash scripts/test_count_check_all_plugins_lanes.sh; then
451
+ fail=1
452
+ fi
453
+ else
454
+ echo "FAIL count_check all-plugins lanes: count_check.sh present but its anchor is missing"
455
+ fail=1
456
+ fi
457
+
445
458
  # count_check's COUNT DECLARATION parser — the sweep reads "N skills"/"N agents" out of a plugin
446
459
  # description and compares it to disk. #768 shipped that sweep and wrote its own residual down:
447
460
  # «순회는 description 의 첫 N skills 패턴만 읽는다 — 과탐/미탐 방향 미측정». Both were measured
@@ -518,6 +531,20 @@ else
518
531
  fail=1
519
532
  fi
520
533
 
534
+ # resident-cost meter — read-only instrument for session-start resident cost (chars vs bytes · MEMORY
535
+ # loaded share · YAML-parsed skill listing). Built 2026-10-01 after two same-day mis-measurements
536
+ # (`wc -c` bytes reported as chars · one-line frontmatter parse missing folded `>-` descriptions).
537
+ if [ ! -f scripts/resident_cost.py ]; then
538
+ _absent_subject_verdict "resident-cost lanes" "scripts/resident_cost.py" || fail=1
539
+ elif [ -f scripts/test_resident_cost_lanes.sh ]; then
540
+ if ! bash scripts/test_resident_cost_lanes.sh; then
541
+ fail=1
542
+ fi
543
+ else
544
+ echo "FAIL resident-cost lanes: scripts/resident_cost.py present but its anchor is missing"
545
+ fail=1
546
+ fi
547
+
521
548
  # terminal audit banner — templates/fh_audit_check.zsh (sourced from every user's ~/.zshrc by install-wizard)
522
549
  # fired 2 false lines forever (harvest glob nothing writes · state-marker sentinels aged as audits) and
523
550
  # aborted whole on zsh NOMATCH for a fresh install. Lane = false lines gone · real overdue audits still warn.
@@ -954,6 +981,9 @@ for _pair in \
954
981
  "templates/.git-hooks/pre-commit|scripts/test_marker_soul_tenet_lanes.sh" \
955
982
  "templates/.git-hooks/pre-commit|scripts/test_marker_affected_lanes.sh" \
956
983
  "templates/.git-hooks/pre-commit|scripts/test_marker_oracle_lanes.sh" \
984
+ `# ── 경량 SKIP 의 «사유» 가 참인가 (2026-10-05, 클린룸 감사): 판정은 맞고 사유가 거짓이면 아무 레인도 안 빨개진다 ──` \
985
+ "templates/.git-hooks/pre-commit|scripts/test_axis23_skip_reason_lanes.sh" \
986
+ "templates/.git-hooks/pre-commit|scripts/test_marker_diff_sha_lanes.sh" \
957
987
  `# ── 판정을 둘로 (2026-09-06, SWE-Gate 답습): 합성 «PASS» 가 acceptance-evidence 를 가리지 않는가 ──` \
958
988
  "templates/.git-hooks/pre-commit|scripts/test_gate_two_verdicts_lanes.sh" \
959
989
  `# ── fh-qp (QP) — chamber run #18 EMIT 2026-09-05: qp_tools.sh known-pair + residency lanes ──` \
@@ -962,6 +992,8 @@ for _pair in \
962
992
  `# ── action.yml — the GitHub Action wrapper: its exit-code mapping is where a typed verdict could become a boolean ──` \
963
993
  "action.yml|scripts/test_action_yml_lanes.sh" \
964
994
  "scripts/sim_isolated_run.sh|scripts/test_sim_path_isolation_lanes.sh" \
995
+ `# ── mutation_probe (2026-10-07) — revert_probe 의 «저자가 고른 변이 1개» 를 연산자 생성 변이로 넓힌 것. 앵커가 고정하는 것은 생성기 보정(리다이렉트 비변이)과 «못 잰 것은 2» 다 ──` \
996
+ "scripts/mutation_probe.py|scripts/test_mutation_probe_lanes.sh" \
965
997
  `# ── live-eval — the live twin of the static /prompt-regression probe check (2026-09-04) ──` \
966
998
  "scripts/probe_live_eval.sh|scripts/test_probe_live_eval_lanes.sh" \
967
999
  "scripts/probe_live_eval_lib.py|scripts/test_probe_live_eval_lanes.sh" \
@@ -1019,6 +1051,8 @@ for _pair in \
1019
1051
  "plugins/fh-preprep/skills/preprep/lane_promise.py|scripts/test_preprep_promise_lanes.sh" \
1020
1052
  "plugins/fh-preprep/skills/preprep/lane_slide_refs.py|scripts/test_preprep_slide_refs_lanes.sh" \
1021
1053
  "plugins/fh-preprep/skills/preprep/lane_font.py|scripts/test_preprep_font_lanes.sh" \
1054
+ `# 발표 코칭(2026-10-03) — 녹화를 듣는 레인. 의존성이 «없는» 상태가 가장 흔해서, 이 앵커가 고정하는 것은 «못 들었을 때 0 을 안 낸다» 다` \
1055
+ "plugins/fh-preprep/skills/preprep/lane_speech_coach.py|scripts/test_preprep_speech_coach_lanes.sh" \
1022
1056
  "plugins/fh-preprep/skills/preprep/SKILL.md|scripts/test_preprep_drift_anchor.sh" \
1023
1057
  "scripts/test_preprep_drift_anchor.sh|scripts/test_preprep_drift_anchor_lanes.sh" \
1024
1058
  "scripts/field_canon_preload.sh|scripts/test_skill_canon_preload_lanes.sh" \
@@ -1329,6 +1363,20 @@ else
1329
1363
  _show_failure "$_out"
1330
1364
  fail=1
1331
1365
  fi
1366
+ # 밀폐 레인(2026-10-02, pmh-dev #84) — 호출자 env 에 클러스터 변수가 살아 있어도 self-test 판정이 같아야 한다.
1367
+ # known-pair: 위 블록(env 없음)과 이 블록(env 있음)이 같은 «0 FAIL» 을 내고, 이 블록은 비운 사실을 이름으로 말한다.
1368
+ if [ -f scripts/cluster_capability_scan.sh ]; then
1369
+ if _out=$(FH_CLUSTER_ROOTS=/nonexistent-fh-a:/nonexistent-fh-b FH_TRACKS_ROOT=/nonexistent-fh-tracks FH_PROJECTS_HOME=/nonexistent-fh-home \
1370
+ bash scripts/cluster_capability_scan.sh --self-test < /dev/null 2>&1) \
1371
+ && printf '%s\n' "$_out" | grep -qE '캘리브레이션 통과: [1-9][0-9]* PASS / 0 FAIL' \
1372
+ && printf '%s\n' "$_out" | grep -q '픽스처 밀폐): FH_CLUSTER_ROOTS FH_TRACKS_ROOT FH_PROJECTS_HOME'; then
1373
+ echo "PASS cluster_capability_scan.sh --self-test hermetic under caller env ($(printf '%s\n' "$_out" | grep -oE '[0-9]+ PASS / [0-9]+ FAIL' | tail -1))"
1374
+ else
1375
+ echo "FAIL cluster_capability_scan.sh: --self-test leaks caller env (FH_CLUSTER_ROOTS/FH_TRACKS_ROOT/FH_PROJECTS_HOME) into fixture lanes"
1376
+ _show_failure "$_out"
1377
+ fail=1
1378
+ fi
1379
+ fi
1332
1380
 
1333
1381
  # capability_effect_probe — wired 2026-08-16. `lane_runner_check.sh` had been flagging it as an
1334
1382
  # embedded --self-test subject with ZERO dispatchers, and that warning was load-bearing: the same
@@ -2368,6 +2416,20 @@ elif [ -f scripts/test_hook_drift_lanes.sh ]; then
2368
2416
  else
2369
2417
  echo "FAIL hook-drift lanes: hook_drift_check.sh present but its anchor is missing"; fail=1
2370
2418
  fi
2419
+ # Hook templates must load in GitHub Copilot CLI too (2026-10-01): `"matcher": ""` makes Copilot
2420
+ # reject the WHOLE settings file («matcher cannot be empty»); omitted means the same in Claude Code.
2421
+ # Subjects = shipped templates/snippets/docs + the wizard merge blocks + hook_drift_check's "" ≡ omitted.
2422
+ if [ -f scripts/test_hook_templates_copilot_compat_lanes.sh ]; then
2423
+ if _out=$(bash scripts/test_hook_templates_copilot_compat_lanes.sh 2>&1); then
2424
+ echo "PASS test_hook_templates_copilot_compat_lanes.sh (no empty matcher shipped · wizard normalizes · drift \"\"≡omitted · revert probe)"
2425
+ else
2426
+ echo "FAIL test_hook_templates_copilot_compat_lanes.sh: a shipped hook template would break Copilot CLI settings loading"
2427
+ _show_failure "$_out"
2428
+ fail=1
2429
+ fi
2430
+ else
2431
+ echo "FAIL copilot-compat lanes: anchor scripts/test_hook_templates_copilot_compat_lanes.sh is missing"; fail=1
2432
+ fi
2371
2433
  # ④-f session config fingerprint (2026-09-26): a mid-session overwrite of settings/CLAUDE.md went
2372
2434
  # unnoticed on 2026-09-25. Advisory at close; the lane pins «no snapshot = NOT MEASURED».
2373
2435
  if [ ! -f scripts/session_config_fingerprint.sh ]; then
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env bash
2
+ # test_axis23_skip_reason_lanes.sh — «Axes 2+3 이 왜 안 돌았나» 라는 문장이 참인지 고정한다.
3
+ #
4
+ # WHY (2026-10-05, 주간 클린룸 감사 실측 known-pair): 경량 모드의 SKIP 줄은 사유를
5
+ # «lightweight mode — CATALOG.md / tracks/ only» 라는 **리터럴**로 찍고 있었다. $LIGHT 는 두
6
+ # 경로로 채워지는데 — ⓐ 경로-light(CATALOG.md · tracks/) · ⓑ carve-out 강등(knowledge/**.md ·
7
+ # docs/*.md · AGENTS.md · README*.md 의 prose-only diff) — 그 문장은 ⓐ만 말했다. 실측:
8
+ # CATALOG.md 만 staged → «CATALOG.md / tracks/ only» (참)
9
+ # prose-only knowledge/** 만 → «CATALOG.md / tracks/ only» (거짓 — CATALOG 도 tracks 도 없다)
10
+ # **판정은 맞고 사유가 거짓**이라 아무 레인도 빨개지지 않았다. 손해를 보는 쪽은 커밋이 아니라
11
+ # 훅 출력을 읽고 «이 커밋은 왜 전체 게이트를 안 탔나»를 재구성하는 **감사자**다 — 이 저장소가
12
+ # 이미 이름을 가진 결함 부류다([[feedback_rule_misdescribes_its_own_machine]]).
13
+ #
14
+ # SCOPE — 채널이지 판정이 아니다(§Mechanization Boundary). 이 레인은 «경량으로 가는 게 맞나»를
15
+ # 안 묻는다(그 라우팅은 `test_heavy_classifier_lanes.sh` 가 고정한다). 묻는 것은 하나다:
16
+ # 라우팅이 스스로를 설명하는 문장이 그 라우팅의 실제 출처와 일치하나.
17
+ #
18
+ # 방법 — 두 층을 다 잰다. 함수만 격리해 재면 «호출되는가»를 구조적으로 볼 수 없고(그 결함의
19
+ # 정본은 `test_hook_leg_wiring_lanes.sh` 머리말), 훅만 돌리면 경계 입력을 못 만든다.
20
+ # ① 픽스처 : 훅에서 `_axis23_skip_reason` 을 **추출**해 경계 입력으로 돌린다(리터럴 재작성 금지)
21
+ # ② 배선 : 합성 레포에서 **진짜 훅**을 돌려 ⓑ 팔이 실제로 그 문장을 내는지 본다 +
22
+ # 호출부를 옛 리터럴로 되돌린 사본에서 사라지는지(known-negative)
23
+ #
24
+ # Usage: bash scripts/test_axis23_skip_reason_lanes.sh Exit: 0 PASS · 1 회귀 · 10 계기 불량
25
+ set -uo pipefail
26
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
27
+ HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
28
+ [ -f "$HOOK" ] || { echo "❌ HARNESS-ERROR — hook not found: $HOOK"; exit 10; }
29
+ T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
30
+ FAIL=0
31
+
32
+ # ── ① 함수 추출. 🟥 비면 아래 픽스처가 «아무것도 아닌 것»을 재고 전부 통과한다 → fail CLOSED.
33
+ sed -n '/^_axis23_skip_reason()/,/^}/p' "$HOOK" > "$T/fn.sh"
34
+ if ! grep -q '_axis23_skip_reason' "$T/fn.sh"; then
35
+ echo "❌ HARNESS-ERROR — _axis23_skip_reason 이 $HOOK 에서 추출되지 않았다."
36
+ echo " 훅의 모양이 바뀌었다. 이 추출을 고쳐라 — 레인을 지우거나 사유 문자열의 사본을"
37
+ echo " 여기 인라인하지 마라(그것이 레인이 대상을 덮기를 멈추는 방식이다)."
38
+ exit 10
39
+ fi
40
+
41
+ f() { bash -c 'set -uo pipefail; . "$1"; _axis23_skip_reason "$2"' _ "$T/fn.sh" "${1-}" 2>&1; }
42
+
43
+ lane() { # $1=id $2=LIGHT $3=기대 사유(완전 일치)
44
+ local id="$1" light="$2" want="$3" got
45
+ got=$(f "$light")
46
+ if [ "$got" = "$want" ]; then printf ' ✅ %-26s %s\n' "$id" "$got"
47
+ else printf ' ❌ %-26s 기대 «%s» · 실제 «%s»\n' "$id" "$want" "$got"; FAIL=1; fi
48
+ }
49
+ lane_not() { # $1=id $2=LIGHT $3=나오면 안 되는 조각
50
+ local id="$1" light="$2" never="$3" got
51
+ got=$(f "$light")
52
+ if grep -qF -- "$never" <<<"$got"; then
53
+ printf ' ❌ %-26s «%s» 가 사유에 섞였다 — 실제 «%s»\n' "$id" "$never" "$got"; FAIL=1
54
+ else printf ' ✅ %-26s «%s» 없음 — %s\n' "$id" "$never" "$got"; fi
55
+ }
56
+
57
+ echo "== ① 사유 ↔ \$LIGHT 출처 (경계 입력) =="
58
+ lane S1-path-catalog 'CATALOG.md' 'CATALOG.md / tracks/'
59
+ lane S2-path-tracks 'tracks/_meta/fh_completed_2026-10-05.md' 'CATALOG.md / tracks/'
60
+ lane S3-prose-only 'knowledge/shared/harness-core/x.md (prose-only)' 'prose-only carve-out'
61
+ lane S4-both 'CATALOG.md
62
+ docs/USER_GUIDE.md (prose-only)' 'CATALOG.md / tracks/ + prose-only carve-out'
63
+ # 🟥 빈 값은 ⓐ가 아니다. 미측정/부재를 «CATALOG.md / tracks/» 로 접는 것이 이 결함의 일반형이다.
64
+ lane S5-empty '' 'no heavy-class file staged'
65
+ lane S6-blank-lines '
66
+
67
+ ' 'no heavy-class file staged'
68
+
69
+ echo "== ① 컨트롤 — 사유가 그냥 양쪽 다 찍는 것이 아니다 =="
70
+ lane_not C1-prose-not-path 'AGENTS.md (prose-only)' 'CATALOG.md'
71
+ lane_not C2-path-not-prose 'CATALOG.md' 'prose-only'
72
+
73
+ echo "== ② 배선 — 진짜 훅이 그 문장을 내나 (되돌림 known-negative) =="
74
+ WP="$T/wp"; mkdir -p "$WP/knowledge/shared/harness-core" "$WP/tracks/_meta"
75
+ ( cd "$WP" && git init -q . && git config user.email t@example.invalid && git config user.name t ) \
76
+ || { echo "❌ HARNESS-ERROR — git init failed"; exit 10; }
77
+ ln -s "$REPO_ROOT/scripts" "$WP/scripts"
78
+ printf '# prose\n' > "$WP/knowledge/shared/harness-core/doctrine.md"
79
+ ( cd "$WP" && git add knowledge/shared/harness-core/doctrine.md && git commit -qm init ) >/dev/null 2>&1
80
+ printf '\n한 줄 산문.\n' >> "$WP/knowledge/shared/harness-core/doctrine.md"
81
+ ( cd "$WP" && git add knowledge/shared/harness-core/doctrine.md ) >/dev/null 2>&1
82
+
83
+ # known-negative: 호출부를 옛 리터럴로 되돌린 사본
84
+ NH="$T/hook_literal.sh"
85
+ sed -E 's/\[Axis 2\+3\] SKIP \(lightweight mode — \$\(_axis23_skip_reason "\$LIGHT"\)\)/[Axis 2+3] SKIP (lightweight mode — CATALOG.md \/ tracks\/ only)/' "$HOOK" > "$NH"
86
+ if grep -qF '_axis23_skip_reason "$LIGHT"' "$NH" || ! bash -n "$NH" 2>/dev/null; then
87
+ echo "❌ HARNESS-ERROR — 되돌림 사본이 호출부를 그대로 들고 있거나 구문이 깨졌다. 초록 보고 안 한다."
88
+ exit 10
89
+ fi
90
+
91
+ live=$( cd "$WP" && bash "$HOOK" 2>&1 | grep -cF 'prose-only carve-out' )
92
+ dead=$( cd "$WP" && bash "$NH" 2>&1 | grep -cF 'prose-only carve-out' )
93
+ if [ "$live" -gt 0 ] && [ "$dead" -eq 0 ]; then
94
+ printf ' ✅ %-26s WIRED (live=%s dead=%s)\n' W1-prose-arm "$live" "$dead"
95
+ elif [ "$live" -eq 0 ]; then
96
+ printf ' ❌ %-26s NOT REACHED — 진짜 훅이 «prose-only carve-out» 을 안 찍었다\n' W1-prose-arm; FAIL=1
97
+ else
98
+ printf ' ❌ %-26s HARNESS-ERROR — 되돌려도 문장이 남는다(live=%s dead=%s). 배선을 재는 게 아니다.\n' \
99
+ W1-prose-arm "$live" "$dead"; FAIL=1
100
+ fi
101
+
102
+ echo
103
+ echo "🟥 이 레인이 덮지 않는 것 (이름으로 남긴다):"
104
+ echo ' · 경량/전체 **라우팅** 자체 — test_heavy_classifier_lanes.sh 가 고정한다.'
105
+ echo " · \`diff_is_substantive\` 의 판정(어떤 diff 가 prose-only 인가) — 거기도 별도 앵커가 없다."
106
+ echo " · 전체 모드의 출력 문구 — 이 레인은 SKIP 쪽 한 줄만 본다."
107
+ echo
108
+ if [ $FAIL -eq 0 ]; then echo "AXIS23 SKIP REASON LANES: PASS"; exit 0; fi
109
+ echo "AXIS23 SKIP REASON LANES: FAIL"; exit 1