Commit graph

26 commits

Author SHA1 Message Date
Claude
256aa80abd
fix(security): Address critical security and performance issues in ZK proofs
Security Fixes:
- CRITICAL: Add zeroize on drop for FinancialProver to prevent memory extraction
- HIGH: Fix WASM type import (ProdVerificationResult -> VerificationResult)
- MEDIUM: Add input validation for zero rent/multiplier/budget values
- Use checked_mul instead of saturating_mul for overflow detection

Performance Optimizations:
- Reduce generator memory from 16 MB to 8 MB (1-party vs 16-party)
- Add zeroize dependency (1.8) for secure memory clearing

Documentation:
- Add comprehensive ZK performance analysis docs
- Add benchmark suite for criterion testing
- Add optimization quick reference and examples

All 7 production ZK tests pass.
2026-01-01 19:52:44 +00:00
Claude
cb28364c7b
feat(zk): Add production-ready Bulletproofs for zero-knowledge financial proofs
- Add production crypto: bulletproofs 5.0, merlin 3.0, subtle 2.5, lazy_static
- Implement zkproofs_prod.rs with real Ristretto255 Pedersen commitments
- Add constant-time operations via subtle crate for side-channel resistance
- Create zk_wasm_prod.rs with WASM bindings for browser-based ZK proofs
- Fix bit size calculation (Bulletproofs requires power-of-2: 8, 16, 32, 64)
- Fix memory leak: use rand crate instead of getrandom for non-wasm

Security improvements:
- Real cryptographic Bulletproofs (not demo hashing)
- Fiat-Shamir transcripts via Merlin for non-interactive proofs
- Constant-time comparison to prevent timing attacks
- Proof expiration and integrity verification

All 7 production ZK tests pass.
2026-01-01 19:31:40 +00:00
Claude
dcb59ee80e
fix(security): Address critical security and performance issues
Security Fixes:
- Remove blinding factor from Commitment struct (was leaking secrets)
- Add per-installation unique salt for key derivation (was hardcoded)
- Add prominent security warnings to zkproofs.rs (demo-only crypto)
- Document that ZK implementation is for API demonstration only

Performance Fixes:
- Fix memory leak: category_embeddings now uses HashMap instead of Vec
- Add LRU-style eviction at 10k embeddings capacity
- Prevents unbounded memory growth that would crash browser

Code Quality:
- Add max_embeddings configuration option
- Better documentation for data structures
- Add security audit report and optimization guides

⚠️ IMPORTANT: The ZK proof cryptography is simplified for demonstration.
For production use, replace with bulletproofs, curve25519-dalek, merlin crates.
2026-01-01 18:36:58 +00:00
Claude
ba7dafd3ac
feat(edge): Add zero-knowledge financial proofs for privacy-preserving verification
Implements ZK proofs that allow users to prove financial statements without
revealing actual numbers. Key features:

- Bulletproofs-style range proofs (no trusted setup required)
- Pedersen commitments to hide actual values
- Proof types: income, affordability, savings, overdraft, debt ratio
- Complete rental application proof bundle
- All proof generation runs in browser WASM

Components:
- examples/edge/src/plaid/zkproofs.rs: Core ZK proof system
- examples/edge/src/plaid/zk_wasm.rs: WASM bindings for browser
- examples/edge/pkg/zk-financial-proofs.ts: TypeScript API
- examples/edge/pkg/zk-demo.html: Interactive demo

Use cases:
- Rental applications: Prove income ≥ 3× rent without revealing salary
- Loan pre-qualification: Prove DTI ratio without revealing debts
- Employment verification: Prove minimum salary without exact pay
- Account stability: Prove no overdrafts without transaction history

Privacy guarantee: Verifier mathematically CANNOT extract actual numbers
from the proof - only learns whether statement is true or false.
2026-01-01 18:20:29 +00:00
Claude
55dcfe330c
feat(edge): Add Plaid local learning system for browser-based financial intelligence
Implements a privacy-preserving financial learning system that runs entirely
in the browser using WebAssembly. Key features:

- PlaidLocalLearner: Browser-local ML engine with IndexedDB persistence
- Q-learning for budget optimization and spending recommendations
- HNSW vector index for semantic transaction categorization
- Spiking neural network for temporal pattern recognition
- Anomaly detection for unusual transaction flagging
- Zero data exfiltration - all learning stays client-side

