@nahisaho/musubix-core 2.4.2 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.github/AGENTS.md CHANGED
@@ -1,243 +1,858 @@
1
- # MUSUBIX - AI Coding Agents
1
+ # MUSUBIX - Neuro-Symbolic AI Integration System
2
2
 
3
- This file defines AI agent configurations for MUSUBIX - Neuro-Symbolic AI Integration System.
3
+ > **AI Coding Agent向け**: このファイルはAIエージェント(GitHub Copilot、Claude等)がMUSUBIXプロジェクトを理解するためのガイドです。
4
4
 
5
- **Platform Support**: GitHub Copilot, Claude, Cursor, Gemini CLI, Codex CLI, Windsurf
5
+ ## 🎯 プロジェクト概要
6
+
7
+ **MUSUBIX**は、**Neural(LLM)** と **Symbolic(Knowledge Graph)** 推論を統合した次世代AIコーディングシステムです。MUSUBI SDD方法論とオントロジー推論を組み合わせ、高品質なソフトウェア開発を支援します。
8
+
9
+ | 項目 | 詳細 |
10
+ |------|------|
11
+ | **バージョン** | 3.0.0 (Git-Native Knowledge System) |
12
+ | **言語** | TypeScript |
13
+ | **ランタイム** | Node.js >= 20.0.0 |
14
+ | **パッケージマネージャ** | npm >= 10.0.0 |
15
+ | **ビルドシステム** | モノレポ(npm workspaces) |
16
+ | **テストフレームワーク** | Vitest |
17
+ | **テスト数** | 2249+ (全合格) |
18
+ | **パッケージ数** | 25 |
19
+ | **MCPツール数** | 61 |
20
+ | **Agent Skills** | 13 (Claude Code対応) |
6
21
 
7
22
  ---
8
23
 
