@chrono-meta/fh-gate 3.36.1 → 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 +23 -2
- package/knowledge/shared/harness-core/claude_md_full_reference.md +7 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +54 -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 +18 -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/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_selfcheck_shard_lanes.sh +44 -0
- package/templates/fh_audit_check.zsh +140 -0
- package/templates/settings.PreToolUse.snippet.json +2 -1
|
@@ -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).",
|