musubix 1.0.1 → 1.0.3

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.
@@ -0,0 +1,664 @@
1
+ # MUSUBIX User Guide
2
+
3
+ > Neuro-Symbolic AI Coding with Ultimate Specification Driven Development
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Introduction](#introduction)
10
+ 2. [Installation](#installation)
11
+ 3. [CLI Usage](#cli-usage)
12
+ 4. [Quick Start](#quick-start)
13
+ 5. [SDD Workflow](#sdd-workflow)
14
+ 6. [MCP Server Integration](#mcp-server-integration)
15
+ 7. [YATA Integration](#yata-integration)
16
+ 8. [Best Practices](#best-practices)
17
+ 9. [Troubleshooting](#troubleshooting)
18
+
19
+ ---
20
+
21
+ ## Introduction
22
+
23
+ ### What is MUSUBIX?
24
+
25
+ **MUSUBIX** is an Ultimate Specification Driven Development (SDD) platform based on Neuro-Symbolic AI. By integrating MUSUBI (SDD Engine) with YATA (Knowledge Graph), it provides an AI-assisted development environment that maintains requirements, design, and implementation consistency.
26
+
27
+ ### 9 Constitutional Articles
28
+
29
+ MUSUBIX development follows 9 Articles:
30
+
31
+ | Article | Description |
32
+ |---------|-------------|
33
+ | Article 1 | EARS-format requirements |
34
+ | Article 2 | C4 architecture design |
35
+ | Article 3 | ADR-based technical decisions |
36
+ | Article 4 | Test-first development (TDD) |
37
+ | Article 5 | Full requirement traceability |
38
+ | Article 6 | CI/CD automation |
39
+ | Article 7 | Knowledge graph management |
40
+ | Article 8 | AI-assisted code review |
41
+ | Article 9 | Continuous quality improvement |
42
+
43
+ ---
44
+
45
+ ## Installation
46
+
47
+ ### System Requirements
48
+
49
+ - Node.js: >= 20.0.0
50
+ - npm: >= 10.0.0
51
+ - TypeScript: >= 5.3
52
+
53
+ ### Method 1: Global Installation (Recommended)
54
+
55
+ ```bash
56
+ # Global installation
57
+ npm install -g musubix
58
+
59
+ # Verify installation
60
+ musubix --version
61
+ ```
62
+
63
+ ### Method 2: Using npx
64
+
65
+ ```bash
66
+ # Initialize project without installation
67
+ npx musubix init my-project
68
+
69
+ # Project templates
70
+ npx musubix init my-app --template typescript
71
+ npx musubix init my-api --template node
72
+ npx musubix init my-web --template react
73
+ ```
74
+
75
+ ### Method 3: Project Dependency
76
+
77
+ ```bash
78
+ # Add to existing project
79
+ npm install musubix
80
+
81
+ # Use with npx
82
+ npx musubix --help
83
+ ```
84
+
85
+ ### Method 4: From Source
86
+
87
+ ```bash
88
+ # Clone repository
89
+ git clone https://github.com/nahisaho/MUSUBIX.git
90
+ cd MUSUBIX
91
+
92
+ # Install dependencies
93
+ npm install
94
+
95
+ # Build
96
+ npm run build
97
+
98
+ # Global link
99
+ npm link
100
+ ```
101
+
102
+ ### YATA Installation (Optional)
103
+
104
+ If you want to use knowledge graph features, install YATA separately:
105
+
106
+ ```bash
107
+ # Install uv (if not installed)
108
+ curl -LsSf https://astral.sh/uv/install.sh | sh
109
+
110
+ # Clone YATA
111
+ git clone https://github.com/nahisaho/YATA.git
112
+ cd YATA
113
+
114
+ # Create Python environment
115
+ uv venv
116
+ source .venv/bin/activate # Linux/macOS
117
+ # or .venv\Scripts\activate # Windows
118
+
119
+ # Install dependencies
120
+ uv pip install -e ".[dev]"
121
+ ```
122
+
123
+ ---
124
+
125
+ ## CLI Usage
126
+
127
+ ### musubix Command
128
+
129
+ Main command for project management:
130
+
131
+ ```bash
132
+ # Initialize project
133
+ musubix init <project-name>
134
+
135
+ # Available templates
136
+ musubix init my-project --template typescript
137
+ musubix init my-project --template node
138
+ musubix init my-project --template react
139
+
140
+ # Help
141
+ musubix --help
142
+
143
+ # Version
144
+ musubix --version
145
+ ```
146
+
147
+ ### musubix-mcp Command
148
+
149
+ Start MCP server for AI platform integration:
150
+
151
+ ```bash
152
+ # Start with stdio transport (default)
153
+ musubix-mcp
154
+
155
+ # Start with SSE transport
156
+ musubix-mcp --transport sse --port 3000
157
+
158
+ # Help
159
+ musubix-mcp --help
160
+
161
+ # Version
162
+ musubix-mcp --version
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Quick Start
168
+
169
+ ### Basic TypeScript Usage
170
+
171
+ ```typescript
172
+ import {
173
+ createRequirementsService,
174
+ createDesignService,
175
+ createValidationService
176
+ } from 'musubix';
177
+
178
+ // Create services
179
+ const requirements = createRequirementsService();
180
+ const design = createDesignService();
181
+ const validation = createValidationService();
182
+
183
+ // Add requirement (EARS format)
184
+ const req = requirements.addRequirement({
185
+ id: 'REQ-001',
186
+ text: 'When a user logs in, the system shall authenticate the user',
187
+ priority: 'high',
188
+ acceptanceCriteria: [
189
+ 'JWT token shall be returned on successful login',
190
+ 'Error message shall be displayed on failure'
191
+ ]
192
+ });
193
+
194
+ // Create design
195
+ const des = design.createComponent({
196
+ id: 'DES-001',
197
+ name: 'AuthModule',
198
+ type: 'component',
199
+ requirements: ['REQ-001'],
200
+ decisions: ['Use JWT authentication']
201
+ });
202
+
203
+ // Validate
204
+ const result = validation.validate({
205
+ requirements: [req],
206
+ designs: [des]
207
+ });
208
+
209
+ console.log(result.compliant); // true or false
210
+ ```
211
+
212
+ ### SDD Workflow Overview
213
+
214
+ ```
215
+ ┌─────────────────┐
216
+ │ Requirements │ EARS format requirements
217
+ └────────┬────────┘
218
+
219
+ ┌─────────────────┐
220
+ │ Design │ C4 Architecture + ADR
221
+ └────────┬────────┘
222
+
223
+ ┌─────────────────┐
224
+ │ Tasks │ Traceable implementation tasks
225
+ └────────┬────────┘
226
+
227
+ ┌─────────────────┐
228
+ │ Validation │ 9 Articles compliance check
229
+ └─────────────────┘
230
+ ```
231
+
232
+ ---
233
+
234
+ ## SDD Workflow
235
+
236
+ ### Phase 1: Requirements (EARS Format)
237
+
238
+ Use EARS (Easy Approach to Requirements Syntax) format for requirements:
239
+
240
+ ```typescript
241
+ const requirements = createRequirementsService();
242
+
243
+ // Pattern: "When <trigger>, the system shall <response>"
244
+ const loginReq = requirements.addRequirement({
245
+ id: 'REQ-001',
246
+ text: 'When a user enters valid credentials, the system shall issue an authentication token',
247
+ priority: 'high',
248
+ acceptanceCriteria: [
249
+ 'Token shall be valid for 24 hours',
250
+ 'Token shall include user information'
251
+ ]
252
+ });
253
+
254
+ // Pattern: "While <state>, the system shall <behavior>"
255
+ const sessionReq = requirements.addRequirement({
256
+ id: 'REQ-002',
257
+ text: 'While a session is active, the system shall maintain user state',
258
+ priority: 'medium'
259
+ });
260
+
261
+ // Get all requirements
262
+ const allReqs = requirements.getAllRequirements();
263
+ console.log(`Total requirements: ${allReqs.length}`);
264
+ ```
265
+
266
+ ### Phase 2: Design (C4 + ADR)
267
+
268
+ #### C4 Model
269
+
270
+ Design at 4 levels:
271
+
272
+ ```typescript
273
+ const design = createDesignService();
274
+
275
+ // Level 1: Context
276
+ const system = design.createContainer({
277
+ id: 'SYS-001',
278
+ name: 'MUSUBIX System',
279
+ type: 'system',
280
+ description: 'Neuro-Symbolic AI-based SDD platform'
281
+ });
282
+
283
+ // Level 2: Container
284
+ const apiServer = design.createContainer({
285
+ id: 'CON-001',
286
+ name: 'API Server',
287
+ type: 'container',
288
+ parent: 'SYS-001',
289
+ technology: 'Node.js + Express'
290
+ });
291
+
292
+ // Level 3: Component
293
+ const authModule = design.createComponent({
294
+ id: 'COMP-001',
295
+ name: 'Authentication Module',
296
+ type: 'component',
297
+ parent: 'CON-001',
298
+ requirements: ['REQ-001']
299
+ });
300
+ ```
301
+
302
+ #### ADR (Architecture Decision Record)
303
+
304
+ Document technical decisions:
305
+
306
+ ```typescript
307
+ const adr = design.createADR({
308
+ id: 'ADR-001',
309
+ title: 'JWT for Authentication',
310
+ context: 'Need to select stateless authentication method',
311
+ decision: 'Use JWT',
312
+ status: 'accepted',
313
+ consequences: [
314
+ 'Positive: Stateless, scalable',
315
+ 'Negative: Token revocation requires additional implementation'
316
+ ],
317
+ relatedRequirements: ['REQ-001']
318
+ });
319
+ ```
320
+
321
+ ### Phase 3: Tasks
322
+
323
+ Break down requirements and designs into implementation tasks:
324
+
325
+ ```typescript
326
+ const tasks = createTaskService();
327
+
328
+ // Create task linked to requirements
329
+ const task = tasks.createTask({
330
+ id: 'TASK-001',
331
+ title: 'Implement JWT authentication',
332
+ description: 'Implement JWT-based authentication module',
333
+ requirements: ['REQ-001'],
334
+ designs: ['COMP-001'],
335
+ estimatedHours: 4,
336
+ acceptanceCriteria: [
337
+ 'Login API endpoint completed',
338
+ 'JWT generation/validation tests passing'
339
+ ]
340
+ });
341
+
342
+ // Track progress
343
+ tasks.updateProgress('TASK-001', {
344
+ status: 'in-progress',
345
+ completedItems: ['Login API endpoint completed']
346
+ });
347
+ ```
348
+
349
+ ### Phase 4: Validation
350
+
351
+ Check compliance with 9 Constitutional Articles:
352
+
353
+ ```typescript
354
+ const validation = createValidationService();
355
+
356
+ // Full validation
357
+ const result = validation.validateAll({
358
+ requirements: requirements.getAllRequirements(),
359
+ designs: design.getAllDesigns(),
360
+ tasks: tasks.getAllTasks()
361
+ });
362
+
363
+ // Check results
364
+ console.log('Compliant:', result.compliant);
365
+ console.log('Score:', result.score);
366
+
367
+ // Check details by Article
368
+ result.articleResults.forEach(article => {
369
+ console.log(`Article ${article.number}: ${article.passed ? '✓' : '✗'}`);
370
+ if (!article.passed) {
371
+ console.log(' Issues:', article.issues);
372
+ }
373
+ });
374
+ ```
375
+
376
+ ---
377
+
378
+ ## MCP Server Integration
379
+
380
+ ### CLI Startup
381
+
382
+ ```bash
383
+ # Default (stdio transport)
384
+ musubix-mcp
385
+
386
+ # SSE transport
387
+ musubix-mcp --transport sse --port 3000
388
+
389
+ # WebSocket transport
390
+ musubix-mcp --transport websocket --port 3001
391
+ ```
392
+
393
+ ### Programmatic Startup
394
+
395
+ ```typescript
396
+ import { startServer, createMCPServer } from '@nahisaho/musubix-mcp-server';
397
+
398
+ // Simple startup
399
+ await startServer();
400
+
401
+ // Startup with options
402
+ const server = createMCPServer({
403
+ transport: 'sse',
404
+ port: 3000
405
+ });
406
+ await server.start();
407
+ ```
408
+
409
+ ### AI Platform Integration
410
+
411
+ #### GitHub Copilot (VS Code)
412
+
413
+ Add to `.vscode/settings.json`:
414
+
415
+ ```json
416
+ {
417
+ "github.copilot.chat.mcpServers": {
418
+ "musubix": {
419
+ "command": "musubix-mcp",
420
+ "args": ["--transport", "stdio"]
421
+ }
422
+ }
423
+ }
424
+ ```
425
+
426
+ #### Claude Desktop
427
+
428
+ Add to Claude configuration file (`~/.config/claude/config.json` or similar):
429
+
430
+ ```json
431
+ {
432
+ "mcpServers": {
433
+ "musubix": {
434
+ "command": "musubix-mcp",
435
+ "args": []
436
+ }
437
+ }
438
+ }
439
+ ```
440
+
441
+ #### Cursor
442
+
443
+ Add to `.cursor/mcp.json`:
444
+
445
+ ```json
446
+ {
447
+ "mcpServers": {
448
+ "musubix": {
449
+ "command": "musubix-mcp",
450
+ "args": ["--transport", "stdio"]
451
+ }
452
+ }
453
+ }
454
+ ```
455
+
456
+ ### Available MCP Tools
457
+
458
+ | Tool Name | Description |
459
+ |-----------|-------------|
460
+ | `create_requirement` | Create EARS-format requirement |
461
+ | `validate_requirements` | Validate requirements |
462
+ | `create_design` | Create C4 design element |
463
+ | `create_adr` | Create ADR |
464
+ | `create_task` | Create implementation task |
465
+ | `validate_all` | Full 9 Articles compliance check |
466
+ | `get_traceability` | Get traceability matrix |
467
+
468
+ ---
469
+
470
+ ## YATA Integration
471
+
472
+ ### What is YATA?
473
+
474
+ **YATA** (Yet Another Thinking Agent) is a knowledge graph management MCP server that stores and retrieves expertise and know-how as structured data. **Note: YATA is a separate Python-based installation.**
475
+
476
+ ### Architecture
477
+
478
+ ```
479
+ ┌─────────────────────────────────────────┐
480
+ │ AI Platform │
481
+ │ (GitHub Copilot, Claude, etc.) │
482
+ └─────────────┬───────────────────────────┘
483
+ │ MCP Protocol
484
+ ┌───────┴───────┐
485
+ ↓ ↓
486
+ ┌──────────┐ ┌──────────┐
487
+ │ MUSUBIX │ │ YATA │
488
+ │ MCP │ │ MCP │
489
+ │ Server │ │ Server │
490
+ └────┬─────┘ └────┬─────┘
491
+ │ │
492
+ ↓ ↓
493
+ ┌──────────┐ ┌──────────┐
494
+ │ SDD │ │ Knowledge│
495
+ │ Engine │ │ Graph │
496
+ └──────────┘ └──────────┘
497
+ ```
498
+
499
+ ### YATA Client (from MUSUBIX)
500
+
501
+ ```typescript
502
+ import { createYATAClient } from '@nahisaho/musubix-yata-client';
503
+
504
+ // Create client
505
+ const yata = createYATAClient({
506
+ endpoint: 'http://localhost:8000',
507
+ apiKey: process.env.YATA_API_KEY
508
+ });
509
+
510
+ // Save knowledge
511
+ await yata.addKnowledge({
512
+ topic: 'jwt-authentication',
513
+ content: 'Best practices for JWT implementation',
514
+ tags: ['security', 'authentication'],
515
+ relatedRequirements: ['REQ-001']
516
+ });
517
+
518
+ // Search knowledge
519
+ const results = await yata.search({
520
+ query: 'authentication best practices',
521
+ limit: 10
522
+ });
523
+ ```
524
+
525
+ ### YATA Features
526
+
527
+ | Feature | Description |
528
+ |---------|-------------|
529
+ | 34 MCP Tools | Read/write/query knowledge graphs |
530
+ | 47 Frameworks | TypeScript, Python, React, etc. |
531
+ | Vector Search | Semantic knowledge search |
532
+ | Relationship Mapping | Connect knowledge nodes |
533
+
534
+ ---
535
+
536
+ ## Best Practices
537
+
538
+ ### 1. Requirements Best Practices
539
+
540
+ ✅ **Recommended**:
541
+ - Use EARS format
542
+ - Include verifiable acceptance criteria
543
+ - One function per requirement
544
+
545
+ ❌ **Avoid**:
546
+ - Vague expressions ("appropriately", "quickly", etc.)
547
+ - Multiple functions in one requirement
548
+ - Implementation details in requirements
549
+
550
+ ### 2. Design Best Practices
551
+
552
+ ✅ **Recommended**:
553
+ - Utilize all 4 C4 levels
554
+ - Document important decisions with ADR
555
+ - Maintain traceability to requirements
556
+
557
+ ❌ **Avoid**:
558
+ - Over-detailed initial design
559
+ - Omitting decision rationale
560
+ - Isolated design documents
561
+
562
+ ### 3. Task Management Best Practices
563
+
564
+ ✅ **Recommended**:
565
+ - Granularity within 4 hours
566
+ - Clear links to requirements
567
+ - Explicit completion criteria
568
+
569
+ ❌ **Avoid**:
570
+ - Tasks too large (8+ hours)
571
+ - Tasks without requirement links
572
+ - Vague completion criteria
573
+
574
+ ---
575
+
576
+ ## Troubleshooting
577
+
578
+ ### Common Problems and Solutions
579
+
580
+ #### Requirements Validation Error
581
+
582
+ ```
583
+ Error: EARS format not detected
584
+ ```
585
+
586
+ **Solution**: Include an EARS pattern in your requirement text.
587
+
588
+ ```typescript
589
+ // Before
590
+ const text = 'Implement authentication feature';
591
+
592
+ // After
593
+ const text = 'When a user logs in, the system shall perform authentication';
594
+ ```
595
+
596
+ #### Traceability Warning
597
+
598
+ ```
599
+ Warning: Requirement REQ-001 has no design reference
600
+ ```
601
+
602
+ **Solution**: Create a design document and link it.
603
+
604
+ ```typescript
605
+ requirementsService.linkDesign('REQ-001', 'DES-001');
606
+ ```
607
+
608
+ #### MCP Server Connection Error
609
+
610
+ ```
611
+ Error: Cannot connect to MCP server
612
+ ```
613
+
614
+ **Solution**:
615
+ 1. Verify server is running
616
+ 2. Check port number
617
+ 3. Check firewall settings
618
+
619
+ ```bash
620
+ # Check server status
621
+ ps aux | grep musubix
622
+ ```
623
+
624
+ #### YATA Connection Error
625
+
626
+ ```
627
+ Error: Cannot connect to YATA endpoint
628
+ ```
629
+
630
+ **Solution**:
631
+ 1. Verify endpoint URL
632
+ 2. Check API key
633
+ 3. Check network settings
634
+
635
+ ```typescript
636
+ const client = createYATAClient({
637
+ endpoint: 'http://localhost:8000', // Correct URL
638
+ apiKey: process.env.YATA_API_KEY // Verify environment variable
639
+ });
640
+ ```
641
+
642
+ ---
643
+
644
+ ## Next Steps
645
+
646
+ - 📚 See [API Reference](./API-REFERENCE.md)
647
+ - 💡 Check [Sample Projects](./examples/)
648
+ - 🤝 Read [Contribution Guide](./CONTRIBUTING.md)
649
+
650
+ ---
651
+
652
+ ## Related Documents
653
+
654
+ | Document | Description |
655
+ |----------|-------------|
656
+ | [INSTALL-GUIDE.md](INSTALL-GUIDE.md) | Detailed installation guide |
657
+ | [API-REFERENCE.md](API-REFERENCE.md) | API reference |
658
+ | [evolution-from-musubi-to-musubix.md](evolution-from-musubi-to-musubix.md) | Evolution from MUSUBI |
659
+
660
+ ---
661
+
662
+ **Version**: 1.0.0
663
+ **Last Updated**: 2026-01-02
664
+ **MUSUBIX Project**