Skip to content

feat(boot): Issue #70 — Step 3 Memory Restore を McpHealthCheck.psm1 でワイヤリング - #81

Merged
Kensan196948G merged 1 commit into
mainfrom
feature/issue70-memory-mcp
Apr 14, 2026
Merged

Kensan196948G merged 1 commit into
mainfrom
feature/issue70-memory-mcp

Conversation

@Kensan196948G

@Kensan196948G Kensan196948G commented Apr 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Start-ClaudeOS.ps1 に McpHealthCheck.psm1 を追加インポート
  • Invoke-StepMemoryRestore 関数を新規実装 (Step 3)
    • .mcp.json 未設定 → SKIP
    • memory kind サーバー未設定 → SKIP
    • 設定あり → OK(エントリ数・ファイルパスをレポート)
    • 例外発生 → FAIL
  • Step 3 プレースホルダー (Invoke-StepPlaceholder) を Invoke-StepMemoryRestore に置換
  • StartScripts.Tests.ps1: Step 3 を SKIP リストから除外し、Memory Restore 専用テストを追加

Test plan

  • StartScripts.Tests.ps1 — Step 3 が Memory Restore として実行されること が PASS
  • StartScripts.Tests.ps1 — Step 5/6/8 がプレースホルダー SKIP が PASS
  • .mcp.json あり / memory サーバー設定あり → Step 3 = OK
  • .mcp.json なし / memory サーバーなし → Step 3 = SKIP
  • CI (Linux Pester) 全テスト PASS

影響範囲

  • scripts/main/Start-ClaudeOS.ps1 — Step 3 ロジック変更
  • tests/StartScripts.Tests.ps1 — テスト更新

残課題

  • CLAUDE_MEMORY_FILE_PATH 環境変数が未設定の場合は「configured (file not yet created)」表示(正常動作)

Closes #70

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • 新機能

    • メモリ復元ステップが実装されました。システムはメモリファイルの存在を確認し、保存されたエンティティを読み込むようになりました。
    • ヘルスチェック機能が統合され、システムが正しく構成されているかを検証するようになりました。
  • テスト

    • メモリ復元機能の動作確認テストが追加されました。

…ワイヤリング

- Start-ClaudeOS.ps1 に McpHealthCheck.psm1 を Import-Module
- Invoke-StepMemoryRestore 関数を実装:
  - .mcp.json 未設定 → SKIP
  - memory server 未設定 → SKIP
  - 設定あり → OK (エントリ数・ファイルパスをレポート)
  - 例外 → FAIL
- Step 3 のプレースホルダー呼び出しを Invoke-StepMemoryRestore に置換
- StartScripts.Tests.ps1: Step 3 を SKIP リストから除外し専用テストを追加

Closes #70

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 02:56
@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

ウォークスルー

Start-ClaudeOS.ps1 の Step 3 における Memory Restore 機能の実装。McpHealthCheck モジュールをインポートし、プレースホルダー処理を具体実装に置き換え。MCP 設定確認、環境変数からメモリファイル読み込み、エンティティ数カウント、ステータス結果を返却する処理を追加。テスト更新により Step 3 が SKIP ではなく実行されることを検証。

Changes

Cohort / File(s) Summary
Memory Restore Implementation
scripts/main/Start-ClaudeOS.ps1
McpHealthCheck モジュールをインポート。Step 3 プレースホルダーを Invoke-StepMemoryRestore に置き換え。Get-McpHealthReport で MCP 設定確認、CLAUDE_MEMORY_FILE_PATH から JSON メモリファイルを読み込み、エンティティ数をカウント。MCP 未設定時は SKIP、パース失敗時は FAIL、成功時は OK ステータスを返却。
Test Validation
tests/StartScripts.Tests.ps1
Step 3 が SKIP から Memory Restore 実行状態へ変更されたことを検証。従来の Step 3 SKIP 期待値を削除し、Step 3 が "Memory Restore" として実行され、かつ SKIP マッチングしないことを明示的にアサート。

予測される関連イシュー

推定コードレビュー工数

🎯 3 (中程度) | ⏱️ 約25分

ポエム

