@ruvector/edge-net

January 1, 2026 · View on GitHub

Collective AI Computing Network - Share, Contribute, Compute Together

A distributed computing platform that enables collective resource sharing for AI workloads. Contributors share idle compute resources, earning participation units (rUv) that can be used to access the network's collective AI computing power.

┌─────────────────────────────────────────────────────────────────────────────┐
│              EDGE-NET: COLLECTIVE AI COMPUTING NETWORK                      │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│   ┌─────────────┐       ┌─────────────┐       ┌─────────────┐              │
│   │  Your       │       │  Collective │       │  AI Tasks   │              │
│   │  Browser    │◄─────►│  Network    │◄─────►│  Completed  │              │
│   │  (Idle CPU) │  P2P  │  (1000s)    │       │  for You    │              │
│   └─────────────┘       └─────────────┘       └─────────────┘              │
│         │                     │                     │                       │
│         ▼                     ▼                     ▼                       │
│   ┌─────────────┐       ┌─────────────┐       ┌─────────────┐              │
│   │  Contribute │       │  Earn rUv   │       │  Use rUv    │              │
│   │  Compute    │  ───► │  Units      │  ───► │  for AI     │              │
│   │  When Idle  │       │  (Credits)  │       │  Workloads  │              │
│   └─────────────┘       └─────────────┘       └─────────────┘              │
│                                                                             │
│   Vector Search │ Embeddings │ Semantic Match │ Encryption │ Compression   │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Table of Contents


What is Edge-Net?

Edge-net creates a collective computing network where participants share idle browser resources to power distributed AI workloads. Think of it as a cooperative where:

  1. You Contribute - Share unused CPU cycles when browsing
  2. You Earn - Accumulate rUv (Resource Utility Vouchers) based on contribution
  3. You Use - Spend rUv to run AI tasks across the collective network
  4. Network Grows - More participants = more collective computing power

Why Collective AI Computing?

Traditional AI ComputingCollective Edge-Net
Expensive GPU serversFree idle browser CPUs
Centralized data centersDistributed global network
Pay-per-use pricingContribution-based access
Single point of failureResilient P2P mesh
Limited by your hardwareScale with the collective

Core Principles

PrincipleDescription
CollectibilityResources are pooled and shared fairly
ContributionEarn by giving, spend by using
Self-SustainingNetwork operates without central control
Privacy-FirstPi-Key cryptographic identity system
AdaptiveQ-learning security protects the collective

Key Features

Collective Resource Sharing

FeatureBenefit
Idle CPU UtilizationUse resources that would otherwise be wasted
Browser-BasedNo installation, runs in any modern browser
Adjustable ContributionControl how much you share (10-50% CPU)
Battery AwareAutomatically reduces on battery power
Fair DistributionWork routed based on capability matching

AI Computing Capabilities

Edge-net provides a complete AI stack that runs entirely in your browser. Each component is designed to be lightweight, fast, and work without a central server.

┌─────────────────────────────────────────────────────────────────────────────┐
│                        AI INTELLIGENCE STACK                                 │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    MicroLoRA Adapter Pool (from ruvLLM)              │   │
│  │  • LRU-managed pool (16 slots) • Rank 1-16 adaptation                │   │
│  │  • <50µs rank-1 forward        • 2,236+ ops/sec with batch 32        │   │
│  │  • 4-bit/8-bit quantization    • P2P shareable adapters              │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    SONA - Self-Optimizing Neural Architecture         │   │
│  │  • Instant Loop: Per-request MicroLoRA adaptation                    │   │
│  │  • Background Loop: Hourly K-means consolidation                     │   │
│  │  • Deep Loop: Weekly EWC++ consolidation (catastrophic forgetting)   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
│  ┌──────────────────────┐  ┌──────────────────────┐  ┌─────────────────┐  │
│  │   HNSW Vector Index  │  │  Federated Learning  │  │ ReasoningBank   │  │
│  │   • 150x faster      │  │  • TopK Sparsify 90% │  │ • Trajectories  │  │
│  │   • O(log N) search  │  │  • Byzantine tolerant│  │ • Pattern learn │  │
│  │   • Incremental P2P  │  │  • Diff privacy      │  │ • 87x energy    │  │
│  └──────────────────────┘  └──────────────────────┘  └─────────────────┘  │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Core AI Tasks

