@chrono-meta/fh-gate 3.44.0 โ†’ 3.46.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 (101) hide show
  1. package/.claude/rules/fh_4axis_gate.md +50 -608
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/CATALOG.md +21 -0
  4. package/CHEATSHEET.md +13 -3
  5. package/docs/codex-compat.md +1 -1
  6. package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
  7. package/knowledge/shared/harness-core/fh_detail_protocols.md +1 -0
  8. package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
  9. package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
  10. package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
  11. package/knowledge/shared/learnings/subagent_invocations_log.yaml +209 -0
  12. package/package.json +19 -1
  13. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  14. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +9 -8
  15. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +20 -0
  16. package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +12 -6
  17. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-meta/CHANGELOG.md +122 -0
  19. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -0
  20. package/plugins/fh-meta/skills/context-doctor/SKILL.md +1 -0
  21. package/plugins/fh-meta/skills/deep-clarify/SKILL.md +76 -22
  22. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +2 -2
  23. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
  24. package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +6 -0
  25. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +2 -1
  26. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  27. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  28. package/scripts/agy_launch_guard.sh +117 -1
  29. package/scripts/below_floor_scan.sh +30 -0
  30. package/scripts/codex_launch_guard.sh +38 -2
  31. package/scripts/correction_moments.py +23 -2
  32. package/scripts/fh-gate.sh +612 -14
  33. package/scripts/fh-goal.sh +56 -12
  34. package/scripts/fh-run.sh +1 -1
  35. package/scripts/fh_gate_exec.sh +272 -0
  36. package/scripts/fh_session_load.sh +17 -0
  37. package/scripts/finding_fleet.sh +2 -1
  38. package/scripts/finding_verifier.sh +2 -1
  39. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
  40. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
  41. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
  42. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
  43. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
  44. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
  45. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
  46. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
  47. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
  48. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
  49. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
  50. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
  51. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
  52. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
  53. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
  54. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
  55. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
  56. package/scripts/heavy_skill_smell.py +311 -0
  57. package/scripts/job_heartbeat.py +186 -0
  58. package/scripts/live_eval_matrix.py +128 -0
  59. package/scripts/live_eval_trace.py +197 -4
  60. package/scripts/package_coverage_check.sh +18 -0
  61. package/scripts/pr_merge_verified.sh +14 -4
  62. package/scripts/prepush_guard_check.sh +8 -0
  63. package/scripts/probe_live_eval.sh +32 -0
  64. package/scripts/probe_live_eval_lib.py +8 -2
  65. package/scripts/selfcheck.sh +113 -0
  66. package/scripts/selfcheck_shard_weights.txt +2 -0
  67. package/scripts/sidecar_calibrate.sh +7 -5
  68. package/scripts/sim_isolated_run.sh +20 -0
  69. package/scripts/test_agy_launch_guard_lanes.sh +120 -0
  70. package/scripts/test_below_floor_scan_lanes.sh +85 -0
  71. package/scripts/test_codex_launch_guard_lanes.sh +45 -0
  72. package/scripts/test_correction_moments_lanes.sh +37 -0
  73. package/scripts/test_deep_clarify_interview_lanes.sh +108 -0
  74. package/scripts/test_deep_clarify_spec_path_lanes.sh +91 -0
  75. package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
  76. package/scripts/test_fh_gate_defaults_lanes.sh +188 -0
  77. package/scripts/test_fh_gate_exec_lanes.sh +244 -0
  78. package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
  79. package/scripts/test_fh_gate_regressions.sh +92 -1
  80. package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
  81. package/scripts/test_finding_pipeline_lanes.sh +35 -1
  82. package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
  83. package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
  84. package/scripts/test_job_heartbeat_lanes.sh +96 -0
  85. package/scripts/test_live_eval_construct_lanes.sh +29 -6
  86. package/scripts/test_live_eval_matrix_lanes.sh +53 -0
  87. package/scripts/test_live_eval_trace_lanes.sh +132 -5
  88. package/scripts/test_name_boundary_locale_lanes.sh +36 -5
  89. package/scripts/test_pr_merge_verified_lanes.sh +15 -2
  90. package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
  91. package/scripts/test_probe_live_eval_lanes.sh +44 -0
  92. package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
  93. package/scripts/test_sidecar_calibrate_lanes.sh +1 -1
  94. package/scripts/test_sim_isolated_run_lanes.sh +43 -0
  95. package/scripts/universal_guard_check.sh +8 -0
  96. package/scripts/worktree_reclaim.sh +1 -1
  97. package/templates/.claude/rules/mcp_tool_gating.md +27 -0
  98. package/templates/.git-hooks/pre-push +60 -3
  99. package/templates/PRE-PUBLISH-CHECKLIST.md +22 -0
  100. package/templates/regression_guard.sh +8 -4
  101. package/templates/settings.LaneGap.snippet.json +27 -0
@@ -46,7 +46,7 @@ setup() {
46
46
  git clone -q "$d/origin.git" "$d/work" 2>/dev/null; git -C "$d/work" fetch -q origin feat
47
47
  printf '%s' "$(git -C "$d/seed" rev-parse feat)" > "$d/head.oid"
48
48
  }
49
- # fake gh. Behaviour knobs via files in $D: view_fail ยท merge_fail ยท drop_b
49
+ # fake gh. Behaviour knobs via files in $D: view_fail ยท merge_fail ยท drop_b ยท trunc (headRefOid cut to 37 chars)
50
50
  mkgh() {
51
51
  local D="$1"; mkdir -p "$D/bin"
52
52
  cat > "$D/bin/gh" <<EOF
@@ -67,7 +67,7 @@ case "\$1 \$2" in
67
67
  elif [ -f "\$D/closed" ]; then echo "CLOSED \$(cat "\$D/head.oid")"
68
68
  else echo "OPEN \$(cat "\$D/head.oid")"; fi ;;
69
69
  *title*) echo "Fake PR title" ;;
70
- *headRefOid*) cat "\$D/head.oid"; echo ;;
70
+ *headRefOid*) if [ -f "\$D/trunc" ]; then cut -c1-37 "\$D/head.oid"; else cat "\$D/head.oid"; echo; fi ;;
71
71
  *state*) if [ -f "\$D/merge.oid" ] && [ ! -f "\$D/queued" ]; then echo MERGED; else echo OPEN; fi ;;
72
72
  *mergeCommit*) if [ -f "\$D/queued" ]; then echo null; else cat "\$D/merge.oid" 2>/dev/null; echo; fi ;; esac ;;
73
73
  "pr merge")
@@ -318,5 +318,18 @@ elif grep -q 'recorded, not enforced' "$SC"; then bad "L33 header still says the
318
318
  elif ! grep -q '^#.*lease (.*TIER=AUTO, see EXIT 7)' "$SC"; then bad "L33 RECEIPT lease note no longer points at the TIER=AUTO / EXIT 7 enforcement"
319
319
  else ok "L33 header does not contradict EXIT 7 (lease is enforced)"; fi
320
320
 
