@chrono-meta/fh-gate 3.43.0 → 3.45.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 (105) hide show
  1. package/.claude/rules/fh_4axis_gate.md +50 -608
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/AGENTS.md +5 -1
  4. package/CATALOG.md +21 -0
  5. package/CHEATSHEET.md +7 -1
  6. package/docs/USER_GUIDE.md +95 -0
  7. package/docs/codex-compat.md +1 -1
  8. package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
  9. package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
  10. package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
  11. package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
  12. package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
  13. package/knowledge/shared/learnings/subagent_invocations_log.yaml +221 -0
  14. package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
  15. package/package.json +24 -1
  16. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  17. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +50 -14
  18. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +80 -0
  19. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
  20. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
  21. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-meta/CHANGELOG.md +118 -0
  23. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +58 -1
  24. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
  25. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
  26. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +9 -4
  27. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  28. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  29. package/scripts/agy_launch_guard.sh +165 -0
  30. package/scripts/agy_remote_run.sh +187 -0
  31. package/scripts/below_floor_scan.sh +30 -0
  32. package/scripts/codex_launch_guard.sh +123 -0
  33. package/scripts/correction_moments.py +23 -2
  34. package/scripts/fh-gate.sh +612 -14
  35. package/scripts/fh-goal.sh +56 -12
  36. package/scripts/fh-run.sh +1 -1
  37. package/scripts/fh_gate_exec.sh +272 -0
  38. package/scripts/fh_session_load.sh +17 -0
  39. package/scripts/finding_fleet.sh +36 -2
  40. package/scripts/finding_verifier.sh +7 -2
  41. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
  42. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
  43. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
  44. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
  45. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
  46. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
  47. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
  48. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
  49. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
  50. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
  51. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
  52. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
  53. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
  54. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
  55. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
  56. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
  57. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
  58. package/scripts/heavy_skill_smell.py +311 -0
  59. package/scripts/job_heartbeat.py +186 -0
  60. package/scripts/ko_tech_writer_calibrate.py +88 -1
  61. package/scripts/live_eval_matrix.py +128 -0
  62. package/scripts/live_eval_trace.py +199 -5
  63. package/scripts/package_coverage_check.sh +18 -0
  64. package/scripts/prepush_guard_check.sh +41 -20
  65. package/scripts/probe_live_eval.sh +33 -1
  66. package/scripts/probe_live_eval_lib.py +14 -6
  67. package/scripts/selfcheck.sh +162 -2
  68. package/scripts/selfcheck_shard_weights.txt +2 -0
  69. package/scripts/session_checklist.py +109 -5
  70. package/scripts/sidecar_calibrate.sh +15 -5
  71. package/scripts/sidecar_wait.sh +21 -1
  72. package/scripts/sim_isolated_run.sh +20 -0
  73. package/scripts/test_agy_launch_guard_lanes.sh +347 -0
  74. package/scripts/test_agy_remote_run_lanes.sh +228 -0
  75. package/scripts/test_below_floor_scan_lanes.sh +85 -0
  76. package/scripts/test_codex_launch_guard_lanes.sh +183 -0
  77. package/scripts/test_correction_moments_lanes.sh +37 -0
  78. package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
  79. package/scripts/test_fh_gate_defaults_lanes.sh +169 -0
  80. package/scripts/test_fh_gate_exec_lanes.sh +244 -0
  81. package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
  82. package/scripts/test_fh_gate_regressions.sh +92 -1
  83. package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
  84. package/scripts/test_finding_pipeline_lanes.sh +41 -3
  85. package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
  86. package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
  87. package/scripts/test_job_heartbeat_lanes.sh +96 -0
  88. package/scripts/test_live_eval_construct_lanes.sh +29 -6
  89. package/scripts/test_live_eval_matrix_lanes.sh +53 -0
  90. package/scripts/test_live_eval_trace_lanes.sh +165 -12
  91. package/scripts/test_name_boundary_locale_lanes.sh +36 -5
  92. package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
  93. package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
  94. package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
  95. package/scripts/test_probe_live_eval_lanes.sh +43 -0
  96. package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
  97. package/scripts/test_session_checklist_lanes.sh +205 -0
  98. package/scripts/test_sidecar_calibrate_lanes.sh +5 -1
  99. package/scripts/test_sidecar_wait_stdin.sh +18 -0
  100. package/scripts/test_sim_isolated_run_lanes.sh +43 -0
  101. package/scripts/universal_guard_check.sh +8 -0
  102. package/templates/.claude/rules/mcp_tool_gating.md +27 -0
  103. package/templates/.git-hooks/pre-push +60 -3
  104. package/templates/regression_guard.sh +8 -4
  105. package/templates/settings.LaneGap.snippet.json +27 -0
@@ -253,6 +253,36 @@ def heading_dense(path, common=None, st=None):
253
253
  return out
254
254
 
255
255
 