Task TypeUse CaseHow It Works
Vector SearchFind similar itemsHNSW index with 150x speedup
EmbeddingsText understandingGenerate semantic vectors
Semantic MatchIntent detectionClassify meaning
LoRA InferenceTask adaptationMicroLoRA <100µs forward
Pattern LearningSelf-optimizationReasoningBank trajectories

MicroLoRA Adapter System

What it does: Lets the network specialize for different tasks without retraining the whole model. Think of it like having 16 expert "hats" the AI can quickly swap between - one for searching, one for encryption, one for routing, etc.

Ported from ruvLLM with enhancements for distributed compute:

FeatureSpecificationPerformance
Rank Support1-16Rank-1: <50µs, Rank-2: <100µs
Pool Size16 concurrent adaptersLRU eviction policy
Quantization4-bit, 8-bit75% memory reduction
Batch Size32 (optimal)2,236+ ops/sec
Task TypesVectorSearch, Embedding, Inference, Crypto, RoutingAuto-routing

Why it matters: Traditional AI models are "one size fits all." MicroLoRA lets each node become a specialist for specific tasks in under 100 microseconds - faster than a blink.


SONA: Self-Optimizing Neural Architecture

What it does: The network teaches itself to get better over time using three learning speeds - instant reactions, daily improvements, and long-term memory. Like how your brain handles reflexes, daily learning, and permanent memories differently.

Three-temporal-loop continuous learning system:

LoopIntervalMechanismPurpose
InstantPer-requestMicroLoRA rank-2Immediate adaptation
BackgroundHourlyK-means clusteringPattern consolidation
DeepWeeklyEWC++ (λ=2000)Prevent catastrophic forgetting

Why it matters: Most AI systems forget old knowledge when learning new things ("catastrophic forgetting"). SONA's three-loop design lets the network learn continuously without losing what it already knows.


HNSW Vector Index

What it does: Finds similar items incredibly fast by organizing data like a multi-level highway system. Instead of checking every item (like walking door-to-door), it takes smart shortcuts to find what you need 150x faster.

ParameterDefaultDescription
M32Max connections per node
M_max_064Max connections at layer 0
ef_construction200Build-time beam width
ef_search64Search-time beam width
Performance150xSpeedup vs linear scan

Why it matters: When searching millions of vectors, naive search takes seconds. HNSW takes milliseconds - essential for real-time AI responses.


Federated Learning

What it does: Nodes teach each other without sharing their private data. Each node trains on its own data, then shares only the "lessons learned" (gradients) - like students sharing study notes instead of copying each other's homework.

P2P gradient gossip without central coordinator:

FeatureMechanismBenefit
TopK Sparsification90% compressionOnly share the most important updates
Rep-Weighted FedAvgReputation scoringTrusted nodes have more influence
Byzantine ToleranceOutlier detection, clippingIgnore malicious or broken nodes
Differential PrivacyNoise injectionMathematically guaranteed privacy
Gossip ProtocolEventually consistentWorks even if some nodes go offline

Why it matters: Traditional AI training requires sending all your data to a central server. Federated learning keeps your data local while still benefiting from collective intelligence.


ReasoningBank & Learning Intelligence

What it does: The network's "memory system" that remembers what worked and what didn't. Like keeping a journal of successful strategies that any node can learn from.

ComponentWhat It DoesWhy It's Fast
ReasoningBankStores successful task patternsSemantic search for quick recall
Pattern ExtractorGroups similar experiences togetherK-means finds common patterns
Multi-Head AttentionDecides which node handles each taskParallel evaluation of options
Spike-Driven AttentionUltra-low-power decision making87x more energy efficient

Why it matters: Without memory, the network would repeat the same mistakes. ReasoningBank lets nodes learn from each other's successes and failures across the entire collective.

Pi-Key Identity System

Ultra-compact cryptographic identity using mathematical constants:

Key TypeSizePurpose
π (Pi-Key)40 bytesYour permanent identity
e (Session)34 bytesTemporary encrypted sessions
φ (Genesis)21 bytesNetwork origin markers

Self-Optimizing Network

  • Automatic Task Routing - Work goes to best-suited nodes
  • Topology Optimization - Network self-organizes for efficiency
  • Q-Learning Security - Learns to defend against threats
  • Economic Balance - Self-sustaining resource economy

Quick Start

1. Add to Your Website

