Commit graph

780 commits

Author SHA1 Message Date
Claude
cd58ecd993 feat: Add real attention, KV cache, RoPE, and tokenizer to BitNet backend
Resolves the three blocking gaps that prevented end-to-end inference:

1. **Real attention layer** (was pass-through placeholder):
   - AttentionWeights struct with Q/K/V/O ternary projections
   - GQA (Grouped Query Attention) with configurable num_heads / num_kv_heads
   - Pre-computed RoPE cos/sin tables (apply_rope)
   - Per-layer KV cache for autoregressive generation
   - forward_token() for efficient single-token inference with cache
   - forward_layer_cached() with full attention computation
   - forward_layer_nocache() legacy path for backwards compatibility

2. **Tokenizer integration** (was raw bytes → token IDs):
   - load_tokenizer_from_gguf() extracts vocab + merges from GGUF metadata
   - Byte-level fallback tokenizer (260 tokens) when GGUF has no vocab
   - TokenizerBridge implements crate-level Tokenizer trait
   - tok() accessor for direct tokenizer access

3. **generate() uses tokenizer** (was returning [token_id] strings):
   - Encodes prompt via BPE tokenizer before forward pass
   - Decodes generated tokens back to text
   - generate_cached() for KV-cached autoregressive generation
   - get_embeddings() now uses tokenizer for text encoding
   - reset_cache() to clear KV state between sequences

Tests: 174/174 bitnet tests pass (9 new: RoPE, KV cache, tokenizer roundtrip,
attention weights, byte-level fallback, cache operations)

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 17:39:58 +00:00
Claude
c7566d41f7 feat: Add appliance-optimized RLM embedder (Pi 5 + STM32 offload)
Implements AD-25 appliance deployment optimizations for the RLM recursive
sentence transformer embedder targeting Raspberry Pi 5 + 7 STM32 coprocessors:

- Pi 5 config presets: pi5_optimized() (2-iter, 3-neighbor) and pi5_streaming() (1-iter)
- STM32 offload protocol: ComputeHash, FilterNeighbors, GateCheck, WatchdogPing, ScheduleReorder
- NullStm32 software fallback for development/cloud environments
- Batch embedding with per-chunk latency tracking and STM32 gate-checking
- Priority-scheduled batch embedding via STM32-driven reordering
- HashEmbedder: lightweight FNV-1a pseudo-embedder for testing/baseline
- FlatNeighborStore: in-memory neighbor retriever for small corpora (<100K chunks)
- EmbedderBenchmark: throughput, P95/P99 latency, peak memory reporting
- NEON-optimizable math: 4-element unrolled cosine_similarity, l2_normalize
- vec_accumulate_weighted and mean_embedding helpers
- 41 tests (27 new): STM32 protocol, batch, HashEmbedder, FlatNeighborStore, benchmark, integration

All 165 bitnet module tests pass.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 15:53:40 +00:00
Claude
a3c7fb54a8 feat: Add RLM embedder, tokenizer, eval gates, trace writer, and security hardening
New modules (4 files, 2,359 lines):
- rlm_embedder.rs (743L): RLM-style recursive sentence transformer with
  3 variants (query-conditioned, corpus-conditioned, contradiction-aware
  twin), merge rule, BaseEmbedder/NeighborRetriever traits, 14 tests
- tokenizer.rs (418L): BPE tokenizer with GGUF vocab loading, encode/decode,
  special token handling, 10 tests
- trace.rs (554L): JSONL trace writer for routing, citation, refusal
  decisions, jaccard similarity, manual JSON serialization, 10 tests
- eval.rs (644L): Three behavioral gates (routing correctness >= 0.85,
  citation precision >= 0.90, refusal F1 >= 0.85), EvalSuite, 12 tests

Documentation:
- AD-24: RLM-Style Recursive Sentence Transformer Embedder — 3 variants,
  merge rule, training strategy, evaluation criteria, appliance fit
