musubix 1.3.1 → 1.4.2

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/AGENTS.md CHANGED
@@ -8,13 +8,13 @@
8
8
 
9
9
  | 項目 | 詳細 |
10
10
  |------|------|
11
- | **バージョン** | 1.3.0 |
11
+ | **バージョン** | 1.4.1 |
12
12
  | **言語** | TypeScript |
13
13
  | **ランタイム** | Node.js >= 20.0.0 |
14
14
  | **パッケージマネージャ** | npm >= 10.0.0 |
15
15
  | **ビルドシステム** | モノレポ(npm workspaces) |
16
16
  | **テストフレームワーク** | Vitest |
17
- | **テスト数** | 752 (全合格) |
17
+ | **テスト数** | 800 (全合格) |
18
18
  | **コンポーネント数** | 243 (62ドメイン対応) |
19
19
  | **Agent Skills** | 12 (Claude Code対応) |
20
20
 
@@ -38,7 +38,7 @@ packages/
38
38
  | パッケージ | npm | 役割 |
39
39
  |-----------|-----|------|
40
40
  | `packages/core/` | `@nahisaho/musubix-core` | コアライブラリ - CLI、EARS検証、コード生成、設計パターン |
41
- | `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 16ツール、3プロンプト |
41
+ | `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 19ツール、3プロンプト |
42
42
  | `packages/yata-client/` | `@nahisaho/musubix-yata-client` | YATAクライアント - 知識グラフ連携 |
43
43
  | `packages/pattern-mcp/` | `@nahisaho/musubix-pattern-mcp` | パターン学習 - 抽出・圧縮・ライブラリ |
44
44
  | `packages/ontology-mcp/` | `@nahisaho/musubix-ontology-mcp` | オントロジー - N3Store・推論エンジン |
@@ -112,7 +112,14 @@ npx musubix learn remove-pattern <id> # パターン削除
112
112
  npx musubix learn recommend # コンテキストベースの推奨
113
113
  npx musubix learn decay # 未使用パターンの減衰
114
114
  npx musubix learn export # 学習データエクスポート
115
+ # オプション: --output <file>, --privacy-filter, --patterns-only, --feedback-only, --min-confidence <n>
115
116
  npx musubix learn import <file> # 学習データインポート
117
+ # オプション: --merge-strategy <skip|overwrite|merge>, --dry-run, --patterns-only, --feedback-only
118
+
119
+ # オントロジー操作 (v1.4.1 NEW!)
120
+ npx musubix ontology validate -f <file> # 知識グラフ整合性検証
121
+ npx musubix ontology check-circular -f <file> # 循環依存チェック
122
+ npx musubix ontology stats -f <file> # 統計表示
116
123
 
117
124
  # ヘルプ
118
125
  npx musubix --help
@@ -130,7 +137,7 @@ npx @nahisaho/musubix-mcp-server
130
137
  npx musubix-mcp --transport stdio