9
- ## MCP Server Integration
24
+ ## 📦 アーキテクチャ
25
+
26
+ ### パッケージ構成
27
+
28
+ ```
29
+ packages/
30
+ ├── core/ # @nahisaho/musubix-core
31
+ ├── mcp-server/ # @nahisaho/musubix-mcp-server
32
+ ├── security/ # @nahisaho/musubix-security
33
+ ├── formal-verify/ # @nahisaho/musubix-formal-verify
34
+ ├── pattern-mcp/ # @nahisaho/musubix-pattern-mcp
35
+ ├── ontology-mcp/ # @nahisaho/musubix-ontology-mcp
36
+ ├── wake-sleep/ # @nahisaho/musubix-wake-sleep
37
+ ├── sdd-ontology/ # @nahisaho/musubix-sdd-ontology
38
+ ├── dfg/ # @nahisaho/musubix-dfg
39
+ ├── lean/ # @nahisaho/musubix-lean
40
+ ├── library-learner/# @nahisaho/musubix-library-learner
41
+ ├── neural-search/ # @nahisaho/musubix-neural-search
42
+ ├── synthesis/ # @nahisaho/musubix-synthesis
43
+ ├── agent-orchestrator/ # @nahisaho/musubix-agent-orchestrator
44
+ ├── workflow-engine/ # @nahisaho/musubix-workflow-engine
45
+ ├── skill-manager/ # @nahisaho/musubix-skill-manager
46
+ ├── codegraph/ # @nahisaho/musubix-codegraph
47
+ ├── knowledge/ # @musubix/knowledge (v3.0.0 NEW!)
48
+ ├── policy/ # @musubix/policy (v3.0.0 NEW!)
49
+ └── decisions/ # @musubix/decisions (v3.0.0 NEW!)
50
+ ```
51
+
52
+ | パッケージ | npm | 役割 |
53
+ |-----------|-----|------|
54
+ | `packages/core/` | `@nahisaho/musubix-core` | コアライブラリ - CLI、EARS検証、コード生成、設計パターン |
55
+ | `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 61ツール、5プロンプト |
56
+ | `packages/security/` | `@nahisaho/musubix-security` | セキュリティ分析 - 脆弱性検出、シークレット検出、テイント解析 |
57
+ | `packages/formal-verify/` | `@nahisaho/musubix-formal-verify` | 形式検証 - Z3統合、Hoare検証、EARS→SMT変換 |
58
+ | `packages/pattern-mcp/` | `@nahisaho/musubix-pattern-mcp` | パターン学習 - 抽出・圧縮・ライブラリ |
59
+ | `packages/ontology-mcp/` | `@nahisaho/musubix-ontology-mcp` | オントロジー - N3Store・推論エンジン |
60
+ | `packages/wake-sleep/` | `@nahisaho/musubix-wake-sleep` | Wake-Sleep学習サイクル |
61
+ | `packages/sdd-ontology/` | `@nahisaho/musubix-sdd-ontology` | SDD方法論オントロジー |
62
+ | `packages/dfg/` | `@nahisaho/musubix-dfg` | **DFG/CFG抽出** - データフロー・制御フロー解析 |
63
+ | `packages/lean/` | `@nahisaho/musubix-lean` | **Lean 4統合** - 定理証明・EARS変換 |
64
+ | `packages/library-learner/` | `@nahisaho/musubix-library-learner` | **ライブラリ学習** - APIパターン抽出、メトリクスエクスポート |
65
+ | `packages/knowledge/` | `@musubix/knowledge` | **知識ストア (v3.0.0 NEW!)** - Git-friendly JSON知識グラフ |
66
+ | `packages/policy/` | `@musubix/policy` | **ポリシーエンジン (v3.0.0 NEW!)** - 9憲法条項検証 |
67
+ | `packages/decisions/` | `@musubix/decisions` | **ADRマネージャー (v3.0.0 NEW!)** - Architecture Decision Records |
68
+ | `packages/neural-search/` | `@nahisaho/musubix-neural-search` | **ニューラル検索** - 意味的コード検索、軌跡ロギング |
69
+ | `packages/synthesis/` | `@nahisaho/musubix-synthesis` | **プログラム合成** - ニューラル誘導合成、説明生成 |
70
+ | `packages/agent-orchestrator/` | `@nahisaho/musubix-agent-orchestrator` | **エージェント調整** - サブエージェント分散・複雑度分析 |
71
+ | `packages/workflow-engine/` | `@nahisaho/musubix-workflow-engine` | **ワークフロー制御** - 5フェーズ制御・品質ゲート |
72
+ | `packages/skill-manager/` | `@nahisaho/musubix-skill-manager` | **スキル管理** - スキル登録・実行・検証 |
73
+ | `packages/codegraph/` | `@nahisaho/musubix-codegraph` | **コードグラフ** - コード構造解析・依存関係追跡 |
74
+
75
+ ### 非推奨パッケージ(Deprecated) ⚠️
76
+
77
+ 以下のYATA関連パッケージはv3.0.0で非推奨となりました。`@musubix/knowledge`へ移行してください。
78
+
79
+ | パッケージ | 状態 | 移行先 |
80
+ |-----------|------|--------|
81
+ | `packages/yata-client/` | ⚠️ Deprecated | `@musubix/knowledge` |
82
+ | `packages/yata-global/` | ⚠️ Deprecated | `@musubix/knowledge` |
83
+ | `packages/yata-local/` | ⚠️ Deprecated | `@musubix/knowledge` |
84
+ | `packages/yata-scale/` | ⚠️ Deprecated | `@musubix/knowledge` |
85
+ | `packages/yata-ui/` | ⚠️ Deprecated | `@musubix/knowledge` |
86
+
87
+ **移行ガイド**: [docs/MIGRATION-v3.0.md](docs/MIGRATION-v3.0.md)
88
+
89
+ ### Core パッケージモジュール
90
+
91
+ ```
92
+ packages/core/src/
93
+ ├── auth/ # 認証・認可
94
+ ├── cli/ # CLIインターフェース
95
+ ├── codegen/ # コード生成・解析
96
+ ├── design/ # 設計パターン・C4モデル
97
+ ├── error/ # エラーハンドリング
98
+ ├── explanation/ # 説明生成・可視化
99
+ ├── learning/ # 自己学習システム
100
+ ├── requirements/ # 要件分析・分解
101
+ ├── symbolic/ # シンボリック推論(v1.2.0 NEW!)
102
+ ├── traceability/ # トレーサビリティ
103
+ ├── types/ # 型定義
104
+ ├── utils/ # ユーティリティ
105
+ └── validators/ # EARS検証
106
+ ```
10
107
 
11
- MUSUBIX provides an MCP Server (`@nahisaho/musubix-mcp-server`) with 10 SDD tools and 3 prompts.
108
+ ---
12
109
 
13
- ### Starting MCP Server
110
+ ## 🛠️ CLI コマンド
111
+
112
+ ```bash
113
+ # プロジェクト初期化
114
+ npx musubix init [path] [--name <name>] [--force]
115
+
116
+ # 要件分析(EARS形式)
117
+ npx musubix requirements analyze <file> # 自然言語 → EARS変換
118
+ npx musubix requirements validate <file> # EARS構文検証
119
+ npx musubix requirements map <file> # オントロジーマッピング
120
+ npx musubix requirements search <query> # 関連要件検索
121
+
122
+ # 設計生成
123
+ npx musubix design generate <file> # 要件から設計生成
124
+ npx musubix design patterns <context> # パターン検出
125
+ npx musubix design validate <file> # SOLID準拠検証
126
+ npx musubix design c4 <file> # C4ダイアグラム生成
127
+ npx musubix design adr <decision> # ADR生成
128
+
129
+ # コード生成
130
+ npx musubix codegen generate <file> # 設計からコード生成
131
+ npx musubix codegen analyze <file> # 静的解析
132
+ npx musubix codegen security <path> # セキュリティスキャン
133
+
134
+ # テスト
135
+ npx musubix test generate <file> # テスト生成
136
+ npx musubix test coverage <dir> # カバレッジ測定
137
+
138
+ # トレーサビリティ
139
+ npx musubix trace matrix # トレーサビリティマトリクス
140
+ npx musubix trace matrix -p <project> # 指定プロジェクトのマトリクス
141
+ npx musubix trace impact <id> # 影響分析
142
+ npx musubix trace validate # リンク検証
143
+ npx musubix trace sync # トレースマトリクス自動更新 (v1.6.7 NEW!)
144
+ npx musubix trace sync --dry-run # プレビューのみ
145
+
146
+ # 説明生成
147
+ npx musubix explain why <id> # 決定理由の説明
148
+ npx musubix explain graph <id> # 推論グラフ生成
149
+
150
+ # 自己学習システム
151
+ npx musubix learn status # 学習状態ダッシュボード
152
+ npx musubix learn feedback <id> # フィードバック記録
153
+ npx musubix learn patterns # パターン一覧表示
154
+ npx musubix learn add-pattern <name> # パターン手動登録
155
+ npx musubix learn remove-pattern <id> # パターン削除
156
+ npx musubix learn recommend # コンテキストベースの推奨
157
+ npx musubix learn decay # 未使用パターンの減衰
158
+ npx musubix learn export # 学習データエクスポート
159
+ # オプション: --output <file>, --privacy-filter, --patterns-only, --feedback-only, --min-confidence <n>
160
+ npx musubix learn import <file> # 学習データインポート
161
+ # オプション: --merge-strategy <skip|overwrite|merge>, --dry-run, --patterns-only, --feedback-only
162
+
163
+ # オントロジー操作 (v1.4.1 NEW!)
164
+ npx musubix ontology validate -f <file> # 知識グラフ整合性検証
165
+ npx musubix ontology check-circular -f <file> # 循環依存チェック
166
+ npx musubix ontology stats -f <file> # 統計表示
167
+
168
+ # Interactive REPL (v1.5.0 NEW!)
169
+ npx musubix repl # 対話的シェルを起動
170
+ npx musubix repl --history <file> # カスタム履歴ファイル
171
+ npx musubix repl --no-color # 色なしモード
172
+
173
+ # KGPR - Knowledge Graph Pull Request (v1.6.4 - DEPRECATED)
174
+ # KGPRは廃止されました。通常のGit PRワークフローを使用してください。
175
+
176
+ # SDDプロジェクトスキャフォールド (v1.6.7 NEW!)
177
+ npx musubix scaffold domain-model <name> # DDDプロジェクト生成
178
+ npx musubix scaffold domain-model <name> -e "Entity1,Entity2" # エンティティ指定
179
+ npx musubix scaffold domain-model <name> -d DOMAIN # ドメイン接頭辞指定
180
+ npx musubix scaffold minimal <name> # 最小構成プロジェクト
181
+
182
+ # プログラム合成 (v2.2.0 NEW!)
183
+ npx musubix synthesize <examples.json> # 例からプログラム合成
184
+ npx musubix synthesize pbe <examples.json> # PBE特化合成
185
+ npx musubix syn <examples.json> # エイリアス
186
+
187
+ # パターンライブラリ管理 (v2.2.0 NEW!)
188
+ npx musubix library learn <file> # コードからパターン学習
189
+ npx musubix library query <query> # パターン検索
190
+ npx musubix library stats # 統計表示
191
+ npx musubix lib stats # エイリアス
192
+
193
+ # ヘルプ
194
+ npx musubix --help
195
+ npx musubix help <command>
196
+ ```
197
+
198
+ ---
199
+
200
+ ## 🔌 MCP Server
201
+
202
+ ### 起動方法
14
203
 
15
204
  ```bash
16
205
  npx @nahisaho/musubix-mcp-server
17
206
  npx musubix-mcp --transport stdio
