STEP 1537 — rei-mcp-server Msg 2 層化 design spec

STEP 1537 (STEP 1594 retrospective update) · bluesky RunEngine + Msg indirection pattern port · Rei-AIOS · 2026-08-30 · commit b49d9449f + 1354eaf45

要旨

rei-mcp-server (現状 v2.8.5、 83 tool) の tool dispatch を、 tool 毎 direct call から bluesky/bluesky (BSD-3-Clause) 準拠の Msg indirection layer に refactor する design spec。 dry-run / 中断-再開 / audit trail 自動化 / SafetyGate 統一 dispatch / plan composition (multi-tool arc + clean rollback) が目的。

★ STEP 1594 retrospective: 起草時 (STEP 1537) は design-only、 同日 別 tab で 全 Layer 実装済と判明 (STEP 1533 wrapper + STEP 1534 PlanRunner v0.2 + STEP 1584 SafetyGate)。 現在 は canonical spec description role。

bluesky verbatim quote (core insight)

"Calling epics.caput inside a plan prevents the RunEngine from knowing about it and thus circumvents its facilities for putting devices in a safe state in the event of an unexpected exit or error."

Rei stack でも 同構造 = rei-mcp-server tool を Claude Code から 直接 call すると SafetyGate / audit / rollback が bypass される、 Msg indirection layer 必須。

Actual implementation status (retrospective STEP 1594)

私 spec Layer別 tab 実 fileSTEPStatus
L1 Msg (5-tuple + command)src/mcp/plan-runner-msg.ts1579COMPLETED
L2 Plan (async generator)同上1579COMPLETED
L3 RunEngine (dispatch)同上 + plan-runner-msg-v02.ts (6 新 Msg)1579 + 1534COMPLETED
L4 SafetyGate 統合safety-gate.ts + msg-tool-wrapper.ts1584 + 1533COMPLETED
L5 v0.3 (私 spec 未言及)plan-runner-msg-v03.ts未 grepIN PROGRESS (別 tab)

私 spec との 主要差分 4 件 (別 tab canonical)

  1. 一斉 refactor vs 逐次 opt-in: 私 spec = 全 82 tool 一斉 / 別 tab = 既存 rei-mcp-server.ts 不変 + wrapAsMsgTool factory 経由 opt-in migration (canonical、 breaking change zero)
  2. Msg command 種類: 私 spec 8 command / 別 tab v01+v02 base 5 + 拡張 6 (Bluesky Msg source 直輸入)
  3. SafetyGate 統合: 私 spec Phase 4 defer → 別 tab STEP 1584 で 3-tier hazard + 6 rule constructor 実装済
  4. Pilot tool: 私 spec 1 tool 推奨 → 別 tab 3 pilot 同時 (disk_health + shannon_entropy + puzzle_verify) の 3x coverage

Rei stack lesson (multi-tab spec collision)

Honest scope

Related