@chrono-meta/fh-gate 3.39.1 → 3.41.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 (65) 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 +20 -18
  5. package/README.zh.md +20 -18
  6. package/knowledge/shared/harness-core/claude_md_full_reference.md +8 -1
  7. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +9 -0
  8. package/knowledge/shared/harness-core/fh_module_contract.md +55 -1
  9. package/knowledge/shared/harness-core/lease_record_channel.md +26 -2
  10. package/knowledge/shared/harness-core/onboarding_acceleration_autopilot.md +7 -0
  11. package/knowledge/shared/learnings/subagent_invocations_log.yaml +36 -0
  12. package/knowledge/shared/rules/operations.md +1 -0
  13. package/package.json +14 -1
  14. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +52 -0
  17. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  19. package/scripts/adapters/gstack_content_safety.sh +2 -2
  20. package/scripts/adapters/mate_agent_boundary.sh +2 -2
  21. package/scripts/adapters/qasp_new_code_anchor.sh +2 -2
  22. package/scripts/adapters/qasp_web_rules.sh +2 -2
  23. package/scripts/agent_tools_pin.txt +16 -0
  24. package/scripts/catch_tally.py +216 -0
  25. package/scripts/claim_precision_report.py +138 -0
  26. package/scripts/fh_module_check.py +182 -1
  27. package/scripts/fh_session_load.sh +3 -1
  28. package/scripts/fixture_guard_lib.sh +38 -0
  29. package/scripts/generated_harness_check.py +4 -0
  30. package/scripts/lane_identity_tripwire.sh +35 -0
  31. package/scripts/package_coverage_check.sh +6 -2
  32. package/scripts/post_squash_verify.sh +53 -1
  33. package/scripts/pr_merge_verified.sh +57 -1
  34. package/scripts/probe_live_eval.sh +61 -0
  35. package/scripts/probe_live_eval_lib.py +47 -4
  36. package/scripts/selfcheck.sh +17 -0
  37. package/scripts/selfdev_merge_tier.sh +153 -0
  38. package/scripts/session_checklist.py +38 -1
  39. package/scripts/session_close_check.sh +79 -1
  40. package/scripts/shell_name_boundary_scan.sh +11 -3
  41. package/scripts/sim_isolated_run.sh +62 -1
  42. package/scripts/test_adapter_lanes.sh +3 -3
  43. package/scripts/test_agent_tools_pin_lanes.sh +73 -0
  44. package/scripts/test_catch_tally_lanes.sh +10 -0
  45. package/scripts/test_claim_precision_report_lanes.sh +77 -0
  46. package/scripts/test_doc_claims_1113_lanes.sh +36 -0
  47. package/scripts/test_fh_module_check_lanes.sh +106 -1
  48. package/scripts/test_fh_run_resolver_lanes.sh +1 -1
  49. package/scripts/test_fixture_git_env_lanes.sh +87 -0
  50. package/scripts/test_generated_harness_check_lanes.sh +8 -0
  51. package/scripts/test_lane_gap_hint_lanes.sh +2 -2
  52. package/scripts/test_locale_invariance_lanes.sh +3 -3
  53. package/scripts/test_name_boundary_locale_lanes.sh +66 -0
  54. package/scripts/test_package_coverage_lanes.sh +10 -0
  55. package/scripts/test_post_squash_verify_lanes.sh +23 -2
  56. package/scripts/test_pr_merge_verified_lanes.sh +62 -3
  57. package/scripts/test_probe_live_eval_lanes.sh +160 -5
  58. package/scripts/test_selfdev_merge_tier_lanes.sh +128 -0
  59. package/scripts/test_session_checklist_lanes.sh +57 -0
  60. package/scripts/test_session_close_chain_lanes.sh +93 -0
  61. package/scripts/test_session_close_lanes.sh +11 -0
  62. package/scripts/test_sim_isolated_run_lanes.sh +67 -0
  63. package/scripts/test_temper_check_lanes.sh +1 -1
  64. package/scripts/test_verdict_watermark_lanes.sh +1 -1
  65. package/templates/harness_birth_core.md +57 -0