18
207
  ```
19
208
 
20
- ### MCP Tools (10 SDD Tools)
209
+ ### ツール一覧(61ツール)
210
+
211
+ #### SDD基本ツール(7ツール)
212
+
213
+ | ツール名 | 説明 |
214
+ |---------|------|
215
+ | `sdd_create_requirements` | EARS形式の要件ドキュメント作成 |
216
+ | `sdd_validate_requirements` | 要件のEARS検証・憲法準拠チェック |
217
+ | `sdd_create_design` | C4モデル設計ドキュメント作成 |
218
+ | `sdd_validate_design` | 設計の要件トレーサビリティ検証 |
219
+ | `sdd_create_tasks` | 設計から実装タスク生成 |
220
+ | `sdd_validate_constitution` | 9憲法条項への準拠検証 |
221
+ | `sdd_validate_traceability` | 要件↔設計↔タスクのトレーサビリティ検証 |
222
+
223
+ #### パターン統合ツール(7ツール)- v1.3.0 NEW!
224
+
225
+ | ツール名 | 説明 |
226
+ |---------|------|
227
+ | `pattern_extract` | コードからパターンを抽出 |
228
+ | `pattern_compress` | パターンの抽象化・圧縮 |
229
+ | `pattern_store` | パターンライブラリへの保存 |
230
+ | `pattern_query` | パターンの検索・取得 |
231
+ | `pattern_consolidate` | 類似パターンの統合 |
232
+ | `ontology_query` | オントロジーグラフへのクエリ |
233
+ | `ontology_infer` | オントロジーによる推論実行 |
234
+
235
+ #### オントロジー検証ツール(3ツール)- v1.4.1 NEW!
236
+
237
+ | ツール名 | 説明 |
238
+ |---------|------|
239
+ | `consistency_validate` | 知識グラフの整合性検証 |
240
+ | `validate_triple` | 単一トリプルの事前検証 |
241
+ | `check_circular` | 循環依存の検出 |
242
+
243
+ #### Synthesisツール(5ツール)- v2.2.0 NEW!
244
+
245
+ | ツール名 | 説明 |
246
+ |---------|------|
247
+ | `synthesis_from_examples` | 例からプログラム合成 |
248
+ | `synthesis_analyze_examples` | 例題品質分析 |
249
+ | `synthesis_learn_patterns` | パターン学習 |
250
+ | `synthesis_query_patterns` | パターン検索 |
251
+ | `synthesis_get_stats` | 統計取得 |
252
+
253
+ #### Agent Orchestratorツール(4ツール)- v2.4.0 NEW!
254
+
255
+ | ツール名 | 説明 |
256
+ |---------|------|
257
+ | `agent_analyze_complexity` | タスク複雑度分析・サブエージェント分散判定 |
258
+ | `agent_dispatch` | サブエージェントへのタスクディスパッチ |
259
+ | `agent_collect_results` | サブエージェント結果の収集・統合 |
260
+ | `agent_get_status` | エージェント実行状態の取得 |
261
+
262
+ #### Workflow Engineツール(5ツール)- v2.4.0 NEW!
263
+
264
+ | ツール名 | 説明 |
265
+ |---------|------|
266
+ | `workflow_create` | 新規ワークフロー作成(5フェーズ制御) |
267
+ | `workflow_advance_phase` | 次フェーズへの遷移(品質ゲート検証付き) |
268
+ | `workflow_set_approval` | ユーザー承認状態の設定 |
269
+ | `workflow_get_status` | ワークフロー現在状態の取得 |
270
+ | `workflow_validate_transition` | フェーズ遷移の事前検証 |
271
+
272
+ #### Skill Managerツール(5ツール)- v2.4.0 NEW!
273
+
274
+ | ツール名 | 説明 |
275
+ |---------|------|
276
+ | `skill_register` | 新規スキルの登録 |
277
+ | `skill_execute` | スキルの実行 |
278
+ | `skill_list` | 登録済みスキル一覧の取得 |
279
+ | `skill_get_info` | スキル詳細情報の取得 |
280
+ | `skill_validate` | スキル定義の検証 |
281
+
282
+ #### Knowledge Storeツール(6ツール)- v3.0.0 NEW!
283
+
284
+ | ツール名 | 説明 |
285
+ |---------|------|
286
+ | `knowledge_put_entity` | エンティティの作成・更新 |
287
+ | `knowledge_get_entity` | エンティティの取得 |
288
+ | `knowledge_delete_entity` | エンティティの削除 |
289
+ | `knowledge_add_relation` | リレーションの追加 |
290
+ | `knowledge_query` | グラフクエリによる検索 |
291
+ | `knowledge_traverse` | グラフ走査による関連エンティティ探索 |
292
+
293
+ #### Policy Engineツール(4ツール)- v3.0.0 NEW!
294
+
295
+ | ツール名 | 説明 |
296
+ |---------|------|
297
+ | `policy_validate` | プロジェクトのポリシー検証 |
298
+ | `policy_list` | 登録済みポリシー一覧 |
299
+ | `policy_get` | ポリシー詳細取得 |
300
+ | `policy_check_file` | 単一ファイルのポリシー検証 |
301
+
302
+ #### Decision Recordsツール(8ツール)- v3.0.0 NEW!
303
+
304
+ | ツール名 | 説明 |
305
+ |---------|------|
306
+ | `decision_create` | ADRの作成 |
307
+ | `decision_list` | ADR一覧取得 |
308
+ | `decision_get` | ADR詳細取得 |
309
+ | `decision_accept` | ADRの承認 |
310
+ | `decision_deprecate` | ADRの廃止 |
311
+ | `decision_search` | ADRのキーワード検索 |
312
+ | `decision_find_by_requirement` | 要件からADR検索 |
313
+ | `decision_generate_index` | ADRインデックス生成 |
314
+
315
+ ### プロンプト一覧(5プロンプト)
316
+
317
+ | プロンプト名 | 説明 |
318
+ |-------------|------|
319
+ | `sdd_requirements_analysis` | 機能説明からEARS形式要件を生成 |
320
+ | `sdd_requirements_review` | 要件の完全性・憲法準拠レビュー |
321
+ | `sdd_design_generation` | 要件からC4モデル設計を生成 |
322
+ | `synthesis_guidance` | 合成ガイダンス (v2.2.0 NEW!) |
323
+ | `synthesis_explain_pattern` | パターン説明 (v2.2.0 NEW!) |
324
+
325
+ ---
21
326
 
22
- | Tool Name | Description | Usage |
23
- |-----------|-------------|-------|
24
- | `sdd_create_requirements` | Create EARS-format requirements document | Requirements phase |
25
- | `sdd_validate_requirements` | Validate requirements against EARS patterns | Requirements validation |
26
- | `sdd_create_design` | Create C4 model design document | Design phase |
27
- | `sdd_validate_design` | Validate design traceability | Design validation |
28
- | `sdd_create_tasks` | Generate implementation tasks | Task breakdown |
29
- | `sdd_query_knowledge` | Query YATA knowledge graph | Knowledge retrieval |
30
- | `sdd_ask_knowledge` | **Natural language query to YATA (EN/JA)** | NL Knowledge query (v2.4.1 NEW!) |
31
- | `sdd_update_knowledge` | Update knowledge graph | Knowledge management |
32
- | `sdd_validate_constitution` | Validate against 9 Constitutional Articles | Compliance check |
33
- | `sdd_validate_traceability` | Validate requirement-design-task traceability | Traceability audit |
327
+ ## 📋 9憲法条項(Constitutional Articles)
34
328
 
35
- ### MCP Prompts (3 Prompts)
329
+ すべての開発活動を統治する不変のルールです。
36
330
 
37
- | Prompt Name | Description |
38
- |-------------|-------------|
39
- | `sdd_requirements_analysis` | Analyze feature and generate EARS requirements |
40
- | `sdd_requirements_review` | Review requirements for completeness |
41
- | `sdd_design_generation` | Generate C4 model design from requirements |
331
+ | 条項 | 名称 | 概要 |
332
+ |-----|------|------|
333
+ | **I** | Library-First | 機能は独立ライブラリとして開始 |
334
+ | **II** | CLI Interface | すべてのライブラリはCLI公開必須 |
335
+ | **III** | Test-First | Red-Green-Blueサイクルでテスト先行 |
336
+ | **IV** | EARS Format | 要件はEARS形式で記述 |
337
+ | **V** | Traceability | 要件↔設計↔コード↔テストの100%追跡 |
338
+ | **VI** | Project Memory | steering/を参照してから決定 |
339
+ | **VII** | Design Patterns | 設計パターン適用の文書化 |
340
+ | **VIII** | Decision Records | すべての決定をADRで記録 |
341
+ | **IX** | Quality Gates | フェーズ移行前の品質検証 |
42
342
 
43
- **Setup**: See `steering/tech.ja.md` for configuration.
343
+ **詳細**: [steering/rules/constitution.md](steering/rules/constitution.md)
44
344
 
45
345
  ---
46
346
 
47
- ## Project Structure
347
+ ## 📁 プロジェクトメモリ(Steering)
48
348
 
49
- MUSUBIX is a monorepo with 3 packages:
349
+ AIエージェントは決定前に必ずこれらのファイルを参照してください。
50
350
 
51
- ```
52
- packages/
53
- ├── core/ # @nahisaho/musubix-core - CLI, validation, code generation
54
- ├── mcp-server/ # @nahisaho/musubix-mcp-server - MCP Server
55
- └── yata-client/ # @nahisaho/musubix-yata-client - Knowledge graph client
56
- ```
351
+ | ファイル | 内容 |
352
+ |---------|------|
353
+ | `steering/structure.ja.md` | アーキテクチャパターン、レイヤー構造 |
354
+ | `steering/tech.ja.md` | 技術スタック(TypeScript, Node.js 20+) |
355
+ | `steering/product.ja.md` | プロダクトコンテキスト |
356
+ | `steering/rules/constitution.md` | 9憲法条項 |
357
+ | `steering/project.yml` | プロジェクト設定 |
57
358
 
58
359
  ---
59
360
 
60
- ## CLI Commands
361
+ ## 📂 ストレージ構造
61
362
 
62
- ```bash
63
- # Project initialization
64
- npx musubix init [path] [--name <name>] [--force]
363
+ | パス | 内容 |
364
+ |-----|------|
365
+ | `storage/specs/` | 要件(REQ-*)、設計(DES-*)、タスク(TSK-*) |
366
+ | `storage/design/` | 設計ドキュメント、C4ダイアグラム |
367
+ | `storage/traceability/` | トレーサビリティマトリクス |
368
+ | `storage/reviews/` | コードレビュー、検証結果 |
369
+ | `storage/changes/` | 変更履歴 |
370
+ | `storage/archive/` | アーカイブ |
371
+
372
+ ---
65
373
 