131
138
  ```
132
139
 
133
- ### ツール一覧(16ツール)
140
+ ### ツール一覧(19ツール)
134
141
 
135
142
  #### SDD基本ツール(9ツール)
136
143
 
@@ -158,6 +165,14 @@ npx musubix-mcp --transport stdio
158
165
  | `ontology_query` | オントロジーグラフへのクエリ |
159
166
  | `ontology_infer` | オントロジーによる推論実行 |
160
167
 
168
+ #### オントロジー検証ツール(3ツール)- v1.4.1 NEW!
169
+
170
+ | ツール名 | 説明 |
171
+ |---------|------|
172
+ | `consistency_validate` | 知識グラフの整合性検証 |
173
+ | `validate_triple` | 単一トリプルの事前検証 |
174
+ | `check_circular` | 循環依存の検出 |
175
+
161
176
  ### プロンプト一覧(3プロンプト)
162
177
 
163
178
  | プロンプト名 | 説明 |
@@ -467,6 +482,6 @@ npx musubix learn best-practices --format markdown
467
482
  ---
468
483
 
469
484
  **Agent**: GitHub Copilot / Claude
470
- **Last Updated**: 2025-01-10
471
- **Version**: 1.3.0
485
+ **Last Updated**: 2025-01-05
486
+ **Version**: 1.4.1
472
487
  **Repository**: https://github.com/nahisaho/MUSUBIX
package/README.ja.md CHANGED
@@ -6,11 +6,11 @@
6
6
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
7
7
  [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)](https://www.typescriptlang.org/)
9
- [![Tests](https://img.shields.io/badge/tests-752%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
9
+ [![Tests](https://img.shields.io/badge/tests-775%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
10
10
 
11
11
  > MUSUBI × YATA 統合による次世代AIコーディングシステム
12
12
  >
13
- > **v1.3.0** - Wake-Sleep学習サイクル統合完了(S1-S3スプリント)
13
+ > **v1.4.1** - 正誤性検証&OWL制約チェック
14
14
 
15
15
  ## 概要
16
16
 
package/README.md CHANGED
@@ -7,11 +7,11 @@
7
7
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
8
8
  [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)](https://www.typescriptlang.org/)
10
- [![Tests](https://img.shields.io/badge/tests-752%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
10
+ [![Tests](https://img.shields.io/badge/tests-775%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
11
11
 
12
12
  > Next-generation AI Coding System powered by MUSUBI × YATA Integration
13
13
  >
14
- > **v1.3.0** - Wake-Sleep Learning Cycle Integration Complete (S1-S3 Sprint)
14
+ > **v1.4.1** - Consistency Validation & OWL Constraint Checking
15
15
 
16
16
  **[日本語版 README](README.ja.md)**
17
17
 
@@ -1,7 +1,7 @@
1
1
  # MUSUBIX インストールガイド
2
2
 
3
3
  **文書ID**: INSTALL-GUIDE
4
- **バージョン**: 1.3.0
4
+ **バージョン**: 1.4.1
5
5
  **最終更新**: 2026-01-05
6
6
 
7
7
  ---
@@ -1,7 +1,7 @@
1
1
  # MUSUBIX Installation Guide
2
2
 
3
3
  **Document ID**: INSTALL-GUIDE
4
- **Version**: 1.3.0
4
+ **Version**: 1.4.1
5
5
  **Last Updated**: 2026-01-05
6
6
 
7
7
  ---
@@ -0,0 +1,112 @@
1
+ # MUSUBIX v1.5.0 Roadmap
2
+
3
+ ## Release Target: 2026-Q1
4
+
5
+ ## 🎯 Major Features
6
+
7
+ ### 1. Real-time Pattern Learning (REQ-LEARN-010)
8
+ **Priority: P0**
9
+
10
+ 現在のバッチ学習からリアルタイム学習への進化。
11
+
12
+ | 機能 | 説明 |
13
+ |------|------|
14
+ | Stream Processing | コード変更のストリーム処理 |
15
+ | Incremental Learning | 差分学習による効率化 |
16
+ | Online Feedback | リアルタイムフィードバック反映 |
17
+
18
+ ### 2. Pattern Sharing (REQ-SHARE-001)
19
+ **Priority: P1**
20
+
21
+ チーム間でパターンを共有する機能。
22
+
23
+ | 機能 | 説明 |
24
+ |------|------|
25
+ | Pattern Export/Import | 標準フォーマットでのエクスポート |
26
+ | Pattern Repository | 共有リポジトリ連携 |
27
+ | Conflict Resolution | パターン競合の解決 |
28
+
29
+ ### 3. Advanced Inference (REQ-ONTO-010)
30
+ **Priority: P1**
31
+
32
+ オントロジー推論の高度化。
33
+
34
+ | 機能 | 説明 |
35
+ |------|------|
36
+ | OWL 2 RL Support | OWL 2 RLプロファイル対応 |
37
+ | Datalog Integration | Datalogルールエンジン統合 |
38
+ | Explanation Generation | 推論過程の説明生成 |
39
+
40
+ ### 4. Interactive CLI Mode (REQ-CLI-010)
41
+ **Priority: P2**
42
+
43
+ 対話的なCLI操作モード。
44
+
45
+ | 機能 | 説明 |
46
+ |------|------|
47
+ | REPL Mode | 対話的シェル |
48
+ | Auto-completion | コマンド補完 |
49
+ | History | コマンド履歴 |
50
+
51
+ ### 5. Performance Optimization (REQ-PERF-001)
52
+ **Priority: P2**
53
+
54
+ 大規模プロジェクトでのパフォーマンス改善。
55
+
56
+ | 機能 | 説明 |
57
+ |------|------|
58
+ | Lazy Loading | 遅延読み込み |
59
+ | Cache Layer | キャッシュ層追加 |
60
+ | Parallel Processing | 並列処理強化 |
61
+
62
+ ---
63
+
64
+ ## 📊 Current Status (v1.4.1)
65
+
66
+ | メトリクス | 値 |
67
+ |-----------|-----|
68
+ | テスト数 | 815 |
69
+ | パッケージ数 | 8 |
70
+ | MCPツール | 19 |
71
+ | カバレッジ (lines) | 25% |
72
+
73
+ ---
74
+
75
+ ## 📅 Implementation Schedule
76
+
77
+ ### Phase 1: Foundation (Week 1-2)
78
+ - [ ] Real-time Learning基盤設計
79
+ - [ ] Pattern Sharing API設計
80
+ - [ ] テストカバレッジ向上 (25% → 40%)
81
+
82
+ ### Phase 2: Core Features (Week 3-4)
83
+ - [ ] Real-time Pattern Learning実装
84
+ - [ ] Pattern Export/Import拡張
85
+ - [ ] OWL 2 RL基本サポート
86
+
87
+ ### Phase 3: Integration (Week 5-6)
88
+ - [ ] Pattern Repository連携
89
+ - [ ] Interactive CLI Mode
90
+ - [ ] Performance Optimization
91
+
92
+ ### Phase 4: Stabilization (Week 7-8)
93
+ - [ ] E2Eテスト追加
94
+ - [ ] ドキュメント更新
95
+ - [ ] リリース準備
96
+
97
+ ---
98
+
99
+ ## 🔗 Dependencies
100
+
101
+ - Node.js >= 20.0.0
102
+ - TypeScript 5.x
103
+ - N3.js (RDF handling)
104
+ - tree-sitter (AST parsing)
105
+
106
+ ---
107
+
108
+ ## 📝 Notes
109
+
110
+ - v1.4.xはバグ修正のみ
111
+ - 破壊的変更なし (後方互換性維持)
112
+ - 新機能はオプトイン形式
@@ -16,8 +16,9 @@
16
16
  10. [自己学習システム](#自己学習システム)
17
17
  11. [C4コード生成](#c4コード生成)
18
18
  12. [シンボリック推論](#シンボリック推論) *(v1.2.0)*
19
- 13. [MCPサーバー連携](#mcpサーバー連携)
20
- 14. [YATA知識グラフ](#yata知識グラフ)
19
+ 13. [正誤性検証](#正誤性検証) *(v1.4.1)*
20
+ 14. [MCPサーバー連携](#mcpサーバー連携)
21
+ 15. [YATA知識グラフ](#yata知識グラフ)
21
22
  15. [ベストプラクティス](#ベストプラクティス)
22
23
  16. [トラブルシューティング](#トラブルシューティング)
23
24
 
@@ -538,11 +539,21 @@ musubix learn recommend --artifact-type code
538
539
  # 未使用パターンの減衰を適用
539
540
  musubix learn decay
540
541
 
541
- # 学習データをエクスポート
542
+ # 学習データをエクスポート(v1.4.0 拡張)
542
543
  musubix learn export --output learning-data.json
544
+ # オプション:
545
+ # --privacy-filter 機密情報を除去(APIキー、パスワード等)
546
+ # --patterns-only パターンのみエクスポート
547
+ # --feedback-only フィードバックのみエクスポート
548
+ # --min-confidence <n> 最小信頼度(0-1)
543
549
 
544
- # 学習データをインポート
550
+ # 学習データをインポート(v1.4.0 マージ戦略対応)
545
551
  musubix learn import learning-data.json
552
+ # オプション:
553
+ # --merge-strategy <skip|overwrite|merge> 重複の処理方法
554
+ # --dry-run 変更をプレビュー
555
+ # --patterns-only パターンのみインポート
556
+ # --feedback-only フィードバックのみインポート
546
557
  ```