@@ -344,6 +344,13 @@ def _failure_reason(base, arm):
344
344
  (sim_isolated_run.sh prints "(rc=<n>, ...)" there) and bytes from the actual output file's
345
345
  size (0 for a file that was never written). Purely a diagnostic label for the report/console —
346
346
  never used by score_probe, which stays unchanged."""
347
+ rc = _runner_rc(base, arm, 1)
348
+ said = _read_first_line(os.path.join(base, '%s_r1.txt' % arm)) if rc is not None else None
349
+ if said:
350
+ # The arm wrote text but the runner says it did not finish (a usage-limit reply) — show
351
+ # the rc AND what it said, since the text is exactly what the old scorer mistook for an answer.
352
+ # Empty text falls through to stderr, which then holds the real error.
353
+ return 'rc=%s (runner): %s' % (rc, said)
347
354
  stderr_line = _read_first_line(os.path.join(base, '%s_r1.stderr.txt' % arm))
348
355
  if stderr_line:
349
356
  return stderr_line
@@ -402,6 +409,25 @@ def _read_meta_tsv(path):
402
409
  return out
403
410
 
404
411
 
412
+ def _runner_rc(base, arm, i):
413
+ """The runner's recorded exit code for <arm>_r<i> when it is NONZERO, else None. A nonzero rc
414
+ means the rep did not finish (measured 2026-11-10/11: every usage-limit reply — 156 files across
415
+ a model-arms run and nightly 2026-10-27 — carried rc=1, every normal reply rc=0). The reply text
416
+ is never inspected: a normal answer that quotes limit wording must still be scored. No meta.tsv
417
+ (older runs) or no rc key -> None, i.e. scored exactly as before."""
418
+ m = _read_meta_tsv(os.path.join(base, '%s_r%d.meta.tsv' % (arm, i)))
419
+ rc = (m or {}).get('rc', '')
420
+ return rc if rc not in ('', '0') else None
421
+
422
+
423
+ def _rep_text(base, arm, i):
424
+ """Text of <arm>_r<i>, or None when the runner recorded a nonzero rc for it — so score_probe
425
+ returns FAILED-TO-RUN for a reply that exists but came from a run that did not finish."""
426
+ if _runner_rc(base, arm, i) is not None:
427
+ return None
428
+ return _read_text(os.path.join(base, '%s_r%d.txt' % (arm, i)))
429
+
430
+
405
431
  def budget_line(base, arms_reps):
406
432
  """BUDGET LINE (2026-10-17): the cap each verdict row ran under and whether any episode ENDED
407
433
  AT it. Read from the runner's per-episode meta.tsv (written from the real invocation) — never
@@ -409,7 +435,7 @@ def budget_line(base, arms_reps):
409
435
  its cap; otherwise UNKNOWN when any episode's value is UNKNOWN or its meta/field is missing
410
436
  (an older run, or a stub that wrote none — not measured is not `no`); otherwise no.