66
- # Requirements analysis (EARS format)
67
- npx musubix requirements analyze <file>
68
- npx musubix requirements validate <file>
69
- npx musubix requirements map <file>
70
- npx musubix requirements search <query>
374
+ ## 🧪 開発コマンド
71
375
 
72
- # Design generation
73
- npx musubix design generate <file>
74
- npx musubix design patterns <context>
75
- npx musubix design validate <file>
76
- npx musubix design c4 <file>
77
- npx musubix design adr <decision>
376
+ ```bash
377
+ # 依存関係インストール
378
+ npm install
78
379
 
79
- # Code generation
80
- npx musubix codegen generate <file>
81
- npx musubix codegen analyze <file>
82
- npx musubix codegen security <path>
380
+ # 全パッケージビルド
381
+ npm run build
83
382
 
84
- # Test generation
85
- npx musubix test generate <file>
86
- npx musubix test coverage <dir>
383
+ # テスト実行
384
+ npm run test # 全テスト
385
+ npm run test:unit # ユニットテスト
386
+ npm run test:integration # 統合テスト
387
+ npm run test:coverage # カバレッジ計測
87
388
 
88
- # Traceability
89
- npx musubix trace matrix
90
- npx musubix trace impact <id>
91
- npx musubix trace validate
389
+ # コード品質
390
+ npm run lint # ESLint
391
+ npm run lint:fix # ESLint 自動修正
392
+ npm run typecheck # TypeScript型チェック
92
393
 
93
- # Explanation
94
- npx musubix explain why <id>
95
- npx musubix explain graph <id>
394
+ # クリーンアップ
395
+ npm run clean
96
396
  ```
97
397
 
98
398
  ---
99
399
 
