Skip to content

feat: neural trader — market graph types, MinCut coherence gate, reservoir replay#244

Open
ruvnet wants to merge 4 commits intomainfrom
feat/neural-trader
Open

feat: neural trader — market graph types, MinCut coherence gate, reservoir replay#244
ruvnet wants to merge 4 commits intomainfrom
feat/neural-trader

Conversation

@ruvnet
Copy link
Owner

@ruvnet ruvnet commented Mar 6, 2026

Summary

  • Adds 3 new crates implementing the first 3 layers of the Neural Trader architecture (ADR-085):
    • neural-trader-core — Canonical market event types (MarketEvent, GraphDelta), ingest pipeline traits (EventIngestor, GraphUpdater, Embedder), and graph schema
    • neural-trader-coherence — MinCut coherence gate with CUSUM drift detection, tiered permission system (retrieve > write/act > learn), and regime-dependent volatility floors
    • neural-trader-replay — Reservoir store with capacity-bounded VecDeque, gated writes through coherence gate, and witness receipt logging
  • Renumbers ADR from 084 → 085 (084 is taken by ruvllm-wasm-publish)
  • Fixes: serde_json moved to dev-deps in core, unused neural-trader-core dep removed from coherence
  • All 12 tests pass (7 coherence + 2 core + 3 replay)

Architecture (ADR-085)

Six-layer pipeline treating the limit order book as a dynamic heterogeneous typed graph:

L1 Ingest → L2 Graph → L3 GNN+Attention → L4 Memory → L5 Coherence → L6 Policy

This PR implements L1 (types/ingest), L5 (coherence gate), and L4 (replay store). Remaining layers (L2 graph construction, L3 GNN embeddings, L6 policy actuation) are tracked for follow-up.

Test plan

  • cargo check -p neural-trader-{core,coherence,replay} — compiles clean
  • cargo test -p neural-trader-{core,coherence,replay} — 12/12 pass
  • ADR-084 collision resolved (renumbered to ADR-085)
  • Review: coherence gate threshold tuning for real market data
  • Follow-up: remaining 7 crates from ADR-085 roadmap

🤖 Generated with claude-flow

claude and others added 3 commits March 6, 2026 19:11
ADR-084 defines the RuVector-native Neural Trader architecture using
dynamic market graphs, mincut coherence gating, and proof-gated mutation.
Includes three starter crates (neural-trader-core, neural-trader-coherence,
neural-trader-replay) with canonical types, threshold gate, reservoir
memory store, and 10 passing tests.

https://claude.ai/code/session_01EExDkEDv4eejvfgqUWnSks
ADR:
- Add SQL indexes on (symbol_id, ts_ns) for all tables
- Add HNSW index on nt_embeddings.embedding
- Range-partition nt_event_log and nt_segments by timestamp
- Add retention config (hot/warm/cold TTL) to example YAML
- Add retrieval weight normalization constraint (α+β+γ+δ=1)
- Cross-reference existing examples/neural-trader/

Code:
- core: Replace String property keys with PropertyKey enum (zero alloc)
- core: Add PartialEq on MarketEvent for test assertions
- coherence: Fix redundant drift check — learning now requires half
  drift margin (stricter than act/write)
- coherence: Add boundary_stable_count to GateContext and enforce
  boundary stability window threshold from ADR gate policy
- coherence: Add PartialEq on CoherenceDecision
- coherence: Add 2 new tests (high_drift, boundary_instability)
- replay: Switch ReservoirStore from Vec to VecDeque for O(1) eviction
- replay: Use RegimeLabel enum instead of Option<String> in MemoryQuery

12 tests pass (was 10).

https://claude.ai/code/session_01EExDkEDv4eejvfgqUWnSks
- Rename ADR-084-neural-trader to ADR-085 (ADR-084 is taken by ruvllm-wasm-publish)
- Move serde_json to dev-dependencies in neural-trader-core (only used in tests)
- Remove unused neural-trader-core dependency from neural-trader-coherence

Co-Authored-By: claude-flow <ruv@ruv.net>
Co-Authored-By: claude-flow <ruv@ruv.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants