@ninebix/nmt-system 1.0.0 → 1.0.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/README.md CHANGED
@@ -1,281 +1,149 @@
1
1
  <!--
2
2
  ================================================================================
3
- NINEBIX inc. (주식회사 나인빅스)
3
+ NINEBIX inc.
4
4
  Email : sobdi90@9bix.com
5
5
  Website : https://9bix.com
6
- Corp ID : 476-86-03488
7
6
  ================================================================================
8
7
  -->
9
8
 
10
9
  # NMT System (Neuron Merkle Tree)
11
10
 
12
- **확률적 존재론 기반 검증 가능한 의미적 지식 그래프 시스템**
13
-
14
- A Probabilistic Ontology-based Verifiable Semantic Knowledge Graph System
11
+ **A Probabilistic Ontology-based Verifiable Semantic Knowledge Graph System**
15
12
 
13
+ [![npm version](https://img.shields.io/npm/v/@ninebix/nmt-system.svg)](https://www.npmjs.com/package/@ninebix/nmt-system)
16
14
  [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green)](https://nodejs.org)
17
15
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org)
18
16
  [![License](https://img.shields.io/badge/License-NSAL%20v1.0-orange)](LICENSE)
19
17
 
20
- ---
21
-
22
- ## Target Audience
23
-
24
- | 대상 | 활용 방식 |
25
- |------|----------|
26
- | **AI/ML 연구자** | 확률적 추론, 확률 분포 기반 지식 표현 연구 |
27
- | **지식 그래프 개발자** | 검증 가능한 분산 지식 베이스 구축 |
28
- | **LLM 애플리케이션 개발자** | RAG 시스템 백엔드, 맥락 기반 검색 |
29
- | **블록체인/DeFi 개발자** | Merkle 증명 기반 데이터 무결성 검증 |
30
- | **기업 R&D 팀** | 사내 지식 관리, AI 학습 데이터 파이프라인 |
18
+ NMT is a knowledge graph system where **all knowledge exists as probability distributions** rather than deterministic facts. It combines Merkle tree verification, HNSW vector search, and bidirectional inference for building verifiable, distributed knowledge bases.
31
19
 
32
20
  ---
33
21
 
34
- ## Core Features
35
-
36
- ### 1. Probabilistic Ontology (확률적 존재론)
37
-
38
- 기존 결정론적 지식 그래프와 달리, **모든 지식이 확률 분포로 존재**합니다.
39
-
40
- ```
41
- ┌─────────────────────────────────────────────────────────────────────┐
42
- │ Probabilistic Ontology Framework │
43
- │ │
44
- │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
45
- │ │ Probabilistic│ │ Attractor │ │ Bidirectional│ │
46
- │ │ States │───▶│ Model │───▶│ Inference │ │
47
- │ │ (확률분포) │ │ (목표 끌개) │ │ (양방향추론) │ │
48
- │ └──────────────┘ └──────────────┘ └──────────────┘ │
49
- │ │ │ │ │
50
- │ └───────────────────┴───────────────────┘ │
51
- │ │ │
52
- │ ┌────────┴────────┐ │
53
- │ │ Four-Stage │ │
54
- │ │ Learning │ │
55
- │ │ (4단계 학습) │ │
56
- │ └─────────────────┘ │
57
- └─────────────────────────────────────────────────────────────────────┘
58
- ```
22
+ ## Features
59
23
 
60
- #### 확률적 존재론인가?
61
-
62
- | 기존 방식 | NMT 확률적 방식 | 이점 |
63
- |----------|----------------|------|
64
- | "A는 B이다" (결정론) | "A가 B일 확률 0.85" | 불확실성 표현 가능 |
65
- | 단일 정답 | 다중 가능성 분포 | 복잡한 현실 반영 |
66
- | 정적 지식 | 관측/맥락에 따른 변화 | 동적 추론 가능 |
67
- | 원인→결과 단방향 | 원인↔결과 양방향 | 역추론/귀납 가능 |
24
+ - **Probabilistic Ontology** - Knowledge as probability distributions, not fixed facts
25
+ - **Bidirectional Inference** - Forward (cause→effect) and backward (effect→cause) reasoning
26
+ - **Attractor Model** - Goal-oriented decision making with future state influence
27
+ - **Four-Stage Learning** - Extract → Pattern → Process → Outcome learning pipeline
28
+ - **Merkle Verification** - Cryptographic integrity proofs for all data
29
+ - **State Synchronization** - Vector clocks and change journals for distributed systems
30
+ - **Dynamic Embeddings** - Runtime-expandable semantic dimensions
31
+ - **Local Embeddings** - Powered by Xenova/transformers (no external API required)
68
32
 
69
33
  ---
70
34
 
71
- ### 2. Attractor Model (목표 끌개 모델)
72
-
73
- **미래 목표가 현재 결정에 영향**을 미치는 목적론적 추론 시스템.
74
-
75
- ```typescript
76
- // 목표 끌개 생성
77
- nmt attractor create "프로젝트 완료" --priority 9 --deadline 2025-03-31
35
+ ## Installation
78
36
 
79
- // 현재 상태에서 목표까지의 경로 계산
80
- nmt attractor path neuron-current attractor-goal
37
+ ### From npm
81
38
 
82
- // 목표 확률장의 영향력 계산
83
- nmt attractor influence neuron-xyz
39
+ ```bash
40
+ npm install -g @ninebix/nmt-system
84
41
  ```
85
42
 
86
- **활용 사례:**
87
- - 목표 기반 의사결정 지원
88
- - 프로젝트 계획 최적화
89
- - 학습 경로 추천
90
-
91
- ---
92
-
93
- ### 3. Four-Stage Learning (4단계 학습 시스템)
94
-
95
- AI 학습을 **인간의 학습 과정과 유사하게** 구조화:
96
-
97
- ```
98
- Stage 1: Extract (추출)
99
-
100
- 유의미한 정보 추출 및 키워드 식별
101
-
102
- Stage 2: Pattern (패턴)
103
-
104
- 반복 패턴 인식 및 분류
105
-
106
- Stage 3: Process (과정)
107
-
108
- AI 추론 과정 자체를 학습
109
-
110
- Stage 4: Outcome (결과)
111
-
112
- 결과 피드백으로 전체 시스템 개선
113
- ```
43
+ ### From Source
114
44
 
115
45
  ```bash
116
- # 학습 세션 시작
117
- nmt learn session start
118
-
119
- # 내용 추출
120
- nmt learn extract neuron-abc --limit 20
121
-
122
- # 4단계 전체 실행
123
- nmt orchestrate learn --input "질문" --output "답변" --success --feedback 0.9
46
+ git clone https://github.com/CopikProjeckId/nmt-system.git
47
+ cd nmt-system
48
+ npm install
49
+ npm run build
50
+ npm link
124
51
  ```
125
52
 
126
53
  ---
127
54
 
128
- ### 4. Bidirectional Inference (양방향 추론)
55
+ ## Quick Start
129
56
 
130
- 원인→결과 (연역)와 결과→원인 (귀납)을 **동시에 수행**:
57
+ ### Initialize
131
58
 
132
59
  ```bash
133
- # 순방향 추론 (원인 → 결과)
134
- nmt infer forward neuron-cause --depth 5
135
-
136
- # 역방향 추론 (결과 → 원인)
137
- nmt infer backward neuron-effect --depth 5
60
+ # Initialize data directory
61
+ nmt init
138
62
 
139
- # 인과 관계 탐색
140
- nmt infer causal neuron-a neuron-b
141
-
142
- # 양방향 통합 추론
143
- nmt infer bidirectional neuron-xyz --depth 3
63
+ # Check system health
64
+ nmt prob health
144
65
  ```
145
66
 
146
- ---
147
-
148
- ### 5. Merkle Tree Verification (머클 트리 검증)
149
-
150
- 모든 데이터의 **암호학적 무결성 검증** 지원:
67
+ ### Ingest Data
151
68
 
152
69
  ```bash
153
- # 뉴런 무결성 검증
154
- nmt verify neuron neuron-abc
155
-
156
- # 증명 생성
157
- nmt verify proof neuron-abc --index 2
70
+ # Ingest text file
71
+ nmt ingest ./documents/article.txt --tags "ml,tutorial"
158
72
 
159
- # 뉴런 간 차이 비교
160
- nmt verify diff neuron-abc neuron-xyz
161
-
162
- # 배치 증명
163
- nmt verify batch neuron-abc --indices 0,2,5
73
+ # Ingest text directly
74
+ nmt ingest-text "Machine learning is a subset of AI" --tags "ml,ai"
164
75
  ```
165
76
 
166
- **Merkle 기능:**
167
- - Tree Diff: 두 트리 간 변경 사항 추적
168
- - Batch Proof: 다중 리프 동시 증명
169
- - Range Proof: 범위 기반 부분 검증
170
- - Versioned Tree: 버전 관리 및 롤백
171
-
172
- ---
173
-
174
- ### 6. State Synchronization (상태 동기화)
175
-
176
- **분산 환경**을 위한 동기화 인프라:
77
+ ### Search
177
78
 
178
79
  ```bash
179
- # 동기화 상태 확인
180
- nmt sync status
181
-
182
- # 변경 로그 조회
183
- nmt sync changes --from 0
80
+ # Semantic search
81
+ nmt search "neural networks" --k 10
184
82
 
185
- # 상태 내보내기
186
- nmt sync export --output backup.json
187
-
188
- # 상태 가져오기
189
- nmt sync import backup.json
190
-
191
- # 연결된 피어 목록
192
- nmt sync peers
193
-
194
- # 저널 통계
195
- nmt sync journal
83
+ # Get neuron details
84
+ nmt get <neuron-id>
196
85
  ```
197
86
 
198
- **동기화 기능:**
199
- - Vector Clock: 분산 환경 인과 관계 추적
200
- - Change Journal: 변경 이력 저널링
201
- - Conflict Resolution: Last-Write-Wins, Vector Clock, Custom Merge 전략
202
- - Merkle-based Diff: 효율적인 상태 비교
203
-
204
- ---
205
-
206
- ### 7. Dynamic Embedding (동적 임베딩)
207
-
208
- **차원을 동적으로 추가/수정** 가능한 유연한 임베딩:
87
+ ### Inference
209
88
 
210
89
  ```bash
211
- # 차원 등록
212
- nmt dimension register "감정" --category "sentiment"
90
+ # Forward inference (cause → effect)
91
+ nmt infer forward <neuron-id> --depth 5
213
92
 
214
- # 카테고리별 차원 조회
215
- nmt dimension category "sentiment"
93
+ # Backward inference (effect → cause)
94
+ nmt infer backward <neuron-id> --depth 5
216
95
 
217
- # 뉴런에 차원 설정
218
- nmt dimension set neuron-abc "감정" 0.8
219
- ```
220
-
221
- ---
96
+ # Find causal chain between neurons
97
+ nmt infer causal <from-id> <to-id>
222
98
 
223
- ## Quick Start
224
-
225
- ### Prerequisites
226
-
227
- - Node.js 18+
228
- - npm or yarn
99
+ # Bidirectional inference
100
+ nmt infer bidirectional <neuron-id> --depth 3
101
+ ```
229
102
 
230
- ### Installation
103
+ ### Attractors (Goal-Oriented Reasoning)
231
104
 
232
105
  ```bash
233
- # Clone
234
- git clone https://github.com/CopikProjeckId/nmt-system.git
235
- cd nmt-system
106
+ # Create goal attractor
107
+ nmt attractor create "Project Completion" --strength 0.8
236
108
 
237
- # Install
238
- npm install
109
+ # Find path to goal
110
+ nmt attractor path <neuron-id> <attractor-id>
239
111
 
240
- # Build
241
- npm run build
112
+ # Calculate goal influence on neuron
113
+ nmt attractor influence <neuron-id>
242
114
  ```
243
115
 
244
- ### CLI Usage
116
+ ### Verification
245
117
 
246
118
  ```bash
247
- # 전역 설치 (선택)
248
- npm link
119
+ # Verify neuron integrity
120
+ nmt verify neuron <neuron-id>
249
121
 
250
- # 도움말
251
- nmt --help
252
-
253
- # 시스템 상태 확인
254
- nmt prob health
122
+ # Generate Merkle proof
123
+ nmt verify proof <neuron-id> --index 2
255
124
 
256
- # 텍스트 학습
257
- nmt ingest --text "학습할 내용" --tags "태그1,태그2"
125
+ # Compare two neurons
126
+ nmt verify diff <neuron-a> <neuron-b>
258
127
 
259
- # 검색
260
- nmt query "검색어" --k 10
261
-
262
- # 통합 추론
263
- nmt orchestrate infer neuron-abc --depth 3
128
+ # Batch verification
129
+ nmt verify batch <neuron-id> --indices 0,2,5
264
130
  ```
265
131
 
266
- ### API Server
132
+ ### State Synchronization
267
133
 
268
134
  ```bash
269
- # 개발 서버 시작
270
- npm run dev
135
+ # Check sync status
136
+ nmt sync status
271
137
 
272
- # 프로덕션 빌드 후 실행
273
- npm run build
274
- npm start
275
- ```
138
+ # View change log
139
+ nmt sync changes --from 0
276
140
 
277
- - Backend API: http://localhost:3000
278
- - Dashboard: http://localhost:5173
141
+ # Export state
142
+ nmt sync export --output backup.json
143
+
144
+ # Import state
145
+ nmt sync import backup.json
146
+ ```
279
147
 
280
148
  ---
281
149
 
@@ -308,7 +176,7 @@ npm start
308
176
  │ │ Core Engines │ │
309
177
  │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
310
178
  │ │ │MerkleEngine│ │ HNSWIndex │ │NeuronGraph │ │ │
311
- │ │ │(검증/증명) │ │(벡터검색) │ │(그래프탐색)│ │ │
179
+ │ │ │ (Proofs) │ │ (Search) │ │ (Graph) │ │ │
312
180
  │ │ └────────────┘ └────────────┘ └────────────┘ │ │
313
181
  │ └───────────────────────────┬──────────────────────────────────┘ │
314
182
  │ │ │
@@ -328,50 +196,14 @@ npm start
328
196
 
329
197
  ---
330
198
 
331
- ## Project Structure
199
+ ## Why Probabilistic Ontology?
332
200
 
333
- ```
334
- nmt-system/
335
- ├── bin/
336
- │ └── nmt.ts # CLI entry point
337
- ├── src/
338
- │ ├── api/ # REST API (Express)
339
- │ ├── cli/ # CLI commands
340
- │ │ ├── commands/ # Command implementations
341
- │ │ └── utils/ # Validators, formatters
342
- │ ├── core/ # Core engines
343
- │ │ ├── merkle-engine.ts
344
- │ │ ├── hnsw-index.ts
345
- │ │ ├── neuron-graph.ts
346
- │ │ ├── probabilistic-orchestrator.ts
347
- │ │ ├── probabilistic-neuron.ts
348
- │ │ ├── bidirectional-inference.ts
349
- │ │ ├── attractor-model.ts
350
- │ │ ├── dynamic-embedding.ts
351
- │ │ └── evolution-scheduler.ts
352
- │ ├── events/ # Event system
353
- │ │ ├── event-bus.ts
354
- │ │ └── progress-tracker.ts
355
- │ ├── services/ # Business logic
356
- │ │ ├── four-stage-learning.ts
357
- │ │ ├── ingestion.ts
358
- │ │ ├── query.ts
359
- │ │ └── embedding-provider.ts
360
- │ ├── storage/ # Persistence (LevelDB)
361
- │ │ ├── probabilistic-store.ts
362
- │ │ ├── neuron-store.ts
363
- │ │ └── chunk-store.ts
364
- │ ├── sync/ # State synchronization
365
- │ │ ├── state-sync.ts
366
- │ │ ├── change-journal.ts
367
- │ │ └── vector-clock.ts
368
- │ ├── types/ # TypeScript definitions
369
- │ └── utils/ # Utilities
370
- ├── tests/ # Test suites
371
- ├── dashboard/ # React dashboard (optional)
372
- ├── docs/ # Documentation
373
- └── data/ # Runtime data
374
- ```
201
+ | Traditional Approach | NMT Probabilistic Approach | Benefit |
202
+ |---------------------|---------------------------|---------|
203
+ | "A is B" (deterministic) | "A is B with probability 0.85" | Express uncertainty |
204
+ | Single answer | Multiple possibility distribution | Reflect complex reality |
205
+ | Static knowledge | Context-dependent changes | Dynamic reasoning |
206
+ | Cause Effect only | Cause ↔ Effect bidirectional | Abductive reasoning |
375
207
 
376
208
  ---
377
209
 
@@ -381,26 +213,27 @@ nmt-system/
381
213
 
382
214
  | Endpoint | Method | Description |
383
215
  |----------|--------|-------------|
384
- | `/api/v1/ingest` | POST | 텍스트 학습 |
385
- | `/api/v1/ingest/url` | POST | URL 학습 |
386
- | `/api/v1/query/search` | POST | 의미적 검색 |
387
- | `/api/v1/rag/query` | POST | RAG 질의 |
388
- | `/api/v1/graph/neuron/:id` | GET | 뉴런 상세 |
389
- | `/api/v1/graph/full` | GET | 전체 그래프 |
390
- | `/api/v1/health` | GET | 헬스 체크 |
391
- | `/api/v1/metrics` | GET | 시스템 메트릭 |
216
+ | `/api/v1/ingest` | POST | Ingest text content |
217
+ | `/api/v1/ingest/url` | POST | Ingest from URL |
218
+ | `/api/v1/query/search` | POST | Semantic search |
219
+ | `/api/v1/rag/query` | POST | RAG query |
220
+ | `/api/v1/graph/neuron/:id` | GET | Get neuron details |
221
+ | `/api/v1/graph/full` | GET | Get full graph |
222
+ | `/api/v1/health` | GET | Health check |
223
+ | `/api/v1/metrics` | GET | System metrics |
392
224
 
393
225
  ### CLI Commands
394
226
 
395
227
  | Category | Commands |
396
228
  |----------|----------|
229
+ | **Core** | `init`, `ingest`, `search`, `get`, `list`, `stats` |
397
230
  | **Inference** | `infer forward`, `backward`, `causal`, `bidirectional` |
398
231
  | **Learning** | `learn extract`, `session` |
399
232
  | **Attractor** | `attractor create`, `path`, `influence` |
400
233
  | **Dimension** | `dimension register`, `category`, `set` |
401
- | **Orchestrate** | `orchestrate infer`, `learn`, `feedback`, `reinforce` |
402
- | **Sync** | `sync status`, `changes`, `export`, `import`, `peers` |
403
- | **System** | `prob metrics`, `health`, `prometheus` |
234
+ | **Sync** | `sync status`, `changes`, `export`, `import` |
235
+ | **Verify** | `verify neuron`, `proof`, `diff`, `batch` |
236
+ | **System** | `prob metrics`, `health`, `dashboard` |
404
237
 
405
238
  ---
406
239
 
@@ -416,18 +249,38 @@ nmt-system/
416
249
 
417
250
  ---
418
251
 
252
+ ## Configuration
253
+
254
+ Create `.env` file in your project root:
255
+
256
+ ```env
257
+ # Data directory for LevelDB storage
258
+ DATA_DIR=./data
259
+
260
+ # Dashboard server port
261
+ PORT=3000
262
+
263
+ # HNSW Index Parameters
264
+ HNSW_M=16
265
+ HNSW_EF_CONSTRUCTION=200
266
+ HNSW_EF_SEARCH=50
267
+
268
+ # Text Chunking
269
+ CHUNK_SIZE=512
270
+ CHUNK_OVERLAP=50
271
+
272
+ # Logging
273
+ LOG_LEVEL=info
274
+ ```
275
+
276
+ ---
277
+
419
278
  ## Documentation
420
279
 
421
- ### English
422
- - [User Guide](docs/USER_GUIDE_EN.md)
423
- - [CLI API Reference](docs/CLI_API_EN.md)
280
+ - [User Guide (EN)](docs/USER_GUIDE_EN.md)
281
+ - [CLI API Reference (EN)](docs/CLI_API_EN.md)
424
282
  - [Architecture](docs/ARCHITECTURE.md)
425
- - [Quick Reference](docs/QUICK_REFERENCE.md)
426
-
427
- ### 한국어 (Korean)
428
- - [한글 문서](docs/README_KO.md)
429
- - [사용자 가이드](docs/USER_GUIDE.md)
430
- - [CLI API 레퍼런스](docs/CLI_API.md)
283
+ - [한국어 문서](docs/README_KO.md)
431
284
 
432
285
  ---
433
286
 
@@ -456,8 +309,9 @@ This project is licensed under the [NINEBIX Source Available License (NSAL) v1.0
456
309
 
457
310
  ## Acknowledgments
458
311
 
459
- - Built with TypeScript, React, Express, LevelDB
312
+ - Built with TypeScript, Express, LevelDB
460
313
  - Vector search powered by HNSW algorithm
314
+ - Embeddings by Xenova/transformers
461
315
  - Cryptographic hashing via SHA3-256
462
316
 
463
317
  ---