100
- ## 9 Constitutional Articles
400
+ ## 🔑 主要機能
401
+
402
+ ### 1. Neuro-Symbolic統合(REQ-INT-001〜003準拠)
403
+ - **Neural(LLM)**: 創造的なコード生成、自然言語理解
404
+ - **Symbolic(Ontology)**: オントロジーによる精密な推論、一貫性検証
405
+ - **信頼度評価ルール** (REQ-INT-002):
406
+ | シンボリック結果 | ニューラル信頼度 | 最終決定 |
407
+ |-----------------|-----------------|---------|
408
+ | invalid | - | ニューラル結果を棄却 |
409
+ | valid | ≥0.8 | ニューラル結果を採用 |
410
+ | valid | <0.8 | シンボリック結果を優先 |
411
+
412
+ ### 2. EARS要件分析
413
+ 5つのEARSパターンで要件を形式化(REQ-RA-001準拠):
414
+
415
+ | パターン | 構文 | 用途 |
416
+ |---------|------|------|
417
+ | Ubiquitous | `THE [system] SHALL [requirement]` | システムが常に満たすべき要件 |
418
+ | Event-driven | `WHEN [event], THE [system] SHALL [response]` | 特定イベント発生時の要件 |
419
+ | State-driven | `WHILE [state], THE [system] SHALL [response]` | 特定状態における要件 |
420
+ | Unwanted | `THE [system] SHALL NOT [behavior]` | 回避すべき動作の要件 |
421
+ | Optional | `IF [condition], THEN THE [system] SHALL [response]` | 条件付き要件 |
422
+
423
+ **要件総数**: 41要件(REQ-MUSUBIX-001定義)
424
+ **優先度**: P0(必須)、P1(重要)、P2(任意)
425
+
426
+ ### 3. C4モデル設計
427
+ 4つのレベルで設計を構造化:
428
+ - **Context**: システム境界と外部アクター
429
+ - **Container**: 技術選択とコンテナ構成
430
+ - **Component**: コンテナ内部構造
431
+ - **Code**: 実装詳細
432
+
433
+ **C4コード生成** (v1.0.12 NEW!):
434
+ ```bash
435
+ # C4設計ドキュメントからTypeScriptスケルトンコードを自動生成
436
+ npx musubix codegen generate <design.md> --output src/
437
+ ```
438
+ - 設計パターン(Repository, Service, Factory等)を自動検出
439
+ - コンポーネントごとにTypeScriptファイル生成
440
+ - 設計との完全なトレーサビリティを維持
101
441
 
102
- All development activities are governed by these immutable rules:
442
+ ### 4. 完全なトレーサビリティ
443
+ ```
444
+ 要件(REQ-*) → 設計(DES-*) → タスク(TSK-*) → コード → テスト
445
+ ```
103
446
 
104
- | Article | Name | Summary |
105
- |---------|------|---------|
106
- | **I** | Library-First | Features start as independent libraries in packages/ |
107
- | **II** | CLI Interface | All libraries expose CLI |
108
- | **III** | Test-First | Red-Green-Blue cycle |
109
- | **IV** | EARS Format | Requirements in EARS syntax |
110
- | **V** | Traceability | 100% Requirements↔Design↔Code↔Tests tracking |
111
- | **VI** | Project Memory | Consult steering/ before decisions |
112
- | **VII** | Design Patterns | Document pattern applications |
113
- | **VIII** | Decision Records | All decisions as ADRs |
114
- | **IX** | Quality Gates | Validate before phase transitions |
447
+ ### 5. 自己学習システム(REQ-LEARN-001〜006準拠)
448
+ - **フィードバック収集**: accept/reject/modifyの記録と分析
449
+ - **パターン抽出**: 繰り返しパターンの自動検出・登録
450
+ - **適応的推論**: 学習済みパターンに基づく推論調整
451
+ - **プライバシー保護**: 機密情報の自動フィルタリング(ローカルストレージのみ)
115
452
 
116
- ---
453
+ ```
454
+ フィードバック → パターン候補 → 閾値超過 → パターン登録 → 推論に適用
455
+ ```
117
456
 
118
- ## Prompt Files
457
+ ### 6. Wake-Sleep学習サイクル(v1.3.0 NEW!)
119
458
 
120
- GitHub Copilot prompts are located in `.github/prompts/`:
459
+ Wake-Sleepアルゴリズムに基づいた継続的学習システム:
121
460
 
122
- | Prompt | Command | Description |
123
- |--------|---------|-------------|
124
- | `sdd-requirements.prompt.md` | `musubix requirements` | Create EARS requirements |
125
- | `sdd-design.prompt.md` | `musubix design` | Generate C4 design |
126
- | `sdd-tasks.prompt.md` | `musubix tasks` | Break down into tasks |
127
- | `sdd-implement.prompt.md` | `musubix implement` | Execute implementation |
128
- | `sdd-validate.prompt.md` | `musubix validate` | Validate compliance |
129
- | `sdd-steering.prompt.md` | `musubix steering` | Manage project memory |
130
- | `sdd-change-init.prompt.md` | `musubix change init` | Initialize change proposal |
131
- | `sdd-change-apply.prompt.md` | `musubix change apply` | Apply change proposal |
132
- | `sdd-change-archive.prompt.md` | `musubix change archive` | Archive completed change |
461
+ | フェーズ | 処理内容 |
462
+ |---------|----------|
463
+ | **Wake** | コード観察 パターン抽出 知識グラフ更新 |
464
+ | **Sleep** | パターン統合 類似パターン圧縮 メモリ最適化 |
133
465
 
134
- ---
466
+ ```
467
+ Wake Phase: observe() → extractPatterns() → updateKnowledge()
468
+ Sleep Phase: consolidate() → compress() → optimize()
469
+ ```
135
470
 
136
- ## Project Memory (Steering)
471
+ **主要コンポーネント**:
472
+ - `WakeSleepCycle`: 学習サイクル全体の制御
473
+ - `PatternLibrary`: 学習済みパターンの永続化管理
474
+ - `PatternOntologyBridge`: パターン↔オントロジー相互変換
475
+ - `N3Store`: RDF/OWLベースの知識グラフストレージ
137
476
 
138
- AI agents MUST consult these files before making decisions:
477
+ ### 7. Git-Native Knowledge System(v3.0.0 NEW!)
139
478
 
140
- | File | Content |
141
- |------|---------|
142
- | `steering/structure.ja.md` | Architecture patterns, layer structure |
143
- | `steering/tech.ja.md` | Technology stack (TypeScript, Node.js 20+) |
144
- | `steering/product.ja.md` | Product context |
145
- | `steering/rules/constitution.md` | 9 Constitutional Articles |
146
- | `steering/project.yml` | Project configuration |
479
+ サーバーレス・Git-friendlyな知識グラフシステム:
147
480
 
148
- ---
481
+ | 特徴 | 説明 |
482
+ |------|------|
483
+ | **サーバーレス** | データベース不要、JSONファイルで完結 |
484
+ | **Git-friendly** | diff/merge/PR対応、バージョン管理可能 |
485
+ | **軽量** | ゼロ依存(外部ライブラリ不要) |
486
+ | **階層型ID** | `requirement:REQ-001`、`design:DES-001` |
149
487
 
150
- ## Storage Structure
488
+ ```
489
+ .knowledge/
490
+ └── graph.json # 全エンティティ・リレーション
491
+ ```
151
492
 
