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>
Add user-friendly introduction explaining:
- What the library does in plain language
- Who should use it (use cases table)
- Key benefits with concrete examples
- Simple "how it works" diagram
Keeps all technical details intact while making the project
more accessible to newcomers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add pqcrypto-dilithium (v0.5) and pqcrypto-kyber (v0.8) as optional deps
- Update production-crypto feature to enable real PQ implementations
- ML-DSA-65: Uses Dilithium3 when production-crypto enabled
- ML-KEM-768: Uses Kyber768 when production-crypto enabled
- Update security_notice.rs with dynamic status based on feature flag
- Export check_crypto_security() from lib.rs for startup checks
- is_production_ready() returns true when feature enabled
Usage:
# Enable production post-quantum crypto
ruvector-dag = { version = "0.1", features = ["production-crypto"] }
# Check at startup
fn main() {
ruvector_dag::check_crypto_security();
}
SECURITY FIXES:
1. ML-DSA-65 (CRITICAL):
- BEFORE: verify() always returned true if signature non-zero
- BEFORE: sign() used trivially weak XOR with simple hash
- AFTER: Uses HMAC-SHA256 for basic integrity verification
- Added security warnings that this is NOT quantum-resistant
2. ML-KEM-768 (CRITICAL):
- BEFORE: encapsulate() ignored public key, just random bytes
- BEFORE: decapsulate() used simple XOR, trivially breakable
- AFTER: Uses HKDF-SHA256 for key derivation with proper binding
- Added ciphertext structure verification
3. Differential Privacy (MEDIUM):
- BEFORE: sample_laplace() could produce ln(0) → -infinity/NaN
- BEFORE: sample_gaussian() could produce ln(0) → -infinity/NaN
- AFTER: Clamp inputs to avoid ln(0) with f64::EPSILON
4. Added security_notice.rs module:
- Runtime security status checking
- Production readiness validation
- Comprehensive documentation of limitations
- `production-crypto` feature flag for when real impls are used
5. Test fixes (unrelated to security):
- Fixed test_validator_weight assertion logic
- Fixed test_stats to use initial_value=0
IMPORTANT: The placeholder crypto provides CLASSICAL security only.
For production use, integrate real ML-DSA/ML-KEM implementations.
See security_notice.rs for migration guide.
Added dependencies:
- sha2 = "0.10" for HMAC/HKDF implementations
All 76 tests pass.
Fixes across attention mechanisms, SONA engine, and examples:
Attention mechanisms:
- hierarchical_lorentz: Use dag.node_count(), dag.children() API
- parallel_branch: Replace get_children() with children()
- temporal_btsp: Fix node.estimated_cost access, remove selectivity
- cache: Use dag.node_ids() and dag.children() for iteration
- mincut_gated: Fix return type to match DagAttentionMechanism trait
- selector: Update tests to use OperatorNode::new()
SONA/QuDAG:
- sona/engine: Add deprecated Scan/Join match arms
- ml_kem: Fix unused parameter warnings
- ml_dsa: Fix unused parameter warnings
Examples:
- basic_usage: Use dag.children() instead of get_children()
- learning_workflow: Fix HnswScan/Sort field names, trajectory access
- attention_demo: Import DagAttentionMechanism trait
- attention_selection: Fix CausalConeConfig field names
- self_healing: Remove non-existent result fields
- federated_coherence: Add parentheses for comparison expression
Cargo.toml:
- Register all exotic examples with explicit paths
All 12 examples now build and run successfully.
Six examples demonstrating systems that respond to internal tension
rather than external commands. Intelligence as homeostasis.
1. synthetic_reflex_organism.rs (286 lines)
- No global objective function
- Minimizes structural stress over time
- Learns only when instability crosses thresholds
- "Intelligence as homeostasis, not problem-solving"
2. timing_synchronization.rs (334 lines)
- Machines that feel timing, not data
- Measures when things stop lining up
- Synchronizes with biological rhythms
- "You stop predicting intent. You synchronize with it."
3. coherence_safety.rs (442 lines)
- Capability degradation: Full → Reduced → Conservative → Minimal → Halted
- Self-halts when internal coherence drops
- "Safety becomes structural, not moral"
4. artificial_instincts.rs (406 lines)
- Biases enforced by mincut/attention/healing
- Avoid fragmentation, preserve causality, prefer reversibility
- "Closer to evolution than training"
5. living_simulation.rs (349 lines)
- Simulations that maintain stability under perturbation
- Exposes fragile boundaries, not forecasts
- "No longer modeling reality. Modeling fragility."
6. thought_integrity.rs (421 lines)
- Reasoning integrity monitored like voltage
- Reduce precision, exit early, route to simpler paths
- "Always-on intelligence without runaway cost"
Total: 2,238 lines of exotic coherence-sensing code
- 130KB raw, 58KB gzipped WASM binary
- 13-method API surface (add_node, add_edge, topo_sort, critical_path, attention)
- 3 attention mechanisms (topological, critical path, uniform)
- Binary and JSON serialization
- wee_alloc feature for even smaller builds
- TypeScript type definitions included
Also updates ruvector-dag README with:
- Design philosophy: MinCut as central control signal
- Policy layer for attention mechanism selection
- SONA state vector structure with per-operator LoRA weights
- Predictive healing based on rising cut tension
- External cost model trait for PostgreSQL/embedded/chip schedulers
- QuDAG sync frequency bounds (1min-1hr adaptive)
- End-to-end convergence example with logs