@chrono-meta/fh-gate 3.27.0 → 3.28.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 (43) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/CLAUDE.md +2 -2
  3. package/README.ja.md +2 -4
  4. package/README.ko.md +2 -4
  5. package/README.md +19 -19
  6. package/README.zh.md +2 -4
  7. package/knowledge/shared/harness-core/fh_module_contract.md +97 -0
  8. package/knowledge/shared/learnings/subagent_invocations_log.yaml +81 -0
  9. package/package.json +10 -1
  10. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  11. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +84 -4
  12. package/plugins/fh-commons/skills/ko-tech-writer/fh-module.yaml +19 -0
  13. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_negative.md +73 -1
  14. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_positive.md +39 -1
  15. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_unclosed.md +6 -0
  16. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  17. package/plugins/fh-meta/CHANGELOG.md +10 -0
  18. package/plugins/fh-meta/skills/frontier-digest/SKILL.md +14 -10
  19. package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +17 -1
  20. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  21. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  22. package/scripts/fh_module_check.py +686 -0
  23. package/scripts/fixtures/frontier_digest_recall.tsv +5 -0
  24. package/scripts/ko_tech_writer_calibrate.py +288 -15
  25. package/scripts/probe_live_eval.sh +19 -1
  26. package/scripts/probe_live_eval_lib.py +174 -5
  27. package/scripts/resident_cost.py +1 -1
  28. package/scripts/selfcheck.sh +7 -1
  29. package/scripts/session_checklist.py +66 -0
  30. package/scripts/session_close_check.sh +44 -0
  31. package/scripts/sim_isolated_run.sh +31 -0
  32. package/scripts/test_claude_md_size_lanes.sh +22 -7
  33. package/scripts/test_fh_module_check_lanes.sh +581 -0
  34. package/scripts/test_frontier_digest_recall.sh +26 -0
  35. package/scripts/test_frontier_digest_recall_negctl.sh +15 -0
  36. package/scripts/test_ko_tech_writer_lanes.sh +1 -1
  37. package/scripts/test_probe_live_eval_lanes.sh +116 -0
  38. package/scripts/test_resident_cost_lanes.sh +1 -1
  39. package/scripts/test_session_checklist_lanes.sh +29 -0
  40. package/scripts/test_sim_isolated_run_lanes.sh +51 -0
  41. package/scripts/test_utterance_checklist_hook_lanes.sh +175 -0
  42. package/scripts/utterance_checklist_hook.py +193 -0
  43. package/scripts/utterance_checklist_hook.sh +31 -0
@@ -25,7 +25,7 @@
25
25
  #
26
26
  # 범위 밖(이름으로 남긴다): 시스템 프롬프트 · 이 레포 밖 플러그인의 스킬 목록 · MCP 도구 설명 · 토큰 수.
27
27
  # 그래서 «합계» 는 «FH 가 좌우하는 상주분» 이지 세션 전체 비용이 아니다.
28
- # CLAUDE.md 크기 «가드» 는 scripts/test_claude_md_size_lanes.sh 가 따로 한다(한계 145,000). 이건 계기지 게이트가 아니다.
28
+ # CLAUDE.md 크기 «가드» 는 scripts/test_claude_md_size_lanes.sh 가 따로 한다(한계 18,000 — 2026-10-17 래칫). 이건 계기지 게이트가 아니다.
29
29
  #
30
30
  # 사용: python3 scripts/resident_cost.py [--json] [--repo DIR] [--user-claude FILE] [--memory-dir DIR]
31
31
  # [--memory-cap-chars N] [--no-user]
@@ -519,7 +519,7 @@ else
519
519
  fi
520
520
 
521
521
  # CLAUDE.md size guard — Claude Code warns «CLAUDE.md is over the 150.0k-char limit» on every session
522
- # start of a clone (measured 2026-09-26: 154,149 chars since ~v3.16.0). Guard at 145k (headroom ~1k/week).
522
+ # start of a clone (measured 2026-09-26: 154,149 chars since ~v3.16.0). Guard ratcheted 145k → 18k on 2026-10-17 (see the lane header; forks: FH_CLAUDE_MD_LIMIT).
523
523
  if [ ! -f CLAUDE.md ]; then
524
524
  _absent_subject_verdict "claude-md size lanes" "CLAUDE.md" || fail=1
525
525
  elif [ -f scripts/test_claude_md_size_lanes.sh ]; then
