exo-wasm
WASM bindings for EXO-AI 2025 Cognitive Substrate, enabling browser-based deployment of advanced AI substrate operations.
Features
- Pattern Storage: Store and retrieve cognitive patterns with embeddings
- Similarity Search: High-performance vector search with multiple distance metrics
- Temporal Memory: Track patterns with timestamps and causal relationships
- Causal Queries: Query patterns within causal cones
- Browser-First: Optimized for browser deployment with zero-copy transfers
Installation
# Build the WASM package
# Or for Node.js
Usage
Browser (ES Modules)
import init from './pkg/exo_wasm.js';
;
Node.js
const = require;
const substrate = ;
// Use as shown above
API Reference
ExoSubstrate
Main substrate interface.
Constructor
Config options:
dimensions(number): Vector dimensions (required)distance_metric(string): "euclidean", "cosine", "dotproduct", or "manhattan" (default: "cosine")use_hnsw(boolean): Enable HNSW index (default: true)enable_temporal(boolean): Enable temporal tracking (default: true)enable_causal(boolean): Enable causal tracking (default: true)
Methods
store(pattern): Store a pattern, returns pattern IDquery(embedding, k): Search for k similar patterns (returns Promise)get(id): Retrieve pattern by IDdelete(id): Delete pattern by IDlen(): Get number of patternsisEmpty(): Check if substrate is emptystats(): Get substrate statistics
Pattern
Represents a cognitive pattern.
Constructor
Parameters:
embedding(Float32Array): Vector embeddingmetadata(object, optional): Arbitrary metadataantecedents(string[], optional): IDs of causal antecedents
Properties
id: Pattern ID (set after storage)embedding: Vector embedding (Float32Array)metadata: Pattern metadatatimestamp: Creation timestamp (milliseconds since epoch)antecedents: Causal antecedent IDs
Building
Prerequisites
- Rust 1.75+
- wasm-pack
- Node.js (for testing)
Build Commands
# Development build
# Production build (optimized)
# Build for specific target
Testing
# Run tests in browser
# Run tests in Node.js
Performance
The WASM bindings are optimized for browser deployment:
- Size: ~2MB gzipped (with SIMD)
- Initialization: <50ms on modern browsers
- Search: 10k+ queries/second (HNSW enabled)
- Zero-copy: Uses transferable objects where possible
Architecture
This crate provides WASM bindings for the EXO-AI 2025 cognitive substrate. It currently uses ruvector-core as the underlying implementation, with plans to integrate with the full EXO substrate layer.
exo-wasm/
├── src/
│ ├── lib.rs # Main WASM bindings
│ ├── types.rs # Type conversions
│ └── utils.rs # Utility functions
├── Cargo.toml
└── README.md
Links
License
MIT OR Apache-2.0