152
- | Path | Content |
153
- |------|---------|
154
- | `storage/specs/` | Requirements (REQ-*), Design (DES-*), Tasks (TSK-*) |
155
- | `storage/design/` | Design documents, C4 diagrams |
156
- | `storage/traceability/` | Traceability matrices |
157
- | `storage/reviews/` | Code reviews, validations |
158
- | `storage/changes/` | Change proposals and implementations |
159
- | `storage/archive/` | Archived documents |
493
+ **主要API**:
494
+ ```typescript
495
+ import { createKnowledgeStore } from '@musubix/knowledge';
496
+
497
+ const store = createKnowledgeStore('.knowledge');
498
+
499
+ // エンティティ操作
500
+ await store.putEntity({
501
+ id: 'requirement:REQ-001',
502
+ type: 'requirement',
503
+ name: 'User Authentication',
504
+ properties: { ears: 'WHEN user logs in...' },
505
+ tags: ['security', 'auth'],
506
+ });
507
+
508
+ const req = await store.getEntity('requirement:REQ-001');
509
+
510
+ // リレーション追加
511
+ await store.addRelation({
512
+ source: 'requirement:REQ-001',
513
+ target: 'design:DES-001',
514
+ type: 'tracesTo',
515
+ properties: { confidence: 0.95 },
516
+ });
517
+
518
+ // クエリ
519
+ const entities = await store.query({ type: 'requirement', tags: ['security'] });
520
+
521
+ // グラフ走査
522
+ const related = await store.traverse('requirement:REQ-001', {
523
+ direction: 'outgoing',
524
+ relationTypes: ['tracesTo'],
525
+ maxDepth: 2,
526
+ });
527
+ ```
160
528
 
161
- ---
529
+ **関連パッケージ**:
530
+ - `@musubix/policy`: 9憲法条項の自動検証
531
+ - `@musubix/decisions`: Architecture Decision Records管理
162
532
 
163
- ## EARS Patterns
533
+ **ドキュメント**: [docs/packages/knowledge.md](docs/packages/knowledge.md)
164
534
 
165
- All requirements MUST use one of 5 EARS patterns:
535
+ ### 8. Advanced Learning Enhancement(v2.2.0 NEW!)
166
536
 
167
- | Pattern | Syntax | Example |
168
- |---------|--------|---------|
169
- | **Event-driven** | `WHEN [event], the [system] SHALL [response]` | WHEN user clicks Submit, the system SHALL validate input |
170
- | **State-driven** | `WHILE [state], the [system] SHALL [response]` | WHILE loading, the UI SHALL show spinner |
171
- | **Unwanted** | `IF [error], THEN the [system] SHALL [response]` | IF timeout occurs, THEN the system SHALL retry |
172
- | **Optional** | `WHERE [feature enabled], the [system] SHALL [response]` | WHERE 2FA enabled, the system SHALL require OTP |
173
- | **Ubiquitous** | `The [system] SHALL [requirement]` | The API SHALL authenticate all requests |
537
+ 3パッケージに高度な学習機能を追加:
174
538
 
175
- ---
539
+ #### Neural Search強化
540
+ ```typescript
541
+ import {
542
+ ContextAwareEmbedder, // コンテキスト認識埋め込み
543
+ HybridRanker, // BM25 + ベクトル類似度
544
+ EmbeddingCache, // LRU + TTL キャッシュ
545
+ createTrajectoryLogger, // 検索軌跡ロギング
546
+ } from '@nahisaho/musubix-neural-search';
176
547
 
177
- ## C4 Model Levels
548
+ const logger = createTrajectoryLogger();
549
+ logger.logBranch({ depth: 1, score: 0.85, action: 'expand' });
550
+ const parquet = logger.export('parquet');
551
+ ```
178
552
 
179
- Design documents use 4 C4 levels:
553
+ #### Library Learner強化
554
+ ```typescript
555
+ import {
556
+ SemanticChunker, // AST境界認識チャンキング
557
+ PatternVersionManager, // Git風バージョン管理
558
+ createMetricsExporter, // メトリクスエクスポート
559
+ } from '@nahisaho/musubix-library-learner';
560
+
561
+ const exporter = createMetricsExporter(library);
562
+ const markdown = exporter.export('markdown');
563
+ const summary = exporter.getSummary(); // { healthStatus: 'good' }
564
+ ```
180
565
 
181
- | Level | Name | Content |
182
- |-------|------|---------|
183
- | **1** | Context | System boundary, external actors |
184
- | **2** | Container | Deployable units, databases, APIs |
185
- | **3** | Component | Internal structure, services, repositories |
186
- | **4** | Code | Implementation details |
566
+ #### Synthesis強化
567
+ ```typescript
568
+ import {
569
+ createMetaLearningEngine, // メタ学習エンジン
570
+ createExampleAnalyzer, // 例題品質分析
571
+ createExplanationGenerator, // 説明生成
572
+ } from '@nahisaho/musubix-synthesis';
573
+
574
+ const explainer = createExplanationGenerator();
575
+ const explanation = explainer.generate(program);
576
+ const summary = explainer.summarize(program);
577
+ // "Converts to uppercase"
578
+ ```
187
579
 
188
580
  ---
189
581
 
190
- ## Development Workflow
582
+ ## 📚 学習済みベストプラクティス(v1.1.10 Updated!)
583
+
584
+ Project-07〜14の実装から学習したパターンです。
585
+
586
+ ### コードパターン
587
+
588
+ | ID | 名称 | 概要 | 信頼度 |
589
+ |----|------|------|--------|
590
+ | BP-CODE-001 | Entity Input DTO | エンティティ作成にInput DTOオブジェクトを使用 | 95% |
591
+ | BP-CODE-002 | Date-based ID Format | PREFIX-YYYYMMDD-NNN形式でIDを生成 | 90% |
592
+ | BP-CODE-003 | Value Objects | ドメイン概念にValue Objectを使用 | 90% |
593
+ | BP-CODE-004 | Function-based Value Objects | クラスではなくinterface+factory関数でVO実装 | 95% |
594
+ | BP-CODE-005 | Result Type | 失敗可能な操作にResult<T, E>を使用 | 95% |
595
+
596
+ **Function-based Value Object例**:
597
+ ```typescript
598
+ // ✅ 推奨: Interface + Factory Function
599
+ interface Price {
600
+ readonly amount: number;
601
+ readonly currency: 'JPY';
602
+ }
603
+
604
+ function createPrice(amount: number): Result<Price, ValidationError> {
605
+ if (amount < 100 || amount > 1_000_000) {
606
+ return err(new ValidationError('Price must be between 100 and 1,000,000 JPY'));
607
+ }
608
+ return ok({ amount, currency: 'JPY' });
609
+ }
610
+
611
+ // ❌ 非推奨: クラスベース(構造的型付けと相性が悪い)
612
+ class Price {
613
+ private constructor(readonly amount: number) {}
614
+ static create(amount: number): Price { ... }
615
+ }
616
+ ```
191
617
 