411
437
  Returns (ended_at_cap, text, n_yes, n_eps)."""
412
- ends, caps = [], set()
438
+ ends, caps, walls, wall_missing = [], set(), [], 0
413
439
  for arm, i in arms_reps:
414
440
  m = _read_meta_tsv(os.path.join(base, '%s_r%d.meta.tsv' % (arm, i)))
415
441
  if m is None:
@@ -418,8 +444,14 @@ def budget_line(base, arms_reps):
418
444
  # let 2 `no` + 1 missing read as `no`).
419
445
  if os.path.exists(os.path.join(base, '%s_r%d.txt' % (arm, i))):
420
446
  ends.append('UNKNOWN')
447
+ wall_missing += 1
421
448
  continue
422
449
  ends.append(m.get('ended_at_cap', 'UNKNOWN') or 'UNKNOWN')
450
+ w = m.get('wall_s', '') or ''
451
+ if re.fullmatch(r'[0-9]{1,9}', w): # ASCII digits only — '²'.isdigit() is True (codex R1)
452
+ walls.append(int(w))
453
+ else:
454
+ wall_missing += 1
423
455
  caps.add('timeout=%ss max_turns=%s tokens=%s' % (
424
456
  m.get('timeout_s', '?'), m.get('max_turns', '?'), m.get('token_cap', '?')))
425
457
  if not caps:
@@ -433,6 +465,17 @@ def budget_line(base, arms_reps):
433
465
  end = 'no'
434
466
  text = '%s ended_at_cap=%s%s' % ('; '.join(sorted(caps)), end,
435
467
  ' (%d/%d episodes)' % (n_yes, len(ends)) if n_yes else '')
468
+ # COST AXIS (2026-11-12, arXiv:2611.13541 / 2611.12122): a separate record next to the 1-bit
469
+ # verdict, never folded into it. Wall seconds only; tokens are not captured by the single-shot
470
+ # runner (plain-text output) and are printed as UNMEASURED, not 0.
471
+ if walls:
472
+ text += ' wall_s=%d..%d' % (min(walls), max(walls))
473
+ if wall_missing:
474
+ text += ' (%d/%d episodes unmeasured)' % (wall_missing, len(walls) + wall_missing)
475
+ else:
476
+ text += ' wall_s=UNMEASURED'
477
+ text += ' tokens_used=UNMEASURED'
478
+
436
479
  return end, text, n_yes, len(ends)
437
480
 
438
481
 
@@ -475,15 +518,15 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
475
518
  ctrl_b_absent = False # rep-1 only, diagnostic: which arm actually produced nothing
476
519
  per_rep = [] # [(verdict, phit, chit, primary_text, control_text)]
477
520
  for i in range(1, reps + 1):
478
- pt = _read_text(os.path.join(base, 'primary_r%d.txt' % i))
479
- ct = _read_text(os.path.join(base, 'control_r%d.txt' % i))
521
+ pt = _rep_text(base, 'primary', i)
522
+ ct = _rep_text(base, 'control', i)
480
523
  ct_first_arm_ran = bool(ct)
481
524
  if has_ctrl_b:
482
525
  # A declared second control that produced nothing did NOT run — and a probe whose
483
526
  # calibration arm did not run has not been calibrated. Collapsing that into "the
484
527
  # control stayed silent, so the pattern discriminates" is the not-found-is-not-zero
485
528
  # defect pointed at the calibration channel instead of the measurement channel.
486
- ctb = _read_text(os.path.join(base, 'control_b_r%d.txt' % i))
529
+ ctb = _rep_text(base, 'control_b', i)
487
530
  if not ctb:
488
531
  ct = None
489
532
  if i == 1 and ct_first_arm_ran:
@@ -12,6 +12,11 @@
12
12
  # Wiring: `npm test` for any session; `prepublishOnly` so a publish cannot ship a
13
13
  # syntactically broken executable.
14
14
  set -u
15
+ # Inherited git environment reaches every lane: an exported GIT_DIR / GIT_INDEX_FILE makes a lane's
16
+ # `git -C <fixture> commit` write into THAT repo (measured 2026-11-13 on a decoy: 70 of 90 git-using lanes do not
17
+ # source fixture_guard_lib.sh). Same list as fixture_guard_lib.sh (repo-targeting vars only; GIT_CONFIG_* stay —
18
+ # CI carries -c safe.directory there); precedent sync-to-be.sh / session_close_check.sh.
19
+ unset GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_OBJECT_DIRECTORY GIT_DIR GIT_WORK_TREE GIT_IMPLICIT_WORK_TREE GIT_GRAFT_FILE GIT_INDEX_FILE GIT_NO_REPLACE_OBJECTS GIT_REPLACE_REF_BASE GIT_PREFIX GIT_SHALLOW_FILE GIT_COMMON_DIR GIT_NAMESPACE 2>/dev/null || true
15
20
  cd "$(dirname "${BASH_SOURCE[0]}")/.."
16
21
  fail=0
17
22
 
@@ -1184,6 +1189,8 @@ for _pair in \
1184
1189
  "scripts/ablation_nominate.py|scripts/test_ablation_nominate_lanes.sh" \
1185
1190
  `# 리스 기록 채널(2026-11-07). 세션은 초안, 기록은 운영자 — 에이전트 셸 거부 · 코드 불일치 무기록 · 원자적 교체.` \
1186
1191
  "scripts/lease_line_apply.sh|scripts/test_lease_line_apply_lanes.sh" \
1192
+ `# 공유 세션 장부(2026-11-11 시범). 실무 세션이 쓰고 루트가 읽는다 — 안 적은 세션은 NOT-WRITTEN, 깨진 줄은 MALFORMED.` \
1193
+ "scripts/session_ledger_read.py|scripts/test_session_ledger_lanes.sh" \
1187
1194
  `# 맥락 유지 읽는 절반(2026-11-07). 상태 주장 뒤 리스 줄 한 줄 · 착지 판정 — 못 읽음은 OK 가 아니다.` \
1188
1195
  "scripts/state_claim_recheck_hook.sh|scripts/test_state_claim_recheck_lanes.sh" \
1189
1196
  "scripts/governor_landing_check.py|scripts/test_governor_landing_check_lanes.sh" \
@@ -1236,11 +1243,14 @@ for _pair in \
1236
1243
  `# ── mutation_probe (2026-10-07) — revert_probe 의 «저자가 고른 변이 1개» 를 연산자 생성 변이로 넓힌 것. 앵커가 고정하는 것은 생성기 보정(리다이렉트 비변이)과 «못 잰 것은 2» 다 ──` \
1237
1244
  "scripts/mutation_probe.py|scripts/test_mutation_probe_lanes.sh" \
1238
1245
  "scripts/cartridge_admit.py|scripts/test_cartridge_admit_lanes.sh" \
1246
+ "scripts/agent_tools_pin.txt|scripts/test_agent_tools_pin_lanes.sh" \
1239
1247
  `# ── live-eval — the live twin of the static /prompt-regression probe check (2026-09-04) ──` \
1240
1248
  "scripts/probe_live_eval.sh|scripts/test_probe_live_eval_lanes.sh" \
1241
1249
  "scripts/probe_live_eval_lib.py|scripts/test_probe_live_eval_lanes.sh" \
1242
1250
  "templates/.git-hooks/pre-commit|scripts/test_marker_first_use_lanes.sh" \
1243
1251
  "scripts/fixture_guard_lib.sh|scripts/test_fixture_guard_lanes.sh" \
1252
+ "scripts/fixture_guard_lib.sh|scripts/test_fixture_git_env_lanes.sh" \
1253
+ "scripts/lane_identity_tripwire.sh|scripts/test_fixture_git_env_lanes.sh" \
1244
1254
  "scripts/stray_path_scan.sh|scripts/test_stray_path_lanes.sh" \
1245
1255
  "scripts/session_close_check.sh|scripts/test_stray_path_lanes.sh" \
1246
1256
  `# ── ①-g stale-ref (2026-09-21 신설) — #773 이 「배선 안 함」이라 적은 자리의 호출부. SUBJECT 는 스캐너가 아니라 «마감 블록»이다: 스캐너 자체는 test_stale_ref_scan_lanes.sh 가 이미 앵커한다 ──` \
@@ -1251,6 +1261,7 @@ for _pair in \
1251
1261
  # 운영자 지적: «내 발화가 도중에 열화되었다 … 테스트 한 차례 끝날 때마다 들여다봐야 할 것 같다».
1252
1262
  # SUBJECT 를 session_checklist.py 로 잡는다 — 이 레인이 재는 것은 그 도구의 판정이다.` \
1253
1263
  "scripts/session_checklist.py|scripts/test_checklist_unblocked_lanes.sh" \
1264
+ "scripts/claim_precision_report.py|scripts/test_claim_precision_report_lanes.sh" \
1254
1265
  "templates/.git-hooks/pre-commit|scripts/test_hook_leg_wiring_lanes.sh" \
1255
1266
  ".claude/soul_tenets.txt|scripts/test_marker_soul_tenet_lanes.sh" \
1256
1267
  "docs/map/fh_assets.architecture.json|scripts/test_fh_map_paths_lanes.sh" \
@@ -1282,6 +1293,9 @@ for _pair in \
1282
1293
  "scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
1283
1294
  "plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
1284
1295
  "scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
1296
+ "scripts/catch_tally.py|scripts/test_catch_tally_lanes.sh" \
1297
+ "scripts/shell_name_boundary_scan.sh|scripts/test_name_boundary_locale_lanes.sh" \
1298
+ "scripts/catch_tally.py|scripts/test_doc_claims_1113_lanes.sh" \
1285
1299
  "scripts/digest_slow_leg.py|scripts/test_digest_slow_leg_lanes.sh" \
1286
1300
  "scripts/script_caller_ratchet.sh|scripts/test_script_caller_ratchet_lanes.sh" \
1287
1301
  "scripts/script_caller_ratchet.sh|scripts/test_runner_surface_index_lanes.sh" \
@@ -3052,6 +3066,9 @@ else
3052
3066
  echo "SKIP rules-dotfile (package mode: .git 없음 — 소스 트리 전용 검사)"
3053
3067
  fi
3054
3068
 
3069
+ # Lane-identity tripwire — record-only: a WARN line, never a FAIL (a hit is a past event in the
3070
+ # repo, not this run's verdict). Runs AFTER the lanes, which is when a leaked commit would have just landed.
3071
+ if [ -f scripts/lane_identity_tripwire.sh ]; then bash scripts/lane_identity_tripwire.sh . | grep -v '^LANE-TRIPWIRE ok' ; fi
3055
3072
  if [ "$_CONSUMER" -eq 1 ]; then
3056
3073
  _n=$(printf '%s\n' $CONSUMER_SKIPPED | grep -c .)
3057
3074
  echo "CONSUMER PROFILE — $_n checkout-only suite(s) NOT measured here (not a pass):$CONSUMER_SKIPPED"
@@ -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:
@@ -450,6 +516,18 @@ if [ "$COMMITS_TODAY" -gt 0 ] && [ ! -f "$FC" ]; then
450
516
  FAIL=1
451
517
  fi
452
518
 
519
+ # ⑤-catches (RECORD-ONLY — never sets FAIL). Wrap-up ⑤(a) asks every close for a «## 잡은 것» section
520
+ # (or «## Catches»), which scripts/catch_tally.py counts. Measured 2026-11-13: 0 of 69 daily files
521
+ # (2026-09-01..11-13) carried it, 6 of them after the step shipped (#1058) — nothing reported the absence.
522
+ # This line states a property of today's record (present / absent), not a verdict on the session.
523
+ if [ -f "$FC" ]; then
524
+ if grep -qE '^##[[:space:]]+(잡은 것|Catches)[[:space:]]*$' "$FC"; then
525
+ echo "✅ ⑤-catches fh_completed_${TODAY}.md has a «## 잡은 것» section"
526
+ else
527
+ echo "ⓘ ⑤-catches fh_completed_${TODAY}.md has no «## 잡은 것» section (record only) — add the table, or «0건 — <what you looked at>»"
528
+ fi
529
+ fi
530
+
453
531
  # ④-b npm freshness — files[] assets changed since last version tag → republish owed.
454
532
  # Patterns are NARROWED to the actually-shipped subpaths (package.json files[]): knowledge/ ships only
455
533
  # shared/{harness-core,dialogue,rules}; docs/ ships only {codex-compat,CONTRIBUTING,pillars}. A broad
@@ -4,16 +4,24 @@
4
4
  # 🟥 왜 있나. 2026-08-31 하루에 **세 번** 나왔고 셋 다 자력 적발이 아니었다:
5
5
  # ① zsh "$ref:scripts/x" 콜론 뒤를 «modifier» 로 먹는다 — 에러가 아니라 «다른 유효 문자열»
6
6
  # ② zsh set -- $pair 인용 없는 전개가 리스트가 안 된다 — 여러 낱말이 한 낱말로
7
- # ③ bash "$V»" 다국어 문자가 «변수명»에 붙는다 — 이름 `V»` → unbound variable
7
+ # ③ bash "$V" 바로 뒤 » 꼴 다국어 문자가 «변수명»에 붙는다 — 이름 `V»` → unbound variable
8
8
  # 공통형: **셸이 이름 경계를 다르게 읽는데 그게 조용하다**(①은 완전 무음, ③만 시끄럽다).
9
9
  #
10
10
  # ⚠️ **이 스캐너는 셋 중 «둘»만 덮는다** — ①과 ③. ②(단어분할)는 문법이 아니라 «의도»라
11
11
  # 정적으로 못 가른다. 안 덮는 것을 덮는 척하지 않는다.
12
12
  # ⚠️ 주석 안의 히트도 «보고한다» — 제외하면 진짜를 놓치는 쪽으로 기운다. 사람이 판정해라.
13
+ #
14
+ # --nonascii-only : ③ 만 본다(주석 줄도 본다 — 여러 줄 문자열·heredoc 안의 «#» 줄은 실행되는 글이라
15
+ # «주석처럼 보이는 줄» 을 빼면 진짜를 놓친다, 2026-11-13 교차 계열 지적) — selfcheck 레인(test_name_boundary_locale_lanes.sh)이
16
+ # 출하 셸 전체에 거는 모드. ③ 은 맥 기본 UTF-8 로캘(ko_KR · en_US)에서 bash 3.2 와 bash 5 둘 다
17
+ # rc 127 로 죽인다(2026-11-13 실측, LC_ALL=C 만 무사) — 리눅스 CI 는 이 얼굴을 못 본다.
13
18
  set -uo pipefail
14
- [ $# -gt 0 ] || { echo "usage: shell_name_boundary_scan.sh <file...>"; exit 2; }
19
+ [ $# -gt 0 ] || { echo "usage: shell_name_boundary_scan.sh [--nonascii-only] <file...>"; exit 2; }
15
20
  python3 - "$@" <<'PY'
16
21
  import re,sys,io
22
+ CODE_ONLY = len(sys.argv)>1 and sys.argv[1]=='--nonascii-only'
23
+ if CODE_ONLY: del sys.argv[1]
24
+ if len(sys.argv)<2: print("usage: shell_name_boundary_scan.sh [--nonascii-only] <file...> — no files given (nothing scanned)"); sys.exit(2)
17
25
  NONASCII=re.compile(r'\$[A-Za-z_][A-Za-z0-9_]*(?=[^\x00-\x7F])') # ③
18
26
  MODIFIER=re.compile(r'"\$[A-Za-z_][A-Za-z0-9_]*:') # ① (중괄호 없는 "$V:...")
19
27
  hits=0
@@ -23,7 +31,7 @@ for f in sys.argv[1:]:
23
31
  for i,l in enumerate(s.split('\n'),1):
24
32
  for m in NONASCII.finditer(l):
25
33
  print(" 🟥 %s:%d [비-ASCII가 이름에 붙음] %s → %s"%(f,i,m.group(0),l.strip()[:64])); hits+=1
26
- for m in MODIFIER.finditer(l):
34
+ for m in ([] if CODE_ONLY else MODIFIER.finditer(l)):
27
35
  print(" 🟥 %s:%d [zsh modifier 로 먹힐 수 있음] %s → %s"%(f,i,m.group(0),l.strip()[:64])); hits+=1
28
36
  print(" 히트 %d 건 (0 이면 이 두 얼굴은 없다 — 나머지 하나는 이 계기가 «안 본다»)"%hits)
29
37
  sys.exit(1 if hits else 0)
@@ -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