321
+ # โ”€โ”€ a commit id cut short (an output-compression proxy shortened a hash in a field run: 37 of 40 chars) โ”€โ”€
322
+ # L34 the PR head read from gh is not a full 40/64-hex id โ†’ refused BEFORE the merge, by name. A 37-char prefix still
323
+ # resolves locally (git accepts abbreviations), so without the check the merge call went out with it.
324
+ setup tr; mkgh "$T/tr"; : > "$T/tr/trunc"; run "$T/tr" 7 --rerun "$GOOD"
325
+ { [ "$RC" -eq 4 ] && ! merged "$T/tr" && printf '%s' "$OUT" | grep -q 'not a full 40- or 64-hex commit id'; } \
326
+ && ok "L34 PR head cut to 37 chars โ†’ rc=4 BEFORE merge, named" \
327
+ || { bad "L34 truncated head rc=$RC merged=$(merged "$T/tr" && echo yes || echo no)"; printf '%s\n' "$OUT" | tail -3; }
328
+ # L35 the caller's --expect-head cut short โ†’ usage refusal (rc=2) before anything is read or merged
329
+ setup te; mkgh "$T/te"; run "$T/te" 7 --rerun "$GOOD" --expect-head "$(cut -c1-37 "$T/te/head.oid")"
330
+ { [ "$RC" -eq 2 ] && ! merged "$T/te" && printf '%s' "$OUT" | grep -q -- '--expect-head is not a full 40- or 64-hex commit id'; } \
331
+ && ok "L35 --expect-head cut to 37 chars โ†’ rc=2, no merge, named" \
332
+ || { bad "L35 truncated --expect-head rc=$RC merged=$(merged "$T/te" && echo yes || echo no)"; printf '%s\n' "$OUT" | tail -3; }
333
+
321
334
  printf 'PASS %d ยท FAIL %d\n' "$PASS" "$FAIL"