Components:
- examples/edge/src/plaid/mod.rs: Core Rust learning algorithms
- examples/edge/src/plaid/wasm.rs: WASM bindings for browser
- examples/edge/pkg/plaid-local-learner.ts: TypeScript API wrapper
- examples/edge/pkg/plaid-demo.html: Interactive demo page
- examples/edge/docs/plaid-local-learning.md: Comprehensive documentation

Privacy guarantees:
- Financial data never leaves the browser
- Optional AES-256-GCM encryption for IndexedDB storage
- User can delete all data instantly
- No analytics, telemetry, or tracking
2026-01-01 17:48:00 +00:00
rUv
cc0198e4a4 Add integration tests for ruvector-learning-wasm and ruvector-nervous-system-wasm
- Implement comprehensive tests for adaptive learning mechanisms including MicroLoRA and SONA in learning_tests.rs.
- Introduce tests for bio-inspired neural components such as HDC, BTSP, and Spiking Neural Networks in nervous_system_tests.rs.
- Create common utilities for random vector generation, vector assertions, and softmax calculations in mod.rs.
- Ensure all tests validate expected behaviors and maintain numerical stability.
2026-01-01 07:06:54 +00:00
rUv
dcd1132675 feat(edge): add Web Workers configuration to generator
- Add Concurrency section with 4 worker modes:
  - Main Thread (no workers, simple)
  - Worker Pool (auto-scaling, recommended)
  - Dedicated (one worker per task type)
  - Shared Worker (cross-tab coordination)
- Add comprehensive worker templates with code examples
- Update stats to show worker count
- Include WorkerPool class with batch operations
- Add SharedWorker cross-tab example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 22:15:53 +00:00
rUv
c40e28049c docs(edge): add Web Workers section with understandable language
- Add comprehensive Web Workers section explaining UI responsiveness
- Include WorkerPool usage examples with practical code
- Add feature table explaining auto-scaling, load balancing, timeouts
- Add "when to use workers" guidance table
- Update Table of Contents with Consensus Modes and Web Workers
- Add WorkerPool to API Reference section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 22:13:55 +00:00
rUv
89bbae1485 docs(edge): update source README with npm package and consensus modes
- Add npm package section at top with install commands
- Link to pkg/README.md for JavaScript documentation
- Clarify Raft vs Gossip+CRDT consensus modes
- Add Web Worker pool to distributed systems features
- Update WASM badge to show 364KB size

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 22:11:09 +00:00
rUv
421279b61e feat(edge): add Web Worker pool for parallel operations
- Include worker.js and worker-pool.js in package
- Add exports for @ruvector/edge/worker and @ruvector/edge/worker-pool
- Document WorkerPool API with examples
- Features: round-robin distribution, batch splitting, load balancing
- Keeps UI responsive during heavy WASM operations
- Bump to v0.1.9

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 22:10:04 +00:00
rUv
81d10f4224 docs(edge): clarify Raft vs Gossip+CRDT consensus modes
Raft assumes stable membership and trusted nodes - not suitable for
wild browser swarms. Updated docs to:

- Position Raft for "trusted cohorts" (teams, enterprise, private relays)
- Add Gossip + CRDT for "open swarms" (public, high-churn, adversarial)
- Explain when to use each mode with code examples
- Update capability tables to reflect both consensus strategies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:09:49 +00:00
rUv
6369a145da docs(edge): highlight self-learning capabilities in intro
- Update heading to "Free Self-Learning AI Swarms at the Edge"
- Emphasize self-optimizing agents that get smarter over time
- Mention LoRA fine-tuning, EWC++ continual learning, ReasoningBank
- Bump to v0.1.7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:06:28 +00:00
rUv
94bc0f817d docs(edge): clarify full platform capabilities and edge-full integration
- Add comprehensive platform diagram showing edge vs edge-full
- List all capabilities of edge-full modules
- Add optional/peer dependency on @ruvector/edge-full
- Show usage patterns for both packages together
- Bump to v0.1.6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:03:45 +00:00
rUv
53c9f57e13 feat(edge-full): add unified WASM package with all modules
- Create @ruvector/edge-full package bundling 6 WASM modules:
  - edge: crypto, vectors, consensus (364KB)
  - graph: Neo4j-style graph DB with Cypher (288KB)
  - rvlite: SQL/SPARQL/Cypher vector DB (260KB)
  - sona: self-learning neural router (238KB)
  - dag: workflow orchestration (132KB)
  - onnx: HuggingFace embeddings (7.1MB)