@@ -986,6 +986,9 @@ for _pair in \
986
986
  "scripts/session_close_check.sh|scripts/test_peer_worktree_detect_lanes.sh" \
987
987
  "scripts/env_purity_scan.sh|scripts/test_env_purity_lanes.sh" \
988
988
  "scripts/frontier_digest_daily.sh|scripts/test_frontier_digest_retry.sh" \
989
+ "plugins/fh-meta/skills/frontier-digest/SKILL.md|scripts/test_frontier_digest_recall.sh" \
990
+ "scripts/test_frontier_digest_recall.sh|scripts/test_frontier_digest_recall_negctl.sh" \
991
+ "scripts/fh_module_check.py|scripts/test_fh_module_check_lanes.sh" \
989
992
  "scripts/knowledge_seam_check.sh|scripts/test_knowledge_seam_lanes.sh" \
990
993
  "templates/.git-hooks/pre-commit|scripts/test_marker_crossfamily_lanes.sh" \
991
994
  "templates/.git-hooks/pre-commit|scripts/test_marker_floor_lanes.sh" \
@@ -1085,6 +1088,9 @@ for _pair in \
1085
1088
  "scripts/transcript_utterances.py|scripts/test_utterance_intake_lanes.sh" \
1086
1089
  "scripts/compaction_probe.sh|scripts/test_utterance_intake_lanes.sh" \
1087
1090
  "scripts/session_close_check.sh|scripts/test_utterance_intake_lanes.sh" \
1091
+ `# ── 발화 체크리스트 훅(2026-10-18): 말한 순간 받아 적기 · 중간 점검 · 한글 턴. files[] 로 배포(selfcheck 가 이름을 대므로 package-coverage 가 요구) ──` \
1092
+ "scripts/utterance_checklist_hook.sh|scripts/test_utterance_checklist_hook_lanes.sh" \
1093
+ "scripts/utterance_checklist_hook.py|scripts/test_utterance_checklist_hook_lanes.sh" \
1088
1094
  `# ── 워크트리 회수(2026-09-05, N=2 재발 → 스크립트). 사람이 부르는 도구지만 레인은 자동 ──` \
1089
1095
  "scripts/worktree_reclaim.sh|scripts/test_worktree_reclaim_lanes.sh" \
1090
1096
  `# ── 가벼운 게이트 P1·P2(2026-10-12): 비주제 레인의 gh·①-g 스텁 + 켠/끈 비교기 ──` \
@@ -445,6 +445,13 @@ def do_extract(transcript_path, out_path):
445
445
  "| S%d | (요약) | %s | | | | |" % (s, md_escape(blurb))
446
446
  )
447
447
 
448
+ # Re-running extract on a sheet that is already filled must not wipe it (2026-10-18: the mid-session nudge
449
+ # tells the session to re-extract into the SAME file; a plain overwrite erased 259 filled rows' 상태/증거).
450
+ # Carry the four judgement cells forward by (시각, 발화) — both are generated deterministically — and keep
451
+ # any filled row that no longer matches in a section at the end: dropped judgements are named, never lost.
452
+ if out_path and os.path.exists(out_path):
453
+ lines_out = carry_forward(lines_out, out_path)
454
+
448
455
  content = "\n".join(lines_out) + "\n"
449
456
  sys.stdout.write(content)
450
457
 
@@ -455,6 +462,65 @@ def do_extract(transcript_path, out_path):
455
462
  return rc
456
463
 
457
464
 
