MCPcopy Index your code
hub / github.com/YARlabs/hyperspace-db

github.com/YARlabs/hyperspace-db @v3.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.1 ↗ · + Follow
6,844 symbols 12,491 edges 269 files 1,010 documented · 15%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

[H] HyperspaceDB: The Spatial AI Engine

Build Status License: MIT Rust

v3.1.1 | The World's First Schema-Driven Spatial AI Engine.

Why Spatial AI?Use CasesArchitectureBenchmarksSDKs


🌌 What is HyperspaceDB?

Traditional vector databases were built to search static PDF files for chatbots. HyperspaceDB is built for Autonomous Agents, Robotics, and Continuous Learning.

It is the world's first Spatial AI Engine — a mathematically advanced memory infrastructure that models information exactly how the physical world and human cognition are structured: as hierarchical, spatial, and dynamic graphs.

By combining Hyperbolic Geometry (Poincaré & Lorentz models), Lock-Free Concurrency, and an Edge-to-Cloud Serverless architecture, HyperspaceDB allows machines to navigate massive semantic spaces in microseconds, using a fraction of the RAM required by traditional databases.

🧠 Why a Spatial AI Engine? (Beyond RAG)

AI is moving from text-in/text-out to autonomous action. Agents need episodic memory and spatial reasoning. HyperspaceDB provides the primitives to build it:

  • Fractal Knowledge Graphs: Euclidean vectors fail at hierarchies. Our native Hyperbolic engine compresses massive trees (like codebases or taxonomies) into 64-dimensional spaces, reducing RAM usage by 50x without losing semantic context.
  • Continuous Reconsolidation: AI agents need to "sleep" and organize memories. With our Fast Upsert Path, CDC Event Streams, and built-in Riemannian Math SDK (Fréchet mean, parallel transport), your agents can continuously shift and prune vectors dynamically.
  • Edge-to-Cloud & Offline-First: Drones and humanoid robots can't wait for cloud latency. HyperspaceDB runs directly on Edge hardware, using a Merkle Tree Delta Sync protocol (SyncHandshake, SyncPull, SyncPush) to asynchronously handshake and sync episodic memory chunks with the Cloud when the network is available.
  • Serverless at Billion-Scale: HyperspaceDB dynamically unloads idle logic to disk/S3, enabling you to host millions of vectors across thousands of tenants on a single commodity server, acting as the "Neon of Vector Search."

🚀 Core Pillars (v3.1.1)

