@chrono-meta/fh-gate 3.36.0 → 3.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +4 -4
- package/knowledge/shared/harness-core/builtin_capability_map.md +50 -0
- package/knowledge/shared/harness-core/claude_md_full_reference.md +17 -1
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +78 -0
- package/package.json +8 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +30 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +2 -0
- package/plugins/fh-meta/skills/harness-doctor/SKILL.md +1 -0
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/card_status_tags.sh +47 -0
- package/scripts/correction_moments.py +116 -0
- package/scripts/destructive_pre_gate.sh +25 -2
- package/scripts/env_layer_fingerprint.sh +44 -3
- package/scripts/package_coverage_check.sh +13 -5
- package/scripts/probe_live_eval.sh +9 -0
- package/scripts/probe_live_eval_lib.py +40 -0
- package/scripts/selfcheck.sh +3 -0
- package/scripts/selfcheck_shard_weights.txt +184 -0
- package/scripts/session_close_check.sh +11 -0
- package/scripts/test_card_status_tags_lanes.sh +58 -0
- package/scripts/test_correction_moments_lanes.sh +42 -0
- package/scripts/test_destructive_pre_gate_lanes.sh +36 -0
- package/scripts/test_env_layer_fingerprint_lanes.sh +6 -1
- package/scripts/test_fh_detach_lanes.sh +27 -4
- package/scripts/test_live_eval_transitions_lanes.sh +32 -0
- package/scripts/test_package_coverage_lanes.sh +31 -0
- package/scripts/test_selfcheck_shard_lanes.sh +44 -0
- package/scripts/test_utterance_checklist_hook_lanes.sh +9 -0
- package/scripts/utterance_checklist_hook.py +14 -5
- package/templates/fh_audit_check.zsh +140 -0
- package/templates/settings.PreToolUse.snippet.json +2 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for probe_live_eval_lib.transitions / render_transitions_line («moved since previous», record only).
|
|
3
|
+
# Known pair: a probe that flipped must be listed; identical runs say «none». The two shapes that must NOT read as «none»:
|
|
4
|
+
# a previous report that lacks some current probes (not comparable) and no previous report at all (not supplied).
|
|
5
|
+
set -u
|
|
6
|
+
FH="$(cd "$(dirname "$0")/.." && pwd)"
|
|
7
|
+
out=$(python3 - "$FH/scripts" <<'PY'
|
|
8
|
+
import sys
|
|
9
|
+
sys.path.insert(0, sys.argv[1])
|
|
10
|
+
import probe_live_eval_lib as L
|
|
11
|
+
rows = [{'id': 'G-A', 'verdict': 'PASS'}, {'id': 'G-B', 'verdict': 'FAIL'}, {'id': 'G-C', 'verdict': 'PASS'}]
|
|
12
|
+
def show(name, tr, prev='live_eval_2026-11-02.md'):
|
|
13
|
+
print(name, tr['status'], '|', L.render_transitions_line(tr, prev))
|
|
14
|
+
show('T1', L.transitions(rows, {'G-A': 'PASS', 'G-B': 'PASS', 'G-C': 'PASS'}))
|
|
15
|
+
show('T2', L.transitions(rows, {'G-A': 'PASS', 'G-B': 'FAIL', 'G-C': 'PASS'}))
|
|
16
|
+
show('T3', L.transitions(rows, {'G-A': 'PASS', 'G-B': 'FAIL'}))
|
|
17
|
+
show('T4', L.transitions(rows, None), '')
|
|
18
|
+
show('T5', L.transitions(rows, {'G-A': 'FAIL', 'G-B': 'FAIL'}))
|
|
19
|
+
PY
|
|
20
|
+
)
|
|
21
|
+
rc=$?
|
|
22
|
+
pass=0; fail=0
|
|
23
|
+
lane() { if printf '%s\n' "$out" | grep -q -E "$2"; then echo "PASS $1"; pass=$((pass+1)); else echo "FAIL $1"; fail=$((fail+1)); fi; }
|
|
24
|
+
[ "$rc" = 0 ] || { echo "FAIL harness — python rc=$rc"; printf '%s\n' "$out"; exit 1; }
|
|
25
|
+
lane T1-flip-listed '^T1 moved \| moved since previous \(live_eval_2026-11-02.md\): G-B PASS->FAIL$'
|
|
26
|
+
lane T2-identical-none '^T2 none \| moved since previous \(live_eval_2026-11-02.md\): none$'
|
|
27
|
+
lane T3-narrower-not-none '^T3 not-comparable \| .*not comparable \(1 probes absent from previous\)$'
|
|
28
|
+
lane T4-no-prev '^T4 not-supplied \| moved since previous: not supplied \(no prior report found\)$'
|
|
29
|
+
lane T5-flip-plus-absent '^T5 moved \| .*G-A FAIL->PASS \(absent from previous: G-C\)$'
|
|
30
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
31
|
+
echo "live-eval transitions lanes: $pass pass · $fail fail"
|
|
32
|
+
[ "$fail" -eq 0 ]
|
|
@@ -255,6 +255,37 @@ else
|
|
|
255
255
|
bad "L7 zero shipped docs: expected exit 1 'check broke', got rc=$rc" "$out"
|
|
256
256
|
fi
|
|
257
257
|
|
|
258
|
+
# ── L8 · an accepted entry is exercised by REFERENCE, not by the file existing here ────
|
|
259
|
+
# Three entries name files that exist only on the author's machine, so in a clean clone (CI, the
|
|
260
|
+
# release chain) the old `exists and not covered` gate read them STALE while shipped docs still
|
|
261
|
+
# named them. Three legs, one variable each: named+absent must NOT be stale (the fix), unnamed must
|
|
262
|
+
# be stale (the advisory still fires), named+present must not be stale (old behaviour kept).
|
|
263
|
+
_ACC_LIST=$(bash "$SUBJECT" --list-accepted) # capture first: an early-exit grep in a pipe would SIGPIPE the producer
|
|
264
|
+
ACC_ONE=$(printf '%s\n' "$_ACC_LIST" | grep '\.py$'); ACC_ONE=${ACC_ONE%%$'\n'*}
|
|
265
|
+
l8_stale() { # l8_stale <named:yes|no> <present:yes|no> -> prints the STALE advisory lines
|
|
266
|
+
local d="$TMP/l8_$1_$2"
|
|
267
|
+
make_tree "$d" dir yes
|
|
268
|
+
[ "$1" = yes ] && printf 'See `%s` for the admit step.\n' "$ACC_ONE" >> "$d/docs/guide.md"
|
|
269
|
+
[ "$2" = yes ] && { mkdir -p "$d/$(dirname "$ACC_ONE")"; : > "$d/$ACC_ONE"; }
|
|
270
|
+
_LAST_OUT=$(run_tree "$d"); _LAST_RC=$?
|
|
271
|
+
}
|
|
272
|
+
if [ -z "$ACC_ONE" ]; then
|
|
273
|
+
skip "L8 no .py entry in ACCEPTED_ABSENT to plant"
|
|
274
|
+
else
|
|
275
|
+
l8_stale yes no
|
|
276
|
+
if [ "$_LAST_RC" -eq 0 ] && ! printf '%s' "$_LAST_OUT" | grep -qxF " $ACC_ONE"; then
|
|
277
|
+
ok "L8a named in a shipped doc, file absent here: not reported STALE"
|
|
278
|
+
else bad "L8a named+absent: expected rc=0 and $ACC_ONE not STALE (rc=$_LAST_RC)" "$_LAST_OUT"; fi
|
|
279
|
+
l8_stale no no
|
|
280
|
+
if [ "$_LAST_RC" -eq 0 ] && printf '%s' "$_LAST_OUT" | grep -qxF " $ACC_ONE"; then
|
|
281
|
+
ok "L8b named nowhere: still reported STALE (control — the advisory is alive)"
|
|
282
|
+
else bad "L8b unnamed: expected $ACC_ONE in the STALE list (rc=$_LAST_RC)" "$_LAST_OUT"; fi
|
|
283
|
+
l8_stale yes yes
|
|
284
|
+
if [ "$_LAST_RC" -eq 0 ] && ! printf '%s' "$_LAST_OUT" | grep -qxF " $ACC_ONE"; then
|
|
285
|
+
ok "L8c named and present: not reported STALE (behaviour before the fix kept)"
|
|
286
|
+
else bad "L8c named+present: expected rc=0 and $ACC_ONE not STALE (rc=$_LAST_RC)" "$_LAST_OUT"; fi
|
|
287
|
+
fi
|
|
288
|
+
|
|
258
289
|
echo
|
|
259
290
|
if [ "$skipped" -gt 0 ]; then
|
|
260
291
|
echo "package-coverage lanes: ${pass} passed, ${fail} failed, ${skipped} UNCALIBRATED (not verified here)"
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
# answers "run it".
|
|
15
15
|
# S7 every shard owns at least one suite for N in 2..4 (an empty shard is a wasted runner and a
|
|
16
16
|
# sign the plan collapsed).
|
|
17
|
+
# S8 shard 1 ACTUALLY runs the inline checks (the ~39 non-suite decisions it alone owns).
|
|
18
|
+
# S1..S7 are dry runs and `_shard_inline` answers "skip" in dry mode, so none of them can
|
|
19
|
+
# see this axis; breaking it leaves every leg green with those 39 checks run nowhere.
|
|
17
20
|
# The runs are DRY (`--shard-dry`): nothing is executed, the decision is appended to $FH_SHARD_TRACE.
|
|
18
21
|
# So this suite costs seconds, and it cannot recurse into itself (a dry run never runs a suite).
|
|
19
22
|
set -u
|
|
@@ -121,6 +124,47 @@ else
|
|
|
121
124
|
printf '%s' "$res" | grep -qx 'inlineskip=1'; chk $? "S6 without --shard no inline check is skipped"
|
|
122
125
|
fi
|
|
123
126
|
|
|
127
|
+
# ── S8 shard 1 ACTUALLY runs the inline checks ───────────────────────────────────────────────
|
|
128
|
+
# WHY THIS LANE EXISTS (measured 2026-11-02, weekly clean-room audit). S1..S7 all run with
|
|
129
|
+
# `--shard-dry`, and in dry mode `_shard_inline` returns 1 BY CONSTRUCTION — so every lane above
|
|
130
|
+
# holds the SUITE assignment and none of them can say anything about the inline checks that
|
|
131
|
+
# shard 1 alone owns: the syntax scans, the nine named checkers routed through the `bash` shim
|
|
132
|
+
# (count_check · prepush_guard_check · gate_anchor_check · multibyte_bracket_lint ·
|
|
133
|
+
# package_coverage_check · files_manifest_shipping_check · lane_runner_check · gate_pathspec_check
|
|
134
|
+
# · sync_guard_check) and every `--self-test` entry point — 39 decisions in the dry trace.
|
|
135
|
+
# The hole is silent in the direction this repo calls hollow green: 8 of the 11 `_shard_inline_skip`
|
|
136
|
+
# call sites are `then :`, so a skipped inline check never sets `fail=1`. Measured with the mutant
|
|
137
|
+
# below: with `_shard_inline` answering "skip" always, EVERY leg SHARD-SKIPs all 39, no leg runs
|
|
138
|
+
# them, selfcheck exits 0, and this suite reported 31 passed / 0 failed. Nothing was red anywhere.
|
|
139
|
+
# S6 does not cover it either: S6 asks the no-`--shard` case, which is `npm test`, not a CI leg.
|
|
140
|
+
if [ ! -f "$T/block.sh" ]; then
|
|
141
|
+
chk 1 "S8 the lifted shard block is available (S6 did not produce it — lane would test nothing)"
|
|
142
|
+
else
|
|
143
|
+
# one answer pair from the lifted block, run with the given arguments: "<_shard_inline rc> <_shard_inline_skip rc>"
|
|
144
|
+
inline_answer() { # $1 = block file, $2.. = arguments as selfcheck would receive them
|
|
145
|
+
local _bf="$1"; shift
|
|
146
|
+
( cd "$ROOT" && env -u FH_SELFCHECK_SHARD bash -c '
|
|
147
|
+
f="$1"; shift
|
|
148
|
+
. "$f"
|
|
149
|
+
_shard_inline; a=$?
|
|
150
|
+
_shard_inline_skip LBL >/dev/null 2>&1; b=$?
|
|
151
|
+
echo "$a $b"' _ "$_bf" "$@" 2>/dev/null | tail -1 )
|
|
152
|
+
}
|
|
153
|
+
a_leg1=$(inline_answer "$T/block.sh" --shard 1/4)
|
|
154
|
+
a_leg2=$(inline_answer "$T/block.sh" --shard 2/4)
|
|
155
|
+
a_dry1=$(inline_answer "$T/block.sh" --shard 1/4 --shard-dry)
|
|
156
|
+
[ "$a_leg1" = "0 1" ]; chk $? "S8 --shard 1/4 (not dry): the inline checks RUN here (got '$a_leg1', want '0 1')"
|
|
157
|
+
[ "$a_leg2" = "1 0" ]; chk $? "S8 known-negative: --shard 2/4 skips them, so S8 is not a lane that always passes (got '$a_leg2', want '1 0')"
|
|
158
|
+
[ "$a_dry1" = "1 0" ]; chk $? "S8 control: the DRY form every lane above uses answers 'skip' even for shard 1 (got '$a_dry1') — that is why S1..S7 cannot hold this axis"
|
|
159
|
+
|
|
160
|
+
# KNOWN-NEGATIVE on the detector itself: break inline dispatch with one line. If S8 cannot go
|
|
161
|
+
# red on this, it proves nothing about the subject (same construction as S5).
|
|
162
|
+
sed 's|^ \[ "\$_SHARD_I" = 1 \]$| false|' "$T/block.sh" > "$T/block_mut.sh"
|
|
163
|
+
cmp -s "$T/block.sh" "$T/block_mut.sh"; chk $((1 - $?)) "S8 control: the mutation APPLIED — if this is red the \$_SHARD_I line moved, so S8's known-negative below is VOID, not the subject's fault"
|
|
164
|
+
a_mut=$(inline_answer "$T/block_mut.sh" --shard 1/4)
|
|
165
|
+
[ "$a_mut" != "0 1" ]; chk $? "S8 known-negative: with inline dispatch broken, shard 1 no longer runs them (got '$a_mut') — the detector can fail"
|
|
166
|
+
fi
|
|
167
|
+
|
|
124
168
|
# ── notes (printed, never a verdict) ────────────────────────────────────────────────────────
|
|
125
169
|
if [ -f "$ROOT/scripts/selfcheck_shard_weights.txt" ]; then
|
|
126
170
|
awk 'NF >= 2 && $1 ~ /^[0-9.]+$/ && $2 != "@inline" { print $2 }' "$ROOT/scripts/selfcheck_shard_weights.txt" | LC_ALL=C sort -u > "$T/w.names"
|
|
@@ -146,6 +146,15 @@ OUT=$(mk "홈 변수가 없어도 죽으면 안 된다" "0123abcd-0000-4000-8000
|
|
|
146
146
|
S5="0123abcd-0000-4000-8000-0000000000a8"
|
|
147
147
|
for i in $(seq 1 10); do (mk "동시에 들어온 요청 번호 $i 입니다 길게" "$S5" | CLAUDE_PROJECT_DIR="$T" bash "$HOOK" >/dev/null) & done; wait
|
|
148
148
|
python3 -c 'import json,sys;r=[json.loads(l)["n"] for l in open(sys.argv[1])];s=json.load(open(sys.argv[2]));assert sorted(r)==list(range(1,11)) and s["rows"]==10,(sorted(r),s)' "$D/$S5.jsonl" "$D/$S5.state.json" && ok "U15 10 concurrent prompts → rows 1..10, state 10 (locked)" || no U15 "race"
|
|
149
|
+
# U15b the deterministic half of U15 (2026-11-02): U15 loses a row only ~1% of runs, so reverting the fix leaves it green.
|
|
150
|
+
# Another holder keeps the session lock for 2.0 s; the prompt must still be written down once the lock frees.
|
|
151
|
+
# With the old 0.3 s wait this row is skipped in silence unless the hook starts >1.7 s late (2.0 s, not 1.0 s:
|
|
152
|
+
# at 1.0 s a 0.7 s scheduling delay was enough to turn the reverted code green — codex review 2026-11-02).
|
|
153
|
+
S5b="0123abcd-0000-4000-8000-0000000000a9"
|
|
154
|
+
python3 -c 'import fcntl,os,sys,time;fd=os.open(sys.argv[1],os.O_RDWR|os.O_CREAT,0o600);fcntl.flock(fd,fcntl.LOCK_EX);open(sys.argv[2],"w").close();time.sleep(2.0)' "$D/$S5b.lock" "$T/u15b.ready" &
|
|
155
|
+
HOLD=$!; for _ in $(seq 1 100); do [ -f "$T/u15b.ready" ] && break; sleep 0.02; done
|
|
156
|
+
mk "다른 쪽이 잠금을 쥐고 있는 동안 들어온 요청" "$S5b" | CLAUDE_PROJECT_DIR="$T" bash "$HOOK" >/dev/null; wait "$HOLD"
|
|
157
|
+
[ -f "$T/u15b.ready" ] && [ "$(wc -l < "$D/$S5b.jsonl" 2>/dev/null | tr -d ' ')" = 1 ] && ok "U15b prompt arriving while the lock is held 2.0 s is still written (no silent skip)" || no U15b "row skipped while lock held (ready=$([ -f "$T/u15b.ready" ] && echo y || echo n))"
|
|
149
158
|
rm -rf "$T2" "$T3"
|
|
150
159
|
|
|
151
160
|
# ── codex R2 (final round) cases ──
|
|
@@ -102,13 +102,22 @@ def main():
|
|
|
102
102
|
d = None
|
|
103
103
|
if d:
|
|
104
104
|
lock_p = sid + ".lock"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
lfd = None
|
|
106
|
+
for _ in range(50): # concurrent O_CREAT of one name fails transiently (ENOENT, measured on macOS) — a single try dropped the row
|
|
107
|
+
try:
|
|
108
|
+
lfd = open_regular(lock_p, os.O_RDWR | os.O_CREAT); break
|
|
109
|
+
except OSError as e:
|
|
110
|
+
if e.errno not in (errno.ENOENT, errno.EEXIST):
|
|
111
|
+
break
|
|
112
|
+
time.sleep(0.01)
|
|
109
113
|
if lfd is not None:
|
|
110
114
|
locked = False
|
|
111
|
-
|
|
115
|
+
# 3.0 s, not 0.3 s (operator decision 2026-11-02): a lock timeout skips the row in silence, and losing what
|
|
116
|
+
# the operator asked for is worse than a pause under contention. codex R2's «never hold the prompt long»
|
|
117
|
+
# still bounds it: the lock is held for milliseconds, so the wait only grows when many prompts land at once.
|
|
118
|
+
# The intended waits (0.5 s of open retries + 3.0 s) sit under the 5 s hook timeout in .claude/settings.json;
|
|
119
|
+
# scheduling and I/O are outside that sum. Residual: a holder past 3.0 s still skips the row in silence.
|
|
120
|
+
deadline = time.monotonic() + 3.0
|
|
112
121
|
while time.monotonic() < deadline:
|
|
113
122
|
try:
|
|
114
123
|
fcntl.flock(lfd, fcntl.LOCK_EX | fcntl.LOCK_NB); locked = True; break
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env zsh
|
|
2
|
+
# forge-harness — periodic audit reminder (zshrc hook template)
|
|
3
|
+
#
|
|
4
|
+
# Checks elapsed days for each audit item every time a terminal opens,
|
|
5
|
+
# and prints a warning if the threshold is exceeded.
|
|
6
|
+
#
|
|
7
|
+
# ── Installation ──────────────────────────────────────────
|
|
8
|
+
#
|
|
9
|
+
# 1. Set environment variables in .zshrc:
|
|
10
|
+
#
|
|
11
|
+
# export FH_DIR="$HOME/path/to/forge-harness" # required
|
|
12
|
+
# export CC_HUB_DIR="$HOME/path/to/your-cc-hub" # if you have a CC hub
|
|
13
|
+
# export CC_SENTINELS_DIR="$HOME/.cc_sentinels" # project sentinels (optional)
|
|
14
|
+
#
|
|
15
|
+
# 2. Load the function using one of:
|
|
16
|
+
#
|
|
17
|
+
# a) source "$FH_DIR/templates/fh_audit_check.zsh" # source file directly
|
|
18
|
+
# b) Paste the contents of this file into .zshrc # standalone
|
|
19
|
+
#
|
|
20
|
+
# ── Auto-run (opt-in) ─────────────────────────────────────
|
|
21
|
+
#
|
|
22
|
+
# Default is manual run (call _fh_audit_check directly).
|
|
23
|
+
# To auto-run on terminal start, add to .zshrc:
|
|
24
|
+
#
|
|
25
|
+
# export FH_AUDIT_AUTO=1
|
|
26
|
+
#
|
|
27
|
+
# ── Sentinel-based project audits ─────────────────────────
|
|
28
|
+
#
|
|
29
|
+
# Quarterly/monthly project audits are tracked via sentinel files.
|
|
30
|
+
# After completing an audit, touch the sentinel to reset the warning.
|
|
31
|
+
#
|
|
32
|
+
# mkdir -p ~/.cc_sentinels
|
|
33
|
+
# touch ~/.cc_sentinels/my_project_pfd # record audit completion
|
|
34
|
+
# export CC_SENTINEL_MY_PROJECT_PFD_DAYS=90 # set 90-day threshold
|
|
35
|
+
#
|
|
36
|
+
# ──────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
# mtime lookup (macOS / Linux compatible) — **GNU-first, and the order is load-bearing**.
|
|
39
|
+
# This was BSD-first (`stat -f %m || stat -c %Y`) and that is silently wrong on GNU/Linux: `-f`
|
|
40
|
+
# there means `--file-system`, so on a regular file it exits 0 and prints a filesystem report
|
|
41
|
+
# instead of an epoch — the `||` fallback never runs and the caller gets a multi-line blob that
|
|
42
|
+
# compares as garbage. Fixed 2026-08-15 after the identical bug was measured in
|
|
43
|
+
# scripts/digest_landing_check.sh (macOS 10/10 PASS · ubuntu 1/10 FAIL). Every other _mtime helper
|
|
44
|
+
# in this repo is already GNU-first (scripts/sync-from-be.sh:116 · scripts/fh_session_load.sh:105
|
|
45
|
+
# carry the same warning); this template copy was the straggler, and it ships to field harnesses.
|
|
46
|
+
_fh_mtime() { stat -c %Y "$1" 2>/dev/null || stat -f %m "$1" 2>/dev/null || echo 0; }
|
|
47
|
+
|
|
48
|
+
_fh_audit_check() {
|
|
49
|
+
# The caller's zshrc must not leak options in: under KSH_ARRAYS `${arr[1]}` is the SECOND newest
|
|
50
|
+
# file, so a current audit would read as overdue (cross-family codex, 2026-09-27). Local reset.
|
|
51
|
+
emulate -L zsh
|
|
52
|
+
local -a warns=()
|
|
53
|
+
local now
|
|
54
|
+
now=$(date +%s)
|
|
55
|
+
|
|
56
|
+
# ① weekly_audit — 7-day threshold (when CC_HUB_DIR is set)
|
|
57
|
+
# 🟥 This used to glob `tracks/_meta/harvest_*.md`, a filename NOTHING writes (harvest-loop's
|
|
58
|
+
# SKILL*.md writes skill_usage.md · edit_manifest.yaml · fh_signal_*, never harvest_*). So the
|
|
59
|
+
# «No harvest history» line was unsatisfiable: it fired on every terminal open for every user,
|
|
60
|
+
# forever (measured 2026-09-26 on a hub whose latest weekly audit was 2 days old). The artifact
|
|
61
|
+
# the canonical cadence table names (CLAUDE.md §Cadence Rules · install-wizard §Step1-Checks
|
|
62
|
+
# `weekly_audit latest`) is `tracks/_audit/weekly_audit_*.md` — check THAT.
|
|
63
|
+
# Guard stays on the dir existing (`tracks/_audit/.gitkeep` ships in every clone), so a
|
|
64
|
+
# missing history still warns: not-found is not zero.
|
|
65
|
+
if [[ -n "${CC_HUB_DIR}" && -d "${CC_HUB_DIR}/tracks/_audit" ]]; then
|
|
66
|
+
local aud
|
|
67
|
+
# zsh: an unmatched glob is a SHELL error raised before `ls` runs — the `2>/dev/null` belongs to
|
|
68
|
+
# ls, so `_fh_audit_check:N: no matches found: …` printed on every terminal open of a hub with no
|
|
69
|
+
# harvest files (measured 2026-09-04). 🟥 The obvious fix — appending `(N)` to the ls argument —
|
|
70
|
+
# is WRONG and was measured wrong the same day: the null glob drops the word entirely, `ls -t`
|
|
71
|
+
# then lists the CURRENT DIRECTORY, `head -1` returns an unrelated file, and the «No harvest
|
|
72
|
+
# history» warning silently disappears (not-found rendered as found). Collect into an array with
|
|
73
|
+
# `(N.om)` (null-glob · plain files · newest-first) and read element 1 — empty array ⇒ empty aud.
|
|
74
|
+
local -a _fh_audits
|
|
75
|
+
_fh_audits=( "${CC_HUB_DIR}/tracks/_audit"/weekly_audit_*.md(N.om) )
|
|
76
|
+
aud="${_fh_audits[1]:-}"
|
|
77
|
+
if [[ -n "$aud" ]]; then
|
|
78
|
+
local d=$(( (now - $(_fh_mtime "$aud")) / 86400 ))
|
|
79
|
+
(( d >= 7 )) && warns+=("weekly_audit ${d}d elapsed → run the weekly audit (/harvest-loop lightweight) in your CC hub cwd")
|
|
80
|
+
else
|
|
81
|
+
warns+=("No weekly audit history (tracks/_audit/weekly_audit_*.md) → run the weekly audit (/harvest-loop lightweight) in your CC hub cwd")
|
|
82
|
+
fi
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# ② frontier_digest — 7-day threshold (when CC_HUB_DIR is set)
|
|
86
|
+
# 🟥 Same defect class as ①: this globbed `knowledge/shared/harness-core/harness_frontier_
|
|
87
|
+
# diagnosis_*.md` at 90d and told you to «run /frontier-digest» — but /frontier-digest writes
|
|
88
|
+
# `tracks/_meta/frontier_digest_*.md` (frontier-digest SKILL.md --save), never the diagnosis
|
|
89
|
+
# file. Running the advised command could not reset the clock, and the diagnosis file's mtime
|
|
90
|
+
# moves on unrelated edits. Aligned to CLAUDE.md §Cadence Rules (7d on frontier_digest_*.md).
|
|
91
|
+
# Absent history stays silent, as before (not every install runs digests).
|
|
92
|
+
if [[ -n "${CC_HUB_DIR}" && -d "${CC_HUB_DIR}/tracks/_meta" ]]; then
|
|
93
|
+
local -a _fh_digests
|
|
94
|
+
_fh_digests=( "${CC_HUB_DIR}/tracks/_meta"/frontier_digest_*.md(N.om) )
|
|
95
|
+
local fd="${_fh_digests[1]:-}"
|
|
96
|
+
if [[ -n "$fd" ]]; then
|
|
97
|
+
local d=$(( (now - $(_fh_mtime "$fd")) / 86400 ))
|
|
98
|
+
(( d >= 7 )) && warns+=("frontier_digest ${d}d elapsed → run /frontier-digest --save in your CC hub cwd")
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# ③ FH sim Area B — REMOVED 2026-10-19 (operator decision «사건기준으로 바꿔줘»).
|
|
103
|
+
# Area B used to nag here on a 30-day clock. It is now event-bound: run it before a minor/major
|
|
104
|
+
# release or a public announcement (templates/PRE-PUBLISH-CHECKLIST.md §Read it as a reader;
|
|
105
|
+
# sim-conductor SKILL.md §Frequency limits). A terminal opening is not that event, so this
|
|
106
|
+
# banner no longer has an Area B line. The 7-day minimum-interval guard stays in the skill.
|
|
107
|
+
# Lanes: scripts/test_fh_audit_check_lanes.sh ③ asserts the line is gone even at 116d.
|
|
108
|
+
|
|
109
|
+
# ④ Custom sentinels — per-file threshold in CC_SENTINELS_DIR (optional)
|
|
110
|
+
# Uppercase filename = env var key: CC_SENTINEL_{NAME}_DAYS (default 90)
|
|
111
|
+
# 🟥 The same directory also holds STATE markers written by install-wizard and
|
|
112
|
+
# scripts/fh_env_delta_scan.sh — `*_wizard_done` · `*_mapping_skipped` · `*_wizard_declined` ·
|
|
113
|
+
# `*_wizard_reminder_muted`. They record that something happened, not when an audit is due; aging
|
|
114
|
+
# them as 90-day clocks produced false lines (and «touch … to reset» would falsify a state
|
|
115
|
+
# record). They are skipped by suffix. Any other file is still a custom audit sentinel.
|
|
116
|
+
if [[ -n "${CC_SENTINELS_DIR}" && -d "${CC_SENTINELS_DIR}" ]]; then
|
|
117
|
+
for f in "${CC_SENTINELS_DIR}"/*(N); do
|
|
118
|
+
[[ -f "$f" ]] || continue
|
|
119
|
+
case "${f:t}" in
|
|
120
|
+
*_wizard_done|*_mapping_skipped|*_wizard_declined|*_wizard_reminder_muted) continue ;;
|
|
121
|
+
esac
|
|
122
|
+
local name="${${f:t}:u}"
|
|
123
|
+
local key="CC_SENTINEL_${name}_DAYS"
|
|
124
|
+
local threshold="${(P)key:-90}"
|
|
125
|
+
local d=$(( (now - $(_fh_mtime "$f")) / 86400 ))
|
|
126
|
+
(( d >= threshold )) && warns+=("${f:t} sentinel ${d}d elapsed → touch ${f} to reset")
|
|
127
|
+
done
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Output
|
|
131
|
+
(( ${#warns[@]} == 0 )) && return
|
|
132
|
+
print ""
|
|
133
|
+
print "\033[33m── forge-harness Audit Reminders ────────────────────────\033[0m"
|
|
134
|
+
for w in "${warns[@]}"; do
|
|
135
|
+
print "\033[33m ⚠ ${w}\033[0m"
|
|
136
|
+
done
|
|
137
|
+
print "\033[33m────────────────────────────────────────────────────────\033[0m"
|
|
138
|
+
print ""
|
|
139
|
+
}
|
|
140
|
+
[[ "${FH_AUDIT_AUTO:-0}" == "1" ]] && _fh_audit_check
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"counterweight is mechanical. Net-new coverage is the LOCAL destructive ops no git hook sees;",
|
|
39
39
|
"the pre-push hook remains the hard floor for the push-time surface (role deconfliction in the",
|
|
40
40
|
"script header). Advisory by design, same contract as pipe_verdict_guard (additionalContext +",
|
|
41
|
-
"systemMessage, no permissionDecision); escalate with FH_DESTRUCTIVE_BLOCK=1.
|
|
41
|
+
"systemMessage, no permissionDecision); escalate with FH_DESTRUCTIVE_BLOCK=1. Under",
|
|
42
|
+
"permission_mode=bypassPermissions it blocks by default (FH_DESTRUCTIVE_BLOCK=0 keeps advisory). Opt out with",
|
|
42
43
|
"`# noqa: destructive-op` — the opt-out exempts the ENTIRE Bash payload (whole-command match),",
|
|
43
44
|
"not a single line: a multi-statement payload with a destructive line 1 and a noqa on line 2 is",
|
|
44
45
|
"fully exempt (accepted advisory-surface residual — see the script header's PRECISION OVER RECALL list).",
|