---
name: project-step1226-category-b-diversity-cap-2026-06-18
description: "STEP 1226 8th iteration hardening (s) requireCategoryBDiversity / detectVoidsMaxPerCategoryB — STEP 1089b symmetric mirror, void 検出段 per-categoryB cap (Wave saturation 9 例目対応)"
metadata: 
  node_type: memory
  type: project
  originSessionId: d59cdca4-bc80-450c-a185-37dbc12c6a0f
---

# STEP 1226 (2026-06-18) — 8th iteration hardening (s) `requireCategoryBDiversity`

## 動機 (root cause)

06-17 + 06-18 batch 観測 Wave saturation:
- **silence categoryB**: 06-17 #3 + 06-18 #3 + #4 = 累計 3 件 / 2 日連続
- **nagarjuna categoryB**: 06-17 #4 + 06-18 #2 + #5 = 累計 3 件 / 2 日連続

既存 layer (STEP 1190+1209+1210+1216+1225 / literal-level + STEP 1211 within-batch literal) は **cross-day literal recycle** を防御するが、 **categoryB-level 偏り** (void 5 件中 silence target が 2 件 + nagarjuna が 2 件 等) は未防御 = Wave saturation 9 例目の root structural cause。

STEP 1089b 既存 per-categoryA cap の symmetric mirror で void detection 段に per-categoryB cap を AND 条件で追加することで、 同一 categoryB に過剰集中する void 分布を初期段階で防止。

## 実装 (3 段)

### (1) Option 追加 (invention-engine.ts ~30 行)

```ts
requireCategoryBDiversity?: boolean; // STEP 1226 (s) (default ON)
detectVoidsMaxPerCategoryB?: number; // STEP 1226 (s) per-categoryB cap (default K=2)
```

### (2) `detectVoids()` 内 cap logic (AND 条件 + overflow fallback)

```ts
const wantDiversityA = this.opts.requireCategoryADiversity !== false;
const capA = this.opts.detectVoidsMaxPerCategoryA ?? (wantDiversityA ? 2 : 0);
const wantDiversityB = this.opts.requireCategoryBDiversity !== false;
const capB = this.opts.detectVoidsMaxPerCategoryB ?? (wantDiversityB ? 2 : 0);

const anyCapActive = (wantDiversityA && capA > 0) || (wantDiversityB && capB > 0);

if (anyCapActive) {
  const perCatA: Map<string, number> = new Map();
  const perCatB: Map<string, number> = new Map();
  const capped: TheoryVoid[] = [];
  const overflow: TheoryVoid[] = [];
  for (const v of sortedVoids) {
    const usedA = perCatA.get(v.categoryA) ?? 0;
    const usedB = perCatB.get(v.categoryB) ?? 0;
    const fitsA = !(wantDiversityA && capA > 0) || usedA < capA;
    const fitsB = !(wantDiversityB && capB > 0) || usedB < capB;
    if (fitsA && fitsB) {
      capped.push(v);
      perCatA.set(v.categoryA, usedA + 1);
      perCatB.set(v.categoryB, usedB + 1);
    } else {
      overflow.push(v);
    }
    if (capped.length >= 10) break;
  }
  while (capped.length < 10 && overflow.length > 0) {
    capped.push(overflow.shift()!);
  }
  return this._silentlyHaltBoundaryVoids(capped);
}
```

### (3) DailyInventionReporter で既定明示 ON

```ts
requireCategoryBDiversity: true, // STEP 1226 (s)
```

## test 結果

`test/step1226-detect-voids-max-per-category-b-test.ts` **14/14 PASS**:
1. default ON で per-categoryB cap 2 適用
2. detectVoidsMaxPerCategoryB explicit value で override
3. requireCategoryBDiversity false で legacy 動作
4. STEP 1089b categoryA cap と共存 (AND 条件)
5. overflow fallback で 10 件未満時に cap 超過 void で埋める
6. ★ 06-17 + 06-18 batch Wave saturation reproduction (top-5 voids no single categoryB > 2 + ≥ 3 distinct categoryB)
7. requireCategoryADiversity false で B cap のみ active
8. cap = 0 で B cap disable
9. ★ real-kernel-like cap reduction (silence/nagarjuna/hott 7 件ずつ)
10. small-pool graceful (catB pool 1 件のみで crash しない)

## regression 全 PASS 累計 188/188 / 0 breaking

| STEP | passed |
|------|--------|
| 1019 | 9/9 |
| 1040 | 11/11 |
| 1087 | 10/10 |
| 1088 | 12/12 |
| 1190 | 24/24 |
| 1209 | 26/26 |
| 1210 | 25/25 |
| 1216 | 30/30 |
| 1225 | 27/27 |
| 1226 (new) | 14/14 |