🐰 メモリよ、甦れ MCP の扉から
JSON に眠る思い出たちを
Step 3 の光が目を覚ます
ClaudeOS は今、記憶を取り戻す ✨🧠

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR タイトルは Issue #70 と Step 3 Memory Restore を McpHealthCheck.psm1 で統合する内容を正確に反映しており、実装内容と一致しています。
Linked Issues check ✅ Passed PR は Issue #70 の受入れ条件の大部分を満たしています: Step 3 が SKIP から OK/FAIL に変更され、MCP ヘルスチェックが統合され、テストが追加されています。
Out of Scope Changes check ✅ Passed すべての変更が Issue #70 のスコープ内です。McpHealthCheck.psm1 のインポート、Invoke-StepMemoryRestore の実装、テスト更新は、Step 3 Memory Restore の実装という目的に一貫しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue70-memory-mcp

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements Boot Step 3 (“Memory Restore”) wiring in Start-ClaudeOS.ps1 using McpHealthCheck.psm1, and updates Pester tests to reflect that Step 3 is no longer a placeholder.

Changes:

  • Import McpHealthCheck.psm1 and add Invoke-StepMemoryRestore for Step 3 decisioning (SKIP/OK/FAIL).
  • Replace the previous Step 3 placeholder call with Invoke-StepMemoryRestore.
  • Update StartScripts.Tests.ps1 to stop expecting Step 3 placeholder-SKIP and add a Step 3 execution assertion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
scripts/main/Start-ClaudeOS.ps1 Adds Step 3 implementation and wires it into the boot flow via MCP health reporting + memory file reporting.
tests/StartScripts.Tests.ps1 Updates dry-run flow assertions and adds a dedicated Step 3 “Memory Restore is executed” test.