465
+ def _cells(line):
466
+ """split a markdown table row on unescaped «|» (md_escape writes «\\|»); None if not a 7-cell data row."""
467
+ if not line.startswith("| "):
468
+ return None
469
+ parts, cur, i = [], "", 0
470
+ while i < len(line):
471
+ ch = line[i]
472
+ if ch == "\\" and i + 1 < len(line) and line[i + 1] == "|":
473
+ cur += "\\|"; i += 2; continue
474
+ if ch == "|":
475
+ parts.append(cur); cur = ""
476
+ else:
477
+ cur += ch
478
+ i += 1
479
+ parts.append(cur)
480
+ cells = [c.strip() for c in parts[1:-1]]
481
+ return cells if len(cells) == 7 else None
482
+
483
+
484
+ CARRY_HEADING = "## 이전 결과서에서 이어받지 못한 판정"
485
+
486
+
487
+ def carry_forward(lines_out, out_path):
488
+ try:
489
+ with open(out_path, "r", encoding="utf-8", errors="replace") as f:
490
+ old = f.read().split("\n")
491
+ except OSError:
492
+ return lines_out
493
+ prev, orphans_prev = {}, []
494
+ in_orphans = False
495
+ for l in old:
496
+ if l.startswith(CARRY_HEADING):
497
+ in_orphans = True; continue
498
+ c = _cells(l)
499
+ if not c or c[0] in ("#", "---") or set(c[0]) <= set("-"):
500
+ continue
501
+ if not any(c[3:]):
502
+ continue # an empty row has nothing to carry
503
+ if in_orphans:
504
+ orphans_prev.append(l); continue # earlier orphans stay orphans unless they match below
505
+ prev.setdefault((c[1], c[2]), c[3:])
506
+ used, out = set(), []
507
+ for l in lines_out:
508
+ c = _cells(l)
509
+ key = (c[1], c[2]) if c else None
510
+ if c and key in prev and not any(c[3:]):
511
+ out.append("| %s | %s | %s | %s | %s | %s | %s |" % tuple(c[:3] + prev[key]))
512
+ used.add(key); continue
513
+ out.append(l)
514
+ orphans = ["| %s | %s | %s | %s | %s | %s | %s |" % ((("-",) + k + tuple(v))) for k, v in prev.items() if k not in used]
515
+ orphans += orphans_prev
516
+ if used or orphans:
517
+ out.insert(4, "↩️ 이전 결과서에서 판정 %d줄 이어받음 · 못 맞춘 판정 %d줄은 맨 아래 «이전 결과서에서 이어받지 못한 판정»에 보존" % (len(used), len(orphans)))
518
+ if orphans:
519
+ out += ["", CARRY_HEADING, "", "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안(이번 세션 vs 이월) |",
520
+ "|---|---|---|---|---|---|---|"] + orphans
521
+ return out
522
+
523
+
458
524
  # ---------------------------------------------------------------------------
459
525
  # check
460
526
  # ---------------------------------------------------------------------------
@@ -364,6 +364,50 @@ else
364
364
  echo "⚠️ ①-f utterance_intake.sh 없음 — skipped, not passed (UNMEASURED)"
365
365
  fi
366
366
 
367
+ # ── ①-g REQUEST CHECKLIST RESULT SHEET (advisory) ─────────────────────────────
368
+ # WHY. ①-f asks «did the utterance reach a record»; the operator asked a different question twice:
369
+ # «체크리스트에 받아적고 마무리시점이나 중간에 한번씩 파악해보는거» (2026-10-18) and, on 2026-09-18, a close
370
+ # report «like TCs — done / partly / not done, with reasons and proposals» (fh_signal_2026-09-18_request-
371
+ # checklist-close-report.md). session_checklist.py was built for that and never called from here; ①-f's own
372
+ # history (a checker with zero call sites) repeated. utterance_checklist_hook.sh nudges it mid-session; this
373
+ # line asks for it at the close. Advisory: the table is a surface the operator reads and contests row by row,
374
+ # not a gate (form is checked, truth is not — session_checklist.py header).
375
+ _SC_PY="$FH/scripts/session_checklist.py"
376
+ if [ -f "$_SC_PY" ]; then
377
+ _SC_FILES=()
378
+ # this session's sheet (any date — a session can cross midnight); without a session id, today's sheets
379
+ # (codex R1 B11: a sheet from another session must not satisfy this one's close)
380
+ if [ -n "${_UI_SID:-}" ]; then
381
+ for _p in "$FH"/tracks/_meta/session_checklist_*_"${_UI_SID:0:8}".md; do [ -f "$_p" ] && _SC_FILES+=("$_p"); done
382
+ else
383
+ for _p in "$FH"/tracks/_meta/session_checklist_"$TODAY"_*.md; do [ -f "$_p" ] && _SC_FILES+=("$_p"); done
384
+ [ "${#_SC_FILES[@]}" -gt 0 ] && echo "ℹ️ ①-g 세션 id 미상 — 오늘자 결과서 ${#_SC_FILES[@]} 개를 본다(다른 세션 것일 수 있다: «이 세션 결과서가 있다» 의 증명이 아니다)"
385
+ fi
386
+ if [ "${#_SC_FILES[@]}" -eq 0 ]; then
387
+ echo "⚠️ ①-g 오늘자 요청 체크리스트 결과서가 없다 — advisory, 막지 않는다"
388
+ if [ -n "${_UI_TR:-}" ] && [ -f "${_UI_TR:-/nonexistent}" ]; then
389
+ printf ' 만들기: python3 scripts/session_checklist.py extract --transcript %q --out %q\n' "$_UI_TR" "tracks/_meta/session_checklist_${TODAY}_${_UI_SID:0:8}.md"
390
+ else
391
+ echo " 만들기: python3 scripts/session_checklist.py extract --transcript <이 세션 전사본> --out tracks/_meta/session_checklist_${TODAY}_<세션8>.md"
392
+ fi
393
+ echo " → 상태 칸을 증거·사유와 함께 채우고, 열린 줄을 운영자에게 표로 보여라(영혼 다지기)."
394
+ else
395
+ for _f in "${_SC_FILES[@]}"; do
396
+ _SC_OUT=$(python3 "$_SC_PY" check --file "$_f" 2>&1); _SC_RC=$?
397
+ case "$_SC_RC" in
398
+ 0) echo "✅ ①-g 결과서 형식 OK — ${_f#$FH/} (형식만 본다: 상태가 참인지는 운영자가 본다)" ;;
399
+ 1) echo "⚠️ ①-g 결과서에 빈 칸·사유 없는 미완 줄이 있다 — ${_f#$FH/}"
400
+ printf '%s\n' "$_SC_OUT" | tail -8 | sed 's/^/ /' ;;
401
+ 4) echo "⚠️ ①-g 결과서 표에 행이 0 개다(DEAD CONTROL) — ${_f#$FH/} · «잴 게 없었다» 가 아니라 «안 적었다» 다" ;;
402
+ *) echo "⚠️ ①-g 결과서 검사 UNMEASURED (rc=$_SC_RC) — ${_f#$FH/}"
403
+ printf '%s\n' "$_SC_OUT" | tail -4 | sed 's/^/ /' ;;
404
+ esac
405
+ done
406
+ fi
407
+ else
408
+ echo "⚠️ ①-g session_checklist.py 없음 — skipped, not passed (UNMEASURED)"
409
+ fi
410
+
367
411
  # ② FH assets changed today → harvest-loop owed
