musubix 1.8.5 → 2.0.1

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,14 +8,14 @@
8
8
 
9
9
  | 項目 | 詳細 |
10
10
  |------|------|
11
- | **バージョン** | 1.8.0 (Security Analysis Edition) |
11
+ | **バージョン** | 2.0.0 (Deep Symbolic + Advanced Learning) |
12
12
  | **言語** | TypeScript |
13
13
  | **ランタイム** | Node.js >= 20.0.0 |
14
14
  | **パッケージマネージャ** | npm >= 10.0.0 |
15
15
  | **ビルドシステム** | モノレポ(npm workspaces) |
16
16
  | **テストフレームワーク** | Vitest |
17
- | **テスト数** | 1586 (全合格) |
18
- | **コンポーネント数** | 249 (62ドメイン対応) |
17
+ | **テスト数** | 1660+ (全合格) |
18
+ | **パッケージ数** | 19 |
19
19
  | **Agent Skills** | 12 (Claude Code対応) |
20
20
 
21
21
  ---
@@ -28,32 +28,44 @@
28
28
  packages/
29
29
  ├── core/ # @nahisaho/musubix-core
30
30
  ├── mcp-server/ # @nahisaho/musubix-mcp-server
31
- ├── security/ # @nahisaho/musubix-security (NEW!)
31
+ ├── security/ # @nahisaho/musubix-security
32
32
  ├── formal-verify/ # @nahisaho/musubix-formal-verify
33
33
  ├── yata-client/ # @nahisaho/musubix-yata-client
34
34
  ├── yata-local/ # @nahisaho/yata-local
35
35
  ├── yata-global/ # @nahisaho/yata-global
36
36
  ├── yata-ui/ # @nahisaho/yata-ui
37
+ ├── yata-scale/ # @nahisaho/yata-scale (v2.0.0 NEW!)
37
38
  ├── pattern-mcp/ # @nahisaho/musubix-pattern-mcp
38
39
  ├── ontology-mcp/ # @nahisaho/musubix-ontology-mcp
39
40
  ├── wake-sleep/ # @nahisaho/musubix-wake-sleep