⚙️ Reflex-Level Speed Built on Nightly Rust. Our ArcSwap Lock-Free architecture and f32 SIMD intrinsics deliver up to 12,000 Search QPS and 60,000 Ingest QPS on a single node.
🔑 RBAC & Cross-Tenant Sharing Granular Role-Based Access Control (Admin, ReadWrite, ReadOnly) using transaction-safe redb security storage. Support for namespaced URL collection referencing (owner:name or owner/name) for secure cross-tenant index sharing.
🕵️‍♂️ Audit Logs & Isolation High-performance structured JSON audit logging (off, low, medium, high, full levels) streaming to stdout or files. Real-time, tenant-isolated log buffers stream secure log feeds directly to the Web Dashboard.
🌿 Eco-Monitoring (EcoMonitor) Telemetry agent tracking carbon footprints of CPU/RAM computations per node. Visualizes ESG sustainability metrics and environmental compliance certification badges inside the dashboard UI.
L0 Hot Tier Cache Transparent two-level vector caching. Combines a thread-safe 64-shard L1 DashMap Cache (~1 µs lookups) with an L2 HNSW Fallback Graph (~100 µs lookups), featuring background TTL invalidation and automatic self-healing graph rebuilds.
💾 O(1) Payload Indexing High-throughput O(1) incremental indexing via append-only index write-ahead logging (WAL) in payload_store.rs, eliminating latency spikes and write amplification.
📝 Real-Time WriteBuffer Zero-latency searchability. Inserts instantly write to an in-memory WriteBuffer; searches execute Rayon-parallelized linear scans on the buffer and merge/deduplicate results with main HNSW results.
🧭 Schema-Driven Cascade Native MRL (Matryoshka) support. Define one schema with multiple layers; the RAM-resident CascadePipeline queries truncated dimensions in microseconds, automatically reranking results via full-resolution vectors on NVMe/S3.
🎓 Cognitive Math Engine First-class HNSW support for Euclidean (L2/Cosine), Poincaré Ball, Lorentz Hyperboloid metrics, and Wasserstein O(N) CFM. * **Implicit Graph Engine (v3.1)**: Stop hiding HNSW topology. Expose raw adjacency and navigate via **Lorentz Light-Cones** and **Wave Diffusion** (resonant semantic propagation). * **Graph Explorer (v3.1)**: High-performance canvas-based visualization of HNSW topology. Features Poincaré/Euclidean manifold projections, **Momentum Path Tracing**, and **Lyapunov Stability Radar**. * **Relativistic Traversal**: Use **Momentum Traversal** (Dirac) to swing through nodes with semantic inertia, predicting trajectories via Koopman extrapolations. * **Advanced Geometric Filters**: Native InBall, InBox, and InCone filters in core engine. Execute spatial K-Means, Fréchet Mean, and Parallel Transport directly in the Native SDK. Evaluate datasets via Gromov's Delta-Hyperbolicity.
📡 Agentic Workflows Trigger Memory Reconsolidation via Flow Matching natively to shift paradigms. Connect CDC Streams via subscribe_to_events to trigger secondary models. Hybrid Search (BM25) now supports RRF fusion for state-of-the-art lexical + semantic retrieval.
🧹 Metadata-Driven Pruning Agents must forget to stay efficient. Use typed numeric Range Filters (energy < 0.1) inside a Hot Vacuum to automatically prune obsolete memories.
📦 LSM-Tree Storage Optimized for high-concurrency writes. Hot MemTables continuously flush into immutable Fractal Segments (chunk_N.hyp), enabling near-instant RAM reclamation and stable performance at billion-scale.
☁️ S3 Cloud Tiering Native S3/MinIO tiered storage integration. Seamlessly offload cold segments mapping Petabytes of vectors linearly without scaling local SSDs. (Unlock via Cargo feature s3-tiering & HS_STORAGE_BACKEND=s3).

⚡ L0 Hot Tier Caching & WriteBuffer (Real-Time Ingestion)

To maximize read throughput and achieve true real-time ingestion, HyperspaceDB implements a transparent, dual-component memory tier:

graph TD
    Request[Incoming Request] --> Action{Write or Search?}

    Action -->|Insert| WB[WriteBuffer in RAM]
    WB --> WAL[WAL Log]
    WB --> IndexQueue[Active Indexing Queue]

    Action -->|Search| CacheCheck{L0 Cache Hit?}
    CacheCheck -->|Yes L1/L2 Hit| FastOut[Instant Result ~1 µs - 100 µs]
    CacheCheck -->|No Cache Miss| SearchMerge[Merged Scatter-Gather Search]
    SearchMerge --> HNSWS[HNSW Index search]
    SearchMerge --> WBS[WriteBuffer Rayon Parallel Scan]
    HNSWS --> Deduplicate[Deduplicate by external ID & Re-rank]
    WBS --> Deduplicate

1. Transparent L0 Hot Tier Cache (hyperspace-cache)

The L0 Cache resides directly on the read path, enabling blistering microsecond-level vector retrievals: * L1 exact-match Cache: Uses a 64-shard thread-safe DashMap for key-value point lookups. Latency is an imperceptible ~1 µs. * L2 approximate-match Cache: Uses an in-memory HNSW graph (instant-distance) with ArcSwap for atomic lock-free reads during background updates. Latency is ~100 µs. * Time-To-Live (TTL): Automatic scanning of the __ttl metadata field every 100 ms. Expired keys are invalidated, and tombstones are added to L2. * Auto-rebuild and Cooldown: When L2 tombstones exceed 30%, a self-healing background task rebuilds the L2 graph, protected by a 5-second cooldown to prevent CPU-rebuild thrashing. * Metadata Warmup: Rebuilding or starting up automatically warmloads key-value metadata from metadata.forward, ensuring that payloads are instantly available upon cache hits.