<script type="module">
  import init, { EdgeNetNode, EdgeNetConfig } from '@ruvector/edge-net';

  async function joinCollective() {
    await init();

    // Join the collective with your site ID
    const node = new EdgeNetConfig('my-website')
      .cpuLimit(0.3)          // Contribute 30% CPU when idle
      .memoryLimit(256 * 1024 * 1024)  // 256MB max
      .respectBattery(true)   // Reduce on battery
      .build();

    // Start contributing to the collective
    node.start();

    // Monitor your participation
    setInterval(() => {
      console.log(`Contributed: ${node.ruvBalance()} rUv`);
      console.log(`Tasks completed: ${node.getStats().tasks_completed}`);
    }, 10000);
  }

  joinCollective();
</script>

2. Use the Collective's AI Power

// Submit an AI task to the collective
const result = await node.submitTask('vector_search', {
  query: embeddings,
  k: 10,
  index: 'shared-knowledge-base'
}, 5);  // Spend up to 5 rUv

console.log('Similar items:', result);

3. Monitor Your Contribution

// Check your standing in the collective
const stats = node.getStats();
console.log(`
  rUv Earned: ${stats.ruv_earned}
  rUv Spent: ${stats.ruv_spent}
  Net Balance: ${stats.ruv_earned - stats.ruv_spent}
  Tasks Completed: ${stats.tasks_completed}
  Reputation: ${(stats.reputation * 100).toFixed(1)}%
`);

How It Works

The Contribution Cycle

┌─────────────────────────────────────────────────────────────────────────────┐
│                        CONTRIBUTION CYCLE                                    │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│   1. CONTRIBUTE          2. EARN              3. USE                        │
│   ┌─────────────┐       ┌─────────────┐       ┌─────────────┐              │
│   │   Browser   │       │    rUv      │       │  AI Tasks   │              │
│   │   detects   │  ───► │   credited  │  ───► │  submitted  │              │
│   │   idle time │       │   to you    │       │  to network │              │
│   └─────────────┘       └─────────────┘       └─────────────┘              │
│         │                     │                     │                       │
│         ▼                     ▼                     ▼                       │
│   ┌─────────────┐       ┌─────────────┐       ┌─────────────┐              │
│   │  Process    │       │  10x boost  │       │  Results    │              │
│   │  incoming   │       │  for early  │       │  returned   │              │
│   │  tasks      │       │  adopters   │       │  to you     │              │
│   └─────────────┘       └─────────────┘       └─────────────┘              │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Network Growth Phases

The collective grows through natural phases:

PhaseSizeYour Benefit
Genesis0-10K nodes10x rUv multiplier (early adopter bonus)
Growth10K-50KMultiplier decreases, network strengthens
Maturation50K-100KStable economy, high reliability
Independence100K+Self-sustaining, maximum collective power

Fair Resource Allocation

// The network automatically optimizes task distribution
const health = JSON.parse(node.getEconomicHealth());

console.log(`
  Resource Velocity: ${health.velocity}      // How fast resources circulate
  Utilization: ${health.utilization}         // Network capacity used
  Growth Rate: ${health.growth}              // Network expansion
  Stability: ${health.stability}             // Economic equilibrium
`);

AI Computing Tasks

Vector Search (Distributed Similarity)

Find similar items across the collective's distributed index:

// Search for similar documents
const similar = await node.submitTask('vector_search', {
  query: [0.1, 0.2, 0.3, ...],  // Your query vector
  k: 10,                         // Top 10 results
  index: 'shared-docs'           // Distributed index name
}, 3);  // Max 3 rUv

// Results from across the network
similar.forEach(item => {
  console.log(`Score: ${item.score}, ID: ${item.id}`);
});

Embedding Generation

Generate semantic embeddings using collective compute:

// Generate embeddings for text
const embeddings = await node.submitTask('embedding', {
  text: 'Your text to embed',
  model: 'sentence-transformer'
}, 2);

console.log('Embedding vector:', embeddings);

Semantic Matching

Classify intent or meaning:

// Classify text intent
const intent = await node.submitTask('semantic_match', {
  text: 'I want to cancel my subscription',
  categories: ['billing', 'support', 'sales', 'general']
}, 1);

console.log('Detected intent:', intent.category);

Secure Operations

Encrypt data across the network:

// Distributed encryption
const encrypted = await node.submitTask('encryption', {
  data: sensitiveData,
  operation: 'encrypt',
  key_id: 'my-shared-key'
}, 2);

Pi-Key Identity System

Your identity in the collective uses mathematical constants for key sizes:

Key Types

┌─────────────────────────────────────────────────────────────────────────────┐
│                        PI-KEY IDENTITY SYSTEM                               │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│   π Pi-Key (Identity)     e Euler-Key (Session)    φ Phi-Key (Genesis)     │
│   ┌─────────────────┐     ┌───────────────┐        ┌───────────────┐       │
│   │   314 bits      │     │   271 bits    │        │   161 bits    │       │
│   │   = 40 bytes    │     │   = 34 bytes  │        │   = 21 bytes  │       │
│   │                 │     │               │        │               │       │
│   │   Your unique   │     │   Temporary   │        │   Origin      │       │
│   │   identity      │     │   sessions    │        │   markers     │       │
│   │   (permanent)   │     │   (encrypted) │        │   (network)   │       │
│   └─────────────────┘     └───────────────┘        └───────────────┘       │
│                                                                             │
│   Ed25519 Signing         AES-256-GCM              SHA-256 Derived         │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Using Pi-Keys

import { PiKey, SessionKey, GenesisKey } from '@ruvector/edge-net';

// Create your permanent identity
const identity = new PiKey();
console.log(`Your ID: ${identity.getShortId()}`);  // π:a1b2c3d4...

// Sign data
const signature = identity.sign(data);
const valid = identity.verify(data, signature, identity.getPublicKey());

// Create encrypted backup
const backup = identity.createEncryptedBackup('my-password');

// Create temporary session
const session = SessionKey.create(identity, 3600);  // 1 hour
const encrypted = session.encrypt(sensitiveData);
const decrypted = session.decrypt(encrypted);

Security Architecture

Edge-net implements production-grade cryptographic security:

Cryptographic Primitives

ComponentAlgorithmPurpose
Key DerivationArgon2id (64MB, 3 iterations)Memory-hard password hashing
SigningEd25519Digital signatures (128-bit security)
EncryptionAES-256-GCMAuthenticated encryption
HashingSHA-256Content hashing and verification

Identity Protection

// Password-protected key export with Argon2id + AES-256-GCM
let encrypted = identity.export_secret_key("strong_password")?;

// Secure memory cleanup (zeroize)
// All sensitive key material is automatically zeroed after use

Authority Verification

All resolution events require cryptographic proof:

// Ed25519 signature verification for authority decisions
let signature = ScopedAuthority::sign_resolution(&resolution, &context, &signing_key);
// Signature verified against registered authority public keys

Attack Resistance

The RAC (RuVector Adversarial Coherence) protocol defends against:

AttackDefense
SybilStake-weighted voting, witness path diversity
EclipseContext isolation, Merkle divergence detection
Byzantine1/3 threshold, escalation tracking
ReplayTimestamp validation, duplicate detection
Double-spendConflict detection, quarantine system

Self-Optimization

The network continuously improves itself:

Automatic Task Routing

// Get optimal peers for your tasks
const peers = node.getOptimalPeers(5);

// Network learns from every interaction
node.recordTaskRouting('vector_search', 'peer-123', 45, true);

Fitness-Based Evolution

// High-performing nodes can replicate their config
if (node.shouldReplicate()) {
  const optimalConfig = node.getRecommendedConfig();
  // New nodes inherit successful configurations
}

// Track your contribution
const fitness = node.getNetworkFitness();  // 0.0 - 1.0

Q-Learning Security

The collective learns to defend itself:

// Run security audit
const audit = JSON.parse(node.runSecurityAudit());
console.log(`Security Score: ${audit.security_score}/10`);

// Defends against:
// - DDoS attacks
// - Sybil attacks
// - Byzantine behavior
// - Eclipse attacks
// - Replay attacks

Tutorials

Tutorial 1: Join the Collective

import init, { EdgeNetConfig } from '@ruvector/edge-net';

async function joinCollective() {
  await init();

  // Configure your contribution
  const node = new EdgeNetConfig('my-site')
    .cpuLimit(0.25)           // 25% CPU when idle
    .memoryLimit(128 * 1024 * 1024)  // 128MB
    .minIdleTime(5000)        // Wait 5s of idle
    .respectBattery(true)     // Reduce on battery
    .build();

  // Join the network
  node.start();

  // Check your status
  console.log('Joined collective!');
  console.log(`Node ID: ${node.nodeId()}`);
  console.log(`Multiplier: ${node.getMultiplier()}x`);

  return node;
}

Tutorial 2: Contribute and Earn

async function contributeAndEarn(node) {
  // Process tasks from the collective
  let tasksCompleted = 0;

  while (true) {
    // Check if we should work
    if (node.isIdle()) {
      // Process a task from the network
      const processed = await node.processNextTask();

      if (processed) {
        tasksCompleted++;
        const stats = node.getStats();
        console.log(`Completed ${tasksCompleted} tasks, earned ${stats.ruv_earned} rUv`);
      }
    }

    await new Promise(r => setTimeout(r, 1000));
  }
}

Tutorial 3: Use Collective AI Power

async function useCollectiveAI(node) {
  // Check your balance
  const balance = node.ruvBalance();
  console.log(`Available: ${balance} rUv`);

  // Submit AI tasks
  const tasks = [
    { type: 'vector_search', cost: 3 },
    { type: 'embedding', cost: 2 },
    { type: 'semantic_match', cost: 1 }
  ];

  for (const task of tasks) {
    if (balance >= task.cost) {
      console.log(`Running ${task.type}...`);
      const result = await node.submitTask(
        task.type,
        { data: 'sample' },
        task.cost
      );
      console.log(`Result: ${JSON.stringify(result)}`);
    }
  }
}

Tutorial 4: Monitor Network Health

async function monitorHealth(node) {
  setInterval(() => {
    // Your contribution
    const stats = node.getStats();
    console.log(`
      === Your Contribution ===
      Earned: ${stats.ruv_earned} rUv
      Spent: ${stats.ruv_spent} rUv
      Tasks: ${stats.tasks_completed}
      Reputation: ${(stats.reputation * 100).toFixed(1)}%
    `);

    // Network health
    const health = JSON.parse(node.getEconomicHealth());
    console.log(`
      === Network Health ===
      Velocity: ${health.velocity.toFixed(2)}
      Utilization: ${(health.utilization * 100).toFixed(1)}%
      Stability: ${health.stability.toFixed(2)}
    `);

    // Check sustainability
    const sustainable = node.isSelfSustaining(10000, 50000);
    console.log(`Self-sustaining: ${sustainable}`);

  }, 30000);
}

API Reference

Core Methods

MethodDescriptionReturns
new EdgeNetNode(siteId)Join the collectiveEdgeNetNode
start()Begin contributingvoid
pause() / resume()Control contributionvoid
ruvBalance()Check your creditsu64
submitTask(type, payload, maxCost)Use collective computePromise<Result>
processNextTask()Process work for othersPromise<bool>

Identity Methods

MethodDescriptionReturns
new PiKey()Generate identityPiKey
getIdentity()Get 40-byte identityVec<u8>
sign(data)Sign dataVec<u8>
verify(data, sig, pubkey)Verify signaturebool
createEncryptedBackup(password)Backup identityVec<u8>

Network Methods

MethodDescriptionReturns
getNetworkFitness()Your contribution scoref32
getOptimalPeers(count)Best nodes for tasksVec<String>
getEconomicHealth()Network health metricsString (JSON)
isSelfSustaining(nodes, tasks)Check sustainabilitybool

Development

Build

cd examples/edge-net
wasm-pack build --target web --out-dir pkg

Test

cargo test

Run Simulation

cd sim
npm install
npm run simulate

Exotic AI Capabilities

Edge-net can be enhanced with exotic AI WASM capabilities for advanced P2P coordination, self-learning, and distributed reasoning. Enable these features by building with the appropriate feature flags.

Available Feature Flags

FeatureDescriptionDependencies
exoticTime Crystal, NAO, Morphogenetic Networksruvector-exotic-wasm
learning-enhancedMicroLoRA, BTSP, HDC, WTA, Global Workspaceruvector-learning-wasm, ruvector-nervous-system-wasm
economy-enhancedEnhanced CRDT creditsruvector-economy-wasm
exotic-fullAll exotic capabilitiesAll above

Time Crystal (P2P Synchronization)

Robust distributed coordination using discrete time crystal dynamics:

// Enable time crystal with 10 oscillators
node.enableTimeCrystal(10);

