@soulcraft/brainy 5.6.1 β 5.6.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/CHANGELOG.md +6 -0
- package/README.md +116 -119
- package/dist/augmentations/typeMatching/brainyTypes.js +30 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [5.6.2](https://github.com/soulcraftlabs/brainy/compare/v5.6.1...v5.6.2) (2025-11-11)
|
|
6
|
+
|
|
7
|
+
- fix: update tests for Stage 3 CANONICAL taxonomy (42 nouns, 127 verbs) (c5dcdf6)
|
|
8
|
+
- docs: restructure README for better new user flow (2d3f59e)
|
|
9
|
+
|
|
10
|
+
|
|
5
11
|
## [5.6.1](https://github.com/soulcraftlabs/brainy/compare/v5.6.0...v5.6.1) (2025-11-11)
|
|
6
12
|
|
|
7
13
|
### π Bug Fixes
|
package/README.md
CHANGED
|
@@ -32,6 +32,25 @@ await brain.init()
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
+
## π Choose Your Path
|
|
36
|
+
|
|
37
|
+
**New to Brainy? Pick your starting point:**
|
|
38
|
+
|
|
39
|
+
### π Path 1: I want to build something NOW
|
|
40
|
+
**β [Complete API Reference](docs/api/README.md)** β **Most developers start here** β
|
|
41
|
+
- Every method documented with examples
|
|
42
|
+
- Quick start in 60 seconds
|
|
43
|
+
- 1,870 lines of copy-paste ready code
|
|
44
|
+
- **This is your primary resource**
|
|
45
|
+
|
|
46
|
+
### π§ Path 2: I want to understand the big picture first
|
|
47
|
+
**β Keep reading below** for demos, architecture, and use cases
|
|
48
|
+
|
|
49
|
+
### π Path 3: I'm evaluating database options
|
|
50
|
+
**β Jump to [Why Revolutionary](#why-brainy-is-revolutionary)** or **[Benchmarks](#benchmarks)**
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
35
54
|
## See It In Action
|
|
36
55
|
|
|
37
56
|
**30 seconds to understand why Brainy is different:**
|
|
@@ -72,98 +91,96 @@ const results = await brain.find({
|
|
|
72
91
|
|
|
73
92
|
---
|
|
74
93
|
|
|
75
|
-
##
|
|
94
|
+
## Quick Start
|
|
76
95
|
|
|
77
|
-
|
|
96
|
+
```bash
|
|
97
|
+
npm install @soulcraft/brainy
|
|
98
|
+
```
|
|
78
99
|
|
|
79
|
-
###
|
|
100
|
+
### Your First Knowledge Graph (60 seconds)
|
|
80
101
|
|
|
81
102
|
```javascript
|
|
82
|
-
|
|
103
|
+
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
|
104
|
+
|
|
83
105
|
const brain = new Brainy()
|
|
84
106
|
await brain.init()
|
|
85
107
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
// Add knowledge
|
|
109
|
+
const jsId = await brain.add({
|
|
110
|
+
data: "JavaScript is a programming language",
|
|
111
|
+
type: NounType.Concept,
|
|
112
|
+
metadata: { category: "language", year: 1995 }
|
|
113
|
+
})
|
|
89
114
|
|
|
90
|
-
|
|
115
|
+
const nodeId = await brain.add({
|
|
116
|
+
data: "Node.js runtime environment",
|
|
117
|
+
type: NounType.Concept,
|
|
118
|
+
metadata: { category: "runtime", year: 2009 }
|
|
119
|
+
})
|
|
91
120
|
|
|
92
|
-
|
|
121
|
+
// Create relationships
|
|
122
|
+
await brain.relate({ from: nodeId, to: jsId, type: VerbType.Executes })
|
|
93
123
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
path: './brainy-data',
|
|
100
|
-
compression: true // 60-80% space savings
|
|
101
|
-
}
|
|
124
|
+
// Query with Triple Intelligence
|
|
125
|
+
const results = await brain.find({
|
|
126
|
+
query: "JavaScript", // π Vector
|
|
127
|
+
where: { category: "language" }, // π Document
|
|
128
|
+
connected: { from: nodeId, depth: 1 } // πΈοΈ Graph
|
|
102
129
|
})
|
|
103
130
|
```
|
|
104
131
|
|
|
105
|
-
**
|
|
106
|
-
|
|
107
|
-
**
|
|
132
|
+
**Done.** No configuration. No complexity. Production-ready from day one.
|
|
133
|
+
|
|
134
|
+
**β Ready to dive deeper? [Complete API Documentation](docs/api/README.md)** has every method with examples.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## From Prototype to Planet Scale
|
|
108
139
|
|
|
109
|
-
|
|
140
|
+
**The same API. Zero rewrites. Any scale.**
|
|
110
141
|
|
|
142
|
+
### π€ Individual Developer β Weekend Prototype
|
|
143
|
+
```javascript
|
|
144
|
+
const brain = new Brainy() // Zero config, starts in memory
|
|
145
|
+
await brain.init()
|
|
146
|
+
```
|
|
147
|
+
**Perfect for:** Hackathons, side projects, prototyping, learning
|
|
148
|
+
|
|
149
|
+
### π₯ Small Team β Production MVP
|
|
111
150
|
```javascript
|
|
112
|
-
// Scale to cloud - same API
|
|
113
151
|
const brain = new Brainy({
|
|
114
|
-
storage: {
|
|
115
|
-
type: 's3',
|
|
116
|
-
s3Storage: {
|
|
117
|
-
bucketName: 'my-knowledge-base',
|
|
118
|
-
region: 'us-east-1'
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
hnsw: { typeAware: true } // 87% memory reduction
|
|
152
|
+
storage: { type: 'filesystem', path: './data', compression: true }
|
|
122
153
|
})
|
|
123
154
|
```
|
|
155
|
+
**Scale:** Thousands to hundreds of thousands β’ **Performance:** <5ms queries
|
|
124
156
|
|
|
125
|
-
|
|
126
|
-
**Scale:** Millions of entities
|
|
127
|
-
**Performance:** <10ms queries, 12GB memory @ 10M entities
|
|
128
|
-
**Features:** Auto-scaling, distributed storage, cost optimization (96% savings)
|
|
129
|
-
|
|
130
|
-
### π **Enterprise / Planet Scale** β Billion+ Entities
|
|
131
|
-
|
|
157
|
+
### π’ Growing Company β Multi-Million Scale
|
|
132
158
|
```javascript
|
|
133
|
-
// Billion-scale - STILL the same API
|
|
134
159
|
const brain = new Brainy({
|
|
135
|
-
storage: {
|
|
136
|
-
|
|
137
|
-
gcsStorage: { bucketName: 'global-knowledge' }
|
|
138
|
-
},
|
|
139
|
-
hnsw: {
|
|
140
|
-
typeAware: true,
|
|
141
|
-
M: 32,
|
|
142
|
-
efConstruction: 400
|
|
143
|
-
}
|
|
160
|
+
storage: { type: 's3', s3Storage: { bucketName: 'my-kb', region: 'us-east-1' } },
|
|
161
|
+
hnsw: { typeAware: true } // 87% memory reduction
|
|
144
162
|
})
|
|
163
|
+
```
|
|
164
|
+
**Scale:** Millions of entities β’ **Performance:** <10ms queries, 12GB @ 10M entities
|
|
145
165
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
### π Enterprise β Billion+ Scale
|
|
167
|
+
```javascript
|
|
168
|
+
const brain = new Brainy({
|
|
169
|
+
storage: { type: 'gcs', gcsStorage: { bucketName: 'global-kb' } },
|
|
170
|
+
hnsw: { typeAware: true, M: 32, efConstruction: 400 }
|
|
149
171
|
})
|
|
150
172
|
```
|
|
151
|
-
|
|
152
|
-
**Perfect for:** Fortune 500, global platforms, research institutions, government
|
|
153
|
-
**Scale:** Billions of entities (tested at 1B+)
|
|
154
|
-
**Performance:** 18ms queries @ 1B scale, 50GB memory (87% reduction)
|
|
173
|
+
**Scale:** Billions (tested @ 1B+) β’ **Performance:** 18ms queries, 50GB memory
|
|
155
174
|
**Cost:** $138k/year β $6k/year with intelligent tiering (96% savings)
|
|
156
|
-
**Features:** Sharding, replication, monitoring, enterprise SLAs
|
|
157
175
|
|
|
158
|
-
|
|
176
|
+
**β [Capacity Planning Guide](docs/operations/capacity-planning.md)** | **[Cost Optimization](docs/operations/)**
|
|
159
177
|
|
|
160
|
-
|
|
178
|
+
### π― The Point
|
|
161
179
|
|
|
162
|
-
|
|
163
|
-
- Simple but doesn't scale (SQLite, Redis)
|
|
164
|
-
- Scales but complex (Kubernetes + 7 databases)
|
|
180
|
+
**Start simple. Scale infinitely. Never rewrite.**
|
|
165
181
|
|
|
166
|
-
|
|
182
|
+
Most systems make you choose: Simple (SQLite) OR Scalable (Kubernetes + 7 databases).
|
|
183
|
+
**Brainy gives you both.** Starts simple as SQLite. Scales like Google.
|
|
167
184
|
|
|
168
185
|
---
|
|
169
186
|
|
|
@@ -296,48 +313,6 @@ Every asset knows its relationships. Intelligent tagging, similarity-based disco
|
|
|
296
313
|
|
|
297
314
|
---
|
|
298
315
|
|
|
299
|
-
## Quick Start
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
npm install @soulcraft/brainy
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Your First Knowledge Graph (60 seconds)
|
|
306
|
-
|
|
307
|
-
```javascript
|
|
308
|
-
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
|
309
|
-
|
|
310
|
-
const brain = new Brainy()
|
|
311
|
-
await brain.init()
|
|
312
|
-
|
|
313
|
-
// Add knowledge
|
|
314
|
-
const jsId = await brain.add({
|
|
315
|
-
data: "JavaScript is a programming language",
|
|
316
|
-
type: NounType.Concept,
|
|
317
|
-
metadata: { category: "language", year: 1995 }
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
const nodeId = await brain.add({
|
|
321
|
-
data: "Node.js runtime environment",
|
|
322
|
-
type: NounType.Concept,
|
|
323
|
-
metadata: { category: "runtime", year: 2009 }
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
// Create relationships
|
|
327
|
-
await brain.relate({ from: nodeId, to: jsId, type: VerbType.Executes })
|
|
328
|
-
|
|
329
|
-
// Query with Triple Intelligence
|
|
330
|
-
const results = await brain.find({
|
|
331
|
-
query: "JavaScript", // π Vector
|
|
332
|
-
where: { category: "language" }, // π Document
|
|
333
|
-
connected: { from: nodeId, depth: 1 } // πΈοΈ Graph
|
|
334
|
-
})
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
**Done.** No configuration. No complexity. Production-ready from day one.
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
316
|
## Core Features
|
|
342
317
|
|
|
343
318
|
### π§ **Natural Language Queries**
|
|
@@ -355,6 +330,8 @@ await brain.find({
|
|
|
355
330
|
})
|
|
356
331
|
```
|
|
357
332
|
|
|
333
|
+
**β [See all query methods in API Reference](docs/api/README.md#search--query)**
|
|
334
|
+
|
|
358
335
|
### π **Virtual Filesystem** β Intelligent File Management
|
|
359
336
|
|
|
360
337
|
Build file explorers and IDEs that never crash:
|
|
@@ -566,40 +543,60 @@ brainy search "programming"
|
|
|
566
543
|
|
|
567
544
|
---
|
|
568
545
|
|
|
569
|
-
## Documentation
|
|
546
|
+
## π Complete Documentation
|
|
570
547
|
|
|
571
|
-
|
|
572
|
-
- **[API Reference](docs/api/README.md)** β Complete API documentation for all features
|
|
573
|
-
- **[v4.0.0 Migration Guide](docs/MIGRATION-V3-TO-V4.md)** β Upgrade from v3 (backward compatible)
|
|
548
|
+
**For most developers:** Start with the **[Complete API Reference](docs/api/README.md)** β
|
|
574
549
|
|
|
575
|
-
|
|
576
|
-
-
|
|
577
|
-
-
|
|
578
|
-
-
|
|
579
|
-
-
|
|
550
|
+
This comprehensive guide includes:
|
|
551
|
+
- β
Every method with parameters, returns, and examples
|
|
552
|
+
- β
Quick start in 60 seconds
|
|
553
|
+
- β
Core CRUD β Advanced features (branching, versioning, time-travel)
|
|
554
|
+
- β
TypeScript types and patterns
|
|
555
|
+
- β
1,870 lines of copy-paste ready code
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
### π― Essential Reading (Start Here)
|
|
560
|
+
|
|
561
|
+
1. **[π Complete API Reference](docs/api/README.md)** β **START HERE** β
|
|
562
|
+
- Your primary resource for building with Brainy
|
|
563
|
+
- Every method documented with working examples
|
|
564
|
+
|
|
565
|
+
2. **[Natural Language Queries](docs/guides/natural-language.md)**
|
|
566
|
+
- Master the `find()` method and Triple Intelligence queries
|
|
580
567
|
|
|
581
|
-
|
|
568
|
+
3. **[v4.0.0 Migration Guide](docs/MIGRATION-V3-TO-V4.md)**
|
|
569
|
+
- Upgrading from v3 (100% backward compatible)
|
|
570
|
+
|
|
571
|
+
### π§ Core Concepts & Architecture
|
|
572
|
+
|
|
573
|
+
- **[Triple Intelligence Architecture](docs/architecture/triple-intelligence.md)** β How vector + graph + document work together
|
|
574
|
+
- **[Noun-Verb Taxonomy](docs/architecture/noun-verb-taxonomy.md)** β The universal type system (42 nouns Γ 127 verbs)
|
|
582
575
|
- **[Architecture Overview](docs/architecture/overview.md)** β System design and components
|
|
583
576
|
- **[Data Storage Architecture](docs/architecture/data-storage-architecture.md)** β Type-aware indexing and HNSW
|
|
584
|
-
- **[Capacity Planning](docs/operations/capacity-planning.md)** β Memory, storage, and scaling guidelines
|
|
585
577
|
|
|
586
578
|
### βοΈ Production & Operations
|
|
579
|
+
|
|
587
580
|
- **[Cloud Deployment Guide](docs/deployment/CLOUD_DEPLOYMENT_GUIDE.md)** β Deploy to AWS, GCS, Azure
|
|
588
|
-
- **[
|
|
581
|
+
- **[Capacity Planning](docs/operations/capacity-planning.md)** β Memory, storage, and scaling to billions
|
|
582
|
+
- **Cost Optimization:** **[AWS S3](docs/operations/cost-optimization-aws-s3.md)** | **[GCS](docs/operations/cost-optimization-gcs.md)** | **[Azure](docs/operations/cost-optimization-azure.md)** | **[Cloudflare R2](docs/operations/cost-optimization-cloudflare-r2.md)**
|
|
589
583
|
|
|
590
584
|
### π Framework Integration
|
|
585
|
+
|
|
591
586
|
- **[Framework Integration Guide](docs/guides/framework-integration.md)** β React, Vue, Angular, Svelte
|
|
592
587
|
- **[Next.js Integration](docs/guides/nextjs-integration.md)**
|
|
593
588
|
- **[Vue.js Integration](docs/guides/vue-integration.md)**
|
|
594
589
|
|
|
595
|
-
### π³ Virtual Filesystem
|
|
590
|
+
### π³ Virtual Filesystem (VFS)
|
|
591
|
+
|
|
596
592
|
- **[VFS Quick Start](docs/vfs/QUICK_START.md)** β Build file explorers that never crash
|
|
597
593
|
- **[VFS Core Documentation](docs/vfs/VFS_CORE.md)**
|
|
598
|
-
- **[Semantic VFS Guide](docs/vfs/SEMANTIC_VFS.md)**
|
|
594
|
+
- **[Semantic VFS Guide](docs/vfs/SEMANTIC_VFS.md)** β AI-powered file navigation
|
|
599
595
|
- **[Neural Extraction API](docs/vfs/NEURAL_EXTRACTION.md)**
|
|
600
596
|
|
|
601
|
-
### π¦ Data Import
|
|
602
|
-
|
|
597
|
+
### π¦ Data Import & Processing
|
|
598
|
+
|
|
599
|
+
- **[Import Anything Guide](docs/guides/import-anything.md)** β CSV, Excel, PDF, URLs with auto-detection
|
|
603
600
|
|
|
604
601
|
---
|
|
605
602
|
|
|
@@ -31,6 +31,14 @@ const NOUN_TYPE_DESCRIPTIONS = {
|
|
|
31
31
|
[NounType.Organism]: 'organism animal plant bacteria fungi species living biological life creature being microorganism',
|
|
32
32
|
// Material Types (1) - Stage 3
|
|
33
33
|
[NounType.Substance]: 'substance material matter chemical element compound liquid gas solid molecule atom material',
|
|
34
|
+
// Property & Quality Types (1) - Stage 3
|
|
35
|
+
[NounType.Quality]: 'quality property attribute characteristic feature aspect trait dimension parameter value',
|
|
36
|
+
// Temporal Types (1) - Stage 3
|
|
37
|
+
[NounType.TimeInterval]: 'timeInterval period duration span range epoch era season quarter interval window',
|
|
38
|
+
// Functional Types (1) - Stage 3
|
|
39
|
+
[NounType.Function]: 'function purpose role capability capacity utility objective goal aim intent',
|
|
40
|
+
// Informational Types (1) - Stage 3
|
|
41
|
+
[NounType.Proposition]: 'proposition statement claim assertion declaration premise conclusion hypothesis theory',
|
|
34
42
|
// Digital/Content Types
|
|
35
43
|
[NounType.Document]: 'document file report article paper text pdf word contract agreement record documentation',
|
|
36
44
|
[NounType.Media]: 'media image photo video audio music podcast multimedia graphic visualization animation',
|
|
@@ -59,7 +67,18 @@ const NOUN_TYPE_DESCRIPTIONS = {
|
|
|
59
67
|
[NounType.Regulation]: 'regulation law rule policy standard compliance requirement guideline ordinance statute',
|
|
60
68
|
// Technical Infrastructure Types
|
|
61
69
|
[NounType.Interface]: 'interface API endpoint protocol specification contract schema definition connection',
|
|
62
|
-
[NounType.Resource]: 'resource infrastructure server database storage compute memory bandwidth capacity asset'
|
|
70
|
+
[NounType.Resource]: 'resource infrastructure server database storage compute memory bandwidth capacity asset',
|
|
71
|
+
// Custom/Extensible (1) - Stage 3
|
|
72
|
+
[NounType.Custom]: 'custom special unique particular specific domain-specific specialized tailored bespoke',
|
|
73
|
+
// Social Structures (3) - Stage 3
|
|
74
|
+
[NounType.SocialGroup]: 'socialGroup community tribe clan network circle collective society crowd gathering',
|
|
75
|
+
[NounType.Institution]: 'institution establishment foundation organization system structure framework tradition practice',
|
|
76
|
+
[NounType.Norm]: 'norm convention standard custom tradition protocol etiquette rule practice expectation',
|
|
77
|
+
// Information Theory (2) - Stage 3
|
|
78
|
+
[NounType.InformationContent]: 'informationContent story narrative knowledge data schema pattern model structure',
|
|
79
|
+
[NounType.InformationBearer]: 'informationBearer carrier medium vehicle signal token representation document',
|
|
80
|
+
// Meta-Level (1) - Stage 3
|
|
81
|
+
[NounType.Relationship]: 'relationship connection relation association link bond tie interaction dynamic'
|
|
63
82
|
};
|
|
64
83
|
const VERB_TYPE_DESCRIPTIONS = {
|
|
65
84
|
// Core Relationship Types
|
|
@@ -389,6 +408,16 @@ export class BrainyTypes {
|
|
|
389
408
|
generateReasoning(obj, selectedType, typeKind) {
|
|
390
409
|
const descriptions = typeKind === 'noun' ? NOUN_TYPE_DESCRIPTIONS : VERB_TYPE_DESCRIPTIONS;
|
|
391
410
|
const typeDesc = descriptions[selectedType];
|
|
411
|
+
// Handle missing descriptions gracefully
|
|
412
|
+
if (!typeDesc) {
|
|
413
|
+
if (typeKind === 'noun') {
|
|
414
|
+
const fields = Object.keys(obj).slice(0, 3).join(', ');
|
|
415
|
+
return `Matched to ${selectedType} based on semantic similarity and object fields: ${fields}`;
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return `Matched to ${selectedType} based on semantic similarity and relationship context`;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
392
421
|
if (typeKind === 'noun') {
|
|
393
422
|
const fields = Object.keys(obj).slice(0, 3).join(', ');
|
|
394
423
|
return `Matched to ${selectedType} based on semantic similarity to "${typeDesc.split(' ').slice(0, 5).join(' ')}..." and object fields: ${fields}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.2",
|
|
4
4
|
"description": "Universal Knowledge Protocolβ’ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. Stage 3 CANONICAL: 42 nouns Γ 127 verbs covering 96-97% of all human knowledge.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|