256
+ # ── S35 낱말 뜻 흔들림 — (a) 기계 단계: 가벼운 동사·명사의 «모든 등장»을 활용형까지 문맥과 함께 늘어놓는다.
257
+ # 🟥 이 함수는 뜻을 가르지 않는다. 뜻 묶기(b)는 판단이다 — 사람 또는 모델이 낱말마다 등장을 뜻별로 묶고 소수 뜻을 표시한다.
258
+ # 레인(C22)이 재는 것은 «늘어놓기의 재현율»뿐이다: 활용형 픽스처의 모든 줄을 잡는가 · 겹치는 다른 낱말(쓰레기 · 세계 · 재료 …)을 안 잡는가.
259
+ # 출발점(2026-11-16): 정규식 하나가 「쓰던 · 쓰면 · 쓰고 · 쓰되」를 놓쳤다 — 활용형 열거가 이 레인의 핵심이다.
260
+ # 낱말을 늘리려면 픽스처 두 파일에 활용형 줄과 겹치는 낱말 줄을 먼저 넣고, 레인이 초록일 때만 여기에 더한다.
261
+ # 앞 경계 (?<![가-힣]) 때문에 합성어(글쓰기 · 덮어쓰기 · 공작기계)는 안 잡는다 — 알려진 잔여.
262
+ SENSE_WORDS = [
263
+ # 쓰다 = 어간 일치 + 이름 붙인 제외(쓰레기 · 쓰나미 · 쓰러지다 · 쓰라리다 · 쓰다듬다 · 씁쓸). 활용형을 열거하지 않는다 —
264
+ # 열거형은 라운드마다 새 활용형을 놓쳤다(쓰던 → 쓰인 → 쓰였다). 대신 과다 나열(쓸모 · 쓴맛 …)을 받아들이고 (b)가 가른다.
265
+ ("쓰다", r"(?<![가-힣])(?:쓰(?!레|나미|러|라리|라린|다듬)|써(?![클머핀드])|썼|씁(?!쓸)|쓴|쓸(?!쓸)|씀)"),
266
+ # 세다 · 재다 = 「세 · 재」로 시작하는 다른 낱말이 너무 많아(세계 · 세션 · 재료 · 재현 …) 어미 첫 음절 목록 + 이름 붙인 제외로 둔다.
267
+ # 이 둘은 열거형이다 — 목록 밖 활용형은 조용히 빠진다(--senses 출력이 그렇게 적는다).
268
+ ("세다", r"(?<![가-힣])(?:세(?:다(?!리)|는|어|었|고|면(?!대)|며|서|던|지|도(?!정)|려|되|겠|니|야|거|봤|보|셨|죠|네|든|기로|길)|센(?:다|(?![가-힣]))|셀(?:까|지|(?![가-힣]))|셉|셌)"),
269
+ ("재다", r"(?<![가-힣])(?:재(?:다|는|어|었|고(?!품)|면(?!접)|며|서|던|지(?!정|원|급)|도(?!전|입)|려|되|겠|니|야|거(?!래)|봤|보(?!험)|셨|죠|든|기로|길)|잰(?:다|(?![가-힣]))|잴|잽(?!싸)|쟀)"),
270
+ ("기계", r"(?<![가-힣])기계"),
271
+ ]
272
+
273
+
274
+ def sense_hits(path, st=None):
275
+ """[(낱말, 줄번호, 문맥)] — 펜스 · 그림 블록은 뺀다. 문맥 = 맞은 자리 앞뒤 20자."""
276
+ out = []
277
+ for i, line in scan_lines(path, True, st or Blocks()):
278
+ line = re.sub(r"<!--.*?-->", "", line) # 주석 안 낱말은 독자 본문이 아니다(픽스처의 기대 표지도 주석이다)
279
+ for lemma, pat in SENSE_WORDS:
280
+ for m in re.finditer(pat, line):
281
+ a, b = max(0, m.start() - 20), min(len(line), m.end() + 20)
282
+ out.append((lemma, i, line[a:b].strip()))
283
+ return out
284
+
285
+
256
286
  # 함수형 레인 레지스트리: 플래그 -> f(path, common) -> [(키, 줄번호, 종류)]
257
287
  FUNC_LANES = {"s7": lambda path, common=None: s7_candidates(path, common),
258
288
  "hdens": lambda path, common=None: heading_dense(path)}
@@ -524,13 +554,42 @@ def scan_main(args):
524
554
  return 0
525
555
 
526
556
 
557
+ def senses_main(args):
558
+ """--senses FILE — S35 (a) 단계: 낱말별 모든 등장을 줄번호 · 문맥과 함께. 뜻 묶기(b)는 이 출력을 읽는 사람/모델의 몫이다."""
559
+ if len(args) != 1 or args[0].startswith("--"):
560
+ sys.stderr.write("usage: ko_tech_writer_calibrate.py --senses FILE\n")
561
+ return 10
562
+ st = Blocks()
563
+ try:
564
+ hits = sense_hits(args[0], st)
565
+ except (OSError, UnicodeDecodeError) as e:
566
+ sys.stderr.write("harness error: cannot scan %s: %s\n" % (args[0], e))
567
+ return 10
568
+ print("scanned: %s %d lines (fence/fig skipped: %d)" % (args[0], st.total, st.skipped))
569
+ print("words: %s -- listing only; group each word's lines by sense and flag the minority sense (judgment)" % ", ".join(w for w, _ in SENSE_WORDS))
570
+ print("coverage: 쓰다 · 기계 = stem match (over-lists; step b sorts it out) · 세다 · 재다 = enumerated endings -- a form outside the list is silently absent, so 0 here is not 'none'")
571
+ for lemma, _ in SENSE_WORDS:
572
+ rows = [(i, c) for w, i, c in hits if w == lemma]
573
+ print("== %s (%d)" % (lemma, len(rows)))
574
+ for i, c in rows:
575
+ print("%d\t%s" % (i, c))
576
+ bad = unclosed(st)
577
+ if bad:
578
+ for b in bad:
579
+ sys.stderr.write("WARNING unclosed block at EOF: %s -- listing after it is NOT valid\n" % b)
580
+ return 3
581
+ return 0
582
+
583
+
527
584
  def main():
