@chrono-meta/fh-gate 3.39.0 → 3.40.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 (49) hide show
  1. package/.claude/regression/probes_live.yaml +9 -2
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/CLAUDE.md +2 -2
  4. package/README.ja.md +22 -20
  5. package/README.ko.md +2 -2
  6. package/README.md +2 -2
  7. package/README.zh.md +22 -20
  8. package/knowledge/shared/harness-core/claude_md_full_reference.md +8 -1
  9. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +9 -0
  10. package/knowledge/shared/harness-core/fh_module_contract.md +68 -3
  11. package/knowledge/shared/harness-core/governor_landing_before_compact.md +4 -4
  12. package/knowledge/shared/harness-core/lease_record_channel.md +26 -2
  13. package/knowledge/shared/harness-core/onboarding_acceleration_autopilot.md +7 -0
  14. package/knowledge/shared/learnings/subagent_invocations_log.yaml +36 -0
  15. package/knowledge/shared/rules/operations.md +1 -0
  16. package/package.json +10 -1
  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 +45 -0
  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/agent_tools_pin.txt +16 -0
  23. package/scripts/catch_tally.py +215 -0
  24. package/scripts/claim_precision_report.py +138 -0
  25. package/scripts/fh_module_check.py +182 -1
  26. package/scripts/generated_harness_check.py +4 -0
  27. package/scripts/package_coverage_check.sh +5 -0
  28. package/scripts/post_squash_verify.sh +53 -1
  29. package/scripts/pr_merge_verified.sh +56 -0
  30. package/scripts/probe_live_eval.sh +61 -0
  31. package/scripts/probe_live_eval_lib.py +47 -4
  32. package/scripts/selfcheck.sh +5 -0
  33. package/scripts/selfdev_merge_tier.sh +153 -0
  34. package/scripts/session_checklist.py +38 -1
  35. package/scripts/session_close_check.sh +67 -1
  36. package/scripts/sim_isolated_run.sh +62 -1
  37. package/scripts/test_agent_tools_pin_lanes.sh +73 -0
  38. package/scripts/test_catch_tally_lanes.sh +10 -0
  39. package/scripts/test_claim_precision_report_lanes.sh +77 -0
  40. package/scripts/test_fh_module_check_lanes.sh +106 -1
  41. package/scripts/test_generated_harness_check_lanes.sh +8 -0
  42. package/scripts/test_post_squash_verify_lanes.sh +23 -2
  43. package/scripts/test_pr_merge_verified_lanes.sh +55 -3
  44. package/scripts/test_probe_live_eval_lanes.sh +160 -5
  45. package/scripts/test_selfdev_merge_tier_lanes.sh +128 -0
  46. package/scripts/test_session_checklist_lanes.sh +57 -0
  47. package/scripts/test_session_close_chain_lanes.sh +93 -0
  48. package/scripts/test_sim_isolated_run_lanes.sh +67 -0
  49. package/templates/harness_birth_core.md +57 -0
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env bash
2
+ # selfdev_merge_tier.sh — may an unattended self-dev PR merge on its own, or does it wait for the
3
+ # operator? A CLASSIFIER OF THE CHANGED FILE LIST, not a judgment of the change.
4
+ #
5
+ # WHY (operator, 2026-11-04 — «가로 ㄱㄱ», CLAUDE.local.md §FH 자체개발 자율화): reversible changes
6
+ # (doc lines, new lanes) merge unattended once CI is green + 4-axis + cross-family; anything that
7
+ # touches a gate, a verdict enum or an irreversible path waits for the morning report. The split is
8
+ # decided HERE by path, mechanically, so the unattended session that wrote the change never grades
9
+ # its own merge (author ≠ judge — CLAUDE.md §Mechanization Boundary: a check asserts a property of
10
+ # the record, not a conclusion).
11
+ #
12
+ # ALLOW-LIST, NOT DENY-LIST. A path is AUTO-eligible only if it matches a class below; every other
13
+ # path — including any path nobody thought of yet — is HOLD. A deny-list would fail open on the
14
+ # first new file type; this fails closed.
15
+ # AUTO-eligible (all must hold for EVERY changed path):
16
+ # docs/**/*.md
17
+ # knowledge/**/*.md except knowledge/shared/rules/** (relocated protocol rules)
18
+ # except knowledge/shared/harness-core/*gate*.md · *irreversib*.md
19
+ # plugins/*/skills/*/SKILL.md · SKILL_detail.md unless a CHANGED line (+ or −) carries verdict /
20
+ # scoring vocabulary (VERDICT_RE below) — a skill's rubric IS its
21
+ # instrument, and loosening it is the #1063 shape (AQ-20261109-6).
22
+ # Needs the diff: --pr fetches it, --files takes --diff <file>; a
23
+ # skill path whose lines cannot be read is HOLD, never AUTO.
24
+ # CATALOG.md
25
+ # scripts/test_*.sh ADDED only (status A) — a new lane cannot change what ships;
26
+ # an edited lane can silently weaken a gate, so M → HOLD
27
+ # plus: total changed lines ≤ SELFDEV_MAX_LINES (default 300).
28
+ # Everything else → HOLD: CLAUDE.md · AGENTS.md · .claude/** · templates/** (git hooks, field rules)
29
+ # · scripts/** (other than an added lane) · .github/** · package.json · plugins/*/hooks/** · etc.
30
+ #
31
+ # 🟥 EMPTY INPUT IS NOT «ALL ALLOWED». `all()` over an empty set is true; an empty file list here
32
+ # means the instrument did not see the change, so it is HARNESS-ERROR (rc 2), never AUTO.
33
+ # (feedback_not_found_is_not_zero_family — 7th face, the empty set passing a universal check.)
34
+ #
35
+ # INPUT one line per changed path: «<status>\t<path>\t<added>\t<deleted>» (status A/M/D/R…)
36
+ # from a file (--files <f>) or from a PR (--pr <n> [--repo owner/name], via gh).
37
+ # OUTPUT TIER=AUTO|HOLD|HARNESS-ERROR on the last line; one «reason:» line per HOLD path.
38
+ # RC 0 AUTO · 3 HOLD · 2 HARNESS-ERROR
39
+ #
40
+ # NAMED RESIDUALS: ⓐ a SKILL.md edit is reversible but changes behaviour — allowed on the operator's
41
+ # «문서 줄» wording; the 4-axis gate and cross-family review are what stand behind it, not this
42
+ # script. Since AQ-20261109-6 the verdict-vocabulary edits among them are HOLD; a rubric loosened in
43
+ # words the list does not carry still reaches AUTO, and so does a rubric living in docs/ or
44
+ # knowledge/ (only skill files are line-checked). Measured 2026-11-09 on the last 273 SKILL commits
45
+ # on main: 155 (57%, case-sensitive) carry the vocabulary in a changed line — the over-hold cost, paid in the morning
46
+ # report, not in an unattended merge. Case-insensitive since codex R1: 185 (68%). ⓑ CI-green and the cross-family marker are checked by the caller (selfdev_loop.sh), not
47
+ # here — this script sees paths only.
48
+
49
+ set -u
50
+ # the ceiling may be LOWERED by env, never raised, and a non-number is HARNESS-ERROR (codex R1 #6)
51
+ MAX_LINES="${SELFDEV_MAX_LINES:-300}"
52
+ case "$MAX_LINES" in ''|*[!0-9]*) echo "reason: SELFDEV_MAX_LINES=«$MAX_LINES» is not a number"; echo "TIER=HARNESS-ERROR"; exit 2 ;; esac
53
+ [ "${#MAX_LINES}" -gt 4 ] || [ "$((10#$MAX_LINES))" -gt 300 ] && MAX_LINES=300
54
+ MAX_LINES=$((10#$MAX_LINES))
55
+ FILES=""; PR=""; DIFF=""; REPO="chrono-meta/forge-harness"
56
+ # verdict / scoring vocabulary: the enum words FH verdicts use, plus the words a rubric is written in
57
+ VERDICT_RE='\b(PASS|FAIL|BLOCKED|HOLD|ESCALATE|PENDING|UNCALIBRATED|UNMEASURED|HARNESS[-_ ]ERROR|INCONCLUSIVE)\b|verdict|threshold|expect_re|rubric|판정|채점|문턱'
58
+ while [ $# -gt 0 ]; do
59
+ case "$1" in
60
+ --files) FILES="$2"; shift 2 ;;
61
+ --pr) PR="$2"; shift 2 ;;
62
+ --repo) REPO="$2"; shift 2 ;;
63
+ --diff) DIFF="$2"; shift 2 ;;
64
+ *) echo "unknown arg: $1" >&2; echo "TIER=HARNESS-ERROR"; exit 2 ;;
65
+ esac
66
+ done
67
+
68
+ TMP="$(mktemp)"; DTMP="$(mktemp)"; trap 'rm -f "$TMP" "$DTMP"' EXIT
69
+ DIFF_OK=0
70
+ if [ -n "$PR" ]; then
71
+ if ! out="$(gh pr view "$PR" -R "$REPO" --json files \
72
+ -q '.files[] | "\(.changeType)\t\(.path)\t\(.additions)\t\(.deletions)"' 2>&1)"; then
73
+ echo "reason: gh pr view failed — $out"; echo "TIER=HARNESS-ERROR"; exit 2
74
+ fi
75
+ # gh changeType words → git status letters
76
+ printf '%s\n' "$out" | sed -E 's/^ADDED\t/A\t/; s/^MODIFIED\t/M\t/; s/^DELETED\t/D\t/; s/^RENAMED\t/R\t/; s/^CHANGED\t/M\t/; s/^COPIED\t/C\t/' > "$TMP"
77
+ # the diff is only needed for skill files; a failed fetch leaves DIFF_OK=0 and those paths HOLD
78
+ gh pr diff "$PR" -R "$REPO" > "$DTMP" 2>/dev/null && [ -s "$DTMP" ] && DIFF_OK=1
79
+ elif [ -n "$FILES" ] && [ -f "$FILES" ]; then
80
+ cp "$FILES" "$TMP"
81
+ if [ -n "$DIFF" ] && [ -s "$DIFF" ]; then cp "$DIFF" "$DTMP"; DIFF_OK=1; fi
82
+ else
83
+ echo "reason: no input (--files <existing file> or --pr <n>)"; echo "TIER=HARNESS-ERROR"; exit 2
84
+ fi
85
+
86
+ n=0; hold=0; total=0
87
+ while IFS=$'\t' read -r st path add del; do
88
+ [ -z "${path:-}" ] && continue
89
+ n=$((n+1))
90
+ # bounded decimals only: a 19-digit count wraps the sum negative, «08» is octal to bash (codex R1 #9)
91
+ case "${add:-x}${del:-x}" in *[!0-9]*) echo "reason: $path — line counts unreadable ($add/$del)"; hold=1; continue ;; esac
92
+ if [ "${#add}" -gt 6 ] || [ "${#del}" -gt 6 ]; then echo "reason: $path — line count out of range ($add/$del)"; hold=1; continue; fi
93
+ total=$((total + 10#$add + 10#$del))
94
+ ok=0
95
+ # a rename/copy is classified by its destination only, so a protected SOURCE path could leave the
96
+ # tree unseen — every R/C is HOLD (codex R1 #4)
97
+ case "$st" in R*|C*) echo "reason: $path — status $st (rename/copy: source path not classified)"; hold=1; continue ;; esac
98
+ case "$path" in
99
+ knowledge/shared/rules/*) ok=0 ;;
100
+ knowledge/shared/harness-core/*gate*.md|knowledge/shared/harness-core/*irreversib*.md) ok=0 ;;
101
+ docs/*.md|docs/*/*.md|docs/*/*/*.md) ok=1 ;;
102
+ knowledge/*.md|knowledge/*/*.md|knowledge/*/*/*.md|knowledge/*/*/*/*.md) ok=1 ;;
103
+ plugins/*/skills/*/SKILL.md|plugins/*/skills/*/SKILL_detail.md)
104
+ if [ "$DIFF_OK" -ne 1 ]; then
105
+ echo "reason: $path — skill file, but its changed lines could not be read (no --diff / gh pr diff failed)"; hold=1; continue
106
+ fi
107
+ # changed lines of THIS file only: its «diff --git» section, header lines skipped only BEFORE the first
108
+ # @@ (a removed content line «-- x» shows as «--- x» inside a hunk — codex R1), +/− lines printed with
109
+ # their sign so an empty changed line still counts
110
+ vlines="$(awk -v p="$path" '
111
+ /^diff --git / { on = ($0 == "diff --git a/" p " b/" p); hdr = 1; next }
112
+ on && hdr && /^@@/ { hdr = 0; next }
113
+ on && hdr { next }
114
+ on && /^@@/ { next }
115
+ on && /^[-+]/ { print }' "$DTMP")"
116
+ # the diff must carry every changed line the file list counts — a partial diff is not the change (codex R1)
117
+ vn="$(printf '%s' "$vlines" | grep -c '^[-+]')"
118
+ case "$vn" in ''|*[!0-9]*) vn=-1 ;; esac # grep failed → a count nobody read, never a match
119
+ if [ -z "$vlines" ] || [ "$vn" -ne $((10#$add + 10#$del)) ]; then
120
+ echo "reason: $path — the diff shows ${vn:-0} changed line(s) for this skill, the file list counts $((10#$add + 10#$del)) (instrument did not see all its lines)"; hold=1; continue
121
+ fi
122
+ # case-insensitive: «pass when any check succeeds» is a rubric too (codex R1). grep rc 2 (error) is HOLD, not «no match».
123
+ # no other command in this pipe: a failing `cut` once handed grep nothing and the rc said «no match» (codex R2)
124
+ printf '%s\n' "$vlines" | grep -Eiq "$VERDICT_RE"; grc=$?
125
+ if [ "$grc" -eq 0 ]; then
126
+ echo "reason: $path — a changed line carries verdict/scoring vocabulary («$(printf '%s\n' "$vlines" | cut -c2- | grep -Eio "$VERDICT_RE" | head -1)»): a skill's rubric is its instrument"; hold=1; continue
127
+ elif [ "$grc" -ne 1 ]; then
128
+ echo "reason: $path — vocabulary check failed (grep rc=$grc); unread is not clean"; hold=1; continue
129
+ fi
130
+ ok=1 ;;
131
+ CATALOG.md) ok=1 ;;
132
+ scripts/test_*.sh) [ "$st" = "A" ] && ok=1 ;;
133
+ esac
134
+ if [ "$ok" -ne 1 ]; then
135
+ hold=1
136
+ if [ "${path#scripts/test_}" != "$path" ]; then
137
+ echo "reason: $path — status $st (only an ADDED lane is auto-eligible; an edited lane can weaken a gate)"
138
+ else
139
+ echo "reason: $path — outside the auto-merge allow-list"
140
+ fi
141
+ fi
142
+ done < "$TMP"
143
+
144
+ if [ "$n" -eq 0 ]; then
145
+ echo "reason: changed-file list is empty — the instrument saw no change, which is not «all allowed»"
146
+ echo "TIER=HARNESS-ERROR"; exit 2
147
+ fi
148
+ if [ "$total" -gt "$MAX_LINES" ]; then
149
+ echo "reason: $total changed lines > $MAX_LINES (SELFDEV_MAX_LINES)"; hold=1
150
+ fi
151
+ echo "files=$n lines=$total"
152
+ if [ "$hold" -eq 1 ]; then echo "TIER=HOLD"; exit 3; fi
153
+ echo "TIER=AUTO"; exit 0
@@ -177,8 +177,42 @@ EXCLUDE_ENVELOPES = (
177
177
  ("<local-command-caveat>", "</local-command-caveat>", "end"),
178
178
  ("<command-name>", "<command-message>", "in"),
179
179
  ("Caveat: The messages below were generated by the user while running local commands", "", ""), # v6: the synthetic caveat sentence itself
180
+ # v12 (2026-11-08 harvest H1): the desktop app's side-session event, measured 70× in one governor transcript
181
+ # behind leading reminder blocks (origin absent · promptSource=sdk) — only reachable after the leading strip below
182
+ ("<side-sessions-event>", "</side-sessions-event>", "end"),
180
183
  )
181
184
 
185
+ # v12 (2026-11-08 harvest H1): the desktop app PREPENDS complete `<system-reminder>…</system-reminder>` blocks (up to 9
186
+ # measured, stacked) to the operator's own words in the same entry. Strip only LEADING, COMPLETE blocks — the opening
187
+ # tag may carry attributes (no `<` inside them: an unclosed opener must not swallow a later block — codex R2); a block whose body holds another opening tag is not complete (an unclosed look-alike
188
+ # before a real block is kept); a mid-text tag is never touched. If nothing but blocks remains, the text is returned
189
+ # unchanged, so L39 (a human entry that is only an envelope stays a row) and the full-envelope exclusion still hold.
190
+ LEADING_REMINDER_RE = re.compile(
191
+ r"\A\s*<system-reminder(?:\s[^<>]*)?>(?:(?!<system-reminder(?:\s|>)).)*?</system-reminder>", re.S)
192
+
193
+
194
+ def _leading_reminder_split(text):
195
+ rest, n = text, 0
196
+ while True:
197
+ m = LEADING_REMINDER_RE.match(rest)
198
+ if not m:
199
+ return n, rest
200
+ rest, n = rest[m.end():], n + 1
201
+
202
+
203
+ def only_reminder_blocks(text):
204
+ n, rest = _leading_reminder_split(text or "")
205
+ return n > 0 and not rest.strip()
206
+
207
+
208
+ def strip_leading_reminders(text):
209
+ if not text:
210
+ return text
211
+ n, rest = _leading_reminder_split(text)
212
+ if n and rest.strip():
213
+ return rest.lstrip()
214
+ return text
215
+
182
216
  COMPACTION_PREFIX = "This session is being continued from a previous conversation"
183
217
 
184
218
  # v4 (codex round 3): the compaction heading is localized in Korean sessions — an alias table, not one spelling.
@@ -243,6 +277,8 @@ def is_excluded(text, entry):
243
277
  return True
244
278
  if has_metadata(entry) and origin_kind(entry) == "":
245
279
  pass # metadata present but no origin — fall through to the text validators
280
+ if only_reminder_blocks(text):
281
+ return True # v12 (codex R1): an envelope-only entry whose opener carries attributes, or several stacked blocks
246
282
  stripped = text.lstrip()
247
283
  for p, companion, where in EXCLUDE_ENVELOPES:
248
284
  if not stripped.startswith(p):
@@ -414,7 +450,7 @@ def read_hook_channel(path):
414
450
  if not parse_ts_candidates(d.get("ts")):
415
451
  bad += 1 # the hook always writes ts; without it the time window cannot apply, so the row is not trusted
416
452
  continue
417
- rows.append({"ts": d.get("ts"), "text": d["text"], "truncated": d.get("truncated") is True})
453
+ rows.append({"ts": d.get("ts"), "text": strip_leading_reminders(d["text"]), "truncated": d.get("truncated") is True}) # v12: same text as the transcript row it pairs with
418
454
  except OSError as e:
419
455
  return "error", [], 0, e.strerror or "unreadable"
420
456
  return "read", rows, bad, ""
@@ -485,6 +521,7 @@ def do_extract(transcript_path, out_path, utterances_path=None):
485
521
  if not has_text or text is None or text.strip() == "":
486
522
  continue
487
523
  text = text.lstrip("\ufeff") # v5: a BOM before the compaction prefix hid the summary channel
524
+ text = strip_leading_reminders(text) # v12: the operator's words, not the prepended reminder blocks
488
525
  if entry.get("isCompactSummary") is True:
489
526
  # v11: the flag Claude Code sets on compaction entries — primary signal; the text shape is the fallback
490
527
  summary_texts.append(text)
@@ -17,7 +17,7 @@ set -uo pipefail
17
17
 
18
18
  # 상속된 git 환경변수를 끊는다 — export 된 GIT_DIR 이 있으면 `git -C "$FH"` 가 인자로 받은
19
19
  # 레포가 아니라 그 레포를 잰다(Axis 2 at-floor LOW, 2026-08-06). READ-ONLY 체커라 부작용 없음.
20
- unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
20
+ unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR # GIT_COMMON_DIR: ①-r would read another repo's receipts (codex R2, 2026-11-08)
21
21
  FH="${1:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
22
22
  TODAY=$(date +%Y-%m-%d)
23
23
  CARD="$FH/tracks/_meta/reference_next_session_starter.md"
@@ -122,6 +122,72 @@ if command -v gh >/dev/null 2>&1; then
122
122
  [ "${PRS:-0}" -gt 0 ] && echo "⚠️ ①-b $PRS open PR(s) by you — classify: self-mergeable vs awaiting-external"
123
123
  fi
124
124
 
125
+ # ①-r MERGE RECEIPTS — report only («advisory, does not block»; rc unchanged). `pr_merge_verified.sh` appends one
126
+ # JSON line per merge to <git-common-dir>/fh-merge-receipts.jsonl (or $PMV_RECEIPTS), but nothing at close read it:
127
+ # FH #1057 merged with `verify-incomplete` and only a hand check found it (2026-11-08 harvest H2). The flagged set is
128
+ # «last outcome is NOT `verified`» — never an enumerated list, so a new outcome name is shown, not passed. «Last» is
129
+ # FILE order (append order), not the `at` string. Only THIS repo's file is read: receipts carry no repo field and PR
130
+ # numbers collide across repos. Absent/empty file = UNMEASURED, never «all verified». Malformed lines are counted.
131
+ # Only the last FH_RECEIPT_WINDOW_DAYS (default 7) days are named; older ones are counted on their own line.
132
+ # Anchored by scripts/test_session_close_chain_lanes.sh lanes ①-r-*.
133
+ RCPT="${PMV_RECEIPTS:-}"
134
+ if [ -z "$RCPT" ]; then
135
+ _gcd=$(git -C "$FH" rev-parse --path-format=absolute --git-common-dir 2>/dev/null) || _gcd=""
136
+ [ -n "$_gcd" ] && RCPT="$_gcd/fh-merge-receipts.jsonl"
137
+ fi
138
+ if [ -z "$RCPT" ] || [ ! -s "$RCPT" ]; then
139
+ echo "ℹ️ ①-r receipts: none/UNMEASURED (${RCPT:-no git dir}) — advisory, does not block"
140
+ elif ! command -v python3 >/dev/null 2>&1; then
141
+ echo "ℹ️ ①-r receipts: UNMEASURED — python3 not found ($RCPT) — advisory, does not block"
142
+ else
143
+ python3 - "$RCPT" <<'PYEOF' || echo "ℹ️ ①-r receipts: UNMEASURED — reader failed ($RCPT) — advisory, does not block"
144
+ import json, sys
145
+ path = sys.argv[1]
146
+ last, bad, total = {}, 0, 0
147
+ with open(path, encoding="utf-8", errors="replace") as f:
148
+ for raw in f:
149
+ if not raw.strip():
150
+ continue
151
+ total += 1
152
+ try:
153
+ d = json.loads(raw)
154
+ pr, out = d["pr"], d["outcome"]
155
+ if isinstance(pr, bool) or not isinstance(pr, int) or not isinstance(out, str) or not out:
156
+ raise ValueError
157
+ except Exception:
158
+ bad += 1
159
+ continue
160
+ at = d.get("at")
161
+ last[pr] = (out, at if isinstance(at, str) and at else "?") # file order: a later line replaces an earlier one
162
+ if total == 0: # whitespace-only file: nothing was read — UNMEASURED, never an all-clear (codex R1)
163
+ print("ℹ️ ①-r receipts: none/UNMEASURED (%s holds no receipt line) — advisory, does not block" % path)
164
+ sys.exit(0)
165
+ flagged = sorted((pr, o, at) for pr, (o, at) in last.items() if o != "verified")
166
+ # window (operator 2026-11-08 «판단후추천대로»): name only receipts from the last N days (default 7 = the weekly-audit
167
+ # cycle) so the same old PRs do not repeat at every close until nobody reads the line. Older ones are COUNTED, never
168
+ # dropped silently. A receipt whose `at` has no readable date is treated as recent (shown). N=0 shows everything.
169
+ import datetime, os, re
170
+ try:
171
+ days = int(os.environ.get("FH_RECEIPT_WINDOW_DAYS", "7"))
172
+ except ValueError:
173
+ days = 7
174
+ cutoff = (datetime.date.today() - datetime.timedelta(days=days)).isoformat() if days > 0 else None
175
+ def _recent(at):
176
+ return cutoff is None or not re.match(r"\d{4}-\d{2}-\d{2}", at) or at[:10] >= cutoff
177
+ shown = [f for f in flagged if _recent(f[2])]
178
+ older = len(flagged) - len(shown)
179
+ if shown:
180
+ items = " · ".join("#%d %s (%s)" % (pr, o, at[:10]) for pr, o, at in shown)
181
+ print("⚠️ ①-r %d PR(s) whose last merge receipt is not «verified»: %s — read each; advisory, does not block" % (len(shown), items))
182
+ if older:
183
+ print("ℹ️ ①-r %d older PR(s) (> %d days) whose last receipt is not «verified» — not named here; FH_RECEIPT_WINDOW_DAYS=0 lists all" % (older, days))
184
+ if bad:
185
+ print("⚠️ ①-r %d malformed receipt line(s) of %d in %s — those merges are UNMEASURED; advisory, does not block" % (bad, total, path))
186
+ if not flagged and not bad:
187
+ print("✅ ①-r merge receipts: last outcome «verified» for all %d PR(s) (%s)" % (len(last), path))
188
+ PYEOF
189
+ fi
190
+
125
191
  # ── ①-d CLOSE RE-OPENED? ──────────────────────────────────────────────────────
126
192
  # WHY: a session that closed cleanly and then kept working looks IDENTICAL to one that never
127
193
  # closed — both read Completed from outside, and ①-c cannot separate them. Measured 2026-08-09:
@@ -315,6 +315,8 @@ _PYEOF
315
315
  BASE_REF=""; BASE_SHA=""
316
316
  ARM=""; REPS=1; PROMPT=""; MODE="observe"; MODEL="sonnet"; TIMEOUT=900; OUTDIR=""; NOHARNESS=0; SETUP=""; EXTRA=""
317
317
  TURNS=""; NORESUME=0
318
+ SETSRC=""; SETFILE=""; PERMMODE=""; ADDWRAP=0 # §CONSUMER SURFACE — never inherited from the env (codex R1)
319
+ _needval() { [ "$#" -ge 2 ] || { echo "FAIL: $1 needs a value" >&2; exit 2; }; }
318
320
  while [ $# -gt 0 ]; do
319
321
  case "$1" in
320
322
  --arm) ARM="${2:-}"; shift 2 ;;
@@ -332,9 +334,56 @@ while [ $# -gt 0 ]; do
332
334
  --mcp-config) MCPCFG="${2:-}"; shift 2 ;; # the ONLY MCP servers an arm may see (see MCP ISOLATION). Default: none.
333
335
  --turns) TURNS="${2:-}"; shift 2 ;; # MULTI-TURN: one turn per line. See §MULTI-TURN.
334
336
  --no-resume) NORESUME=1; shift ;; # CONTROL arm for --turns:each turn is a fresh session. See §MULTI-TURN.
337
+ --setting-sources) _needval "$@"; SETSRC="$2"; [ -n "$SETSRC" ] || { echo "FAIL: --setting-sources is empty" >&2; exit 2; }; shift 2 ;; # §CONSUMER SURFACE — e.g. project,local
338
+ --settings) _needval "$@"; SETFILE="$2"; [ -n "$SETFILE" ] || { echo "FAIL: --settings is empty" >&2; exit 2; }; shift 2 ;; # §CONSUMER SURFACE — permission file
339
+ --permission-mode) _needval "$@"; PERMMODE="$2"
340
+ case "$PERMMODE" in default|acceptEdits|plan) ;; *) echo "FAIL: --permission-mode '$PERMMODE' refused — only default|acceptEdits|plan (an unattended arm must not bypass the runner's deny rules)" >&2; exit 2 ;; esac
341
+ shift 2 ;;
342
+ --add-wrapper-dir) ADDWRAP=1; shift ;; # §CONSUMER SURFACE — the rep's own wrapper (clone + siblings)
335
343
  *) echo "unknown flag: $1" >&2; exit 2 ;;
336
344
  esac
337
345
  done
346
+ # ── §CONSUMER SURFACE (2026-11-10, AQ-20261110-6) ───────────────────────────────────────────
347
+ # WHY: the blind harness-birth test (branch claude/blind-birth-test-092883, its fixtures folder
348
+ # blind_birth_2026-11-10 — not on main when this landed) needed an arm that
349
+ # looks like a CONSUMER install, and the runner could not express one:
350
+ # · user-scope settings (the operator's own plugins and hooks) load into every non-restricted
351
+ # arm — so an "FH arm" measured FH + whatever this operator installed, and a "bare" arm could
352
+ # not be made bare without `--no-harness`;
353
+ # · `--no-harness` (= --restricted) kills act-mode writes (see the header), and plain act mode
354
+ # cannot reach a sibling project folder next to the clone.
355
+ # The test ran through a PATH shim that appended these four flags. This section makes the shim
356
+ # unnecessary. Known pair, 2026-11-10: with `--setting-sources project,local` the FH clone still
357
+ # answers «yes, the 🐿️ greeting rule» (project memory kept) and an emptied clone answers «no»;
358
+ # neither lists any user-scope `fh-` skill.
359
+ # 🟥 ALL FOUR ARE OPT-IN. With none given, the argv handed to `claude` is byte-identical to before
360
+ # (lane L31a). `--permission-mode bypassPermissions` is REFUSED: an unattended arm that can bypass
361
+ # the deny rules this runner writes is not isolated, and the auto-mode classifier refused the same
362
+ # shape when it was tried by hand. Only default|acceptEdits|plan pass.
363
+ # 🟥 RESIDUAL, named: headless arms still cannot write under `<project>/.claude/` even with an explicit
364
+ # allow — the platform treats it as sensitive and wants a human. Not fixable here; score what the
365
+ # arm wrote, and record how it reacted to the block.
366
+ # 🟥 PILOT THE HELD-OUT TASK ON A BARE ARM FIRST. In the same test the stage-2 task hit the ceiling:
367
+ # an arm with NO harness found the planted false claim 6/6 and held the publish script 6/6, so the
368
+ # task could not tell a harness from none. Before registering a task, run it once on an emptied
369
+ # clone (no harness); if that arm already passes, the task measures nothing — pick a harder one.
370
+ # A same-model-authored trap is the usual cause (the cartridge rounds saw it six times).
371
+ SURF=()
372
+ if [ -n "$SETSRC" ]; then
373
+ # Validate the exact string that is forwarded, not a shell-split copy of it (codex R2).
374
+ printf '%s' "$SETSRC" | grep -qE '^(user|project|local)(,(user|project|local))*$' \
375
+ || { echo "FAIL: --setting-sources takes a comma list of user|project|local, got '$SETSRC'" >&2; exit 2; }
376
+ # 🟥 `local` is REQUIRED: the runner's isolation deny rules live in the clone's local settings
377
+ # file — a source list without `local` silently drops them (codex R2).
378
+ case ",$SETSRC," in *,local,*) ;; *) echo "FAIL: --setting-sources must include 'local' — the runner's isolation deny rules are a local settings file" >&2; exit 2 ;; esac
379
+ SURF+=(--setting-sources "$SETSRC")
380
+ fi
381
+ if [ -n "$SETFILE" ]; then
382
+ [ -f "$SETFILE" ] || { echo "FAIL: --settings file not found: $SETFILE" >&2; exit 2; }
383
+ SETFILE="$(cd "$(dirname "$SETFILE")" && pwd)/$(basename "$SETFILE")"
384
+ SURF+=(--settings "$SETFILE")
385
+ fi
386
+ [ -n "$PERMMODE" ] && SURF+=(--permission-mode "$PERMMODE") # validated in the parser (empty refused there)
338
387
  [ -n "$ARM" ] || { echo "FAIL: --arm required" >&2; exit 2; }
339
388
  [ -n "$PROMPT" ] || [ -n "$TURNS" ] || { echo "FAIL: --prompt or --turns required" >&2; exit 2; }
340
389
  case "$MODE" in observe|act) ;; *) echo "FAIL: --mode must be observe|act" >&2; exit 2 ;; esac
@@ -409,6 +458,7 @@ fh_run_turns() {
409
458
  if [ -n "$_sid" ] && [ "$NORESUME" -eq 0 ]; then _resume=(--resume "$_sid"); fi
410
459
  ( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$_t" \
411
460
  --model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
461
+ ${SURFREP[@]+"${SURFREP[@]}"} \
412
462
  ${_resume[@]+"${_resume[@]}"} --output-format json \
413
463
  < /dev/null 2>"${_tf}.stderr.txt" ) > "${_tf}.json"
414
464
  _rc=$?; _lastrc=$_rc
@@ -810,7 +860,10 @@ for r in $(seq 1 "$REPS"); do
810
860
  # = "only the servers given by --mcp-config" (CLI --help), and with no --mcp-config that is
811
861
  # NONE. An arm that legitimately needs a server (e.g. Playwright for a web target) gets it
812
862
  # explicitly via --mcp-config <file inside the clone>; nothing is inherited.
813
- MCPARGS=(--strict-mcp-config); [ -n "${MCPCFG:-}" ] && MCPARGS+=(--mcp-config "$MCPCFG") # bash 3.2 + set -u: expanded with the ${a[@]+"${a[@]}"} idiom below
863
+ MCPARGS=(--strict-mcp-config); [ -n "${MCPCFG:-}" ] && MCPARGS+=(--mcp-config "$MCPCFG")
864
+ # §CONSUMER SURFACE — per-rep copy: the wrapper dir differs per rep. Empty unless opted in.
865
+ SURFREP=(${SURF[@]+"${SURF[@]}"}); [ "$ADDWRAP" -eq 1 ] && SURFREP+=(--add-dir "$WRAP") # bash 3.2 + set -u: expanded with the ${a[@]+"${a[@]}"} idiom below
866
+ _wall_t0=$(date +%s) # COST AXIS (2026-11-12): wall seconds per episode, record only — never scored
814
867
  if [ -n "$TURNS" ]; then
815
868
  # §MULTI-TURN — the single-shot branch below is left byte-identical on purpose: `--turns`
816
869
  # adds a path, it does not modify the one every existing probe already runs on.
@@ -819,9 +872,16 @@ for r in $(seq 1 "$REPS"); do
819
872
  else
820
873
  ( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$PROMPT" \
821
874
  --model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
875
+ ${SURFREP[@]+"${SURFREP[@]}"} \
822
876
  < /dev/null 2>"$OUTDIR/${ARM}_r${r}.stderr.txt" ) > "$OUTDIR/${ARM}_r${r}.txt"
823
877
  rc=$?
824
878
  fi
879
+ # A failed clock read must not become 0 or an epoch-sized number (codex R1): both reads digits,
880
+ # delta >= 0, else UNMEASURED. Residual: a wall-clock step during the episode is not detected.
881
+ _wall_t1=$(date +%s)
882
+ case "$_wall_t0$_wall_t1" in (''|*[!0-9]*) _wall_s=UNMEASURED ;;
883
+ (*) if [ -n "$_wall_t0" ] && [ -n "$_wall_t1" ] && [ "$_wall_t1" -ge "$_wall_t0" ]; then
884
+ _wall_s=$((_wall_t1 - _wall_t0)); else _wall_s=UNMEASURED; fi ;; esac
825
885
  bytes=$(wc -c < "$OUTDIR/${ARM}_r${r}.txt" | tr -d ' ')
826
886
 
827
887
  # ── BUDGET LINE (2026-10-17) — which cap this episode ran under, and did it END at that cap. ──
@@ -849,6 +909,7 @@ for r in $(seq 1 "$REPS"); do
849
909
  printf 'max_turns\t%s\n' "$_cap_turns"
850
910
  printf 'token_cap\t%s\n' "$_cap_tokens"
851
911
  printf 'ended_at_cap\t%s\n' "$_cap_end"
912
+ printf 'wall_s\t%s\n' "$_wall_s"
852
913
  } >> "$OUTDIR/${ARM}_r${r}.meta.tsv"
853
914
 
854
915
  # 🟥 An empty output is NOT a "no" answer. The first version of tonight's runner used
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ # Pin each agent definition's `tools:` restriction against scripts/agent_tools_pin.txt.
3
+ # Origin: digest 2026-11-11 (arXiv:2611.09895, «restriction silently deleted» mutant). Measured that
4
+ # day: deleting all 14 `tools:` lines left validate_yaml and the whole selfcheck unchanged — the
5
+ # restrictions were held by prose only. This lane asserts a property of the record (present and equal
6
+ # to the declared value), not whether the restriction is right.
7
+ # T1 every declared file exists and its `tools:` line equals the declared value
8
+ # T2 every agent file under plugins/*/agents and .claude/agents that has a `tools:` line is declared
9
+ # K1-K3 known pair on a temp copy: deletion / widening / undeclared new agent → red; untouched → green
10
+ set -u
11
+ ROOT="${1:-$(cd "$(dirname "$0")/.." && pwd)}"
12
+ PIN="$ROOT/scripts/agent_tools_pin.txt"
13
+
14
+ # `tools:` read from the YAML frontmatter only (between the first two `---` lines) — a body line that
15
+ # happens to say «tools: Read» is not a restriction (codex R1).
16
+ fm_tools() { awk 'NR==1 && $0=="---" {f=1; next} f && $0=="---" {exit} f && /^tools:/ {sub(/^tools: */, ""); print; exit}' "$1"; }
17
+
18
+ check() { # $1 = repo root; prints problems, returns count via rc (capped)
19
+ local root="$1" pin="$1/scripts/agent_tools_pin.txt" n=0 f want got
20
+ [ -f "$pin" ] || { echo " pin list missing: $pin"; return 1; }
21
+ while IFS='|' read -r f want || [ -n "$f" ]; do
22
+ case "$f" in ''|\#*) continue ;; esac
23
+ if [ ! -f "$root/$f" ]; then echo " declared but missing: $f"; n=$((n+1)); continue; fi
24
+ got="$(fm_tools "$root/$f")"
25
+ if [ -z "$got" ]; then echo " tools: line deleted: $f (declared: $want)"; n=$((n+1))
26
+ elif [ "$got" != "$want" ]; then echo " tools: changed: $f «$got» (declared: «$want»)"; n=$((n+1)); fi
27
+ done < "$pin"
28
+ local found frc d dirs=()
29
+ # .claude/agents may legitimately not exist — only existing roots go to find, so any find error
30
+ # (GNU quotes paths ‘…’, BSD does not — a message-text filter broke on CI) is an incomplete measurement.
31
+ for d in "$root/plugins" "$root/.claude/agents"; do [ -d "$d" ] && dirs+=("$d"); done
32
+ [ "${#dirs[@]}" -gt 0 ] || { echo " discovery incomplete (no agent roots) — not measured"; return 1; }
33
+ found="$(find "${dirs[@]}" -path '*agents*' -name '*.md' -type f 2>&1)"; frc=$?
34
+ if [ "$frc" -ne 0 ]; then echo " discovery incomplete (find rc=$frc) — not measured"; n=$((n+1)); fi
35
+ while IFS= read -r f; do
36
+ case "$f" in find:*|'') continue ;; esac
37
+ rel="${f#"$root"/}"
38
+ [ -n "$(fm_tools "$f")" ] || continue
39
+ grep -q "^$rel|" "$pin" || { echo " undeclared tools: line: $rel"; n=$((n+1)); }
40
+ done <<< "$found"
41
+ [ "$n" -eq 0 ]
42
+ }
43
+
44
+ fail=0
45
+ declared=$(grep -cvE '^(#|$)' "$PIN" 2>/dev/null); declared=${declared:-0}
46
+ if [ "$declared" -eq 0 ]; then echo " ❌ T0 pin list empty or missing — nothing measured"; fail=1
47
+ elif out="$(check "$ROOT")"; then echo " ✅ T1/T2 $declared declared tools: lines present, unchanged, none undeclared"
48
+ else echo "$out"; echo " ❌ T1/T2 tools: pin drift"; fail=1; fi
49
+
50
+ # Known pair on a temp copy of just the files involved.
51
+ T="$(mktemp -d "${TMPDIR:-/tmp}/atp.XXXXXX")"; trap 'rm -rf "$T"' EXIT
52
+ mk() { rm -rf "$T/r"; mkdir -p "$T/r/scripts"; cp "$PIN" "$T/r/scripts/"
53
+ ( cd "$ROOT" && find plugins .claude/agents -path '*agents*' -name '*.md' -type f 2>/dev/null ) \
54
+ | while IFS= read -r f; do mkdir -p "$T/r/$(dirname "$f")"; cp "$ROOT/$f" "$T/r/$f"; done; }
55
+ first="$(grep -vE '^(#|$)' "$PIN" | head -1 | cut -d'|' -f1)"
56
+ mk; check "$T/r" >/dev/null && echo " ✅ K0 untouched copy green (control)" || { echo " ❌ K0 control red"; fail=1; }
57
+ mk; sed -i.bak '/^tools:/d' "$T/r/$first"
58
+ check "$T/r" >/dev/null && { echo " ❌ K1 deletion not caught"; fail=1; } || echo " ✅ K1 deleted restriction → red"
59
+ mk; sed -i.bak 's/^tools: .*/&, Bash/' "$T/r/$first"
60
+ check "$T/r" >/dev/null && { echo " ❌ K2 widening not caught"; fail=1; } || echo " ✅ K2 widened restriction (+Bash) → red"
61
+ mk; mkdir -p "$T/r/plugins/zz/agents"; printf -- '---\nname: x\ntools: Read\n---\n' > "$T/r/plugins/zz/agents/x.md"
62
+ check "$T/r" >/dev/null && { echo " ❌ K3 undeclared agent not caught"; fail=1; } || echo " ✅ K3 undeclared new tools: line → red"
63
+
64
+ # K4 frontmatter restriction deleted, same text left in the body → still red (codex R1)
65
+ mk; awk 'BEGIN{d=0} /^tools:/ && !d {t=$0; d=1; next} {print} END{print ""; print t}' "$T/r/$first" > "$T/x" && mv "$T/x" "$T/r/$first"
66
+ check "$T/r" >/dev/null && { echo " ❌ K4 body-only tools: line accepted"; fail=1; } || echo " ✅ K4 restriction moved out of frontmatter → red"
67
+ # K5 pin list without a trailing newline still checks its last entry (codex R1)
68
+ mk; printf '%s' "$(cat "$T/r/scripts/agent_tools_pin.txt")" > "$T/r/scripts/agent_tools_pin.txt"
69
+ last="$(grep -vE '^(#|$)' "$PIN" | tail -1 | cut -d'|' -f1)"; sed -i.bak '/^tools:/d' "$T/r/$last"
70
+ check "$T/r" >/dev/null && { echo " ❌ K5 last unterminated entry skipped"; fail=1; } || echo " ✅ K5 unterminated last entry still checked → red"
71
+
72
+ echo "agent_tools_pin lanes: $([ $fail = 0 ] && echo PASS || echo FAIL)"
73
+ exit $fail
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # test_catch_tally_lanes.sh — catch_tally.py 의 기록 규칙 known-pair (얇은 래퍼).
3
+ # 절 없는 날·범위 없는 0건 = 미기록(0 아님) · 목록 밖 방법/놓친 쪽 = INVALID(세지 않음)
4
+ # · 다른 절·범위 밖 날은 안 셈 · 컨트롤(유효 기록만이면 rc=0). 레인은 파이썬 안에 있다.
5
+ # exit: 0 전 레인 PASS · 1 실패 · 10 harness error(python3 부재)
6
+ set -uo pipefail
7
+ SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ command -v python3 >/dev/null 2>&1 || {
9
+ echo "harness error: python3 absent -- cannot measure. Not a pass." >&2; exit 10; }
10
+ python3 "$SRC/catch_tally.py" --self-test
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env bash
2
+ # Lanes for scripts/claim_precision_report.py — known pair + channel-gap cases.
3
+ # P1 DONE → PARTIAL in a later sheet → M=1 (known-positive)
4
+ # P2 DONE → DONE → M=0 (known-negative, same run)
5
+ # P3 DONE → empty 상태 → B=1, M unchanged (not re-judged ≠ corrected)
6
+ # P4 a session with one sheet → listed NOT MEASURED, contributes nothing
7
+ # P5 empty folder → rc 10, NOT MEASURED (absence ≠ 0)
8
+ set -u
9
+ HERE="$(cd "$(dirname "$0")" && pwd)"
10
+ R="$HERE/claim_precision_report.py"
11
+ T="$(mktemp -d "${TMPDIR:-/tmp}/cpr.XXXXXX")"
12
+ trap 'rm -rf "$T"' EXIT
13
+ pass=0; fail=0
14
+ ok(){ echo " ✅ $1"; pass=$((pass+1)); }
15
+ ng(){ echo " ❌ $1"; fail=$((fail+1)); }
16
+
17
+ hdr='| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안(이번 세션 vs 이월) |
18
+ |---|---|---|---|---|---|---|'
19
+ mkdir -p "$T/d"
20
+ { echo "$hdr"
21
+ echo '| 1 | 11-01 10:00 | alpha request | ✅DONE | e1 | — | — |'
22
+ echo '| 2 | 11-01 11:00 | beta request | ✅DONE | e2 | — | — |'
23
+ echo '| 3 | 11-01 12:00 | gamma request | ✅DONE | e3 | — | — |'; } > "$T/d/session_checklist_2026-11-01_sA.md"
24
+ { echo "$hdr"
25
+ echo '| 1 | 11-01 10:00 | alpha request | 🟡PARTIAL | e1 | narrowed | later |'
26
+ echo '| 2 | 11-01 11:00 | beta request | ✅DONE | e2 | — | — |'
27
+ echo '| 3 | 11-01 12:00 | gamma request | | | | |'; } > "$T/d/session_checklist_2026-11-02_sA.md"
28
+ { echo "$hdr"
29
+ echo '| 1 | 11-03 09:00 | solo request | ✅DONE | e | — | — |'; } > "$T/d/session_checklist_2026-11-03_sB.md"
30
+
31
+ out="$(python3 "$R" --dir "$T/d" 2>&1)"; rc=$?
32
+ echo "$out" | sed 's/^/ | /'
33
+ [ "$rc" = 0 ] && ok "rc 0 on sheets" || ng "rc=$rc"
34
+ echo "$out" | grep -q 'N done-rows=3 ' && ok "P2 N=3 (DONE rows of the measured session)" || ng "P2 N"
35
+ echo "$out" | grep -q 'M later reopened (non-DONE in the enum)=1 ' && ok "P1 M=1 known-positive" || ng "P1 M"
36
+ echo "$out" | grep -q 'alpha request' && ok "P1 reopened row is the alpha row" || ng "P1 row identity"
37
+ echo "$out" | grep -q 'beta request' && ng "P2 known-negative listed as reopened" || ok "P2 beta not listed"
38
+ echo "$out" | grep -q 'B not re-judged in newest sheet (blank, absent or outside the enum)=1 ' && ok "P3 blank counted apart (B=1)" || ng "P3 B"
39
+ echo "$out" | grep -q 'not-measured(<2 readable sheets)=1' && echo "$out" | grep -q 'readable sheets sB' \
40
+ && ok "P4 single-sheet session named NOT MEASURED" || ng "P4"
41
+
42
+ mkdir -p "$T/empty"
43
+ out="$(python3 "$R" --dir "$T/empty" 2>&1)"; rc=$?
44
+ [ "$rc" = 10 ] && echo "$out" | grep -q 'NOT MEASURED' && ok "P5 empty folder → rc 10 NOT MEASURED" || ng "P5 rc=$rc"
45
+
46
+ # Codex R1 (2026-11-11) — each reproduced red against the first version before the fix.
47
+ # P6 two sheets that cannot be parsed → not measured, never «measured=1 N=0 M=0».
48
+ mkdir -p "$T/bad"; : > "$T/bad/session_checklist_2026-11-01_sC.md"; : > "$T/bad/session_checklist_2026-11-02_sC.md"
49
+ out="$(python3 "$R" --dir "$T/bad" 2>&1)"
50
+ echo "$out" | grep -q 'measured=0 ' && echo "$out" | grep -q 'unreadable sheets session_checklist_2026-11-01_sC.md' \
51
+ && ok "P6 unreadable sheets → measured=0, named" || ng "P6"
52
+ # P7 DONE → PARTIAL → DONE: the reopening stays counted (sticky).
53
+ mkdir -p "$T/sticky"
54
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | ✅DONE | e | — | — |'; } > "$T/sticky/session_checklist_2026-11-01_sD.md"
55
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | 🟡PARTIAL | e | x | y |'; } > "$T/sticky/session_checklist_2026-11-02_sD.md"
56
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | ✅DONE | e | — | — |'; } > "$T/sticky/session_checklist_2026-11-03_sD.md"
57
+ python3 "$R" --dir "$T/sticky" 2>&1 | grep -q 'M later reopened (non-DONE in the enum)=1 ' && ok "P7 reopening is sticky" || ng "P7"
58
+ # P8 a DONE row absent from the newest sheet counts in B (not re-judged), not as silence.
59
+ mkdir -p "$T/gone"
60
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | eps request | ✅DONE | e | — | — |'; } > "$T/gone/session_checklist_2026-11-01_sE.md"
61
+ { echo "$hdr"; echo '| 1 | 11-02 10:00 | other request | ✅DONE | e | — | — |'; } > "$T/gone/session_checklist_2026-11-02_sE.md"
62
+ python3 "$R" --dir "$T/gone" 2>&1 | grep -q '(blank, absent or outside the enum)=1 ' && ok "P8 absent row counted in B" || ng "P8"
63
+
64
+ # Codex R2: P9 sheets whose 상태 table lacks 시각/발화 → nothing measurable → not measured.
65
+ mkdir -p "$T/nocols"
66
+ for d in 01 02; do printf '| 상태 | 메모 |\n|---|---|\n| ✅DONE | x |\n' > "$T/nocols/session_checklist_2026-11-${d}_sF.md"; done
67
+ python3 "$R" --dir "$T/nocols" 2>&1 | grep -q 'measured=0 ' && ok "P9 no 시각/발화 columns → measured=0" || ng "P9"
68
+
69
+ # P10 a later «—» (outside the enum) is not a reopening: it counts in B, M stays 0.
70
+ mkdir -p "$T/dash"
71
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | zeta request | ✅DONE | e | — | — |'; } > "$T/dash/session_checklist_2026-11-01_sG.md"
72
+ { echo "$hdr"; echo '| 1 | 11-01 10:00 | zeta request | — | e | — | — |'; } > "$T/dash/session_checklist_2026-11-02_sG.md"
73
+ o="$(python3 "$R" --dir "$T/dash" 2>&1)"
74
+ echo "$o" | grep -q 'M later reopened (non-DONE in the enum)=0 ' && echo "$o" | grep -q 'outside the enum)=1 ' && ok "P10 «—» → B, not M" || ng "P10"
75
+
76
+ echo "claim_precision_report lanes: pass=$pass fail=$fail"
77
+ [ "$fail" = 0 ]