322
335
  [ "$FAIL" -eq 0 ]
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env bash
2
+ # test_prepush_marker_lookup_lanes.sh โ€” the pre-push Load-Bearing gate must find THIS branch's marker where the
3
+ # pre-commit hook writes it (the main checkout's tracks/_meta, i.e. EVIDENCE_ROOT), and nothing else.
4
+ #
5
+ # Why (2026-11-15, found pushing FH #1118 from a worktree): the gate read `$REPO_ROOT/tracks/_meta` โ€” the worktree's
6
+ # own folder โ€” and took the newest marker of ANY branch. Two wrong answers followed from one line:
7
+ # W1 a worktree push was BLOCKED although its branch's marker existed in the main checkout;
8
+ # M1 a main-checkout push PASSED on another branch's marker.
9
+ # Lanes (each in a throwaway clone of this checkout with a bare origin; nothing here touches the real repo):
10
+ # W1 worktree, marker for the pushed branch in the main checkout only โ†’ push passes
11
+ # M1 main checkout, only a FOREIGN branch's marker (newer) โ†’ push blocked
12
+ # M2 control: main checkout, the pushed branch's own marker โ†’ push passes
13
+ # M3 control: main checkout, no marker at all โ†’ push blocked
14
+ # M4 only a longer branch's marker (lane/m4_extra for lane/m4 โ€” glob prefix) โ†’ push blocked
15
+ # M5 two local branches share one marker name (lane/m5 ยท lane_m5) โ†’ push blocked
16
+ # M6 same as M5 plus a tag of that name (the short refname would hide the collision) โ†’ push blocked
17
+ # M7 <sha>:refs/heads/lane/m7 while standing on a branch that has a marker โ†’ push blocked
18
+ # M8 <sha>:refs/heads/lane/m8, no local lane/m8, a local lane_m8 with a marker โ†’ push blocked
19
+ # W1/M2 ยซgate-passยป = rc 0 AND the gate printed its โœ… line (proves the hook ran, not just that the push worked)
20
+ # N1 control: a push that carries no load-bearing file, no marker โ†’ push passes (gate not involved)
21
+ # N2 an outside contributor's clone (no tracks/_meta), load-bearing file, no marker โ†’ push passes (FH-dev scope)
22
+ # Exit 0 all lanes pass ยท 1 a lane failed ยท 2 harness error.
23
+ set -uo pipefail
24
+ . "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
25
+ SRC=$(cd "$(dirname "$0")/.." 2>/dev/null && pwd) || { echo "HARNESS-ERROR: cannot resolve the repo root"; exit 2; }
26
+ [ -f "$SRC/templates/.git-hooks/pre-push" ] || { echo "HARNESS-ERROR: no pre-push hook in $SRC"; exit 2; }
27
+ W=$(mktemp -d "${TMPDIR:-/tmp}/prepush-marker.XXXX") || { echo "HARNESS-ERROR: mktemp"; exit 2; }
28
+ trap 'rm -rf "$W"' EXIT
29
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK FH_SESSION_CLOSE 2>/dev/null || true
30
+ G() { git -c user.name=lane -c user.email=lane@localhost -c commit.gpgsign=false "$@"; }
31
+ TODAY=$(date +%Y-%m-%d)
32
+ pass=0; fail=0
33
+
34
+ # one fixture = a clone of this checkout (committed HEAD + this working tree's hook, so the hook under test is the
35
+ # one on disk), a bare origin, hooks wired by absolute path like the operator's setup.
36
+ fixture() { # $1 = dir
37
+ local d="$1"
38
+ G clone -q --no-hardlinks "$SRC" "$d/main" < /dev/null || return 1
39
+ cp "$SRC/templates/.git-hooks/pre-push" "$d/main/templates/.git-hooks/pre-push" || return 1
40
+ G init -q --bare "$d/origin.git" < /dev/null || return 1
41
+ G -C "$d/main" remote set-url origin "$d/origin.git" || return 1
42
+ G -C "$d/main" push -q --no-verify origin HEAD:refs/heads/main < /dev/null || return 1
43
+ G -C "$d/main" fetch -q origin < /dev/null || return 1
44
+ G -C "$d/main" config core.hooksPath "$d/main/templates/.git-hooks" || return 1 # checked (codex R2)
45
+ mkdir -p "$d/main/tracks/_meta" || return 1
46
+ }
47
+ lb_commit() { # $1 = repo dir ยท $2 = branch โ€” a commit touching a load-bearing path
48
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
49
+ lb_change "$1" "$2"
50
+ }
51
+ lb_change() { # $1 = repo dir ยท $2 = label โ€” the change itself, every step checked (codex R1: an unchecked failure
52
+ # left the branch at origin/main, so the push carried nothing load-bearing and ยซpassedยป without exercising the gate)
53
+ printf '\n# lane %s\n' "$2" >> "$1/scripts/predelete_check.sh" || return 1
54
+ G -C "$1" add scripts/predelete_check.sh || return 1
55
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null || return 1
56
+ [ -n "$(G -C "$1" log --format=%h origin/main..HEAD -- scripts/predelete_check.sh)" ] || return 1
57
+ }
58
+ plain_commit() { # $1 = repo dir ยท $2 = branch โ€” a commit touching no load-bearing path
59
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
60
+ printf 'lane\n' > "$1/lane_note_${2//\//_}.txt"; G -C "$1" add "lane_note_${2//\//_}.txt"
61
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null
62
+ }
63
+ marker() { # $1 = evidence dir ยท $2 = branch
64
+ printf 'crossfamily: panel(codex) โ€” residency=CLEAN(files=1) ยท evidence=SHARED(lane) ยท R1 no S/A\n' \
65
+ > "$1/tracks/_meta/.axes_23_passed_${2//\//_}_${TODAY}.marker"
66
+ }
67
+ push() { # $1 = repo dir ยท $2 = branch โ†’ prints rc
68
+ G -C "$1" push origin "$2" > "$W/last_push.log" 2>&1 < /dev/null; echo $?
69
+ }
70
+ lane() { # $1 id ยท $2 want (pass | gate-pass = pass AND the gate printed its โœ… line | block) ยท $3 rc
71
+ if { [ "$2" = pass ] && [ "$3" -eq 0 ]; } \
72
+ || { [ "$2" = gate-pass ] && [ "$3" -eq 0 ] && grep -q 'โœ… FH Load-Bearing Change Gate' "$W/last_push.log"; } \
73
+ || { [ "$2" = block ] && [ "$3" -ne 0 ] && grep -q 'no cross-family leg recorded' "$W/last_push.log"; }; then
74
+ pass=$((pass+1)); echo " โœ… $1 (want $2, rc=$3)"
75
+ else
76
+ fail=$((fail+1)); echo " โŒ $1 โ€” want $2, got rc=$3"; awk '/โ›”|โŒ|error/ && n < 4 { n++; print " " $0 }' "$W/last_push.log"
77
+ fi
78
+ }
79
+ echo "pre-push marker lookup lanes"
80
+
81
+ # W1 โ€” worktree push, marker only in the main checkout
82
+ D="$W/w1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture W1"; exit 2; }
83
+ G -C "$D/main" worktree add -q "$D/wt" -b lane/w1 origin/main < /dev/null || { echo "HARNESS-ERROR: worktree"; exit 2; }
84
+ mkdir -p "$D/wt/tracks/_meta" # the real worktrees have this folder too (it is gitignored, created by tools)
85
+ lb_change "$D/wt" w1 || { echo "HARNESS-ERROR: commit W1"; exit 2; }
86
+ marker "$D/main" lane/w1
87
+ lane W1 gate-pass "$(push "$D/wt" lane/w1)"
88
+
89
+ # M1 โ€” main checkout, only a foreign (newer) marker
90
+ D="$W/m1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M1"; exit 2; }
91
+ lb_commit "$D/main" lane/m1 || { echo "HARNESS-ERROR: commit M1"; exit 2; }
92
+ marker "$D/main" lane/someone-else
93
+ lane M1 block "$(push "$D/main" lane/m1)"
94
+
95
+ # M2 โ€” main checkout, own marker
96
+ marker "$D/main" lane/m1
97
+ lane M2 gate-pass "$(push "$D/main" lane/m1)"
98
+
99
+ # M4 โ€” prefix collision: only a LONGER branch's marker (lane/m1 already pushed; lane_m4_extra is not lane/m4's)
100
+ G -C "$D/main" switch -q -c lane/m4 origin/main < /dev/null && lb_change "$D/main" m4 || { echo "HARNESS-ERROR: commit M4"; exit 2; }
101
+ marker "$D/main" lane/m4_extra
102
+ lane M4 block "$(push "$D/main" lane/m4)"
103
+
104
+ # M5 โ€” slug collision: lane/m5 and lane_m5 both exist locally; the one marker cannot be attributed to either
105
+ G -C "$D/main" branch -q lane_m5 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M5"; exit 2; }
106
+ G -C "$D/main" switch -q -c lane/m5 origin/main < /dev/null && lb_change "$D/main" m5 || { echo "HARNESS-ERROR: commit M5"; exit 2; }
107
+ marker "$D/main" lane/m5
108
+ lane M5 block "$(push "$D/main" lane/m5)"
109
+
110
+ # M6 โ€” tag ambiguity: lane/m6 and lane_m6 both exist AND a tag lane_m6 (refname:short would print heads/lane_m6)
111
+ G -C "$D/main" branch -q lane_m6 origin/main < /dev/null && G -C "$D/main" tag lane_m6 origin/main < /dev/null || { echo "HARNESS-ERROR: refs M6"; exit 2; }
112
+ G -C "$D/main" switch -q -c lane/m6 origin/main < /dev/null && lb_change "$D/main" m6 || { echo "HARNESS-ERROR: commit M6"; exit 2; }
113
+ marker "$D/main" lane/m6
114
+ lane M6 block "$(push "$D/main" lane/m6)"
115
+
116
+ # M7 โ€” commit-expression refspec: standing on lane/m1 (its marker exists), push an unreviewed load-bearing commit to a
117
+ # NEW branch name with <sha>:refs/heads/lane/m7 โ€” it must need lane/m7's marker, not borrow lane/m1's
118
+ G -C "$D/main" switch -q -c lane/m7-src origin/main < /dev/null && lb_change "$D/main" m7 || { echo "HARNESS-ERROR: commit M7"; exit 2; }
119
+ M7SHA=$(G -C "$D/main" rev-parse HEAD); G -C "$D/main" switch -q lane/m1 < /dev/null || { echo "HARNESS-ERROR: switch M7"; exit 2; }
120
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m7" > "$W/last_push.log" 2>&1 < /dev/null; lane M7 block "$?"
121
+
122
+ # M8 โ€” <sha>:refs/heads/lane/m8 where lane/m8 does not exist locally but lane_m8 does, with a marker โ†’ blocked
123
+ G -C "$D/main" branch -q lane_m8 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M8"; exit 2; }
124
+ marker "$D/main" lane_m8
125
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m8" > "$W/last_push.log" 2>&1 < /dev/null; lane M8 block "$?"
126
+
127
+ # M3 โ€” main checkout, no marker
128
+ D="$W/m3"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M3"; exit 2; }
129
+ lb_commit "$D/main" lane/m3 || { echo "HARNESS-ERROR: commit M3"; exit 2; }
130
+ lane M3 block "$(push "$D/main" lane/m3)"
131
+
132
+ # N1 โ€” no load-bearing file, no marker
133
+ plain_commit "$D/main" lane/n1 || { echo "HARNESS-ERROR: commit N1"; exit 2; }
134
+ lane N1 pass "$(push "$D/main" lane/n1)"
135
+
136
+ # N2 โ€” an outside contributor's clone (no tracks/_meta anywhere), load-bearing file, no marker โ†’ not blocked by this gate
137
+ D="$W/n2"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture N2"; exit 2; }
138
+ rm -rf "$D/main/tracks/_meta"
139
+ lb_commit "$D/main" lane/n2 || { echo "HARNESS-ERROR: commit N2"; exit 2; }
140
+ lane N2 pass "$(push "$D/main" lane/n2)"
141
+
142
+ echo "pre-push marker lookup lanes: $pass passed, $fail failed"
143
+ [ "$fail" -eq 0 ]
@@ -878,6 +878,50 @@ fi
878
878
  _lane SF3 state-fp "verdict row identical across runs whose end states differ" "yes" \
879
879
  "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/sf_b.md")" ] && echo yes || echo no)"
880
880
 
