---
name: project-step1382-hunter-gamma-fdr-wire-2026-08-23
description: STEP 1382 discovery-worker v0.5 hunter_gamma + fdr_gate pipeline wire — verdict → p-value synthesis adapter、E2E test 40/40、4 next candidates 全完了
metadata: 
  node_type: memory
  type: project
  originSessionId: 1f71dc26-eff6-41db-8142-70648b0a0ec2
  modified: 2026-08-22T22:11:36.037Z
---

# STEP 1382 — discovery-worker v0.5 hunter_gamma + fdr_gate wire (4 next candidates 全完了)

Date: 2026-08-23
Status: 実装 + test 40/40 + E2E ✓ + local commit ac0338e
契機: STEP 1377 fdr_gate landing 時 defer 「future v0.5+ hunter_gamma stage で wire up 検討」 の 実装

## 実装 (discovery-worker external repo、local commit ac0338e)

新規 file 3:
- worker/hunter_gamma.py (~250 行、stdlib only)
  - binomial_upper_tail(k, n, p) — log-space stable
  - synthesize_pvalue_from_hunter_result(result, null_failure_rate) — verdict → p:
    * TRUE → p=0 / FALSE (K iter) → p=(1-r0)^K / INFINITY, NEITHER → None
  - batch_pipeline_to_fdr_input(pipeline_json, null_rate) — pipeline → fdr_gate adapter
  - CLI: python worker/hunter_gamma.py <pipeline-output.json> --null-rate 0.001
- tests/test_hunter_gamma.py (40/40 PASS)
- docs/v0.5-notes.md

## Pipeline wire (3 stage manual chain)

1. pipeline.py runs → output/pipeline-batch-XXX.json (verdict-based)
2. hunter_gamma.py → gamma-trials-batch-XXX.json (p-value synthesized)
3. fdr_gate.py → aggregate D-FUMT₈ verdict + FDR correction

各 stage 独立 CLI = manual composition (caller が null_rate / fdr_q / alpha 判断)。
Auto-pipeline stage 化は defer (別 STEP)。

## E2E verify (test [13])

Input: 10 conjectures (2 TRUE + 7 FALSE varied iter + 1 INFINITY)
hunter_gamma (r0=0.001) → 10 trials (9 p_value, 1 None)
fdr_gate (fdr_q=0.05, alpha=0.05) →
  valid_p_value_count=9 (INFINITY excluded), naive=4, fdr=4
  aggregate_verdict=TRUE (all_naive_survive_fdr)

Chain end-to-end 動作 ✓ INFINITY graceful excluded (統計汚染回避)。

## Semantic model

H0: 真の failure rate <= r0 (「conjecture holds >= 100(1-r0)%」)
H1: rate > r0
Observed: K iter, k counterexamples

- k>=1 → deterministic H0 refutation → p=0
- k=0, K large → (1-r0)^K (probability of observing 0 failures under H0)
- k=0, K small → (1-r0)^K ≈ 1 (insufficient evidence)

## 4 next candidates 全完了達成

| Item | Description | STEP | Status |
|---|---|---|---|
| 1 | MCP tool count systemic drift 対策 | 1378 | ✅ auto-count (v2.8.4) |
| 2 | TS/Python 決定表 drift 検知 CI | 1380 | ✅ subprocess parity 52/52 |
| 3 | STEP 1376 v0.2 Cohen's d BOTH | 1379 | ✅ v0.2 5/8 activate 39/39 |
| 4 | discovery-worker v0.5 hunter_gamma | **1381 (本 STEP)** | **✅ 40/40 + E2E ✓** |

同日 2026-08-23 全 landing 達成。

## Rei stack 相補構造 (7/8 値 activate 不変)

hunter_gamma は verdict emit しない feeder role。
STEP 1371/1377 sibling primitive を pipeline caller として 活用。
Union 7/8 (SELF のみ 予約) は STEP 1377 で 既 達成、変化なし。

## Honest scope

1. 「世界初」 主張ゼロ、Neyman-Pearson 1928 100 年前既知
2. Verdict → p-value semantic approximation (deterministic exhaustive → probabilistic hypothesis test mapping、statistical purist critique の 余地あり)
3. Independent random-sampling worker は v0.6+ candidate (現時点 verdict-based adapter のみ)
4. Bayesian / Boschloo / hunter_beta similarity 変換 は scope 外
5. pipeline auto-integration は defer (manual chain 継続)
6. Isolation contract 維持 (rei-aios / rei-* dependency ゼロ、stdlib only)

## Site

- URL: https://rei-aios.pages.dev/tools/step-1382-hunter-gamma-fdr-wire/
- external commit: discovery-worker `ac0338e` (local only、no remote push)

## 関連

- STEP 1371 / 1377 (rei-aios TS + discovery-worker Python primitives)
- STEP 1378 / 1379 / 1380 (同日 4 next candidates 系列)
- STEP 1350 (single measurement 相補)
- feedback-super-naming-siren-family-pattern (semantic model honest 明示)
- feedback-all-research-site-reflection-default (2026-08-06 protocol)
- discovery-worker docs/v0.5-notes.md
