brainy/docs/features/v3-features.md
David Snelling 00d3203d68 refactor(8.0)!: remove distributed clustering subsystem — inert/orphaned, scale is single-process + native provider
The distributed-clustering subsystem never ran in production: it was inert,
orphaned dead code (faked consensus, stub replication, no live wiring, and it
did not interoperate with the 8.0 Db API). Brainy 8.0 is a single-process
library. Scale is single-process + the optional native provider
(@soulcraft/cortex, on-disk DiskANN to 10B+ vectors) + per-tenant pools +
horizontal read scaling (many reader processes, one writer).

Removed:
- src/distributed/ entirely (coordinator, shardManager, cacheSync,
  readWriteSeparation, queryPlanner, healthMonitor, configManager,
  hashPartitioner, shardMigration, domainDetector, storageDiscovery, http/network
  transports). ReaderMode/HybridMode relocated to src/storage/operationalModes.ts
  (slimmed to the live surface).
- src/types/distributedTypes.ts; config.distributed field + JSDoc;
  coreTypes distributedConfig; memoryStorage distributedConfig persistence.
- DistributedRole enum + src/config/distributedPresets.ts and the orphaned
  src/config/extensibleConfig.ts (config/augmentation registry built on removed
  cloud adapters + distributed presets), plus their src/index.ts re-exports.
- 13 BRAINY_* cluster env vars; the storage setDistributedComponents hook;
  enableDistributedSearch (dead config flag); the metadata partition field;
  the distributed_ reserved key prefix.
- Orphaned src/storage/readOnlyOptimizations.ts (zero importers).
- Tests targeting the subsystem: distributed-demo, distributed-cluster helper,
  distributed-transactions, sharding-transactions.
- Docs: EXTENDING_STORAGE.md (deleted); scrubbed distributed/cluster/Raft/
  shard-manager/multi-node prose from v3-features, enterprise-for-everyone,
  augmentations-actual, complete-feature-list, vfs/README, vfs/ROADMAP,
  vfs/VFS_CORE, capacity-planning, transactions, MIGRATION-V3-TO-V4,
  storage-architecture; reframed scale prose to the 8.0 model.

Kept: src/storage/sharding.ts (local-disk 256-bucket directory sharding via
getShardIdFromUuid — used live by baseStorage, unrelated to clustering);
the multi-process mode: 'reader' | 'writer' roles; semantic/HNSW clustering.

RELEASES.md: added a removed-surfaces row documenting the cut and the 8.0
scale model.
2026-06-15 10:37:39 -07:00

5.2 KiB

🚀 Brainy - Production-Ready Features

Status: All features listed here are IMPLEMENTED and TESTED

📊 Performance Metrics

  • Search Latency: <10ms for 10,000+ items
  • Write Throughput: 10,000+ ops/sec
  • Memory Efficiency: <500MB for 10K items
  • Concurrent Operations: 100+ simultaneous operations

🧠 Core Intelligence Features

Triple Intelligence System

Unified query system combining three types of intelligence:

const results = await brain.find({
  like: 'AI research',           // Vector similarity search
  where: { year: 2024 },          // Metadata filtering
  connected: { to: authorId }     // Graph relationships
})

Intelligent Type Mapping

Prevents semantic degradation by intelligently inferring types:

// Automatically infers 'person' from email field
brain.add({ name: "John", email: "john@example.com" }, 'entity')
// → Stored as type: 'person', not generic 'entity'

Neural Query Understanding

  • 220+ embedded patterns for intent detection
  • Natural language query processing
  • Automatic query optimization
  • Pattern-based query rewriting

🔐 Security & Compliance

Rate Limiting

Per-operation configurable limits:

const rateLimiter = createRateLimitAugmentation({
  limits: {
    searches: 1000,  // per minute
    writes: 100,
    reads: 5000,
    deletes: 50
  }
})

Audit Logging

Comprehensive operation tracking:

const auditLogger = createAuditLogAugmentation({
  logLevel: 'detailed',
  retention: 90,  // days
  includeMetadata: true
})

// Query audit logs
const logs = auditLogger.queryLogs({
  operation: 'add',
  startTime: Date.now() - 3600000
})

📦 Storage & Persistence

Full crash recovery and replay:

  enabled: true,
  checkpointInterval: 1000,
  maxLogSize: 100 * 1024 * 1024  // 100MB
}))

Multi-Tenancy

Service-based data isolation:

// Isolated data per service
await brain.add(data, 'document', { service: 'tenant-1' })
await brain.find('query', { service: 'tenant-1' })

Write-Only Mode

For dedicated write nodes:

const brain = new Brainy({
  mode: 'write-only',
  storage: 's3://bucket/path'
})

🚀 Performance Features

Batch Operations

Optimized bulk processing:

// Parallel processing with automatic batching
await brain.addMany(items)  // <10ms per item
await brain.updateMany(updates)
await brain.removeMany(filters)

Request Deduplication

Automatic duplicate request handling:

brain.use(new RequestDeduplicatorAugmentation())
// Identical concurrent requests return same result

Smart Caching

Intelligent search result caching:

brain.use(new CacheAugmentation({
  maxSize: 10000,
  ttl: 300000,  // 5 minutes
  invalidateOnWrite: true
}))

🔄 Data Processing

Entity Registry

Bloom filter-based deduplication:

brain.use(new EntityRegistryAugmentation())
// Handles millions of entities with minimal memory

Neural Import

Intelligent data import with type inference:

await brain.import({
  source: 'data.json',
  autoDetectTypes: true,
  batchSize: 1000
})

Streaming Pipeline

Real-time data processing:

brain.stream()
  .pipe(transform)
  .pipe(enrich)
  .pipe(brain.writer())

📊 Analytics & Monitoring

Metrics Collection

Built-in performance metrics:

const metrics = brain.getMetrics()
// {
//   operations: { add: 1000, find: 5000 },
//   performance: { p95: 8, p99: 12 },
//   cache: { hits: 4500, misses: 500 }
// }

Health Monitoring

Automatic health checks:

const health = brain.getHealth()
// {
//   status: 'healthy',
//   storage: 'connected',
//   memory: { used: 245, limit: 512 }
// }

🛠️ Developer Experience

Zero Configuration

Works out of the box:

import Brainy from '@soulcraft/brainy'
const brain = new Brainy()  // Auto-configures everything

TypeScript First

Full type safety and inference:

// Types are automatically inferred
const results = await brain.find<MyType>('query')

Augmentation System

Extensible plugin architecture:

class CustomAugmentation extends BaseAugmentation {
  execute(operation, params, next) {
    // Your custom logic
    return next()
  }
}

🔧 Operational Features

Graceful Shutdown

Clean shutdown with data persistence:

process.on('SIGTERM', async () => {
  await brain.shutdown()  // Saves all pending data
})

Hot Reload

Configuration updates without restart:

brain.updateConfig({
  cache: { enabled: false }
})

Backup & Restore

Full data backup capabilities:

await brain.backup('backup.bin')
await brain.restore('backup.bin')

📈 Proven at Scale

  • 10,000+ items: Sub-10ms search
  • 1M+ operations: Stable memory usage
  • 100+ concurrent users: No performance degradation

🚫 NOT Implemented (Planned)

These features are documented but NOT yet implemented:

  • GraphQL API (use REST API instead)
  • Kubernetes operators (use Docker)

Last Updated: Latest Version All features listed above are production-ready and tested