40
- └── sdd-ontology/ # @nahisaho/musubix-sdd-ontology
41
+ ├── sdd-ontology/ # @nahisaho/musubix-sdd-ontology
42
+ ├── dfg/ # @nahisaho/musubix-dfg (v2.0.0 NEW!)
43
+ ├── lean/ # @nahisaho/musubix-lean (v2.0.0 NEW!)
44
+ ├── library-learner/# @nahisaho/musubix-library-learner (v2.0.0 NEW!)
45
+ ├── neural-search/ # @nahisaho/musubix-neural-search (v2.0.0 NEW!)
46
+ └── synthesis/ # @nahisaho/musubix-synthesis (v2.0.0 NEW!)
41
47
  ```
42
48
 
43
49
  | パッケージ | npm | 役割 |
44
50
  |-----------|-----|------|
45
51
  | `packages/core/` | `@nahisaho/musubix-core` | コアライブラリ - CLI、EARS検証、コード生成、設計パターン |
46
52
  | `packages/mcp-server/` | `@nahisaho/musubix-mcp-server` | MCPサーバー - 19ツール、3プロンプト |
47
- | `packages/security/` | `@nahisaho/musubix-security` | **セキュリティ分析** - 脆弱性検出、シークレット検出、テイント解析 (NEW!) |
53
+ | `packages/security/` | `@nahisaho/musubix-security` | セキュリティ分析 - 脆弱性検出、シークレット検出、テイント解析 |
48
54
  | `packages/formal-verify/` | `@nahisaho/musubix-formal-verify` | 形式検証 - Z3統合、Hoare検証、EARS→SMT変換 |
49
55
  | `packages/yata-client/` | `@nahisaho/musubix-yata-client` | YATAクライアント - 知識グラフ連携 |
50
- | `packages/yata-local/` | `@nahisaho/yata-local` | **YATA Local** - SQLiteベースローカル知識グラフ |
51
- | `packages/yata-global/` | `@nahisaho/yata-global` | **YATA Global** - 分散型知識グラフプラットフォーム |
52
- | `packages/yata-ui/` | `@nahisaho/yata-ui` | **YATA UI** - Web可視化・管理インターフェース |
56
+ | `packages/yata-local/` | `@nahisaho/yata-local` | YATA Local - SQLiteベースローカル知識グラフ |
57
+ | `packages/yata-global/` | `@nahisaho/yata-global` | YATA Global - 分散型知識グラフプラットフォーム |
58
+ | `packages/yata-ui/` | `@nahisaho/yata-ui` | YATA UI - Web可視化・管理インターフェース |
59
+ | `packages/yata-scale/` | `@nahisaho/yata-scale` | **YATA Scale** - 分散シャーディング・キャッシュ (v2.0.0 NEW!) |
53
60
  | `packages/pattern-mcp/` | `@nahisaho/musubix-pattern-mcp` | パターン学習 - 抽出・圧縮・ライブラリ |
54
61
  | `packages/ontology-mcp/` | `@nahisaho/musubix-ontology-mcp` | オントロジー - N3Store・推論エンジン |
55
62
  | `packages/wake-sleep/` | `@nahisaho/musubix-wake-sleep` | Wake-Sleep学習サイクル |
56
63
  | `packages/sdd-ontology/` | `@nahisaho/musubix-sdd-ontology` | SDD方法論オントロジー |
64
+ | `packages/dfg/` | `@nahisaho/musubix-dfg` | **DFG/CFG抽出** - データフロー・制御フロー解析 (v2.0.0 NEW!) |
65
+ | `packages/lean/` | `@nahisaho/musubix-lean` | **Lean 4統合** - 定理証明・EARS変換 (v2.0.0 NEW!) |
66
+ | `packages/library-learner/` | `@nahisaho/musubix-library-learner` | **ライブラリ学習** - APIパターン抽出 (v2.0.0 NEW!) |
67
+ | `packages/neural-search/` | `@nahisaho/musubix-neural-search` | **ニューラル検索** - 意味的コード検索 (v2.0.0 NEW!) |
68
+ | `packages/synthesis/` | `@nahisaho/musubix-synthesis` | **プログラム合成** - ニューラル誘導合成 (v2.0.0 NEW!) |
57
69
 
58
70
  ### Core パッケージモジュール
59
71
 
@@ -525,5 +537,5 @@ npx musubix learn best-practices --format markdown
525
537
  ---
526
538
 
527
539
  **Agent**: GitHub Copilot / Claude
528
- **Last Updated**: 2026-01-06
529
- **Version**: 1.6.4
540
+ **Last Updated**: 2026-01-08
541
+ **Version**: 2.0.0
package/README.md CHANGED
@@ -7,15 +7,18 @@
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-1824%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
10
+ [![Tests](https://img.shields.io/badge/tests-1600%2B%20passing-brightgreen)](https://github.com/nahisaho/MUSUBIX)
11
11
  [![npm security](https://img.shields.io/npm/v/@nahisaho/musubix-security.svg?label=@nahisaho/musubix-security)](https://www.npmjs.com/package/@nahisaho/musubix-security)
12
12
  [![npm dfg](https://img.shields.io/npm/v/@nahisaho/musubix-dfg.svg?label=@nahisaho/musubix-dfg)](https://www.npmjs.com/package/@nahisaho/musubix-dfg)
13
13
  [![npm lean](https://img.shields.io/npm/v/@nahisaho/musubix-lean.svg?label=@nahisaho/musubix-lean)](https://www.npmjs.com/package/@nahisaho/musubix-lean)
14
14
  [![npm yata-scale](https://img.shields.io/npm/v/@nahisaho/yata-scale.svg?label=@nahisaho/yata-scale)](https://www.npmjs.com/package/@nahisaho/yata-scale)
15
+ [![npm synthesis](https://img.shields.io/npm/v/@nahisaho/musubix-synthesis.svg?label=@nahisaho/musubix-synthesis)](https://www.npmjs.com/package/@nahisaho/musubix-synthesis)
16
+ [![npm library-learner](https://img.shields.io/npm/v/@nahisaho/musubix-library-learner.svg?label=@nahisaho/musubix-library-learner)](https://www.npmjs.com/package/@nahisaho/musubix-library-learner)
17
+ [![npm neural-search](https://img.shields.io/npm/v/@nahisaho/musubix-neural-search.svg?label=@nahisaho/musubix-neural-search)](https://www.npmjs.com/package/@nahisaho/musubix-neural-search)
15
18
 
16
19
  > Next-generation AI Coding System powered by MUSUBI × YATA Integration
17
20
  >
18
- > **v1.8.5** - Deep Symbolic Integration Edition
21
+ > **v2.0.0** - Deep Symbolic Integration & Advanced Learning Edition
19
22
 
20
23
  **[日本語版 README](README.ja.md)**
21
24
 
@@ -23,31 +26,30 @@
23
26
 
24
27
  MUSUBIX is an innovative AI coding system that integrates **Neural (LLM)** and **Symbolic (Knowledge Graph)** reasoning. It combines MUSUBI SDD methodology with YATA knowledge graph reasoning to support high-quality software development.
25
28
 
29
+ ### 🎉 v2.0.0 Highlights
30
+
31
+ - **Phase 1: Deep Symbolic Integration** - DFG/CFG analysis, Lean 4 theorem proving, distributed KG
32
+ - **Phase 2: Advanced Learning** - DreamCoder-style library learning, neural search, program synthesis
33
+ - **1600+ tests** passing across 19 packages
34
+
26
35
  ### Features
27
36
 
28
37
  - 🧠 **Neuro-Symbolic Integration** - Fusion of LLM creativity and YATA knowledge graph precision
29
- - **Symbolic Reasoning** - Formal verification, hallucination detection, constitution enforcement
38
+ - 📊 **DFG/CFG Analysis** - Data flow and control flow graph extraction for TypeScript/JavaScript *(v2.0.0)*
39
+ - 🧮 **Lean 4 Integration** - Formal theorem proving with EARS-to-Lean conversion *(v2.0.0)*
40
+ - 📈 **YATA Scale** - Distributed knowledge graph with sharding and multi-tier caching *(v2.0.0)*
41
+ - 📚 **Library Learning** - DreamCoder-style hierarchical abstraction and pattern compression *(v2.0.0)*
42
+ - 🔍 **Neural Search** - Neural-guided program synthesis with beam search *(v2.0.0)*
43
+ - ⚗️ **Program Synthesis** - DSL-based PBE synthesis with witness functions *(v2.0.0)*
44
+ - 🔒 **Symbolic Reasoning** - Formal verification, hallucination detection, constitution enforcement
30
45
  - 📝 **EARS Requirements Analysis** - Conversion and validation from natural language to formal requirements
31
46
  - 🎨 **Design Pattern Recommendations** - Context-based C4 model and ADR generation
32
47
  - ✅ **Test-Driven Development** - Quality assurance through Test-First principles
33
48
  - 🔗 **Complete Traceability** - Tracking from requirements to code
34
- - 💬 **Interactive Q&A Hearing** - Dialogue-based requirements gathering support
35
- - 🌐 **Internationalization (i18n)** - Japanese and English support
36
- - 🔒 **Security Scanning** - Vulnerability detection, secret scanning, OWASP patterns
37
- - 📚 **Self-Learning System** - Adaptive improvement through feedback collection and pattern extraction
38
- - 🏗️ **C4 Code Generation** - Generate TypeScript skeleton from C4 design documents
39
- - ⚙️ **Quality Gates** - Automated quality validation before phase transitions
40
- - 🔮 **Advanced Inference** - OWL 2 RL reasoning and Datalog evaluation *(v1.4.5)*
49
+ - 🛡️ **Security Analysis** - Vulnerability scanning, secret detection, taint analysis *(v1.8.0)*
50
+ - 🔬 **Formal Verification** - Z3 SMT solver integration, Hoare triple verification *(v1.7.5)*
41
51
  - 🖥️ **Interactive REPL** - Command completion, history, session variables *(v1.6.0)*
42
- - 🗄️ **YATA Local** - SQLite-based local knowledge graph (BFS/DFS, reasoning) *(v1.6.3)*
43
- - 🌐 **YATA Global** - Distributed knowledge platform with offline sync *(v1.6.3)*
44
- - 📤 **KGPR** - Knowledge Graph Pull Request for safe knowledge sharing *(v1.6.4)*
45
- - 🚀 **YATA Platform Enhancements** - Index optimization, enhanced export, global sync, code generation, web UI *(v1.7.0)*
46
- - 🔬 **Formal Verification** - Z3 SMT solver integration, Hoare triple verification, EARS-to-SMT conversion *(v1.7.5)*
47
- - 🛡️ **Security Analysis** - Vulnerability scanning, secret detection, taint analysis, dependency auditing *(v1.8.0)*
48
- - 📊 **DFG/CFG Extraction** - Data flow graph and control flow graph analysis for TypeScript/JavaScript *(v2.0.0-alpha.1)*
49
- - 🧮 **Lean 4 Integration** - Theorem proving with EARS-to-Lean conversion and ReProver proof search *(v2.0.0-alpha.1)*
50
- - 📈 **YATA Scale** - Distributed knowledge graph with sharding, multi-tier caching, and vector clock sync *(v2.0.0-alpha.1)*
52
+ - 🔮 **Advanced Inference** - OWL 2 RL reasoning and Datalog evaluation *(v1.4.5)*
51
53
 
52
54
  ## Architecture
53
55
 
@@ -97,13 +99,16 @@ flowchart TB
97
99
  | `packages/ontology-mcp/` | **Ontology Engine (NEW!)** |
98
100
  | `packages/wake-sleep/` | **Wake-Sleep Learning (NEW!)** |
99
101
  | `packages/sdd-ontology/` | **SDD Ontology (NEW!)** |
100
- | `packages/yata-local/` | **YATA Local - SQLite Knowledge Graph (NEW!)** |
101
- | `packages/yata-global/` | **YATA Global - Distributed Knowledge Platform (NEW!)** |
102
- | `packages/security/` | **Security Analysis (NEW!)** |
102
+ | `packages/yata-local/` | **YATA Local - SQLite Knowledge Graph** |
103
+ | `packages/yata-global/` | **YATA Global - Distributed Knowledge Platform** |
104
+ | `packages/security/` | **Security Analysis** |
103
105
  | `packages/formal-verify/` | **Formal Verification** |
104
106
  | `packages/dfg/` | **DFG/CFG Extraction - Data Flow Analysis (v2.0.0)** |
105
107
  | `packages/lean/` | **Lean 4 Integration - Theorem Proving (v2.0.0)** |
106
108
  | `packages/yata-scale/` | **YATA Scale - Distributed KG (v2.0.0)** |
109
+ | `packages/library-learner/` | **Library Learning - DreamCoder-style (v2.0.0)** |
110
+ | `packages/neural-search/` | **Neural Search - Guided Synthesis (v2.0.0)** |
111
+ | `packages/synthesis/` | **Program Synthesis - DSL/PBE (v2.0.0)** |
107
112
  | `steering/` | Project Memory |
108
113
  | `storage/` | Specifications & Artifacts |
109
114
  | `templates/` | Templates |
@@ -141,9 +146,16 @@ npm install @nahisaho/musubix-mcp-server
141
146
  npm install @nahisaho/musubix-yata-client
142
147
  npm install @nahisaho/musubix-security
143
148
  npm install @nahisaho/musubix-formal-verify
149
+
150
+ # Phase 1: Deep Symbolic Integration
144
151
  npm install @nahisaho/musubix-dfg
145
152
  npm install @nahisaho/musubix-lean
146
153
  npm install @nahisaho/yata-scale
154
+
155
+ # Phase 2: Advanced Learning
156
+ npm install @nahisaho/musubix-library-learner
157
+ npm install @nahisaho/musubix-neural-search
158
+ npm install @nahisaho/musubix-synthesis
147
159
  ```
