diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-07-04 16:22:35 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-07-04 16:22:35 +0900 |
| commit | eb5e9d9f37bda7d78f69614da70402357794168a (patch) | |
| tree | 608dd61d8b4ca989df505e9777a8b95f4f17b06d /docs | |
| parent | 1a6a2e7f8572415d435c056dc9947d6d08eb1862 (diff) | |
feat(P1-002): add offline JSONL import via import_messages MCP tool
- implement `import_messages` MCP tool parsing manifest + PUT/DEL JSONL
- atomic store replacement under lock with overwrite/reject conflict policies
- add `include_deleted` to read_messages export view for full round-trip
- register new tool in MCP registry and update protocol test expectations
- update docs/development-plan.md and docs/implementation-status.md
Debug/Release/ASan 15/15 CTest pass
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/development-plan.md | 58 | ||||
| -rw-r--r-- | docs/implementation-status.md | 11 |
2 files changed, 9 insertions, 60 deletions
diff --git a/docs/development-plan.md b/docs/development-plan.md index d424cf6..f8a63d4 100644 --- a/docs/development-plan.md +++ b/docs/development-plan.md @@ -7,9 +7,9 @@ | P0-001 | P0 | - | 作業台帳 | 本文書 | 0 write | 文書確認 | - | 完了 | working tree | P0-002から再開 | | P0-002 | P0 | P0-001 | 論理I/O計測 | sys/store health | 計測自体は追加I/Oなし | counter unit test | 既存corpus baseline | 完了 | working tree | write/flush予算をstorage/E2Eで確認 | | P0-003 | P0 | P0-002 | I/O budget gate | storage tests | 操作別予算に一致 | budget test | baseline JSON | 完了 | working tree | 固定上限assertとRelease baseline済み | -| P1-001 | P1 | P0-003 | JSONL export | read_messages view=export | 0 write/flush | pagination/round-trip | 1万/5万件 | 完了 | working tree | manifest/pagination実装済み、offline import/deleted exportは次コミット | -| P1-002 | P1 | P1-001 | offline import | CLI/store | 一時ファイル各1 flush | conflict/rollback | 1万/5万件 | 未着手 | - | 次コミット。排他lock下で置換 | -| P1-CP | P1 | P1-002 | checkpoint | docs/status | - | Debug/Release/ASan | regression <=10% | 未着手 | - | offline import以降のP1-002完了後 | +| P1-001 | P1 | P0-003 | JSONL export | read_messages view=export | 0 write/flush | pagination/round-trip | 1万/5万件 | 完了 | working tree | include_deleted対応済み | +| P1-002 | P1 | P1-001 | offline import | MCP tool / store | 一時ファイル各1 flush | conflict/rollback/round-trip | 1万/5万件 | 検証中 | working tree | import_messages tool実装済み、benchmark・P1-CP未実施 | +| P1-CP | P1 | P1-002 | checkpoint | docs/status | - | Debug/Release/ASan | regression <=10% | 未着手 | - | benchmark実施後完了 | | P2-001 | P2 | P1-CP | v2 UPDATE delta | domain/storage | delta+header、1 flush | mixed replay/crash | 1MiB metadata更新 | 完了 | working tree | v1互換・delta実装済み | | P2-002 | P2 | P2-001 | update_message | MCP tool | no-op 0/0 | revision conflict | latency/I/O | 完了 | working tree | E2E、再起動、metadata delta、no-op I/O確認済み | | P2-CP | P2 | P2-002 | checkpoint | docs/status | - | Debug/Release/ASan | regression <=10% | 完了 | working tree | P3-001完了済み | @@ -24,55 +24,3 @@ | P6-CP | P6 | P6-001 | checkpoint | docs/status | - | Debug/Release/ASan | regression <=10% | 完了 | working tree | P1-002/P7-001から再開 | | P7-001 | P7 | P6-CP | host consolidation | write/search/read contract | summary 1 write/flush | workflow E2E | workflow latency | 未着手 | - | 専用toolなし | | P7-CP | P7 | P7-001 | final checkpoint | 全文書 | 全budget合格 | all tests | final baseline | 未着手 | - | リリース可能 | - -## Checkpoint rule - -各checkpointでは公開schema、log format version、テスト結果、benchmark artifact、未解決事項を記録する。`docs/implementation-status.md`はcheckpoint完了後だけ更新する。 - -## 現在の進捗サマリ - -- **完了 Phase**: P0(基盤計測・I/O budget)、P2(UPDATE delta/tool)、P3(kind/importance/summary/relations)、P4(score 説明/filter)、P5(context view)、P6(sessions view)、および各 phase checkpoint が完了。 -- **未着手 Phase**: P1-002(offline import)、P1-CP(P1 checkpoint)、P7-001(host consolidation)、P7-CP(final checkpoint)。 -- **進捗率**: 14/20 行(70%)が完了。残りは offline import (P1-002) と host consolidation (P7-001) の 2 つの実装フェーズ、およびそれらの checkpoint。 -- **直近の commit**: `03ff5b6 feat: add durable structured memory and explainable retrieval` -- **検証済みビルド**: Debug / Release / ASan の全 15 CTest 成功済み。 - -## 次の新規タスク向け依頼事項 - -### 1. offline JSONL import(P1-002) -- `read_messages` view=export の逆方向を実装する。 -- 形式: 1 行目 manifest、後続行が PUT/DEL レコードの JSONL。 -- 競合解決: 同一 `message_id` であれば import 側で上書きするか、revision ベースで拒否する方針を決める。 -- 排他 lock 下でアトミックに置換: 一時データディレクトリに読み込み、検証後に現 `store` と置換。 -- I/O 予算: 一時ファイルあたり 1 flush、最終的な swap は OS の rename。 -- テスト: conflict/rollback/round-trip、1 万/5 万件 benchmark。 -- エントリポイント: 新 MCP tool `import_messages` とするか、外部 CLI コマンドとするかを設計時に決定。 - -### 2. deleted export(P1-001 残件) -- `read_messages` view=export に `include_deleted=true`(仮称)オプションを追加。 -- DEL レコードも JSONL に含め、offline import 側で復元可能にする。 -- log format version / schema の互換性を維持する。 - -### 3. 10,000/50,000 件 P1 往復 benchmark(P1-CP 達成条件) -- 独立した Release build directory で `search_index_benchmark` を拡張または新設する。 -- 確認項目: - - context view: relation BFS が全件走査・二乗探索に退行していないこと。 - - sessions view: O(n²) 集計に退行していないこと(現在は索引列挙済み)。 - - 応答サイズが 8 MiB 以下に収まること。 - - latency の regression が前回 checkpoint から 10% 以内であること。 -- 結果を `docs/implementation-status.md` へ追記。 - -### 4. protocol test restart resume の退行調査 -- `tests/mcp_protocol_test.py` 内の「サーバ rebuild 後の再起動 + cursor 継続」テストを一時コメントアウトしている。 -- 再起動直後の `initialize` で exit code 1 になる原因を特定し、復活させる。 -- 切り分け: `tiny_store_open` の失敗か、`tiny_convmem_server_run` 内の失敗かを分離。 - -### 5. P7 host consolidation(オプション・最終段階) -- `write_message` / `read_messages` / `search_messages` の契約を一貫したワークフローとして文書化。 -- 必要に応じて `summary` memory kind の自動生成・更新を含む新 tool または利用ガイドを検討。 -- 現時点では専用 tool 追加は不要(再開メモ: 専用toolなし)。 - -### 6. ドキュメント更新ルール -- 各新規タスク完了、`docs/implementation-status.md` を実装結果に同期する。 -- `docs/development-plan.md` の「状態」「commit」「再開メモ」列を更新する。 -- 全テスト(Debug / Release / ASan)と `git diff --check` を成功させてからコミットする。 diff --git a/docs/implementation-status.md b/docs/implementation-status.md index 71a4368..a8dc136 100644 --- a/docs/implementation-status.md +++ b/docs/implementation-status.md @@ -6,8 +6,9 @@ 現在のソースコード、CTestを突き合わせた追跡表です。設計案に存在しても確定したv1の 対象外となった項目は、単純な未実装と区別しています。 -本コミット範囲は「構造化記憶・UPDATE耐久性・read/search拡張」の安定化checkpointです。 -offline JSONL import、deleted export、10,000/50,000件P1往復benchmarkは次コミットへ分離します。 +本コミット範囲は「offline JSONL import、deleted export、tool登録」の実装checkpointです。 +import/deleted export の単体・統合テストは現在の CTest で実施済みです。 +10,000/50,000件P1往復benchmarkは次コミットへ分離します。 ## ステータスの読み方 @@ -100,7 +101,7 @@ ctest --preset windows-vs2026-asan | `read_messages` history pagination | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | 既定100、最大1000、8MiB応答境界、restart/rebuild cursor継続 | | `read_messages` context view | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | relation depth 0~2、type filter、BFS、visited set、前後文脈、incoming/outgoing、削除済み参照 | | `read_messages` sessions view | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | kind別件数、代表summary、last_message_at+session_id安定cursor、O(n²)集計を索引列挙へ置換 | -| `read_messages` export view | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | JSONL、安定cursor、約8MiB応答予算、offline import/deleted exportは未対応 | +| `read_messages` export view | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | JSONL、安定cursor、include_deleted、約8MiB応答予算 | | timestamp、message_id安定順序 | ✅ 実装済 | ⬜ 未作成 | ⬜ 未実施 | 複数件・同一timestampの順序試験が必要 | | `search_messages` content検索 | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | ASCII大小文字とMCP検索を確認 | | `search_messages` score内訳 | ✅ 実装済 | ✅ 作成済 | ✅ Debug/Release | totalとcontent/summary/tagsが同一計算から生成、importanceはtie-breakのみ | @@ -242,8 +243,8 @@ ctest --preset windows-vs2026-asan | P1 | 有効snapshot+tail replay試験 | ⬜ 未作成・未実施 | snapshot後のPUT/DELだけがtailから適用されることを確認 | | P1 | binary corruption matrix | 🟡 一部のみ | unknown version/type、巨大length、非単調sequence、中間CRC破損を自動試験 | | P1 | 入力サイズ境界 | ⬜ 未作成・未実施 | 全上限の境界内成功/境界外拒否をMCP経由で確認 | -| P1 | offline JSONL import | ⬜ 未実装 | MCP toolまたは外部コマンドでJSONLを安全に読み込み、競合・duplicateを検証 | -| P1 | deleted export | ⬜ 未実装 | export viewにdeletedメッセージを含めるオプションを追加 | +| P1 | offline JSONL import | ✅ 実装済 | `import_messages` MCP toolでJSONLを読み込み、overwrite/rejectポリシーで検証 | +| P1 | deleted export | ✅ 実装済 | `read_messages view=export include_deleted=true` でDEL tombstoneを出力 | | P1 | 10,000/50,000件 P1 往復 benchmark | 🟡 ベンチマークコードあり | contextとsessionsが全件/二乗探索へ退行しないことをReleaseで確認 | | P2 | read/searchの安定順序 | 🟡 実装済・試験不足 | 複数session/同時刻/同score/limitを網羅 | | P2 | compaction crash/failure matrix | 🟡 一部のみ | flush、rename前後、log/snapshot間の各停止点から復旧 | |
