STEP 1658 — Stopping-Condition v0.2 89/89 PASS worktree 隔離

2026-09-02 · src/aios/stopping-condition/v02/ + src/mcp/stopping-condition-mcp.ts · npm test:step1658

起点 + 復元 incident

1 度 destroy された: 本 STEP は 最初 C:/Users/user/rei-aios/ 直下で 実装、 test 89/89 PASS まで 到達したが、 別タブの git pull --rebase origin main が 私の untracked/unstaged STEP 1658 files を 完全 消去 (reflog HEAD@{6} で確認)。

藤本さん directive: 「同時にタブを並行しているので、 commit も push も衝突するのは 当然。 メモリやコミットをする場所を新たに設けて そちらにて行うのが 当然だと 思いませんか?」

: git worktree で working tree + branch を 完全隔離 (.claude/worktrees/step1658-stopping-condition-v02 + worktree-step1658-stopping-condition-v02 branch)。 他タブの pull/rebase/commit は 別 worktree で 発生するため、 私の working tree は 完全 保護される。

Multi-tab collision root cause fix

STEP 1554 atomic-commit (index collision 予防) + inbox pattern (集約 file collision 予防) の 上に、 本 STEP で 3 段目の 予防 layer = worktree working tree 隔離 が 追加された:

教訓: multi-tab 併走時は 常に worktree が正しい起点。 メイン worktree に 全タブが 集まると 予防できない collision (pull --rebase による untracked destruction) が 残存。

6 features 全 land (再構築後)

#FeatureFile役割
(a)MCP wiresrc/mcp/stopping-condition-mcp.ts3 tool: stopping_condition_run / _query_chain / _verify_chain
(b)Ledger anchor 実 wirev02/ledger-anchor.tsSTEP 1638 hash-chained ledger の sync 独立実装 (canonical JSON + sha256、 rei-checker-mcp v0.3+ verify と 互換)
(c)Async 版v02/async-pipeline.tsrunStoppingConditionAsync、 array/Promise/AsyncIterable 3 種
(d)W-48 実 wirev02/w48-adapter.tsrouteToW48 + createInMemoryW48Adapter、 neither-halt → suspend
(e)Hierarchical stoppingv02/hierarchical.tsNested GroupStep tree、 flatten + ancestry path 保持
(f)Escalation chain 追跡v02/escalation-chain.tsquery/findById/filter × 2 + verifyChain (seq-gap/prev-hash/hash 3 種 tampering) + traceAncestors

MCP 3 tool (a) — SafetyGate discipline

tool役割副作用
stopping_condition_runv0.1 pipeline + opt-in ledger appendledger append のみ (append-only、 破壊なし)
stopping_condition_query_chainledger read-only queryなし
stopping_condition_verify_chainhash-chain 独立検証なし
MCP surface で W-48/external-oracle/human 送信は 実行しない (STEP 1345+1644 継承)。 payload 生成のみ、 実 delivery は library 経由で caller が判断。 auto-approve 経路の 意図せぬ suspend 予防。

Test 89/89 分布

SectionPASS/Total
(b) Ledger anchor13/13
(c) Async pipeline10/10
(d) W-48 adapter10/10
(e) Hierarchical14/14
(f) Escalation chain19/19
(a) MCP wire13/13
Integration10/10
合計89/89
Regression — STEP 1651 v0.189/89
Regression — STEP 1631 invariance-checker48/48

Honest scope (v0.2)

  1. Ledger sync 独立実装 (scripts/checker/ledger.ts async 非依存、 hash 算式 共通)
  2. Async streaming 早期停止 未対応 (v0.3+ candidate)
  3. W-48 送信は library 経由のみ (MCP では 実行しない)
  4. Hierarchical group aggregate 未実装 (v0.3+ candidate)
  5. Ledger kind hardcoded ('stopping-condition-escalation')
  6. Chain verify self-contained (rei-checker-mcp v0.3+ verify と 冗長)
  7. Worktree 隔離 で 開発: main worktree への merge/push は 藤本さん judgment 待ち

次 STEP candidate (v0.3+)

STEP 1554 atomic-commit dogfood 34 例目。 Worktree 隔離初適用 (multi-tab collision root cause fix 3 段目)。 STEP 番号 中央 counter (claim-step.ts --sync-from-git --confirm--slug stopping_condition_v02_six_features)。