148
160
 
149
161
  ### Build from Source
@@ -23,13 +23,16 @@
23
23
  15. [YATA Platform Enhancements](#yata-platform-enhancements) *(v1.7.0)*
24
24
  16. [Formal Verification](#formal-verification) *(v1.7.5)*
25
25
  17. [Security Analysis](#security-analysis) *(v1.8.0)*
26
- 18. [DFG/CFG Extraction](#dfgcfg-extraction) *(v2.0.0-alpha.1)*
27
- 19. [Lean 4 Integration](#lean-4-integration) *(v2.0.0-alpha.1)*
28
- 20. [YATA Scale](#yata-scale) *(v2.0.0-alpha.1)*
29
- 21. [MCP Server Integration](#mcp-server-integration)
30
- 22. [YATA Integration](#yata-integration)
31
- 23. [Best Practices](#best-practices)
32
- 24. [Troubleshooting](#troubleshooting)
26
+ 18. [DFG/CFG Extraction](#dfgcfg-extraction) *(v2.0.0)*
27
+ 19. [Lean 4 Integration](#lean-4-integration) *(v2.0.0)*
28
+ 20. [YATA Scale](#yata-scale) *(v2.0.0)*
29
+ 21. [Library Learning](#library-learning) *(v2.0.0 NEW!)*
30
+ 22. [Neural Search](#neural-search) *(v2.0.0 NEW!)*
31
+ 23. [Program Synthesis](#program-synthesis) *(v2.0.0 NEW!)*
32
+ 24. [MCP Server Integration](#mcp-server-integration)
33
+ 25. [YATA Integration](#yata-integration)
34
+ 26. [Best Practices](#best-practices)
35
+ 27. [Troubleshooting](#troubleshooting)
33
36
 
34
37
  ---
35
38
 
@@ -1377,7 +1380,7 @@ npx musubix-security scan ./src --format sarif --output report.sarif
1377
1380
 
1378
1381
  ## DFG/CFG Extraction
1379
1382
 
1380
- *(v2.0.0-alpha.1)*
1383
+ *(v2.0.0)*
1381
1384
 
1382
1385
  The `@nahisaho/musubix-dfg` package provides Data Flow Graph (DFG) and Control Flow Graph (CFG) extraction for TypeScript and JavaScript code analysis.
1383
1386
 
@@ -1458,7 +1461,7 @@ for (const dep of deps) {
1458
1461
 
1459
1462
  ## Lean 4 Integration
1460
1463
 
1461
- *(v2.0.0-alpha.1)*
1464
+ *(v2.0.0)*
1462
1465
 
1463
1466
  The `@nahisaho/musubix-lean` package provides integration with the Lean 4 theorem prover for formal verification of requirements.
1464
1467
 
@@ -1556,7 +1559,7 @@ if (proof.found) {
1556
1559
 
1557
1560
  ## YATA Scale
1558
1561
 
1559
- *(v2.0.0-alpha.1)*
1562
+ *(v2.0.0)*
1560
1563
 
1561
1564
  The `@nahisaho/yata-scale` package provides distributed knowledge graph capabilities with sharding, caching, and synchronization.
1562
1565
 
@@ -1677,7 +1680,7 @@ sync.onConflict((conflict) => {
1677
1680
  });
1678
1681
  ```
1679
1682
 
1680
- ### v2.0.0-alpha.1 Package Summary
1683
+ ### v2.0.0 Package Summary
1681
1684
 
1682
1685
  | Package | Tests | Description |
1683
1686
  |---------|-------|-------------|
@@ -1688,6 +1691,352 @@ sync.onConflict((conflict) => {
1688
1691
 
1689
1692
  ---
1690
1693
 
1694
+ ## Library Learning
1695
+
1696
+ *(v2.0.0 NEW!)*
1697
+
1698
+ The `@nahisaho/musubix-library-learner` package provides intelligent API pattern extraction and documentation from TypeScript libraries, enabling the system to learn and suggest library usage patterns.
1699
+
1700
+ ### Installation
1701
+
1702
+ ```bash
1703
+ npm install @nahisaho/musubix-library-learner
1704
+ ```
1705
+
1706
+ ### Library Analysis
1707
+
1708
+ Analyze and learn patterns from TypeScript libraries:
1709
+
1710
+ ```typescript
1711
+ import { LibraryLearner, LibraryAnalyzer } from '@nahisaho/musubix-library-learner';
1712
+
1713
+ const learner = new LibraryLearner();
1714
+
1715
+ // Analyze a library
1716
+ const patterns = await learner.analyze({
1717
+ libraryName: 'lodash',
1718
+ sourceDir: './node_modules/lodash',
1719
+ includeExamples: true,
1720
+ });
1721
+
1722
+ console.log(`Found ${patterns.length} API patterns`);
1723
+ for (const pattern of patterns) {
1724
+ console.log(`- ${pattern.name}: ${pattern.description}`);
1725
+ }
1726
+ ```
1727
+
1728
+ ### Pattern Extraction
1729
+
1730
+ Extract usage patterns from code examples:
1731
+
1732
+ ```typescript
1733
+ import { PatternExtractor } from '@nahisaho/musubix-library-learner';
1734
+
1735
+ const extractor = new PatternExtractor();
1736
+
1737
+ const patterns = await extractor.extract({
1738
+ code: sourceCode,
1739
+ libraryContext: 'express',
1740
+ });
1741
+
1742
+ // Get common patterns
1743
+ for (const pattern of patterns) {
1744
+ console.log(`Pattern: ${pattern.type}`);
1745
+ console.log(`Example: ${pattern.example}`);
1746
+ console.log(`Frequency: ${pattern.frequency}`);
1747
+ }
1748
+ ```
1749
+
1750
+ ### API Documentation Generation
1751
+
1752
+ Generate documentation from learned patterns:
1753
+
1754
+ ```typescript
1755
+ import { DocGenerator } from '@nahisaho/musubix-library-learner';
1756
+
1757
+ const generator = new DocGenerator();
1758
+
1759
+ const docs = await generator.generate({
1760
+ patterns: learnedPatterns,
1761
+ format: 'markdown',
1762
+ includeExamples: true,
1763
+ });
1764
+
1765
+ await fs.writeFile('API-PATTERNS.md', docs);
1766
+ ```
1767
+
1768
+ ### TypeScript Analysis
1769
+
1770
+ Deep analysis of TypeScript declarations:
1771
+
1772
+ ```typescript
1773
+ import { TypeScriptAnalyzer } from '@nahisaho/musubix-library-learner';
1774
+
1775
+ const analyzer = new TypeScriptAnalyzer();
1776
+
1777
+ const analysis = await analyzer.analyze('./src/index.ts');
1778
+
1779
+ // Get exported types
1780
+ for (const type of analysis.exports) {
1781
+ console.log(`${type.name}: ${type.kind}`);
1782
+ if (type.kind === 'function') {
1783
+ console.log(` Params: ${type.parameters.join(', ')}`);
1784
+ console.log(` Returns: ${type.returnType}`);
1785
+ }
1786
+ }
1787
+ ```
1788
+
1789
+ ---
1790
+
1791
+ ## Neural Search
1792
+
1793
+ *(v2.0.0 NEW!)*
1794
+
1795
+ The `@nahisaho/musubix-neural-search` package provides semantic code search using embeddings and neural ranking, enabling context-aware code discovery across your codebase.
1796
+
1797
+ ### Installation
1798
+
1799
+ ```bash
1800
+ npm install @nahisaho/musubix-neural-search
1801
+ ```
1802
+
1803
+ ### Semantic Search
1804
+
1805
+ Search code by meaning, not just keywords:
1806
+
1807
+ ```typescript
1808
+ import { NeuralSearchEngine } from '@nahisaho/musubix-neural-search';
1809
+
1810
+ const search = new NeuralSearchEngine({
1811
+ embeddingModel: 'code-bert',
1812
+ indexPath: './search-index',
1813
+ });
1814
+
1815
+ // Index your codebase
1816
+ await search.index('./src');
1817
+
1818
+ // Semantic search
1819
+ const results = await search.search({
1820
+ query: 'function that validates email addresses',
1821
+ limit: 10,
1822
+ });
1823
+
1824
+ for (const result of results) {
1825
+ console.log(`${result.file}:${result.line} (score: ${result.score})`);
1826
+ console.log(` ${result.snippet}`);
1827
+ }
1828
+ ```
1829
+
1830
+ ### Code Embeddings
1831
+
1832
+ Generate embeddings for code snippets:
1833
+
1834
+ ```typescript
1835
+ import { CodeEmbedder } from '@nahisaho/musubix-neural-search';
1836
+
1837
+ const embedder = new CodeEmbedder();
1838
+
1839
+ const embedding = await embedder.embed({
1840
+ code: 'function add(a: number, b: number) { return a + b; }',
1841
+ language: 'typescript',
1842
+ });
1843
+
1844
+ // Compare similarity
1845
+ const similarity = embedder.cosineSimilarity(embedding1, embedding2);
1846
+ console.log(`Similarity: ${similarity}`);
1847
+ ```
1848
+
1849
+ ### Hybrid Search
1850
+
1851
+ Combine lexical and semantic search:
1852
+
1853
+ ```typescript
1854
+ import { HybridSearchEngine } from '@nahisaho/musubix-neural-search';
1855
+
1856
+ const hybrid = new HybridSearchEngine({
1857
+ lexicalWeight: 0.3,
1858
+ semanticWeight: 0.7,
1859
+ });
1860
+
1861
+ const results = await hybrid.search({
1862
+ query: 'authentication middleware express',
1863
+ filters: {
1864
+ language: 'typescript',
1865
+ path: 'src/middleware/**',
1866
+ },
1867
+ });
1868
+ ```
1869
+
1870
+ ### Code Ranking
1871
+
1872
+ Neural ranking for search results:
1873
+
1874
+ ```typescript
1875
+ import { CodeRanker } from '@nahisaho/musubix-neural-search';
1876
+
1877
+ const ranker = new CodeRanker();
1878
+
1879
+ const ranked = await ranker.rank({
1880
+ query: 'parse JSON safely',
1881
+ candidates: searchResults,
1882
+ context: {
1883
+ currentFile: './src/utils.ts',
1884
+ recentFiles: ['./src/api.ts', './src/config.ts'],
1885
+ },
1886
+ });
1887
+ ```
1888
+
1889
+ ---
1890
+
1891
+ ## Program Synthesis
1892
+
1893
+ *(v2.0.0 NEW!)*
1894
+
1895
+ The `@nahisaho/musubix-synthesis` package provides neural-guided program synthesis, generating code from specifications using symbolic constraints and neural networks.
1896
+
1897
+ ### Installation
1898
+
1899
+ ```bash
1900
+ npm install @nahisaho/musubix-synthesis
1901
+ ```
1902
+
1903
+ ### Specification-Based Synthesis
1904
+
1905
+ Generate code from formal specifications:
1906
+
1907
+ ```typescript
1908
+ import { ProgramSynthesizer } from '@nahisaho/musubix-synthesis';
1909
+
1910
+ const synthesizer = new ProgramSynthesizer();
1911
+
1912
+ const result = await synthesizer.synthesize({
1913
+ specification: {
1914
+ input: 'array of numbers',
1915
+ output: 'array of numbers (sorted ascending)',
1916
+ constraints: ['stable sort', 'O(n log n) complexity'],
1917
+ },
1918
+ language: 'typescript',
1919
+ });
1920
+
1921
+ console.log(result.code);
1922
+ // function sort(arr: number[]): number[] {
1923
+ // return [...arr].sort((a, b) => a - b);
1924
+ // }
1925
+ ```
1926
+
1927
+ ### Example-Based Synthesis
1928
+
1929
+ Generate code from input/output examples:
1930
+
1931
+ ```typescript
1932
+ import { ExampleBasedSynthesizer } from '@nahisaho/musubix-synthesis';
1933
+
1934
+ const synthesizer = new ExampleBasedSynthesizer();
1935
+
1936
+ const result = await synthesizer.synthesize({
1937
+ examples: [
1938
+ { input: ['hello', 'world'], output: 'hello world' },
1939
+ { input: ['foo', 'bar', 'baz'], output: 'foo bar baz' },
1940
+ ],
1941
+ language: 'typescript',
1942
+ });
1943
+
1944
+ console.log(result.code);
1945
+ // function join(arr: string[]): string {
1946
+ // return arr.join(' ');
1947
+ // }
1948
+ ```
1949
+
1950
+ ### Sketch-Based Synthesis
1951
+
1952
+ Fill in holes in partial programs:
1953
+
1954
+ ```typescript
1955
+ import { SketchSynthesizer } from '@nahisaho/musubix-synthesis';
1956
+
1957
+ const synthesizer = new SketchSynthesizer();
1958
+
1959
+ const result = await synthesizer.complete({
1960
+ sketch: `
1961
+ function validate(email: string): boolean {
1962
+ const pattern = ??; // hole to fill
1963
+ return pattern.test(email);
1964
+ }
1965
+ `,
1966
+ constraints: ['must validate common email formats'],
1967
+ });
1968
+
1969
+ console.log(result.code);
1970
+ // const pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1971
+ ```
1972
+
1973
+ ### Neural-Guided Search
1974
+
1975
+ Use neural networks to guide synthesis search:
1976
+
1977
+ ```typescript
1978
+ import { NeuralGuidedSynthesizer } from '@nahisaho/musubix-synthesis';
1979
+
1980
+ const synthesizer = new NeuralGuidedSynthesizer({
1981
+ model: 'codegen-2B',
1982
+ beamWidth: 5,
1983
+ maxDepth: 10,
1984
+ });
1985
+
1986
+ const result = await synthesizer.synthesize({
1987
+ description: 'Parse a CSV string into array of objects with headers as keys',
1988
+ tests: [
1989
+ {
1990
+ input: 'name,age\\nAlice,30\\nBob,25',
1991
+ output: [{ name: 'Alice', age: '30' }, { name: 'Bob', age: '25' }],
1992
+ },
1993
+ ],
1994
+ });
1995
+
1996
+ if (result.verified) {
1997
+ console.log('All tests pass!');
1998
+ console.log(result.code);
1999
+ }
2000
+ ```
2001
+
2002
+ ### Synthesis Verification
2003
+
2004
+ Verify synthesized code against specifications:
2005
+
2006
+ ```typescript
2007
+ import { SynthesisVerifier } from '@nahisaho/musubix-synthesis';
2008
+
2009
+ const verifier = new SynthesisVerifier();
2010
+
2011
+ const verification = await verifier.verify({
2012
+ code: synthesizedCode,
2013
+ specification: originalSpec,
2014
+ tests: testCases,
2015
+ });
2016
+
2017
+ console.log(`Verified: ${verification.passed}`);
2018
+ console.log(`Coverage: ${verification.testCoverage}%`);
2019
+ for (const issue of verification.issues) {
2020
+ console.log(`Issue: ${issue.message}`);
2021
+ }
2022
+ ```
2023
+
2024
+ ### v2.0.0 Package Summary
2025
+
2026
+ | Package | Tests | Description |
2027
+ |---------|-------|-------------|
2028
+ | **Phase 1: Deep Symbolic Integration** | | |
2029
+ | `@nahisaho/musubix-dfg` | 30 | DFG/CFG extraction, Def-Use analysis |
2030
+ | `@nahisaho/musubix-lean` | 151 | Lean 4 theorem proving, EARS conversion |
2031
+ | `@nahisaho/yata-scale` | 57 | Distributed sharding, caching, sync |
2032
+ | **Phase 2: Advanced Learning** | | |
2033
+ | `@nahisaho/musubix-library-learner` | 132 | API pattern extraction, documentation |
2034
+ | `@nahisaho/musubix-neural-search` | 144 | Semantic code search, embeddings |
2035
+ | `@nahisaho/musubix-synthesis` | 146 | Neural-guided program synthesis |
2036
+ | **Total v2.0.0 New** | **660** | **6 new packages** |
2037
+
2038
+ ---
2039
+
1691
2040
  ## MCP Server Integration
1692
2041
 
1693
2042
  ### CLI Startup
@@ -2298,6 +2647,6 @@ const client = createYATAClient({
2298
2647
 
2299
2648
  ---
2300
2649
 
2301
- **Version**: 1.8.5
2650
+ **Version**: 2.0.0
2302
2651
  **Last Updated**: 2026-01-08
2303
2652
  **MUSUBIX Project**
@@ -0,0 +1,310 @@
1
+ # MUSUBIX Phase 2: Advanced Learning - 完了レポート
2
+
3
+ **完了日**: 2026-01-08
4
+ **バージョン**: 2.0.0
5
+ **ステータス**: ✅ Phase 2 完了
6
+
7
+ ---
8
+
9
+ ## 1. 概要
10
+
11
+ Phase 2「Advanced Learning」の全3パッケージの開発が完了しました。合計422テストが全て合格し、MUSUBIX v2.0.0としてリリース準備が整いました。
12
+
13
+ ### 1.1 完了サマリー
14
+
15
+ | パッケージ | バージョン | テスト数 | 結果 |
16
+ |-----------|------------|----------|------|
17
+ | **@nahisaho/musubix-library-learner** | 2.0.0 | 132 | ✅ 全合格 |
18
+ | **@nahisaho/musubix-neural-search** | 2.0.0 | 144 | ✅ 全合格 |
19
+ | **@nahisaho/musubix-synthesis** | 2.0.0 | 146 | ✅ 全合格 |
20
+ | **合計** | - | **422** | ✅ |
21
+
22
+ ---
23
+
24
+ ## 2. @nahisaho/musubix-library-learner
25
+
26
+ ### 2.1 パッケージ概要
27
+
28
+ DreamCoder(10^72探索削減を達成)を参考にした階層的ライブラリ学習パッケージです。パターンの抽象化と圧縮により、探索空間を劇的に削減します。
29
+
30
+ ### 2.2 主要機能
31
+
32
+ | 機能 | 説明 |
33
+ |------|------|
34
+ | **階層的抽象化** | Multi-level Abstractionによるパターンの階層化 |
35
+ | **パターン圧縮** | CompressionEngineによる冗長性削減 |
36
+ | **Wake-Sleep学習** | 観察と統合のサイクルによる継続的学習 |
37
+ | **型指向探索** | 型システムによる探索空間削減 |
38
+ | **E-graph最適化** | 等価性グラフによる表現最適化 |
39
+
40
+ ### 2.3 アーキテクチャ
41
+
42
+ ```
43
+ packages/library-learner/
44
+ ├── src/
45
+ │ ├── index.ts # Main exports
46
+ │ ├── types.ts # 型定義
47
+ │ ├── LibraryLearner.ts # メイン学習器
48
+ │ ├── AbstractionEngine.ts # 抽象化エンジン
49
+ │ ├── CompressionEngine.ts # 圧縮エンジン
50
+ │ ├── PatternMatcher.ts # パターンマッチング
51
+ │ ├── TypeDirectedSearch.ts # 型指向探索
52
+ │ └── EGraphOptimizer.ts # E-graph最適化
53
+ └── tests/
54
+ └── ... (132 tests)
55
+ ```
56
+
57
+ ### 2.4 使用例
58
+
59
+ ```typescript
60
+ import { LibraryLearner, AbstractionEngine, CompressionEngine } from '@nahisaho/musubix-library-learner';
61
+
62
+ // ライブラリ学習器の初期化
63
+ const learner = new LibraryLearner({
64
+ abstractionLevels: 3,
65
+ minOccurrences: 5,
66
+ });
67
+
68
+ // コーパスから学習
69
+ await learner.learnFromCorpus(codeCorpus);
70
+
71
+ // 学習済みプリミティブで合成
72
+ const solution = await learner.synthesize(specification, {
73
+ useLearnedPrimitives: true,
74
+ });
75
+ ```
76
+
77
+ ---
78
+
79
+ ## 3. @nahisaho/musubix-neural-search
80
+
81
+ ### 3.1 パッケージ概要
82
+
83
+ DeepCoder、NGDSを参考にしたニューラル誘導探索パッケージです。ニューラルモデルによる分岐スコアリングで効率的な探索を実現します。
84
+
85
+ ### 3.2 主要機能
86
+
87
+ | 機能 | 説明 |
88
+ |------|------|
89
+ | **分岐スコアリング** | ニューラルモデルで探索分岐を評価 |
90
+ | **探索優先順位付け** | 有望な探索パスを優先 |
91
+ | **学習ベースプルーニング** | 不毛な探索を早期打ち切り |
92
+ | **探索履歴学習** | 過去の探索から学習 |
93
+ | **ベストファースト探索** | スコアベースの最良優先探索 |
94
+
95
+ ### 3.3 アーキテクチャ
96
+
97
+ ```
98
+ packages/neural-search/
99
+ ├── src/
100
+ │ ├── index.ts # Main exports
101
+ │ ├── types.ts # 型定義
102
+ │ ├── NeuralSearchEngine.ts # メインエンジン
103
+ │ ├── embedding/
104
+ │ │ ├── EmbeddingModel.ts # 埋め込みモデル
105
+ │ │ └── EmbeddingScorer.ts # スコアリング
106
+ │ ├── search/
107
+ │ │ ├── BeamSearch.ts # ビームサーチ
108
+ │ │ ├── BestFirstSearch.ts # 最良優先探索
109
+ │ │ └── PruningStrategy.ts # プルーニング戦略
110
+ │ └── learning/
111
+ │ └── HistoryLearner.ts # 履歴学習
112
+ └── tests/
113
+ └── ... (144 tests)
114
+ ```
115
+
116
+ ### 3.4 使用例
117
+
118
+ ```typescript
119
+ import { NeuralSearchEngine, EmbeddingScorer, BeamSearch } from '@nahisaho/musubix-neural-search';
120
+
121
+ // ニューラル探索エンジンの初期化
122
+ const engine = new NeuralSearchEngine({
123
+ embeddingModel: model,
124
+ beamWidth: 10,
125
+ });
126
+
127
+ // スコアリング
128
+ const scorer = new EmbeddingScorer();
129
+ const scores = scorer.scoreBranches(candidates);
130
+
131
+ // ビームサーチ
132
+ const search = new BeamSearch({ width: 10, maxDepth: 20 });
133
+ const result = await search.search(spec);
134
+ ```
135
+
136
+ ---
137
+
138
+ ## 4. @nahisaho/musubix-synthesis
139
+
140
+ ### 4.1 パッケージ概要
141
+
142
+ Microsoft PROSE/FlashMetaを参考にしたプログラム合成DSLフレームワークです。例示合成(PBE)とWitness関数による演繹的合成をサポートします。
143
+
144
+ ### 4.2 主要機能
145
+
146
+ | 機能 | 説明 |
147
+ |------|------|
148
+ | **DSL定義フレームワーク** | ドメイン固有言語の宣言的定義 |
149
+ | **型システム** | 型推論・型チェック・型統一 |
150
+ | **プログラム列挙** | 網羅的なプログラム空間探索 |
151
+ | **例示合成 (PBE)** | 入出力例からの合成 |
152
+ | **Witness関数** | 演繹的合成のためのWitness関数 |
153
+ | **バージョン空間** | 候補プログラムの効率的管理 |
154
+ | **合成ルール学習** | メタ学習による合成ルール自動学習 |
155
+
156
+ ### 4.3 アーキテクチャ
157
+
158
+ ```
159
+ packages/synthesis/
160
+ ├── src/
161
+ │ ├── index.ts # Main exports
162
+ │ ├── types.ts # 型定義
163
+ │ ├── dsl/
164
+ │ │ ├── DSL.ts # DSL実行エンジン
165
+ │ │ ├── DSLBuilder.ts # DSLビルダー
166
+ │ │ └── TypeSystem.ts # 型システム
167
+ │ ├── synthesis/
168
+ │ │ ├── Enumerator.ts # プログラム列挙
169
+ │ │ ├── PBESynthesizer.ts # PBE合成器
170
+ │ │ ├── WitnessEngine.ts # Witness関数エンジン
171
+ │ │ └── VersionSpace.ts # バージョン空間
172
+ │ └── rules/
173
+ │ ├── RuleExtractor.ts # ルール抽出
174
+ │ ├── RuleLibrary.ts # ルールライブラリ
175
+ │ └── MetaLearner.ts # メタ学習器
176
+ └── tests/
177
+ └── ... (146 tests)
178
+ ```
179
+
180
+ ### 4.4 使用例
181
+
182
+ ```typescript
183
+ import { DSL, DSLBuilder, PBESynthesizer, WitnessEngine } from '@nahisaho/musubix-synthesis';
184
+
185
+ // DSL定義
186
+ const config = new DSLBuilder()
187
+ .type('int', { kind: 'primitive', name: 'int' })
188
+ .operator('add', {
189
+ name: 'add',
190
+ inputTypes: ['int', 'int'],
191
+ outputType: 'int',
192
+ implementation: (a, b) => a + b,
193
+ })
194
+ .constant('zero', { name: 'zero', type: 'int', value: 0 })
195
+ .build();
196
+
197
+ const dsl = new DSL(config);
198
+
199
+ // 例示合成(PBE)
200
+ const synthesizer = new PBESynthesizer();
201
+ const result = await synthesizer.synthesize(spec, dsl);
202
+
203
+ // Witness関数による演繹的合成
204
+ const witness = new WitnessEngine(dsl);
205
+ const program = await witness.synthesizeWithWitness(spec);
206
+ ```
207
+
208
+ ---
209
+
210
+ ## 5. Phase 1 + Phase 2 統合
211
+
212
+ ### 5.1 パッケージ間の連携
213
+
214
+ ```
215
+ ┌─────────────────────────────────────────────────────────────┐
216
+ │ MUSUBIX v2.0.0 │
217
+ ├─────────────────────────────────────────────────────────────┤
218
+ │ Phase 1: Deep Symbolic Integration │
219
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
220
+ │ │ musubix- │ │ musubix- │ │ yata- │ │
221
+ │ │ dfg │ │ lean │ │ scale │ │
222
+ │ │ (30 tests) │ │ (151 tests)│ │ (57 tests) │ │
223
+ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
224
+ │ │ │ │ │
225
+ │ └────────────────┼────────────────┘ │
226
+ │ ▼ │
227
+ │ Phase 2: Advanced Learning │
228
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
229
+ │ │ library- │ │ neural- │ │ musubix- │ │
230
+ │ │ learner │ │ search │ │ synthesis │ │
231
+ │ │ (132 tests)│ │ (144 tests)│ │ (146 tests)│ │
232
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
233
+ ├─────────────────────────────────────────────────────────────┤
234
+ │ Total: 660 tests (Phase 1: 238 + Phase 2: 422) │
235
+ └─────────────────────────────────────────────────────────────┘
236
+ ```
237
+
238
+ ### 5.2 統合API例
239
+
240
+ ```typescript
241
+ import { DFGExtractor } from '@nahisaho/musubix-dfg';
242
+ import { LibraryLearner } from '@nahisaho/musubix-library-learner';
243
+ import { NeuralSearchEngine } from '@nahisaho/musubix-neural-search';
244
+ import { PBESynthesizer, DSLBuilder } from '@nahisaho/musubix-synthesis';
245
+
246
+ // 1. DFGからパターンを抽出
247
+ const dfg = new DFGExtractor().extract(sourceCode);
248
+
249
+ // 2. パターンをライブラリとして学習
250
+ const learner = new LibraryLearner();
251
+ await learner.learnFromPatterns(dfg.patterns);
252
+
253
+ // 3. ニューラル誘導で探索を効率化
254
+ const search = new NeuralSearchEngine({
255
+ library: learner.getLibrary(),
256
+ });
257
+
258
+ // 4. DSLベースで合成
259
+ const synthesizer = new PBESynthesizer();
260
+ const result = await synthesizer.synthesize(spec, dsl, {
261
+ searchEngine: search,
262
+ });
263
+ ```
264
+
265
+ ---
266
+
267
+ ## 6. 成功指標(KPI)達成状況
268
+
269
+ | 指標 | 目標 | 実績 | 状態 |
270
+ |------|------|------|------|
271
+ | library-learnerテスト数 | 100+ | 132 | ✅ |
272
+ | neural-searchテスト数 | 80+ | 144 | ✅ |
273
+ | synthesisテスト数 | 120+ | 146 | ✅ |
274
+ | 合計テスト数 | 300+ | 422 | ✅ |
275
+ | ビルド成功 | 100% | 100% | ✅ |
276
+ | 型チェック通過 | 100% | 100% | ✅ |
277
+
278
+ ---
279
+
280
+ ## 7. 次のステップ
281
+
282
+ ### 7.1 Phase 3への準備
283
+
284
+ Phase 3「Enterprise Ready (v3.0)」の準備:
285
+
286
+ 1. **JetBrains/VS Code深い統合**: IDE拡張機能の開発
287
+ 2. **セキュリティ特化機能**: 高度な脆弱性検出
288
+ 3. **大規模知識グラフ**: 1億+トリプル対応
289
+
290
+ ### 7.2 v2.0.0正式リリース
291
+
292
+ - ✅ 全パッケージバージョン更新
293
+ - ✅ CHANGELOG更新
294
+ - ✅ README更新
295
+ - ✅ ドキュメント整備
296
+ - ⏳ npm公開
297
+
298
+ ---
299
+
300
+ ## 8. 参考文献
301
+
302
+ 1. **DreamCoder**: Ellis et al., "DreamCoder: Bootstrapping Inductive Program Synthesis with Wake-Sleep Library Learning" (PLDI 2021)
303
+ 2. **DeepCoder**: Balog et al., "DeepCoder: Learning to Write Programs" (ICLR 2017)
304
+ 3. **PROSE**: Gulwani et al., "Program Synthesis" (Foundations and Trends in Programming Languages 2017)
305
+ 4. **FlashMeta**: Polozov & Gulwani, "FlashMeta: A Framework for Inductive Program Synthesis" (OOPSLA 2015)
306
+
307
+ ---
308
+
309
+ **作成者**: MUSUBIX Development Team
310
+ **最終更新**: 2026-01-08
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musubix",
3
- "version": "1.8.5",
3
+ "version": "2.0.1",
4
4
  "description": "Neuro-Symbolic AI Coding System - MUSUBI × YATA Integration",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -63,17 +63,24 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@modelcontextprotocol/sdk": "1.25.1",
66
- "@nahisaho/musubi": "^1.3.0",
67
- "@nahisaho/musubix-core": "^1.7.5",
68
- "@nahisaho/musubix-formal-verify": "^1.7.5",
69
- "@nahisaho/musubix-mcp-server": "^1.7.5",
70
- "@nahisaho/musubix-ontology-mcp": "^1.0.0",
71
- "@nahisaho/musubix-pattern-mcp": "^1.0.0",
72
- "@nahisaho/musubix-sdd-ontology": "^1.0.0",
73
- "@nahisaho/musubix-security": "^1.8.0",
74
- "@nahisaho/musubix-wake-sleep": "^1.0.0",
75
- "@nahisaho/musubix-yata-client": "^1.3.0",
76
- "musubix": "^1.8.0",
77
- "yo": "^6.0.0"
66
+ "@nahisaho/musubi": "^2.0.0",
67
+ "@nahisaho/musubix-core": "^2.0.0",
68
+ "@nahisaho/musubix-dfg": "^2.0.0",
69
+ "@nahisaho/musubix-formal-verify": "^2.0.0",
70
+ "@nahisaho/musubix-lean": "^2.0.0",
71
+ "@nahisaho/musubix-library-learner": "^2.0.0",
72
+ "@nahisaho/musubix-mcp-server": "^2.0.0",
73
+ "@nahisaho/musubix-neural-search": "^2.0.0",
74
+ "@nahisaho/musubix-ontology-mcp": "^2.0.0",
75
+ "@nahisaho/musubix-pattern-mcp": "^2.0.0",
76
+ "@nahisaho/musubix-sdd-ontology": "^2.0.0",
77
+ "@nahisaho/musubix-security": "^2.0.0",
78
+ "@nahisaho/musubix-synthesis": "^2.0.0",
79
+ "@nahisaho/musubix-wake-sleep": "^2.0.0",
80
+ "@nahisaho/musubix-yata-client": "^2.0.0",
81
+ "@nahisaho/yata-global": "^2.0.0",
82
+ "@nahisaho/yata-local": "^2.0.0",
83
+ "@nahisaho/yata-scale": "^2.0.0",
84
+ "@nahisaho/yata-ui": "^2.0.0"
78
85
  }
79
86
  }