Comment on lines +136 to +139
function Invoke-StepMemoryRestore {
param([string]$Root)
Write-BootStep 3 'Memory Restore'
try {

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script header comment still states that Step 3 is a placeholder that emits SKIP (it lists steps 3/5/6/7/8 as placeholders). Since Step 3 is now implemented via Invoke-StepMemoryRestore, please update the top-of-file description to avoid misleading users and future maintainers.

Copilot uses AI. Check for mistakes.
Comment on lines +141 to +149
if (-not $report.configured) {
Write-Host ' [SKIP] .mcp.json not found' -ForegroundColor DarkGray
Write-Host ''
return @{ Step = 3; Name = 'Memory Restore'; Status = 'SKIP'; Detail = 'no mcp config' }
}

$memoryConn = @($report.connections | Where-Object { $_.kind -eq 'memory' }) | Select-Object -First 1
if (-not $memoryConn) {
Write-Host ' [SKIP] memory server not configured in .mcp.json' -ForegroundColor DarkGray

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SKIP message hard-codes “.mcp.json not found”, but Get-McpHealthReport can be configured to look at a different config path via AI_STARTUP_MCP_CONFIG_PATH. Consider printing/reporting the actual $report.configPath (or similar) so the message remains accurate when a custom config path is used.

Suggested change
if (-not $report.configured) {
Write-Host ' [SKIP] .mcp.json not found' -ForegroundColor DarkGray
Write-Host ''
return @{ Step = 3; Name = 'Memory Restore'; Status = 'SKIP'; Detail = 'no mcp config' }
}
$memoryConn = @($report.connections | Where-Object { $_.kind -eq 'memory' }) | Select-Object -First 1
if (-not $memoryConn) {
Write-Host ' [SKIP] memory server not configured in .mcp.json' -ForegroundColor DarkGray
$configLabel = if ($report.configPath) { $report.configPath } else { '.mcp.json' }
if (-not $report.configured) {
Write-Host (' [SKIP] {0} not found' -f $configLabel) -ForegroundColor DarkGray
Write-Host ''
return @{ Step = 3; Name = 'Memory Restore'; Status = 'SKIP'; Detail = 'no mcp config' }
}
$memoryConn = @($report.connections | Where-Object { $_.kind -eq 'memory' }) | Select-Object -First 1
if (-not $memoryConn) {
Write-Host (' [SKIP] memory server not configured in {0}' -f $configLabel) -ForegroundColor DarkGray

Copilot uses AI. Check for mistakes.
Comment on lines +147 to +152
$memoryConn = @($report.connections | Where-Object { $_.kind -eq 'memory' }) | Select-Object -First 1
if (-not $memoryConn) {
Write-Host ' [SKIP] memory server not configured in .mcp.json' -ForegroundColor DarkGray
Write-Host ''
return @{ Step = 3; Name = 'Memory Restore'; Status = 'SKIP'; Detail = 'no memory server' }
}

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoke-StepMemoryRestore returns Status='OK' as long as a memory server entry exists in .mcp.json, even if that server is unavailable/unhealthy (e.g., command missing on Linux, or runtime probe/health status indicates failure). This can lead to a misleading boot summary where Memory Restore reports OK when it cannot actually run. Consider basing the status on the selected memory server’s availability/health (e.g., skip or fail with a clear detail when unavailable) and include the connection/server status in the returned Detail for diagnostics.

Copilot uses AI. Check for mistakes.
Comment on lines +154 to +166
$filePath = $env:CLAUDE_MEMORY_FILE_PATH
$entryCount = 0
if ($filePath -and (Test-Path $filePath)) {
try {
$data = Get-Content $filePath -Raw -Encoding UTF8 | ConvertFrom-Json -ErrorAction Stop
$entryCount = if ($data.entities) { @($data.entities).Count } else { 0 }
}
catch { $entryCount = 0 }
}

$fileLabel = if ($filePath -and (Test-Path $filePath)) {
'found ({0} entries)' -f $entryCount
}

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The memory file existence checks use Test-Path $filePath (twice) without -LiteralPath / -PathType Leaf. Using -LiteralPath avoids wildcard expansion, and PathType Leaf avoids treating a directory as a valid “memory file”; also consider computing a single $fileExists flag to avoid repeating Test-Path.

Copilot uses AI. Check for mistakes.
Comment on lines +167 to +172
elseif ($filePath) {
'configured (file not yet created)'
}
else {
'CLAUDE_MEMORY_FILE_PATH not set'
}

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says that when CLAUDE_MEMORY_FILE_PATH is unset the output should show something like “configured (file not yet created)” as a normal case, but the implementation labels it “CLAUDE_MEMORY_FILE_PATH not set”. Please align the output behavior with the PR description (either adjust the message/logic or update the PR description).

Copilot uses AI. Check for mistakes.
@Kensan196948G
Kensan196948G merged commit f8e8885 into main Apr 14, 2026
6 of 7 checks passed
Kensan196948G added a commit that referenced this pull request Apr 14, 2026
v2.9.0 セクションを `[v2.9.0-dev] - 2026-04-08` から `[v2.9.0] - 2026-04-14 (STABLE)` に更新し、
ClaudeOS v7.5 の全成果 (Boot Sequence Step 3/7/9 完全実装、CodeRabbit 統合、
/team-onboarding、ループ時間最適化、Issue Sync 修正) を反映。

新規に `[v3.0.0] - Unreleased` セクションを追加し、Phase 4 残タスク
(セキュリティ監査 / E2E テスト / リリースタグ) と Go/No-Go 基準を明文化。

- テスト数: 304 → 311 件に更新
- 追加 PR: #77, #79, #80, #81, #82, #83, #84, #86, #87, #88, #89

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Kensan196948G added a commit that referenced this pull request Apr 14, 2026
v2.9.0 セクションを `[v2.9.0-dev] - 2026-04-08` から `[v2.9.0] - 2026-04-14 (STABLE)` に更新し、
ClaudeOS v7.5 の全成果 (Boot Sequence Step 3/7/9 完全実装、CodeRabbit 統合、
/team-onboarding、ループ時間最適化、Issue Sync 修正) を反映。

新規に `[v3.0.0] - Unreleased` セクションを追加し、Phase 4 残タスク
(セキュリティ監査 / E2E テスト / リリースタグ) と Go/No-Go 基準を明文化。

- テスト数: 304 → 311 件に更新
- 追加 PR: #77, #79, #80, #81, #82, #83, #84, #86, #87, #88, #89

Co-authored-by: 有藤 健太郎 <k-aritoh@mirai-const.co.jp>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 3: Memory MCP 永続化統合

2 participants