npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@soulcraft/cortex

v1.5.0

Published

Native Rust acceleration for Brainy — SIMD distance, vector quantization, zero-copy mmap, native embeddings. Commercial license required (14-day free trial).

Readme

Cortex


What is Cortex?

Cortex replaces Brainy's JavaScript internals with native Rust implementations. Same API, same data, dramatically faster.

Install it, add it to your plugins config, and Brainy uses Rust for distance calculations, embeddings, metadata queries, graph operations, and more.

npm install @soulcraft/brainy @soulcraft/cortex
import Brainy from '@soulcraft/brainy'

const brain = new Brainy({
  plugins: ['@soulcraft/cortex']
})
await brain.init()
// [brainy] Plugin activated: @soulcraft/cortex

// Verify what's accelerated
const diag = brain.diagnostics()
console.log(diag.providers)
// { distance: { source: 'plugin' }, embeddings: { source: 'plugin' }, ... }

Why Cortex?

Brainy works great on its own with pure JavaScript and WASM. Cortex is for when you need more:

  • SIMD distance calculations — every vector comparison gets faster
  • Native ML inference — Candle engine replaces WASM embeddings, with CPU, CUDA, and Metal support
  • Rust metadata engine — queries and mutations run in Rust with CRoaring bitmaps
  • Native graph index — 4 LSM-trees with verb tracking, all in Rust
  • Batch embeddings — single Rust forward pass for bulk operations
  • Zero-copy storage — mmap-backed SSTables for disk-heavy workloads

Brainy's plugin system means cortex acceleration flows through every operation — add(), find(), update(), delete(), similar(), VFS path resolution, neural APIs, and everything in between.

What Gets Accelerated

| Subsystem | What Cortex Provides | Impact | |-----------|---------------------|--------| | HNSW index | Rust graph engine with SIMD distance, Arc-based COW | Core vector search | | Distance | SIMD cosine, euclidean, manhattan, dot product | Every vector comparison | | Embeddings | Candle ML engine (CPU/CUDA/Metal) | No WASM compilation, GPU support | | Batch embeddings | Single forward pass for multiple texts | Bulk import and reindex | | Cache | Rust eviction engine with JS data storage | Memory management | | Metadata index | Rust query/mutation engine with CRoaring | Faster filtering and type queries | | Graph adjacency | 4 LSM-trees with verb tracking | Faster relationship operations | | Entity ID mapper | Rust O(1) HashMap for UUID-integer mapping | Bitmap index operations | | Vector quantization | SIMD SQ8/SQ4 distance on compressed vectors | 4-8x memory reduction | | Product quantization | Native PQ codebook training and ADC | 16-32x compression | | Graph compression | Delta-varint encoded connections | 2-3x smaller graph storage | | Roaring bitmaps | CRoaring bindings | Faster set operations | | Msgpack | Native encode/decode | Faster serialization | | Storage | MmapFileSystemStorage with zero-copy SSTables | Faster disk I/O | | Compaction | Graph-aware BFS/HNSW traversal ordering | Better disk locality |

Getting Started

1. Install

npm install @soulcraft/brainy @soulcraft/cortex

2. Set up your license

# Environment variable
export SOULCRAFT_LICENSE=sc_cortex_<your-key>

# Or license file
echo "sc_cortex_<your-key>" > ~/.soulcraft/license

License validation is offline — no network calls, no telemetry.

3. Enable cortex in your Brainy config

import Brainy from '@soulcraft/brainy'

const brain = new Brainy({
  storage: { type: 'filesystem', rootDirectory: './data' },
  plugins: ['@soulcraft/cortex']
})
await brain.init()
// [brainy] Plugin activated: @soulcraft/cortex
// [brainy] Providers: 10/10 native (@soulcraft/cortex)

4. Verify in production

Use requireProviders() to fail fast if cortex isn't providing expected acceleration:

brain.requireProviders(['distance', 'embeddings', 'metadataIndex', 'graphIndex'])

Or inspect the full picture with diagnostics:

console.log(brain.diagnostics())

MmapFileSystemStorage

Cortex includes a storage adapter with mmap-backed binary blob support:

const brain = new Brainy({
  storage: { type: 'mmap-filesystem', rootDirectory: './data' }
})

Zero-copy access to LSM-tree SSTables — useful for large graph datasets where disk I/O is the bottleneck.

Platform Support

| Platform | Architecture | Status | |----------|-------------|--------| | Linux | x64 (glibc) | Supported | | Linux | arm64 (glibc) | Supported | | macOS | arm64 (Apple Silicon) | Supported | | macOS | x64 (Intel) | Supported | | Windows | x64 | Supported |

Requirements

  • @soulcraft/brainy >= 7.15.4
  • Node.js >= 22 or Bun >= 1.3.0

Direct Native Access

For advanced use cases, access the Rust bindings directly:

import { loadNativeModule, isNativeAvailable } from '@soulcraft/cortex'

if (isNativeAvailable()) {
  const native = loadNativeModule()
  const distance = native.cosineDistance(vectorA, vectorB)
}

Learn More

License

Commercial. See LICENSE for details.