@chrono-meta/fh-gate 3.11.0 → 3.13.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/CLAUDE.md +8 -4
- package/bin/fh-codex-doctor.js +223 -25
- package/knowledge/shared/harness-core/claude_md_gate_details.md +8 -4
- package/knowledge/shared/harness-core/governance_engineering_definition.md +403 -7
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +99 -0
- package/package.json +268 -257
- 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 +54 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/citation_key_check.py +357 -0
- package/scripts/claim_propagation_scan.py +499 -0
- package/scripts/numeric_token_diff.py +389 -0
- package/scripts/outbound_pr_gate.sh +283 -0
- package/scripts/package_coverage_check.sh +10 -0
- package/scripts/section_ref_check.py +591 -0
- package/scripts/selfcheck.sh +111 -0
- package/scripts/session_checklist.py +704 -0
- package/scripts/test_claim_propagation_lanes.sh +573 -0
- package/scripts/test_codex_doctor_root_lanes.sh +384 -0
- package/scripts/test_outbound_pr_gate_lanes.sh +214 -0
- package/scripts/test_paper_integrity_lanes.sh +1473 -0
- package/scripts/test_session_checklist_lanes.sh +746 -0
- package/templates/predelete_check.sh +28 -4
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "fh-meta",
|
|
14
|
-
"version": "3.
|
|
14
|
+
"version": "3.13.0",
|
|
15
15
|
"description": "New in 2.2.0: BREAKING (gate): chamber step 6 now reads ACTUAL.md, not BUDGET.md — an in-flight chamber run whose actual cost sits in BUDGET.md blocks until the ACTUAL: line moves to tracks/_chamber/<slug>/ACTUAL.md (the runner prints the path). Why: BUDGET.md's pre-verdict hash IS the ordering witness, and step 6 hard-blocked until that same file changed, so every run that reached COMPLETE necessarily mutated a witnessed artifact and verify returned TAMPERED — the chamber's promotion condition was unsatisfiable by construction, not by strictness. Two roles (immutable witness / post-verdict calibration sink) had collided in one file; each was correct alone, so neither side's code showed the conflict. Also: ko-tech-writer Step 2/4-b scans are now calibration-backed (known-pair fixtures + reproducible command, shipped) — discrimination is proven, 'zero residue' is explicitly NOT; chamber lane suite 12 -> 33 including the runner x witness seam no test covered; chamber_run.sh now teaches the two-commit discipline (gate hashes and verdict hash must land in separate commits/PRs — it previously advised the opposite). New in 2.1.0: BREAKING (gate): `crossfamily: declined` in an Axes 2-3 marker now requires grounds naming a record path that RESOLVES on disk — bare `declined`, and `declined` justified by author judgment, are blocked at commit. Remedy: cite where the operator decision lives (e.g. `.. — operator declined sidecars, per knowledge/shared/rules/operational_adaptation.md`), or use `DEGRADED_PANEL_UNUSED` if a panel was reachable and you chose not to recruit it — which is what author judgment actually is. `declined` was the only enum value with no grounds requirement; a cross-family review then broke the first (vocabulary-grep) fix three ways — self-validating on the value's own token, vacuous keyword passes, and over-blocking real declinations in natural prose — so the check asserts a resolvable record instead of words. Also: standpoint axis gains `tier1b` (a STATIC read of a target repo, executed nothing) plus a decide-in-order procedure, after blind floor-tier sims graded pure cold-reads as `tier2` three rounds running; steel-quench Wave 1's sixth angle (gate-locality) gains the output-template row it never had, so a mandatory angle stops being structurally unreportable; verify-bidirectional gains category 5 (prescriptive doctrine statement); Sister Asset Protocol gains an active-adoption trigger; new resident doctrine — Mechanization Boundary, Local Execution First, Skeleton-not-Muscle, Expedition track, and this package's versioning policy. Hub meta-operations toolkit — 35 skills + 7 agents. New in 2.0.1: harness-doctor cadence hook, portability lint wired into pre-commit, branch_claim.sh claim-count-vs-tree-count warning, louder confidentiality-scan fail-open notice, fh-gate.sh missing-package.json survival, identity ① reclassified 🟢 (cross-harness adapters + relay argument channel). New in 1.4.53: `fh-codex-doctor` (npm bin) — Codex adapter drift scanner; reads the documented M1/M2/M3 skill tier map + skill/agent source and reports codex-native/adapter-required/claude-native/unclassified per unit, wired into `npm test`/`prepublishOnly` (fail-closed on unclassified Claude-native primitives). New in 1.4.49: steel-quench gains Step 0.6 Verdict-Invariance Probe (groundedness axis — a load-bearing judged gate's verdict must track behavior, not rubric phrasing; measured flip-count over cross-family paraphrases; arXiv:2605.06161 Policy Invariance anchor); multi_model_sidecar_strategy §Vendor-native harness (a model is strongest in its own vendor CLI — Claude/CC, GPT/codex, Gemini/Antigravity; a universal router degrades all of them, so it stays an autocomplete/QA sidecar, never orchestration); predelete_check.sh fail-closed rewrite; memory-hygiene A-TMA anchor. New in 1.4.48: phantom-quench + steel-quench gain external frontier anchors (arXiv:2607.02052 package-hallucination; arXiv:2607.02057 prompt-coverage-adequacy); README model-flat claim reframed from a per-release point-curve to structural invariants (operation flattens across tiers; depth tier-order fixed within a generation). New in 1.4.47: onboarding step ① surfaces the Mode D companion-store session-start load in the auto-read salience anchor (previously only in the local binding + rules, so a greeting could skip the load). New in 1.4.46: context-doctor command-output axis (route to rtk/proxy for verbose CLI stdout, complementing .claudeignore; risk-gated to token-scarce envs). New in 1.4.41: context-doctor 2026 trigger vocab (context engineering/rot/collapse) + phantom-citation hardening; hub measurement-integrity-checklist (cross-model measurement pre-flight: display-name pin/reps≥3/discriminating probe). New in 1.4.40: install-wizard queryable-wiki scaffold (INDEX + session-start read + R/W/C ingest). New in 1.4.39: auto-decorrelation (cross-family verifier sidecar recruitment) + video-ingest (capability-routed video ingestion). New in 1.4.x: verify-axis check-class taxonomy (mandatory-pass/measured/judged), no-reinvention Tier-0 inventory, 7-class failure taxonomy, Destructive-Op Gate, Wave-T (Temper), tier-floor governance, Mode D Model Notice, FC consent lane, default-Sonnet guidance. New in 1.3.0: public-surface-audit, field-harvest Mode B auto-trigger, 4-axis gate scope ext. Validated cross-CLI: Claude Code, Codex, Gemini.",
|
|
16
16
|
"source": "./plugins/fh-meta"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "fh-commons",
|
|
20
|
-
"version": "3.
|
|
20
|
+
"version": "3.13.0",
|
|
21
21
|
"description": "Project-agnostic utility skills — 5 skills (convergence-loop · deliberation · mcp-circuit-breaker · token-budget-gate · ko-tech-writer) + 1 agent (quench-challenger). Domain-independent utilities transplantable into any project.",
|
|
22
22
|
"source": "./plugins/fh-commons"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"name": "fh-qp",
|
|
26
|
-
"version": "3.
|
|
26
|
+
"version": "3.13.0",
|
|
27
27
|
"description": "QP (Quality Platform) — the generic edition of a field QA harness's Prepare→Automation→Regression loop as an FH plugin: 4 skills (qp router · qp-plan · qp-run · qp-regress) + qp_tools.sh (target-class · adapter-probe · mask · surface-reach · mtm-check · run-verbs, typed exit codes) + a zero-domain-constant profile slot + 29 known-pair lanes. Drives web targets through the session's Playwright MCP and desktop targets through computer-use MCP (mobile deferred); calls a registered qasp typed capability when one exists (strictest-wins) — none is registered today, so the MCP fallback is the first edition. Verdict contract: a MACHINE closure requires a recorded assertion; a failed first step is attributed BLOCKED, not FAIL; surface_reach counts every TC in the denominator. Born as chamber run #18 (EMIT, 2026-09-05).",
|
|
28
28
|
"source": "./plugins/fh-qp"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "fh-preprep",
|
|
32
|
-
"version": "3.
|
|
32
|
+
"version": "3.13.0",
|
|
33
33
|
"description": "preprep — a presentation-preparation harness. One CLI over 17 lanes (7 built-in + 10 module) that reads a declared surface manifest and checks a talk's assets against each other: canonical terms, jargon glosses, retired vocabulary, inter-slide dependencies, pacing, get/put round-trips, adjacent duplication, slide relations, geometry, attribute consistency, fonts, diagrams, slide refs, and screen-parity between manuscript and deck. Verdict contract: exit 0 pass / 1 findings / 2 cannot-judge — a surface that could not be read is UNMEASURED, never 0. Promoted out of fh-commons 2026-09-13 after the skill grew past one role (routing / lane modules / fixtures).",
|
|
34
34
|
"source": "./plugins/fh-preprep"
|
|
35
35
|
}
|
package/CLAUDE.md
CHANGED
|
@@ -41,7 +41,7 @@ core invariants never melt). The nursery also **verifies what it births**: harne
|
|
|
41
41
|
| **① Control Tower** | Coordinates all connected projects and **drives harness-ification across them** — decides *which* projects to harness and *when*, propagates harness assets to each, and feeds their synced learnings into the hub's compounding loop. The *how* (rules · gates · 6-axis) is executed via the Core Axis. Command HQ, not a passive registry. | `knowledge/shared/rules/auto_project_mapping.md` (mapping + **Full-Harness Mode**) · `harvest-loop` (compounding loop) · `templates/` (project-harness bundle) · `CATALOG.md` |
|
|
42
42
|
| **② 프런티어 답습 · Frontier absorption** | 확신이 안 서는 자리에서 **책장(우리가 이미 가진 것) → 도서관(세상이 이미 만든 것)** 순으로 먼저 뒤진다. 목적은 **재발명 차단**이지 외부 인용으로 똑똑해 보이는 것이 아니다. | `knowledge/shared/harness-core/harness_frontier_diagnosis_*.md` · `knowledge/{your-org}/` |
|
|
43
43
|
| **③ AI Collaboration Guide** | Accumulates and distributes best practices for token efficiency and dialogue methodology — "how to ask, delegate, and record". | `CHEATSHEET.md` · `knowledge/shared/dialogue/ai_dialogue_playbook.md` · `MEMORY.md` intent-based + associative recall (`knowledge/shared/dialogue/memory_intent_recall.md`) |
|
|
44
|
-
| **Core Axis** | **Harness Engineering (How)** — the methodology and practice axis that realizes the three layers above. The 6-axis framework is the operating unit. **A harness is a means, not an end** — Field harness: "simpler over time" (complexity = warning signal). Meta-harness: *optimize*, not necessarily simplify — complexity earns its scope; red flags are orphaned, redundant, and decorative units, not complexity itself.<br>**And what it is a means *to* is Governance Engineering (What for)** — 🐿️ *«수치를 목표로 움직이되, 그 수치가 게이트를 열지는 않는다»*: drive the error rate toward 0.x% **and** hold the surfaces where no number buys passage. Two verbs, and the second one carries the load — drop it and the discipline decays into "lower the number and the gate opens", which §Irreversibility Gates forbids by name. Measured content, not a slogan
|
|
44
|
+
| **Core Axis** | **Harness Engineering (How)** — the methodology and practice axis that realizes the three layers above. The 6-axis framework is the operating unit. **A harness is a means, not an end** — Field harness: "simpler over time" (complexity = warning signal). Meta-harness: *optimize*, not necessarily simplify — complexity earns its scope; red flags are orphaned, redundant, and decorative units, not complexity itself.<br>**And what it is a means *to* is Governance Engineering (What for)** — 🐿️ *«수치를 목표로 움직이되, 그 수치가 게이트를 열지는 않는다»*: drive the error rate toward 0.x% **and** hold the surfaces where no number buys passage. Two verbs, and the second one carries the load — drop it and the discipline decays into "lower the number and the gate opens", which §Irreversibility Gates forbids by name. Measured content, not a slogan — 🟥 **and the numbers were replaced 2026-09-17** (the earlier «five arms, 2.7 %–13.6 %» came from a scorer since found defective — it counted our own mandated defeater paragraphs as defect claims and dropped ~half of all claims out of the denominator — and it is **not re-scorable**, structurally): **four** arms ran **0.0 %–1.1 %** claim-error on the same eight cases, 95 % upper bound ≈2.1 %, and **no contrast separates** after cluster correction, so it is a spectrum and not a ranking. Every one usable on a review surface, **not one** usable on publish/delete/rewrite — and that holds *now that the point estimate is inside 0.x%*, which is the first time the second verb is testable rather than vacuous. That distance is why this axis exists. Canon: `governance_engineering_definition.md` (operator formulation 2026-09-09; the term exists in IT/data governance — what is ours is the referent, and an outbound claim of novelty owes a stated delta, never mere absence of prior use). | `harness_6axis_framework.md` · `hub_compounding_loop.md` · `claude_code_runtime_flow.md` · `plugins/*/agents/` (sub-agents) |
|
|
45
45
|
|
|
46
46
|
> **번호가 둘이다 — 이 표의 ①②③ 은 «3층 미션»이고, 정체성 등급표의 ①~④·Ⓑ 는 «5대 정체성»이다.**
|
|
47
47
|
> 같은 것을 다르게 세는 게 아니라 **다른 분류**이므로 번호가 어긋나도 모순이 아니다. 여기 **②**(프런티어 답습)는
|
|
@@ -581,7 +581,7 @@ Every new `SKILL.md` must clear a **6-item bar** (role-duplication via `/asset-p
|
|
|
581
581
|
|
|
582
582
|
**FH 자산을 수정하면**(SKILL.md · **SKILL_detail.md** · `.claude/rules/*.md` · `knowledge/shared/rules/*.md` · `templates/` · `CLAUDE.md` · substantive `knowledge/`·`docs/*.md` · `AGENTS.md` · **`scripts/**/*.sh`** · **`scripts/**/*.py`**(`.py` 는 2026-09-07 부터 — 그 전엔 출하 파이썬 7개가 게이트 밖이었다) · **에이전트 정의**(`plugins/*/agents/**/*.md` · `.claude/agents/**/*.md`)) **4축 검증 체인이 그 세션 첫 커밋 전에 자동 실행된다.** 사용자 요청 불요 — 제안이 아니라 의무 단계다.
|
|
583
583
|
|
|
584
|
-
**기계층 — 무엇이 실제로 막는지 나눠서 말한다(2026-08-04 실측).** `git commit` 은 `templates/.git-hooks/pre-commit` 이 **하드 차단**한다: 축이 전부 PASS 할 때까지 커밋이 안 되고, 아래 상세가 로드되지 않아도 훅이 막는다 — 이 산문은 훅 위의 살리언스 층이지 유일 floor 가 아니다. 다만 **훅은 클라이언트측이고 `--no-verify` 로 우회된다**(§Integration branch 가 이미 그렇게 말한다 — 두 곳이 어긋나 보이던 것을 여기서 맞춘다). **그리고 서버측 검증엔 남은 잔여가 있다(2026-08-12 재확인 — `contexts=[]` 서술은 stale, 정정됨)**: `main` 은 `enforce_admins: true` 로 **푸시 경로**(PR 경유)를 강제하고, legacy `required_status_checks.contexts` 는 **`["validate"]`** — `validate` 잡(`.github/workflows/validate.yml`, 메타데이터·`selfcheck.sh` 배선 레인)
|
|
584
|
+
**기계층 — 무엇이 실제로 막는지 나눠서 말한다(2026-08-04 실측).** `git commit` 은 `templates/.git-hooks/pre-commit` 이 **하드 차단**한다: 축이 전부 PASS 할 때까지 커밋이 안 되고, 아래 상세가 로드되지 않아도 훅이 막는다 — 이 산문은 훅 위의 살리언스 층이지 유일 floor 가 아니다. 다만 **훅은 클라이언트측이고 `--no-verify` 로 우회된다**(§Integration branch 가 이미 그렇게 말한다 — 두 곳이 어긋나 보이던 것을 여기서 맞춘다). **그리고 서버측 검증엔 남은 잔여가 있다(2026-08-12 재확인 — `contexts=[]` 서술은 stale, 정정됨)**: `main` 은 `enforce_admins: true` 로 **푸시 경로**(PR 경유)를 강제하고, legacy `required_status_checks.contexts` 는 **`["validate", "new-code-anchor"]`** 다(2026-09-17 두 층 직독 — rulesets 층은 `non_fast_forward` 하나뿐) — `validate` 잡(`.github/workflows/validate.yml`, 메타데이터·`selfcheck.sh` 배선 레인)과 `new-code-anchor` 가 실제 **필수 체크**다. ⚠️ **`validate` 는 Axis 1 이 아니다** — Axis 1(`regression-guard.yml` → `templates/regression_guard.sh`)은 **여전히 필수 체크가 아니다**(빨개도 머지를 못 막는다). 🟥 **다만 «돌지도 않는다» 는 2026-09-17 부로 거짓이다 — 정정.** 이 줄은 «그 워크플로의 `paths:` 가 `SKILL.md`·`.claude/rules/*.md`·`CLAUDE.md`·`templates/*.md` 만 보므로 `knowledge/`·`docs/`·`AGENTS.md`·`scripts/**`·에이전트 정의만 바뀐 PR 에는 Axis 1 자체가 돌지도 않는다» 고 적고 있었는데, **`paths:` 는 2026-08-29(`d5fceac`, #552)에 4축 대상 클래스 전부를 덮도록 넓어졌고**(추가분 = `knowledge/**/*.md` · `docs/*.md` · `AGENTS.md` · `scripts/**` · `templates/.git-hooks/*` · `plugins/*/agents/*.md` · `.claude/agents/**/*.md` · `README*.md` · `CHEATSHEET.md` · `CATALOG.md` · `.github/workflows/*.yml` · `.claude/registry/*.md` · `package.json` — 기존 `SKILL.md`·`.claude/rules/*.md`·`CLAUDE.md`·`templates/*.md`·`templates/regression_guard.sh` 위에) 이 문장만 19일간 안 따라갔다. 실측: `scripts/`·`package.json`·`bin/` 만 바뀐 PR #745 에서 Axis 1 이 **실제로 돌아 통과**했다(run 35227853301, `REGRESSION_GUARD_RESULT=pass`). 🟥 **그리고 그 낡은 문장이 같은 날 기록 셋(커밋 메시지·마커·매니페스트)으로 그대로 전파됐다** — 상주층의 낡은 주장은 읽는 세션이 «확인» 대신 «인용» 하는 순간 번진다([[feedback_half_fix_propagation_boundary]] · 정정면 = PR #745 코멘트). 남는 갭은 이제 «안 돈다» 가 아니라 **«돌지만 필수가 아니다»** 하나다. `validate` 쪽 남은 갭은 `strict: false`: 그 체크는 PR 브랜치에 푸시할 때마다 재실행되지만(오픈 시점 한정이 아니다), 그 뒤 main 이 움직여도 재검증을 강제하지 않으므로 **초록으로 남아 있는 체크가 실제로 병합되는 최신 트리를 본 적이 없을 수 있다.** 즉 서버가 강제하는 건 *체크가 초록인가*지 *그 체크가 지금의 main 을 봤는가*가 아니다. Axes 2–3(마커)·Axis 4(매니페스트)는 그 파일들이 `tracks/**` 로 gitignored 라 CI 가 **구조적으로 볼 수조차 없다**. 🟥 **그 사각이 실제로 뚫렸다(2026-09-14 실측, 2/2)** — 원격 자율 노드(`claude/*` 브랜치, 클라우드 세션)는 체크아웃이 휘발해서 마커가 **아무 데도 안 남는다**. 머지된 `claude/` 접두사 PR 전수 **#675·#716 둘 다** FH 자산을 바꾸고 마커 없이 **초록으로** 들어왔다. ⇒ `scripts/remote_marker_gate.sh` 가 **그 채널에 한해** «마커 3필드(`axes-run`·`crossfamily`·`standpoint`)가 커밋 기록에 실려 왔나» 를 `validate` 에서 막는다(레인 14 · 되돌림 프로브 포함). 보통 브랜치는 pre-commit 이 이미 관할하므로 **SKIP** 이다 — 만족 불가능한 이중 요구는 override 를 훈련시킨다. 🟥 **닫은 것은 «조용한 부재» 하나다**: 검사는 형식만 보고(값의 진위도 enum 멤버십도 안 본다 — enum 정본은 저작 노드의 훅이다), 옮긴 마커와 지어낸 마커는 여전히 바이트가 같다. 정직한 표현은 "하드 차단"이 아니라 "**가용한 가장 강한 층**"이다. **미해결 잔여**: `strict` 를 켜는 것도, Axis 1 을 필수 체크로 거는 것도 운영자 결정이다(막 flaky 레인을 하나 기록한 참이라, 과차단이 override 를 습관화시키는 쪽으로 기울 수 있다). 🟢 «그 `paths:` 를 넓히는 것» 은 2026-08-29 에 이미 닫혔다 — 위 정정 참조.
|
|
585
585
|
|
|
586
586
|
> **상세 정본**: `.claude/rules/fh_4axis_gate.md` — 4축 정의·마커 필수 필드·경량 예외·substantive carve-out·target-tier sim 게이트·Mode D 모델 공지·cross-family 보완. **`paths:` 로 *일부* FH 자산 경로에 스코핑돼 있어 그 파일들을 *읽을 때* 자동 로드된다 — 로드 조건이지 게이트 적용 범위가 아니다** (공식 트리거는 read — `code.claude.com/docs/en/memory.md` §Path-specific rules).
|
|
587
587
|
> (2026-07-20 분리. **파일 char 실측**: 이 절 자체가 76,706자 중 **10,331자(13.5%)**로 단일 최대였다. 그 분리 + 같은 세션의 중복 3건 제거 + New-Skill 게이트 편입까지 **합산**해 파일은 **76,706 → 67,611 (순감 9,095자, 11.9%)** — 합산치이지 이 절 하나의 성과가 아니다 — 이건 파일 크기지 `/context` 상주 실측이 아니다(계기≠대상, [[feedback_resident_memory_measured_fresh_toplevel]]: 상주는 톱레벨 새 세션 `/context` 로만 잰다 — 미측정). 트리거가 *파일*이고 *기계 백스톱*이 있어 1순위 후보였다. 같은 이유로 **비가역 게이트 3종은 이동 불가** — 의도 트리거라 경로 스코핑하면 fail-open 이 된다.)
|
|
@@ -808,8 +808,12 @@ list ships no source/executable file — **grep the file list, don't assert "doc
|
|
|
808
808
|
|
|
809
809
|
**Surface class sets the error budget, not only the degrade direction** (operator decision 2026-09-08).
|
|
810
810
|
The same automated verdict engine is usable on one surface and not on another, and the discriminator is
|
|
811
|
-
what a wrong verdict costs. Measured
|
|
812
|
-
|
|
811
|
+
what a wrong verdict costs. Measured across **four** review arms on the same eight cases — 🟥 **the
|
|
812
|
+
earlier «five arms, 2.7 % – 13.6 %» from this date is RETRACTED (2026-09-17): the scorer was found
|
|
813
|
+
defective and replaced, and the old run is structurally not re-scorable. Canon:
|
|
814
|
+
`governance_engineering_definition.md` §첫 실증** — claim error rates ran **0.0 % – 1.1 %** (95 %
|
|
815
|
+
upper bound ≈2.1 %; **no contrast separates** after cluster correction, so it is a spectrum and not
|
|
816
|
+
a ranking), and every one of them is usable *on a review surface*, because a
|
|
813
817
|
wrong finding costs a reader a minute. On publish · delete · history-rewrite there is no "costs a
|
|
814
818
|
minute": the wrong call is the whole loss. 🟥 **So an automated verdict never clears an irreversible
|
|
815
819
|
gate on its own, however good its measured rate** — it feeds a fail-closed gate whose terminal step
|
package/bin/fh-codex-doctor.js
CHANGED
|
@@ -40,10 +40,59 @@ function parseArgs(argv) {
|
|
|
40
40
|
return out;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// The root predicate is derived from what buildReport() actually READS, not from what "FH root"
|
|
44
|
+
// suggests. Two surfaces are load-bearing:
|
|
45
|
+
// · AGENTS.md — documentedTiers()'s only source; absent ⇒ INSTRUMENT_ERROR (exit 10)
|
|
46
|
+
// · plugins/**/SKILL.md — collectSkills()/collectAgents()'s only subject
|
|
47
|
+
// `package.json` used to be required here and in main(). It is never OPENED anywhere in this file
|
|
48
|
+
// (the only two references were this predicate and main()'s gate), so the gate asserted a property
|
|
49
|
+
// nothing downstream consumes — and it made a shipped npm binary structurally unusable for every
|
|
50
|
+
// non-npm consumer harness that has all the audited surfaces (measured on a consumer harness that
|
|
51
|
+
// carries AGENTS.md with
|
|
52
|
+
// a tier table, plugins/ with 41 SKILL.md, .claude/registry/agent_cards.json — and no package.json).
|
|
53
|
+
//
|
|
54
|
+
// 🟥 The inverse error is the real hazard, so this is NOT merely a loosening. A random directory
|
|
55
|
+
// must not produce a confident empty report: the SKILL.md leg requires plugins/ to hold at least one
|
|
56
|
+
// skill, because an EMPTY plugins/ would otherwise yield `Skills scanned: 0` / `Findings: none` /
|
|
57
|
+
// `Status: OK` — "not found rendered as zero", this repo's named failure family. Degrade direction
|
|
58
|
+
// is unchanged: a genuinely wrong root still exits 11, loudly, naming each missing surface.
|
|
59
|
+
//
|
|
60
|
+
// 🟥 THREE NON-ZERO CLASSES, KEPT DISTINCT. The loosened predicate's hazard is not only fail-open,
|
|
61
|
+
// it is EXIT-CODE COLLAPSE: any surface whose shape the predicate stopped asserting used to reach
|
|
62
|
+
// `readdirSync`/`readFileSync` and throw, and an uncaught node exception is rc=1 — which is already
|
|
63
|
+
// spoken for by "--strict found HIGH drift". A caller cannot then tell "the harness broke" from
|
|
64
|
+
// "the harness found something". So:
|
|
65
|
+
// 11 = wrong root (a surface is absent, or present with the wrong SHAPE)
|
|
66
|
+
// 10 = instrument/input error (a surface is there but unusable: unreadable, unparseable)
|
|
67
|
+
// 1 = --strict with HIGH findings ← reserved. Nothing structural may land here.
|
|
68
|
+
function missingAuditSurfaces(dir, inputErrors) {
|
|
69
|
+
const missing = [];
|
|
70
|
+
const sink = inputErrors || [];
|
|
71
|
+
if (!exists(path.join(dir, 'AGENTS.md'))) {
|
|
72
|
+
missing.push('AGENTS.md — the tier table this doctor measures every skill against');
|
|
73
|
+
}
|
|
74
|
+
const pluginsDir = path.join(dir, 'plugins');
|
|
75
|
+
if (!exists(pluginsDir)) {
|
|
76
|
+
missing.push('plugins/ — the skill/agent surface to be audited');
|
|
77
|
+
} else if (!isDirectory(pluginsDir)) {
|
|
78
|
+
// `plugins` present but not a directory (a file, a device node, a symlink to one). This is a
|
|
79
|
+
// ROOT-SHAPE fault, so it belongs at 11 alongside absence — measured before this branch existed:
|
|
80
|
+
// walk() called readdirSync on it, threw ENOTDIR uncaught, and exited 1.
|
|
81
|
+
missing.push('plugins/ — present but NOT a directory, so it cannot hold skills/agents');
|
|
82
|
+
} else {
|
|
83
|
+
const found = walk(pluginsDir, (p) => path.basename(p) === 'SKILL.md', sink);
|
|
84
|
+
// 🟥 `sink.length` guard: a plugins/ that cannot be ENUMERATED yields 0 hits for a reason that
|
|
85
|
+
// is not absence. Claiming "holds no skill" there would be this repo's not-found-is-zero family
|
|
86
|
+
// wearing an exit code. Enumeration failure is an input error (10), handled by the caller.
|
|
87
|
+
if (found.length === 0 && sink.length === 0) {
|
|
88
|
+
missing.push('plugins/**/SKILL.md — plugins/ exists but holds no skill to classify');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return missing;
|
|
92
|
+
}
|
|
93
|
+
|
|
43
94
|
function looksLikeFHRoot(dir) {
|
|
44
|
-
return
|
|
45
|
-
exists(path.join(dir, 'plugins')) &&
|
|
46
|
-
exists(path.join(dir, 'AGENTS.md'));
|
|
95
|
+
return missingAuditSurfaces(dir).length === 0;
|
|
47
96
|
}
|
|
48
97
|
|
|
49
98
|
function defaultRoot() {
|
|
@@ -73,14 +122,32 @@ function exists(file) {
|
|
|
73
122
|
}
|
|
74
123
|
}
|
|
75
124
|
|
|
76
|
-
function
|
|
125
|
+
function isDirectory(p) {
|
|
126
|
+
try {
|
|
127
|
+
return fs.statSync(p).isDirectory();
|
|
128
|
+
} catch (_err) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// `errors` is an optional sink. A directory that EXISTS but cannot be enumerated must not return
|
|
134
|
+
// [] silently — that is a measurement failure rendered as an empty subject. With a sink the caller
|
|
135
|
+
// classifies it (→ exit 10); without one it throws, so the fault can never be swallowed by default.
|
|
136
|
+
function walk(dir, predicate, errors) {
|
|
77
137
|
const results = [];
|
|
78
138
|
if (!exists(dir)) return results;
|
|
79
|
-
|
|
139
|
+
let entries;
|
|
140
|
+
try {
|
|
141
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
142
|
+
} catch (err) {
|
|
143
|
+
if (!errors) throw err;
|
|
144
|
+
errors.push(`${dir}: directory exists but cannot be enumerated — ${err.code || err.message}`);
|
|
145
|
+
return results;
|
|
146
|
+
}
|
|
80
147
|
for (const entry of entries) {
|
|
81
148
|
const p = path.join(dir, entry.name);
|
|
82
149
|
if (entry.isDirectory()) {
|
|
83
|
-
results.push(...walk(p, predicate));
|
|
150
|
+
results.push(...walk(p, predicate, errors));
|
|
84
151
|
} else if (!predicate || predicate(p)) {
|
|
85
152
|
results.push(p);
|
|
86
153
|
}
|
|
@@ -228,29 +295,126 @@ function classify(docTier, primitives) {
|
|
|
228
295
|
return 'codex-native-candidate';
|
|
229
296
|
}
|
|
230
297
|
|
|
231
|
-
|
|
298
|
+
// `inputErrors` is required, not optional. A SKILL.md that walk() listed but readText() cannot open
|
|
299
|
+
// — chmod 000, a broken symlink, a file deleted between the scan and the read — used to throw out of
|
|
300
|
+
// here uncaught: rc=1, the same code as "--strict found HIGH drift". The subject being unreadable is
|
|
301
|
+
// an INPUT fault (10), and the diagnostic names the path so the caller can fix the input rather than
|
|
302
|
+
// re-run hunting for a finding that was never made.
|
|
303
|
+
function collectSkills(root, inputErrors) {
|
|
232
304
|
const skillsRoot = path.join(root, 'plugins');
|
|
233
|
-
const files = walk(skillsRoot, (p) => path.basename(p) === 'SKILL.md');
|
|
234
|
-
|
|
235
|
-
|
|
305
|
+
const files = walk(skillsRoot, (p) => path.basename(p) === 'SKILL.md', inputErrors);
|
|
306
|
+
const skills = [];
|
|
307
|
+
for (const file of files.sort()) {
|
|
308
|
+
let text;
|
|
309
|
+
try {
|
|
310
|
+
text = readText(file);
|
|
311
|
+
} catch (err) {
|
|
312
|
+
inputErrors.push(`${rel(root, file)}: skill input unreadable — ${err.code || err.message}`);
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
236
315
|
const fm = parseFrontmatter(text);
|
|
237
316
|
const skillName = fm.name || path.basename(path.dirname(file));
|
|
238
|
-
|
|
317
|
+
skills.push({
|
|
239
318
|
type: 'skill',
|
|
240
319
|
name: skillName,
|
|
241
320
|
path: rel(root, file),
|
|
242
321
|
frontmatter: fm,
|
|
322
|
+
// An empty or frontmatter-less SKILL.md gave the classifier nothing to classify. It already
|
|
323
|
+
// lands in `unclassified`, but `unclassified` is also where a merely-undocumented-but-real
|
|
324
|
+
// skill lands, so the two are indistinguishable in the summary. WARN (not HIGH, not 10):
|
|
325
|
+
// the run did measure the surface, it just measured an empty one.
|
|
326
|
+
emptyInput: text.trim() === '' || Object.keys(fm).length === 0,
|
|
243
327
|
primitives: scanPrimitives(text),
|
|
244
|
-
};
|
|
245
|
-
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return skills;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Plugin namespaces are DISCOVERED, not hardcoded. The previous list was ['fh-meta','fh-commons'],
|
|
334
|
+
// which renders "Agents scanned: 0" for any consumer whose plugins carry a different prefix
|
|
335
|
+
// (a consumer harness names its namespaces after ITSELF, e.g. <prefix>-meta/ and <prefix>-commons/,
|
|
336
|
+
// each with an agents/ dir) — the same not-found-is-zero family
|
|
337
|
+
// as the gate above, and it would have been the first thing a newly-unblocked consumer saw.
|
|
338
|
+
// No change for FH itself: its other plugin dirs (fh-preprep, fh-qp) ship no agents/ dir, so walk()
|
|
339
|
+
// returns [] for them and the count stays 14. Sorted for determinism.
|
|
340
|
+
//
|
|
341
|
+
// 🟥 DISCOVERED-BY-SHAPE, NOT BY NAME, AND NOT BY "any subdirectory". The first version accepted
|
|
342
|
+
// every directory immediately under plugins/, so `plugins/node_modules/`, a stale copy, a scratch
|
|
343
|
+
// dir, or `plugins/not-a-plugin/agents/ghost.md` all INFLATED `Agents scanned` — "the count is true
|
|
344
|
+
// but the referent drifted". The discriminator is the plugin manifest, because that is the file a
|
|
345
|
+
// real plugin must carry (verified present in all 4 FH plugins and in both plugins of a consumer
|
|
346
|
+
// harness measured off-tree) and it is
|
|
347
|
+
// prefix-independent: a consumer's <prefix>-meta/ resolves exactly as fh-meta/ does. A NAME filter
|
|
348
|
+
// would have re-broken the consumer axis lane6 exists to hold.
|
|
349
|
+
function isPluginShaped(dir) {
|
|
350
|
+
return exists(path.join(dir, '.claude-plugin', 'plugin.json'));
|
|
246
351
|
}
|
|
247
352
|
|
|
248
|
-
|
|
353
|
+
// Two degrade rules, both aimed at the same failure family:
|
|
354
|
+
// · NO manifest anywhere → shape is UNDETECTABLE on this root, which is not the same as "zero
|
|
355
|
+
// plugins". Fall back to every subdirectory so a manifest-less consumer stays auditable, and
|
|
356
|
+
// WARN that the count is unfiltered — a reader must not read it as shape-verified.
|
|
357
|
+
// · Manifests exist but a dir lacks one AND still carries agents/ or skills/ → that is exactly
|
|
358
|
+
// the material the old code counted. It is DROPPED, so the drop is named in a WARN. A silent
|
|
359
|
+
// drop and a silent over-count are the same defect pointing opposite ways.
|
|
360
|
+
function pluginNamespaces(root, warnings) {
|
|
361
|
+
const base = path.join(root, 'plugins');
|
|
362
|
+
if (!isDirectory(base)) return [];
|
|
363
|
+
let entries;
|
|
364
|
+
try {
|
|
365
|
+
entries = fs.readdirSync(base, { withFileTypes: true });
|
|
366
|
+
} catch (err) {
|
|
367
|
+
if (warnings) {
|
|
368
|
+
warnings.push({
|
|
369
|
+
severity: 'WARN',
|
|
370
|
+
code: 'PLUGIN_DIR_UNENUMERABLE',
|
|
371
|
+
path: rel(root, base),
|
|
372
|
+
message: `plugins/ could not be enumerated for agent discovery — ${err.code || err.message}`,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
return [];
|
|
376
|
+
}
|
|
377
|
+
const dirs = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
378
|
+
const shaped = dirs.filter((name) => isPluginShaped(path.join(base, name)));
|
|
379
|
+
if (shaped.length === 0) {
|
|
380
|
+
if (warnings && dirs.length > 0) {
|
|
381
|
+
warnings.push({
|
|
382
|
+
severity: 'WARN',
|
|
383
|
+
code: 'PLUGIN_SHAPE_UNDETECTABLE',
|
|
384
|
+
path: rel(root, base),
|
|
385
|
+
message: `no .claude-plugin/plugin.json under any of ${dirs.length} plugins/ subdirectories — agent discovery fell back to UNFILTERED subdirectory scan (${dirs.join(', ')})`,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
return dirs;
|
|
389
|
+
}
|
|
390
|
+
const shapedSet = new Set(shaped);
|
|
391
|
+
for (const name of dirs) {
|
|
392
|
+
if (shapedSet.has(name)) continue;
|
|
393
|
+
const dir = path.join(base, name);
|
|
394
|
+
if (!isDirectory(path.join(dir, 'agents')) && !isDirectory(path.join(dir, 'skills'))) continue;
|
|
395
|
+
if (!warnings) continue;
|
|
396
|
+
warnings.push({
|
|
397
|
+
severity: 'WARN',
|
|
398
|
+
code: 'PLUGIN_NAMESPACE_NOT_PLUGIN_SHAPED',
|
|
399
|
+
path: rel(root, dir),
|
|
400
|
+
message: `plugins/${name}/ carries agents/ or skills/ content but no .claude-plugin/plugin.json — EXCLUDED from agent discovery, so it is not counted`,
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return shaped;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function collectAgents(root, inputErrors, warnings) {
|
|
249
407
|
const agents = [];
|
|
250
|
-
for (const plugin of
|
|
408
|
+
for (const plugin of pluginNamespaces(root, warnings)) {
|
|
251
409
|
const dir = path.join(root, 'plugins', plugin, 'agents');
|
|
252
|
-
for (const file of walk(dir, (p) => p.endsWith('.md')).sort()) {
|
|
253
|
-
|
|
410
|
+
for (const file of walk(dir, (p) => p.endsWith('.md'), inputErrors).sort()) {
|
|
411
|
+
let text;
|
|
412
|
+
try {
|
|
413
|
+
text = readText(file);
|
|
414
|
+
} catch (err) {
|
|
415
|
+
inputErrors.push(`${rel(root, file)}: agent input unreadable — ${err.code || err.message}`);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
254
418
|
agents.push({
|
|
255
419
|
type: 'agent',
|
|
256
420
|
name: path.basename(file, '.md'),
|
|
@@ -279,7 +443,9 @@ function loadAgentCards(root) {
|
|
|
279
443
|
|
|
280
444
|
function buildReport(root) {
|
|
281
445
|
const docs = documentedTiers(root);
|
|
282
|
-
const
|
|
446
|
+
const inputErrors = [];
|
|
447
|
+
const shapeWarnings = [];
|
|
448
|
+
const skills = collectSkills(root, inputErrors).map((skill) => {
|
|
283
449
|
const doc = docs.tiers.get(skill.name);
|
|
284
450
|
return {
|
|
285
451
|
...skill,
|
|
@@ -288,10 +454,22 @@ function buildReport(root) {
|
|
|
288
454
|
codexMode: classify(doc && doc.tier, skill.primitives),
|
|
289
455
|
};
|
|
290
456
|
});
|
|
291
|
-
const agents = collectAgents(root);
|
|
457
|
+
const agents = collectAgents(root, inputErrors, shapeWarnings);
|
|
292
458
|
const skillNames = new Set(skills.map((s) => s.name));
|
|
293
459
|
const compatMentions = compatDocTierMentions(root, skillNames);
|
|
294
460
|
const findings = [];
|
|
461
|
+
findings.push(...shapeWarnings);
|
|
462
|
+
|
|
463
|
+
for (const item of skills) {
|
|
464
|
+
if (item.emptyInput) {
|
|
465
|
+
findings.push({
|
|
466
|
+
severity: 'WARN',
|
|
467
|
+
code: 'SKILL_MD_HAS_NO_CLASSIFIABLE_CONTENT',
|
|
468
|
+
path: item.path,
|
|
469
|
+
message: `${item.name} is empty or carries no parseable frontmatter — it was counted as a skill but nothing could be classified from it`,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
295
473
|
|
|
296
474
|
for (const item of skills) {
|
|
297
475
|
if (item.documentedTier === 'M1') {
|
|
@@ -351,10 +529,14 @@ function buildReport(root) {
|
|
|
351
529
|
// INSTRUMENT_ERROR outranks both: without a tier table this run measured nothing, and
|
|
352
530
|
// "measured nothing" must not be reported as OK (nor as DRIFT, which would claim a
|
|
353
531
|
// finding it never made).
|
|
354
|
-
|
|
532
|
+
// An UNREADABLE SUBJECT sits in the same class as an unreadable instrument: the run did not
|
|
533
|
+
// measure what it claims to have measured, so it may not report OK — and it may not report
|
|
534
|
+
// rc=1 either, which would be indistinguishable from a real drift finding.
|
|
535
|
+
status: (docs.sourceErrors.length > 0 || inputErrors.length > 0)
|
|
355
536
|
? 'INSTRUMENT_ERROR'
|
|
356
537
|
: findings.some((f) => f.severity === 'HIGH') ? 'DRIFT' : 'OK',
|
|
357
538
|
instrumentErrors: docs.sourceErrors,
|
|
539
|
+
inputErrors,
|
|
358
540
|
root,
|
|
359
541
|
counts,
|
|
360
542
|
agentCards: loadAgentCards(root),
|
|
@@ -418,12 +600,25 @@ function main() {
|
|
|
418
600
|
return;
|
|
419
601
|
}
|
|
420
602
|
const root = args.root;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
603
|
+
// One gate, one predicate — see missingAuditSurfaces(). It names every missing surface rather
|
|
604
|
+
// than the first, so a consumer fixes the root in one pass instead of one exit code at a time.
|
|
605
|
+
// The sink separates the two classes at the ONE place they are both visible: an absent or
|
|
606
|
+
// wrong-shaped surface is a wrong root (11); a present-but-unenumerable one is an input fault (10).
|
|
607
|
+
const preflightErrors = [];
|
|
608
|
+
const missing = missingAuditSurfaces(root, preflightErrors);
|
|
609
|
+
if (preflightErrors.length > 0) {
|
|
610
|
+
for (const err of preflightErrors) {
|
|
611
|
+
process.stderr.write(`ERROR: audited surface unusable — ${err}\n`);
|
|
612
|
+
}
|
|
613
|
+
process.stderr.write(' The surface exists but could not be read, so nothing was measured. Failing closed.\n');
|
|
614
|
+
process.exit(10);
|
|
424
615
|
}
|
|
425
|
-
if (
|
|
426
|
-
process.stderr.write(`ERROR: root is missing
|
|
616
|
+
if (missing.length > 0) {
|
|
617
|
+
process.stderr.write(`ERROR: root is missing the surfaces this doctor audits: ${root}\n`);
|
|
618
|
+
for (const item of missing) {
|
|
619
|
+
process.stderr.write(` - missing: ${item}\n`);
|
|
620
|
+
}
|
|
621
|
+
process.stderr.write(' Nothing could be classified from this root. Failing closed.\n');
|
|
427
622
|
process.exit(11);
|
|
428
623
|
}
|
|
429
624
|
const report = buildReport(root);
|
|
@@ -439,6 +634,9 @@ function main() {
|
|
|
439
634
|
for (const err of report.instrumentErrors) {
|
|
440
635
|
process.stderr.write(`ERROR: tier source unusable — ${err}\n`);
|
|
441
636
|
}
|
|
637
|
+
for (const err of report.inputErrors) {
|
|
638
|
+
process.stderr.write(`ERROR: audited input unusable — ${err}\n`);
|
|
639
|
+
}
|
|
442
640
|
process.stderr.write(' Nothing was classified, so no drift could be detected. Failing closed.\n');
|
|
443
641
|
process.exit(10);
|
|
444
642
|
}
|
|
@@ -477,11 +477,15 @@ as-is rather than rewritten).
|
|
|
477
477
|
> ⚠️ A *different* residual on `main` is still real and must not be folded into the one just
|
|
478
478
|
> retracted — but the residual's own description was itself stale and needed correction on
|
|
479
479
|
> 2026-08-12 (live re-check, `[[reference_github_protection_two_layers]]`): legacy
|
|
480
|
-
> `required_status_checks.contexts` is **`["validate"]`**, not `[]` —
|
|
481
|
-
>
|
|
482
|
-
> `
|
|
480
|
+
> `required_status_checks.contexts` is **`["validate", "new-code-anchor"]`**, not `[]` — 🟥 re-read
|
|
481
|
+
> 2026-09-17 (both layers): the 2026-08-12 line said `["validate"]` and that had gone stale once
|
|
482
|
+
> `new-code-anchor` was promoted; a green `validate` AND a green `new-code-anchor` are required
|
|
483
|
+
> before a PR can merge, and `GET /rules/branches/main` carries only `non_fast_forward` — no
|
|
484
|
+
> competing `required_status_checks` rule, so the legacy field is the effective one here. `validate`
|
|
483
485
|
> (`.github/workflows/validate.yml`) is a **separate job from Axis 1** (`regression-guard.yml`) —
|
|
484
|
-
> Axis 1 is still not required, see the 4-axis section below.
|
|
486
|
+
> Axis 1 is still not required, see the 4-axis section below. 🟥 But since 2026-08-29 (#552) Axis 1
|
|
487
|
+
> **does run** on every 4-axis asset class (its `paths:` was widened); the remaining gap is
|
|
488
|
+
> "runs but not required", not "does not run". The gap on `validate` is
|
|
485
489
|
> `strict: false`: that check re-runs on every push to the PR branch, but nothing re-forces it
|
|
486
490
|
> against a **moving** main after it last ran — so a check that passed can still land behind
|
|
487
491
|
> concurrent merges it never saw.
|