- Update generator.html with module selection UI
- Add module-specific code templates
- Update @ruvector/edge README with edge-full reference
- Bump @ruvector/edge to v0.1.5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:59:29 +00:00
rUv
a4243ce042 feat(edge): add interactive swarm generator with MCP tools
Generator Features:
- 6 topologies: Mesh, Star, Hierarchical, Ring, Gossip, Sharded
- 4 transports: GUN.js, WebRTC, libp2p, Nostr
- 6 use cases: AI Assistants, Data Pipeline, Gaming, IoT, Marketplace, Research
- 8 features: Identity, Encryption, HNSW, Semantic, Raft, Post-Quantum, Spiking, Compression
- 7 exotic patterns: MCP Tools, Byzantine, Quantum, Neural Consensus, Swarm Intel, Self-Healing, Emergent

Browser-Based MCP Tools:
- discover_agents: Find agents by capability
- send_secure_message: Encrypted P2P messaging
- store_memory: Vector memory storage
- search_memory: Semantic search
- sign_message: Cryptographic signing
- MCPCollaborativeNetwork: Multi-server coordination

Live demo runs directly in browser using WASM.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:41:27 +00:00
rUv
6639947e47 docs(edge): add free infrastructure guide with tables
- Improved intro with cost comparison table and architecture diagram
- Added comprehensive free infrastructure section:
  - Free GUN relays (unlimited)
  - Free STUN servers (Google, Cloudflare, Mozilla)
  - Free TURN providers table
  - Free signaling services table
  - Free Nostr relays
  - Free self-hosting options (Fly.io, Railway, Cloudflare Workers)
- Complete example using 100% free stack
- Cost summary showing $0/month at any scale (1 to 1M+ users)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:30:46 +00:00
rUv
0365595328 docs(edge): add comprehensive tutorial-style README
- 5-step tutorial: Identity, Crypto, Vector Search, Routing, Consensus
- P2P transport options: WebRTC, GUN.js, IPFS/libp2p, Nostr
- Full code examples for each transport integration
- Architecture diagrams showing edge-first design
- Transport comparison table with recommendations
- Complete API reference for all 9 WASM exports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:22:06 +00:00
rUv
d981a56e36 feat(edge): add WASM bindings and publish @ruvector/edge v0.1.1
WASM Implementation:
- Add wasm.rs with bindings for all core P2P types
- Configure Cargo.toml with wasm/native feature flags
- Gate native-only modules (tokio, transport) behind feature flags
- Convert intelligence.rs and memory.rs to sync (parking_lot::RwLock)
- Fix distributed_learning.rs example for sync API

Exports:
- WasmIdentity, WasmCrypto, WasmHnswIndex
- WasmSemanticMatcher, WasmRaftNode, WasmHybridKeyPair
- WasmSpikingNetwork, WasmQuantizer, WasmAdaptiveCompressor

Build:
- WASM: wasm-pack build --no-default-features --features wasm
- Native: cargo build --features native
- Tests: 60 passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:16:15 +00:00
rUv
b9bf51bb01 docs(edge): improve README with free edge swarm introduction
- Emphasize zero-cost edge-first architecture
- Add economics comparison (cloud vs edge)
- Document all WASM APIs with examples
- Add use cases and architecture diagram
- Compare with cloud alternatives (OpenAI, LangChain, AutoGPT)
- Include agentic-flow integration example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:15:24 +00:00
rUv
09b66e5191 feat(edge): add WASM npm package @ruvector/edge
- Built WASM bindings with wasm-pack for browser/Node.js usage
- Exports: WasmIdentity, WasmCrypto, WasmHnswIndex, WasmSemanticMatcher,
  WasmRaftNode, WasmHybridKeyPair, WasmSpikingNetwork, WasmQuantizer,
  WasmAdaptiveCompressor
- 364KB optimized WASM binary with full TypeScript types
- Published to npm as @ruvector/edge@0.1.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:11:26 +00:00
rUv
7eafcab492 docs(edge): comprehensive README overhaul
- Added badges (Rust, License, Tests, Security, WASM)
- New "Why RuVector Edge?" section explaining problem/solution
- Key Benefits table with quantified impacts
- Unique Capabilities table with 8 advanced features
- Features organized by category (Security, Intelligence, Performance, Distributed)
- Updated architecture diagram with Advanced Intelligence layer
- 7 comprehensive usage examples:
  - HNSW Vector Search
  - Post-Quantum Signatures
  - Spiking Neural Networks
  - Raft Consensus
  - Semantic Task Matching
  - Adaptive Compression
- Performance benchmarks table
- Zero-Trust Identity Chain documentation
- Comparison table vs libp2p, Matrix, NATS
- API Reference with Core Types table
- Complete exports listing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:48:00 +00:00
rUv
50da131469 feat(edge/p2p): complete RuVector advanced integrations
Added:
- Semantic embeddings interface with hash-based LSH encoding
- SemanticTaskMatcher for intelligent agent-task matching
- Raft consensus protocol for distributed task coordination
  - Leader election with term-based voting
  - Log replication with consistency checks
  - Heartbeat and append entries protocol

Now exports 20+ advanced types from p2p module:
- Quantization: ScalarQuantized, BinaryQuantized, CompressedData
- HDC: Hypervector, HdcMemory, HDC_DIMENSION
- Compression: AdaptiveCompressor, NetworkCondition
- Pattern routing: PatternRouter
- Vector index: HnswIndex
- Post-quantum: HybridKeyPair, HybridPublicKey, HybridSignature
- Spiking networks: LIFNeuron, SpikingNetwork
- Embeddings: SemanticEmbedder, SemanticTaskMatcher
- Consensus: RaftNode, RaftState, LogEntry, RaftVoteRequest/Response, RaftAppendEntries/Response

60 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:37:57 +00:00
rUv
f1f39902cd feat(edge/p2p): add advanced RuVector integrations
- HNSW vector indexing for O(log n) nearest neighbor search
- Hybrid post-quantum signatures (Ed25519 + Dilithium-style)
- Spiking neural networks (LIF neurons with STDP learning)
- Binary/Scalar quantization (4-32x compression)
- Hyperdimensional Computing for pattern matching
- Adaptive compression based on network conditions
- HDC-based semantic task routing

54 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:35:37 +00:00
rUv
99c5c97a73 docs(edge): Update README with P2P Swarm security documentation
- Add P2P Swarm Layer to architecture diagram
- Document Ed25519/X25519 crypto and AES-256-GCM encryption
- Add security features table and code examples
- Document task execution with signed receipts
- Add GUN integration section
- Include P2P Security Model and Identity Trust Chain
- Add Key Derivation formula
- Update performance metrics with crypto ops/sec
- Add feature flags documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:06:56 +00:00
rUv
3a14478436 feat(edge): Production-grade P2P Swarm with Ed25519/X25519 crypto
Implements a production-grade P2P swarm coordination layer with:

Security Features:
- Ed25519 identity keys + X25519 ephemeral keys for ECDH
- AES-256-GCM authenticated encryption
- Canonical JSON serialization (sorted keys) for signatures
- Registry-based identity binding (never trust envelope keys)
- Message replay protection (nonces, counters, timestamps)
- Signed task receipts with full execution binding

Core Modules:
- identity.rs: Ed25519/X25519 key management, member registry
- crypto.rs: AES-256-GCM, canonical JSON, hashing
- envelope.rs: SignedEnvelope, TaskEnvelope, TaskReceipt types
- relay.rs: GUN relay health monitoring and failover
- artifact.rs: Local CID-based storage with LRU eviction
- swarm.rs: P2PSwarmV2 coordinator with heartbeats and task claiming

Additional:
- gun.rs: GUN decentralized database integration for swarm sync
- Examples: local_swarm.rs, distributed_learning.rs

All tests pass. Demo runs successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:03:34 +00:00
rUv
940fd021e5 feat(edge): add ruv-swarm-transport integration example
New example: examples/edge/
- Distributed AI swarm communication using ruv-swarm-transport
- WebSocket, SharedMemory, and WASM transport support
- Intelligence sync for distributed Q-learning patterns
- Shared vector memory for collaborative RAG
- LZ4 + quantization tensor compression (up to 12x)
- Protocol with Join, Sync, Task, Election messages
- Agent roles: Coordinator, Worker, Scout, Specialist

Binaries:
- edge-demo: Demo of distributed learning
- edge-agent: CLI agent that joins swarm
- edge-coordinator: Swarm coordinator

Dependencies:
- ruv-swarm-transport v1.0.5
- tokio, serde, lz4_flex, clap
2025-12-31 17:20:51 +00:00