368
412
  # NOTE: no `grep -q` here — under `set -o pipefail`, -q's early exit SIGPIPEs git log (141),
369
413
  # masking a real match as pipeline failure so the warning NEVER fired on true positives
@@ -571,6 +571,10 @@ snapshot "$OUTDIR/_machine_before.txt"
571
571
 
572
572
  CONTAMINATED=0
573
573
  for r in $(seq 1 "$REPS"); do
574
+ # A reused --out must not carry the previous run's budget record into a rep that fails before
575
+ # writing its own (clone failure `continue`s first) — a stale `ended_at_cap=no` would be read as
576
+ # this run's. Same for the per-turn table the budget line reads.
577
+ rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv"
574
578
  # Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
575
579
  # and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
576
580
  # projects and reported finding "iso_A, door_CTRL" — the other arms' work dirs. Content stayed
@@ -758,6 +762,33 @@ for r in $(seq 1 "$REPS"); do
758
762
  fi
759
763
  bytes=$(wc -c < "$OUTDIR/${ARM}_r${r}.txt" | tr -d ' ')
760
764
 
765
+ # ── BUDGET LINE (2026-10-17) — which cap this episode ran under, and did it END at that cap. ──
766
+ # Caps are read off the ARGV actually handed to `claude -p` (TOOLS/MCPARGS arrays) and the env it
767
+ # inherited — never retyped. `timeout_s` is the very $TIMEOUT fed to fh_timeout above.
768
+ # ended_at_cap is three-valued, never defaulted to "no":
769
+ # yes rc=124 — fh_timeout's own convention for all three kinds (gnu / gtimeout / bash watchdog)
770
+ # no rc=0 AND no turn/token cap was set (nothing else could have stopped it early)
771
+ # UNKNOWN anything else: rc=0 with a turn/token cap set (a max-turns stop exits 0 and this
772
+ # runner reads no stop reason), or a non-124 failure (crash vs kill is not told apart)
773
+ _cap_arg() { local _f="$1"; shift; while [ $# -gt 0 ]; do [ "$1" = "$_f" ] && { printf '%s' "${2:-unset}"; return; }; shift; done; printf 'unset'; }
774
+ _cap_turns="$(_cap_arg --max-turns "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"})"
775
+ _cap_tokens="${CLAUDE_CODE_MAX_OUTPUT_TOKENS:-unset}"
776
+ # Multi-turn: the rep returns its FIRST failing rc, so turn 1 rc=7 + turn 2 rc=124 returns 7 and
777
+ # would hide the timeout. Any turn row with rc=124 makes the episode `yes`. timeout_s is per turn.
778
+ _turn_timeout=0
779
+ [ -f "$OUTDIR/${ARM}_r${r}.turns.tsv" ] && \
780
+ awk -F'\t' 'NR>1 && $2==124 {f=1} END {exit !f}' "$OUTDIR/${ARM}_r${r}.turns.tsv" && _turn_timeout=1
781
+ if [ "$rc" -eq 124 ] || [ "$_turn_timeout" -eq 1 ]; then _cap_end=yes
782
+ elif [ "$rc" -eq 0 ] && [ "$_cap_turns" = unset ] && [ "$_cap_tokens" = unset ]; then _cap_end=no
783
+ else _cap_end=UNKNOWN; fi
784
+ {
785
+ printf 'rc\t%s\n' "$rc"
786
+ printf 'timeout_s\t%s\n' "$TIMEOUT"
787
+ printf 'max_turns\t%s\n' "$_cap_turns"
788
+ printf 'token_cap\t%s\n' "$_cap_tokens"
789
+ printf 'ended_at_cap\t%s\n' "$_cap_end"
790
+ } >> "$OUTDIR/${ARM}_r${r}.meta.tsv"
791
+
761
792
  # 🟥 An empty output is NOT a "no" answer. The first version of tonight's runner used
762
793
  # `timeout 300`, which killed exactly the heavy arms — the ones where the behaviour under test
763
794
  # actually fired — and left 0-byte files that read as "the identity did not fire". A false RED
@@ -4,14 +4,18 @@
4
4
  # 왜: Claude Code 는 세션 시작 시 CLAUDE.md 가 150.0k **문자**를 넘으면
5
5
  # `⚠ CLAUDE.md is over the 150.0k-char limit` 경고를 띄운다. 허브 CLAUDE.md 는 tracked·출하 파일이라
6
6
  # README 주 경로(git clone)로 들어온 모든 사용자가 그 경고를 본다(v3.16.0~v3.21.0 실측: 150,733 → 154,149).
7
- # 파일은 주당 ~1k 씩 자라므로, 경고가 뜨기 **전에** 이 레인이 빨개지도록 한계를 145,000 으로 둔다.
7
+ # 파일은 주당 ~1k 씩 자라므로, 경고가 뜨기 **전에** 이 레인이 빨개지도록 한계를 145,000 으로 두었다(과거).
8
+ # 2026-10-17 래칫: v3.27.0 다이어트로 95줄 14,697자가 됐는데 한계가 145,000 이라 10배 재팽창까지 아무것도
9
+ # 안 막았다(운영자 «클로드md 자수는 앞으로도 잘 관리되겠지?»). 한계 = 18,000(지금 +22%). 넘으면 옮기거나,
10
+ # 정말 상주가 필요하면 **이 숫자를 올리는 커밋**으로 늘린다 — 그래야 늘어난 이유가 기록에 남는다.
11
+ # L7(advisory): 이 머신에 CLAUDE.local.md 가 있으면 합계를 같이 찍는다. CC 경고는 지침 파일 «합계» 150k 를 센다.
8
12
  # 무엇을 세나: Python `len()` 을 UTF-8 디코드한 텍스트에 건다 = **문자 수**(바이트 아님). CC 경고가 문자를
9
13
  # 세므로 같은 단위다. `wc -c` 는 바이트라 한글 한 글자를 3 으로 세어 과차단한다(L4 가 그 차이를 박는다).
10
14
  # 처방: 빨개지면 지우지 말고 **옮겨라** — 근거·실측·철회 경위를 detail 파일로 verbatim 이관하고 상주에는
11
15
  # 규칙 + 포인터만 남긴다(선례: tracks/_meta/claude_md_diet_2026-09-26/ 의 diet.py·verify.py).
12
16
  set -uo pipefail
13
17
  HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/.." && pwd)"
14
- LIMIT=145000
18
+ LIMIT="${FH_CLAUDE_MD_LIMIT:-18000}" # 포크는 자기 CLAUDE.md 에 맞춰 올려도 된다(이건 FH 허브 상주 래칫이다)
15
19
  PASS=0; FAIL=0
16
20
  ok(){ PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
17
21
  no(){ FAIL=$((FAIL+1)); printf ' ❌ %s — %s\n' "$1" "${2:-}"; }
@@ -45,11 +49,12 @@ printf '# small\n' > "$D/small.md"
45
49
  OUT=$(size_check "$D/small.md" "$LIMIT"); RC=$?
46
50
  [ "$RC" -eq 0 ] && ok "L3 known-negative: 작은 파일 → PASS" || no "L3 known-negative" "rc=$RC out=$OUT"
47
51
 
48
- # L4 unit = characters, not bytes: 100,000 Hangul chars = 300,000 bytes must PASS.
49
- python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("가"*100000)' "$D/ko.md"
52
+ # L4 unit = characters, not bytes: LIMIT/2 Hangul chars = 1.5×LIMIT bytes must PASS.
53
+ HALF=$((LIMIT/2))
54
+ python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("가"*int(sys.argv[2]))' "$D/ko.md" "$HALF"
50
55
  OUT=$(size_check "$D/ko.md" "$LIMIT"); RC=$?; BYTES=$(wc -c < "$D/ko.md" | tr -d ' ')
51
- [ "$RC" -eq 0 ] && [ "$OUT" = "100000" ] && [ "$BYTES" -gt "$LIMIT" ] \
52
- && ok "L4 단위 = 문자: 한글 100,000자(${BYTES} bytes) → PASS" || no "L4 단위" "rc=$RC chars=$OUT bytes=$BYTES — 바이트를 세고 있다"
56
+ [ "$RC" -eq 0 ] && [ "$OUT" = "$HALF" ] && [ "$BYTES" -gt "$LIMIT" ] \
57
+ && ok "L4 단위 = 문자: 한글 ${HALF}자(${BYTES} bytes) → PASS" || no "L4 단위" "rc=$RC chars=$OUT bytes=$BYTES — 바이트를 세고 있다"
53
58
 
54
59
  # L5 boundary: exactly LIMIT passes, LIMIT+1 fails.
55
60
  python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("a"*int(sys.argv[2]))' "$D/eq.md" "$LIMIT"
@@ -66,9 +71,19 @@ if [ ! -f "$ROOT/CLAUDE.md" ]; then
66
71
  no "L1 CLAUDE.md" "파일 부재 — 미측정(통과 아님)"
67
72
  else
68
73
  OUT=$(size_check "$ROOT/CLAUDE.md" "$LIMIT"); RC=$?
69
- if [ "$RC" -eq 0 ]; then ok "L1 CLAUDE.md = ${OUT}자 ≤ ${LIMIT} (CC 경고선 150,000 까지 $((150000-OUT)))"
74
+ if [ "$RC" -eq 0 ]; then ok "L1 CLAUDE.md = ${OUT}자 ≤ ${LIMIT} (한계까지 $((LIMIT-OUT)) · CC 경고선 150,000)"
70
75
  else no "L1 CLAUDE.md" "${OUT}자 > ${LIMIT} — 지우지 말고 detail 파일로 옮겨라(헤더 처방)"; fi
71
76
  fi
72
77
 
78
+ # L7 advisory (never fails): the CC warning counts ALL instruction files (150k total). CLAUDE.local.md is
79
+ # gitignored, so CI never sees it — on a machine that has one, print the pair's total so growth is visible.
80
+ if [ -f "$ROOT/CLAUDE.local.md" ] && [ -f "$ROOT/CLAUDE.md" ]; then
81
+ A=$(size_check "$ROOT/CLAUDE.md" 999999999); B=$(size_check "$ROOT/CLAUDE.local.md" 999999999)
82
+ case "$A$B" in *UNMEASURED*) echo " ℹ️ L7 합계 미측정 ($A / $B)" ;;
83
+ *) echo " ℹ️ L7 CLAUDE.md ${A} + CLAUDE.local.md ${B} = $((A+B))자 (CC 합계 경고 150,000 · 전역 ~/.claude/CLAUDE.md 는 scripts/resident_cost.py 로)" ;; esac
84
+ else
85
+ echo " ℹ️ L7 CLAUDE.local.md 없음 — 합계 미측정(0 아님)"
86
+ fi
87
+
73
88
  echo "PASS=$PASS FAIL=$FAIL"
74
89
  [ "$FAIL" -eq 0 ] || { echo "FAILED=1"; exit 1; }