// Check synchronization level (0.0 - 1.0)
const sync = node.getTimeCrystalSync();
console.log(`P2P sync: ${(sync * 100).toFixed(1)}%`);

// Check if crystal is stable
if (node.isTimeCrystalStable()) {
  console.log('Network is synchronized!');
}

NAO (Neural Autonomous Organization)

Decentralized governance with stake-weighted quadratic voting:

// Enable NAO with 70% quorum requirement
node.enableNAO(0.7);

// Add peer nodes as members
node.addNAOMember('peer-123', 100);
node.addNAOMember('peer-456', 50);

// Propose and vote on network actions
const propId = node.proposeNAOAction('Increase task capacity');
node.voteNAOProposal(propId, 0.9);  // Vote with 90% weight

// Execute if quorum reached
if (node.executeNAOProposal(propId)) {
  console.log('Proposal executed!');
}

MicroLoRA (Per-Node Self-Learning)

Ultra-fast LoRA adaptation with <100us latency:

// Enable MicroLoRA with rank-2 adaptation
node.enableMicroLoRA(2);

// Adapt weights based on task feedback
const gradient = new Float32Array(128);
node.adaptMicroLoRA('vector_search', gradient);

// Apply adaptation to inputs
const input = new Float32Array(128);
const adapted = node.applyMicroLoRA('vector_search', input);

HDC (Hyperdimensional Computing)

10,000-bit binary hypervectors for distributed reasoning:

// Enable HDC memory
node.enableHDC();

// Store patterns for semantic operations
node.storeHDCPattern('concept_a');
node.storeHDCPattern('concept_b');

WTA (Winner-Take-All)

Instant decisions with <1us latency:

// Enable WTA with 1000 neurons
node.enableWTA(1000);

BTSP (One-Shot Learning)

Immediate pattern association without iterative training:

// Enable BTSP with 128-dim inputs
node.enableBTSP(128);

// One-shot associate a pattern
const pattern = new Float32Array(128);
node.oneShotAssociate(pattern, 1.0);

Morphogenetic Network

Self-organizing network topology through cellular differentiation:

// Enable 100x100 morphogenetic grid
node.enableMorphogenetic(100);

// Network grows automatically
console.log(`Cells: ${node.getMorphogeneticCellCount()}`);

Stepping All Capabilities

In your main loop, step all capabilities forward:

function gameLoop(dt) {
  // Step exotic capabilities
  node.stepCapabilities(dt);

  // Process tasks
  node.processNextTask();
}

setInterval(() => gameLoop(0.016), 16);  // 60 FPS

Building with Exotic Features

# Build with exotic capabilities
wasm-pack build --target web --release --out-dir pkg -- --features exotic

# Build with learning-enhanced capabilities
wasm-pack build --target web --release --out-dir pkg -- --features learning-enhanced

# Build with all exotic capabilities
wasm-pack build --target web --release --out-dir pkg -- --features exotic-full

Core Architecture & Capabilities

Edge-net is a production-grade distributed AI computing platform with ~36,500 lines of Rust code and 177 passing tests.

Unified Attention Architecture

Four attention mechanisms that answer critical questions for distributed AI:

┌─────────────────────────────────────────────────────────────────────────────┐
│                    UNIFIED ATTENTION ARCHITECTURE                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐            │
│  │ Neural Attention│  │  DAG Attention  │  │ Graph Attention │            │
│  │                 │  │                 │  │                 │            │
│  │ "What words     │  │ "What steps     │  │ "What relations │            │
│  │  matter?"       │  │  matter?"       │  │  matter?"       │            │
│  │                 │  │                 │  │                 │            │
│  │ • Multi-head    │  │ • Topo-sort     │  │ • GAT-style     │            │
│  │ • Q/K/V project │  │ • Critical path │  │ • Edge features │            │
│  │ • Softmax focus │  │ • Parallelism   │  │ • Message pass  │            │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘            │
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────┐          │
│  │                   State Space Model (SSM)                    │          │
│  │                                                              │          │
│  │     "What history still matters?" - O(n) Mamba-style         │          │
│  │                                                              │          │
│  │  • Selective gating: What to remember vs forget              │          │
│  │  • O(n) complexity: Efficient long-sequence processing       │          │
│  │  • Temporal dynamics: dt, A, B, C, D state transitions       │          │
│  └─────────────────────────────────────────────────────────────┘          │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
Attention TypeQuestion AnsweredUse Case
NeuralWhat words matter?Semantic focus, importance weighting
DAGWhat steps matter?Task scheduling, critical path analysis
GraphWhat relationships matter?Network topology, peer connections
State SpaceWhat history matters?Long-term memory, temporal patterns