618
+ ### 設計パターン
619
+
620
+ | ID | 名称 | 概要 | 信頼度 |
621
+ |----|------|------|--------|
622
+ | BP-DESIGN-001 | Status Transition Map | 有効なステータス遷移をMapで定義 | 95% |
623
+ | BP-DESIGN-002 | Repository Async Pattern | 将来のDB移行に備えてasync化 | 85% |
624
+ | BP-DESIGN-003 | Service Layer with DI | リポジトリをDIしたService層 | 90% |
625
+ | BP-DESIGN-004 | Optimistic Locking | 同時編集検出のためのversion管理 | 90% |
626
+ | BP-DESIGN-005 | AuditService | データ変更の監査ログ記録 | 85% |
627
+ | BP-DESIGN-006 | Entity Counter Reset | テスト用のresetXxxCounter()関数を提供 | 95% |
628
+ | BP-DESIGN-007 | Expiry Time Logic | 有効期限をexpiresAtフィールドで明示管理 | 90% |
629
+
630
+ **Status Transition Map例**:
631
+ ```typescript
632
+ const validStatusTransitions: Record<Status, Status[]> = {
633
+ draft: ['active', 'cancelled'],
634
+ active: ['completed', 'cancelled'],
635
+ completed: [],
636
+ cancelled: [],
637
+ };
192
638
  ```
193
- 1. Read steering/ (Article VI)
194
- 2. Define requirements in EARS format (Article IV)
195
- 3. Design with C4 model
196
- 4. Write tests first - RED (Article III)
197
- 5. Implement minimum code - GREEN
198
- 6. Refactor - BLUE
199
- 7. Validate traceability (Article V)
200
- 8. Pass quality gates (Article IX)
639
+
640
+ ### テストパターン
641
+
642
+ | ID | 名称 | 概要 | 信頼度 |
643
+ |----|------|------|--------|
644
+ | BP-TEST-001 | Test Counter Reset | beforeEachでIDカウンターをリセット | 95% |
645
+ | BP-TEST-002 | Verify API Before Test | テスト前にAPIシグネチャを確認 | 80% |
646
+ | BP-TEST-003 | Vitest ESM Configuration | Vitest + TypeScript ESM構成 | 85% |
647
+ | BP-TEST-004 | Result Type Test Pattern | isOk()/isErr()で両方のケースをテスト | 95% |
648
+ | BP-TEST-005 | Status Transition Testing | 有効・無効な遷移を網羅的にテスト | 90% |
649
+
650
+ **Result Type Test例**:
651
+ ```typescript
652
+ describe('createPrice', () => {
653
+ it('should create valid price', () => {
654
+ const result = createPrice(1000);
655
+ expect(result.isOk()).toBe(true);
656
+ if (result.isOk()) {
657
+ expect(result.value.amount).toBe(1000);
658
+ }
659
+ });
660
+
661
+ it('should reject price below minimum', () => {
662
+ const result = createPrice(50);
663
+ expect(result.isErr()).toBe(true);
664
+ if (result.isErr()) {
665
+ expect(result.error.message).toContain('100');
666
+ }
667
+ });
668
+ });
669
+ ```
670
+
671
+ ### CLIでベストプラクティスを表示
672
+
673
+ ```bash
674
+ # 全ベストプラクティス表示
675
+ npx musubix learn best-practices
676
+
677
+ # カテゴリ別フィルタ
678
+ npx musubix learn best-practices --category code
679
+ npx musubix learn best-practices --category design
680
+ npx musubix learn best-practices --category test
681
+
682
+ # 高信頼度パターンのみ
683
+ npx musubix learn best-practices --high-confidence
684
+
685
+ # Markdown出力
686
+ npx musubix learn best-practices --format markdown
201
687
  ```
202
688
 
203
689
  ---
204
690
 
205
- ## Technology Stack
691
+ ## �📚 ドキュメント
206
692
 
207
- - **Language**: TypeScript
208
- - **Runtime**: Node.js >= 20.0.0
209
- - **Package Manager**: npm >= 10.0.0
210
- - **Build**: npm workspaces (monorepo)
211
- - **Test**: Vitest
212
- - **Lint**: ESLint
693
+ | ドキュメント | 説明 |
694
+ |-------------|------|
695
+ | [docs/INSTALL-GUIDE.md](docs/INSTALL-GUIDE.md) | インストールガイド |
696
+ | [docs/USER-GUIDE.md](docs/USER-GUIDE.md) | ユーザーガイド |
697
+ | [docs/API-REFERENCE.md](docs/API-REFERENCE.md) | APIリファレンス |
698
+ | [README.md](README.md) | 英語版README |
699
+ | [README.ja.md](README.ja.md) | 日本語版README |
213
700
 
214
701
  ---
215
702
 
216
- ## Quick Start
703
+ ## 🤝 AI Agent向けガイドライン
217
704
 