528
585
  if len(sys.argv) > 1:
529
586
  if sys.argv[1] == "--scan":
530
587
  return scan_main(sys.argv[2:])
531
588
  if sys.argv[1] == "--check-rewrite":
532
589
  return check_main(sys.argv[2:])
533
- sys.stderr.write("usage: ko_tech_writer_calibrate.py [--scan FILE [--s7-common LIST] | --check-rewrite ...]\n")
590
+ if sys.argv[1] == "--senses":
591
+ return senses_main(sys.argv[2:])
592
+ sys.stderr.write("usage: ko_tech_writer_calibrate.py [--scan FILE [--s7-common LIST] | --check-rewrite ... | --senses FILE]\n")
534
593
  return 10
535
594
  for p in (POS, NEG):
536
595
  if not os.path.isfile(p):
@@ -650,6 +709,33 @@ def main():
650
709
  print("FAIL RW2 %s" % name)
651
710
  nfail += 1
652
711
 
712
+ # C22 S35 낱말 뜻 늘어놓기 — 활용형 픽스처의 «모든» 줄을 기대 낱말로 잡는가(재현율) · 겹치는 다른 낱말을 0건 잡는가.
713
+ # 🟥 판별하는 것은 늘어놓기(a)뿐이다. 뜻 묶기(b)는 판단이라 이 레인이 재지 않는다 — 초록이어도 «뜻 흔들림 검출»을 주장하지 마라.
714
+ sp, sn = os.path.join(FIX, "sense_positive.md"), os.path.join(FIX, "sense_negative.md")
715
+ if not (os.path.isfile(sp) and os.path.isfile(sn)):
716
+ print("FAIL C22 word-sense listing -- fixture missing (%s / %s)" % (sp, sn))
717
+ nfail += 1
718
+ else:
719
+ exp = {}
720
+ for i, l in enumerate(read_lines(sp), 1):
721
+ m = re.search(r"<!-- (\S+) -->\s*$", l)
722
+ if m:
723
+ exp[i] = m.group(1)
724
+ got = {}
725
+ for lemma, i, _ in sense_hits(sp):
726
+ got.setdefault(i, set()).add(lemma)
727
+ miss = sorted(i for i, e in exp.items() if e not in got.get(i, set()))
728
+ extra = sorted(i for i in got if got[i] != {exp.get(i)})
729
+ neg = sense_hits(sn)
730
+ if exp and not miss and not extra and not neg:
731
+ print("OK C22 낱말 뜻 늘어놓기(S35 a단계) -- recall %d/%d lines of a constructed inflection fixture (%s) / negative 0 (listing discriminates there; "
732
+ "sense grouping is judgment, NOT measured here)" % (len(exp), len(exp), ", ".join(w for w, _ in SENSE_WORDS)))
733
+ npass += 1
734
+ else:
735
+ print("FAIL C22 낱말 뜻 늘어놓기 -- expected %d, missed lines %s, wrong-lemma lines %s, negative hits %d"
736
+ % (len(exp), miss, extra, len(neg)))
737
+ nfail += 1
738
+
653
739
  # META 컨트롤 1 — 없는 토큰이 양쪽 다 0인가 (계기가 «늘 잡는다» 를 내지 않는다)
654
740
  if count(POS, NEVER) == 0 and count(NEG, NEVER) == 0:
655
741
  print("OK META control -- an absent token matches nothing in either fixture")
@@ -675,6 +761,7 @@ def main():
675
761
  print(" NOT proven: 'zero residue' in any real document. That is measured per document.")
676
762
  print(" C7-C12 positives are the harvest's own 'before' sentences (re-built short); C13-C14 positives are constructed (no harvest pair), so")
677
763
  print(" false-positive rate on out-of-distribution text is UNMEASURED. C9 over-blocks by design.")
764
+ print(" C22 measures listing recall on a constructed inflection fixture only; grouping occurrences by sense (S35 step b) is judgment and has no lane.")
678
765
  print(" Citing this suite as evidence of 'zero residue' reproduces the very downgrade")
679
766
  print(" recorded in harness_terminal_correlation_and_recommendations.md.")