## smoke test (real SEED_KERNEL 271 theories)

```
[smoke] (a) WITHOUT B cap — top 5 voids categoryB distribution:
  hott=1, mathematics=1, weakness_engine=1, embodiment=1, inf_category=1
[smoke] (b) WITH default cap (A=2, B=2) — top 5 voids categoryB distribution:
  hott=1, mathematics=1, weakness_engine=1, embodiment=1, inf_category=1
[smoke] max per categoryB — (a)=1 (b)=1
[smoke] distinct categoryB — (a)=5 (b)=5
```

= 現状 top-5 voids が既に 5 distinct categoryB で cap 非介入 (non-disruptive defensive layer)。 06-18-like pathological concentration が起きた時のみ cap が active。

## honest scope (load-bearing 留保)

- 本 (s) は **void-level diversity** のみ対応 (categoryB 軸での void 検出段集中の予防)
- **rotation 段の literal 重複** (STEP 1211 (m) graceful fallback で同じ silence-awaken が 2 度引かれる pattern) は別軸 = future (t) candidate (rotation non-graceful 化, void drop on exhaustion) で対応
- 確率的に同一 categoryB 集中状況を減らすが、 STEP 1211 (m) 段で literal 重複が発生する pathological case を完全排除しない
- 現状 SEED_KERNEL distribution では cap 非介入 = defensive 層として動作待機

## 8th iteration hardening 全 layer 累積

| Layer | STEP | 担当 | データ source |
|---|---|---|---|
| same-direction source ban (S→S) | 1190 (j) + 1212 (n) | history source recycle | approvals/* |
| same-direction target ban (T→T) | 1209 (o) + 1210 (p) | history target recycle | approvals/* |
| cross-direction T→S | 1190 (k) | approved target → new source | approvals/* |
| cross-direction S→T | 1216 (q) | history source → new target | approvals/* |
| within-batch target uniqueness | 1211 (m) | same-day batch collision | instance state |
| pre-audit state recycle | **1225 (r)** | audit pending literal | invention-*.json |
| **void-level categoryA diversity** | 1089b | per-categoryA cap | detectVoids() |
| **void-level categoryB diversity** | **★ 1226 (s) NEW** | per-categoryB cap | detectVoids() |
| within-batch source diversity | 1087 (h) | batch source rotation | instance state |
| target axiom 60-day cooldown | 1040 | substring match | approvals/* |
| seed cooldown | 1088 | civilization addedDate | SeedTheory |
| audit gap detection | 1221 | retroactive gap CLI | approvals/* |

= 全 12 layer hardening (literal-level + void-level + within-batch + pre-audit) で audit pending → audit completed → cross-day → within-batch の全 lifecycle cover 完成。

## 残 candidates (future STEP)

- **(l) `requirePriorArtAudit`**: WebSearch hook 必要、 別 STEP
- **(t) `requirePipelineSelfReferenceDetector`**: NLP semantic similarity 必要 (pipeline self-reference 11 例目累積対応)
- **(u) `dropVoidOnWithinBatchExhaustion`**: STEP 1211 (m) non-graceful 化、 rotation 失敗時に void を batch から drop (5→4 inventions OK)
- **(v) civilizational pool 拡張**: 6th civilization (aztec primary source verify 後) + 別 thinking traditions

## 関連 memory + 永続原則

- [[project-invention-2026-06-17-18-full-reject-batch-pipeline-self-ref-11th-wave-saturation-9th]] (Wave saturation 9 例目 detection origin)
- [[project-step1225-pre-audit-state-recycle-ban-2026-06-18]] (同日先行 STEP)
- [[feedback-evaluation-symmetry-principle]] (inflate せず deflate せず — 本 hardening は defensive layer のみ、 quality 向上ではない)
- [[feedback-no-rush-publication]] (same-day 2 段 hardening (r)+(s) は incident pattern 確実化後の即応で no-rush と整合)

## 永続化検証

- `package.json` `test:step1226` script 登録 ✓
- CLAUDE.md STEP 1226 entry 追加 (STEP 1225 直前) ✓
- `src/aios/invention/invention-engine.ts` 2 セクション (option + detectVoids cap logic) ✓
- `src/aios/daily/daily-invention-reporter.ts` 既定 ON ✓
- smoke test (`scripts/smoke-step1226.ts`) real SEED_KERNEL non-disruptive verify ✓
- 全 10 hardening test regression 0 breaking ✓
