File size: 4,895 Bytes
8ef2d83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//! # ARMS - Attention Reasoning Memory Store
//!
//! > "The hippocampus of artificial minds"
//!
//! ARMS is a spatial memory fabric for AI models. It stores computed attention
//! states at their native dimensional coordinates, enabling instant retrieval
//! by proximity rather than traditional indexing.
//!
//! ## Philosophy
//!
//! - **Position IS relationship** - No foreign keys, proximity defines connection
//! - **Configurable, not hardcoded** - Dimensionality, proximity functions, all flexible
//! - **Generators over assets** - Algorithms, not rigid structures
//! - **Pure core, swappable adapters** - Hexagonal architecture
//!
//! ## Architecture
//!
//! ```text
//! β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
//! β”‚                         ARMS                                 β”‚
//! β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
//! β”‚                                                              β”‚
//! β”‚  CORE (pure math, no I/O)                                   β”‚
//! β”‚    Point, Id, Blob, Proximity, Merge                        β”‚
//! β”‚                                                              β”‚
//! β”‚  PORTS (trait contracts)                                     β”‚
//! β”‚    Place, Near, Latency                                     β”‚
//! β”‚                                                              β”‚
//! β”‚  ADAPTERS (swappable implementations)                       β”‚
//! β”‚    Storage: Memory, NVMe                                    β”‚
//! β”‚    Index: Flat, HNSW                                        β”‚
//! β”‚    API: Python bindings                                      β”‚
//! β”‚                                                              β”‚
//! β”‚  ENGINE (orchestration)                                      β”‚
//! β”‚    Arms - the main entry point                              β”‚
//! β”‚                                                              β”‚
//! β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
//! ```
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use arms::{Arms, ArmsConfig, Point};
//!
//! // Create ARMS with default config (768 dimensions)
//! let mut arms = Arms::new(ArmsConfig::default());
//!
//! // Place a point in the space
//! let point = Point::new(vec![0.1; 768]);
//! let id = arms.place(point, b"my data".to_vec());
//!
//! // Find nearby points
//! let query = Point::new(vec![0.1; 768]);
//! let neighbors = arms.near(&query, 5);
//! ```

// ============================================================================
// MODULES
// ============================================================================

/// Core domain - pure math, no I/O
/// Contains: Point, Id, Blob, Proximity trait, Merge trait
pub mod core;

/// Port definitions - trait contracts for adapters
/// Contains: Place trait, Near trait, Latency trait
pub mod ports;

/// Adapter implementations - swappable components
/// Contains: storage, index, python submodules
pub mod adapters;

/// Engine - orchestration layer
/// Contains: Arms main struct
pub mod engine;

// ============================================================================
// PYTHON BINDINGS (when enabled)
// ============================================================================

#[cfg(feature = "python")]
pub use adapters::python::*;

// ============================================================================
// RE-EXPORTS (public API)
// ============================================================================

// Core types
pub use crate::core::{Point, Id, Blob, PlacedPoint};
pub use crate::core::proximity::{Proximity, Cosine, Euclidean, DotProduct};
pub use crate::core::merge::{Merge, Mean, WeightedMean, MaxPool};
pub use crate::core::config::ArmsConfig;

// Port traits
pub use crate::ports::{Place, Near, Latency};

// Engine
pub use crate::engine::Arms;

// ============================================================================
// CRATE-LEVEL DOCUMENTATION
// ============================================================================

/// The five primitives of ARMS:
///
/// 1. **Point**: `Vec<f32>` - Any dimensionality
/// 2. **Proximity**: `fn(a, b) -> f32` - How related?
/// 3. **Merge**: `fn(points) -> point` - Compose together
/// 4. **Place**: `fn(point, data) -> id` - Exist in space
/// 5. **Near**: `fn(point, k) -> ids` - What's related?
///
/// Everything else is configuration or adapters.
#[doc(hidden)]
pub const _PRIMITIVES: () = ();