881
+ # BP1-BP4 behaviour profile (2026-11-17): one record-only line per rep, appended after the verdict.
882
+ # BP1 the budget stub writes no stream โ†’ MISSING for both arms (not measured โ‰  0).
883
+ _lane BP1 behave-prof "stub without stream: report carries 'trace=MISSING' for both arms" "2" \
884
+ "$(grep -cE '^behaviour-profile: G-GREET-01 (primary|control) r1 trace=MISSING$' "$T/bud_report.md")"
885
+ # BP2 a stub that writes a stream: primary explores + runs a test, control only explores. The stub writes no
886
+ # tool_result, so first_error is ยซunknownยป (not measured), never ยซnoneยป.
887
+ cat > "$BSTUB/fake_sim_trace.sh" <<'FAKETRACE'
888
+ #!/usr/bin/env bash
889
+ arm=""; out=""
890
+ while [ $# -gt 0 ]; do case "$1" in --arm) arm="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac; done
891
+ mkdir -p "$out"
892
+ printf 'stub body %s\n' "$arm" > "$out/${arm}_r1.txt"
893
+ printf 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\tno\n' > "$out/${arm}_r1.meta.tsv"
894
+ if [ "$arm" = primary ]; then cmd='bash scripts/test_x_lanes.sh'; else cmd='ls tracks'; fi
895
+ { printf '{"type":"system","subtype":"init","tools":["Read","Bash"],"mcp_servers":[]}\n'
896
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"a","name":"Read","input":{"file_path":"CATALOG.md"}}]}}\n'
897
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"b","name":"Bash","input":{"command":"%s"}}]}}\n' "$cmd"
898
+ printf '{"type":"result","subtype":"success","result":"stub body"}\n'; } > "$out/${arm}_r1.stream.jsonl"
899
+ [ "$arm" = control ] && [ "${FH_TRACE_STUB_BAD:-no}" = yes ] && printf 'not json\x00' > "$out/${arm}_r1.stream.jsonl" && chmod 000 "$out/${arm}_r1.stream.jsonl"
900
+ echo "RESULT: CLEAN"; exit 0
901
+ FAKETRACE
902
+ chmod +x "$BSTUB/fake_sim_trace.sh"
903
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" \
904
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp.md" ) >"$T/bp.log" 2>&1
905
+ _lane BP2 behave-prof "stream present: per-arm counts (primary runs a test, control only explores)" "yes" \
906
+ "$(grep -qxF 'behaviour-profile: G-GREET-01 primary r1 explore=1 edit=0 test-run=1 other=0 total=2 first_error=unknown' "$T/bp.md" \
907
+ && grep -qxF 'behaviour-profile: G-GREET-01 control r1 explore=2 edit=0 test-run=0 other=0 total=2 first_error=unknown' "$T/bp.md" && echo yes || echo no)"
908
+ # BP3 FH_LIVE_TRACE=0 keeps no stream โ†’ one ยซnot recordedยป line, not a MISSING line per rep
909
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_LIVE_TRACE=0 \
910
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp0.md" ) >"$T/bp0.log" 2>&1
911
+ _lane BP3 behave-prof "FH_LIVE_TRACE=0 โ†’ one 'not recorded' line, no per-rep lines" "1 0" \
912
+ "$(grep -c '^behaviour-profile: not recorded โ€” FH_LIVE_TRACE=0' "$T/bp0.md") $(grep -c '^behaviour-profile: G-GREET-01' "$T/bp0.md")"
913
+ # BP4 an unreadable stream says UNREADABLE (skipped as root: root reads mode 000)
914
+ if [ "$(id -u)" != 0 ]; then
915
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_TRACE_STUB_BAD=yes \
916
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bpu.md" ) >"$T/bpu.log" 2>&1
917
+ _lane BP4 behave-prof "unreadable stream โ†’ trace=UNREADABLE, not counts of 0" "1" \
918
+ "$(grep -cxF 'behaviour-profile: G-GREET-01 control r1 trace=UNREADABLE' "$T/bpu.md")"
919
+ chmod -R u+rwx "$T" 2>/dev/null
920
+ fi
921
+ # BP5 the profile never moves a verdict: the G-GREET-01 row is identical with and without streams.
922
+ _lane BP5 behave-prof "verdict row identical with stream (BP2) and without (FH_LIVE_TRACE=0)" "yes" \
923
+ "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/bp0.md")" ] && echo yes || echo no)"
924
+
881
925
  # TG3 default output unchanged: no --target -> no split section anywhere.
882
926
  _lane TG3 target "default (no --target): report has no 'Target split' section" \
883
927
  "no" "$(grep -q 'Target split' "$T/bud_report.md" && echo yes || echo no)"
@@ -8,7 +8,8 @@
8
8
  # SKILL pair โ€” so these lanes cover both pairs and both directions:
9
9
  # moved into the sibling -> no M-tier (exit != 2)
10
10
  # dropped from both -> M-tier block (exit 2) <- the lookup must not become a free pass
11
- # plus a REVERT PROBE: the CLAUDE.md case is deleted from a copy of the guard and lane S1 must turn red.
11
+ # plus REVERT PROBES: each pair arm is deleted from a copy of the guard and its lane must turn red.
12
+ # 2026-11-19: third pair, .claude/rules/fh_4axis_gate.md <-> fh_4axis_gate_detail.md (S11-S13, R4-R5).
12
13
  #
13
14
  # Usage: bash scripts/test_regression_guard_sibling_lanes.sh Exit: 0 = all behave; 1 = regression.
14
15
 
@@ -188,6 +189,56 @@ else
188
189
  else echo " โœ… R3 revert probe: without the reverse arm the reference side no longer sees a move"; fi
189
190
  fi
190
191
 
192
+ # S11 (2026-11-19): the 4-axis rule became a thin resident layer; its body moved verbatim to
193
+ # knowledge/shared/harness-core/fh_4axis_gate_detail.md. Same pair shape, so the same lookup.
194
+ RULE=.claude/rules/fh_4axis_gate.md; RDET=knowledge/shared/harness-core/fh_4axis_gate_detail.md
195
+ mkrule() { local d=$1; mkrepo "$d"; mkdir -p "$d/.claude/rules"; printf '# gate\n%s' "$BODY" > "$d/$RULE"; git -C "$d" add -A && git -C "$d" commit -q -m rule; }
196
+ d=$T/s11; mkrule "$d"
197
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
198
+ git -C "$d" add -A
199
+ run_lane "S11 4-axis rule -> detail move" "$d" "$GUARD" pass
200
+
201
+ # S12: rule slimmed, detail file absent -> real loss still blocks
202
+ d=$T/s12; mkrule "$d"
203
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; git -C "$d" add -A
204
+ run_lane "S12 4-axis rule loss, detail absent" "$d" "$GUARD" block
205
+
206
+ # R4: revert probe โ€” delete the rule arm from a copy of the guard; S11 must now block
207
+ G5=$T/guard_norule.sh
208
+ grep -v '^ .claude/rules/fh_4axis_gate.md) ' "$GUARD" > "$G5"
209
+ if cmp -s "$GUARD" "$G5"; then echo " โŒ R4 revert probe: the mutation did not apply (pattern drift) โ€” HARNESS-ERROR"; FAIL=1
210
+ else
211
+ d=$T/r4; mkrule "$d"
212
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
213
+ git -C "$d" add -A
214
+ run_lane "R4 revert probe: without the rule pair, S11 blocks" "$d" "$G5" block
215
+ fi
216
+
217
+ # S13: reverse โ€” detail content moved back into the rule -> move recognised on the detail side
218
+ d=$T/s13; mkrule "$d"
219
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
220
+ git -C "$d" add -A; git -C "$d" commit -q -m split
221
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
222
+ out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
223
+ sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); if [[ "$sec" == *"moved to"* ]] && [[ "$sec" != *"M-TIER"* ]]; then
224
+ echo " โœ… S13 detail -> rule reverse move recognised"
225
+ else echo " โŒ S13 reverse move not recognised on the detail side"; FAIL=1; fi
226
+
227
+ # R5: revert probe โ€” drop the detail-side arm; S13 must fail
228
+ G6=$T/guard_nodetailarm.sh
229
+ grep -v 'fh_4axis_gate_detail.md) sib=".claude/rules/fh_4axis_gate.md"' "$GUARD" > "$G6"
230
+ if cmp -s "$GUARD" "$G6"; then echo " โŒ R5 revert probe: the mutation did not apply (pattern drift) โ€” HARNESS-ERROR"; FAIL=1
231
+ else
232
+ d=$T/r5; mkrule "$d"
233
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
234
+ git -C "$d" add -A; git -C "$d" commit -q -m split
235
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
236
+ rc=0; out=$(cd "$d" && bash "$G6" --staged 2>&1) || rc=$?
237
+ if [ "$rc" -gt 2 ] || ! grep -q "fh_4axis_gate_detail.md ===" <<<"$out"; then echo " โŒ R5 revert probe: mutated guard did not run or never examined the detail file (rc=$rc) โ€” HARNESS-ERROR"; FAIL=1
238
+ elif sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); [[ "$sec" == *"moved to"* ]]; then echo " โŒ R5 revert probe: reverse move still recognised without the detail-side arm"; FAIL=1
239
+ else echo " โœ… R5 revert probe: without the detail-side arm the detail file no longer sees a move"; fi
240
+ fi
241
+
191
242
  echo
