@chrono-meta/fh-gate 3.45.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.
@@ -11,25 +11,25 @@
11
11
  "plugins": [
12
12
  {
13
13
  "name": "fh-meta",
14
- "version": "3.45.0",
14
+ "version": "3.46.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.45.0",
20
+ "version": "3.46.0",
21
21
  "description": "Project-agnostic utility skills — 7 skills (convergence-loop · deliberation · mcp-circuit-breaker · token-budget-gate · ko-tech-writer · persona-cast · standpoint-review) + 7 agents (quench-challenger + the web-review cast: designer · ux-writer · fe-dev · be-dev · qa · a11y). 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.45.0",
26
+ "version": "3.46.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.45.0",
32
+ "version": "3.46.0",
33
33
  "description": "preprep — a presentation-preparation harness. 1 skill. 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/CHEATSHEET.md CHANGED
@@ -239,6 +239,8 @@ npx --package @chrono-meta/fh-gate fh-gate "src/foo.ts" full # explicit files +
239
239
  FH_BACKEND=codex npx --package @chrono-meta/fh-gate fh-gate # Codex backend (default: claude)
240
240
  # → FH_GATE_VERDICT: PASS | PENDING | BLOCKED | ESCALATE
241
241
  # → exit: 0 PASS · 1 PENDING · 2 BLOCKED · 3 ESCALATE · 10 harness error · 11 arg error · 12 dry-run
242
+ # → a changed file whose name holds a newline cannot be passed on: fh-gate (and fh-goal) exit 10
243
+ # instead of reviewing the rest. Rename the file, or name the files to review explicitly.
242
244
 
243
245
  # Run a skill or agent doc through a backend, outside Claude Code
244
246
  npx --package @chrono-meta/fh-gate fh-run --skill <name>
@@ -526,7 +528,7 @@ Claude agents feature
526
528
  | `harness-doctor` | Diagnoses harness structure (L1–L4) on the principle "a good harness gets simpler over time" | "check my Claude setup", "the harness feels complex", "too many skills" |
527
529
  | `context-doctor` | Finds the 3 main causes of token waste + prescribes `.claudeignore` / `/clear` timing | "session is slow", "context is getting full", "clean up context" |
528
530
  | `install-doctor` | Diagnoses conflicts/duplicates/overwrite risks before installing plugins into a project | "check the install", "verify my setup", "will this overwrite anything" |
529
- | `mcp-circuit-breaker` *(commons)* | Detects MCP failure loops, trips a breaker to stop retry waste, proposes alternatives | "MCP keeps failing", "same tool error is looping" |
531
+ | `mcp-circuit-breaker` *(commons)* | Detects MCP failure loops, trips a breaker to stop retry waste, proposes alternatives. A success status with the wrong shape (an HTML page where JSON was expected) counts as a failure (`WRONG_SHAPE`) and does not close the breaker | "MCP keeps failing", "same tool error is looping" |
530
532
 
531
533
  ### Harvesting & learning — *"keep what we learned"*
532
534
 
@@ -552,6 +554,8 @@ Claude agents feature
552
554
  > **Going public?** Don't run these one at a time — say **"publish"** / **"make this repo public"** and Claude
553
555
  > fires the **Pre-Publish Surface Gate** (CLAUDE.md), which runs `public-surface-audit` + `marketplace-gate`
554
556
  > Check 5 *before* the irreversible action. Portable checklist: `templates/PRE-PUBLISH-CHECKLIST.md`.
557
+ > Publishing a filtered copy (protected paths stripped, pushed to a second remote)? Its Step 0b checks that
558
+ > the stripped tree did not flow back into your own `main` — a tree diff shows it, commit counts do not.
555
559
 
556
560
  ### Discovery — *"what's out there?"*
557
561
 
@@ -567,7 +571,7 @@ Claude agents feature
567
571
  |---|---|---|
568
572
  | `sim-conductor` | Profiles a target → derives personas → parallel-agent audit → M/S/R triage. Areas: A external-user · B internal-audit · C ideation | "external user perspective", "run an internal audit", "simulate this" |
569
573
  | `apex-review` | Reviews from a top-level decision-maker's lens, not a practitioner's | "will this hold up for leadership", "CTO-level review", "approval deck" |
570
- | `deep-clarify` | Turns a vague request into an actionable spec through Socratic questioning | "I'm not sure what to build", "help me clarify the requirements" |
574
+ | `deep-clarify` | Turns a vague request into an actionable spec through Socratic questioning, saved to `specs/{slug}.md` in the work folder (not under `.claude/`, where Claude Code asks before writing) | "I'm not sure what to build", "help me clarify the requirements" |
571
575
 
572
576
  ### Setup & onboarding — *"get started / keep it tidy"*
573
577
 
@@ -292,6 +292,7 @@ priority: high|medium|low
292
292
  ## Session Retrospective ← 마감 회고로 생성된 신호만. 상한 8줄. 이벤트 신호는 이 절 없음
293
293
  - 정정: {운영자가 나를 정정한 건수} — 각 한 줄, 무엇을 어떻게 틀렸나
294
294
  - 자력 {N} / 타력 {M} — 타력은 **잡은 축 이름**으로 (레인 · 되돌림 · cross-family · 첫실사용 · ⓓ · 운영자 · CI)
295
+ - 막지 못한 통제: {그 결함이 지나간 게이트 · 레인 · 훅 이름, 또는 「그 자리에 통제 없음」} — 잡은 축과 따로 적는다. 같은 이름이 쌓이면 «어느 통제가 반복해서 새는가» 가 보인다
295
296
  - 안 돌린 축: {이름, 또는 「없음」}
296
297
  - 반복: {이번이 N번째인 실수 — memory 키 또는 「신규」}
297
298
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrono-meta/fh-gate",
3
- "version": "3.45.0",
3
+ "version": "3.46.0",
4
4
  "description": "FH runtime adapters — run FH governance, skills, and agents via Claude or Codex with machine-parseable gates.",
5
5
  "homepage": "https://github.com/chrono-meta/forge-harness#readme",
6
6
  "bugs": {
@@ -187,6 +187,8 @@
187
187
  "scripts/absorption_queue.py",
188
188
  "scripts/test_absorption_queue_lanes.sh",
189
189
  "scripts/test_meta_prompt_restate_lanes.sh",
190
+ "scripts/test_deep_clarify_spec_path_lanes.sh",
191
+ "scripts/test_deep_clarify_interview_lanes.sh",
190
192
  "scripts/catch_tally.py",
191
193
  "scripts/test_catch_tally_lanes.sh",
192
194
  "scripts/test_name_boundary_locale_lanes.sh",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-commons",
3
- "version": "3.45.0",
3
+ "version": "3.46.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -40,7 +40,7 @@ HALF-OPEN → Recovery probe (1 test call allowed, resets if success)
40
40
  ```
41
41
 
42
42
  Default thresholds:
43
- - **Trip threshold**: 3 consecutive failures of the same tool
43
+ - **Trip threshold**: 3 consecutive failures of the same tool for transient types (`TIMEOUT`, `RATE_LIMIT`, and `MALFORMED` / `UNKNOWN` until known); **1** for the non-transient types (`ADMIN_GATED`, `AUTH`, `NOT_FOUND`, `WRONG_SHAPE`) — see Step 2
44
44
  - **Half-open probe**: after 60s cooldown (or explicit user command)
45
45
  - **Reset**: 1 successful call in HALF-OPEN state → back to CLOSED
46
46
 
@@ -75,11 +75,14 @@ Classify failure type:
75
75
  | `AUTH` | 401 / 403 response | Credentials expired or missing |
76
76
  | `NOT_FOUND` | 404 / tool not available | Server down / tool removed |
77
77
  | `MALFORMED` | Parse error on response | Schema mismatch / API change |
78
+ | `WRONG_SHAPE` | No error and a success status (e.g. HTTP 200), but the answer is not the expected shape — an HTML page where JSON was expected, or an expected field missing | Wrong host or path (a field run: a webhook path called on the API host returned 200 with a generic HTML page, so the call «succeeded» and did nothing) — retrying the same endpoint will not fix it |
78
79
  | `RATE_LIMIT` | 429 / quota exceeded | Too many calls |
79
80
  | `ADMIN_GATED` | "instance admin approval required" / server pending org enablement / tool unavailable until approved | Capability exists; the **MCP mount** is gated behind instance/admin permission — not a transport failure. Retrying never recovers it (an admin must act) |
80
81
 
81
82
  If failure type cannot be determined: classify as `UNKNOWN`.
82
83
 
84
+ `MALFORMED` vs `WRONG_SHAPE`: the answer could not be parsed at all → `MALFORMED`; it parsed (or arrived as a page) but is not what the caller needs → `WRONG_SHAPE`.
85
+
83
86
  > **`ADMIN_GATED` is not a retry case.** Distinguish *capability unavailable* from *MCP transport
84
87
  > unavailable*: when the block is an org/admin approval dependency, do not burn retries — route straight
85
88
  > to the lower-permission substitute in Step 4 (Priority 1b).
@@ -92,12 +95,13 @@ Count consecutive failures of the identified tool in the current session context
92
95
 
93
96
  | Count | Action |
94
97
  |---|---|
95
- | 1 | Log warning. Continue — *"MCP tool {name} failed once. Monitoring."* |
96
- | 2 | Escalate warning. Suggest checking server status. |
98
+ | 1 | Transient type: log warning and continue — *"MCP tool {name} failed once. Monitoring."* Non-transient type (see below): **TRIP CIRCUIT** now |
99
+ | 2 | Transient type: escalate warning. Suggest checking server status. |
97
100
  | 3+ | **TRIP CIRCUIT** → output circuit open notice, block further calls to this tool |
98
101
 
99
- > **Non-transient types trip at count 1, not 3.** `ADMIN_GATED`, `AUTH`, and `NOT_FOUND` do not recover
100
- > on retry (an admin must act / credentials must change / the tool is gone), so counting to 3 only wastes
102
+ > **Non-transient types trip at count 1, not 3.** `ADMIN_GATED`, `AUTH`, `NOT_FOUND` and `WRONG_SHAPE` do not
103
+ > recover on retry (an admin must act / credentials must change / the tool is gone / the host or path is wrong,
104
+ > so the same call keeps getting the same wrong answer), so counting to 3 only wastes
101
105
  > calls. On the first failure of one of these types, trip immediately and go to Step 4. The 1→2→3 ramp is
102
106
  > for *transient* types (`TIMEOUT`, `RATE_LIMIT`) where a later call may succeed.
103
107
 
@@ -127,6 +131,7 @@ cat >> .claude/mcp_circuit/circuit_log.yaml << EOF
127
131
  state: OPEN # OPEN | HALF-OPEN | CLOSED — same enum as Done When
128
132
  failure_type: {TYPE}
129
133
  failure_count: {N}
134
+ expected_shape: {content type + the field the caller needs — WRONG_SHAPE only; the Step 5 probe checks against it}
130
135
  tripped_at: {ISO-8601}
131
136
  reset_at: null
132
137
  EOF
@@ -141,6 +146,7 @@ Present the relevant fallback options ranked by effort (at least 3):
141
146
  | Priority | Alternative | When to Use |
142
147
  |---|---|---|
143
148
  | **1 — Substitute tool** | Use a different MCP tool or built-in tool that covers the same task | Tool-specific failure (NOT_FOUND, AUTH) |
149
+ | **1a — Fix the endpoint** | Check the configured host and path against the service's documentation (an API host and a webhook host are often different), correct it, then let the Step 5 probe confirm the expected shape | `WRONG_SHAPE` |
144
150
  | **1b — Lower-permission API / workflow substitute** | The MCP mount is gated, but the underlying capability is usually still reachable through a member-scoped path: a Personal-Access-Token REST API call, or a workflow-automation runner. Before relying on it, confirm **credential scope** (a member-level token suffices?), **audit parity** (logged where the MCP path would log?), and **behavior gap** (what the MCP path does that this does not — e.g. natural-language workflow creation vs hand-written JSON). | `ADMIN_GATED` |
145
151
  | **2 — Degrade gracefully** | Skip the MCP step, note the gap, continue with available information | TIMEOUT / RATE_LIMIT |
146
152
  | **3 — Pause and retry** | Wait for server recovery (HALF-OPEN probe after cooldown) | Transient failure (TIMEOUT, RATE_LIMIT) |
@@ -179,7 +185,7 @@ Sending HALF-OPEN probe to {tool-name}...
179
185
  ```
180
186
 
181
187
  - 1 minimal test call is allowed through
182
- - If success: circuit → CLOSED, log updated
188
+ - If success: circuit → CLOSED, log updated. **Success = the answer has the expected shape** (the content type and at least one field the caller needs), not a success status alone — a 200 with an HTML page or without that field is `WRONG_SHAPE`, and the circuit stays OPEN
183
189
  - If fail: circuit remains OPEN, cooldown resets
184
190
 
185
191
  Reset log entry — **append as a NEW list item (`- tool:`), never as bare indented keys**:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-meta",
3
- "version": "3.45.0",
3
+ "version": "3.46.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -2,6 +2,33 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### [3.46.0] — 2026-11-21
6
+
7
+ Minor by the version policy. Skill behaviour changes: `deep-clarify` saves its spec outside `.claude/` (#1162) and changes its interview (#1174); `mcp-circuit-breaker` names `WRONG_SHAPE` and trips it on the first failure (#1164, #1171); the close retrospective has five fields (#1166). There is also a new record field on the live-eval behaviour profile (#1167) and new shipped lanes: new lane files (#1162, #1174) and a new case in an existing one (#1161).
8
+
9
+ One change makes a shipped helper refuse more by default; see its `BREAKING (gate):` entry: `pr_merge_verified.sh` refuses a commit id that is not full length (#1163).
10
+
11
+ ### Added
12
+ - Live-eval behaviour profile (record only): each `behaviour-profile:` line that has a stream carries `first_error=` after `total=` — the 1-based position of the first top-level tool call whose result is an error, `none` when every call has a result and none is an error, or `unknown` when a call before that has no result (not measured is not «no error»). Calls inside subagents are not counted. Nothing scores it; verdict rows are unchanged. `live_eval_trace.py profile` (shipped). (#1167)
13
+
14
+ ### Changed
15
+ - `deep-clarify` (shipped) interview: Round 1 asks the upper goal (Why) as its own question next to completion criteria, and scope moves to Round 2. A textbook phrase («make it scalable», «standard architecture») is not recorded as a requirement — the skill asks once what is actually needed; a repeat answer becomes an `(inferred: …)` guess and an open question. Round 3 tests understanding with one design option the user has not mentioned, judged against the Why as the user stated it: a contradiction gets one re-ask in the same round, then goes under Open questions. Step 4's default next step is a new session that reads only the saved spec; «Start implementation directly» stays as a non-default option. The spec format gains `## Why`, `## Understanding check` and `## Open questions`. The 3-round · 2-question cap, the `(inferred: X)` guesses, the Excluded scope and the `specs/` path are unchanged. New lane `scripts/test_deep_clarify_interview_lanes.sh` (shipped) checks the round templates' structure, not whether a model follows them. (#1174)
16
+ - `mcp-circuit-breaker` (shipped) names a new failure type, `WRONG_SHAPE`: no error and a success status (e.g. HTTP 200), but the answer is not the expected shape — an HTML page where JSON was expected, or a needed field missing. The half-open recovery probe counts as success only when the answer has the expected shape, so such an answer leaves the circuit OPEN. `WRONG_SHAPE` trips the circuit on its first failure, like `ADMIN_GATED`, `AUTH` and `NOT_FOUND`: the host or path is wrong, so the same call keeps getting the same wrong answer. The other types keep their counts. The trip threshold line and the Step 2 table now say which types trip at 1; Step 2 says how to tell `MALFORMED` (could not be parsed) from `WRONG_SHAPE` (parsed, but not what the caller needs); the trip log gains an `expected_shape:` line that the Step 5 probe checks against; and Step 4 gains a «fix the endpoint» row for `WRONG_SHAPE`. (#1164, #1171, release audit)
17
+ - `templates/PRE-PUBLISH-CHECKLIST.md` (shipped) gains Step 0b for publishing a filtered copy: check that the stripped tree did not flow back into your own branch with `git diff --name-status origin/main main` — commit counts and ahead/behind look normal when it has. The step says `origin` must be the unfiltered upstream, that protected paths come from the filter's own exclusion list, and how to put deleted files back (anything wider goes through the Destructive-Op gate). Text only; no script or hook. (#1165, release audit)
18
+ - The session close retrospective (`fh_detail_protocols.md`, shipped) gains a `막지 못한 통제:` line — the gate, lane or hook a defect slipped past, or «그 자리에 통제 없음» — beside the caught-by line; `harvest-loop` Step 0-d now asks for five fields. New records only. (#1166)
19
+ - `memory-hygiene` (shipped) Step 3 describes an optional `metadata.evidence:` line — the narrowest source of a lesson (a commit hash, PR number, log line or `file:line`), written when the memory is created and opened first on re-verify. Optional and never inferred; an older entry without it is not an error, and a pointer that no longer resolves is reported, not filled in. Staleness thresholds and type methods are unchanged. (#1170)
20
+ - `CHEATSHEET.md` (shipped) rows catch up with four merged behaviours: the deep-clarify spec path, `WRONG_SHAPE`, pre-publish Step 0b, and a newline-named file making `fh-gate` / `fh-goal` exit 10. (#1169)
21
+
22
+ ### Fixed
23
+ - `test_fh_gate_defaults_lanes.sh` (shipped) run where there is no `action.yml` — the npm package, or a field harness that syncs FH's lanes — names D7 as skipped («NOT-APPLICABLE … not measured, not a pass») and prints `1 skipped (not a pass)`; before, D7 failed there and the suite exited 1 (3.45.0). In an FH checkout a missing `action.yml` is still reported by `test_action_yml_lanes.sh` (exit 10). New lane D12 runs the lane from a copy without `action.yml`. (#1161)
24
+ - `deep-clarify` (shipped) saves its spec to `specs/{slug}.md` in the work folder instead of `.claude/specs/{slug}.md`. Claude Code treats `.claude/` as sensitive: a headless run had the write refused, and an interactive user got a «modify sensitive file» prompt. The ABORT-if-exists check, the `test -f` save check and the gitignore advice for company projects keep their logic and now name `specs/`; a spec already saved under `.claude/specs/` stays there, and both paths are gitignored in this repo. New lane `scripts/test_deep_clarify_spec_path_lanes.sh` (shipped) runs the skill's own Step 3 commands in an empty folder. (#1162)
25
+ - BREAKING (gate): `pr_merge_verified.sh` (shipped), the merge helper.
26
+ - What changed: it refuses, before the merge call, a PR head or `--expect-head` that is not a full 40- or 64-character lowercase hex commit id, and says the value may have been cut on the way (PR head: exit 4 · `--expect-head`: exit 2, the existing usage code).
27
+ - Why: a field run saw an output-compression proxy shorten `git rev-parse HEAD` to 37 characters. A short value still resolves locally, so before this the merge call went out with it and failed later with no hint why.
28
+ - What now blocks: a cut commit id, or one that is not lowercase hex. A full lowercase id behaves as before.
29
+ - Remedy: pass the full id (for example from `gh pr view --json headRefOid`); if an output proxy shortens it, run that command through the proxy's raw escape hatch (for rtk: `rtk proxy <cmd>`). The script's usage line and header now name `--expect-head` and these two exits.
30
+ - `context-doctor` gains one line where it recommends a command-output proxy: values a later step reads as data must bypass the proxy or be checked. (#1163)
31
+
5
32
  ### [3.45.0] — 2026-11-20
6
33
 
7
34
  Minor by the version policy: fh-gate gains an execution layer, a review pass that follows `/code-review`'s method, a history-aware «elephant» pass and `/code-review` itself as an opt-in reviewer (#1147, #1156). There are also new shipped tools and lanes (`live_eval_matrix.py`, `heavy_skill_smell.py`, `job_heartbeat.py`), a new `FH_AGY_ISOLATION=no-tools-agent` route, and judged procedure changes in shipped skills and canon.
@@ -219,6 +219,7 @@ The reductions above all act on the **context-footprint** axis (files, history r
219
219
  - ⚠️ **Name collision**: there is an unrelated `reachingforthejack/rtk` (Rust Type Kit). Verify the Token-Killer build — `rtk gain` (savings analytics) should work; "command not found" means the wrong binary.
220
220
  - **No-reinvention**: FH **routes to** this tool; it does not rebuild a token-killer. Install + hook wiring live in the user's own config (global `CLAUDE.md` / `settings.json`), never reimplemented here.
221
221
  - ⚠️ **Never filter a command whose output a mechanical gate parses.** FH gates read raw command output (a pre-commit hook greps, `regression_guard` diffs). A filtered `git diff` / `git log` feeding a gate gives the gate wrong input — the same trap as grepping filtered prose for a verdict (typed-verdict-channel). Keep filtering off gate-input paths, and keep a raw escape hatch (`rtk proxy <cmd>`).
222
+ - ⚠️ **Values a later step reads as data must bypass the proxy or be checked.** Trimming is for reading, not for data: the same layer can shorten a hash, object ID, token or digest that a later command consumes. A field run saw `git rev-parse HEAD` come back 37 of 40 characters, and the API call that used it failed later with no hint why. Run such commands through the raw escape hatch, or check the value's shape before use (a full commit id is 40 or 64 hex characters — `pr_merge_verified.sh` refuses anything else).
222
223
 
223
224
  **Prescription**: in a normal token environment, recommend the per-call flags (#1) and **do not** suggest installing a proxy — the lossy risk is not worth it. Only when the user states or exhibits a binding token constraint, surface #2 with the gate-input caveat above. Diagnosis + recommendation, never an auto-install.
224
225
 
@@ -40,44 +40,83 @@ Quickly identify the following from the user's request.
40
40
 
41
41
  ```
42
42
  Clarity check:
43
+ □ Upper goal — Why (why this is wanted, what is better once it is done) — ask if unclear
43
44
  □ Final state (what will be different when done?) — ask if unclear
44
45
  □ Completion criteria (how will it be verified?) — ask if unclear
45
46
  □ Constraints (what must not be done, what must not be touched) — ask if unclear
46
47
  □ Priority (fast vs thorough, now vs later) — ask if unclear
48
+ □ Textbook phrases in the request (see below)
47
49
  ```
48
50
 
49
- **Direct entry conditions** (skip to Step 3 without questions):
50
- - Request is specific and completion criteria are clear → draft spec document and confirm
51
+ The Why is asked on its own, not folded into the Goal: when it is missing, the gaps get filled with the AI's
52
+ own defaults, and every later choice inherits them.
53
+
54
+ ### Textbook phrases
55
+
56
+ A phrase that sounds like a requirement but does not say what to do — "make it scalable", "standard
57
+ architecture", "clean code", "best practice", "production-ready", "user-friendly" (examples, not a closed
58
+ list) — is **not recorded as a requirement**. Ask once what is actually needed behind it, with a concrete
59
+ guess: *"'Scalable' — for how many users or how much data, and what must not get slower? (inferred: one team,
60
+ a few hundred records)"*. This question uses one of the round's two slots. If the answer is the phrase again,
61
+ record your guess as `(inferred: …)` in the spec and list it under Open questions — do not ask a second time.
62
+
63
+ **Direct entry conditions** (skip Rounds 1–2 and go straight to Round 3):
64
+ - Request is specific and completion criteria are clear → draft the spec (Step 3's format), then run Round 3's
65
+ understanding check; Step 3 saves the result
51
66
  - Clarity at the level of "add Y feature to file X"
52
67
 
53
68
  ---
54
69
 
55
70
  ## Step 2. Socratic Dialogue
56
71
 
57
- ### Round 1 — Goal / Completion Criteria (core 2 questions)
72
+ ### Round 1 — Why / Completion Criteria (core 2 questions)
58
73
 
59
74
  ```
60
75
  Clarification needed.
61
76
 
62
- 1. Completion criteria: What does a completed [task name] look like?
77
+ 1. Why: What is this for — what will be better once it is done?
78
+ (inferred: [inferred upper goal] — confirm if correct)
79
+
80
+ 2. Completion criteria: What does a completed [task name] look like?
63
81
  (inferred: [inferred completion criteria] — confirm if correct)
82
+ ```
83
+
84
+ Skip a question the request already answers. A textbook phrase (Step 1) takes the free slot here or in Round 2.
85
+
86
+ ### Round 2 — Scope / Constraints / Priority (only if needed)
64
87
 
65
- 2. Scope: Which of [A / B / C] takes priority?
88
+ Skip if Round 1 resolves everything. Ask at most two of the items still open — scope, what must not be done,
89
+ priority, a textbook phrase — and infer the rest as `(inferred: X)`.
90
+
91
+ ```
92
+ 1. Scope: Which of [A / B / C] takes priority?
66
93
  (inferred: [inferred choice] — reason: [rationale])
94
+ 2. Is there anything this task must absolutely not do?
95
+ (or, if that is already clear: Which takes priority — fast completion vs solid design?)
67
96
  ```
68
97
 
69
- ### Round 2 — Constraints / Priority (only if needed)
98
+ ### Round 3 — Understanding Check (always — one question, a second only on a contradiction)
70
99
 
71
- Skip if Round 1 resolves everything.
100
+ Draft the spec first and show its summary, Excluded scope included. Then test understanding instead of asking
101
+ "is this right?" — agreement proves little, a choice proves more. Pick **one design option the user has not
102
+ mentioned**, one whose answer follows from the Why (for example: save to a local file vs a server database;
103
+ one shared page vs a page per user).
72
104
 
73
105
  ```
74
- 1. Is there anything this task must absolutely not do?
75
- 2. Which takes priority: fast completion vs solid design?
106
+ 1. One choice we have not discussed: for [decision], [option A] or [option B]?
107
+ (I expect [A], because your Why is "[Why in their words]")
108
+ 2. (only if the pick contradicts the Why) You picked [B], but [B] means [consequence], and your Why was
109
+ "[Why]". Which matters more here?
76
110
  ```
77
111
 
78
- ### Round 3 — Final Confirmation (only if needed)
79
-
80
- Draft the spec first, then single confirmation: "Is this the right direction?"
112
+ - Judge the fit against the Why **as the user stated it**. The reason the user gives for the pick ("less
113
+ hassle") is not part of the Why unless they say so; if the pick's consequence works against the stated Why
114
+ (it may miss what they said they need to find), that is a contradiction even when the reason sounds fair.
115
+ - The pick fits the Why → understanding confirmed; record it in `## Understanding check`.
116
+ - It contradicts the Why → ask question 2 (the same round, so the 3-round · 2-question cap holds). Update the
117
+ Why or the spec from the answer.
118
+ - Still contradictory after question 2 → stop asking: write the conflict under Open questions in the spec and
119
+ end. Do not open a fourth round.
81
120
 
82
121
  ---
83
122
 
@@ -89,23 +128,27 @@ path is not saving it.
89
128
  1. Derive the slug: `slug = kebab-case(spec title) + "-" + YYYYMMDD`
90
129
  (lowercase, non-alphanumerics → `-`, collapse repeats, strip leading/trailing `-`).
91
130
  Example: "Rewrite the login flow" on 2026-08-11 → `rewrite-the-login-flow-20260811`.
92
- 2. If `.claude/specs/{slug}.md` **already exists → ABORT** and report the existing path.
131
+ 2. If `specs/{slug}.md` **already exists → ABORT** and report the existing path.
93
132
  Never overwrite and never silently suffix — an existing spec is a prior decision to extend or
94
133
  supersede, and that is the user's call.
95
134
  3. Create the directory, then write the file with the **Write** tool (not a shell redirect):
96
135
 
97
136
  ```bash
98
- mkdir -p .claude/specs
137
+ mkdir -p specs
99
138
  ```
100
139
 
101
- Then `Write` → `.claude/specs/{slug}.md` with the format below, and verify:
140
+ Then `Write` → `specs/{slug}.md` with the format below, and verify:
102
141
 
103
142
  ```bash
104
- test -f .claude/specs/{slug}.md && echo "SPEC SAVED: .claude/specs/{slug}.md"
143
+ test -f specs/{slug}.md && echo "SPEC SAVED: specs/{slug}.md"
105
144
  ```
106
145
 
146
+ **Where**: `specs/` in the work folder, not under `.claude/` — Claude Code asks before writing there, so a
147
+ headless run is refused and an interactive user gets a «modify sensitive file» prompt. A spec an earlier
148
+ version saved under `.claude/specs/` stays where it is.
149
+
107
150
  **Residency**: the spec records the user's goals, constraints, and "must not touch" list.
108
- `.claude/specs/` is gitignored in this repo; **in a company project, confirm the path is gitignored
151
+ `specs/` is gitignored in this repo; **in a company project, confirm the path is gitignored
109
152
  there too before writing** — if it is not, write to a gitignored location instead.
110
153
 
111
154
  ### Spec Document Format
@@ -115,7 +158,10 @@ there too before writing** — if it is not, write to a gitignored location inst
115
158
  Created: {date} | Status: draft
116
159
 
117
160
  ## Goal
118
- {One sentence — what is being built and why}
161
+ {One sentence — what is being built}
162
+
163
+ ## Why
164
+ {The upper goal in the user's words — why it is wanted, what is better once it is done}
119
165
 
120
166
  ## Completion Criteria
121
167
  - [ ] {verifiable condition 1}
@@ -132,6 +178,12 @@ Excluded: {what is explicitly excluded}
132
178
  ## Priority
133
179
  {Fast completion / Solid design / Balanced} — {reason}
134
180
 
181
+ ## Understanding check
182
+ Option offered: {the choice not discussed before} · Picked: {answer} · Fits the Why: {yes / re-asked → yes / no — see Open questions}
183
+
184
+ ## Open questions
185
+ {conflicts left after Round 3, textbook phrases the user did not unpack — or "none"}
186
+
135
187
  ## References
136
188
  {related files / existing skills / prerequisite work}
137
189
  ```
@@ -140,13 +192,14 @@ Excluded: {what is explicitly excluded}
140
192
 
141
193
  ## Step 4. Follow-up Connections
142
194
 
143
- After generating the spec document, suggest the appropriate next path:
195
+ After generating the spec document, suggest the appropriate next path. The first row is the default:
144
196
 
145
197
  | Situation | Connected skill |
146
198
  |---|---|
147
- | Agent orchestration needed for implementation | `agent-composer` — pass spec document path |
199
+ | **Default** — implementation | Open a new session that reads only the saved spec (`specs/{slug}.md`) and implement there. The guesses this interview corrected stay in this window and would otherwise pull the implementation back toward them |
200
+ | Agent orchestration needed for implementation | `agent-composer` — pass spec document path (it, too, should read the spec, not this conversation) |
148
201
  | Plan / design review needed | built-in `Plan` agent — build plan based on spec |
149
- | Single task is now clear | Start implementation directly |
202
+ | Single task is now clear and the user wants to stay here | Start implementation directly (not the default — offer it when the user asks) |
150
203
  | Audit needed before external sharing | `hub-persona-auditor` |
151
204
 
152
205
  ---
@@ -156,7 +209,8 @@ After generating the spec document, suggest the appropriate next path:
156
209
  | Condition | Completion verdict | Check class |
157
210
  |---|---|---|
158
211
  | Socratic dialogue complete (≤3 rounds, ≤2 questions/round) | ✅ Clarification complete | **mandatory-pass** |
159
- | `test -f .claude/specs/{slug}.md` exits 0 — the file **exists on disk** | ✅ Save complete | **mandatory-pass** (a printed path is not a saved file) |
212
+ | `test -f specs/{slug}.md` exits 0 — the file **exists on disk** | ✅ Save complete | **mandatory-pass** (a printed path is not a saved file) |
213
+ | The spec's `## Why` and `## Understanding check` are filled — the option offered, the pick, and whether it fits the Why (a contradiction left open is listed under Open questions) | ✅ Understanding tested | **mandatory-pass** (an empty or "n/a" Understanding check fails) |
160
214
  | The spec's Completion Criteria are independently verifiable — someone other than the author could tell whether each is met | ✅ Spec actionable | **judged** — adversarial pairing: `fh-meta:beginner` cold-reads the spec and attempts to state, per criterion, how they would check it; a criterion they cannot operationalize fails |
161
215
  | Follow-up skill connection suggestion output | ✅ Handoff complete | **mandatory-pass** |
162
216
 
@@ -72,12 +72,12 @@ Session end
72
72
  **운영자 발화가 인용돼 기록되는 순간** 승인된다. 전자는 세션이 자기 권한을 넓히는 형태다.
73
73
 
74
74
  산출: 오늘자 `tracks/_meta/fh_signal_{date}_{source}.md` 에 `retro: close` 를 달고
75
- `## Session Retrospective` 4필드를 채운다(형식 정본 = fh_detail_protocols.md).
75
+ `## Session Retrospective` 5필드를 채운다(형식 정본 = fh_detail_protocols.md).
76
76
  「없음」·「0」도 유효한 값이고, **비우는 것만 안 된다.**
77
77
 
78
78
  Done When:
79
79
  + 오늘자 signal 파일이 존재하고 `retro: close` 를 달고 있다 — mandatory-pass
80
- + Session Retrospective 4필드가 전부 채워졌다 — mandatory-pass
80
+ + Session Retrospective 5필드가 전부 채워졌다 — mandatory-pass
81
81
  + 정정 건수는 **세었지 회상하지 않았다** — measured
82
82
  + FH Registration Candidate 가 비면 그 이유가 한 줄 적혀 있다 — mandatory-pass
83
83
 
@@ -100,6 +100,12 @@ FRESH (<threshold):
100
100
 
101
101
  ### Step 3 — Re-verify Stale Entries
102
102
 
103
+ **Evidence pointer first.** An entry may carry `metadata.evidence:` — one line naming the narrowest source of
104
+ the lesson: a commit hash, a PR number, a log line or a `file:line`. Write it when the memory is created, next to
105
+ the session link it already has. When it is present, re-verify against it before the type method below; it is the
106
+ place to go back to. It is optional and never inferred: an older entry without it is not an error, and a pointer
107
+ that no longer resolves is reported as such, not filled in.
108
+
103
109
  For each stale entry, run the appropriate re-verification:
104
110
 
105
111
  **Reference type** (URLs, DOIs, GitHub):
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-preprep",
3
- "version": "3.45.0",
3
+ "version": "3.46.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-qp",
3
- "version": "3.45.0",
3
+ "version": "3.46.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -11,7 +11,7 @@ Two uses:
11
11
  extract <stream.jsonl> <out.txt> <tools.txt> (runner) write the final result text and the init
12
12
  tool/MCP/plugin inventory. Exit 3 on a stream that has no parseable result event — never an empty
13
13
  «the session said nothing» (same rule as sim_isolated_run.sh's turns path).
14
- profile <stream.jsonl> (runner) one record-only line: top-level tool calls in four bins
14
+ profile <stream.jsonl> (runner) one record-only line: top-level tool calls in four bins + first error depth
15
15
  (explore · edit · test-run · other). Exit 3 and «trace=UNREADABLE» on a stream it cannot read.
16
16
  library: parse_stream(path) · behave_hit(trace, spec) · inventory(trace) · profile_bins(trace)
17
17
 
@@ -37,7 +37,8 @@ def parse_stream(path):
37
37
  lines = open(path, encoding='utf-8').read().splitlines()
38
38
  except (OSError, UnicodeDecodeError):
39
39
  return None
40
- out = {'result': None, 'tools': None, 'mcp': None, 'plugins': None, 'calls': [], 'damaged': 0, 'ok_ids': set()}
40
+ out = {'result': None, 'tools': None, 'mcp': None, 'plugins': None, 'calls': [], 'damaged': 0, 'ok_ids': set(),
41
+ 'res_ids': set(), 'err_ids': set()}
41
42
  inits = [] # plugin set of every init event, in order
42
43
  for ln in lines:
43
44
  ln = ln.strip()
@@ -76,8 +77,12 @@ def parse_stream(path):
76
77
  out['calls'].append((str(c.get('name', '')), c.get('input') or {}, c.get('id')))
77
78
  elif t == 'user':
78
79
  for c in (ev.get('message') or {}).get('content') or []:
79
- if isinstance(c, dict) and c.get('type') == 'tool_result' and not c.get('is_error'):
80
- out['ok_ids'].add(c.get('tool_use_id'))
80
+ if isinstance(c, dict) and c.get('type') == 'tool_result':
81
+ out['res_ids'].add(c.get('tool_use_id'))
82
+ if c.get('is_error'):
83
+ out['err_ids'].add(c.get('tool_use_id'))
84
+ else:
85
+ out['ok_ids'].add(c.get('tool_use_id'))
81
86
  elif t == 'result':
82
87
  if ev.get('subtype') not in (None, 'success') or ev.get('is_error'):
83
88
  out['damaged'] += 1 # an error result is not a finished session
@@ -276,6 +281,18 @@ def profile_bins(trace):
276
281
  return out
277
282
 
278
283
 
284
+ def first_error(trace):
285
+ """1-based position of the first top-level call whose result is an error · 'none' when every top-level call
286
+ has a result and none is an error · 'unknown' when a call has no result before that (not measured ≠ no error).
287
+ Record only (AQ-20261101-2): a final PASS can hide a run that hit errors early and recovered by luck."""
288
+ for i, (_, _, cid) in enumerate(trace['calls'], 1):
289
+ if cid in trace['err_ids']:
290
+ return str(i)
291
+ if cid not in trace['res_ids']:
292
+ return 'unknown'
293
+ return 'none'
294
+
295
+
279
296
  def _profile(src):
280
297
  """One line for the report. A stream that cannot be read says so (exit 3) — never counts of 0.
281
298
  A stream with no result event or damaged lines keeps its counts and says they are a lower bound."""
@@ -285,6 +302,7 @@ def _profile(src):
285
302
  return 3
286
303
  p = profile_bins(tr)
287
304
  line = ' '.join('%s=%d' % (b, p[b]) for b in PROFILE_BINS) + ' total=%d' % sum(p.values())
305
+ line += ' first_error=%s' % first_error(tr)
288
306
  flags = []
289
307
  if tr['result'] is None:
290
308
  flags.append('result=MISSING')
@@ -16,7 +16,7 @@
16
16
  # 🟥 This script does not decide whether to merge. Approval is still yours — it only makes the
17
17
  # verification impossible to forget once you do.
18
18
  #
19
- # USAGE bash scripts/pr_merge_verified.sh <pr-number> --rerun '<command>' [--repo <path>] [--lease '<label>']
19
+ # USAGE bash scripts/pr_merge_verified.sh <pr-number> --rerun '<command>' [--repo <path>] [--lease '<label>'] [--expect-head <full sha>]
20
20
  # RECEIPT once GitHub has accepted the merge request (every outcome from there: verified · verify failed · queued/not completed ·
21
21
  # merged from another head · not fetchable — never for a refusal or a merge GitHub did not take) one JSON line goes to
22
22
  # ${PMV_RECEIPTS:-<git common dir>/fh-merge-receipts.jsonl} — local, never pushed: pr · head · merge · outcome ·
@@ -25,8 +25,10 @@
25
25
  # Why: arXiv:2610.28683 — 27% of merges that passed a «non-author review» gate rested on an agent approving under a
26
26
  # human account; who decided must be on the record, not inferred later (frontier digest 2026-10-23).
27
27
  # EXIT 0 merged + verified · 1 merged but verify FAILED (the merge stands — act on it)
28
- # 2 usage (nothing merged) · 3 trivial --rerun refused (nothing merged)
29
- # 4 harness error (see message: before or after the merge)
28
+ # 2 usage (nothing merged) — includes an --expect-head that is not a full 40/64-char lowercase hex id
29
+ # 3 trivial --rerun refused (nothing merged)
30
+ # 4 harness error (see message: before or after the merge) — includes a PR head read from gh that is not a full
31
+ # 40/64-char lowercase hex id (cut on the way, e.g. by an output-compression proxy; nothing merged)
30
32
  # 6 merge accepted but not completed (queue/lag) — NOT verified, nothing claimed
31
33
  # 7 lease merge refused: a --lease other than «operator…» and selfdev_merge_tier.sh did not say AUTO, or the tier
32
34
  # could not be read (nothing merged)
@@ -48,8 +50,15 @@ while [ $# -gt 0 ]; do
48
50
  *) [ -z "$PR" ] || { echo "🟥 one PR number only" >&2; exit 2; }; PR="$1"; shift ;;
49
51
  esac
50
52
  done
51
- case "$PR" in ''|*[!0-9]*) echo "🟥 usage: pr_merge_verified.sh <pr-number> --rerun '<cmd>'" >&2; exit 2 ;; esac
53
+ case "$PR" in ''|*[!0-9]*) echo "🟥 usage: pr_merge_verified.sh <pr-number> --rerun '<cmd>' [--repo <path>] [--lease '<label>'] [--expect-head <full sha>]" >&2; exit 2 ;; esac
52
54
  [ "$RERUN_SET" -eq 1 ] || { echo "🟥 --rerun is required — checked before merging so the verify half cannot be skipped" >&2; exit 2; }
55
+ # _full_oid <value> — true only for a full commit id: 40 (SHA-1) or 64 (SHA-256) lowercase hex. A shorter value can
56
+ # still resolve locally (git accepts abbreviations), so «resolves» is not «whole». A field run saw an output-compression
57
+ # proxy cut `git rev-parse HEAD` to 37 chars, and the API that took it failed later with no hint why.
58
+ _full_oid() { case "$1" in *[!0-9a-f]*|'') return 1 ;; esac; [ "${#1}" -eq 40 ] || [ "${#1}" -eq 64 ]; }
59
+ if [ -n "$EXPECT_HEAD" ] && ! _full_oid "$EXPECT_HEAD"; then
60
+ echo "🟥 --expect-head is not a full 40- or 64-hex commit id («${EXPECT_HEAD}», ${#EXPECT_HEAD} chars) — a shortened or cut value (an output proxy can do this) cannot pin a merge; not merging" >&2; exit 2
61
+ fi
53
62
  PSV="$(cd "$(dirname "$0")" && pwd)/post_squash_verify.sh"
54
63
  [ -f "$PSV" ] || { echo "🟥 HARNESS-ERROR (before merge): $PSV missing — not merging" >&2; exit 4; }
55
64
 
@@ -96,6 +105,7 @@ _clog() { # outcome-label merge_oid
96
105
  # 1. head before merge
97
106
  HEAD_OID=$(gh pr view "$PR" --json headRefOid -q .headRefOid < /dev/null) || HEAD_OID=""
98
107
  [ -n "$HEAD_OID" ] || { echo "🟥 HARNESS-ERROR (before merge): could not read PR #$PR head" >&2; exit 4; }
108
+ _full_oid "$HEAD_OID" || { echo "🟥 HARNESS-ERROR (before merge): PR #$PR head «${HEAD_OID}» is not a full 40- or 64-hex commit id (${#HEAD_OID} chars) — the value may have been cut on the way (an output proxy can do this); not merging" >&2; exit 4; }
99
109
  git fetch -q origin "pull/$PR/head" < /dev/null 2>/dev/null || git fetch -q origin "$HEAD_OID" < /dev/null 2>/dev/null || true
100
110
  git cat-file -e "$HEAD_OID^{commit}" 2>/dev/null \
101
111
  || { echo "🟥 HARNESS-ERROR (before merge): PR head $HEAD_OID not fetchable — not merging" >&2; exit 4; }
@@ -1325,6 +1325,8 @@ for _pair in \
1325
1325
  "scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
1326
1326
  "plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
1327
1327
  "plugins/fh-meta/skills/meta-prompt-builder/SKILL.md|scripts/test_meta_prompt_restate_lanes.sh" \
1328
+ "plugins/fh-meta/skills/deep-clarify/SKILL.md|scripts/test_deep_clarify_spec_path_lanes.sh" \
1329
+ "plugins/fh-meta/skills/deep-clarify/SKILL.md|scripts/test_deep_clarify_interview_lanes.sh" \
1328
1330
  "scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
1329
1331
  "scripts/catch_tally.py|scripts/test_catch_tally_lanes.sh" \
1330
1332
  "scripts/shell_name_boundary_scan.sh|scripts/test_name_boundary_locale_lanes.sh" \
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env bash
2
+ # test_deep_clarify_interview_lanes.sh — the shape of deep-clarify's interview after the four 2026-11-21 additions.
3
+ #
4
+ # WHY. A public «interview me» talk (2026-11-21, used as an idea source only — its numbers are unverified) and
5
+ # deep-clarify differed in four places: deep-clarify folded the upper goal (Why) into the one-line Goal, wrote
6
+ # textbook phrases («make it scalable») straight into the spec, never tested whether it had understood, and
7
+ # offered «start implementation directly» in the same window as an equal next step.
8
+ #
9
+ # WHAT IS CHECKED (structure of SKILL.md — the round templates are what a session copies):
10
+ # I1 Round 1 asks the Why as its own question, separate from the completion-criteria question
11
+ # I2 a textbook-phrase rule: such a phrase is not recorded as a requirement; ask once what is needed
12
+ # I3 the last round tests understanding with an option the user has not mentioned, checks the pick
13
+ # against the Why, re-asks once on a contradiction, then records an open question
14
+ # I4 Step 4's first (default) row is a new session that reads only the saved spec; «Start
15
+ # implementation directly» is still there and marked not the default
16
+ # I5 the spec format carries `## Why` and `## Understanding check`
17
+ # K1 kept: «maximum 3 rounds, maximum 2 questions per round», `(inferred:`, `Excluded:`, `specs/{slug}.md`
18
+ # K2 no round template holds more than 2 numbered questions (the cap holds after adding the Why)
19
+ # C controls: a copy with each of I1–I4 removed goes red on that case alone
20
+ # NOT CHECKED: whether a real session asks these questions — that is the blind Sonnet sim recorded in the
21
+ # PR, not this lane. A green run here means the template says it, not that a model does it.
22
+ #
23
+ # Usage: bash scripts/test_deep_clarify_interview_lanes.sh [<skill file>] Exit: 0 all pass · 1 any fail
24
+ set -uo pipefail
25
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
26
+ SKILL="${1:-$HERE/../plugins/fh-meta/skills/deep-clarify/SKILL.md}"
27
+ TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/deep_clarify_iv_XXXXXX")
28
+ trap 'rm -rf "$TMPROOT"' EXIT
29
+ pass=0; fail=0
30
+ ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
31
+ bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
32
+
33
+ # probe <skill file> — prints one line per case: «<id> ok» or «<id> <problem>»
34
+ probe() {
35
+ python3 - "$1" <<'PY'
36
+ import re, sys
37
+ t = open(sys.argv[1], encoding="utf-8").read()
38
+ def sec(start, end):
39
+ a = t.find(start)
40
+ if a < 0: return ""
41
+ b = t.find(end, a + len(start)) if end else -1
42
+ return t[a:b] if b > a else t[a:]
43
+ def say(i, ok, why): print(f"{i} ok" if ok else f"{i} {why}")
44
+ r1 = sec("### Round 1", "### Round 2")
45
+ blk = re.findall(r"```\n(.*?)```", r1, re.S)
46
+ qs = re.findall(r"^\s*(\d+)\.\s+(.*)$", blk[0], re.M) if blk else []
47
+ why_q = [n for n, q in qs if re.search(r"\bWhy\b", q)]
48
+ cc_q = [n for n, q in qs if re.search(r"[Cc]ompletion criteria", q)]
49
+ say("I1", why_q and cc_q and set(why_q).isdisjoint(cc_q),
50
+ f"Round 1 template: Why question {why_q or 'missing'}, completion-criteria question {cc_q or 'missing'} (must be separate)")
51
+ tb = sec("### Textbook phrases", "\n## ") or sec("Textbook phrase", "\n### ")
52
+ say("I2", bool(tb) and re.search(r"not (be )?record", tb) and re.search(r"[Aa]sk once", tb),
53
+ "no textbook-phrase rule that says «not recorded as a requirement» and «ask once»")
54
+ r3 = sec("### Round 3", "\n## ")
55
+ say("I3", bool(r3) and re.search(r"not (yet )?(mentioned|discussed)", r3) and re.search(r"\bWhy\b", r3)
56
+ and re.search(r"[Oo]pen question", r3),
57
+ "Round 3 lacks the unmentioned-option test against the Why with an open-question fallback")
58
+ s4 = sec("## Step 4.", "\n## Done When")
59
+ rows = [l for l in s4.splitlines() if l.startswith("|") and not re.match(r"\|\s*-", l)][1:]
60
+ first = rows[0] if rows else ""
61
+ direct = [l for l in rows if "Start implementation directly" in l]
62
+ say("I4", re.search(r"new session", first, re.I) and re.search(r"only the saved spec", first, re.I)
63
+ and direct and re.search(r"not the default", direct[0], re.I),
64
+ f"Step 4 first row «{first[:60]}» is not the new-session default, or «Start implementation directly» is gone / not marked")
65
+ fmt = sec("### Spec Document Format", "\n## Step 4")
66
+ say("I5", "## Why" in fmt and "## Understanding check" in fmt, "spec format lacks ## Why or ## Understanding check")
67
+ keep = ["maximum 3 rounds, maximum 2 questions per round", "(inferred:", "Excluded:", "specs/{slug}.md"]
68
+ miss = [k for k in keep if k not in t]
69
+ say("K1", not miss, f"missing kept text: {miss}")
70
+ over = []
71
+ for name in ("### Round 1", "### Round 2", "### Round 3"):
72
+ s = sec(name, "\n### ") if name != "### Round 3" else r3
73
+ for b in re.findall(r"```\n(.*?)```", s, re.S):
74
+ n = len(re.findall(r"^\s*\d+\.\s", b, re.M))
75
+ if n > 2: over.append(f"{name.strip('# ')}={n}")
76
+ say("K2", not over, f"round template over 2 questions: {over}")
77
+ PY
78
+ }
79
+
80
+ [ -r "$SKILL" ] || { echo "HARNESS: $SKILL not readable — not measured"; exit 1; }
81
+ out=$(probe "$SKILL") || { echo "HARNESS: probe failed"; exit 1; }
82
+ while read -r id rest; do
83
+ [ "$rest" = ok ] && ok "$id" || bad "$id" "$rest"
84
+ done <<< "$out"
85
+
86
+ # C — controls: remove one addition at a time from a copy; exactly that case must go red
87
+ control() { # control <id> <python that edits text t>
88
+ local f="$TMPROOT/ctl_$1.md" got
89
+ python3 - "$SKILL" "$f" "$2" <<'PY'
90
+ import re, sys
91
+ t = open(sys.argv[1], encoding="utf-8").read()
92
+ exec(sys.argv[3])
93
+ open(sys.argv[2], "w", encoding="utf-8").write(t)
94
+ PY
95
+ got=$(probe "$f" | awk '$2 != "ok" {print $1}' | tr '\n' ' ')
96
+ [ "$got" = "$1 " ] && ok "C-$1 control: removing it turns only $1 red" || bad "C-$1 control" "red cases «${got}», expected «$1 »"
97
+ }
98
+ if [ "$fail" -eq 0 ]; then
99
+ control I1 't = re.sub(r"(### Round 1.*?```\n)(.*?)(```)", lambda m: m.group(1) + re.sub(r"^.*\bWhy\b.*\n(?:\s+\(.*\n)?", "", m.group(2), flags=re.M) + m.group(3), t, count=1, flags=re.S)'
100
+ control I2 't = t.replace("### Textbook phrases", "### Plain phrases").replace("Textbook phrase", "Plain phrase")'
101
+ control I3 't = re.sub(r"(### Round 3)(.*?)(\n## )", lambda m: m.group(1) + "\n\nDraft the spec, then confirm once.\n" + m.group(3), t, count=1, flags=re.S)'
102
+ control I4 't = re.sub(r"(## Step 4\..*?\|---\|---\|\n)\|[^\n]*\n", r"\1", t, count=1, flags=re.S)'
103
+ else
104
+ echo "SKIP controls — the shipped skill is already red (a control on a red subject proves nothing)"
105
+ fi
106
+
107
+ echo "PASS $pass · FAIL $fail"
108
+ [ "$fail" -eq 0 ]
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env bash
2
+ # test_deep_clarify_spec_path_lanes.sh — where deep-clarify's own Step 3 commands put the spec.
3
+ #
4
+ # WHY. deep-clarify wrote `.claude/specs/{slug}.md`. Claude Code treats `.claude/` as sensitive: a headless
5
+ # run gets the write refused, and an interactive non-developer gets a «modify sensitive file» prompt
6
+ # (FoD O2, 2026-11-21). The spec belongs in a plain work-folder path.
7
+ #
8
+ # WHAT IS CHECKED, by running the commands the skill tells the session to run (not by reading prose):
9
+ # P1 Step 3's mkdir block, a write to the «Write →» path and Step 3's `test -f` line, run in an empty
10
+ # folder, save the spec, print «SPEC SAVED», and create nothing under `.claude/`
11
+ # P2 the four places that name the path agree: the ABORT-if-exists check, the Write target, the
12
+ # `test -f` line, and the Done-When row
13
+ # P3 the gitignore advice for company projects is still there
14
+ # P4 control: the same checks on a planted copy that saves under `.claude/specs/` go red
15
+ # NOT CHECKED: whether a real session follows Step 3 (that is a behaviour sim, not this lane).
16
+ #
17
+ # Usage: bash scripts/test_deep_clarify_spec_path_lanes.sh Exit: 0 all pass · 1 any fail
18
+ set -uo pipefail
19
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ SKILL="$HERE/../plugins/fh-meta/skills/deep-clarify/SKILL.md"
21
+ TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/deep_clarify_spec_XXXXXX")
22
+ trap 'rm -rf "$TMPROOT"' EXIT
23
+ pass=0; fail=0
24
+ ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
25
+ bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
26
+
27
+ # extract <skill file> <out dir> — writes mkdir.sh, write_path, test.sh, abort_path, done_path, has_ignore
28
+ extract() {
29
+ python3 - "$1" "$2" <<'PY'
30
+ import re, sys, os
31
+ src, out = sys.argv[1], sys.argv[2]
32
+ t = open(src, encoding="utf-8").read()
33
+ a = t.find("## Step 3."); b = t.find("### Spec Document Format", a)
34
+ step = t[a:b] if a >= 0 and b > a else ""
35
+ blocks = re.findall(r"```bash\n(.*?)```", step, re.S)
36
+ mk = next((x for x in blocks if "mkdir" in x), "")
37
+ ts = next((x for x in blocks if "test -f" in x), "")
38
+ w = re.search(r"`Write`\s*→\s*`([^`]+)`", step)
39
+ ab = re.search(r"If `([^`]+)` \*\*already exists", step)
40
+ dw = t[t.find("## Done When"):]
41
+ dn = re.search(r"`test -f ([^`]+)` exits 0", dw)
42
+ ign = "gitignore" in step
43
+ def put(name, val): open(os.path.join(out, name), "w", encoding="utf-8").write(val)
44
+ put("mkdir.sh", mk); put("test.sh", ts)
45
+ put("write_path", w.group(1) if w else ""); put("abort_path", ab.group(1) if ab else "")
46
+ put("done_path", dn.group(1) if dn else ""); put("has_ignore", "1" if ign else "0")
47
+ PY
48
+ }
49
+
50
+ # check <label> <skill file> — prints the problems, nothing when the skill saves outside .claude/
51
+ check() {
52
+ local d="$TMPROOT/$1" wp tp out
53
+ mkdir -p "$d/x" "$d/work"; extract "$2" "$d/x" || { echo "extract failed"; return; }
54
+ wp=$(sed 's/{slug}/demo-spec-20261121/' "$d/x/write_path")
55
+ [ -s "$d/x/mkdir.sh" ] || echo "no mkdir block in Step 3"
56
+ [ -s "$d/x/test.sh" ] || echo "no test -f block in Step 3"
57
+ [ -n "$wp" ] || echo "no «Write → path» in Step 3"
58
+ [ -n "$wp" ] || return
59
+ ( cd "$d/work" && bash "$d/x/mkdir.sh" ) > /dev/null 2>&1 || echo "mkdir block failed"
60
+ ( cd "$d/work" && printf '# Spec: demo\n' > "$wp" ) 2>/dev/null || echo "write to $wp failed (directory missing?)"
61
+ sed 's/{slug}/demo-spec-20261121/g' "$d/x/test.sh" > "$d/x/test_run.sh"
62
+ out=$(cd "$d/work" && bash "$d/x/test_run.sh" 2>&1) || echo "test -f block failed: $out"
63
+ [[ "$out" == *"SPEC SAVED"* ]] || echo "no «SPEC SAVED» line"
64
+ case "$wp" in .claude/*|*/.claude/*) echo "spec path is under .claude/ ($wp)" ;; esac
65
+ [ -e "$d/work/.claude" ] && echo "the commands created .claude/ in the work folder"
66
+ for f in abort_path done_path; do
67
+ [ "$(cat "$d/x/$f")" = "$(cat "$d/x/write_path")" ] || echo "$f «$(cat "$d/x/$f")» ≠ write path «$(cat "$d/x/write_path")»"
68
+ done
69
+ tp=$(sed -n '/test -f /{s/.*test -f \([^ &]*\).*/\1/p;q;}' "$d/x/test.sh")
70
+ [ "$tp" = "$(cat "$d/x/write_path")" ] || echo "test -f path «${tp}» ≠ write path"
71
+ [ "$(cat "$d/x/has_ignore")" = 1 ] || echo "the gitignore advice is gone from Step 3"
72
+ }
73
+
74
+ [ -r "$SKILL" ] || { echo "HARNESS: $SKILL not readable — not measured"; exit 1; }
75
+
76
+ probs=$(check shipped "$SKILL")
77
+ if [ -z "$probs" ]; then ok "P1–P3 the skill's own Step 3 commands save the spec outside .claude/, four path mentions agree, gitignore advice kept"
78
+ else bad "P1–P3 shipped SKILL.md" "$(printf '%s' "$probs" | tr '\n' '|')"; fi
79
+
80
+ # P4 — control: a planted copy that saves under .claude/specs/ must be caught (the instrument is alive)
81
+ sed -E 's#(`|mkdir -p |test -f |SPEC SAVED: )specs/#\1.claude/specs/#g' "$SKILL" > "$TMPROOT/planted.md"
82
+ if grep -q '\.claude/specs/{slug}' "$TMPROOT/planted.md"; then
83
+ probs=$(check planted "$TMPROOT/planted.md")
84
+ [[ "$probs" == *"under .claude/"* ]] && ok "P4 control: a copy saving under .claude/specs/ is caught" \
85
+ || bad "P4 control blind" "planted .claude/ path not reported: $(printf '%s' "$probs" | tr '\n' '|')"
86
+ else
87
+ bad "P4 control not planted" "no .claude/specs/{slug} in the planted copy — the substitution did not apply"
88
+ fi
89
+
90
+ echo "deep-clarify spec path lanes: $pass passed, $fail failed"
91
+ [ "$fail" -eq 0 ]
@@ -16,6 +16,7 @@
16
16
  # D9 --help names fh-legacy as the default reviewer
17
17
  # D10 FH_REVIEWER=fh and the elephant pass get exactly Read/Glob/Grep — no shell, no MCP, no skill (D10b: control)
18
18
  # D11 FH_REVIEWER=code-review keeps git but runs without the five GITHUB_* command-file variables
19
+ # D12 run from a copy with no action.yml (package shape): D7 is SKIPPED by name — not a pass, not a fail
19
20
  # D7 action.yml does not put FH_TIMEOUT in the step env; it exports it only when the `timeout` input (default '') is non-empty
20
21
  # (known pair: the shipped file passes; a planted «FH_TIMEOUT: ${{ inputs.timeout }}» env line is caught)
21
22
  # Token-free: claude and codex are stubs that answer by request kind and log what they were asked.
@@ -27,7 +28,7 @@ TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_defaults_XXXXXX")
27
28
  trap 'rm -rf "$TMPROOT"' EXIT
28
29
  export FH_RECORD_BASE="$TMPROOT/records"; mkdir -p "$FH_RECORD_BASE"
29
30
  unset FH_REVIEWER FH_GATE_ELEPHANT FH_GATE_EXEC FH_TIMEOUT FH_GATE_LEVEL
30
- pass=0; fail=0
31
+ pass=0; fail=0; skipped=0
31
32
  ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
32
33
  bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
33
34
  g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false -c core.hooksPath=/dev/null "$@"; }
@@ -163,7 +164,25 @@ if [ -r "$ACTION" ]; then
163
164
  && grep -qE "^ *default: ''" <<<"$(awk '/^ timeout:/{f=1} f&&/default:/{print; exit}' "$ACTION")"; then
164
165
  ok "D7 action.yml: FH_TIMEOUT only from a non-empty timeout input (a planted env line is caught)"
165
166
  else bad "D7 action timeout pass-through" "env lines with FH_TIMEOUT: shipped=$n_ship planted=$n_plant"; fi
166
- else bad "D7 action timeout pass-through" "action.yml not readable at $ACTION (not measured)"; fi
167
+ else
168
+ # No action.yml here: the npm package does not ship it, and a field harness that syncs FH's lanes has none.
169
+ # Not a pass and not a fail — named. In an FH checkout its absence is caught by test_action_yml_lanes.sh (exit 10).
170
+ printf ' SKIP D7 action timeout pass-through — NOT-APPLICABLE: no action.yml at %s (not measured, not a pass)\n' "$ACTION"
171
+ skipped=$((skipped + 1))
172
+ fi
167
173
 
168
- echo "fh-gate defaults lanes: $pass passed, $fail failed"
174
+ # D12 — the same lane file run from a copy with no action.yml (an installed package's shape) must SKIP D7 by name,
175
+ # exit 0 and print no PASS for it (3.45.0 shipped this lane failing there: pmh-dev intake 2026-11-21).
176
+ if [ -z "${FHGD_INNER:-}" ]; then
177
+ mkdir -p "$TMPROOT/pkg"; cp -R "$HERE" "$TMPROOT/pkg/scripts"
178
+ if [ -e "$TMPROOT/pkg/action.yml" ]; then bad "D12 package-shape copy" "action.yml present in the copy — the fixture is not package-shaped"
179
+ else
180
+ ( cd "$TMPROOT/pkg" && FHGD_INNER=1 bash scripts/test_fh_gate_defaults_lanes.sh ) > "$TMPROOT/d12.out" 2>&1 < /dev/null; d12rc=$?
181
+ if [ "$d12rc" -eq 0 ] && grep -q '^ SKIP D7 .*NOT-APPLICABLE' "$TMPROOT/d12.out" && ! grep -q '^PASS D7' "$TMPROOT/d12.out" \
182
+ && grep -q '1 skipped (not a pass)' "$TMPROOT/d12.out"; then ok "D12 without action.yml: D7 is skipped by name, exit 0, not counted as passed"
183
+ else bad "D12 package-shape run" "rc=$d12rc $(grep -E 'D7|lanes:' "$TMPROOT/d12.out" | tr '\n' '|')"; fi
184
+ fi
185
+ fi
186
+
187
+ echo "fh-gate defaults lanes: $pass passed, $fail failed$( [ "$skipped" -gt 0 ] && printf ', %s skipped (not a pass)' "$skipped")"
169
188
  [ "$fail" -eq 0 ]
@@ -212,7 +212,8 @@ else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
212
212
  [[ "$mp" == "PASS "* ]] && ok "TR18 revert probe: inventory without plugins → TR14's pair scores PASS (TR14 would be red)" || bad "TR18 mutant still [$mp]"; fi
213
213
 
214
214
  # ── behaviour profile (2026-11-17, record only): top-level calls in explore · edit · test-run · other.
215
- # mk2 <file> <json list of [name, input, flag]> [noresult] — flag "SUB" = inside a subagent
215
+ # mk2 <file> <json list of [name, input, flag]> [noresult] — flag "SUB" = inside a subagent · "ERR" = its tool_result
216
+ # is_error · "NORES" = no tool_result at all
216
217
  cat > "$T/mk2.py" <<'PY'
217
218
  import json, sys
218
219
  f, calls = sys.argv[1], json.loads(sys.argv[2])
@@ -222,7 +223,12 @@ for n, (name, inp, flag) in enumerate(calls):
222
223
  if flag == "SUB":
223
224
  a["parent_tool_use_id"] = "task0"
224
225
  ev.append(a)
225
- ev.append({"type": "user", "message": {"content": [{"type": "tool_result", "tool_use_id": "b%d" % n}]}})
226
+ if flag == "NORES":
227
+ continue
228
+ r = {"type": "tool_result", "tool_use_id": "b%d" % n}
229
+ if flag == "ERR":
230
+ r["is_error"] = True
231
+ ev.append({"type": "user", "message": {"content": [r]}})
226
232
  if len(sys.argv) < 4:
227
233
  ev.append({"type": "result", "subtype": "success", "result": "done"})
228
234
  open(f, "w").write("".join(json.dumps(e) + "\n" for e in ev))
@@ -235,12 +241,12 @@ B='[["Read",{"file_path":"a.md"},""],["Edit",{"file_path":"a.md"},""],["Write",{
235
241
  ["Edit",{"file_path":"c.md"},"SUB"],["Bash",{"command":"pytest"},"SUB"]]'
236
242
  python3 "$T/mk2.py" "$T/bp.jsonl" "$B"
237
243
  bp=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp.jsonl"; echo "rc=$?")
238
- [ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12
244
+ [ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12 first_error=none
239
245
  rc=0" ] && ok "TR19 profile bins: one known call per rule; redirects to /dev/null and 2>&1 stay explore; subagent calls not counted" \
240
246
  || bad "TR19 [$bp]"
241
247
  python3 "$T/mk2.py" "$T/bpn.jsonl" '[["Read",{"file_path":"a.md"},""]]' noresult
242
248
  bn=$(python3 "$HERE/live_eval_trace.py" profile "$T/bpn.jsonl"); bu=$(python3 "$HERE/live_eval_trace.py" profile "$T/absent.jsonl"; echo "rc=$?")
243
- [ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 result=MISSING (counts are a lower bound)" ] \
249
+ [ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 first_error=none result=MISSING (counts are a lower bound)" ] \
244
250
  && [ "$bu" = "trace=UNREADABLE
245
251
  rc=3" ] && ok "TR20 no result event → counts marked a lower bound; unreadable stream → trace=UNREADABLE rc 3, never 0" \
246
252
  || bad "TR20 noresult=[$bn] absent=[$bu]"
@@ -250,7 +256,7 @@ mkdir -p "$T/mut3"; sed 's|(?!/dev/null\\b)||' "$LIB/live_eval_trace.py" > "$T/m
250
256
  if ! grep -q '(?!/dev/null' "$LIB/live_eval_trace.py"; then bad "TR21 the original has no /dev/null exclusion to revert"
251
257
  elif grep -q '(?!/dev/null' "$T/mut3/live_eval_trace.py"; then bad "TR21 mutation did not apply (instrument error, not a pass)"
252
258
  else mb=$(python3 "$T/mut3/live_eval_trace.py" profile "$T/bp.jsonl"); mrc=$?
253
- [ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12" ] \
259
+ [ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12 first_error=none" ] \
254
260
  && ok "TR21 revert probe: without the /dev/null exclusion, 2>/dev/null reads as an edit → TR19 would be red" \
255
261
  || bad "TR21 mutant rc=$mrc [$mb]"; fi
256
262
  # TR22 (codex R1): naming a test file as data is not a test run; sed -Ei / --in-place are edits;
@@ -261,10 +267,24 @@ B2='[["Bash",{"command":"cat tests/test_example.py"},""],["Bash",{"command":"gre
261
267
  ["Bash",{"command":"./scripts/test_z.sh"},""],["Bash",{"command":"npm run test"},""]]'
262
268
  python3 "$T/mk2.py" "$T/bp2.jsonl" "$B2"
263
269
  b2=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp2.jsonl")
264
- [ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9" ] \
270
+ [ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9 first_error=none" ] \
265
271
  && ok "TR22 reading a test file stays explore; sed -Ei/--in-place are edits; timeout/env wrappers keep the runner visible" \
266
272
  || bad "TR22 [$b2]"
267
273
 
274
+ # TR25 (2026-11-21, absorption AQ-20261101-2): «first error depth» — the 1-based position of the first top-level
275
+ # call whose result is an error. A final PASS hides a run that hit errors early and recovered by luck; the depth is
276
+ # record only, never scored. No error → none. A call with no result → unknown (not measured is not «no error»).
277
+ python3 "$T/mk2.py" "$T/fe.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"ERR"],["Edit",{"file_path":"a.md"},"ERR"]]'
278
+ python3 "$T/mk2.py" "$T/fe0.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},""]]'
279
+ python3 "$T/mk2.py" "$T/feu.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"NORES"]]'
280
+ python3 "$T/mk2.py" "$T/fes.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"SUB"]]'
281
+ fe=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe.jsonl"); fe0=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe0.jsonl")
282
+ feu=$(python3 "$HERE/live_eval_trace.py" profile "$T/feu.jsonl"); fes=$(python3 "$HERE/live_eval_trace.py" profile "$T/fes.jsonl")
283
+ [[ "$fe" == *" first_error=2"* ]] && [[ "$fe0" == *" first_error=none"* ]] && [[ "$feu" == *" first_error=unknown"* ]] \
284
+ && [[ "$fes" == *" first_error=none"* ]] \
285
+ && ok "TR25 first error depth: error at call 2 → 2 · no error → none · a call with no result → unknown · subagent calls not counted" \
286
+ || bad "TR25 err=[$fe] none=[$fe0] nores=[$feu] sub=[$fes]"
287
+
268
288
  # the count has to add the named skips, or a lane that correctly declined would read as a lane that
269
289
  # silently did not run — which is the thing this counter exists to catch.
270
290
  # ── TR23 (2026-11-20 weekly audit): the INVALID reason names what differs. The nightly printed two
@@ -289,7 +309,7 @@ if grep -q 'SURFACE_DIFF_RETURN' "$T/mut3/live_eval_trace.py"; then bad "TR24 mu
289
309
  else m3=$(LIB="$T/mut3" score "$T/plg" P 'read=CATALOG\.md')
290
310
  [[ "$m3" != *"plugins=fx-chart@builtin — "* ]] && [[ "$m3" == INVALID-COMPARISON* ]] && ok "TR24 revert probe: surface_diff → '' drops the named plugin (TR23 would be red), verdict unchanged" || bad "TR24 mutant still [$m3]"; fi
291
311
 
292
- [ $((pass + fail + skipped)) -eq 25 ] || bad "lane count $pass passed + $fail failed + $skipped skipped != 25 — a case did not run"
312
+ [ $((pass + fail + skipped)) -eq 26 ] || bad "lane count $pass passed + $fail failed + $skipped skipped != 26 — a case did not run"
293
313
  if [ "$skipped" -gt 0 ]; then
294
314
  echo "live_eval_trace lanes: $pass passed, $fail failed, $skipped skipped (named, not a pass)"
295
315
  else
@@ -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 ]
@@ -882,7 +882,8 @@ _lane SF3 state-fp "verdict row identical across runs whose end states differ" "
882
882
  # BP1 the budget stub writes no stream → MISSING for both arms (not measured ≠ 0).
883
883
  _lane BP1 behave-prof "stub without stream: report carries 'trace=MISSING' for both arms" "2" \
884
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.
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».
886
887
  cat > "$BSTUB/fake_sim_trace.sh" <<'FAKETRACE'
887
888
  #!/usr/bin/env bash
888
889
  arm=""; out=""
@@ -902,8 +903,8 @@ chmod +x "$BSTUB/fake_sim_trace.sh"
902
903
  ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" \
903
904
  bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp.md" ) >"$T/bp.log" 2>&1
904
905
  _lane BP2 behave-prof "stream present: per-arm counts (primary runs a test, control only explores)" "yes" \
905
- "$(grep -qxF 'behaviour-profile: G-GREET-01 primary r1 explore=1 edit=0 test-run=1 other=0 total=2' "$T/bp.md" \
906
- && grep -qxF 'behaviour-profile: G-GREET-01 control r1 explore=2 edit=0 test-run=0 other=0 total=2' "$T/bp.md" && echo yes || echo no)"
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)"
907
908
  # BP3 FH_LIVE_TRACE=0 keeps no stream → one «not recorded» line, not a MISSING line per rep
908
909
  ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_LIVE_TRACE=0 \
909
910
  bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp0.md" ) >"$T/bp0.log" 2>&1
@@ -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:
@@ -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 |