547
558
 
548
559
  ### プログラムからの使用
@@ -742,6 +753,93 @@ console.log('ゲート詳細:', gateResult.gates);
742
753
 
743
754
  ---
744
755
 
756
+ ## 正誤性検証
757
+
758
+ *(v1.4.1 新機能)*
759
+
760
+ ### 概要
761
+
762
+ 正誤性検証は、知識グラフへのトリプル追加時にデータの整合性を確保します。OWL制約に基づいて違反を検出し、不正なデータの登録を防止します。
763
+
764
+ ### 検証タイプ
765
+
766
+ | タイプ | 説明 | 重大度 |
767
+ |--------|------|--------|
768
+ | `disjoint-class-membership` | 排他的クラスの両方に所属 | error |
769
+ | `functional-property-violation` | 関数型プロパティに複数値 | error |
770
+ | `inverse-functional-violation` | 同じ値が複数の主語にマップ | error |
771
+ | `asymmetric-violation` | 非対称プロパティに逆方向が存在 | error |
772
+ | `irreflexive-violation` | 非反射プロパティで自己参照 | error |
773
+ | `duplicate-triple` | 完全一致の重複トリプル | warning |
774
+ | `circular-dependency` | subClassOfの循環チェーン | error |
775
+
776
+ ### 使用方法
777
+
778
+ #### 検証付きトリプル追加
779
+
780
+ ```typescript
781
+ import { N3Store } from '@nahisaho/musubix-ontology-mcp';
782
+
783
+ // 追加時検証を有効化
784
+ const store = new N3Store({}, true);
785
+
786
+ // 検証付き追加
787
+ const result = store.addTripleValidated({
788
+ subject: 'http://example.org/Person1',
789
+ predicate: 'http://example.org/hasMother',
790
+ object: 'http://example.org/Mother1'
791
+ });
792
+
793
+ if (!result.success) {
794
+ console.error('検証エラー:', result.validation.errors);
795
+ }
796
+ ```
797
+
798
+ #### ストア全体の整合性チェック
799
+
800
+ ```typescript
801
+ // ストア全体をチェック
802
+ const consistency = store.checkConsistency();
803
+
804
+ if (!consistency.consistent) {
805
+ for (const violation of consistency.violations) {
806
+ console.log(`${violation.type}: ${violation.message}`);
807
+ console.log('関連トリプル:', violation.triples);
808
+ }
809
+
810
+ // 修正提案を取得
811
+ for (const suggestion of consistency.suggestions) {
812
+ console.log(`提案: ${suggestion.suggestion}`);
813
+ console.log(`自動修正可能: ${suggestion.autoFixable}`);
814
+ }
815
+ }
816
+ ```
817
+
818
+ #### 直接バリデータを使用
819
+
820
+ ```typescript
821
+ import { ConsistencyValidator } from '@nahisaho/musubix-ontology-mcp';
822
+
823
+ const validator = new ConsistencyValidator({
824
+ checkDisjointClasses: true,
825
+ checkFunctionalProperties: true,
826
+ checkDuplicates: true,
827
+ checkCircularDependencies: true
828
+ });
829
+
830
+ // 追加前に検証
831
+ const validation = validator.validateTriple(newTriple, existingTriples);
832
+ if (!validation.valid) {
833
+ console.error(validation.errors);
834
+ }
835
+
836
+ // 重複を検出
837
+ const duplicates = validator.findDuplicates(allTriples);
838
+ const semanticDuplicates = validator.findSemanticDuplicates(allTriples);
839
+ ```
840
+
841
+ ---
842
+
745
843
  ## MCPサーバー連携