192
243
  if [ "$FAIL" -eq 0 ]; then echo "ALL regression_guard sibling lanes behave."; exit 0; fi
193
244
  echo "regression_guard sibling lanes: FAIL"; exit 1
@@ -101,7 +101,7 @@ STUB
101
101
  # not: "absent" is simulated by NOT creating a stub, so the real codex/agy further down $PATH were
102
102
  # found instead and the lanes fired REAL, billed API calls (measured: a lane run hung past 120s
103
103
  # against live runtimes). A test that can reach production is not a test.
104
- run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1; }
104
+ run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1 < /dev/null; }
105
105
 
106
106
  echo "โ”€โ”€ sidecar-calibrate lanes โ”€โ”€"
107
107
 
@@ -730,5 +730,48 @@ run_sut --arm a --reps 1 --prompt p --setting-sources 'project local' --out "$WO
730
730
  run_sut --arm a --reps 1 --prompt p --setting-sources ',,,' --out "$WORKROOT/o31k2"; _rk2=$RC
731
731
  { [ "$_rk1" = 2 ] && [ "$_rk2" = 2 ]; } && ok "L31k 'project local' and ',,,' โ†’ rc 2" || no "L31k malformed source list accepted (rc=$_rk1/$_rk2)"
732
732
 
733
+ # โ”€โ”€ L32 run-level tally (2026-11-19, AQ-20261108-6) โ€” a run where NO rep produced output is
734
+ # FAILED-TO-RUN, never a quiet ยซRESULT: CLEANยป that a scorer folds to 0/N. Known-positive: every
735
+ # rep dies (rc 7, 0 bytes). Known-negative: every rep answers. Exit code stays 0 in both (L9).
736
+ OUTDIR="$WORKROOT/o32a"
737
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
738
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 ); RC=$?
739
+ { [ "$RC" = 0 ] && printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
740
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
741
+ && ok "L32a every rep dead โ†’ RUN: FAILED-TO-RUN + tally unmeasured=2 of 2 (exit 0 kept)" \
742
+ || no "L32a all-dead run not named FAILED-TO-RUN (rc=$RC): $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
743
+ OUTDIR="$WORKROOT/o32b"
744
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
745
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
746
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
747
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=2 empty=0 unmeasured=0 not_launched=0 of 2$"; } \
748
+ && ok "L32b CONTROL โ€” healthy run carries no FAILED-TO-RUN, tally captured=2 of 2" \
749
+ || no "L32b CONTROL โ€” FAILED-TO-RUN fired on a healthy run, or the tally is wrong"
750
+ OUTDIR="$WORKROOT/o32c"
751
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=silent \
752
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
753
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
754
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=2 unmeasured=0 not_launched=0 of 2$"; } \
755
+ && ok "L32c all-EMPTY (rc 0) is not FAILED-TO-RUN โ€” it ran and said nothing; tally empty=2" \
756
+ || no "L32c EMPTY reps folded into FAILED-TO-RUN, or tally wrong"
757
+
758
+ # L32d/e โ€” the two routes the challenger review (2026-11-19) found around L32a: a multi-turn rep
759
+ # whose every turn died (turn headers make bytes>0) and reps that never launched (clone failure).
760
+ printf 't1\nt2\n' > "$WORKROOT/t32.txt"
761
+ OUTDIR="$WORKROOT/o32d"
762
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
763
+ bash "$SUT" --arm a --reps 2 --turns "$WORKROOT/t32.txt" --out "$OUTDIR" 2>&1 )
764
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
765
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
766
+ && ok "L32d --turns with every turn dead โ†’ unmeasured=2 + FAILED-TO-RUN (turn headers are not output)" \
767
+ || no "L32d multi-turn all-dead run counted as captured: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
768
+ OUTDIR="$WORKROOT/o32e"
769
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
770
+ bash "$SUT" --arm a --reps 2 --prompt p --base-ref no-such-ref-32e --base-sha deadbeef --out "$OUTDIR" 2>&1 )
771
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
772
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=0 not_launched=2 of 2$"; } \
773
+ && ok "L32e every clone failed โ†’ not_launched=2 + FAILED-TO-RUN (not a quiet CLEAN)" \
774
+ || no "L32e never-launched reps not counted: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
775
+
733
776
  echo "sim_isolated_run lanes: $pass passed, $fail failed"
734
777
  [ "$fail" -eq 0 ] || exit 1
@@ -24,6 +24,14 @@
24
24
  set -uo pipefail
25
25
 
26
26
  unset GIT_INDEX_FILE GIT_DIR GIT_WORK_TREE GIT_COMMON_DIR 2>/dev/null || true
27
+ # The anchor measures the hook as it behaves by DEFAULT. A caller that exported an override (a commit made with
28
+ # PUBLIC_SURFACE_OK=1 that stages the hook) used to pass it into the sandboxed hook, which then let its own
29
+ # planted leaks through and broke the known pairs (rc=1 for a reason unrelated to the change โ€” pmh-dev #91 โ‘ก,
30
+ # 2026-11-15). Lane: scripts/test_guard_anchor_override_env_lanes.sh.
31
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK FH_NOVELTY_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK TRACKS_GITLINK_OK TRACKS_PUBLIC_OK 2>/dev/null || true
32
+ # Every PSA_* input too (codex R2: PSA_ALLOWLIST suppressed a planted positive) โ€” by prefix, so a new PSA_ input
33
+ # cannot slip past a hand-written list. The scan library sets the ones it needs itself.
34
+ for _v in $(compgen -v | grep '^PSA_'); do unset "$_v"; done; unset _v
27
35
 
28
36
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
29
37
  HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
@@ -30,7 +30,7 @@
30
30
  # hole big enough to lose the exact thing this script exists to protect: measured on this repo's
31
31
  # own `.gitignore`, a worktree holding ONLY `knowledge/**/*_paper_draft.md` (unpublished drafts)
32
32
  # and `outputs/` (field-harness run artifacts) was told **ยซโœ… safe to: git worktree removeยป**.
33
- # `CLAUDE.local.md`, `.claude/specs/`, `.claude/rules/.public-surface-patterns` are the same class
33
+ # `CLAUDE.local.md`, deep-clarify specs (`specs/`, earlier `.claude/specs/`), `.claude/rules/.public-surface-patterns` are the same class
34
34
  # โ€” ignored AND irreplaceable, several of them with no undo at all.
35
35
  # ๐ŸŸฅ That was the SECOND time in one session that a fix here re-created the disease it was fixing.
36
36
  # So the non-blocking set is now a NAMED WHITELIST, not a category:
@@ -160,6 +160,33 @@ not from sounding harmless.
160
160
  pin for this threat, though the same config-rewrite class can still repoint a
161
161
  `stdio` server's launch command โ€” out of scope for this step, not out of scope
162
162
  for config-integrity generally.