AI Intelligence Layer

┌─────────────────────────────────────────────────────────────────────────────┐
│                       AI Intelligence Layer                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐             │
│  │  HNSW Index     │  │  AdapterPool    │  │  Federated      │             │
│  │  (memory.rs)    │  │   (lora.rs)     │  │ (federated.rs)  │             │
│  │                 │  │                 │  │                 │             │
│  │ • 150x speedup  │  │ • LRU eviction  │  │ • TopK Sparse   │             │
│  │ • O(log N)      │  │ • 16 slots      │  │ • Byzantine tol │             │
│  │ • Cosine dist   │  │ • Task routing  │  │ • Rep-weighted  │             │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘             │
│                                                                             │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐             │
│  │  DAG Attention  │  │  LoraAdapter    │  │ GradientGossip  │             │
│  │                 │  │                 │  │                 │             │
│  │ • Critical path │  │ • Rank 1-16     │  │ • Error feedback│             │
│  │ • Topo sort     │  │ • SIMD forward  │  │ • Diff privacy  │             │
│  │ • Parallelism   │  │ • 4/8-bit quant │  │ • Gossipsub     │             │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘             │
└─────────────────────────────────────────────────────────────────────────────┘

Swarm Intelligence

ComponentCapabilityDescription
Entropy ConsensusBelief convergenceShannon entropy-based decision making
Collective MemoryPattern sharingHippocampal-inspired consolidation and replay
StigmergyPheromone trailsAnt colony optimization for task routing
Consensus CoordinatorMulti-topicParallel consensus on multiple decisions

Compute Acceleration

┌─────────────────────────────────────────────────────────────────────────────┐
│                      COMPUTE ACCELERATION STACK                              │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                      WebGPU Compute Backend                          │   │
│  │                                                                      │   │
│  │  • wgpu-based GPU acceleration (10+ TFLOPS target)                   │   │
│  │  • Matrix multiplication pipeline (tiled, cache-friendly)            │   │
│  │  • Attention pipeline (Flash Attention algorithm)                    │   │
│  │  • LoRA forward pipeline (<1ms inference)                            │   │
│  │  • Staging buffer pool (16MB, zero-copy transfers)                   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                      WebWorker Pool                                  │   │
│  │                                                                      │   │
│  │  +------------------+                                                │   │
│  │  |   Main Thread    |                                                │   │
│  │  |  (Coordinator)   |                                                │   │
│  │  +--------+---------+                                                │   │
│  │           |                                                          │   │
│  │     +-----+-----+-----+-----+                                        │   │
│  │     |     |     |     |     |                                        │   │
│  │  +--v-+ +-v--+ +--v-+ +--v-+ +--v-+                                  │   │
│  │  | W1 | | W2 | | W3 | | W4 | | Wn |  (up to 16 workers)             │   │
│  │  +----+ +----+ +----+ +----+ +----+                                  │   │
│  │     |     |     |     |     |                                        │   │
│  │     +-----+-----+-----+-----+                                        │   │
│  │           |                                                          │   │
│  │     SharedArrayBuffer (when available, zero-copy)                    │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
│  ┌────────────────────────┐  ┌────────────────────────┐                   │
│  │   WASM SIMD (simd128)  │  │   WebGL Compute        │                   │
│  │   • f32x4 vectorized   │  │   • Shader fallback    │                   │
│  │   • 4x parallel ops    │  │   • Universal support  │                   │
│  │   • All modern browsers│  │   • Fragment matmul    │                   │
│  └────────────────────────┘  └────────────────────────┘                   │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
BackendAvailabilityPerformanceOperations
WebGPUChrome 113+, Firefox 120+10+ TFLOPSMatmul, Attention, LoRA
WebWorker PoolAll browsers4-16x CPU coresParallel matmul, dot product
WASM SIMDAll modern browsers4x vectorizedCosine distance, softmax
WebGLUniversal fallbackShader computeMatrix operations
CPUAlways availableLoop-unrolledAll operations

WebGPU Pipelines