2. Real-Time WriteBuffer

A lock-free in-memory buffer ensuring newly inserted vectors are searchable from the very first millisecond: * Instant Searchability: Newly inserted vectors are placed in the WriteBuffer while HNSW graph links are built in the background. * Rayon-Parallel Linear Scan: Queries perform multi-threaded linear scans over the WriteBuffer utilizing AVX2/NEON vector instructions, computing Euclidean/Hyperbolic distances and running complex box/cone region filters in < 2.0 ms for up to 50,000 active entries. * Deduplicated Merging: Results from the main HNSW graph and the WriteBuffer are merged, sorted, and deduplicated by external ID to return highly accurate, real-time lists. * Snapshot Promotion: Upon HNSW graph integration, background workers evict indexed entries from the WriteBuffer, keeping the RAM footprint minimal.

📊 L0 Cache & Ingestion Performance Results

A rigorous 22-test validation suite confirms the stability and performance of the memory acceleration layer: * Cache-Hit Ratio: Achieves >98% Recall accuracy on recurrent L1 lookups, with a zero-copy fast path for de-quantized floats. * rebuild_cooldown Verification: Successfully throttles back-to-back index updates, queuing pending vectors correctly. * tombstone_trigger Auto-rebuild: Automatically resolves up to 5,000 concurrent deletions, reclaiming memory map segments with zero leaks. * WriteBuffer linear scan: Demonstrates Rayon multi-threaded lookup times under 1.8 ms for bulk vector batches.

🤖 Target Use Cases

  1. Robotics & Autonomous Drones: On-device semantic memory, Hierarchical SLAM, and offline-first edge synchronization.
  2. Continuous Learning Systems (AGI): Frameworks doing Riemannian optimization, memory reconsolidation, and Hausdorff-based graph pruning.
  3. Enterprise Graph AI: Merging relational logic with semantic proximity for massive multi-scale data analysis (Code ASTs, Medical Taxonomies).
  4. High-Load RAG & SaaS: Traditional search, but significantly cheaper to operate due to Serverless Idle Eviction and multi-tenant isolation.

⚡ 1 Million Vectors Benchmark (v3.0)

We pushed HyperspaceDB v3.0 to the limit with a 1 Million Vector Dataset. The results define a new standard for performance and efficiency.

🏆 Hyperbolic Efficiency (Poincaré 64d)

When using the native Hyperbolic (Poincaré) metric, HyperspaceDB achieves unparalleled throughput by reducing dimensionality (64d) while preserving semantic structure achievable only with 1024d in Euclidean space.

Metric Result vs Euclidean
Throughput 156,587 QPS 8.8x Faster
P99 Latency 2.47 ms 3.3x Lower
Disk Usage 687 MB 13x Smaller

⚔️ Euclidean Performance (1024d)

Even in standard Euclidean mode, HyperspaceDB outperforms competitors on standard hardware.

Database Total Time (1M vectors) Speedup Factor
HyperspaceDB 56.4s 1x
Milvus 88.7s 1.6x slower
Qdrant 629.4s (10m 29s) 11.1x slower
Weaviate 2036.3s (33m 56s) 36.1x slower

📉 Zero Degradation Architecture

While other databases slow down as data grows, HyperspaceDB maintains consistent throughput. * Weaviate degraded from 738 QPS -> 491 QPS (-33%). * Milvus fluctuated between 6k and 11k QPS. * HyperspaceDB held steady at ~156k QPS (Hyperbolic) and ~17.8k QPS (Euclidean).

💾 50% Less Disk Usage

Store more, pay less. HyperspaceDB's 1-bit quantization and efficient storage engine require half the disk space of Milvus for the exact same dataset.

  • HyperspaceDB: 9.0 GB (Euclidean) / 0.7 GB (Hyperbolic)
  • Milvus: 18.5 GB

