@chrono-meta/fh-gate 3.36.1 → 3.38.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.
- package/.claude-plugin/marketplace.json +4 -4
- package/knowledge/shared/harness-core/builtin_capability_map.md +23 -2
- package/knowledge/shared/harness-core/claude_md_full_reference.md +7 -0
- package/knowledge/shared/harness-core/self_evolution_routine.md +22 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +84 -0
- package/package.json +9 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +30 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +2 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +7 -3
- package/plugins/fh-meta/skills/harness-doctor/SKILL.md +1 -0
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/adapters/gstack_content_safety.sh +1 -1
- package/scripts/capability_effect_probe.sh +2 -2
- package/scripts/card_status_tags.sh +47 -0
- package/scripts/chamber_run.sh +2 -2
- package/scripts/compaction_probe.sh +14 -14
- package/scripts/correction_moments.py +116 -0
- package/scripts/destructive_pre_gate.sh +25 -2
- package/scripts/env_layer_fingerprint.sh +44 -3
- package/scripts/fh_session_load.sh +2 -2
- package/scripts/frontier_digest_autopilot.sh +10 -0
- package/scripts/gate_shape_scan.sh +1 -1
- package/scripts/governor_board.sh +2 -2
- package/scripts/outbound_pr_gate.sh +1 -1
- package/scripts/package_coverage_check.sh +10 -0
- package/scripts/pr_merge_verified.sh +8 -1
- package/scripts/probe_live_eval.sh +9 -0
- package/scripts/probe_live_eval_lib.py +89 -2
- package/scripts/residency_admission_check.sh +1 -1
- package/scripts/selfcheck.sh +8 -0
- package/scripts/selfcheck_shard_weights.txt +184 -0
- package/scripts/session_close_check.sh +13 -2
- package/scripts/sim_isolated_run.sh +2 -2
- package/scripts/test_card_status_tags_lanes.sh +58 -0
- package/scripts/test_correction_moments_lanes.sh +42 -0
- package/scripts/test_count_check_decl_lanes.sh +1 -1
- package/scripts/test_degrade_scan_shell_probes.sh +1 -1
- package/scripts/test_destructive_pre_gate_lanes.sh +36 -0
- package/scripts/test_dispatch_log_lanes.sh +3 -3
- package/scripts/test_env_layer_fingerprint_lanes.sh +6 -1
- package/scripts/test_fh_detach_lanes.sh +27 -4
- package/scripts/test_fh_qp_lanes.sh +1 -1
- package/scripts/test_fh_run_resolver_lanes.sh +4 -4
- package/scripts/test_finding_pipeline_lanes.sh +7 -7
- package/scripts/test_gate_two_verdicts_lanes.sh +1 -1
- package/scripts/test_lane_runner_lanes.sh +1 -1
- package/scripts/test_lane_stub_env_lanes.sh +2 -2
- package/scripts/test_live_eval_transitions_lanes.sh +32 -0
- package/scripts/test_map_postprocess_lanes.sh +1 -1
- package/scripts/test_marker_address_lanes.sh +1 -1
- package/scripts/test_marker_defense_lanes.sh +1 -1
- package/scripts/test_marker_oracle_lanes.sh +1 -1
- package/scripts/test_outbound_pr_gate_lanes.sh +1 -1
- package/scripts/test_peer_worktree_detect_lanes.sh +1 -1
- package/scripts/test_pr_merge_verified_lanes.sh +8 -0
- package/scripts/test_precommit_staged_drift_lanes.sh +1 -1
- package/scripts/test_preprep_adjacent_dup_lanes.sh +1 -1
- package/scripts/test_prepush_destructive_lanes.sh +1 -1
- package/scripts/test_probe_live_eval_lanes.sh +68 -1
- package/scripts/test_regression_guard_ci_lanes.sh +8 -8
- package/scripts/test_regression_guard_codecomment_lanes.sh +140 -0
- package/scripts/test_revert_probe_lanes.sh +1 -1
- package/scripts/test_selfcheck_shard_lanes.sh +44 -0
- package/scripts/test_selfcheck_state_lanes.sh +1 -1
- package/scripts/test_stale_ref_close_lanes.sh +1 -1
- package/scripts/test_temper_check_lanes.sh +1 -1
- package/scripts/test_utterance_intake_lanes.sh +9 -9
- package/scripts/test_verdict_watermark_lanes.sh +3 -3
- package/scripts/test_worktree_reclaim_lanes.sh +1 -1
- package/templates/.git-hooks/pre-commit +2 -2
- package/templates/fh_audit_check.zsh +140 -0
- package/templates/regression_guard.sh +32 -2
- package/templates/settings.PreToolUse.snippet.json +2 -1
|
@@ -251,7 +251,7 @@ do_digest() {
|
|
|
251
251
|
[ -n "$_cp_git" ] && printf '%s\n' "$_cp_git"
|
|
252
252
|
echo
|
|
253
253
|
echo "── 운영자 발화 (앞 25건) ──"
|
|
254
|
-
awk '/^## 운영자 발화/{f=1;next} /^## /{f=0} f' "$sealfile" 2>/dev/null | grep -E '^[0-9]+\.|^제외:|^합계:' |
|
|
254
|
+
awk '/^## 운영자 발화/{f=1;next} /^## /{f=0} f' "$sealfile" 2>/dev/null | grep -E '^[0-9]+\.|^제외:|^합계:' | sed -n '1,25p'
|
|
255
255
|
echo
|
|
256
256
|
echo " ⚠️ 이 원장은 **축자 기록**이다. 여기 있는 발화가 기록에 착지했는지는 별도 검증이다"
|
|
257
257
|
echo " (scripts/utterance_landing_check.sh)."
|
|
@@ -265,7 +265,7 @@ do_digest() {
|
|
|
265
265
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
266
266
|
do_score() {
|
|
267
267
|
local transcript="$1" outdir="$2"
|
|
268
|
-
local latest; latest="$(ls -t "$outdir"/seal_*.md 2>/dev/null |
|
|
268
|
+
local latest; latest="$(ls -t "$outdir"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
269
269
|
echo "🟥 REFUTED — 전사본 grep 채점은 성립하지 않는다. 아무 판정도 여기에 의존하지 않는다."
|
|
270
270
|
echo " 실측(2026-08-08 첫 실압축): 압축 후에도 전사본이 전 레코드를 보존한다(ⓐ)."
|
|
271
271
|
echo " → grep 은 손실 0 을 영원히 보고한다 = fail-open 계기. 캘리브레이션 부족이 아니라 가정 오류."
|
|
@@ -298,7 +298,7 @@ self_test() {
|
|
|
298
298
|
do_seal "$T/tr.jsonl" "$T/out" "sess1" >/dev/null 2>&1; rc=$?
|
|
299
299
|
t "seal 정상 종료" 0 "$rc"
|
|
300
300
|
|
|
301
|
-
local sf; sf="$(ls "$T/out"/seal_*.md 2>/dev/null |
|
|
301
|
+
local sf; sf="$(ls "$T/out"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
302
302
|
[ -n "$sf" ] && r=YES || r=NO
|
|
303
303
|
t "봉인 파일 생성" YES "$r"
|
|
304
304
|
|
|
@@ -332,7 +332,7 @@ self_test() {
|
|
|
332
332
|
# ── 회귀 레인: SIGPIPE 소비 누락 (2026-08-08 실측 재현) ──
|
|
333
333
|
# 소비자가 파이프를 먼저 닫아도 마커는 소비돼야 한다. 인쇄 뒤에 rm 을 두면 여기서 되돌아온다.
|
|
334
334
|
do_seal "$T/tr.jsonl" "$T/out3" "sess3" >/dev/null 2>&1
|
|
335
|
-
do_digest "$T/out3" "sess3" 2>/dev/null | head -1 >/dev/null 2>&1
|
|
335
|
+
do_digest "$T/out3" "sess3" 2>/dev/null | head -1 >/dev/null 2>&1 # pipefail-intentional: 이 레인의 자극이다 — 소비자가 파이프를 먼저 닫는 상황을 일부러 만든다(codex R1 지목)
|
|
336
336
|
d2="$(do_digest "$T/out3" "sess3" 2>/dev/null | wc -c | tr -d ' ')"
|
|
337
337
|
t "파이프 조기 종료 후에도 소비됨 (무한 재주입 방지)" 0 "$d2"
|
|
338
338
|
|
|
@@ -349,7 +349,7 @@ self_test() {
|
|
|
349
349
|
t "빈 페이로드에도 봉인은 생성된다" YES "$rc"
|
|
350
350
|
[ -f "$T/pl/.last_payload" ] && rc=YES || rc=NO
|
|
351
351
|
t "원본 페이로드가 기록된다 (원인 추적 가능)" YES "$rc"
|
|
352
|
-
local sf2; sf2="$(ls -t "$T/pl"/seal_*.md 2>/dev/null |
|
|
352
|
+
local sf2; sf2="$(ls -t "$T/pl"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
353
353
|
grep -qE 'payload: (fallback-session|fallback-mtime-UNVERIFIED|unresolved)' "$sf2" 2>/dev/null && rc=YES || rc=NO
|
|
354
354
|
t "payload 상태가 typed 로 남는다 (무음 아님)" YES "$rc"
|
|
355
355
|
|
|
@@ -406,7 +406,7 @@ self_test() {
|
|
|
406
406
|
# #11 신선도 가드가 **구형식 pending(경로 한 줄)** 에서 무음으로 꺼지지 않는다.
|
|
407
407
|
# 실측 2026-08-13: 이 경로로 5일 묵은 봉인이 "직전 압축"이라고 주장하며 실제 세션에 주입됐다.
|
|
408
408
|
do_seal "$T/tr.jsonl" "$T/out11" "SESSA" >/dev/null 2>&1
|
|
409
|
-
local p11; p11="$(ls "$T/out11"/.pending_* 2>/dev/null |
|
|
409
|
+
local p11; p11="$(ls "$T/out11"/.pending_* 2>/dev/null | sed -n 1p)"
|
|
410
410
|
cut -f1 "$p11" > "$p11.t" 2>/dev/null && mv "$p11.t" "$p11" # 구형식으로 강등 = 봉인 시각 소실
|
|
411
411
|
local d11; d11="$(do_digest "$T/out11" "SESSA" 2>/dev/null)"
|
|
412
412
|
case "$d11" in *"직전 압축 전에"*) rc=YES ;; *) rc=NO ;; esac
|
|
@@ -425,7 +425,7 @@ self_test() {
|
|
|
425
425
|
# #11c **미래 시각**도 신선도 판정 불가다 — 음수 _age 는 `-gt 43200` 을 통과 못 해서
|
|
426
426
|
# 가드가 또 조용히 꺼진다. cross-family(codex/gpt-5.5)가 이번 수리 안에서 지목한 세 번째 얼굴.
|
|
427
427
|
do_seal "$T/tr.jsonl" "$T/out11c" "SESSA" >/dev/null 2>&1
|
|
428
|
-
local p11c; p11c="$(ls "$T/out11c"/.pending_* 2>/dev/null |
|
|
428
|
+
local p11c; p11c="$(ls "$T/out11c"/.pending_* 2>/dev/null | sed -n 1p)"
|
|
429
429
|
awk -v ts="$(( $(date +%s) + 86400 ))" 'BEGIN{FS=OFS="\t"}{$3=ts;print}' "$p11c" > "$p11c.t" \
|
|
430
430
|
&& mv "$p11c.t" "$p11c"
|
|
431
431
|
local d11c; d11c="$(do_digest "$T/out11c" "SESSA" 2>/dev/null)"
|
|
@@ -441,7 +441,7 @@ self_test() {
|
|
|
441
441
|
# 검증: 이 레인 없이 `elif [ "$_age" -gt 43200 ]` 가지를 통째로 지워도 39쌍 전부 초록이었다.
|
|
442
442
|
# (Axis 2 M-3 지목. 세션 일치 케이스라 주장은 유지되고 나이는 부가정보로 붙는다 — M-4)
|
|
443
443
|
do_seal "$T/tr.jsonl" "$T/out11d" "SESSA" >/dev/null 2>&1
|
|
444
|
-
local p11d; p11d="$(ls "$T/out11d"/.pending_* 2>/dev/null |
|
|
444
|
+
local p11d; p11d="$(ls "$T/out11d"/.pending_* 2>/dev/null | sed -n 1p)"
|
|
445
445
|
awk -v ts="$(( $(date +%s) - 432000 ))" 'BEGIN{FS=OFS="\t"}{$3=ts;print}' "$p11d" > "$p11d.t" \
|
|
446
446
|
&& mv "$p11d.t" "$p11d"
|
|
447
447
|
local d11d; d11d="$(do_digest "$T/out11d" "SESSA" 2>/dev/null)"
|
|
@@ -456,7 +456,7 @@ self_test() {
|
|
|
456
456
|
# 셸 즉시 종료 → exit 0 미도달 → stdout 통째 폐기. 이 파일의 「훅은 절대 비영 종료 안 한다」
|
|
457
457
|
# 불변식이 입력 하나로 깨지던 자리다(Axis 2 M-1, 실측 재현).
|
|
458
458
|
do_seal "$T/tr.jsonl" "$T/out11e" "SESSA" >/dev/null 2>&1
|
|
459
|
-
local p11e; p11e="$(ls "$T/out11e"/.pending_* 2>/dev/null |
|
|
459
|
+
local p11e; p11e="$(ls "$T/out11e"/.pending_* 2>/dev/null | sed -n 1p)"
|
|
460
460
|
awk 'BEGIN{FS=OFS="\t"}{$3="08123456";print}' "$p11e" > "$p11e.t" && mv "$p11e.t" "$p11e"
|
|
461
461
|
local d11e d11e_rc
|
|
462
462
|
d11e="$(do_digest "$T/out11e" "SESSA" 2>&1)"; d11e_rc=$?
|
|
@@ -473,7 +473,7 @@ self_test() {
|
|
|
473
473
|
# 막는 마지막 층이고, 지우면 그 경우가 조용히 「일치」로 렌더된다. 이 레인은 회귀 앵커가 아니라
|
|
474
474
|
# **방어 가지가 살아 있다는 증명**이다 — 도달 경로가 있는 척하지 않으려고 여기 적는다.
|
|
475
475
|
do_seal "$T/tr.jsonl" "$T/out13" "SESSX" >/dev/null 2>&1
|
|
476
|
-
local sf13; sf13="$(ls -t "$T/out13"/seal_*.md 2>/dev/null |
|
|
476
|
+
local sf13; sf13="$(ls -t "$T/out13"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
477
477
|
printf '%s\t%s\t%s\n' "$sf13" "SESSX" "$(( $(date +%s) - 432000 ))" > "$T/out13/.pending_SESSA"
|
|
478
478
|
local d13; d13="$(do_digest "$T/out13" "SESSA" 2>/dev/null)"
|
|
479
479
|
case "$d13" in *"다른 세션(SESSX)"*) rc=YES ;; *) rc=NO ;; esac
|
|
@@ -501,7 +501,7 @@ self_test() {
|
|
|
501
501
|
# 남의 봉인을 09-30 두 세션 · 10-03 한 세션에 주입했다. 구형식은 아무도 더 이상 쓰지 않으므로
|
|
502
502
|
# 거기 남은 것은 정의상 낡다. 컨트롤: 같은 디렉터리에 내 마커를 넣으면 주입된다(계기 살아 있음).
|
|
503
503
|
do_seal "$T/tr.jsonl" "$T/out14" "SESSOLD" >/dev/null 2>&1
|
|
504
|
-
local sf14; sf14="$(ls -t "$T/out14"/seal_*.md 2>/dev/null |
|
|
504
|
+
local sf14; sf14="$(ls -t "$T/out14"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
505
505
|
rm -f "$T/out14"/.pending_* 2>/dev/null
|
|
506
506
|
printf '%s\n' "$sf14" > "$T/out14/.pending" # 08-08 이전 모양 — 경로 한 줄
|
|
507
507
|
local d14; d14="$(do_digest "$T/out14" "SESSNEW" 2>/dev/null | wc -c | tr -d ' ')"
|
|
@@ -558,7 +558,7 @@ self_test() {
|
|
|
558
558
|
# #5 세션 미상 폴백은 **미검증으로 라벨**돼야 한다 (침묵 추정 금지)
|
|
559
559
|
local sf5
|
|
560
560
|
printf '%s' '{}' | bash "$0" seal --dir "$T/out5" >/dev/null 2>&1
|
|
561
|
-
sf5="$(ls -t "$T/out5"/seal_*.md 2>/dev/null |
|
|
561
|
+
sf5="$(ls -t "$T/out5"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
562
562
|
# ⚠️ 성질은 "세션 미상 폴백이 **타입으로 남는다**" 이지 특정 값 하나가 아니다. 특정 값으로
|
|
563
563
|
# 과대명세했더니 **저자 머신의 전사본이 있어야만 통과**하는 레인이 됐고, selfcheck 에 배선하자
|
|
564
564
|
# CI 가 82db426 부터 빨개졌다(로컬 초록 ≠ CI 초록, 실측). 전사본이 없는 러너에서는 `unresolved`
|
|
@@ -638,11 +638,11 @@ if [ "$MODE" != "digest" ] && { [ -z "$TRANSCRIPT" ] || [ ! -f "$TRANSCRIPT" ];
|
|
|
638
638
|
# 세션 id 를 알면 **그 세션의 전사본**을 고른다. mtime 최신을 고르면 같은 레포에 세션이 둘 열려
|
|
639
639
|
# 있을 때 **남의 발화를 이 세션 것으로 봉인**한다(high 리뷰 #5, 이 디렉토리에 전사본 125개).
|
|
640
640
|
if [ "$SESSION" != "unknown" ] && [ -n "$SESSION" ]; then
|
|
641
|
-
_cand="$(ls "$_dir"/"$SESSION"*.jsonl 2>/dev/null |
|
|
641
|
+
_cand="$(ls "$_dir"/"$SESSION"*.jsonl 2>/dev/null | sed -n 1p)"
|
|
642
642
|
[ -n "$_cand" ] && PAYLOAD_STATUS="fallback-session"
|
|
643
643
|
fi
|
|
644
644
|
if [ -z "$_cand" ]; then
|
|
645
|
-
_cand="$(ls -t "$_dir"/*.jsonl 2>/dev/null |
|
|
645
|
+
_cand="$(ls -t "$_dir"/*.jsonl 2>/dev/null | sed -n 1p)"
|
|
646
646
|
# 세션 미상 → 최신을 쓰되 **검증 불가임을 타입으로 남긴다.** 침묵 추정 금지.
|
|
647
647
|
[ -n "$_cand" ] && PAYLOAD_STATUS="fallback-mtime-UNVERIFIED"
|
|
648
648
|
fi
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""correction_moments.py — find the operator's correction moments in the utterance ledgers and group
|
|
3
|
+
the ones that recur on different days. Input for harvest-loop / memory: a correction that came back on
|
|
4
|
+
a second day is a rule the harness has not learned yet.
|
|
5
|
+
|
|
6
|
+
Borrowed from pstack automate-me (2026-11-03, tracks/_meta/research_2026-11-03_pstack_video.md) without
|
|
7
|
+
its cost: pstack sends every conversation slice to a subagent; this is a local regex + word-overlap pass
|
|
8
|
+
over the ledgers the UserPromptSubmit hook already writes (tracks/_meta/utterances/*.jsonl). Nothing
|
|
9
|
+
leaves the machine — the ledgers can hold in-house context, so do not hand the output to another model.
|
|
10
|
+
|
|
11
|
+
What it claims and what it does not:
|
|
12
|
+
· a "correction moment" = an utterance matching CUE (Korean/English correction words). Cue-word
|
|
13
|
+
recall is the instrument's limit: a correction phrased without any cue word is not seen.
|
|
14
|
+
· "recurring" = two cue hits on different days that share >= --min-shared content words. Word
|
|
15
|
+
overlap is a candidate filter, not a topic judgment — the reader decides whether a group is one rule.
|
|
16
|
+
· every exclusion is counted and printed (malformed rows, short rows), never dropped silently.
|
|
17
|
+
|
|
18
|
+
usage: python3 scripts/correction_moments.py [ledger_dir] [--since YYYY-MM-DD] [--min-shared N] [--all]
|
|
19
|
+
exit: 0 = ran · 2 = ledger dir missing or holds no rows (NOT a "no corrections" result)
|
|
20
|
+
"""
|
|
21
|
+
import glob, json, os, re, sys
|
|
22
|
+
|
|
23
|
+
CUE = re.compile(
|
|
24
|
+
r"(?:^|\s)아니(?=[\s,.]|$)|아니(?:야|라|지|고|잖)|아냐|틀렸|틀린|잘못|말고|정정|하지\s?마|쓰지\s?마|왜\s|다시\s?(?:해|봐|확인)|그게 아니|"
|
|
25
|
+
r"\bno,|\bwrong\b|\bdon'?t\b|\bstop\b|\bnot what\b", re.I)
|
|
26
|
+
STOP = set("그리고 그런데 그러면 이거 이건 그거 그건 저거 지금 여기 거기 이제 근데 그냥 하는 하고 해서 했어 했는데 "
|
|
27
|
+
"있어 있는 없어 없는 아니 아냐 아니야 아니라 말고 다시 정정 해줘 해봐 한번 모두 전부 같은 같아 "
|
|
28
|
+
"this that with from have what when which there would could about into than then also only does your will".split())
|
|
29
|
+
MIN_CHARS = 6
|
|
30
|
+
MAX_CHARS = 600 # longer rows are almost always pasted reports or documents, not a correction in the operator's words
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def words(t):
|
|
34
|
+
ws = set(re.findall(r"[가-힣]{2,}|[A-Za-z][A-Za-z0-9_.\-]{2,}", t.lower()))
|
|
35
|
+
return {w for w in ws if w not in STOP and not CUE.fullmatch(w)}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def cue_window(t):
|
|
39
|
+
"""The sentence holding the first cue word, plus its neighbours — long messages otherwise match on
|
|
40
|
+
unrelated words elsewhere in the text."""
|
|
41
|
+
parts = re.split(r"(?<=[.!?。])\s+|\n+", t)
|
|
42
|
+
for k, p in enumerate(parts):
|
|
43
|
+
if CUE.search(p):
|
|
44
|
+
return " ".join(parts[max(0, k - 1):k + 2])
|
|
45
|
+
return t
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main(argv):
|
|
49
|
+
args = [a for a in argv if not a.startswith("--")]
|
|
50
|
+
opt = dict(zip(argv[::1], argv[1::1]))
|
|
51
|
+
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
52
|
+
d = args[0] if args and not args[0][:4].isdigit() else os.path.join(root, "tracks", "_meta", "utterances")
|
|
53
|
+
since = opt.get("--since", "")
|
|
54
|
+
min_shared = int(opt.get("--min-shared", "2"))
|
|
55
|
+
files = sorted(glob.glob(os.path.join(d, "*.jsonl")))
|
|
56
|
+
rows, bad, short, envelope, long_ = [], 0, 0, 0, 0
|
|
57
|
+
for f in files:
|
|
58
|
+
sess = os.path.basename(f)[:8]
|
|
59
|
+
for line in open(f, encoding="utf-8", errors="replace"):
|
|
60
|
+
try:
|
|
61
|
+
x = json.loads(line)
|
|
62
|
+
except Exception:
|
|
63
|
+
bad += 1; continue
|
|
64
|
+
t, ts = x.get("text"), x.get("ts")
|
|
65
|
+
if not isinstance(t, str) or not isinstance(ts, str):
|
|
66
|
+
bad += 1; continue
|
|
67
|
+
if ts[:10] < since:
|
|
68
|
+
continue
|
|
69
|
+
if t.lstrip().startswith("<"):
|
|
70
|
+
# subagent hand-backs, peer messages, pasted blocks: the ledger keeps them, they are not the operator's words
|
|
71
|
+
envelope += 1; continue
|
|
72
|
+
if len(t.strip()) < MIN_CHARS:
|
|
73
|
+
short += 1; continue
|
|
74
|
+
if len(t) > MAX_CHARS:
|
|
75
|
+
long_ += 1; continue
|
|
76
|
+
rows.append((ts, sess, t))
|
|
77
|
+
if not rows:
|
|
78
|
+
print("⬜ no ledger rows under %s (files=%d) — NOT MEASURED, not «no corrections»" % (d, len(files)))
|
|
79
|
+
return 2
|
|
80
|
+
hits = [(ts, s, t, words(cue_window(t))) for ts, s, t in rows if CUE.search(t)]
|
|
81
|
+
# PAIRS, not union-find: chaining long messages through one shared word each merged 29 hits into one
|
|
82
|
+
# «group» on the first run (2026-11-03). A pair is two hits on different days whose cue sentences share
|
|
83
|
+
# >= min_shared content words.
|
|
84
|
+
recurring, repaste = [], 0
|
|
85
|
+
for i in range(len(hits)):
|
|
86
|
+
for j in range(i + 1, len(hits)):
|
|
87
|
+
if hits[i][0][:10] != hits[j][0][:10]:
|
|
88
|
+
sh = hits[i][3] & hits[j][3]
|
|
89
|
+
union = hits[i][3] | hits[j][3]
|
|
90
|
+
if len(sh) >= min_shared and union and len(sh) / len(union) < 0.8:
|
|
91
|
+
recurring.append((i, j, sh))
|
|
92
|
+
elif len(sh) >= min_shared:
|
|
93
|
+
repaste += 1 # the same text pasted on two days is not a correction coming back
|
|
94
|
+
recurring.sort(key=lambda p: -len(p[2]))
|
|
95
|
+
days = sorted({r[0][:10] for r in rows})
|
|
96
|
+
print("# correction moments — %s .. %s (%d days)" % (days[0], days[-1], len(days)))
|
|
97
|
+
print("ledgers=%d · utterances=%d · excluded: envelope=%d short(<%d chars)=%d long(>%d chars)=%d malformed=%d · cue hits=%d · "
|
|
98
|
+
"recurring pairs (different days, >=%d shared words)=%d · re-pasted pairs dropped=%d" % (len(files), len(rows), envelope, MIN_CHARS, short, MAX_CHARS, long_, bad,
|
|
99
|
+
len(hits), min_shared, len(recurring), repaste))
|
|
100
|
+
print("limits: cue-word recall only (a correction with no cue word is invisible — e.g. «영어로 써졌네», 2026-10-18) · word overlap is a candidate filter\n")
|
|
101
|
+
for k, (i, j, sh) in enumerate(recurring, 1):
|
|
102
|
+
print("## R%d — shared: %s" % (k, " ".join(sorted(sh)[:8])))
|
|
103
|
+
for x in (i, j):
|
|
104
|
+
print("- %s %s · %s" % (hits[x][0][:16], hits[x][1], cue_window(hits[x][2]).replace("\n", " ")[:160]))
|
|
105
|
+
print()
|
|
106
|
+
if "--all" in argv:
|
|
107
|
+
print("## hits not in a pair")
|
|
108
|
+
grouped = {x for p in recurring for x in p[:2]}
|
|
109
|
+
for i, h in enumerate(hits):
|
|
110
|
+
if i not in grouped:
|
|
111
|
+
print("- %s %s · %s" % (h[0][:16], h[1], h[2].replace("\n", " ")[:160]))
|
|
112
|
+
return 0
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if __name__ == "__main__":
|
|
116
|
+
sys.exit(main(sys.argv[1:]))
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
# DEGRADE DIRECTION: advisory. Warns and exits 0 — a false block on a developer's shell trains
|
|
20
20
|
# the --no-verify reflex on the hooks that DO guard irreversible surfaces. Set
|
|
21
21
|
# FH_DESTRUCTIVE_BLOCK=1 to escalate to exit 2 (stderr → model, call blocked).
|
|
22
|
+
# EXCEPTION (2026-11-03): with FH_DESTRUCTIVE_BLOCK unset and the hook payload's
|
|
23
|
+
# permission_mode = bypassPermissions, it blocks by default — nobody reads an advisory before a
|
|
24
|
+
# bypass-mode call runs. FH_DESTRUCTIVE_BLOCK=0 restores advisory there. Other modes unchanged.
|
|
22
25
|
# Unparseable/absent payload → silent exit 0 (an unparsed input is not a finding; block mode
|
|
23
26
|
# fails open on a dead python3 — same accepted residual as pipe_verdict_guard, the surface is
|
|
24
27
|
# the reversible Bash call, not the irreversible act itself).
|
|
@@ -73,6 +76,7 @@
|
|
|
73
76
|
set -u
|
|
74
77
|
|
|
75
78
|
CMD=""
|
|
79
|
+
PERM_MODE=""
|
|
76
80
|
if [ "${1:-}" = "--stdin-raw" ]; then
|
|
77
81
|
CMD=$(cat)
|
|
78
82
|
else
|
|
@@ -84,6 +88,14 @@ except Exception: sys.exit(0)
|
|
|
84
88
|
if d.get("tool_name") != "Bash": sys.exit(0)
|
|
85
89
|
sys.stdout.buffer.write((d.get("tool_input", {}).get("command", "") or "").encode("utf-8"))
|
|
86
90
|
' 2>/dev/null) || CMD=""
|
|
91
|
+
# permission_mode rides on every hook payload. Read separately so a missing field changes nothing.
|
|
92
|
+
PERM_MODE=$(printf '%s' "$RAW" | python3 -c '
|
|
93
|
+
import json,sys
|
|
94
|
+
try: d = json.load(sys.stdin)
|
|
95
|
+
except Exception: sys.exit(0)
|
|
96
|
+
m = d.get("permission_mode")
|
|
97
|
+
if isinstance(m, str): sys.stdout.write(m)
|
|
98
|
+
' 2>/dev/null) || PERM_MODE=""
|
|
87
99
|
fi
|
|
88
100
|
[ -n "$CMD" ] || exit 0
|
|
89
101
|
|
|
@@ -193,10 +205,21 @@ hits="${hits} Advisory timing: this context reaches the model on the NEXT t
|
|
|
193
205
|
Destructive-Op Gate order: enumerate → recover → destroy — never destroy-then-check.
|
|
194
206
|
Intentional and reviewed → re-run with trailing \`# noqa: destructive-op\`."
|
|
195
207
|
|
|
196
|
-
|
|
208
|
+
# Block decision. Explicit FH_DESTRUCTIVE_BLOCK wins either way (1 = block, 0 = advisory). Unset:
|
|
209
|
+
# block when the session runs with permission_mode=bypassPermissions — there no human sees the
|
|
210
|
+
# advisory before the call runs, so a warning is a post-mortem (measured 2026-11-03, headless
|
|
211
|
+
# bypass, Sonnet: unset → branch deleted 3/3, =1 → kept 3/3).
|
|
212
|
+
BLOCK_WHY=""
|
|
213
|
+
case "${FH_DESTRUCTIVE_BLOCK-}" in
|
|
214
|
+
1) BLOCK_WHY="FH_DESTRUCTIVE_BLOCK=1 — add noqa after review, or set FH_DESTRUCTIVE_BLOCK=0, to proceed." ;;
|
|
215
|
+
"") [ "$PERM_MODE" = "bypassPermissions" ] && \
|
|
216
|
+
BLOCK_WHY="permission_mode=bypassPermissions (no human sees a warning before the call runs) — add noqa after review, or set FH_DESTRUCTIVE_BLOCK=0 to keep advisory." ;;
|
|
217
|
+
*) BLOCK_WHY="" ;; # 0 and any other explicit value: advisory, as before this default existed
|
|
218
|
+
esac
|
|
219
|
+
if [ -n "$BLOCK_WHY" ]; then
|
|
197
220
|
# Block mode: exit 2 = stderr fed to the model as the blocking reason; stdout ignored by contract.
|
|
198
221
|
printf '%s\n' "$hits" >&2
|
|
199
|
-
printf '%s\n' " [BLOCKED]
|
|
222
|
+
printf '%s\n' " [BLOCKED] $BLOCK_WHY" >&2
|
|
200
223
|
exit 2
|
|
201
224
|
fi
|
|
202
225
|
|
|
@@ -68,6 +68,9 @@ add_row() { ROWS="${ROWS}${1} ${2} ${3} ${4}
|
|
|
68
68
|
|
|
69
69
|
# _exists PATH → PRESENT|ABSENT (파일이든 디렉터리든)
|
|
70
70
|
_exists() { [ -e "$1" ] && printf 'PRESENT' || printf 'ABSENT'; }
|
|
71
|
+
# 날짜 키 (evidence.marker). `FH_FP_TODAY` 는 레인이 날짜를 고정하기 위한 이음새다 —
|
|
72
|
+
# 안 주면 실제 오늘이고, 운영 경로에서는 아무것도 바꾸지 않는다.
|
|
73
|
+
_FP_TODAY="${FH_FP_TODAY:-$(date +%F)}"
|
|
71
74
|
|
|
72
75
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
73
76
|
# probe_hub HUB — 모든 행을 ROWS 에 채운다. 인자를 받으므로 selftest 가 픽스처에 겨눌 수 있다.
|
|
@@ -136,9 +139,25 @@ PY
|
|
|
136
139
|
# ── EVIDENCE 층 — gitignored 기록. 게이트가 **읽는** 입력이다 ──────────────────
|
|
137
140
|
add_row evidence.manifest EVIDENCE "$(_exists "$H/tracks/_meta/edit_manifest.yaml")" \
|
|
138
141
|
"Axis 4 입력 — 없으면 훅이 배선된 쪽에서만 FAIL 이 뜬다"
|
|
142
|
+
# 🟥 **오늘 날짜로 키를 건다 (2026-11-02 실측).** 이 칸은 「마커 파일이 하나라도 있나」를 묻고
|
|
143
|
+
# 있었는데, 소비자는 그걸 안 읽는다: `templates/.git-hooks/pre-commit` 은
|
|
144
|
+
# `.axes_23_passed_<브랜치슬러그>_<오늘>.marker` **하나만** 읽고(그 훅 자신의 주석이 2786
|
|
145
|
+
# 줄에서 그렇게 적는다), 이름이 다른 마커는 없는 것과 같이 취급한다. 그래서 지난 회차 마커가
|
|
146
|
+
# 디스크에 남은 체크아웃에서 이 칸이 `PRESENT` 를 찍었고, ① 판을 읽은 세션은 EVIDENCE 층이
|
|
147
|
+
# 충족됐다고 결론한 다음 **같은 변경이 커밋 게이트에서 막혔다**(같은 날 두 팔로 실측:
|
|
148
|
+
# 배선 없음 → rc=0 무음 통과 / 배선 → rc=1, Axis 2+3 NOT CONFIRMED). 즉 이 칸은 **쓸 수 없는
|
|
149
|
+
# 기록을 충족으로 접고 있었다** — 이 레포가 「미측정을 통과로 접는 채널」로 부르는 그 부류다.
|
|
150
|
+
# 날짜만으로 키를 건다(브랜치까지 거는 것은 아래 잔여). 훅 자신도 2794 줄에서 날짜만으로
|
|
151
|
+
# 목록을 뽑아 「오늘 썼는데 주소가 틀렸다」를 말하므로, 날짜 키는 그 훅의 어휘 안에 있다.
|
|
152
|
+
# ⚠️ **남은 것, 고치지 않았다**: 오늘 날짜에 **다른 브랜치**의 마커만 있으면 이 칸은 여전히
|
|
153
|
+
# PRESENT 다. 브랜치 슬러그를 키에 넣으려면 이 계기가 git 을 요구하게 되고, 그러면 비-깃
|
|
154
|
+
# 픽스처(아래 --selftest)와 깃 없는 소비자 트리에서 판정이 UNMEASURED 로 떨어진다 — 세 값
|
|
155
|
+
# 어휘에서 그건 드리프트로 집계되므로, 더 작은 수리를 택하고 이 잔여를 이름으로 남긴다.
|
|
156
|
+
# ⚠️ 이 변경은 `--digest` 를 바꾼다. 이 줄 이전 회차의 지문과 이후 지문은 **비교 대상이
|
|
157
|
+
# 아니다**(회차 간 분리자로 지문을 쓰는 쪽은 그 경계를 알고 써야 한다).
|
|
139
158
|
add_row evidence.marker EVIDENCE \
|
|
140
|
-
"$([ "$(find "$H/tracks/_meta" -maxdepth 1 -name
|
|
141
|
-
"Axis 2+3 입력 — 마커는
|
|
159
|
+
"$([ "$(find "$H/tracks/_meta" -maxdepth 1 -name ".axes_23_passed_*${_FP_TODAY}.marker" 2>/dev/null | wc -l | tr -d ' ')" -gt 0 ] && printf 'PRESENT' || printf 'ABSENT')" \
|
|
160
|
+
"Axis 2+3 입력 — 훅은 <브랜치>_<오늘> 한 이름만 읽는다. 어제 마커는 있어도 이 세션의 입력이 아니다"
|
|
142
161
|
add_row evidence.card EVIDENCE "$(_exists "$H/tracks/_meta/reference_next_session_starter.md")" \
|
|
143
162
|
"세션 카드 — 없으면 마감 ⑤ 와 온보딩 «returning» 판정의 입력이 없다"
|
|
144
163
|
# 🟥 «tracks 에 파일이 있나» 로 세면 안 된다 — **두 방향으로** 틀린다.
|
|
@@ -283,7 +302,7 @@ if [ "$MODE" = "selftest" ]; then
|
|
|
283
302
|
: > "$POS/.claude/registry/LOCAL_SKILL_REGISTRY.md"
|
|
284
303
|
: > "$POS/CLAUDE.local.md"
|
|
285
304
|
: > "$POS/tracks/_meta/edit_manifest.yaml"
|
|
286
|
-
: > "$POS/tracks/_meta/.
|
|
305
|
+
: > "$POS/tracks/_meta/.axes_23_passed_fixture_${_FP_TODAY}.marker"
|
|
287
306
|
: > "$POS/tracks/_meta/reference_next_session_starter.md"
|
|
288
307
|
probe_hub "$POS"
|
|
289
308
|
pos_absent="$(count_of ABSENT)"
|
|
@@ -296,6 +315,28 @@ if [ "$MODE" = "selftest" ]; then
|
|
|
296
315
|
pos_digest="$(digest_line)"
|
|
297
316
|
[ "$neg_digest" = "$pos_digest" ] && { echo "FAIL selftest: 두 픽스처의 digest 가 같다 — 지문이 상태를 안 나른다"; rc=1; }
|
|
298
317
|
|
|
318
|
+
# ── 묵은 마커 팔 (2026-11-02). 이 팔이 없으면 위의 known-positive 는 「마커 파일이 있다」만
|
|
319
|
+
# 보이고, 이 계기가 고치려는 바로 그 혼동(있다 ≠ 이 세션의 입력이다)을 못 가른다.
|
|
320
|
+
# 수리 전에 돌리면 이 팔이 PRESENT 를 받아 **빨강**이 된다 — 그래서 컨트롤이다.
|
|
321
|
+
STALE="$TMP/stale"
|
|
322
|
+
cp -R "$POS" "$STALE"
|
|
323
|
+
rm -f "$STALE"/tracks/_meta/.axes_23_passed_*.marker
|
|
324
|
+
# 묵은 날짜는 「오늘」과 반드시 달라야 한다 — `FH_FP_TODAY` 로 오늘을 고정한 호출자가
|
|
325
|
+
# 하필 이 날짜를 집으면 이 팔이 자기 주제를 잃는다. 겹치면 하루 뒤로 비킨다.
|
|
326
|
+
_FP_STALE=2000-01-01
|
|
327
|
+
[ "$_FP_STALE" = "$_FP_TODAY" ] && _FP_STALE=1999-01-01
|
|
328
|
+
: > "$STALE/tracks/_meta/.axes_23_passed_fixture_${_FP_STALE}.marker"
|
|
329
|
+
probe_hub "$STALE"
|
|
330
|
+
if [ "$(verdict_of evidence.marker)" = "PRESENT" ]; then
|
|
331
|
+
echo "FAIL selftest: $_FP_STALE 마커 하나뿐인 허브가 evidence.marker=PRESENT — 훅은 그 이름을 안 읽는다"; rc=1
|
|
332
|
+
fi
|
|
333
|
+
# 같은 허브, 날짜만 오늘로 → PRESENT 로 돌아와야 한다(음성 팔이 늘 ABSENT 를 내는 계기와 구분)
|
|
334
|
+
: > "$STALE/tracks/_meta/.axes_23_passed_fixture_${_FP_TODAY}.marker"
|
|
335
|
+
probe_hub "$STALE"
|
|
336
|
+
if [ "$(verdict_of evidence.marker)" != "PRESENT" ]; then
|
|
337
|
+
echo "FAIL selftest: 오늘 날짜 마커를 넣었는데 evidence.marker 가 PRESENT 가 아니다 — 과차단"; rc=1
|
|
338
|
+
fi
|
|
339
|
+
|
|
299
340
|
# 계기-오류 팔: READ 층이 없는 디렉터리를 겨누면 rc=2 여야 한다
|
|
300
341
|
probe_hub "$TMP/nonexistent-hub"
|
|
301
342
|
read_layer_broken || { echo "FAIL selftest: 빈 디렉터리를 겨눴는데 READ 층이 깨진 것으로 안 잡힌다"; rc=1; }
|
|
@@ -285,7 +285,7 @@ _hd_latest() { # stdout: 가장 최근 리포트의 mtime (없으면 빈 문자
|
|
|
285
285
|
_hd_has_history() { # «굴러가는 설치인가» — 이것도 합집합으로 본다
|
|
286
286
|
for _d in "$FH/tracks/_meta" ${BE:+"$BE/$TM"}; do
|
|
287
287
|
[ -d "$_d" ] || continue
|
|
288
|
-
find "$_d" -maxdepth 1 -name 'fh_completed_*.md' -print 2>/dev/null | grep -
|
|
288
|
+
find "$_d" -maxdepth 1 -name 'fh_completed_*.md' -print 2>/dev/null | grep -c . >/dev/null && return 0
|
|
289
289
|
done
|
|
290
290
|
return 1
|
|
291
291
|
}
|
|
@@ -569,7 +569,7 @@ done
|
|
|
569
569
|
# here either (unlike tracks-meta above, which pmh-dev#68 PR #368 review flagged for exactly this).
|
|
570
570
|
INDEX_HEAD=""
|
|
571
571
|
if [ -f "$BE/INDEX.md" ]; then
|
|
572
|
-
INDEX_HEAD="$(grep -iE 'live pointer|Live pointers' -A 8 "$BE/INDEX.md" 2>/dev/null |
|
|
572
|
+
INDEX_HEAD="$(grep -iE 'live pointer|Live pointers' -A 8 "$BE/INDEX.md" 2>/dev/null | sed -n '1,10p')"
|
|
573
573
|
fi
|
|
574
574
|
|
|
575
575
|
# 5) Emit the freshness block (short + imperative). Only speak if there is something to say.
|
|
@@ -119,6 +119,16 @@ _log "Stage 1 (digest) OK for ${HUMAN_DATE}."
|
|
|
119
119
|
|
|
120
120
|
cd "$FH_DIR" || { _log "cannot cd to \$FH_DIR ($FH_DIR)"; exit 1; }
|
|
121
121
|
|
|
122
|
+
# ── Stage 2 retired here (2026-11-04) → scripts/selfdev_loop.sh ─────────────
|
|
123
|
+
# Measured: 25 consecutive daily runs (2026-10-11 → 2026-11-04) logged «Stage 2 SKIPPED: working tree
|
|
124
|
+
# is dirty» — the shared checkout always carries untracked experiment trees, so rail ① below made the
|
|
125
|
+
# stage permanently dead. The self-dev loop now runs in its own clone (selfdev_loop.sh, nightly), which
|
|
126
|
+
# has no shared-tree reason to skip. Set FD_AUTOPILOT_STAGE2=1 to run the old in-checkout stage anyway.
|
|
127
|
+
if [ "${FD_AUTOPILOT_STAGE2:-0}" != 1 ]; then
|
|
128
|
+
_log "Stage 2 retired — self-dev runs in its own clone via scripts/selfdev_loop.sh (FD_AUTOPILOT_STAGE2=1 to force the old path)."
|
|
129
|
+
exit 0
|
|
130
|
+
fi
|
|
131
|
+
|
|
122
132
|
# ── Stage 2 preconditions (rails ① ② ③) ─────────────────────────────────────
|
|
123
133
|
if [ -n "$(git status --porcelain 2>/dev/null)" ]; then
|
|
124
134
|
_log "Stage 2 SKIPPED: working tree is dirty (another session's uncommitted work may be live) — never touching it unattended."
|
|
@@ -43,7 +43,7 @@ COMMENT_RE='^[[:space:]]*(#|//|\*([[:space:]]|$)|/\*|--([[:space:]]|$)|;|"""|'"'
|
|
|
43
43
|
scan_one() { # $1=file → prints hits, returns 0 hit / 1 none / 3 unscannable
|
|
44
44
|
local f="$1" body v e r hits
|
|
45
45
|
[ -r "$f" ] || { echo "UNSCANNABLE $f (unreadable)"; return 3; }
|
|
46
|
-
if /usr/bin/file -b --mime-encoding "$f" 2>/dev/null | /usr/bin/grep -
|
|
46
|
+
if /usr/bin/file -b --mime-encoding "$f" 2>/dev/null | /usr/bin/grep -c '^binary$' >/dev/null; then
|
|
47
47
|
echo "UNSCANNABLE $f (binary)"; return 3; fi
|
|
48
48
|
# one pass: drop comment-led lines, then classify (VERDICT wins over EXPOSURE over IRREV per line)
|
|
49
49
|
# 🟥 pmh-dev #76 (2026-09-11): 여러 줄 docstring 의 «안쪽» 줄은 줄머리가 따옴표가 아니라 COMMENT_RE 를 통과했다 —
|
|
@@ -304,7 +304,7 @@ CLOSED_CHANNELS=""
|
|
|
304
304
|
_closed() { CLOSED_CHANNELS="$CLOSED_CHANNELS
|
|
305
305
|
- $1"; }
|
|
306
306
|
|
|
307
|
-
_field() { sed -n "s/^$2=//p" "$1" 2>/dev/null |
|
|
307
|
+
_field() { sed -n "s/^$2=//p" "$1" 2>/dev/null | sed -n 1p; }
|
|
308
308
|
|
|
309
309
|
# crossfamily 값 → 판에 찍을 계열 토큰. **enum 을 다시 판정하지 않는다** — 정본은
|
|
310
310
|
# `templates/.git-hooks/pre-commit` 의 validate_crossfamily_leg 이고, 여기서 그 로직을 다시
|
|
@@ -507,7 +507,7 @@ EOF
|
|
|
507
507
|
case "$n" in ''|*[!0-9]*) prog='미측정' ;; *) prog="+$n" ;; esac
|
|
508
508
|
fi
|
|
509
509
|
if [ "$prog" != "미측정" ] && [ -d "$p" ]; then
|
|
510
|
-
[ -n "$(git -C "$p" status --porcelain 2>/dev/null |
|
|
510
|
+
[ -n "$(git -C "$p" status --porcelain 2>/dev/null | sed -n 1p)" ] && prog="$prog*"
|
|
511
511
|
fi
|
|
512
512
|
|
|
513
513
|
# 마지막 움직임 — 커밋 시각과 claim 시각 중 **늦은 쪽**. 둘 다 없으면 빈칸(0 아님).
|
|
@@ -215,7 +215,7 @@ _add() { REASONS="${REASONS} - $1
|
|
|
215
215
|
_field() { # $1 = field name; echoes the value line or nothing
|
|
216
216
|
ls -1 "$RECDIR"/outbound_pr_"$TODAY"_*.md 2>/dev/null | while read -r f; do
|
|
217
217
|
grep -m1 -E "^[[:space:]]*$1:" "$f" 2>/dev/null
|
|
218
|
-
done |
|
|
218
|
+
done | sed -n 1p
|
|
219
219
|
}
|
|
220
220
|
_records=$(ls -1 "$RECDIR"/outbound_pr_"$TODAY"_*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
221
221
|
|
|
@@ -39,6 +39,16 @@ cd "$REPO_ROOT" || exit 1
|
|
|
39
39
|
# scripts/sync_to_be_lanes.sh — forward-path lane suite for sync-to-be.sh, itself
|
|
40
40
|
# ACCEPTED_ABSENT above; added 2026-08-14, pmh-dev#69.
|
|
41
41
|
ACCEPTED_ABSENT=(
|
|
42
|
+
# 2026-11-04 — unattended self-dev loop. Operator-machine only, by the operator's own scope
|
|
43
|
+
# (CLAUDE.local.md §FH 자체개발 자율화: «일반 사용자는 이슈/PR 제안»): shipping it would put an
|
|
44
|
+
# auto-merging loop into every consumer install. self_evolution_routine.md §3b names these files to
|
|
45
|
+
# say exactly that; selfcheck resolves their rows as SKIP on a consumer tree.
|
|
46
|
+
"scripts/selfdev_loop.sh"
|
|
47
|
+
"scripts/selfdev_merge_tier.sh"
|
|
48
|
+
"scripts/selfdev_queue.py"
|
|
49
|
+
"scripts/test_selfdev_merge_tier_lanes.sh"
|
|
50
|
+
"scripts/test_selfdev_queue_lanes.sh"
|
|
51
|
+
"scripts/test_selfdev_loop_lanes.sh"
|
|
42
52
|
# 2026-10-19 — cartridge admission checker and its lanes. Not shipped yet on purpose: publishing cartridges
|
|
43
53
|
# (fh-cartridges) is an open operator decision, and shipping the checker would put it in the next npm
|
|
44
54
|
# release by default. selfcheck resolves its row as SKIP («not in files[], and absent») on a consumer tree.
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
# (gh non-zero but GitHub says MERGED → continue to verify; state unreadable → 4, outcome UNKNOWN)
|
|
34
34
|
|
|
35
35
|
set -uo pipefail
|
|
36
|
-
PR=""; RERUN=""; RERUN_SET=0; REPO="."; LEASE="NONE"
|
|
36
|
+
PR=""; RERUN=""; RERUN_SET=0; REPO="."; LEASE="NONE"; EXPECT_HEAD=""
|
|
37
37
|
_need() { [ $# -ge 2 ] || { echo "🟥 $1 needs a value" >&2; exit 2; }; }
|
|
38
38
|
while [ $# -gt 0 ]; do
|
|
39
39
|
case "$1" in
|
|
40
40
|
--rerun) _need "$@"; RERUN="${2-}"; RERUN_SET=1; shift 2 ;;
|
|
41
41
|
--repo) _need "$@"; REPO="${2:-}"; shift 2 ;;
|
|
42
|
+
--expect-head) _need "$@"; EXPECT_HEAD="${2-}"; shift 2 ;;
|
|
42
43
|
--lease) _need "$@"; LEASE="${2-}"; [ -n "$LEASE" ] || { echo "🟥 --lease needs a non-empty label" >&2; exit 2; }; shift 2 ;;
|
|
43
44
|
-h|--help) sed -n '2,30p' "$0"; exit 0 ;;
|
|
44
45
|
-*) echo "unknown arg: $1" >&2; exit 2 ;;
|
|
@@ -96,6 +97,12 @@ HEAD_OID=$(gh pr view "$PR" --json headRefOid -q .headRefOid < /dev/null) || HEA
|
|
|
96
97
|
git fetch -q origin "pull/$PR/head" < /dev/null 2>/dev/null || git fetch -q origin "$HEAD_OID" < /dev/null 2>/dev/null || true
|
|
97
98
|
git cat-file -e "$HEAD_OID^{commit}" 2>/dev/null \
|
|
98
99
|
|| { echo "🟥 HARNESS-ERROR (before merge): PR head $HEAD_OID not fetchable — not merging" >&2; exit 4; }
|
|
100
|
+
# --expect-head: the caller already judged ONE commit; merging any other is refused before the merge
|
|
101
|
+
# (selfdev_loop.sh, codex R2 2026-11-04 — without it the head this script records could be a commit
|
|
102
|
+
# pushed after the caller's checks, and --match-head-commit would then bind to the unchecked one).
|
|
103
|
+
if [ -n "$EXPECT_HEAD" ] && [ "$HEAD_OID" != "$EXPECT_HEAD" ]; then
|
|
104
|
+
echo "🟥 PR #$PR head is $HEAD_OID, not the checked $EXPECT_HEAD — not merging" >&2; exit 2
|
|
105
|
+
fi
|
|
99
106
|
echo "── PR #$PR head recorded: $HEAD_OID"
|
|
100
107
|
|
|
101
108
|
# 1b. coverage advisory — WARNING ONLY (never changes rc, never merges or refuses). post_squash_verify's precheck rejects a
|
|
@@ -354,6 +354,15 @@ REPORT_PATH="${REPORT_OUT:-$REPO_ROOT/tracks/_meta/live_eval_${RUN_DATE}.md}"
|
|
|
354
354
|
SCORE_EXTRA=()
|
|
355
355
|
[ -n "$TARGET" ] && SCORE_EXTRA+=(--target "$TARGET")
|
|
356
356
|
[ -n "$BEFORE" ] && SCORE_EXTRA+=(--before "$BEFORE")
|
|
357
|
+
# «Moved since previous» (2026-11-03, record only): the newest live_eval_<date>.md dated before this run. None found -> "" and
|
|
358
|
+
# the report says «not supplied», never «none». FH_LIVE_EVAL_PREV_DIR lets lanes point at a fixture folder.
|
|
359
|
+
PREV=""
|
|
360
|
+
for f in "${FH_LIVE_EVAL_PREV_DIR:-$REPO_ROOT/tracks/_meta}"/live_eval_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].md; do
|
|
361
|
+
[ -e "$f" ] || continue
|
|
362
|
+
b=$(basename "$f" .md); d=${b#live_eval_}
|
|
363
|
+
[[ "$d" < "$RUN_DATE" ]] && PREV="$f"
|
|
364
|
+
done
|
|
365
|
+
SCORE_EXTRA+=(--prev "$PREV")
|
|
357
366
|
python3 "$LIB" score ${SCORE_EXTRA[@]+"${SCORE_EXTRA[@]}"} \
|
|
358
367
|
--probes-live "$PROBES_LIVE" \
|
|
359
368
|
--select-json "$SELECT_JSON" \
|