- DDD v2.6: 8 new ubiquitous language terms, 4 new open questions (#31-34)
- 3 new positive consequences (#31-33) for RLM embeddings

Security hardening (across 6 existing files):
- Path traversal validation in GGUF export
- Division-by-zero epsilon guards in quantizer
- Bounds validation on public function inputs
- NaN-safe softmax with -inf handling

138 tests pass, 0 compilation errors.
Total bitnet module: 9,632 lines across 16 files.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 15:40:59 +00:00
Claude
ab78e18a87 feat: Add AD-23 Phase-1 distillation, expert cache, and DDD updates
AD-23: Phase-1 Distillation via External GPU Teacher Artifacts
- One-time GPU job produces behavioral artifacts (routing traces,
  sparse logits, preference labels) — not trained weights
- CPU-only refinement: router repair, LoRA correction, EWC++, policy
  optimization using teacher artifacts
- Acceptance criteria: 200-prompt suite, all 3 behavioral gates,
  stability under 10% corpus perturbation

expert_cache.rs: MoE expert hot-set caching (new file)
- ExpertCache with LRU/LFU/Adaptive eviction policies
- MoeBatchScheduler: reorder token execution by expert for cache reuse
- Prefetcher trait for future platform-specific prefetch intrinsics
- 12 tests (92/92 bitnet tests pass)

DDD v2.5: 6 new ubiquitous language terms (Teacher Artifact, Behavioral
Distillation, Router Repair, Sparse Logits, Corpus Perturbation) and
4 new open questions (#27-30) for Phase-1 operability.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 15:12:33 +00:00
Claude
d5219db15c docs: Add AD-22 evaluation infrastructure and behavioral gates
Defines three ship/no-ship gates:
- Gate 1: Routing correctness (>= 85% teacher agreement)
- Gate 2: Citation correctness (precision >= 90%, recall >= 70%)
- Gate 3: Refusal calibration (F1 >= 0.85)

Includes JSONL trace schema, auto-labeling strategy using RuVector
signals (redundancy, cluster disagreement, mincut fragility), and
go/no-go rule requiring all gates to pass on same prompt suite run.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 14:57:32 +00:00
Claude
247ab359b5 fix: Polish AVX2 and WASM SIMD128 kernel variants
Agent refinements to tl1_avx2.rs and tl1_wasm.rs — cleanup
of unused imports and linter warnings.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 14:42:30 +00:00
Claude
91492dc49e feat: Implement BitNet inference stack — TL1 kernel, backend, GGUF export, RLM refiner
Phase 0 + 0.5 implementation (4,283 lines across 6 new files):

- tl1_kernel.rs (879L): TL1 ternary GEMV with NEON SIMD + scalar fallback,
  INT8 activation quantization (absmax), LUT generation, 17 tests
- backend.rs (1,179L): Full BitNetBackend implementing LlmBackend trait,
  GGUF model loading, MoE router (softmax gate + top-K), expert FFN
  (SwiGLU via TL1 GEMV), RMSNorm, embedding/LM head, 12 tests
- gguf_export.rs (662L): GGUF v3 writer for BITNET_T158, FP16 conversion,
  model export with BitNet metadata, validation, 8 tests
- rlm_refiner.rs (696L): Phase 0.5 orchestrator wiring MicroLoRA + EWC++ +
  GRPO + ContrastiveTrainer, SIMD-only mode (AD-20), checkpointing, 10 tests
- tl1_avx2.rs (414L): AVX2 SIMD kernel variant (x86_64 conditional)
- tl1_wasm.rs (453L): WASM SIMD128 kernel variant (wasm32 conditional)

All 72 bitnet tests pass. Fixed 2 pre-existing compilation errors in
autodetect.rs and kernels/mod.rs.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 14:34:37 +00:00
Claude
4685854fb8 docs: Add AD-21 native Rust ternary kernels with WASM SIMD128 target
Research bitnet.cpp Rust port strategy: R3-Engine proves 100% Safe Rust
with dual-target (native AVX-512 + WASM SIMD128) achieving 80-117 tok/s.
Recommend Approach C (reference R3-Engine patterns) over Python codegen.
WASM SIMD128 maps TL1 LUT to v128.swizzle for ~20-40 tok/s in browser.

Resolves open question #5 (WASM viability). Adds 6 new references,
5 new DDD terms, 3 new open questions. DDD updated to v2.4.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 14:07:52 +00:00
Claude
fe5a169eb9 docs: Add bitnet module test coverage report
Generated test coverage analysis for the PT-BitNet quantizer module,
documenting coverage across quantization, packing, dequantization,
error metrics, and layer filtering.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 13:55:36 +00:00
Claude
dabc953425 feat: Integrate BITNET_T158 dequant into GGUF pipeline + add layer filter tests
Wire dequantize_bitnet_t158 into gguf/quantization.rs dequantize_block()
and dequantize_tensor() match arms. Add block wrapper that extracts
FP16 scale from interleaved GGUF format. Add 179 lines of layer filter
tests validating AD-2 (router/embed/head stay FP16, expert FFN quantized).

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 13:54:31 +00:00
Claude
120a94e0a5 feat: Implement Phase 0 PT-BitNet quantizer module
Add bitnet/ module with absmean ternary quantizer, TernaryTensor type,
BITNET_T158 dequantization, and comprehensive test suite (~1600 lines).

Components:
- quantizer.rs: PtBitnetConfig, absmean_ternary(), quantize_tensor()
- ternary_tensor.rs: TernaryTensor, pack/unpack 2-bit ternary encoding
- dequantize.rs: dequantize_bitnet_t158(), block dequant, error metrics
- tests.rs: Packing roundtrips, quantization correctness, edge cases
- gguf/quantization.rs: BitnetT158 = 30 enum variant, block_size, bytes

Implements AD-1 (weight representation), AD-5 (GGUF extension), AD-18
(PT-BitNet quantization) from ADR-017.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 12:40:18 +00:00
Claude
94c760d9cf docs: Add AD-20 SIMD-only training mode for Phase 0.5 in ADR/DDD
Analyze RLM training stack GPU dependencies and document that Phase 0.5
runs entirely on pure CPU SIMD (NEON on aarch64) without Metal GPU.
MicroLoRA, TrainingPipeline, EwcRegularizer, GrpoOptimizer are all pure
ndarray; ContrastiveTrainer has explicit CPU fallback. Only ~2-3x slower
than Metal. Extends platform support to Linux ARM64 and x86 (scalar).

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 07:46:59 +00:00
Claude
d612fa61ff docs: Integrate RLM training stack into Craftsman Ultra ADR/DDD
Add Phase 0.5: RLM Post-Quantization Refinement — a $0 Mac Studio
approach that uses the existing RLM stack (MicroLoRA, GRPO, EWC++,
ContrastiveTrainer, MemoryDistiller, PolicyStore) to refine the
Phase 0 PTQ model by training only FP16 components (~1-2% of params).

ADR-017 changes:
- Added Phase 0.5 to phased decision: A(0C) → RLM Refinement → D → C → B
- Added AD-19: RLM Post-Quantization Refinement architecture
  - Frozen ternary weights + trainable FP16 (LoRA, router, scales)
  - ~200-400M trainable params (1-2% of 30B), 100-500M training tokens
  - 100% RLM code reuse, 0% new training code
  - 2-12 days on Mac Studio Metal, $0 cost
  - Expected quality: ~70-80% of FP16 (up from 55-65% Phase 0 PTQ)
- Full pipeline diagram: Router repair → MicroLoRA injection → Scale opt
- Memory budget analysis: ~12-20 GB active RAM (fits any Mac Studio)
- Training schedule: 3-14 days total wall time
- Added Phase 0.5 exit criteria (11 items)
- Updated infrastructure table with Phase 0.5 row
- Updated consequences with RLM refinement benefits

DDD v2.2 changes:
- Added Section 3.8.1: Phase 0.5 RLM Refinement Mode
- Added 5 ubiquitous language terms (RLM Refinement, Frozen Ternary,
  LoRA Correction, Router Repair)
- Added 3 open questions (LoRA rank, GGUF persistence, Phase continuity)

Key insight: RLM trains ~1% of parameters → needs ~0.25% of the data
(100-500M vs 200B tokens) → Mac Studio Metal is sufficient → $0 cost.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 06:43:52 +00:00
Claude
45d30c7c6e docs: Add Mac Studio as $0 Phase 0 PTQ platform in ADR-017
Update AD-17 and AD-18 to reflect that Phase 0 post-training quantization
runs entirely on Mac Studio (Apple Silicon) at zero cost, eliminating the
need for cloud GPU for the prototype phase.

Key changes:
- Phase 0 cost updated from ~$100 (cloud) to $0 (local Mac Studio)
- AD-18 now includes Mac Studio config compatibility matrix (M4 Max 36-128GB,
  M3 Ultra 96-512GB) with wall time estimates per config
- Added mmap strategy: FP16 weights demand-paged from disk, per-tensor
  quantization uses ~2-4MB working memory regardless of model size
- Metal GPU calibration via existing Candle integration (use_metal: true)
- ARM NEON for TL1 kernel validation (same ISA as production target)
- Updated throughput table with Mac Studio entries and Phase 0 column
- PtBitnetConfig gains use_mmap, use_metal_calibration, max_memory_gb fields
- Phase 0 exit criteria updated for Mac Studio local execution
- Updated infrastructure table: Phase 0 + router validation both $0 local

Mac Studio is ideal for Phase 0 (PTQ in hours, $0) but still infeasible
for Phase 1+ training (200B tokens at 500-1000 tok/s = 6.5 years).
This separation validates the phased cloud-for-training approach.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 06:30:05 +00:00
Claude
5896d6dc39 docs: Add Phase 0 PTQ rapid prototype to Craftsman Ultra ADR/DDD
Research post-training quantization feasibility for GLM-4.7-Flash as a
low-cost ($100, 2-4 hrs) validation step before full distillation ($1,300+).

ADR-017 changes:
- Restructured Option A from "Rejected" to tiered PTQ analysis (0A-0D)
- Added AD-18: PT-BitNet post-training quantization strategy
- Updated phased decision to A(0C) → D → C → B
- Added Phase 0 exit criteria and validation benchmarks
- Documented existing community GGUFs (bartowski, unsloth, ngxson)
- Identified RuvLLM IQ1_S dequant gap (type 19 parsed, not implemented)
- Added PT-BitNet, BitDistill, and STBLLM references

DDD v2.1 changes:
- Added 6 Phase 0 ubiquitous language terms (PT-BitNet, BITNET_T158, etc.)
- Updated Section 3.4 with dual-mode quantization pipeline (PTQ + distillation)
- Updated compatibility matrix with Phase 0 vs Phase 1+ columns
- Added 3 new open questions (calibration corpus, GGUF type, weight migration)

Key finding: IQ1_S ≠ BitNet b1.58. Generic codebook PTQ produces garbled
output; PT-BitNet absmean ternary quantization is viable for kernel validation.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 04:56:28 +00:00
Claude
d5caa4dacf docs: Add AD-17 training infrastructure analysis (cloud GPU vs local SIMD)
ADR-017: Add AD-17 with detailed memory budget analysis showing per-expert
distillation fits in A100 40GB (~15.5GB), full model requires 4×A100 80GB
(~430GB). CPU SIMD training infeasible at 200B+ tokens (~65 years on AVX2).
Recommend GCP 4×A100 spot instances (~$1,300 for Phase 1) or DataCrunch
H100 ($1.99/hr). Includes cost comparison across 6 platforms, per-phase
infrastructure mapping, and required CUDA device dispatch code change for
RealContrastiveTrainer.

DDD: Add section 8.5 Training Infrastructure Model with expert-parallel
GPU topology diagram, what-runs-where matrix, and required code change
summary.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 04:44:29 +00:00
Claude
261b510d8e docs: Integrate RLM training stack into Craftsman Ultra ADR/DDD
ADR-017 updates:
- Add RLM Training Stack reuse section (GRPO, EWC++, ContrastiveTrainer,
  MemoryDistiller, PolicyStore — ~70% code reuse ratio)
- Add AD-11: GRPO-guided distillation with per-expert reward scaling
- Add AD-12: Contrastive pre-training for expert routing validation
- Add AD-13: EWC++ cross-expert stability during sequential distillation
- Add AD-14: PolicyStore TernaryScale per-layer policy persistence
- Add AD-15: MemoryDistiller trajectory tracking for distillation quality
- Add AD-16: Full pipeline composition with expert-parallel distillation
- Update Options C/D with RLM component mapping tables
- Update consequences, risks, and validation criteria

DDD v2.0 updates:
- Add bounded context 3.8: RLM Training Orchestration (70% reused)
- Add 13 ubiquitous language terms for RLM concepts
- Update context map with RLM relationships
- Update Quantization Pipeline to delegate to RLM Training
- Add 7 new domain events for GRPO, EWC, and distillation lifecycle
- Update module structure with reused vs new file annotations
- Add 6 RLM-specific integration tests
- Add 3 new open questions for RLM scaling

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 04:34:47 +00:00
Claude
3e18734fa3 docs: Add ADR-017 and DDD for Craftsman Ultra 30b 1bit BitNet integration
Research and architecture documentation for integrating BitNet b1.58
ternary quantization with GLM-4.7-Flash 30B-A3B MoE architecture into
the RuvLLM serving runtime. Includes phased approach (expert replacement
→ full distillation → native training), CPU inference kernel strategy
(TL1/TL2/I2_S), domain model with 7 bounded contexts, and memory budget
analysis targeting <10GB for 30B-class CPU-only inference.

https://claude.ai/code/session_011nTcGcn49b8YKJRVoh4TaK
2026-02-03 04:18:28 +00:00
github-actions[bot]
057dfb8e74 chore: Update NAPI-RS binaries for all platforms
Built from commit d1a2ec1c93

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
2026-01-29 16:11:45 +00:00
rUv
d1a2ec1c93 fix: Add Copilot setup workflow with git clone cleanup step
Resolves the "already exists and is not an empty directory" error by:
- Adding a cleanup step to remove the directory before git clone
- Setting up Node.js for ruvector dependencies
- Installing and verifying ruvector MCP installation
2026-01-29 11:05:28 -05:00
github-actions[bot]
cfd115b8f0 chore: Update NAPI-RS binaries for all platforms
Built from commit 0fee2a99d4

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
2026-01-28 17:10:29 +00:00
rUv
0fee2a99d4 Merge pull request #142 from ruvnet/fix/hnsw-parameterized-query-segfault-141
fix(hnsw): resolve segfault with parameterized queries (#141)
2026-01-28 12:05:29 -05:00
rUv
42d869a196 style: apply rustfmt across entire codebase
Run rustfmt on all Rust files to fix CI formatting checks.
This addresses pre-existing formatting inconsistencies across:
- cognitum-gate-kernel
- cognitum-gate-tilezero
- prime-radiant
- ruvector-* crates
- examples/benchmarks
- and other crates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:00:26 +00:00
rUv
859f93e916 style(hnsw): fix rustfmt formatting issues
- Move datum and false arguments to same line in from_polymorphic_datum
- Join split let text_len = ... assignment to single line

These changes fix CI rustfmt check failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:55:52 +00:00
rUv
58b159776d chore: add version to gated-transformer dep, update Dockerfile version
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:42:22 +00:00
rUv
6724e4b40d chore(release): bump ruvector-postgres to v2.0.1
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:40:11 +00:00
rUv
a4948d9545 fix(hnsw): resolve segfault with parameterized queries (Issue #141)
This commit fixes a critical P0 bug where HNSW indexes on ruvector
columns would crash PostgreSQL with a segmentation fault when using
parameterized queries (prepared statements, ORMs, application drivers).

Root Cause:
- Query vector extraction failed for parameterized queries
- Code fell back to zero vector without validation
- Zero vector caused segfault during HNSW search

Changes:
- Add multi-method query vector extraction pipeline
  1. Direct RuVector::from_polymorphic_datum()
  2. Text parameter conversion for parameterized queries
  3. Validated varlena fallback with dimension checking
- Add query_valid flag to track extraction success
- Add validation before search execution:
  - Reject empty/invalid query vectors with clear errors
  - Reject all-zero vectors (invalid for similarity search)
  - Validate dimension match between query and index
- Apply same fixes to IVFFlat for consistency

Testing:
- Added regression tests for parameterized queries
- Added tests for zero vector error handling
- Added tests for dimension mismatch errors
- Added 384-dimension production-scale tests

Fixes: #141
See: docs/adr/ADR-0027-hnsw-parameterized-query-fix.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:34:42 +00:00
github-actions[bot]
5e6d092772 chore: Update NAPI-RS binaries for all platforms
Built from commit d3b4269717

  Platforms updated:
  - linux-x64-gnu
  - linux-arm64-gnu
  - darwin-x64
  - darwin-arm64
  - win32-x64-msvc

  🤖 Generated by GitHub Actions
2026-01-28 16:27:01 +00:00
rUv
d3b4269717 Merge pull request #139 from ruvnet/claude/ruvbot-v0.1.1-fixes
feat(ruvbot): v0.1.1 with skill system, chat UI, and delta crates
2026-01-28 11:22:15 -05:00
rUv
c24d96a03a feat(ruvbot): add skill system with ChatEnhancer and builtin skills
- Add ChatEnhancer for enhanced chat processing with skills, memory,
  and proactive assistance integration
- Add SkillExecutor for skill lifecycle management and execution
- Add builtin skills: CodeSkill, MemorySkill, SummarizeSkill, WebSearchSkill
- Improve server.ts with better error handling and session management
- Update AIDefenceGuard with enhanced security checks
- Update chat UI with improved styling and interactions
- Bump version to 0.1.1 with delta crates integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:20:36 +00:00
rUv
6db8986776 feat(delta): Add 5 specialized delta crates for distributed systems
Adds modular crates implementing delta-behavior for different domains:

## ruvector-delta-core
- Delta trait with compute/apply/compose/inverse operations
- VectorDelta with sparse/dense encoding
- DeltaStream for event sourcing with checkpoints
- DeltaWindow for time-bounded aggregation
- Compression codecs: LZ4, Zstd, DeltaOfDelta, Quantized

## ruvector-delta-wasm
- JsDelta JavaScript-friendly wrapper
- DeltaEngine for capture/apply operations
- SIMD-accelerated operations
- SharedBuffer and BufferPool for memory management

## ruvector-delta-index
- DeltaHnsw - delta-aware HNSW index
- IncrementalUpdater with multiple strategies
- GraphRepairer with lazy/eager/batched/adaptive modes
- QualityMonitor for recall estimation

## ruvector-delta-graph
- GraphDelta for node/edge operations
- NodeDelta with property and label changes
- EdgeDelta with weight and type changes
- DeltaAwareTraversal (BFS, DFS, shortest path)

## ruvector-delta-consensus
- VectorClock and HybridLogicalClock
- DeltaConsensus coordinator
- DeltaGossip for delta dissemination
- CRDTs: GCounter, PNCounter, LWWRegister, ORSet

Test coverage: 77+ tests across all crates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 04:19:57 +00:00
rUv
6886e727d2 feat(delta-behavior): Complete Δ-behavior implementation with WASM
Implements the full delta-behavior framework - systems where change is
permitted but collapse is not.

## Core Implementation
- Coherence type with [0,1] bounds and safe constructors
- Three-layer enforcement: energy cost, scheduling, memory gating
- DeltaSystem trait for coherence-preserving systems
- DeltaConfig with strict/relaxed/default presets

## 11 Exotic Applications
1. Self-Limiting Reasoning - AI that does less when uncertain
2. Computational Event Horizon - bounded computation without hard limits
3. Artificial Homeostasis - synthetic life with coherence-based survival
4. Self-Stabilizing World Model - models that refuse to hallucinate
5. Coherence-Bounded Creativity - novelty without chaos
6. Anti-Cascade Financial System - markets that cannot collapse
7. Graceful Aging - systems that simplify over time
8. Swarm Intelligence - collective behavior without pathology
9. Graceful Shutdown - systems that seek safe termination
10. Pre-AGI Containment - bounded intelligence growth
11. Extropic Substrate - goal mutation, agent lifecycles, spike semantics

## Performance Optimizations
- O(n²) → O(n·k) swarm neighbor detection via SpatialGrid
- O(n) → O(1) coherence calculation with incremental cache
- VecDeque for O(1) history removal
- SIMD utilities with 8x loop unrolling
- Bounded history to prevent memory leaks

## Security Fixes
- Replaced unsafe static mut with AtomicU64 for thread-safe RNG
- NaN validation on all coherence inputs
- Overflow protection in calculations

## WASM + TypeScript SDK
- Full wasm-bindgen exports for all 11 applications
- High-level TypeScript SDK with ergonomic APIs
- Browser and Node.js examples

## Test Coverage
- 32 lib tests, 14 WASM tests, 13 doc tests (59 total)

Resolves #140

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 04:18:34 +00:00
rUv
831a4d8e92 feat(ruvbot): add Gemini 2.5 support and Google AI provider
- Add GoogleAIProvider for direct Gemini API access
- Support Gemini 2.5 Flash, Pro, and Lite models
- Add Gemini 3.x preview models
- Auto-detect and use Google AI when GOOGLE_AI_API_KEY is set
- Update chat UI with debugging and LLM status checks
- Fix model routing for Google Cloud deployments
- Bump version to 0.1.8

Tested models:
- gemini-2.5-flash (stable, recommended)
- gemini-2.5-pro (stable)
- gemini-2.5-flash-lite (stable)

Sources:
- https://ai.google.dev/gemini-api/docs/models

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 03:51:19 +00:00
rUv
a463517c5d feat(ruvbot): add chat UI, channel integrations, and cloud deployment
- Add embedded chat UI with dark mode default (ADR-015)
- Add channel setup commands for Slack, Discord, Telegram
- Add webhook configuration CLI commands
- Add cloud deployment CLI with Cloud Run, Docker, Kubernetes support
- Add gcloud CLI integration and curl-based installer
- Add template library system for quick starts
- Update Dockerfile to include static files
- Bump version to 0.1.6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 03:30:01 +00:00
rUv
cfc31738d6 fix(ruvbot): improve error handling and chat endpoint reliability
- Fix pino error serialization (use 'err' key instead of 'error')
- Add detailed logging for JSON parse errors with rawBody preview
- Add nested try-catch for AIDefence output validation
- Block critical threats with SECURITY_BLOCKED error code
- Add /api/models endpoint with 12+ supported LLM models
- Add Gemini 2.5 Pro support via OpenRouter
- Update README with stronger security messaging vs Clawdbot
- Update FEATURE_COMPARISON.md with security gap analysis
- Bump version to 0.1.1

Tested and verified on Cloud Run deployment:
- All endpoints working: health, ready, status, models, agents, sessions, chat
- Chat returns proper fallback when LLM not configured
- Error logs now properly serialize error objects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 01:26:54 +00:00
rUv
48c767d20e feat(ruvbot): add HTTP server for Cloud Run deployment
- Add server.ts with REST API endpoints for RuvBot
- Implement health/ready checks for Cloud Run
- Add agent and session management API
- Integrate AIDefence security layer in production
- Fix Dockerfile CMD path to dist/server.js

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 22:52:14 +00:00
rUv
a4168cc8fc fix(ruvbot): resolve typecheck and test failures
- Create missing learning/memory/MemoryManager.ts with Embedder and VectorIndex interfaces
- Fix core/index.ts to re-export memory types from learning module instead of non-existent core/memory
- Fix HybridSearch to await async vectorIndex.add() call and handle empty queries
- Fix MockSlackWebClient name collisions (users, files, reactions private Maps shadowed by API objects)
- Fix MockRouter path matching to properly split method:path keys with param colons
- Fix SkillRegistry updateMetrics calculation for success rate
- Fix test mocks to match async interface signatures (VectorIndex, Embedder)
- Update skill test latency calculation to use performance.now() for sub-ms precision

Test results: 561 passing (previously 287), 10 remaining edge case failures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 22:40:53 +00:00
Claude
1d8f47cc47 feat(ruvbot): add comprehensive CLI with doctor, memory, security, plugins, and agent commands
- Add .env.example with all environment variables documented
- Add bin/ruvbot.js entry point for npx execution
- Add doctor command with 10+ health checks (Node, env, db, LLM, memory, security)
- Add memory commands (stats, store, search, export, import, clear, info)
- Add security commands (scan, audit, test, config, stats)
- Add plugins commands (list, create, info, validate)
- Add agent/swarm commands (spawn, list, stop, status, swarm init/status/dispatch)
- Update package.json with bin entry and files array

CLI Commands:
  ruvbot start       - Start RuvBot server
  ruvbot init        - Initialize RuvBot (--preset minimal/standard/full)
  ruvbot doctor      - Run diagnostics (--fix, --json)
  ruvbot config      - Manage configuration (--show, --validate)
  ruvbot status      - Show bot status (--watch)
  ruvbot memory      - Memory management (stats, info, store, search, etc.)
  ruvbot security    - Security scanning (scan, audit, test, config, stats)
  ruvbot plugins     - Plugin management (list, create, info, validate)
  ruvbot agent       - Agent management (spawn, list, stop, status)
  ruvbot agent swarm - Swarm coordination (init, status, dispatch)
  ruvbot skills      - List available skills
  ruvbot version     - Show version information

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 14:40:11 +00:00
Claude
4463d721ec test(ruvbot): add comprehensive unit tests for security and plugins
- Add 29 AIDefence tests covering prompt injection, jailbreak, PII,
  sanitization, response validation, and performance benchmarks
- Add 24 plugin manager tests covering manifest validation, lifecycle,
  permissions, events, and registry operations
- Fix response validation to detect injection echoes in LLM responses
  by using all injection patterns and adding response-specific patterns

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 14:23:12 +00:00
Claude
11e0b71f25 feat(ruvbot): add plugin system inspired by claude-flow
Adds extensible plugin system with:

Features:
- Plugin discovery from ./plugins directory
- Lifecycle management (install, enable, disable, unload)
- Hot-reload support
- Sandboxed execution with permissions
- IPFS registry integration (optional)
- Plugin scaffolding utility

New Files:
- src/plugins/PluginManager.ts - Main plugin manager (500+ lines)
- src/plugins/index.ts - Module exports

Updated:
- src/index.ts - Export plugins module
- README.md - Added plugin system documentation
- FEATURE_COMPARISON.md - Added plugin system comparison

Plugin Permissions:
- memory:read/write
- session:read/write
- skill:register/invoke
- llm:invoke
- http:outbound
- fs:read/write

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 13:47:10 +00:00
Claude
5f9d5fc690 feat(ruvbot): integrate aidefence for adversarial protection
Adds production-ready AI defense through aidefence@2.1.1:

Security Features:
- Prompt injection detection (<10ms, 50+ patterns)
- Jailbreak prevention (DAN, bypass, unlimited mode)
- PII detection and masking (email, phone, SSN, API keys)
- Control character sanitization
- Unicode homoglyph normalization
- Behavioral analysis (optional)
- Response validation

New Files:
- src/security/AIDefenceGuard.ts - Main guard implementation
- src/security/index.ts - Module exports
- docs/adr/ADR-014-aidefence-integration.md - Architecture decision

Updated:
- package.json - Added aidefence@^2.1.1 dependency
- src/index.ts - Export security module
- README.md - Added AI Defense section

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 13:10:18 +00:00
Claude
7d62a62812 feat(ruvbot): add GCP deployment and LLM provider documentation
Google Cloud Deployment:
- Dockerfile: Multi-stage build for Cloud Run (~150MB)
- docker-compose.yml: Local development with PostgreSQL, Redis
- deploy/gcp/cloudbuild.yaml: CI/CD pipeline
- deploy/gcp/terraform/main.tf: Infrastructure as code
- deploy/gcp/deploy.sh: Quick deployment script
- deploy/init-db.sql: PostgreSQL schema with RLS

Estimated cost: ~$15-20/month for low traffic

Documentation Updates:
- ADR-012: LLM Provider Integration (Anthropic + OpenRouter)
- ADR-013: GCP Deployment Architecture
- Updated README with GCP and LLM sections
- Updated FEATURE_COMPARISON.md with:
  - Cloud deployment comparison
  - LLM provider comparison
  - Hybrid search (BM25 + Vector RRF)
  - Reasoning model support (QwQ, DeepSeek R1, O1)

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 05:25:00 +00:00
Claude
a31a56b655 feat(ruvbot): implement core RuvBot capabilities
Implements comprehensive capabilities matching and exceeding Clawdbot:

Hybrid Search:
- BM25Index: Full-text search with TF-IDF scoring
- HybridSearch: Vector + keyword fusion with RRF

Multi-Channel Adapters:
- BaseAdapter: Unified message interface
- SlackAdapter: @slack/bolt integration
- DiscordAdapter: discord.js integration
- TelegramAdapter: telegraf integration
- ChannelRegistry: Multi-tenant channel management

Swarm Coordination:
- SwarmCoordinator: 12 specialized workers, 4 topologies
- ByzantineConsensus: PBFT-style fault tolerance

LLM Providers:
- AnthropicProvider: Claude models with streaming
- OpenRouterProvider: Multi-model including QwQ reasoning

Total: 3,954 new lines of production code

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 05:11:11 +00:00
Claude
ffdb8f9b51 docs(ruvbot): add ADRs for hybrid search, multi-channel, swarm coordination
ADR-009: Hybrid Search Architecture
- Vector + BM25 keyword search fusion
- Reciprocal Rank Fusion (RRF)
- Performance targets (<25ms total)

ADR-010: Multi-Channel Integration
- 8+ channel adapters (Slack, Discord, Telegram, Signal, WhatsApp, Line, Web, CLI)
- Unified message interface
- Multi-tenant channel isolation

ADR-011: Swarm Coordination (agentic-flow)
- 4 topology types (hierarchical, mesh, hybrid, adaptive)
- 4 consensus protocols (byzantine, raft, gossip, crdt)
- 12 specialized background workers

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:56:06 +00:00
Claude
be81555a8f docs(ruvbot): comprehensive feature comparison with RuVector advantages
- Added complete skills comparison (52 Clawdbot → 68+ RuvBot)
- Added RuVector-exclusive capabilities section
- Added agentic-flow integration details (12 workers, 4 topologies, 4 consensus)
- Added benchmark table showing RuvBot dominance
- Added module-by-module comparison with improvements
- Shows RuvBot is definitively better in every dimension

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:54:30 +00:00
Claude
cd62f9bcd0 docs(ruvbot): add comprehensive comparison tables and capabilities
- Added RuvBot vs Clawdbot feature comparison table
- Added performance benchmarks (50-100x speedups)
- Added 3-tier LLM routing documentation
- Added 6-layer security architecture diagram
- Added 12 background worker types documentation
- Added SONA learning pipeline diagram
- Expanded skills section with SOTA features

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:49:50 +00:00
Claude
13976ece3f fix(ruvbot): resolve TypeScript compilation errors and complete infrastructure
- Fixed BotStatus type to include 'starting' state
- Fixed RuvBotError calls to include required error codes
- Fixed BotConfig.fromEnv() type casting for partial configs
- Fixed duplicate exports (DomainEvent, EventHandler, JobOptions)
- Renamed workers JobOptions to WorkerJobOptions to avoid conflict
- Fixed skills/index.ts to use export type for type-only exports
- Updated tsconfig.json for NodeNext module resolution
- Removed import.meta check from CLI (uses bin entry point)
- Added complete infrastructure layer (persistence, messaging, workers)
- Added integration layer (providers, slack, webhooks)
- Added learning layer (embeddings, patterns, training)
- Build passes for both CJS and ESM outputs
- 287/350 tests passing

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:48:22 +00:00
Claude
980489f148 test(ruvbot): Add E2E and RuVector integration tests
- E2E test suites for full flow testing
- RuVector WASM integration tests

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:33:59 +00:00
Claude
e24a4173c6 chore(ruvbot): Add ESM tsconfig and package updates
- Added tsconfig.esm.json for ESM build
- Updated package.json and tsconfig.json

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:33:33 +00:00
Claude
a26c159e6e feat(ruvbot): Add remaining ADRs and test suites
Additional Architecture Decision Records:
- ADR-005: Integration Layer (Slack, webhooks, external services)
- ADR-006: WASM Integration (ruvector-wasm, ruvllm)
- ADR-007: Learning System (SONA, trajectory learning)

Additional Test Suites:
- Integration: Multi-tenancy isolation, Postgres persistence, Slack
- Unit: API endpoints, WASM bindings, background workers

https://claude.ai/code/session_01GGEDq3rjDELfBzhn9u5fTo
2026-01-27 04:32:34 +00:00