680
767
  return 0
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env python3
2
+ """live_eval_matrix.py — per-probe verdicts across every nightly live-eval report, read once.
3
+
4
+ Why (frontier digest 2026-11-12, arXiv:2611.13709): a pooled pass rate such as 0.8 can hide a
5
+ probe that has never passed. probe_live_eval.sh already compares each report with the one before it
6
+ (`moved since previous`). It does not show the whole history: which probes always pass, which never
7
+ did, and which flip back and forth. This reads every live_eval_<YYYY-MM-DD>.md in a folder and
8
+ prints a probe × date matrix plus four lists:
9
+ always-pass — every scored report says PASS (scored = PASS or FAIL)
10
+ never-pass — every scored report says FAIL
11
+ mixed — both PASS and FAIL appear
12
+ too-few — fewer than 2 scored reports, so no bin applies (an absence is not a bin)
13
+
14
+ Record only. It prints record properties (counts and lists) and no verdict. No threshold, and the
15
+ exit code ignores the bins. Whether a never-pass probe means a dead rule or a broken probe is a
16
+ human judgment. UNCALIBRATED, FAILED-TO-RUN and rows whose verdict is outside the enum are counted in their own columns and are never
17
+ counted as FAIL. A probe that did not run did not fail.
18
+
19
+ Parsing reuses probe_live_eval_lib.parse_prev_report (single source for the run-table shape).
20
+
21
+ Usage:
22
+ live_eval_matrix.py [--dir <folder>] # default <repo>/tracks/_meta (the reports are gitignored)
23
+ exit: 0 printed · 10 input error (folder missing)
24
+ """
25
+ import glob
26
+ import os
27
+ import re
28
+ import sys
29
+
30
+ HERE = os.path.dirname(os.path.abspath(__file__))
31
+ sys.path.insert(0, HERE)
32
+ import probe_live_eval_lib as L # noqa: E402
33
+
34
+ NAME = re.compile(r"^live_eval_(\d{4}-\d{2}-\d{2})\.md$")
35
+ OUT_OF_ENUM = "OUT-OF-ENUM" # row present, verdict cell outside the run-table enum (not scored, not absent)
36
+ SHORT = {L.PASS: "P", L.FAIL: "F", L.UNCALIBRATED: "U", L.FAILED_TO_RUN: "R", "UNKNOWN-ID": "?", OUT_OF_ENUM: "N"}
37
+
38
+
39
+ def collect(folder):
40
+ """-> (dates, {date: {id: verdict}}, unreadable[names]). Files are matched by exact name only;
41
+ stratify/RESULT files and other suffixes are not run tables of this shape and are skipped."""
42
+ reports, unreadable = {}, []
43
+ for p in sorted(glob.glob(os.path.join(folder, "live_eval_*.md"))):
44
+ m = NAME.match(os.path.basename(p))
45
+ if not m:
46
+ continue
47
+ rows = L.parse_prev_report(p)
48
+ if rows is None:
49
+ unreadable.append(os.path.basename(p))
50
+ else:
51
+ reports[m.group(1)] = rows
52
+ # parse_prev_report keeps only enum verdicts. A known probe row whose verdict cell is outside the
53
+ # enum (measured 2026-11-13: «NOT-LIVE-MEASURABLE (…)» in 60+ real reports) would otherwise print
54
+ # as absent, which claims the probe was not in that report when it was there but not scored.
55
+ ids = {i for r in reports.values() for i in r}
56
+ for d, rows in reports.items():
57
+ text = L._read_text(os.path.join(folder, "live_eval_%s.md" % d)) or ""
58
+ for line in text.splitlines():
59
+ cells = [c.strip() for c in line.strip().strip("|").split("|")]
60
+ if line.startswith("|") and len(cells) >= 2 and cells[0] in ids and cells[0] not in rows:
61
+ rows[cells[0]] = OUT_OF_ENUM
62
+ return sorted(reports), reports, unreadable
63
+
64
+
65
+ def bins(dates, reports):
66
+ ids = sorted({i for d in dates for i in reports[d]})
67
+ out = {"always-pass": [], "never-pass": [], "mixed": [], "too-few": []}
68
+ detail = {}
69
+ for i in ids:
70
+ seq = [reports[d].get(i) for d in dates]
71
+ scored = [v for v in seq if v in (L.PASS, L.FAIL)]
72
+ p, f = scored.count(L.PASS), scored.count(L.FAIL)
73
+ other = sum(1 for v in seq if v is not None and v not in (L.PASS, L.FAIL))
74
+ absent = seq.count(None)
75
+ if len(scored) < 2:
76
+ b = "too-few"
77
+ elif f == 0:
78
+ b = "always-pass"
79
+ elif p == 0:
80
+ b = "never-pass"
81
+ else:
82
+ b = "mixed"
83
+ out[b].append(i)
84
+ detail[i] = {"seq": seq, "pass": p, "fail": f, "other": other, "absent": absent, "bin": b}
85
+ return out, detail
86
+
87
+
88
+ def render(folder, dates, reports, unreadable):
89
+ lines = ["live-eval matrix (record only — no verdict, exit code ignores bins)",
90
+ "folder: %s" % folder,
91
+ "reports read: %d%s" % (len(dates), (" (%s .. %s)" % (dates[0], dates[-1])) if dates else ""),
92
+ "reports unreadable or without a run table: %d%s" % (
93
+ len(unreadable), (" — " + ", ".join(unreadable)) if unreadable else "")]
94
+ if not dates:
95
+ lines.append("no readable report — nothing to bin (not measured, not zero)")
96
+ return "\n".join(lines)
97
+ b, detail = bins(dates, reports)
98
+ lines.append("legend: P=PASS F=FAIL U=UNCALIBRATED R=FAILED-TO-RUN ?=UNKNOWN-ID N=row present, verdict outside the enum .=absent from that report")
99
+ lines.append("")
100
+ w = max(len(i) for i in detail)
101
+ for i in sorted(detail):
102
+ d = detail[i]
103
+ cells = "".join(SHORT.get(v, "?") if v is not None else "." for v in d["seq"])
104
+ lines.append("%-*s %s pass=%d fail=%d not-scored=%d absent=%d %s" % (
105
+ w, i, cells, d["pass"], d["fail"], d["other"], d["absent"], d["bin"]))
106
+ lines.append("")
107
+ for k in ("always-pass", "never-pass", "mixed", "too-few"):
108
+ lines.append("%s: %d%s" % (k, len(b[k]), (" — " + ", ".join(b[k])) if b[k] else ""))
109
+ return "\n".join(lines)
110
+
111
+
112
+ def main(argv):
113
+ folder = os.path.join(os.path.dirname(HERE), "tracks", "_meta")
114
+ if len(argv) >= 2 and argv[0] == "--dir":
115
+ folder = argv[1]
116
+ elif argv:
117
+ sys.stderr.write("usage: live_eval_matrix.py [--dir <folder>]\n")
118
+ return 10
119
+ if not os.path.isdir(folder):
120
+ sys.stderr.write("folder not found: %s\n" % folder)
121
+ return 10
122
+ dates, reports, unreadable = collect(folder)
123
+ print(render(folder, dates, reports, unreadable))
124
+ return 0
125
+
126
+
127
+ if __name__ == "__main__":
128
+ sys.exit(main(sys.argv[1:]))
@@ -9,9 +9,11 @@ sim_isolated_run.sh), and a probe may declare `behave:` — an observable tool c
9
9
 
