musubix 1.6.0 → 1.7.0

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.
@@ -17,10 +17,14 @@
17
17
  9. [Consistency Validation](#consistency-validation) *(v1.4.1)*
18
18
  10. [Advanced Inference](#advanced-inference) *(v1.4.5)*
19
19
  11. [Interactive REPL Mode](#interactive-repl-mode) *(v1.5.0)*
20
- 12. [MCP Server Integration](#mcp-server-integration)
21
- 13. [YATA Integration](#yata-integration)
22
- 14. [Best Practices](#best-practices)
23
- 15. [Troubleshooting](#troubleshooting)
20
+ 12. [YATA Local](#yata-local) *(v1.6.3)*
21
+ 13. [YATA Global](#yata-global) *(v1.6.3)*
22
+ 14. [KGPR - Knowledge Graph Pull Request](#kgpr---knowledge-graph-pull-request) *(v1.6.4)*
23
+ 15. [YATA Platform Enhancements](#yata-platform-enhancements) *(v1.7.0)*
24
+ 16. [MCP Server Integration](#mcp-server-integration)
25
+ 17. [YATA Integration](#yata-integration)
26
+ 18. [Best Practices](#best-practices)
27
+ 19. [Troubleshooting](#troubleshooting)
24
28
 
25
29
  ---
26
30
 
@@ -615,6 +619,480 @@ musubix> history clear
615
619
 
616
620
  ---
617
621
 
622
+ ## YATA Local
623
+
624
+ *(New in v1.6.3)*
625
+
626
+ YATA Local provides a high-performance, SQLite-based local knowledge graph with built-in inference capabilities. Designed for single-user, offline scenarios where data sovereignty and speed are critical.
627
+
628
+ ### Features
629
+
630
+ | Feature | Description |
631
+ |---------|-------------|
632
+ | **SQLite Storage** | WAL mode for concurrent reads, single-writer |
633
+ | **Full-Text Search** | FTS5-based triple search |
634
+ | **Graph Traversal** | BFS/DFS with depth control |
635
+ | **Inference Engine** | 4 OWL-lite rules (transitivity, symmetry, inverse, domain/range) |
636
+ | **Constraints** | 4 validation rules (cardinality, disjoint, unique, required) |
637
+ | **ACID Transactions** | Full transaction support |
638
+
639
+ ### Installation
640
+
641
+ ```bash
642
+ npm install @nahisaho/yata-local
643
+ ```
644
+
645
+ ### Quick Start
646
+
647
+ ```typescript
648
+ import { YataLocal } from '@nahisaho/yata-local';
649
+
650
+ // Initialize with default config
651
+ const yata = new YataLocal('./knowledge.db');
652
+ await yata.initialize();
653
+
654
+ // Add triples
655
+ await yata.addTriple({
656
+ subject: 'Person:john',
657
+ predicate: 'hasParent',
658
+ object: 'Person:mary'
659
+ });
660
+
661
+ // Query triples
662
+ const results = await yata.query({
663
+ subject: 'Person:john',
664
+ predicate: 'hasParent'
665
+ });
666
+
667
+ // Full-text search
668
+ const searchResults = await yata.search('john parent');
669
+
670
+ // Graph traversal (BFS)
671
+ const ancestors = await yata.traverse('Person:john', 'hasParent', {
672
+ direction: 'outgoing',
673
+ maxDepth: 5,
674
+ algorithm: 'bfs'
675
+ });
676
+
677
+ // Clean up
678
+ await yata.close();
679
+ ```
680
+
681
+ ### Inference Engine
682
+
683
+ YATA Local supports four OWL-lite inference rules:
684
+
685
+ | Rule | Description | Example |
686
+ |------|-------------|---------|
687
+ | **Transitivity** | If A→B and B→C then A→C | hasAncestor is transitive |
688
+ | **Symmetry** | If A→B then B→A | friendOf is symmetric |
689
+ | **Inverse** | If A→B via P then B→A via P⁻¹ | hasChild ↔ hasParent |
690
+ | **Domain/Range** | Type inference from predicate | hasAge implies Person |
691
+
692
+ ```typescript
693
+ // Run inference
694
+ const inferred = await yata.infer();
695
+ console.log(`Inferred ${inferred.length} new triples`);
696
+ ```
697
+
698
+ ### Constraints
699
+
700
+ ```typescript
701
+ // Define constraints
702
+ await yata.addConstraint({
703
+ type: 'cardinality',
704
+ predicate: 'hasSpouse',
705
+ max: 1
706
+ });
707
+
708
+ // Validate
709
+ const violations = await yata.validate();
710
+ if (violations.length > 0) {
711
+ console.error('Constraint violations:', violations);
712
+ }
713
+ ```
714
+
715
+ ### Configuration Options
716
+
717
+ ```typescript
718
+ const yata = new YataLocal('./knowledge.db', {
719
+ // WAL mode for better concurrency (default: true)
720
+ walMode: true,
721
+
722
+ // Enable FTS5 search (default: true)
723
+ enableSearch: true,
724
+
725
+ // Auto-run inference on writes (default: false)
726
+ autoInfer: false,
727
+
728
+ // Journal mode (default: 'wal')
729
+ journalMode: 'wal'
730
+ });
731
+ ```
732
+
733
+ ---
734
+
735
+ ## YATA Global
736
+
737
+ *(New in v1.6.3)*
738
+
739
+ YATA Global is a distributed knowledge graph platform for team collaboration. It provides REST API access to shared knowledge graphs with offline support and intelligent synchronization.
740
+
741
+ ### Features
742
+
743
+ | Feature | Description |
744
+ |---------|-------------|
745
+ | **REST API** | Full CRUD operations via HTTP |
746
+ | **Offline Cache** | SQLite-based local cache |
747
+ | **Sync Engine** | Push/Pull with conflict resolution |
748
+ | **Conflict Resolution** | Last-write-wins or custom strategies |
749
+ | **Authentication** | API key-based auth |
750
+ | **Batch Operations** | Bulk triple operations |
751
+
752
+ ### Installation
753
+
754
+ ```bash
755
+ npm install @nahisaho/yata-global
756
+ ```
757
+
758
+ ### Quick Start
759
+
760
+ ```typescript
761
+ import { YataGlobal } from '@nahisaho/yata-global';
762
+
763
+ // Initialize client
764
+ const yata = new YataGlobal({
765
+ endpoint: 'https://yata.example.com/api',
766
+ apiKey: 'your-api-key',
767
+ graphId: 'project-knowledge'
768
+ });
769
+
770
+ await yata.initialize();
771
+
772
+ // Add triples (batched)
773
+ await yata.addTriples([
774
+ { subject: 'Task:001', predicate: 'assignedTo', object: 'User:alice' },
775
+ { subject: 'Task:001', predicate: 'status', object: 'in-progress' }
776
+ ]);
777
+
778
+ // Query with filters
779
+ const tasks = await yata.query({
780
+ predicate: 'assignedTo',
781
+ object: 'User:alice'
782
+ });
783
+
784
+ // Clean up
785
+ await yata.close();
786
+ ```
787
+
788
+ ### Offline Support
789
+
790
+ YATA Global supports offline-first operation with automatic synchronization:
791
+
792
+ ```typescript
793
+ const yata = new YataGlobal({
794
+ endpoint: 'https://yata.example.com/api',
795
+ apiKey: 'your-api-key',
796
+ graphId: 'project-knowledge',
797
+
798
+ // Offline configuration
799
+ offlineMode: true,
800
+ cachePath: './yata-cache.db',
801
+ syncInterval: 60000 // Auto-sync every 60 seconds
802
+ });
803
+
804
+ // Works offline - cached locally
805
+ await yata.addTriple({
806
+ subject: 'Note:001',
807
+ predicate: 'content',
808
+ object: 'Important meeting notes'
809
+ });
810
+
811
+ // Manual sync when online
812
+ await yata.sync();
813
+ ```
814
+
815
+ ### Conflict Resolution
816
+
817
+ ```typescript
818
+ const yata = new YataGlobal({
819
+ // ... other options
820
+
821
+ conflictStrategy: 'last-write-wins', // Default
822
+ // or: 'server-wins', 'client-wins', 'manual'
823
+
824
+ onConflict: async (local, remote) => {
825
+ // Custom resolution logic
826
+ console.log('Conflict detected:', local, remote);
827
+ return remote; // Prefer remote version
828
+ }
829
+ });
830
+ ```
831
+
832
+ ### Sync Status
833
+
834
+ ```typescript
835
+ // Check sync status
836
+ const status = await yata.getSyncStatus();
837
+ console.log(`Pending changes: ${status.pendingPush}`);
838
+ console.log(`Last sync: ${status.lastSyncAt}`);
839
+
840
+ // Force full sync
841
+ await yata.sync({ force: true });
842
+ ```
843
+
844
+ ### When to Use YATA Local vs YATA Global
845
+
846
+ | Use Case | Recommended |
847
+ |----------|-------------|
848
+ | Personal knowledge base | YATA Local |
849
+ | Single-user application | YATA Local |
850
+ | Privacy-sensitive data | YATA Local |
851
+ | Team collaboration | YATA Global |
852
+ | Cross-device access | YATA Global |
853
+ | Shared project knowledge | YATA Global |
854
+ | Offline-first with sync | YATA Global |
855
+
856
+ ---
857
+
858
+ ## KGPR - Knowledge Graph Pull Request
859
+
860
+ *(v1.6.4)*
861
+
862
+ KGPR (Knowledge Graph Pull Request) enables safe sharing of knowledge graphs from YATA Local to YATA Global using a GitHub PR-like workflow.
863
+
864
+ ### Workflow
865
+
866
+ ```
867
+ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐
868
+ │ YATA Local │ ──► │ KGPR (Draft) │ ──► │ YATA Global │
869
+ │ (Local KG) │ │ (Extract) │ │ (Review/Merge)│
870
+ └─────────────┘ └──────────────┘ └───────────────┘
871
+
872
+ Status Flow:
873
+ draft → open → reviewing → approved/changes_requested → merged/closed
874
+ ```
875
+
876
+ ### Privacy Levels
877
+
878
+ | Level | Filtered Content |
879
+ |-------|------------------|
880
+ | `strict` | File paths, URLs, credentials, all metadata |
881
+ | `moderate` | File paths, URLs, credentials |
882
+ | `none` | No filtering |
883
+
884
+ ### CLI Commands
885
+
886
+ ```bash
887
+ # Create a KGPR
888
+ musubix kgpr create -t "Add authentication patterns"
889
+
890
+ # Preview diff before creating
891
+ musubix kgpr diff --namespace myproject --privacy moderate
892
+
893
+ # List KGPRs
894
+ musubix kgpr list
895
+
896
+ # Submit KGPR for review
897
+ musubix kgpr submit <id>
898
+
899
+ # Show KGPR details
900
+ musubix kgpr show <id>
901
+
902
+ # Close without merging
903
+ musubix kgpr close <id>
904
+ ```
905
+
906
+ ### MCP Tools
907
+
908
+ | Tool | Description |
909
+ |------|-------------|
910
+ | `kgpr_create` | Create KGPR from local knowledge graph |
911
+ | `kgpr_diff` | Preview diff before creating KGPR |
912
+ | `kgpr_list` | List all KGPRs |
913
+ | `kgpr_submit` | Submit KGPR for review |
914
+ | `kgpr_review` | Review KGPR (approve/changes_requested/commented) |
915
+
916
+ ### Example Usage
917
+
918
+ ```bash
919
+ # 1. Preview what will be shared
920
+ musubix kgpr diff --privacy strict
921
+
922
+ # 2. Create KGPR with description
923
+ musubix kgpr create -t "Share React patterns" -d "Learned patterns from project-x"
924
+
925
+ # 3. Review the KGPR
926
+ musubix kgpr show KGPR-001
927
+
928
+ # 4. Submit for review
929
+ musubix kgpr submit KGPR-001
930
+ ```
931
+
932
+ ---
933
+
934
+ ## YATA Platform Enhancements
935
+
936
+ *(v1.7.0)*
937
+
938
+ Version 1.7.0 introduces significant enhancements to the YATA platform with 5 major features.
939
+
940
+ ### Phase 1: Index Optimization
941
+
942
+ Optimized query performance for YATA Local with composite indexes.
943
+
944
+ ```typescript
945
+ import { IndexOptimizer } from '@nahisaho/yata-local';
946
+
947
+ const optimizer = new IndexOptimizer(database);
948
+
949
+ // Analyze and create optimal indexes
950
+ const analysis = await optimizer.analyzeQueryPatterns();
951
+ const created = await optimizer.createOptimalIndexes();
952
+
953
+ // Check index health
954
+ const health = await optimizer.checkIndexHealth();
955
+ ```
956
+
957
+ **Key Features:**
958
+ - Composite index creation for common query patterns
959
+ - Index health monitoring with fragmentation detection
960
+ - Automatic optimization recommendations
961
+
962
+ ### Phase 2: Enhanced Export Pipeline
963
+
964
+ Powerful export capabilities with incremental export and multiple formats.
965
+
966
+ ```typescript
967
+ import { ExportPipeline } from '@nahisaho/yata-local';
968
+
969
+ const pipeline = new ExportPipeline(database);
970
+
971
+ // Full export
972
+ const fullData = await pipeline.exportFull({ namespace: 'myproject' });
973
+
974
+ // Incremental export (changes since last export)
975
+ const changes = await pipeline.exportIncremental({
976
+ since: lastExportTimestamp,
977
+ format: 'json'
978
+ });
979
+
980
+ // Export with transformation
981
+ const transformed = await pipeline.exportWithTransform({
982
+ format: 'rdf',
983
+ includeMetadata: true
984
+ });
985
+ ```
986
+
987
+ **Supported Formats:**
988
+ - JSON (default)
989
+ - RDF/Turtle
990
+ - N-Triples
991
+ - Custom transformers
992
+
993
+ ### Phase 3: Global Sync Integration
994
+
995
+ Seamless synchronization between YATA Local and YATA Global.
996
+
997
+ ```typescript
998
+ import { GlobalSyncClient, SyncEngine } from '@nahisaho/yata-global';
999
+
1000
+ const client = new GlobalSyncClient({
1001
+ endpoint: 'https://yata-global.example.com',
1002
+ offlineMode: true
1003
+ });
1004
+
1005
+ // Initialize sync
1006
+ await client.initialize();
1007
+
1008
+ // Push local changes
1009
+ const syncResult = await client.sync({
1010
+ namespace: 'myproject',
1011
+ direction: 'push'
1012
+ });
1013
+
1014
+ // Pull updates from global
1015
+ await client.sync({
1016
+ namespace: 'shared-patterns',
1017
+ direction: 'pull'
1018
+ });
1019
+ ```
1020
+
1021
+ **Features:**
1022
+ - Offline-first with automatic sync
1023
+ - Conflict resolution strategies
1024
+ - Selective namespace sync
1025
+ - Framework pattern repository
1026
+
1027
+ ### Phase 4: Code Generator Enhancement
1028
+
1029
+ Advanced code generation from design documents.
1030
+
1031
+ ```typescript
1032
+ import { CodeGenerator } from '@nahisaho/yata-local';
1033
+
1034
+ const generator = new CodeGenerator({
1035
+ language: 'typescript',
1036
+ outputDir: './src/generated'
1037
+ });
1038
+
1039
+ // Generate from C4 design
1040
+ const result = await generator.generateFromC4(designDocument);
1041
+
1042
+ // Generate with custom templates
1043
+ await generator.generate({
1044
+ template: 'repository-pattern',
1045
+ context: { entityName: 'User' }
1046
+ });
1047
+ ```
1048
+
1049
+ **Supported Patterns:**
1050
+ - Repository Pattern
1051
+ - Service Layer
1052
+ - Factory Pattern
1053
+ - Domain Events
1054
+ - Value Objects
1055
+
1056
+ ### Phase 5: YATA UI (Web Visualization)
1057
+
1058
+ Web-based visualization and management interface for knowledge graphs.
1059
+
1060
+ ```typescript
1061
+ import { YataUIServer, createYataUIServer } from '@nahisaho/yata-ui';
1062
+
1063
+ // Create and start server
1064
+ const server = createYataUIServer({
1065
+ port: 3000,
1066
+ enableRealtime: true
1067
+ });
1068
+
1069
+ // Set data provider
1070
+ server.setDataProvider(async () => ({
1071
+ nodes: await getEntities(),
1072
+ edges: await getRelationships()
1073
+ }));
1074
+
1075
+ await server.start();
1076
+ console.log(`UI available at ${server.getUrl()}`);
1077
+ ```
1078
+
1079
+ **UI Features:**
1080
+ - Interactive graph visualization
1081
+ - Real-time updates via WebSocket
1082
+ - Namespace filtering
1083
+ - Entity/Relationship editing
1084
+ - Export/Import functionality
1085
+
1086
+ ### v1.7.0 Package Summary
1087
+
1088
+ | Package | Description |
1089
+ |---------|-------------|
1090
+ | `@nahisaho/yata-local` | IndexOptimizer, ExportPipeline, CodeGenerator |
1091
+ | `@nahisaho/yata-global` | GlobalSyncClient, SyncEngine, CacheManager |
1092
+ | `@nahisaho/yata-ui` | YataUIServer, Graph visualization |
1093
+
1094
+ ---
1095
+
618
1096
  ## MCP Server Integration
619
1097
 
620
1098
  ### CLI Startup
@@ -1225,6 +1703,6 @@ const client = createYATAClient({
1225
1703
 
1226
1704
  ---
1227
1705
 
1228
- **Version**: 1.4.5
1229
- **Last Updated**: 2026-01-05
1706
+ **Version**: 1.6.0
1707
+ **Last Updated**: 2026-01-06
1230
1708
  **MUSUBIX Project**