The GA-readiness audit found the public docs had drifted from the shipped surface and presented uncited performance numbers as measured fact. - quick-start: `FindResult`→`Result`, `VerbType.BuiltOn`→`DependsOn` (the canonical getting-started example now compiles). - noun-verb-taxonomy: rewrote every sample off removed/fictional APIs (`augment`/`connectModel`/`getVerbs`/two-arg `add`/`like`/`$gte`) onto the real single-object `add`/`find`/`relate`/`related`; replaced the stale 31-noun/40-verb catalogs with accurate, complete tables (42 nouns, 127 verbs). - triple-intelligence: `like:`→`query:`, dollar-operators→bare operators, and several other fictional keys swept to the real `FindParams`. - FIND_SYSTEM / PERFORMANCE / index-architecture / BATCHING: replaced fabricated, mutually-inconsistent latency tables and uncited speedup multipliers with Big-O characterizations, qualitative mechanism descriptions, and the one genuinely-measured benchmark (graph O(1) neighbor lookup), per the evidence-based-claims rule. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
111 lines
3.3 KiB
Markdown
111 lines
3.3 KiB
Markdown
---
|
|
title: Quick Start
|
|
slug: getting-started/quick-start
|
|
public: true
|
|
category: getting-started
|
|
template: guide
|
|
order: 2
|
|
description: Build your first knowledge graph in 60 seconds. Add entities, create relationships, and query with Triple Intelligence — vector + graph + metadata in one call.
|
|
next:
|
|
- concepts/triple-intelligence
|
|
- api/reference
|
|
---
|
|
|
|
# Quick Start
|
|
|
|
Get Brainy running in under a minute.
|
|
|
|
## 1. Install
|
|
|
|
```bash
|
|
npm install @soulcraft/brainy
|
|
```
|
|
|
|
## 2. Initialize
|
|
|
|
```typescript
|
|
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
|
|
|
const brain = new Brainy()
|
|
await brain.init()
|
|
```
|
|
|
|
That's it. Brainy auto-configures storage, loads the embedding model, and builds the indexes.
|
|
|
|
## 3. Add Knowledge
|
|
|
|
```typescript
|
|
// Text is automatically embedded into 384-dim vectors
|
|
const reactId: string = await brain.add({
|
|
data: 'React is a JavaScript library for building user interfaces',
|
|
type: NounType.Concept,
|
|
subtype: 'library', // Sub-classification within Concept
|
|
metadata: { category: 'frontend', year: 2013 }
|
|
})
|
|
|
|
const nextId: string = await brain.add({
|
|
data: 'Next.js framework for React with server-side rendering',
|
|
type: NounType.Concept,
|
|
subtype: 'framework',
|
|
metadata: { category: 'framework', year: 2016 }
|
|
})
|
|
```
|
|
|
|
`type` is one of Brainy's 42 stable NounTypes. `subtype` is your free-form sub-classification within that type — flat string, no hierarchy, indexed on the fast path. See **[Subtypes & Facets](./subtypes-and-facets.md)** for the full guide.
|
|
|
|
## 4. Create Relationships
|
|
|
|
```typescript
|
|
// Typed graph relationships
|
|
await brain.relate({
|
|
from: nextId,
|
|
to: reactId,
|
|
type: VerbType.DependsOn
|
|
})
|
|
```
|
|
|
|
## 5. Query with Triple Intelligence
|
|
|
|
```typescript
|
|
import type { Result } from '@soulcraft/brainy'
|
|
|
|
// All three search paradigms in one call
|
|
const results: Result[] = await brain.find({
|
|
query: 'modern frontend frameworks', // Vector similarity search
|
|
where: { year: { greaterThan: 2015 } }, // Metadata filtering
|
|
connected: { to: reactId, depth: 2 } // Graph traversal
|
|
})
|
|
|
|
console.log(results[0].data) // 'Next.js framework for React...'
|
|
console.log(results[0].score) // 0.94
|
|
```
|
|
|
|
## What Just Happened
|
|
|
|
Every entity you `add()` lives in three indexes simultaneously:
|
|
|
|
| Index | What it stores | Query with |
|
|
|-------|---------------|------------|
|
|
| Vector | 384-dim embedding of `data` | `find({ query: '...' })` |
|
|
| Metadata | All `metadata` fields | `find({ where: { ... } })` |
|
|
| Graph | Typed relationships from `relate()` | `find({ connected: { ... } })` |
|
|
|
|
`find()` queries all three in parallel and fuses the results.
|
|
|
|
## Natural Language Queries
|
|
|
|
Brainy understands 220+ natural language patterns:
|
|
|
|
```typescript
|
|
// These all work without any configuration
|
|
await brain.find({ query: 'recent documents about machine learning' })
|
|
await brain.find({ query: 'articles created this week' })
|
|
await brain.find({ query: 'people who work at Anthropic' })
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
- [Triple Intelligence](/docs/concepts/triple-intelligence) — understand how the query engine works
|
|
- [The Find System](/docs/guides/find-system) — advanced queries, operators, and graph traversal
|
|
- [API Reference](/docs/api/reference) — complete method documentation
|
|
- [Storage Adapters](/docs/guides/storage-adapters) — filesystem, memory
|