10
10
  Two uses:
11
11
  extract <stream.jsonl> <out.txt> <tools.txt> (runner) write the final result text and the init
12
- tool/MCP inventory. Exit 3 on a stream that has no parseable result event — never an empty
12
+ tool/MCP/plugin inventory. Exit 3 on a stream that has no parseable result event — never an empty
13
13
  «the session said nothing» (same rule as sim_isolated_run.sh's turns path).
14
- library: parse_stream(path) · behave_hit(trace, spec) · inventory(trace)
14
+ profile <stream.jsonl> (runner) one record-only line: top-level tool calls in four bins
15
+ (explore · edit · test-run · other). Exit 3 and «trace=UNREADABLE» on a stream it cannot read.
16
+ library: parse_stream(path) · behave_hit(trace, spec) · inventory(trace) · profile_bins(trace)
15
17
 
16
18
  `behave:` grammar (one per probe, value is an ERE, no colon by probes_live.yaml convention):
17
19
  read=<re> some SUCCESSFUL Read (file_path) or Grep (path) call matches — Python `re`, not POSIX
@@ -35,7 +37,8 @@ def parse_stream(path):
35
37
  lines = open(path, encoding='utf-8').read().splitlines()
36
38
  except (OSError, UnicodeDecodeError):
37
39
  return None
38
- out = {'result': None, 'tools': None, 'mcp': None, 'calls': [], 'damaged': 0, 'ok_ids': set()}
40
+ out = {'result': None, 'tools': None, 'mcp': None, 'plugins': None, 'calls': [], 'damaged': 0, 'ok_ids': set()}
41
+ inits = [] # plugin set of every init event, in order
39
42
  for ln in lines:
40
43
  ln = ln.strip()
41
44
  if not ln:
@@ -54,6 +57,17 @@ def parse_stream(path):
54
57
  if isinstance(ev.get('mcp_servers'), list):
55
58
  out['mcp'] = sorted(('%s:%s' % (s.get('name'), s.get('status'))) if isinstance(s, dict) else str(s)
56
59
  for s in ev['mcp_servers'])
60
+ # Plugins (2026-11-15): arms load the operator's user/builtin/synced plugins from the real
61
+ # HOME, and the set can change between reps (a builtin rolled out mid-run; an auto-update
62
+ # moved a version). name, source and version — never the path (it carries the home directory).
63
+ # Key absent → None (UNKNOWN, never «no plugins»).
64
+ # Each entry is a JSON array [name, source, version] so no separator inside a name can make
65
+ # two different sets render alike; a non-object entry is {"raw": ...}, which never equals
66
+ # an array. A set: duplicates and order do not matter. Every init is kept (see below).
67
+ inits.append(None if not isinstance(ev.get('plugins'), list) else sorted(set(
68
+ json.dumps([p.get('name'), p.get('source'), p.get('version')], ensure_ascii=False)
69
+ if isinstance(p, dict) else json.dumps({'raw': p}, ensure_ascii=False)
70
+ for p in ev['plugins'])))
57
71
  elif t == 'assistant':
58
72
  if ev.get('parent_tool_use_id'):
59
73
  continue
@@ -69,14 +83,61 @@ def parse_stream(path):
69
83
  out['damaged'] += 1 # an error result is not a finished session
70
84
  r = ev.get('result')
71
85
  out['result'] = r if isinstance(r, str) else ('' if r is None else json.dumps(r, ensure_ascii=False))
86
+ # One init (the normal single-shot stream): its set. Several inits that agree: that set. Several
87
+ # that disagree: the whole sequence, so a later init can never erase an earlier mismatch (codex R1).
88
+ if inits:
89
+ out['plugins'] = inits[0] if all(x == inits[0] for x in inits) else \
90
+ [json.dumps({'inits': inits}, ensure_ascii=False)]
72
91
  return out
73
92
 
74
93
 
94
+ def inventory_parts(trace):
95
+ """The arm's surface as three sets — the same elements `inventory` joins — so a reader can be told
96
+ WHICH ones differ. None when the init event was absent. plugins=None means UNKNOWN (no list)."""
97
+ if trace is None or trace['tools'] is None:
98
+ return None
99
+ return {'tools': set(trace['tools']), 'mcp': set(trace['mcp'] or []),
100
+ 'plugins': set(trace['plugins']) if trace.get('plugins') is not None else None}
101
+
102
+
103
+ def _plugin_label(entry):
104
+ """«source[=version]» for a plugin entry (the JSON array [name, source, version]); the source
105
+ already carries the name in the real init (name@marketplace). Anything else is shown as stored —
106
+ including a multi-init mismatch blob (named residual: it is not broken down per plugin)."""
107
+ try:
108
+ n, src, ver = json.loads(entry)
109
+ except Exception:
110
+ return entry
111
+ src = str(src or '') # unvalidated init JSON: a non-string source must not raise (it would change rc)
112
+ lab = src if src.startswith('%s@' % n) else ('%s@%s' % (n, src) if src else str(n))
113
+ return lab + ('=%s' % ver if ver else '')
114
+
115
+
116
+ def surface_diff(parts_list):
117
+ """Elements that are not in every arm, per kind — «mcp=a,b; plugins=x@y=1.0» — or '' when the
118
+ sets agree. Nothing is dropped: an UNKNOWN plugin list in some arm is named as such."""
119
+ out = []
120
+ for key in ('tools', 'mcp', 'plugins'):
121
+ sets = [p[key] for p in parts_list]
122
+ unknown = key == 'plugins' and any(x is None for x in sets)
123
+ sets = [x for x in sets if x is not None]
124
+ if unknown and sets:
125
+ out.append('plugins=UNKNOWN in some arm')
126
+ # among the arms whose list is known (codex R1: an UNKNOWN arm must not hide a known difference)
127
+ diff = set().union(*sets) - set.intersection(*sets) if sets else set()
128
+ if diff:
129
+ shown = sorted(_plugin_label(e) for e in diff) if key == 'plugins' else sorted(diff)
130
+ out.append('%s=%s' % (key, ','.join(shown)))
131
+ return '; '.join(out) # SURFACE_DIFF_RETURN (TR24 mutates this line)
132
+
133
+
75
134
  def inventory(trace):
76
- """One comparable string for the arm's tool surface, or None when the init event was absent."""
135
+ """One comparable string for the arm's tool/MCP/plugin surface, or None when the init event was
136
+ absent. An init without a plugin list reads plugins=UNKNOWN, so it never equals an arm that has one."""
77
137
  if trace is None or trace['tools'] is None:
78
138
  return None
79
- return 'tools=' + ','.join(trace['tools']) + ' | mcp=' + ','.join(trace['mcp'] or [])
139
+ plug = 'UNKNOWN' if trace.get('plugins') is None else ','.join(trace['plugins'])
140
+ return 'tools=' + ','.join(trace['tools']) + ' | mcp=' + ','.join(trace['mcp'] or []) + ' | plugins=' + plug
80
141
 
81
142
 
82
143
  def _read_hit(call, trace, pat):
@@ -104,6 +165,137 @@ def behave_hit(trace, spec):
104
165
  return any(_read_hit(c, trace, pat) for c in file_calls)
105
166
 
106
167
 
168
+ # ── Behaviour profile (2026-11-17, record only — never read by a scorer) ─────────────────────────
169
+ # Two arms with the same PASS rate can still behave differently (arXiv:2611.17440): one may skip
170
+ # verification and pass anyway. The profile counts the arm's top-level tool calls in four bins.
171
+ # Every EMITTED call counts, successful or not — an attempted test run is still a test run.
172
+ # Bash is binned by its command text, in this order (first match wins):
173
+ # test-run some segment RUNS a test: its command word is a runner (pytest, jest, vitest, npm/pnpm/
174
+ # yarn test, go/cargo test, make test|check, python -m pytest|unittest), or a test
175
+ # script (selfcheck.sh, test_*.sh|py, *_lanes.sh) as the command or as the script
176
+ # argument of bash/sh/zsh/python. Naming a test file as data (`cat test_x.py`) is not a run.
177
+ # edit a write shape: a redirect to a file (not /dev/null, not >&N), sed -i / -Ei / --in-place,
178
+ # tee, or a segment whose command word is mv cp rm mkdir touch chmod ln
179
+ # explore the first command after any leading `cd …` is a read-only one (ls cat grep find …,
180
+ # git log/status/diff/show/…, gh … view/list/status/diff/checks)
181
+ # other anything else — running a script that is not a test lands here
182
+ # Named residuals: only the first non-cd segment decides explore, so `ls && ./build.sh` reads as
183
+ # explore; a redirect inside a quoted string reads as edit; a test runner named differently from the
184
+ # list reads as other; a runner inside a shell string (`bash -c 'pytest'`) or behind a wrapper that
185
+ # carries options (`env -i pytest`, `nice -n 10 pytest`, `timeout --signal=TERM 60 pytest`) reads as
186
+ # other; `git branch` / `git remote` read as other even when they only list. These are a heuristic's
187
+ # edges — after two cross-family rounds each found new ones, they are named here, not chased (a static
188
+ # shell-string reader does not converge). The profile is record only, so a misbinned call moves no
189
+ # verdict. Binning is calibrated on two hand-labelled nightly runs (17/17 calls, explore and other
190
+ # bins) — edit and test-run were exercised on fixtures only.
191
+ EXPLORE_TOOLS = ('Read', 'Grep', 'Glob', 'LS', 'NotebookRead', 'WebFetch', 'WebSearch', 'ToolSearch')
192
+ EDIT_TOOLS = ('Edit', 'Write', 'MultiEdit', 'NotebookEdit')
193
+ _TEST_SCRIPT_RE = re.compile(r'^(?:selfcheck\.sh|test_[\w.-]*\.(?:sh|py)|[\w.-]*_lanes?\.sh)$')
194
+ _TEST_RUNNERS = ('pytest', 'py.test', 'jest', 'vitest')
195
+ _SHELLS = ('bash', 'sh', 'zsh', 'python', 'python3')
196
+ _WRITE_RE = re.compile(r'>>?(?!&)\s*(?!/dev/null\b)[^\s&|;>]|\btee\b')
197
+ _EDIT_WORDS = ('mv', 'cp', 'rm', 'mkdir', 'touch', 'chmod', 'ln')
198
+ _EXPLORE_WORDS = ('ls', 'cat', 'head', 'tail', 'grep', 'egrep', 'rg', 'find', 'wc', 'tree', 'stat', 'file',
199
+ 'pwd', 'which', 'echo', 'printf', 'less', 'diff', 'du', 'sort', 'uniq', 'cut', 'sed', 'awk',
200
+ 'jq', 'readlink', 'realpath', 'basename', 'dirname', 'date', 'id', 'whoami')
201
+ _GIT_READ = ('log', 'status', 'diff', 'show', 'ls-files', 'ls-tree', 'blame',
202
+ 'rev-parse', 'grep', 'describe', 'shortlog', 'reflog')
203
+ _GH_READ = ('view', 'list', 'status', 'diff', 'checks')
204
+ PROFILE_BINS = ('explore', 'edit', 'test-run', 'other')
205
+
206
+
207
+ def _segments(cmd):
208
+ """Each segment's words, with leading VAR=value assignments and the wrappers env / time / nice /
209
+ exec / command / timeout <secs> dropped, so the command word is the one that runs; empty
210
+ segments skipped."""
211
+ for seg in re.split(r'&&|\|\||;|\n|\|', cmd):
212
+ words = seg.split()
213
+ while words:
214
+ if re.match(r'^[A-Za-z_][A-Za-z0-9_]*=', words[0]) or words[0] in ('env', 'time', 'nice', 'exec', 'command'):
215
+ words = words[1:]
216
+ elif words[0] == 'timeout' and len(words) > 1:
217
+ words = words[2:]
218
+ else:
219
+ break
220
+ if words:
221
+ yield words
222
+
223
+
224
+ def _runs_test(w):
225
+ base = lambda x: x.rsplit('/', 1)[-1]
226
+ if w[0] in _TEST_RUNNERS or _TEST_SCRIPT_RE.match(base(w[0])):
227
+ return True
228
+ if w[0] in ('npm', 'pnpm', 'yarn') and 'test' in w[1:3]:
229
+ return True
230
+ if (w[0] in ('go', 'cargo') and w[1:2] == ['test']) or (w[0] == 'make' and w[1:2] in (['test'], ['check'])):
231
+ return True
232
+ if w[0] in _SHELLS:
233
+ args = [x for x in w[1:] if not x.startswith('-')]
234
+ if w[0].startswith('python') and '-m' in w and w[w.index('-m') + 1:w.index('-m') + 2] in (['pytest'], ['unittest']):
235
+ return True
236
+ return bool(args) and bool(_TEST_SCRIPT_RE.match(base(args[0])))
237
+ return False
238
+
239
+
240
+ def _sed_in_place(w):
241
+ return w[0] == 'sed' and any(x.startswith('--in-place') or re.match(r'^-[a-zA-Z]*i', x) for x in w[1:])
242
+
243
+
244
+ def _bash_bin(cmd):
245
+ cmd = str(cmd or '')
246
+ segs = list(_segments(cmd))
247
+ if any(_runs_test(w) for w in segs):
248
+ return 'test-run'
249
+ if _WRITE_RE.search(cmd) or any(w[0] in _EDIT_WORDS or _sed_in_place(w) for w in segs):
250
+ return 'edit'
251
+ first = next((w for w in segs if w[0] != 'cd'), None)
252
+ if not first:
253
+ return 'other'
254
+ if first[0] in _EXPLORE_WORDS:
255
+ return 'explore'
256
+ if first[0] == 'git' and any(w in _GIT_READ for w in first[1:3] if not w.startswith('-')):
257
+ return 'explore'
258
+ if first[0] == 'gh' and any(w in _GH_READ for w in first[1:4]):
259
+ return 'explore'
260
+ return 'other'
261
+
262
+
263
+ def profile_bins(trace):
264
+ """{bin: count} over the top-level calls of a parsed trace."""
265
+ out = dict.fromkeys(PROFILE_BINS, 0)
266
+ for name, inp, _ in trace['calls']:
267
+ if name in EXPLORE_TOOLS:
268
+ b = 'explore'
269
+ elif name in EDIT_TOOLS:
270
+ b = 'edit'
271
+ elif name == 'Bash':
272
+ b = _bash_bin((inp or {}).get('command') if isinstance(inp, dict) else '')
273
+ else:
274
+ b = 'other'
275
+ out[b] += 1
276
+ return out
277
+
278
+
279
+ def _profile(src):
280
+ """One line for the report. A stream that cannot be read says so (exit 3) — never counts of 0.
281
+ A stream with no result event or damaged lines keeps its counts and says they are a lower bound."""
282
+ tr = parse_stream(src)
283
+ if tr is None:
284
+ print('trace=UNREADABLE')
285
+ return 3
286
+ p = profile_bins(tr)
287
+ line = ' '.join('%s=%d' % (b, p[b]) for b in PROFILE_BINS) + ' total=%d' % sum(p.values())
288
+ flags = []
289
+ if tr['result'] is None:
290
+ flags.append('result=MISSING')
291
+ if tr['damaged']:
292
+ flags.append('damaged=%d' % tr['damaged'])
293
+ if flags:
294
+ line += ' ' + ' '.join(flags) + ' (counts are a lower bound)'
295
+ print(line)
296
+ return 0
297
+
298
+
107
299
  def _extract(src, dst_txt, dst_tools):
108
300
  tr = parse_stream(src)
109
301
  if tr is None or tr['result'] is None or tr['damaged']:
@@ -118,5 +310,7 @@ def _extract(src, dst_txt, dst_tools):
118
310
  if __name__ == '__main__':
119
311
  if len(sys.argv) == 5 and sys.argv[1] == 'extract':
120
312
  sys.exit(_extract(*sys.argv[2:5]))
313
+ if len(sys.argv) == 3 and sys.argv[1] == 'profile':
314
+ sys.exit(_profile(sys.argv[2]))
121
315
  print(__doc__, file=sys.stderr)
122
316
  sys.exit(2)
@@ -84,6 +84,24 @@ ACCEPTED_ABSENT=(
84
84
  # release by default. selfcheck resolves its row as SKIP («not in files[], and absent») on a consumer tree.
85
85
  "scripts/cartridge_admit.py"
86
86
  "scripts/test_cartridge_admit_lanes.sh"
87
+ # 2026-11-18 — core cartridge loader (SessionStart hook), its snippet, example list and lanes. The loader only loads
88
+ # snapshots that cartridge_admit.py admitted (the list carries its snapshot_sha256), and that checker is not
89
+ # shipped (above) — so ship all of them together when the operator decides to publish cartridges, or none.
90
+ # Shipping the snippet alone would make install-wizard register a hook for consumers who cannot admit anything.
91
+ "scripts/cartridge_loader.py"
92
+ "scripts/cartridge_loader.sh"
93
+ "scripts/test_cartridge_loader_lanes.sh"
94
+ "templates/settings.CartridgeLoader.snippet.json"
95
+ # 2026-11-19 — measurement scoreboard renderer and its lanes. It reads the operator's sealed measurement records across
96
+ # their own repositories; a consumer has none of those records, so it is not shipped. selfcheck resolves the anchor
97
+ # row as SKIP («not in files[], and absent»).
98
+ "scripts/scoreboard_render.py"
99
+ "scripts/test_scoreboard_render_lanes.sh"
100
+ # 2026-11-19 — FH-side check that the published fh-techwriter copy of ko-tech-writer still matches FH's export,
101
+ # and its lanes. A maintainer tool for this repository's own export, not a consumer capability: a consumer has
102
+ # no fh-techwriter copy to compare. selfcheck resolves its anchor row as SKIP («not in files[], and absent»).
103
+ "scripts/fh_techwriter_sync_check.sh"
104
+ "scripts/test_fh_techwriter_sync_lanes.sh"
87
105
  # 🟥 2026-09-21 (야간) — 정책렌즈 채점기와 그 레인. **FH 자기 연구의 실험 기록**이지 소비자
88
106
  # 능력이 아니다: 판정 대상이 `scripts/fixtures/policy_lens_knownpair_2026-09-21/` 안의
89
107
  # 1차 런 48개 파일(236K)이고, 그것까지 실어 보내면 아무도 안 쓰는 실험 아카이브가 패키지