163
+ 6. For `stdio` servers launched with `npx` / `uvx` (advisory โ€” not a Done When item): a pinned
164
+ version (`pkg@1.2.3`, `uvx --from 'tool==1.2.3'`) is **not a dependency freeze**. The server's
165
+ transitive dependencies are still resolved fresh against their semver ranges whenever a new
166
+ environment is built, so a pinned server is "pinned but not frozen"
167
+ ([CSA AI Safety Initiative, "Pinned but Not Frozen: Dependency Drift in Coding-Assistant
168
+ MCP Servers," 2026-11-15](https://labs.cloudsecurityalliance.org/research/csa-research-note-mcp-server-dependency-drift-20261115-csa-s/)).
169
+ The note recommends:
170
+ - **Freeze with a lockfile you control.** Run the approved server from an internal wrapper
171
+ package with its own committed lockfile (`package-lock.json`, `uv.lock`), or publish it
172
+ internally with an `npm-shrinkwrap.json`.
173
+ - **Add a release-age delay.** npm has `min-release-age`; the note cites npm โ‰ฅ 11.10.0 for
174
+ it, from a practitioner guide. uv has `exclude-newer` and pnpm has `minimumReleaseAge`.
175
+ The note warns that these settings are documented for install and resolution commands,
176
+ not for ad-hoc runners, so check that `npx` / `npm exec` / `uvx` actually honour them.
177
+ - **Set `ignore-scripts=true`** where the server needs no install scripts. This closes the
178
+ lifecycle-script channel. It does not stop malicious code in a dependency from running
179
+ when the server imports it.
180
+
181
+ The note also points out that a pin can freeze a known-vulnerable version (it cites
182
+ CVE-2025-6514 in `mcp-remote`, fixed in 0.1.16), so a pin needs revisiting, not just setting.
183
+
184
+ Headless runs need care too. The note says that in `claude -p` runs, Agent SDK sessions
185
+ and cloud sessions, project-scoped servers load without asking (in Claude Code, project
186
+ scope is the `.mcp.json` file). FH recommendation, not from the note: a headless run that
187
+ should use only a known server set passes `--mcp-config <file> --strict-mcp-config`. Per the
188
+ Claude Code CLI help, that flag uses only the servers from `--mcp-config` and ignores every
189
+ other MCP configuration.
163
190
 
164
191
  Done When (per mounted server):
165
192
  - ยง3 table filled, every enumerated tool name present (check class: mandatory-pass โ€” file inspection)
@@ -44,6 +44,16 @@ set -uo pipefail
44
44
 
45
45
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true)
46
46
  [ -z "$REPO_ROOT" ] && { echo " โŒ pre-push: not in a git repo โ€” fail-closed (block)"; exit 1; }
47
+ # Where the pre-commit hook writes markers: the main checkout (git common dir's parent), not a worktree's own
48
+ # folder. Same derivation as pre-commit's EVIDENCE_ROOT.
49
+ _gcd=$(git rev-parse --git-common-dir 2>/dev/null || echo "")
50
+ case "$_gcd" in
51
+ "") EVIDENCE_ROOT="$REPO_ROOT" ;;
52
+ /*) EVIDENCE_ROOT=$(dirname "$_gcd") ;;
53
+ *) EVIDENCE_ROOT=$(dirname "$REPO_ROOT/$_gcd") ;;
54
+ esac
55
+ [ -d "$EVIDENCE_ROOT" ] || EVIDENCE_ROOT="$REPO_ROOT"
56
+ PUSHED_BRANCHES="" # local branch names this push updates (the Load-Bearing gate binds its marker to these)
47
57
  ZERO="0000000000000000000000000000000000000000"
48
58
  PUSH_REMOTE="${1:-origin}" # git passes the remote NAME as $1; ranges are scoped to it (see below)
49
59
 
@@ -254,6 +264,14 @@ fh_stacked_branch_advisory() {
254
264
 
255
265
  while read -r local_ref local_sha remote_ref remote_sha; do
256
266
  [ -z "${remote_ref:-}" ] && continue
267
+ # Branch identity for the Load-Bearing marker: the local branch, or โ€” for a commit-expression refspec such as
268
+ # <sha>:refs/heads/topic โ€” the destination branch (codex R2: it used to fall back to the CURRENT branch's marker).
269
+ if [ "$local_sha" != "$ZERO" ]; then
270
+ case "$local_ref" in
271
+ refs/heads/*) PUSHED_BRANCHES="${PUSHED_BRANCHES}${PUSHED_BRANCHES:+$'\n'}${local_ref#refs/heads/}" ;;
272
+ *) case "$remote_ref" in refs/heads/*) PUSHED_BRANCHES="${PUSHED_BRANCHES}${PUSHED_BRANCHES:+$'\n'}${remote_ref#refs/heads/}" ;; esac ;;
273
+ esac
274
+ fi
257
275
  # Advisory first โ€” it can never alter the verdict, and it must be visible even when a guard
258
276
  # below blocks (the two findings are independent and the operator wants both at once).
259
277
  [ "$local_sha" = "$ZERO" ] || fh_stacked_branch_advisory "$local_ref" "$local_sha"
@@ -589,10 +607,49 @@ _LB_FILES=$(printf '%s\n' "$_LB_RAW" \
589
607
  # Also FH-dev-scoped: the marker this requires lives in tracks/_meta, which only an FH checkout has.
590
608
  # An outside contributor pushing a gate file cannot produce an FH marker, and blocking them would make
591
609
  # the repo hostile to contribution while protecting nothing they could act on.
592
- if [ -n "$PUSH_RANGES" ] && [ -n "$_LB_FILES" ] && [ -d "$REPO_ROOT/tracks/_meta" ]; then
593
- _cf_marker=$(ls -t "$REPO_ROOT"/tracks/_meta/.axes_23_passed_*.marker 2>/dev/null | head -1)
594
- _cf_line=$(grep -m1 -E '^[[:space:]]*crossfamily:[[:space:]]*[^[:space:]]' "$_cf_marker" 2>/dev/null || true)
610
+ if [ -n "$PUSH_RANGES" ] && [ -n "$_LB_FILES" ] && [ -d "$EVIDENCE_ROOT/tracks/_meta" ]; then
611
+ # The marker is bound to the branch being pushed and read where pre-commit writes it (2026-11-15). It used to be
612
+ # ยซthe newest marker of any branch under ${REPO_ROOT}ยป: a worktree push was blocked although its marker existed in
613
+ # the main checkout, and a main-checkout push passed on another branch's marker. Every pushed branch needs its own;
614
+ # a push that updates no branch (tags only) falls back to the current branch. Lane: scripts/test_prepush_marker_lookup_lanes.sh.
615
+ # ๐ŸŸฅ Named residual: the marker's owner is read from its file name, and ยซ/ยป โ†’ ยซ_ยป is not one-to-one. If two branches
616
+ # once shared a name (feature/a ยท feature_a) and one was deleted, the survivor reads the deleted one's marker as its own.
617
+ # Closing that needs the writer (pre-commit) to put an unambiguous branch identity inside the marker โ€” not done here.
618
+ _cf_find_marker() { # $1 = marker dir ยท $2 = slug โ†’ newest ยซ.axes_23_passed_<slug>_YYYY-MM-DD.markerยป, exact
619
+ # (a function, not inline in $( ): bash 3.2 mis-parses a `case โ€ฆ )` inside a command substitution)
620
+ local _p _s
621
+ ls -t "$1"/.axes_23_passed_*.marker 2>/dev/null | while IFS= read -r _p; do
622
+ _s="${_p##*/}"; _s="${_s#.axes_23_passed_}"
623
+ case "$_s" in *_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].marker) ;; *) continue ;; esac
624
+ [ "${_s%_????-??-??.marker}" = "$2" ] && { printf '%s\n' "$_p"; break; }
625
+ done
626
+ }
627
+ _cf_branches="$PUSHED_BRANCHES"
628
+ [ -n "$_cf_branches" ] || _cf_branches=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)
629
+ _cf_line=""; _cf_missing=""
630
+ while IFS= read -r _cf_br; do
631
+ [ -z "$_cf_br" ] && continue
632
+ _cf_slug="${_cf_br//\//_}"
633
+ # The marker name is <slug>_<YYYY-MM-DD>.marker exactly: a glob on ยซ<slug>_*ยป also matched a longer branch's
634
+ # marker (lane/foo โŠ‚ lane_foo_bar โ€” codex R1). And ยซ/ยป โ†’ ยซ_ยป is not one-to-one (feature/a = feature_a): when
635
+ # another local branch maps to the same slug, its marker cannot be told apart, so it does not count.
636
+ _cf_marker=""
637
+ # %(refname) with the literal prefix stripped: %(refname:short) can print ยซheads/xยป when a tag x exists (codex R2).
638
+ # Any OTHER local branch with the same slug makes the marker unattributable โ€” even when the pushed branch does not
639
+ # exist locally (a <sha>:refs/heads/x push next to a local x-with-underscores โ€” codex R3).
640
+ if [ "$(git for-each-ref --format='%(refname)' refs/heads/ 2>/dev/null | while IFS= read -r _b; do _b="${_b#refs/heads/}"; [ "${_b//\//_}" = "$_cf_slug" ] && [ "$_b" != "$_cf_br" ] && echo "$_b"; done | grep -c .)" -eq 0 ]; then
641
+ _cf_marker=$(_cf_find_marker "$EVIDENCE_ROOT/tracks/_meta" "$_cf_slug")
642
+ else
643
+ echo " (branch '$_cf_br' shares its marker name with another local branch โ€” its marker cannot be attributed)"
644
+ fi
645
+ _cf_one=$(grep -m1 -E '^[[:space:]]*crossfamily:[[:space:]]*[^[:space:]]' "$_cf_marker" 2>/dev/null || true)
646
+ if [ -n "$_cf_one" ]; then _cf_line="${_cf_line:-$_cf_one}"; else _cf_missing="$_cf_missing $_cf_br"; fi
647
+ done <<CFB
648
+ $_cf_branches
649
+ CFB
650
+ [ -n "$_cf_missing" ] && _cf_line=""
595
651
  if [ -z "$_cf_line" ]; then
652
+ [ -n "$_cf_missing" ] && echo " (no marker with a crossfamily: line for:$_cf_missing โ€” looked in $EVIDENCE_ROOT/tracks/_meta)"
596
653
  echo ""
597
654
  echo "โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•"
598
655
  echo " โ›” FH Load-Bearing Change Gate (pre-push) โ€” no cross-family leg recorded"
@@ -53,6 +53,28 @@ grep -rIE '<private-harness-name>|<internal-codename>|<corp-domain>' LICENSE REA
53
53
  git ls-files | grep -iE '<internal-acronym>'
54
54
  ```
55
55
 
56
+ ### Step 0b โ€” Publishing a filtered copy only: did the strip flow back?
57
+
58
+ If you publish a filtered copy โ€” protected paths stripped on a throwaway branch, pushed to a second remote โ€” check
59
+ that your own integration branch did not absorb that stripped tree. In a field run it flowed back into local `main`
60
+ through merges: hundreds of protected files deleted and a few CI and ownership files altered. **The commit counts
61
+ looked normal** โ€” `git log` and ahead/behind showed nothing. Only a tree diff against the upstream showed it:
62
+
63
+ ```bash
64
+ git fetch origin && git diff --name-status origin/main main # D = deleted ยท M = modified ยท A = added, per file
65
+ ```
66
+
67
+ - `origin` here is the **unfiltered** upstream. If `origin` in your clone is the filtered remote, use the name of the
68
+ unfiltered one instead โ€” against the filtered remote the stripped tree looks clean.
69
+ - ยซProtected pathsยป are the ones your filter strips: read them from the filter's own exclusion list (the script or
70
+ config that builds the filtered branch).
71
+
72
+ Any `D` on a protected path โ†’ stop before publishing. Put those files back from the upstream, for example
73
+ `git restore --source=origin/main -- <path>` and commit; anything wider (resetting the branch, rewriting history)
74
+ goes through the Destructive-Op gate first. This stays a manual check on purpose: if the same backflow shows up in a
75
+ second repository, mechanize it as a shared script that prints ยซdeleted N ยท modified M ยท added A (protected-path
76
+ deletions P)ยป and warns when P > 0, without blocking.
77
+
56
78
  ## Step 1 โ€” Run both gates (must both be non-LEAK)
57
79
 
58
80
  | Gate | Catches | Pass condition |
@@ -113,11 +113,11 @@ else
113
113
  HEAD_REF="${2:-}" # empty = working tree
114
114
  fi
115
115
 
116
- # ๊ฒŒ์ดํŠธ ์ปค๋ฒ„ ์ž์‚ฐ = 4์ถ• ์ •๋ณธ(.claude/rules/fh_4axis_gate.md ยง48)์ด ์„ ์–ธํ•œ ๋ชฉ๋ก๊ณผ ๋งž์ถ˜๋‹ค.
116
+ # ๊ฒŒ์ดํŠธ ์ปค๋ฒ„ ์ž์‚ฐ = 4์ถ• ์ •๋ณธ(.claude/rules/fh_4axis_gate.md ์ฒซ ์ ˆ ยซWhenever the AI modifies FH assetsยป ์ค„)์ด ์„ ์–ธํ•œ ๋ชฉ๋ก๊ณผ ๋งž์ถ˜๋‹ค.
117
117
  # 2026-07-22 ์ˆ˜๋ฆฌ: AGENTS.md ยท knowledge/** ยท docs/*.md ๊ฐ€ ์—ฌ๊ธฐ ์—†์–ด์„œ, ์ •๋ณธ์ด "์ปค๋ฒ„ํ•œ๋‹ค"๊ณ 
118
118
  # ์„ ์–ธํ•œ ์ž์‚ฐ์„ Axis 1 ์ด **์•„์˜ˆ ๋ณด์ง€ ๋ชปํ–ˆ๋‹ค**. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ๋ฏธ๊ฒ€์‚ฌ๊ฐ€ ํ˜ธ์ถœ๋ถ€(pre-commit)์—์„œ
119
119
  # `โœ… PASS` ๋กœ ๋ Œ๋”๋๋‹ค = ๊ฒ€์‚ฌ ์•ˆ ํ•จ์ด ํ†ต๊ณผ๋กœ ๋ณด๊ณ ๋˜๋Š” fail-open.
120
- # ์ƒˆ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•  ๋•Œ๋Š” ๋ฐ˜๋“œ์‹œ fh_4axis_gate.md ยง48 ๊ณผ ๋Œ€์กฐํ•  ๊ฒƒ โ€” ๋‘ ๋ชฉ๋ก์ด ๊ฐˆ๋ฆฌ๋ฉด
120
+ # ์ƒˆ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•  ๋•Œ๋Š” ๋ฐ˜๋“œ์‹œ fh_4axis_gate.md ์˜ ๊ทธ ์ž์‚ฐ ๋ชฉ๋ก ์ค„๊ณผ ๋Œ€์กฐํ•  ๊ฒƒ โ€” ๋‘ ๋ชฉ๋ก์ด ๊ฐˆ๋ฆฌ๋ฉด
121
121
  # ๊ฐˆ๋ฆฐ ์ชฝ์ด ์กฐ์šฉํžˆ ๋ฌด๊ฒ€์‚ฌ ๊ตฌ๊ฐ„์ด ๋œ๋‹ค.
122
122
  # 2026-07-26 ์ˆ˜๋ฆฌ (2์ฐจ โ€” ์ด๋ฆ„ ์—ด๊ฑฐ์—์„œ ๋””๋ ‰ํ† ๋ฆฌ ์Šค์ฝ”ํ”„๋กœ): ์ฒ˜์Œ์—” `SKILL_detail.md` ๋ฅผ ์ด๋ฆ„์œผ๋กœ
123
123
  # ์ถ”๊ฐ€ํ–ˆ์œผ๋‚˜, Axis-2 ์ ๋Œ€ ํŒจ์Šค๊ฐ€ "์ด๋ฆ„์„ ํ•˜๋‚˜์”ฉ ๋ง‰๋Š” ๋ฐฉ์‹์€ ์›๋ฆฌ์ ์œผ๋กœ ์ด ํด๋ž˜์Šค๋ฅผ ๋ชป ๋‹ซ๋Š”๋‹ค"๊ณ 
@@ -427,8 +427,8 @@ print('OK')
427
427
  # salience-splitter is designed to reverse.
428
428
  # The resident/reference pair (2026-10-16): CLAUDE.md keeps a ~95-line resident core and the full
429
429
  # ruleset lives in claude_md_full_reference.md with section names unchanged โ€” the same split
430
- # shape as SKILL.md/SKILL_detail.md, so it gets the same symmetric lookup. Only these two exact
431
- # paths pair; any other file keeps an empty sibling, so this does not widen what counts as a move.
430
+ # shape as SKILL.md/SKILL_detail.md, so it gets the same symmetric lookup. Only the exact path pairs
431
+ # listed in the case below pair; any other file keeps an empty sibling, so this does not widen what counts as a move.
432
432
  #
433
433
  # ๐ŸŸฅ Credit only what the sibling GAINED in this change (2026-10-16, cross-family codex HIGH).
434
434
  # The lookup used to compare against the sibling's CURRENT total, so a sibling that already held
@@ -442,6 +442,10 @@ print('OK')
442
442
  */SKILL_detail.md) sib="$(dirname "$f")/SKILL.md" ;;
443
443
  CLAUDE.md) sib="knowledge/shared/harness-core/claude_md_full_reference.md" ;;
444
444
  knowledge/shared/harness-core/claude_md_full_reference.md) sib="CLAUDE.md" ;;
445
+ # 2026-11-19: the path-scoped 4-axis rule became a thin layer (it attaches on every READ of a
446
+ # matching file); its body moved verbatim to the detail file. Same pair shape, same gain rule.
447
+ .claude/rules/fh_4axis_gate.md) sib="knowledge/shared/harness-core/fh_4axis_gate_detail.md" ;;
448
+ knowledge/shared/harness-core/fh_4axis_gate_detail.md) sib=".claude/rules/fh_4axis_gate.md" ;;
445
449
  esac
446
450
  if [ -n "$sib" ]; then detail_content=$(read_after "$sib"); detail_before=$(read_before "$sib"); fi
447
451
  _gain() { # $1=counter fn $2=pattern -> max(0, count in sibling after โˆ’ count in sibling before)
@@ -0,0 +1,27 @@
1
+ {
2
+ "_README": [
3
+ "lane-gap ์•ˆ๋‚ด ํ›… ์Šค๋‹ˆํŽซ โ€” TRACKED ๋ผ clone ๊ณผ ํ•จ๊ป˜ ๋„์ฐฉํ•œ๋‹ค. .claude/settings*.json ์€ gitignored ๋ผ ํ›… ๋“ฑ๋ก์€",
4
+ "install-wizard ๊ฐ€ ์ด ์Šค๋‹ˆํŽซ์„ ์‚ฌ์šฉ์ž ๋กœ์ปฌ ์„ค์ •์— ๋จธ์ง€ํ•  ๋•Œ๋งŒ ์ƒ๊ธด๋‹ค (์Šคํฌ๋ฆฝํŠธ ์ถœํ•˜ โ‰  ๋ฐฐ์„ ).",
5
+ "",
6
+ "๋ฌด์—‡์„ ํ•˜๋‚˜ (2026-11-06, ์šด์˜์ž ยซ์ถ”์ฒœ๋Œ€๋กœยป โ€” tracks/_meta/video_stophook_review_2026-11-06.md ํ›„๋ณด โ‘ฃ):",
7
+ "์ง€๋‚œ ํ„ด์— ์ฝ”๋“œ ํŒŒ์ผ์„ ๋ฐ”๊ฟจ๋Š”๋ฐ ํ…Œ์ŠคํŠธยท๋ ˆ์ธ ์‹คํ–‰ ๊ธฐ๋ก์ด 0 ์ด๋ฉด ๋‹ค์Œ ํ”„๋กฌํ”„ํŠธ์— ํ•œ ์ค„์„ ๋ถ™์ธ๋‹ค.",
8
+ "FH ๋Š” Stop ์—์„œ ๋ง‰์ง€ ์•Š๋Š”๋‹ค โ€” ๋ง‰๋Š” ์ž๋ฆฌ๋Š” ๋น„๊ฐ€์—ญ ๊ฐ€์žฅ์ž๋ฆฌ(pre-push ยท ์„ธ์…˜ ๋งˆ๊ฐ)๋ฟ์ด๊ณ , ์ด๊ฑด ๊ธฐ๋ก์ด๋‹ค.",
9
+ "๋„๊ธฐ: FH_LANE_GAP_HINT=0. ๋ ˆ์ธ: scripts/test_lane_gap_hint_lanes.sh.",
10
+ "์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์—†์œผ๋ฉด ์กฐ์šฉํžˆ ๊บผ์ง€์ง€ ์•Š๊ณ  ํ•œ ์ค„ ๊ฒฝ๋ณด๋ฅผ ๋‚ธ๋‹ค(field-canon ์Šค๋‹ˆํŽซ๊ณผ ๊ฐ™์€ ์ด์œ )."
11
+ ],
12
+ "project_settings_json": {
13
+ "hooks": {
14
+ "UserPromptSubmit": [
15
+ {
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "bash -c '[ \"${FH_LANE_GAP_HINT:-1}\" = 0 ] && exit 0; HUB=\"${CLAUDE_PROJECT_DIR:-$HOME/projects/forge-harness}\"; S=\"$HUB/scripts/lane_gap_hint.sh\"; if [ -f \"$S\" ]; then bash \"$S\"; else echo \"โš ๏ธ [lane-gap] ์•ˆ๋‚ด ํ›… ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์—†๋‹ค โ€” ์ฒดํฌ์•„์›ƒ์ด ์˜› ๋ธŒ๋žœ์น˜์ด๊ฑฐ๋‚˜ ์„ค์น˜๊ฐ€ ๋ถˆ์™„์ „ํ•  ์ˆ˜ ์žˆ๋‹ค(์•ˆ๋‚ด๊ฐ€ ๊บผ์ ธ ์žˆ๋‹ค).\"; fi; exit 0'",
20
+ "timeout": 10
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }
27
+ }