Skip to main content

exo_core/backends/
mod.rs

1//! Substrate backends — ADR-029 pluggable compute substrates for EXO-AI.
2//! Each backend implements SubstrateBackend, providing different computational modalities.
3
4pub mod neuromorphic;
5pub mod quantum_stub;
6
7pub use neuromorphic::NeuromorphicBackend;
8pub use quantum_stub::QuantumStubBackend;
9
10/// Unified substrate backend trait — all compute modalities implement this.
11pub trait SubstrateBackend: Send + Sync {
12    /// Backend identifier
13    fn name(&self) -> &'static str;
14
15    /// Similarity search in the backend's representational space.
16    fn similarity_search(&self, query: &[f32], k: usize) -> Vec<SearchResult>;
17
18    /// One-shot pattern adaptation (analogous to manifold deformation).
19    fn adapt(&mut self, pattern: &[f32], reward: f32) -> AdaptResult;
20
21    /// Check backend health / coherence level (0.0–1.0).
22    fn coherence(&self) -> f32;
23
24    /// Reset/clear backend state.
25    fn reset(&mut self);
26}
27
28#[derive(Debug, Clone)]
29pub struct SearchResult {
30    pub id: u64,
31    pub score: f32,
32    pub embedding: Vec<f32>,
33}
34
35#[derive(Debug, Clone)]
36pub struct AdaptResult {
37    pub delta_norm: f32,
38    pub mode: &'static str,
39    pub latency_us: u64,
40}