STEP 1651 — Stopping-Condition Pipeline v0.1 89/89 PASS
2026-09-01 · src/aios/stopping-condition/ · npm test:step1651
起点
藤本さん directive 「STEP 4 の pipeline 統合を進めて頂けますか?」 (2026-09-01)。 chat-Claude 2026-09-01 dialogue で 提示された 「既存 AI に実装不可能だが必要不可欠な チューンアップ用パーツ」 4 件のうち、 4 番目 = 停止条件 の 実装。
「モデルは『もう分からない』を内部から検出できない。 境界を外部から宣言する装置 (locate_first_error → boundary_report → escalate の流れ) が これに当たります。」 (chat-Claude, 2026-09-01)
本 STEP 直前 状態:
3 primitive + 1 composer
| File | 役割 | Signature (要約) |
locate-first-error.ts | ReasoningStep[] を scan、 最初の non-TRUE 位置を pin | locateFirstError(steps) → FirstErrorLocation | Error |
boundary-report.ts | FirstErrorLocation → 構造化 Boundary + suggestedTarget | boundaryReport(location) → Boundary |
escalate.ts | Boundary → EscalationPayload + 任意 ledger anchor | escalate(boundary, opts) → EscalationPayload |
run-pipeline.ts | 3 primitive を 一本 に 繋いだ default 経路 | runStoppingCondition(input) → Outcome | Error |
決定表 — 停止条件の mapping
Table L (locateFirstError, stopKind 分類)
| # | Condition | stopKind |
| L1 | steps.length === 0 or 非 array | error 'invalid-input' |
| L2 | 全 step が TRUE | all-clear |
| L3 | 最初の non-TRUE = NEITHER | neither-halt |
| L4 | 最初の non-TRUE = FALSE | false-violation |
| L5 | 最初の non-TRUE = ZERO | zero-void |
| L6 | 最初の non-TRUE = BOTH/INFINITY/FLOWING/SELF | other-nondefinite |
Table B (boundaryReport, kind → suggestedTarget)
| # | BoundaryKind | suggestedTarget | 意味 |
| B1 | all-clear | none | 境界 打たず pass-through |
| B2 | neither-halt | w48-negcap | 「判定不能」 は W-48 Negative Capability 保留に流す |
| B3 | false-violation | external-oracle | 「主張が破れた」 は rei-checker-mcp / Lean 4 等 別 verifier |
| B4 | zero-void | human | 「値の不在」 は 藤本さん judgment |
| B5 | other-nondefinite | peer-review | BOTH/INFINITY/FLOWING/SELF は 別 model / chat-Claude cross-check |
Table E (escalate, anchor behavior)
| # | Condition | ledgerAnchor |
| E1 | boundary.kind === 'all-clear' | skip (anchor 不要、 target='none') |
| E2 | anchorToLedger === false / undefined | skip (フィールド undefined) |
| E3 | anchorToLedger === true, fn 未指定 | {appended:false, reason:'no-anchor-fn'} |
| E4 | anchorToLedger === true, fn 成功 | {appended:true, entryHash, entrySeq} |
| E5 | anchorToLedger === true, fn throw | {appended:false, reason:'anchor-threw:<msg>'} |
統合先 (既存部品との接続)
- invariance-checker (STEP 1631 / 1637 / 1645) —
SingleInvariancePayload を ReasoningStep に 写像可 (verdict + reason + source + payload 4 field 共通)
- D-FUMT₈ (
src/axiom-os/seven-logic.ts) — verdict を EightLogicValue で保持、 NEITHER を 「エラーではない有効値」 として neither-halt に mapping
- hash-chained ledger (STEP 1638+1649) —
ledgerAnchorFn DI で escalation を tamper-evident 記録可能
- W-48 Negative Capability (STEP 45) —
neither-halt の default 宛先 w48-negcap は Keats 由来 「不確かさ 保持」 原則 の operational form
- rei-checker-mcp v0.3.0a1 (STEP 1401) —
false-violation の default 宛先 external-oracle は Lean REPL / D-FUMT₈ ledger による cross-check candidate
- LLM-as-judge comparator (STEP 1647) — 判定 sequence 生成側で 使用可 (verdict field で 直接繋がる)
Test 結果 — 89/89 PASS + upstream regression clean
| Section | PASS/Total | 内容 |
| 1. locateFirstError 決定表 | 19/19 | invalid-input 3 + all-clear + NEITHER/FALSE/ZERO/BOTH/INFINITY/FLOWING/SELF 各 kind + index/counts/step 保持 |
| 2. boundaryReport mapping | 16/16 | 5 kind × suggestedTarget + lastClaim propagation + honestScope |
| 3. escalate payload & anchor | 20/20 | all-clear skip + override + default target + anchor 4 状態 (false/no-fn/success/throw) + emittedAt ISO |
| 4. runStoppingCondition pipeline | 18/18 | invalid + 全 stopKind 経由 + override + anchor 呼出 + all-clear anchor skip + throw graceful |
| 5. Integration invariants | 16/16 | 8 verdict × expected target + successCount 単調性 + payload preservation + escalationId 一意性 |
| 合計 | 89/89 | 0 fail |
| Regression — STEP 1631 | 48/48 | invariance-checker v0.1 (dep upstream) |
| Regression — STEP 1647 | 50/50 | LLM-judge comparator v0.1 (dep upstream) |
使い方 (例)
import { runStoppingCondition } from './src/aios/stopping-condition';
const outcome = runStoppingCondition({
sequenceId: 'proof-attempt-42',
steps: [
{ stepId: 'lemma-1', claim: 'H holds', verdict: 'TRUE', reason: 'checker:pass', source: 'rei-checker-mcp' },
{ stepId: 'lemma-2', claim: 'H⇒G', verdict: 'TRUE', reason: 'checker:pass', source: 'rei-checker-mcp' },
{ stepId: 'lemma-3', claim: 'G⇒K', verdict: 'NEITHER', reason: 'undecidable', source: 'invariance-checker' },
{ stepId: 'lemma-4', claim: 'K holds', verdict: 'TRUE', reason: 'checker:pass', source: 'rei-checker-mcp' },
],
anchorToLedger: true,
ledgerAnchorFn: myLedgerAppender, // dependency-injected
});
if ('error' in outcome) throw new Error(outcome.error);
console.log(outcome.summary);
// → "stopping-condition | seq(2/4) | kind=neither-halt | target=w48-negcap | anchor=ok"
// outcome.escalation で 外部 (W-48 保留 / MCP tool / UI) に渡す payload 取得
// - boundary.location.step で 停止した step の 詳細 access
// - boundary.suggestedTarget で default target
// - escalation.ledgerAnchor.entryHash で tamper-evident 記録の pin
Honest scope (v0.1)
- Pure pipeline のみ: LLM 呼出 / 外部 verifier 実起動 / 人間通知 は 一切 行わない。 payload 生成のみ。 async 版は v0.2+ candidate。
- Verdict correctness は 上流責任:
ReasoningStep.verdict は caller が 用意 (invariance-checker / rei-checker-mcp 経由 想定)。 本 module は verdict の 正しさ について 主張しない。
- Ledger anchor は Dependency Injection:
ledgerAnchorFn は caller 提供、 STEP 1638 hash-chained ledger の 実 wire は 別 STEP candidate。 v0.1 は test で mock fn を 使う。
- SuggestedTarget は default:
targetOverride で 上書き可、 mapping は caller の 運用に合わせて 別 module で 拡張可。
- 「最初の non-TRUE」 の shallow scan のみ: 複数 boundary の 同時検出 / hierarchical stopping (sub-sequence 内 stop) は 未対応、 v0.2+ candidate。
- MCP surface 未 wire: rei-aios MCP tool として の 公開は 別 STEP candidate (STEP 1644 agent-connector-mcp の 手続 参照、 execute mode 非公開 discipline を 参考に)。
次 STEP candidate
- (a) MCP wire:
stopping_condition_run tool を rei-aios MCP に 追加 (auto-approve に 乗せる可否は SafetyGate 判断)
- (b) Ledger anchor 実 wire: STEP 1638 hash-chained ledger の
appendEntry を ledgerAnchorFn の default 実装として 提供
- (c) Async 版: LLM-judge comparator (STEP 1647) と 組合せた
runStoppingConditionAsync
- (d) W-48 wire:
neither-halt の w48-negcap target を 実 W-48 保留 API に 接続
- (e) Hierarchical stopping: sub-sequence 内 stop 検出 (nested reasoning tree 用)
- (f) Chain 追跡: 複数 escalation の chain を ledger 上で 参照可能 に (STEP 1638 prev_hash 経由)
関連 file
src/aios/stopping-condition/types.ts — ReasoningStep / Boundary / EscalationPayload / StoppingConditionOutcome 型
src/aios/stopping-condition/locate-first-error.ts — 第 1 primitive (scan)
src/aios/stopping-condition/boundary-report.ts — 第 2 primitive (kind mapping)
src/aios/stopping-condition/escalate.ts — 第 3 primitive (payload + anchor)
src/aios/stopping-condition/run-pipeline.ts — composer
src/aios/stopping-condition/index.ts — public export
test/step1651-stopping-condition-pipeline-v01-test.ts — 89 test
STEP 1554 atomic-commit protocol dogfood 33 例目。 3 tab 併走中 独立 arc、 藤本さん 4 部品 statement (chat-Claude 2026-09-01) 直接 応答、 STEP 1651 番号 = npx tsx scripts/claim-step.ts --slug stopping_condition_pipeline_v01 で 中央 counter から 一意取得済。