218
- ```bash
219
- # Initialize project
220
- npx musubix init my-project
705
+ ### コード生成時の注意点
221
706
 
222
- # Create requirements
223
- npx musubix requirements analyze feature.md
707
+ 1. **憲法条項の遵守**: 9条項を必ず確認
708
+ 2. **steering/参照**: 決定前にproject memoryを確認
709
+ 3. **EARS形式**: 要件は必ずEARS形式で記述
710
+ 4. **トレーサビリティ**: コードコメントに要件IDを記載
711
+ 5. **テスト先行**: Red-Green-Blueサイクルを遵守
712
+ 6. **モノレポ構造**: パッケージ間の依存関係に注意
224
713
 
225
- # Generate design
226
- npx musubix design generate requirements.md
714
+ ### 推奨ワークフロー
227
715
 
228
- # Break down tasks
229
- npx musubix tasks generate design.md
716
+ > **⚠️ 重要ルール**: Phase 1〜3(要件定義・設計・タスク分解)は、**レビュー結果をユーザーに表示し、修正か次ステップかを確認すること**。ユーザーから明示的な承認を得るまで次フェーズに進んではならない。
717
+ >
718
+ > **🚫 絶対禁止**: **設計(Phase 2)から直接実装(Phase 4)に進むことは禁止**。必ずタスク分解(Phase 3)を経ること。タスク分解なしでの実装開始は憲法違反とみなす。
230
719
 
231
- # Implement with Test-First
232
- npx musubix implement feature-name
720
+ ```
721
+ 【Phase 1: 要件定義】
722
+ ┌─────────────────────────────────────────────────────────────┐
723
+ │ 1. steering/ を読む │
724
+ │ 2. 要件定義書を作成(EARS形式) │
725
+ │ 3. ユーザーに提示 │
726
+ │ │
727
+ │ 4. セルフレビュー実施 │
728
+ │ - 既存実装との整合性チェック │
729
+ │ - EARS形式の検証 │
730
+ │ - 要件の網羅性・完全性確認 │
731
+ │ │
732
+ │ 5. レビュー結果を表示 │
733
+ │ ┌───────────────────────────────────────────────────────┐│
734
+ │ │ 📋 レビュー結果: ││
735
+ │ │ ✅ EARS形式: 準拠 ││
736
+ │ │ ✅ 優先度設定: 完了 ││
737
+ │ │ ⚠️ 整合性: 既存REQ-XXXと重複の可能性あり ││
738
+ │ │ ││
739
+ │ │ 👉 修正しますか?それとも次に進みますか? ││
740
+ │ │ - 「修正」→ 指摘箇所を修正して再提示 ││
741
+ │ │ - 「承認」→ Phase 2(設計)へ進む ││
742
+ │ └───────────────────────────────────────────────────────┘│
743
+ │ │
744
+ │ 6. ユーザー応答待ち │
745
+ │ - 修正指示 → 修正して3へ戻る │
746
+ │ - 承認 → Phase 2へ │
747
+ └─────────────────────────────────────────────────────────────┘
748
+
749
+ 【Phase 2: 設計】
750
+ ┌─────────────────────────────────────────────────────────────┐
751
+ │ 1. 設計書を作成(C4モデル) │
752
+ │ 2. ユーザーに提示 │
753
+ │ │
754
+ │ 3. セルフレビュー実施 │
755
+ │ - 既存実装との型・インターフェース整合性 │
756
+ │ - 要件トレーサビリティ(REQ-* → DES-*) │
757
+ │ - 設計パターン・SOLID原則の適用確認 │
758
+ │ - 後方互換性・移行パスの確認 │
759
+ │ │
760
+ │ 4. レビュー結果を表示 │
761
+ │ ┌───────────────────────────────────────────────────────┐│
762
+ │ │ 📋 レビュー結果: ││
763
+ │ │ ✅ トレーサビリティ: REQ-001→DES-001 完了 ││
764
+ │ │ ✅ 型整合性: 既存インターフェースと互換 ││
765
+ │ │ ✅ 設計パターン: Repository, Service適用 ││
766
+ │ │ ││
767
+ │ │ 👉 修正しますか?それとも次に進みますか? ││
768
+ │ │ - 「修正」→ 指摘箇所を修正して再提示 ││
769
+ │ │ - 「承認」→ Phase 3(タスク分解)へ進む ││
770
+ │ │ ⚠️ 実装への直接遷移は禁止!必ずタスク分解を経る ││
771
+ │ └───────────────────────────────────────────────────────┘│
772
+ │ │
773
+ │ 5. ユーザー応答待ち │
774
+ │ - 修正指示 → 修正して2へ戻る │
775
+ │ - 承認 → Phase 3へ(※Phase 4への直接遷移は禁止) │
776
+ └─────────────────────────────────────────────────────────────┘
777
+
778
+ 【Phase 3: タスク分解】⚠️ 必須フェーズ - スキップ禁止
779
+ ┌─────────────────────────────────────────────────────────────┐
780
+ │ 1. タスク分解書を作成(設計→実装タスク) │
781
+ │ 2. ユーザーに提示 │
782
+ │ │
783
+ │ 3. セルフレビュー実施 │
784
+ │ - 設計との対応確認(DES-* → TSK-*) │
785
+ │ - タスクサイズの適切性 │
786
+ │ - 依存関係・実行順序の妥当性 │
787
+ │ - 工数見積もりの現実性 │
788
+ │ │
789
+ │ 4. レビュー結果を表示 │
790
+ │ ┌───────────────────────────────────────────────────────┐│
791
+ │ │ 📋 レビュー結果: ││
792
+ │ │ ✅ トレーサビリティ: DES-001→TSK-001〜003 完了 ││
793
+ │ │ ✅ タスクサイズ: 各2-4時間で適切 ││
794
+ │ │ ✅ 依存関係: TSK-001→TSK-002→TSK-003 明確 ││
795
+ │ │ ││
796
+ │ │ 👉 修正しますか?それとも実装に進みますか? ││
797
+ │ │ - 「修正」→ 指摘箇所を修正して再提示 ││
798
+ │ │ - 「承認」→ Phase 4(実装)へ進む ││
799
+ │ └───────────────────────────────────────────────────────┘│
800
+ │ │
801
+ │ 5. ユーザー応答待ち │
802
+ │ - 修正指示 → 修正して2へ戻る │
803
+ │ - 承認 → Phase 4へ │
804
+ └─────────────────────────────────────────────────────────────┘
805
+
806
+ 【Phase 4: 実装】⚠️ 前提条件: Phase 3(タスク分解)の承認が必須
807
+ ┌─────────────────────────────────────────────────────────────┐
808
+ │ ⛔ 開始前チェック: │
809
+ │ □ Phase 3(タスク分解)が完了し、ユーザー承認済みか? │
810
+ │ □ TSK-* が定義されているか? │
811
+ │ → 未完了の場合、Phase 3に戻ること │
812
+ │ │
813
+ │ タスクごとに: │
814
+ │ 1. テスト作成(Red) │
815
+ │ 2. 実装(Green) │
816
+ │ 3. リファクタリング(Blue) │
817
+ │ 4. ユニットテスト実行・合格確認 │
818
+ │ 5. 必要に応じて統合テスト │
819
+ └─────────────────────────────────────────────────────────────┘
820
+
821
+ 【Phase 5: 完了】
822
+ ┌─────────────────────────────────────────────────────────────┐
823
+ │ 1. CHANGELOG.md を更新 │
824
+ │ 2. 必要に応じてその他ドキュメント更新 │
825
+ │ 3. Git コミット・プッシュ │
826
+ └─────────────────────────────────────────────────────────────┘
827
+ ```
233
828
 
234
- # Validate
235
- npx musubix validate feature-name
829
+ ### レビュー結果の表示フォーマット
830
+
831
+ 各フェーズ終了時に以下の形式でレビュー結果を表示:
832
+
833
+ ```
834
+ 📋 **レビュー結果**
835
+
836
+ | 観点 | 状態 | 詳細 |
837
+ |------|------|------|
838
+ | チェック項目1 | ✅ OK | 説明 |
839
+ | チェック項目2 | ⚠️ 警告 | 要確認事項 |
840
+ | チェック項目3 | ❌ NG | 修正が必要 |
841
+
842
+ 👉 **次のアクションを選択してください:**
843
+ - 「修正」/ 具体的な修正指示 → 修正して再提示
844
+ - 「承認」/「OK」/「進める」 → 次フェーズへ
236
845
  ```
237
846
 
847
+ ### 承認キーワード
848
+
849
+ ユーザーが以下のキーワードを使用した場合、次フェーズへ進む:
850
+ - `承認` / `approve` / `LGTM` / `進める` / `OK` / `実装`
851
+
852
+ > **⚠️ 注意**: 「実装」キーワードが使われても、**現在のフェーズがPhase 2(設計)の場合は、必ずPhase 3(タスク分解)を先に実行すること**。タスク分解をスキップして実装に進むことは禁止されている。
853
+
238
854
  ---
239
855
 
240
856
  **Agent**: GitHub Copilot / Claude
241
- **Last Updated**: 2026-01-02
242
- **Version**: 1.0.0
243
- **Repository**: https://github.com/nahisaho/MUSUBIX
857
+ **Last Updated**: 2026-01-11
858
+ **Version**: 3.0.0