brainy/docs
David Snelling c0f6ccd958 fix: recover VFS content blobs stranded by a 7→8 upgrade, in place on open
The 7.x branch system stored Virtual Filesystem content as blobs in its
copy-on-write area (`_cow/`). 8.0 removed that system and stores content blobs
in the content-addressed store (`_cas/`), but the one-time layout migration only
moves entities — it never adopted the `_cow/` content blobs. A store that used
the VFS was left with every VFS-backed read throwing "Blob metadata not found"
and its pages 500ing, with no first-party recovery and the pre-upgrade backup
already removed on entity-migration "success".

Add an on-open recovery pass (`autoAdoptLegacyVfsBlobsIfNeeded`) that runs right
after the layout migration and adopts every orphaned `_cow/` blob into `_cas/` —
copying both the bytes and the metadata via the raw object primitives,
idempotently and non-destructively (the `_cow/` originals are never deleted). It
is a separate phase, not folded into the migration, so it also heals a store
already upgraded by an earlier 8.0.x that stranded the blobs (whose layout-
migration marker is stamped): it is gated on the presence of `_cow/` and its own
`_system/vfs-blob-adoption.json` marker. Filesystem-only; native-8.0 and non-VFS
stores no-op on a cheap existence check.

- `BaseStorage.adoptLegacyCowBlobs()` — the scan/copy primitive, returning
  `{ cowBlobs, adopted, alreadyPresent, incomplete }`; skips (does not half-adopt)
  a blob missing its bytes or metadata.
- `brain.vfs.adoptOrphanedBlobs()` — the explicit force path; self-initializes.
- Backup retention: the automatic pre-upgrade backup is now kept if any blob
  can't be fully adopted (`incomplete > 0`), instead of being removed on
  entity-migration success alone — a blob-parity gate the migration signal
  cannot provide.

Adds an end-to-end integration test (storage-level adopt with idempotency and
incomplete handling; self-heal on reopen; the explicit API) and an upgrade guide.
2026-07-07 12:23:36 -07:00
..
api refactor(8.0): remove the 4 deprecated query-operator aliases (clean break) 2026-06-29 10:29:20 -07:00
architecture docs: correct rc-era time-travel staleness + record the embedding-model ordering constraint 2026-07-07 10:39:00 -07:00
concepts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
guides fix: recover VFS content blobs stranded by a 7→8 upgrade, in place on open 2026-07-07 12:23:36 -07:00
operations feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
vfs refactor(8.0): remove the 4 deprecated query-operator aliases (clean break) 2026-06-29 10:29:20 -07:00
ADR-001-generational-mvcc.md feat(8.0): Model-B per-write generation-stamping + adaptive retention knob 2026-06-22 15:19:58 -07:00
BATCHING.md docs(8.0): correct public docs to the real 8.0 API + honest perf claims 2026-06-29 10:03:02 -07:00
DATA_MODEL.md chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
DEVELOPER_LEARNING_PATH.md feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
eli5.md docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
FIND_SYSTEM.md docs(8.0): correct public docs to the real 8.0 API + honest perf claims 2026-06-29 10:03:02 -07:00
MIGRATION-V3-TO-V4.md refactor(8.0)!: remove distributed clustering subsystem — inert/orphaned, scale is single-process + native provider 2026-06-15 10:37:39 -07:00
neural-extraction.md feat: queryAggregate() + HAVING, plus aggregate backfill, traversal depth/via, extraction typing (BR-ADV-FEATURES-BUN) 2026-05-26 13:55:43 -07:00
PERFORMANCE.md docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
PLUGINS.md fix: cold-open no longer re-derives durable indexes — complete the readiness contract for all three providers 2026-07-07 10:39:00 -07:00
PRODUCTION_SERVICE_ARCHITECTURE.md chore(8.0): modernize toolchain + position Bun as a runtime 2026-07-01 09:16:46 -07:00
QUERY_OPERATORS.md docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
README.md refactor(8.0)!: remove distributed clustering subsystem — inert/orphaned, scale is single-process + native provider 2026-06-15 10:37:39 -07:00
RELEASE-GUIDE.md docs: correct rc-era time-travel staleness + record the embedding-model ordering constraint 2026-07-07 10:39:00 -07:00
SCALING.md docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
STAGE3-CANONICAL-TAXONOMY.md fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
transactions.md feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
troubleshooting.md feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
universal-display-augmentation.md feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00

Brainy Documentation

The multi-dimensional AI database with Triple Intelligence — vector search, graph traversal, and metadata filtering in one unified API.

Quick Start

import { Brainy, NounType, VerbType } from '@soulcraft/brainy'

const brain = new Brainy()
await brain.init()

// Add entities — data is embedded for semantic search, metadata is indexed for filtering
const id = await brain.add({
  data: 'Revolutionary AI Breakthrough',
  type: NounType.Document,
  metadata: { category: 'technology', rating: 4.8 }
})

// Search with Triple Intelligence
const results = await brain.find({
  query: 'artificial intelligence',              // Semantic search (on data)
  where: { rating: { greaterThan: 4.0 } },       // Metadata filter
  connected: { from: authorId, depth: 2 }         // Graph traversal
})

Core Documentation

Document Description
API Reference Complete API documentation — start here
Data Model Entity structure, data vs metadata, storage fields
Query Operators All BFO operators with examples and indexed/in-memory matrix
Find System Natural language find() and hybrid search details
Consistency Model The Db API guarantees — snapshot isolation, atomic transactions, time travel

Architecture

Document Description
Architecture Overview High-level system design
Triple Intelligence Vector + Graph + Metadata unified query
Noun-Verb Taxonomy 42 nouns + 127 verbs type system
Stage 3 Canonical Taxonomy Complete type reference
Storage Architecture Storage adapters and optimization
Index Architecture Vector, Graph, and Metadata indexing
Zero Configuration Auto-adapts to any environment

Virtual Filesystem (VFS)

Document Description
VFS Quick Start Get started in 30 seconds
VFS Core Core concepts and architecture
VFS API Guide Complete VFS API reference
Common Patterns VFS usage patterns

See vfs/ for the complete VFS documentation set.


Guides

Document Description
Import Anything CSV, Excel, PDF, URL imports
Snapshots & Time Travel Backups, restore, what-if analysis, audit trails
Natural Language Query in plain English
Neural API AI-powered features
Enterprise for Everyone No limits, no tiers
Framework Integration React, Vue, Angular, Svelte

Storage & Deployment

Document Description
Storage Architecture Filesystem and memory adapters, on-disk artifact layout, operator-layer backup
Capacity Planning Scale to millions of entities

Plugins

Document Description
Plugins Plugin system overview — providers, plugins config, brain.use()

Performance & Scaling

Document Description
Performance Optimization techniques
Scaling Scale to billions of entities
Batching Batch operations guide

Migration & Reference

Document Description
v3 to v4 Migration Upgrade guide
Release Guide How to release new versions
Production Architecture Ops reference

Internal

Document Description
Audit Report Feature audit
Honest Status Actual implementation status

License

Brainy is MIT licensed. See LICENSE for details.