PipelinePurposePerformance Target
MatmulMatrix multiplication (tiled)10+ TFLOPS
AttentionFlash attention (memory efficient)2ms for 4K context
LoRALow-rank adapter forward pass<1ms inference

WebWorker Operations

OperationDescriptionParallelization
MatmulPartialRow-blocked matrix multiplyRows split across workers
DotProductPartialPartial vector dot productsSegments split across workers
VectorOpElement-wise ops (add, mul, relu, sigmoid)Ranges split across workers
ReduceSum, max, min, mean reductionsHierarchical aggregation

Work Stealing

Workers that finish early can steal tasks from busy workers' queues:

  • LIFO for local tasks (cache locality)
  • FIFO for stolen tasks (load balancing)

Economics & Reputation

FeatureMechanismPurpose
AMMAutomated Market MakerDynamic rUv pricing
ReputationStake-weighted scoringTrust computation
SlashingByzantine penaltiesBad actor deterrence
RewardsContribution trackingFair distribution

Network Learning

ComponentLearning TypeApplication
RACAdversarial CoherenceConflict resolution
ReasoningBankTrajectory learningStrategy optimization
Q-LearningReinforcementSecurity adaptation
FederatedDistributed trainingModel improvement

Self-Learning Hooks & MCP Integration

Edge-net integrates with Claude Code's hooks system for continuous self-learning.

Learning Scenarios Module

use ruvector_edge_net::learning_scenarios::{
    NeuralAttention, DagAttention, GraphAttention, StateSpaceAttention,
    AttentionOrchestrator, ErrorLearningTracker, SequenceTracker,
    get_ruvector_tools, generate_settings_json,
};

// Create unified attention orchestrator
let orchestrator = AttentionOrchestrator::new(
    NeuralAttention::new(128, 4),      // 128 dim, 4 heads
    DagAttention::new(),
    GraphAttention::new(64, 4),         // 64 dim, 4 heads
    StateSpaceAttention::new(256, 0.95), // 256 dim, 0.95 decay
);

// Get comprehensive attention analysis
let analysis = orchestrator.analyze(tokens, &dag, &graph, &history);

Error Pattern Learning

let mut tracker = ErrorLearningTracker::new();

// Record errors for learning
tracker.record_error(ErrorPattern::TypeMismatch, "expected String", "lib.rs", 42);

// Get AI-suggested fixes
let fixes = tracker.get_suggestions("type mismatch");
// ["Use .to_string()", "Use String::from()", ...]

MCP Tool Categories

CategoryToolsPurpose
VectorDbvector_search, vector_store, vector_querySemantic similarity
Learninglearn_pattern, train_model, get_suggestionsPattern recognition
Memoryremember, recall, forgetVector memory
Swarmspawn_agent, coordinate, route_taskMulti-agent coordination
Telemetrytrack_event, get_stats, export_metricsUsage analytics
AgentRoutingsuggest_agent, record_outcome, get_routing_tableAgent selection

RuVector CLI Commands

# Session management
ruvector hooks session-start    # Start learning session
ruvector hooks session-end      # Save patterns

# Intelligence
ruvector hooks stats            # Show learning stats
ruvector hooks route <task>     # Get agent suggestion
ruvector hooks suggest-context  # Context suggestions

# Memory
ruvector hooks remember <content> -t <type>  # Store memory
ruvector hooks recall <query>                # Semantic search

Claude Code Hook Events

EventTriggerAction
PreToolUseBefore Edit/BashAgent routing, risk analysis
PostToolUseAfter Edit/BashQ-learning update, pattern recording
SessionStartConversation beginsLoad intelligence
StopConversation endsSave learning data
UserPromptSubmitUser messageContext suggestions
PreCompactBefore compactionPreserve context

Research Foundation

Edge-net is built on research in:

  • Distributed Computing - P2P resource sharing
  • Collective Intelligence - Emergent optimization
  • Game Theory - Incentive-compatible mechanisms
  • Adaptive Security - Q-learning threat response
  • Time Crystals - Floquet engineering for coordination
  • Neuromorphic Computing - BTSP, HDC, WTA mechanisms
  • Decentralized Governance - Neural Autonomous Organizations

Disclaimer

Edge-net is a research platform for collective computing. The rUv units are:

  • Resource participation metrics, not currency
  • Used for balancing contribution and consumption
  • Not redeemable for money or goods outside the network

License

MIT License