Benchmark Config: 1M Vectors, 1024 Dimensions (Euclidean) vs 64 Dimensions (Hyperbolic), Batch Size 1000.


🔒 Security

  • API Keys: Secure endpoints with HYPERSPACE_API_KEY environment variable.
  • Header: Clients must send x-api-key: <key>.
  • Zero-Knowledge: Server stores only SHA-256 hash of the key in memory.

🤝 Federated Clustering & P2P Swarm (v3.0)

HyperspaceDB implements two distinct clustering architectures designed for both high availability in the Cloud and dynamic Edge-to-Edge discovery for robotics swarms.

1. Leader-Follower Replication (Cloud / High Availability)

  • Node Identity: Each node generates a unique UUID (node_id) and maintains a Lamport logical clock.
  • Leader: Handles Writes (Coordinator). Streams WAL events. Manages Cluster Topology.
  • Follower: Read-Only replica. Can be promoted to Leader.

2. Edge-to-Edge Gossip Swarm (Robotics / Local-First)

Designed for robotic swarms without a central Leade

Extension points exported contracts — how you extend this code

Embedder (Interface)
(no doc) [6 implementers]
crates/hyperspace-sdk/src/embedder.rs
Metric (Interface)
(no doc) [5 implementers]
crates/hyperspace-core/src/lib.rs
CacheDistance (Interface)
(no doc) [5 implementers]
crates/hyperspace-cache/src/geometry.rs
ChunkBackend (Interface)
Abstract interface for chunk storage. Implementations are responsible for: 1. Resolving a `chunk_id` to a local filesys [2 …
crates/hyperspace-tiering/src/backend.rs
ChunkBackend (Interface)
Minimal ChunkBackend trait for local-only mode. [1 implementers]
crates/hyperspace-server/src/chunk_backend.rs
Vectorizer (Interface)
(no doc) [2 implementers]
crates/hyperspace-embed/src/lib.rs
IDatabaseClient (Interface)
(no doc) [1 implementers]
sdks/ts/src/proto/hyperspace_grpc_pb.d.ts
FloatSubExt (Interface)
(no doc) [1 implementers]
crates/hyperspace-eco/src/worker.rs

Core symbols most depended-on inside this repo

get
called by 536
crates/hyperspace-store/src/ram_impl.rs
len
called by 318
crates/hyperspace-cache/src/l1_exact.rs
append
called by 261
crates/hyperspace-store/src/wal.rs
insert
called by 216
sdks/ts/src/proto/hyperspace_grpc_pb.d.ts
CopyFrom
called by 180
sdks/cpp/proto/hyperspace.pb.h
get
called by 142
crates/hyperspace-server/src/manager.rs
size
called by 108
crates/hyperspace-store/src/wal.rs
search
called by 97
sdks/ts/src/proto/hyperspace_grpc_pb.d.ts

Shape

Method 4,416
Function 1,209
Class 960
Struct 115
Interface 89
Enum 50
TypeAlias 5

Languages

C++43%
Rust17%
Go17%
TypeScript13%
Python10%
C1%

Modules by API surface

sdks/cpp/proto/hyperspace.grpc.pb.h1,420 symbols
sdks/cpp/proto/hyperspace.pb.h1,287 symbols
sdks/go/proto/hyperspace.pb.go901 symbols
sdks/go/proto/hyperspace_grpc.pb.go201 symbols
sdks/ts/src/proto/hyperspace_pb.d.ts189 symbols
sdks/cpp/proto/hyperspace.grpc.pb.cc123 symbols
sdks/ts/src/proto/hyperspace_grpc_pb.js120 symbols
crates/hyperspace-server/src/http_server.rs107 symbols
sdks/ts/src/proto/hyperspace_grpc_pb.d.ts81 symbols
sdks/python/hyperspace/proto/hyperspace_pb2_grpc.py81 symbols
sdks/ts/src/client.ts73 symbols
integrations/langchain-python/src/langchain_hyperspace/generated/hyperspace_pb2_grpc.py65 symbols

For agents

$ claude mcp add hyperspace-db \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page