746
844
 
747
845
  ### MCPサーバーの起動
@@ -14,10 +14,11 @@
14
14
  6. [Self-Learning System](#self-learning-system)
15
15
  7. [C4 Code Generation](#c4-code-generation)
16
16
  8. [Symbolic Reasoning](#symbolic-reasoning) *(v1.2.0)*
17
- 9. [MCP Server Integration](#mcp-server-integration)
18
- 10. [YATA Integration](#yata-integration)
19
- 11. [Best Practices](#best-practices)
20
- 12. [Troubleshooting](#troubleshooting)
17
+ 9. [Consistency Validation](#consistency-validation) *(v1.4.1)*
18
+ 10. [MCP Server Integration](#mcp-server-integration)
19
+ 11. [YATA Integration](#yata-integration)
20
+ 12. [Best Practices](#best-practices)
21
+ 13. [Troubleshooting](#troubleshooting)
21
22
 
22
23
  ---
23
24
 
@@ -406,11 +407,21 @@ musubix learn recommend --artifact-type code
406
407
  # Apply decay to unused patterns
407
408
  musubix learn decay
408
409
 
409
- # Export learning data
410
+ # Export learning data (v1.4.0 enhanced)
410
411
  musubix learn export --output learning-data.json
412
+ # Options:
413
+ # --privacy-filter Remove sensitive data (API keys, passwords)
414
+ # --patterns-only Export patterns only (exclude feedback)
415
+ # --feedback-only Export feedback only (exclude patterns)
416
+ # --min-confidence <n> Minimum confidence threshold (0-1)
411
417
 
412
- # Import learning data
418
+ # Import learning data with merge strategy (v1.4.0 enhanced)
413
419
  musubix learn import learning-data.json
420
+ # Options:
421
+ # --merge-strategy <skip|overwrite|merge> How to handle duplicates
422
+ # --dry-run Preview without applying
423
+ # --patterns-only Import patterns only
424
+ # --feedback-only Import feedback only
414
425
  ```
415
426
 
416
427
  ### Programmatic Usage
@@ -702,6 +713,93 @@ console.log('Gate details:', gateResult.gates);
702
713
 
703
714
  ---
704
715
 
716
+ ## Consistency Validation
717
+
718
+ *(v1.4.1 New Feature)*
719
+
720
+ ### Overview
721
+
722
+ Consistency validation ensures data integrity when adding triples to the knowledge graph. Based on OWL constraints, it detects violations before they corrupt the knowledge base.
723
+
724
+ ### Validation Types
725
+
726
+ | Type | Description | Severity |
727
+ |------|-------------|----------|
728
+ | `disjoint-class-membership` | Instance belongs to disjoint classes | error |
729
+ | `functional-property-violation` | Multiple values for functional property | error |
730
+ | `inverse-functional-violation` | Same value maps to multiple subjects | error |
731
+ | `asymmetric-violation` | Inverse relation exists for asymmetric property | error |
732
+ | `irreflexive-violation` | Self-reference for irreflexive property | error |
733
+ | `duplicate-triple` | Exact duplicate triple | warning |
734
+ | `circular-dependency` | Circular subClassOf chain | error |
735
+
736
+ ### Usage
737
+
738
+ #### Validated Triple Addition
739
+
740
+ ```typescript
741
+ import { N3Store } from '@nahisaho/musubix-ontology-mcp';
742
+
743
+ // Enable validation on add
744
+ const store = new N3Store({}, true);
745
+
746
+ // Add with validation
747
+ const result = store.addTripleValidated({
748
+ subject: 'http://example.org/Person1',
749
+ predicate: 'http://example.org/hasMother',
750
+ object: 'http://example.org/Mother1'
751
+ });
752
+
753
+ if (!result.success) {
754
+ console.error('Validation errors:', result.validation.errors);
755
+ }
756
+ ```
757
+
758
+ #### Store-wide Consistency Check
759
+
760
+ ```typescript
761
+ // Check entire store
762
+ const consistency = store.checkConsistency();
763
+
764
+ if (!consistency.consistent) {
765
+ for (const violation of consistency.violations) {
766
+ console.log(`${violation.type}: ${violation.message}`);
767
+ console.log('Affected triples:', violation.triples);
768
+ }
769
+
770
+ // Get fix suggestions
771
+ for (const suggestion of consistency.suggestions) {
772
+ console.log(`Suggestion: ${suggestion.suggestion}`);
773
+ console.log(`Auto-fixable: ${suggestion.autoFixable}`);
774
+ }
775
+ }
776
+ ```
777
+
778
+ #### Direct Validator Usage
779
+
780
+ ```typescript
781
+ import { ConsistencyValidator } from '@nahisaho/musubix-ontology-mcp';
782
+
783
+ const validator = new ConsistencyValidator({
784
+ checkDisjointClasses: true,
785
+ checkFunctionalProperties: true,
786
+ checkDuplicates: true,
787
+ checkCircularDependencies: true
788
+ });
789
+
790
+ // Validate before adding
791
+ const validation = validator.validateTriple(newTriple, existingTriples);
792
+ if (!validation.valid) {
793
+ console.error(validation.errors);
794
+ }
795
+
796
+ // Find duplicates
797
+ const duplicates = validator.findDuplicates(allTriples);
798
+ const semanticDuplicates = validator.findSemanticDuplicates(allTriples);
799
+ ```
800
+
801
+ ---
802
+
705
803
  ## YATA Integration
706
804
 
707
805
  ### What is YATA?
@@ -21,7 +21,7 @@ AIコーディング支援ツールは急速に進化しています。本記事
21
21
 
22
22
  # TL;DR
23
23
 
24
- > **最新バージョン**: v1.3.0 | **62ドメイン対応** | **243コンポーネント** | **752テスト** | **17ベストプラクティス**
24
+ > **最新バージョン**: v1.4.1 | **62ドメイン対応** | **243コンポーネント** | **775テスト** | **17ベストプラクティス**
25
25
 
26
26
  | 項目 | MUSUBI | MUSUBIX |
27
27
  |------|--------|---------|
@@ -32,6 +32,8 @@ AIコーディング支援ツールは急速に進化しています。本記事
32
32
  | **統合対象** | 7つのAIエージェント | MUSUBI + YATA + 7エージェント |
33
33
  | **ドメイン** | 汎用 | 62専門ドメイン対応 |
34
34
  | **自己学習** | なし | フィードバックベースの適応学習 |
35
+ | **知識共有** | なし | **プロジェクト間ポータビリティ**(v1.4.0) |
36
+ | **正誤性検証** | なし | **OWL制約チェック**(v1.4.1) |
35
37
 
36
38
  # 1. MUSUBIとは?
37
39
 
@@ -1097,6 +1099,160 @@ class UserRepository {
1097
1099
  // 推奨メソッド: findAll(), delete(), exists()」
1098
1100
  ```
1099
1101
 
1102
+ ## 4.8 学習データのポータビリティ(v1.4.0)
1103
+
1104
+ v1.4.0では、**プロジェクト間で学習データを共有・移行**するためのCLI機能を追加しました。これにより、あるプロジェクトで蓄積したパターンや知見を、新しいプロジェクトで即座に活用できます。
1105
+
1106
+ ### なぜポータビリティが必要か?
1107
+
1108
+ 従来の課題:
1109
+ - 各プロジェクトで一から学習をやり直す必要があった
1110
+ - チーム間で知見の共有が困難だった
1111
+ - 機密情報を含むデータの共有にセキュリティリスクがあった
1112
+
1113
+ v1.4.0での解決:
1114
+ - **エクスポート/インポート**: CLI一発で学習データを移行
1115
+ - **プライバシーフィルター**: API Key、パスワード等を自動除去
1116
+ - **マージ戦略**: 既存データとの統合方法を選択可能
1117
+
1118
+ ### CLIコマンド
1119
+
1120
+ ```bash
1121
+ # エクスポート(機密情報除去、高信頼度パターンのみ)
1122
+ npx musubix learn export \
1123
+ --output team-patterns.json \
1124
+ --privacy-filter \
1125
+ --patterns-only \
1126
+ --min-confidence 0.8
1127
+
1128
+ # インポート(マージ戦略指定、ドライラン)
1129
+ npx musubix learn import team-patterns.json \
1130
+ --merge-strategy merge \
1131
+ --dry-run
1132
+ ```
1133
+
1134
+ ### マージ戦略
1135
+
1136
+ | 戦略 | 動作 | ユースケース |
1137
+ |------|------|-------------|
1138
+ | **skip** | 既存を保持、重複をスキップ | 既存の学習を壊したくない場合 |
1139
+ | **overwrite** | インポートデータで上書き | 最新データで完全更新する場合 |
1140
+ | **merge** | 出現回数を合計、信頼度は最大値 | チームの知見を統合する場合 |
1141
+
1142
+ ### プライバシーフィルター
1143
+
1144
+ 以下のパターンを自動検出して`[REDACTED]`に置換:
1145
+
1146
+ ```typescript
1147
+ // 検出対象
1148
+ const PRIVACY_PATTERNS = [
1149
+ /api[_-]?key/i, // API_KEY, api-key
1150
+ /secret/i, // SECRET, secret
1151
+ /password/i, // PASSWORD, password
1152
+ /token/i, // TOKEN, token
1153
+ /credential/i, // CREDENTIAL
1154
+ /private[_-]?key/i, // PRIVATE_KEY
1155
+ /bearer/i, // Bearer token
1156
+ /jwt/i, // JWT
1157
+ ];
1158
+
1159
+ // 32文字以上の英数字文字列も除去
1160
+ // 例: "sk-proj-abc123..." → "[REDACTED]"
1161
+ ```
1162
+
1163
+ ### 活用シナリオ
1164
+
1165
+ ```
1166
+ プロジェクトA(成熟) プロジェクトB(新規)
1167
+ ┌──────────────────┐ ┌──────────────────┐
1168
+ │ 学習済みパターン │ │ 初期状態 │
1169
+ │ - Repository │ export │ │
1170
+ │ - Service Layer │ ────────→ │ │
1171
+ │ - Value Object │ import │ 学習済みパターン │
1172
+ │ 信頼度: 90%+ │ │ 即座に活用可能! │
1173
+ └──────────────────┘ └──────────────────┘
1174
+ ```
1175
+
1176
+ ## 4.9 正誤性検証(v1.4.1)
1177
+
1178
+ v1.4.1では、**知識グラフへのデータ登録時の正誤性検証**機能を追加しました。OWL制約に基づく一貫性チェックにより、不正なデータの登録を防止します。
1179
+
1180
+ ### なぜ正誤性検証が必要か?
1181
+
1182
+ 従来の課題:
1183
+ - 不正なトリプルがそのまま登録されてしまう
1184
+ - 重複データの蓄積
1185
+ - OWL制約違反(関数型プロパティに複数値など)の検出ができない
1186
+
1187
+ v1.4.1での解決:
1188
+ - **ConsistencyValidator**: OWL制約に基づく7種類の検証
1189
+ - **事前検証**: `addTripleValidated()`でエラーを未然に防止
1190
+ - **一括検証**: `checkConsistency()`でストア全体をチェック
1191
+
1192
+ ### 検証タイプ
1193
+
1194
+ | タイプ | 説明 | 重大度 |
1195
+ |--------|------|--------|
1196
+ | `disjoint-class-membership` | owl:disjointWith違反 | error |
1197
+ | `functional-property-violation` | owl:FunctionalProperty違反(複数値) | error |
1198
+ | `inverse-functional-violation` | owl:InverseFunctionalProperty違反 | error |
1199
+ | `asymmetric-violation` | owl:AsymmetricProperty違反(逆方向存在) | error |
1200
+ | `irreflexive-violation` | owl:IrreflexiveProperty違反(自己参照) | error |
1201
+ | `duplicate-triple` | 完全一致の重複トリプル | warning |
1202
+ | `circular-dependency` | subClassOf等の循環依存 | error |
1203
+
1204
+ ### 使用例
1205
+
1206
+ ```typescript
1207
+ import { N3Store } from '@nahisaho/musubix-ontology-mcp';
1208
+
1209
+ // 検証付きストア(validateOnAdd = true)
1210
+ const store = new N3Store({}, true);
1211
+
1212
+ // 検証付き追加
1213
+ const result = store.addTripleValidated({
1214
+ subject: 'http://example.org/Person1',
1215
+ predicate: 'http://example.org/hasMother',
1216
+ object: 'http://example.org/Mother1'
1217
+ });
1218
+
1219
+ if (!result.success) {
1220
+ console.error('Validation errors:', result.validation.errors);
1221
+ }
1222
+
1223
+ // ストア全体の整合性チェック
1224
+ const consistency = store.checkConsistency();
1225
+ if (!consistency.consistent) {
1226
+ for (const v of consistency.violations) {
1227
+ console.log(`${v.type}: ${v.message}`);
1228
+ }
1229
+ }
1230
+ ```
1231
+
1232
+ ### 検証フロー
1233
+
1234
+ ```
1235
+ トリプル追加要求
1236
+
1237
+
1238
+ ┌─────────────────┐
1239
+ │ validateTriple()│ ← 事前検証
1240
+ └────────┬────────┘
1241
+
1242
+ ┌────┴────┐
1243
+ │ valid? │
1244
+ └────┬────┘
1245
+ No │ Yes
1246
+ │ │
1247
+ ▼ ▼
1248
+ 拒否 追加
1249
+
1250
+
1251
+ ┌──────────────┐
1252
+ │ 推論適用 │
1253
+ └──────────────┘
1254
+ ```
1255
+
1100
1256
  # 5. 9つの憲法条項
1101
1257
 
1102
1258
  MUSUBIXは、MUSUBIから継承した **9つの憲法条項(Constitutional Articles)** を遵守します。これらは開発プロセス全体を統治する不変の原則であり、AIコーディングエージェントが従うべきガバナンスフレームワークです。
@@ -1287,6 +1443,10 @@ npx musubix-mcp
1287
1443
  | @nahisaho/musubix-core | `npm install @nahisaho/musubix-core` | コアライブラリ |
1288
1444
  | @nahisaho/musubix-mcp-server | `npm install @nahisaho/musubix-mcp-server` | MCPサーバー |
1289
1445
  | @nahisaho/musubix-yata-client | `npm install @nahisaho/musubix-yata-client` | YATAクライアント |
1446
+ | @nahisaho/musubix-pattern-mcp | `npm install @nahisaho/musubix-pattern-mcp` | パターン抽出・圧縮・ライブラリ |
1447
+ | @nahisaho/musubix-ontology-mcp | `npm install @nahisaho/musubix-ontology-mcp` | N3Store・RDF推論エンジン |
1448
+ | @nahisaho/musubix-wake-sleep | `npm install @nahisaho/musubix-wake-sleep` | Wake-Sleep学習サイクル |
1449
+ | @nahisaho/musubix-sdd-ontology | `npm install @nahisaho/musubix-sdd-ontology` | SDD方法論オントロジー |
1290
1450
 
1291
1451
  ## 8.3 利用方法の選択
1292
1452
 
@@ -1375,7 +1535,7 @@ MUSUBIXのEARS形式で要件を書いてください
1375
1535
 
1376
1536
  ## 8.5 方法2: MCP経由(MCPサーバー連携)
1377
1537
 
1378
- MCP(Model Context Protocol)を使用すると、**9つの専用ツール**と**3つのプロンプト**を利用でき、より高度な機能(知識グラフクエリ、トレーサビリティ検証等)が使えます。
1538
+ MCP(Model Context Protocol)を使用すると、**16の専用ツール**(SDD基本9 + パターン統合7)と**3つのプロンプト**を利用でき、より高度な機能(知識グラフクエリ、トレーサビリティ検証、パターン学習等)が使えます。
1379
1539
 
1380
1540
  ### Claude Code(CLI)
1381
1541
 
@@ -1415,7 +1575,9 @@ claude mcp list
1415
1575
  }
1416
1576
  ```
1417
1577
 
1418
- ### 利用可能なMCPツール(9ツール)
1578
+ ### 利用可能なMCPツール(16ツール)
1579
+
1580
+ #### SDD基本ツール(9ツール)
1419
1581
 
1420
1582
  | ツール名 | 説明 |
1421
1583
  |---------|------|
@@ -1429,6 +1591,18 @@ claude mcp list
1429
1591
  | `sdd_validate_constitution` | 9憲法条項への準拠検証 |
1430
1592
  | `sdd_validate_traceability` | 要件↔設計↔タスクのトレーサビリティ検証 |
1431
1593
 
1594
+ #### パターン統合ツール(7ツール)- v1.3.0 NEW!
1595
+
1596
+ | ツール名 | 説明 |
1597
+ |---------|------|
1598
+ | `pattern_extract` | コードからパターンを抽出 |
1599
+ | `pattern_compress` | パターンの抽象化・圧縮 |
1600
+ | `pattern_store` | パターンライブラリへの保存 |
1601
+ | `pattern_query` | パターンの検索・取得 |
1602
+ | `pattern_consolidate` | 類似パターンの統合 |
1603
+ | `ontology_query` | オントロジーグラフへのクエリ |
1604
+ | `ontology_infer` | オントロジーによる推論実行 |
1605
+
1432
1606
  ### メリット
1433
1607
 
1434
1608
  - ✅ **高度な機能**: 知識グラフ連携、矛盾検出
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "musubix",
3
- "version": "1.3.1",
3
+ "version": "1.4.2",
4
4
  "description": "Neuro-Symbolic AI Coding System - MUSUBI × YATA Integration",
5
5
  "type": "module",
6
6
  "workspaces": [
7
7
  "packages/*"
8
8
  ],
9
9
  "bin": {
10
- "musubix": "./bin/musubix.js",
11
- "musubix-mcp": "./bin/musubix-mcp.js"
10
+ "musubix": "bin/musubix.js",
11
+ "musubix-mcp": "bin/musubix-mcp.js"
12
12
  },
13
13
  "files": [
14
14
  "bin/",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",
40
- "url": "https://github.com/nahisaho/MUSUBIX.git"
40
+ "url": "git+https://github.com/nahisaho/MUSUBIX.git"
41
41
  },
42
42
  "keywords": [
43
43
  "ai",
@@ -56,6 +56,7 @@
56
56
  "@types/node": "^20.10.0",
57
57
  "@typescript-eslint/eslint-plugin": "^6.13.0",
58
58
  "@typescript-eslint/parser": "^6.13.0",
59
+ "@vitest/coverage-v8": "^4.0.16",
59
60
  "eslint": "^8.55.0",
60
61
  "typescript": "^5.3.0",
61
62
  "vitest": "^4.0.16"
@@ -65,10 +66,10 @@
65
66
  "@nahisaho/musubi": "^1.3.0",
66
67
  "@nahisaho/musubix-core": "^1.3.0",
67
68
  "@nahisaho/musubix-mcp-server": "^1.3.0",
68
- "@nahisaho/musubix-yata-client": "^1.3.0",
69
- "@nahisaho/musubix-pattern-mcp": "^1.0.0",
70
69
  "@nahisaho/musubix-ontology-mcp": "^1.0.0",
70
+ "@nahisaho/musubix-pattern-mcp": "^1.0.0",
71
+ "@nahisaho/musubix-sdd-ontology": "^1.0.0",
71
72
  "@nahisaho/musubix-wake-sleep": "^1.0.0",
72
- "@nahisaho/musubix-sdd-ontology": "^1.0.0"
73
+ "@nahisaho/musubix-yata-client": "^1.3.0"
73
74
  }
74
75
  }