mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
Phase 5 — Wedge 8: PortfolioCovarianceAdapter
Symmetric PD covariance matrix Σ for mean-variance Σx = μ. CG is the
upstream 1.7.0 hot path (816 ns @ n=256, 40-60× vs Neumann). Adapter
symmetrises one-sided entries automatically and applies a ridge
(default 1e-6) to keep Σ SPD even when empirical covariance is
rank-deficient. Exposes expectedReturnsVector(matrix) helper aligned
with the matrix's node order for the b vector.
Phase 6 — Wedges 9/10/11 + JL fix:
AIDefenceSuspicionAdapter (ruflo-aidefence:call-graph)
Reverse-direction call graph (callee → caller) so suspicion
propagates from flagged syscall back through the caller chain.
Recommends α=0.95 for callers (high decay = suspicion travels far).
JujutsuBlastRadiusAdapter (ruflo-jujutsu:import-graph)
File-import graph oriented importee → importer for change
propagation. PR seeded at changed file returns downstream blast.
jlEmbed (infrastructure/jl-embed.ts)
Real Johnson-Lindenstrauss with Achlioptas/Dasgupta-Gupta bound
(target_dim ≤ n − 1) enforced. Deterministic Gaussian projection
seeded by content hash so embeddings are reproducible. Replaces
@claude-flow/embeddings hand-rolled JL (closes ADR-121 Phase 4).
sublinear/feasibility tool — now ships a Lagrangian-shrink LP
feasibility heuristic (200-iter pass with stepSize 0.05) instead of
the Phase 1 stub. Returns witness on success or
certificateOfInfeasibility on failure. Supports leq/geq/eq kinds.
80/80 tests passing (+17 since Phase 4):
- phase5-portfolio.test.ts: 4 (symmetrise, CG solve, ridge, end-to-end)
- phase6-adapters.test.ts: 13 (AIDefence reverse-direction, jujutsu
blast orientation, JL Achlioptas cap, JL projection, JL MCP tool,
GOAP feasible+witness+infeasible cases)
Co-Authored-By: RuFlo <ruv@ruv.net>