|
1 |
| -# Synaptic |
2 |
| - |
3 |
| -[](https://www.rust-lang.org) |
4 |
| -[](https://opensource.org/licenses/MIT) |
5 |
| -[](https://github.com/njfio/rust-synaptic) |
6 |
| - |
7 |
| -**Synaptic** is an intelligent AI agent memory system implemented in Rust. It provides sophisticated memory management, advanced search capabilities, knowledge graph functionality, temporal tracking, and multi-modal content processing for AI applications. |
8 |
| - |
9 |
| -## 🚀 Key Features |
10 |
| - |
11 |
| -- **115 Passing Tests** with comprehensive library and integration test coverage |
12 |
| -- **Core Memory Operations** with intelligent storage, retrieval, search, and lifecycle management |
13 |
| -- **Knowledge Graph Integration** with relationship discovery and graph-based queries |
14 |
| -- **Advanced Search Engine** with multiple similarity algorithms and ranking strategies |
15 |
| -- **Temporal Intelligence** with memory evolution tracking and pattern detection |
16 |
| -- **Security Features** including AES-256-GCM encryption and access control |
17 |
| -- **CLI Interface** with SyQL (Synaptic Query Language) support |
18 |
| -- **Multi-Modal Processing** for documents, images, audio, and code analysis |
19 |
| -- **External Integrations** with PostgreSQL, Redis, and ML model support |
20 |
| - |
21 |
| -## Core Features |
22 |
| - |
23 |
| -### Memory Operations |
24 |
| - |
25 |
| -- **Storage & Retrieval**: Store, retrieve, update, and delete memory entries with full async support |
26 |
| -- **Advanced Search**: Text-based search with similarity scoring and relevance ranking |
27 |
| -- **Memory Types**: Support for short-term and long-term memory classification |
28 |
| -- **Metadata Management**: Rich metadata including tags, importance scores, and access tracking |
29 |
| - |
30 |
| -### Knowledge Graph |
31 |
| - |
32 |
| -- **Relationship Discovery**: Automatic detection of relationships between memory entries |
33 |
| -- **Graph Traversal**: Find related memories through graph connections |
34 |
| -- **Centrality Analysis**: Calculate importance based on graph position and connectivity |
35 |
| -- **Relationship Types**: Support for various relationship types (semantic, temporal, causal) |
36 |
| - |
37 |
| -### Temporal Intelligence |
38 |
| - |
39 |
| -- **Memory Evolution**: Track changes to memory entries over time using Myers' diff algorithm |
40 |
| -- **Pattern Detection**: Identify temporal patterns in memory access and creation |
41 |
| -- **Decay Models**: Implement forgetting curves and memory decay algorithms |
42 |
| -- **Temporal Queries**: Search memories based on time-based criteria |
43 |
| - |
44 |
| -### Advanced Management |
45 |
| - |
46 |
| -- **Memory Summarization**: Intelligent consolidation of related memories |
47 |
| -- **Lifecycle Management**: Automated archiving and cleanup policies |
48 |
| -- **Performance Optimization**: Dynamic optimization of storage and retrieval operations |
49 |
| -- **Analytics Engine**: Comprehensive analysis of memory usage patterns and performance |
50 |
| - |
51 |
| -### Security & Privacy |
52 |
| - |
53 |
| -- **AES-256-GCM Encryption**: Strong encryption for sensitive memory data |
54 |
| -- **Access Control**: Role-based access control with security contexts |
55 |
| -- **Audit Logging**: Comprehensive logging of all memory operations |
56 |
| -- **Data Privacy**: Privacy-preserving operations with differential privacy support |
57 |
| - |
58 |
| -### Multi-Modal Processing |
59 |
| - |
60 |
| -- **Document Processing**: Extract content from PDF, Markdown, CSV, and other document formats |
61 |
| -- **Image Analysis**: Basic image processing and feature extraction capabilities |
62 |
| -- **Audio Processing**: Audio content analysis and transcription support |
63 |
| -- **Code Analysis**: Parse and analyze source code using tree-sitter |
64 |
| - |
65 |
| -## Architecture |
66 |
| - |
67 |
| -### Storage Backends |
68 |
| - |
69 |
| -- **In-Memory Storage**: Fast, volatile storage for development and testing |
70 |
| -- **File-Based Storage**: Persistent storage using Sled embedded database |
71 |
| -- **SQL Database Support**: PostgreSQL integration with connection pooling (optional feature) |
72 |
| -- **Storage Middleware**: Compression and encryption layers for enhanced storage |
73 |
| - |
74 |
| -### CLI Interface |
75 |
| - |
76 |
| -- **Interactive Shell**: Full-featured shell with command history and auto-completion |
77 |
| -- **SyQL Query Language**: SQL-like query language for memory operations |
78 |
| -- **Memory Commands**: Direct memory management through CLI commands |
79 |
| -- **Performance Profiling**: Built-in profiling and benchmarking tools |
80 |
| - |
81 |
| -### External Integrations |
82 |
| - |
83 |
| -- **Database Integration**: PostgreSQL support with async connection pooling |
84 |
| -- **Redis Caching**: Optional Redis integration for distributed caching |
85 |
| -- **ML Model Support**: Framework for integrating machine learning models |
86 |
| -- **Visualization**: Basic plotting and visualization capabilities |
87 |
| - |
88 |
| -## Implementation Status |
89 |
| - |
90 |
| -### Test Coverage |
91 |
| - |
92 |
| -- **115 Library Tests**: Comprehensive unit tests covering core functionality |
93 |
| -- **1 Integration Test**: Basic integration testing for key workflows |
94 |
| -- **15 Documentation Tests**: All code examples in documentation are tested |
95 |
| -- **Clean Compilation**: All code compiles without errors |
96 |
| - |
97 |
| -### Core Features Status |
98 |
| - |
99 |
| -- **✅ Memory Operations**: Store, retrieve, update, delete operations fully implemented |
100 |
| -- **✅ Search Engine**: Text-based search with similarity scoring working |
101 |
| -- **✅ Knowledge Graph**: Relationship discovery and graph operations implemented |
102 |
| -- **✅ Temporal Tracking**: Memory evolution and pattern detection functional |
103 |
| -- **✅ Security**: AES-256-GCM encryption and access control implemented |
104 |
| -- **✅ CLI Interface**: Interactive shell and SyQL query language working |
105 |
| -- **✅ Storage Backends**: In-memory, file-based, and SQL storage options available |
106 |
| - |
107 |
| -### Optional Features |
108 |
| - |
109 |
| -- **🔧 Multi-Modal Processing**: Document, image, and audio processing (requires feature flags) |
110 |
| -- **🔧 External Integrations**: PostgreSQL, Redis, ML models (requires feature flags) |
111 |
| -- **🔧 Advanced Security**: Homomorphic encryption, zero-knowledge proofs (requires feature flags) |
112 |
| -- **🔧 Distributed Features**: Kafka, clustering support (requires feature flags) |
113 |
| - |
114 |
| -## Installation |
115 |
| - |
116 |
| -Add Synaptic to your `Cargo.toml`: |
117 |
| - |
118 |
| -```toml |
119 |
| -[dependencies] |
120 |
| -synaptic = "0.1.0" |
121 |
| - |
122 |
| -# For additional features |
123 |
| -synaptic = { version = "0.1.0", features = ["sql-storage", "analytics", "security"] } |
124 |
| -``` |
125 |
| - |
126 |
| -## Quick Start |
127 |
| - |
128 |
| -### Basic Memory Operations |
129 |
| - |
130 |
| -```rust |
131 |
| -use synaptic::memory::{MemoryEntry, MemoryType}; |
132 |
| -use synaptic::memory::storage::create_storage; |
133 |
| -use synaptic::StorageBackend; |
134 |
| - |
135 |
| -#[tokio::main] |
136 |
| -async fn main() -> Result<(), Box<dyn std::error::Error>> { |
137 |
| - // Create storage backend |
138 |
| - let storage = create_storage(StorageBackend::Memory).await?; |
139 |
| - |
140 |
| - // Create a memory entry |
141 |
| - let entry = MemoryEntry::new( |
142 |
| - "user_preference".to_string(), |
143 |
| - "Dark mode enabled".to_string(), |
144 |
| - MemoryType::ShortTerm, |
145 |
| - ); |
146 |
| - |
147 |
| - // Store the memory |
148 |
| - storage.store(&entry).await?; |
149 |
| - |
150 |
| - // Retrieve the memory |
151 |
| - if let Some(retrieved) = storage.retrieve("user_preference").await? { |
152 |
| - println!("Retrieved: {}", retrieved.value); |
153 |
| - } |
154 |
| - |
155 |
| - // Search for memories |
156 |
| - let results = storage.search("dark mode", 10).await?; |
157 |
| - println!("Found {} related memories", results.len()); |
158 |
| - |
159 |
| - Ok(()) |
160 |
| -} |
161 |
| -``` |
162 |
| - |
163 |
| -### Using the CLI |
164 |
| - |
165 |
| -```bash |
166 |
| -# Start interactive shell |
167 |
| -synaptic shell |
168 |
| - |
169 |
| -# Execute SyQL queries |
170 |
| -synaptic query "SELECT * FROM memories WHERE type = 'long_term' LIMIT 5" |
171 |
| - |
172 |
| -# Memory operations |
173 |
| -synaptic memory list --limit 10 |
174 |
| -synaptic memory show --id "user_preference" |
175 |
| -``` |
176 |
| - |
177 |
| -## Testing |
178 |
| - |
179 |
| -### Running Tests |
180 |
| - |
181 |
| -```bash |
182 |
| -# Run all tests |
183 |
| -cargo test |
184 |
| - |
185 |
| -# Run library tests only |
186 |
| -cargo test --lib |
187 |
| - |
188 |
| -# Run with specific features |
189 |
| -cargo test --features "analytics security" |
190 |
| - |
191 |
| -# Run documentation tests |
192 |
| -cargo test --doc |
193 |
| - |
194 |
| -# Run integration tests |
195 |
| -cargo test --test integration_tests |
196 |
| -``` |
197 |
| - |
198 |
| -### Test Coverage |
199 |
| - |
200 |
| -- **115 Library Tests**: Core functionality and unit tests |
201 |
| -- **1 Integration Test**: End-to-end workflow testing |
202 |
| -- **15 Documentation Tests**: Code examples in documentation |
203 |
| -- **Clean Compilation**: All tests compile and run successfully |
204 |
| - |
205 |
| -## Examples |
206 |
| - |
207 |
| -### Available Examples |
208 |
| - |
209 |
| -- **[Basic Usage](examples/basic_usage.rs)**: Core memory operations and basic functionality |
210 |
| -- **[Knowledge Graph](examples/knowledge_graph_usage.rs)**: Relationship management and graph operations |
211 |
| -- **[Intelligent Updates](examples/intelligent_updates.rs)**: Smart memory updates and deduplication |
212 |
| -- **[Security Demo](examples/simple_security_demo.rs)**: Encryption and security features |
213 |
| -- **[Real Integrations](examples/real_integrations.rs)**: External service integrations |
214 |
| -- **[Enhanced Statistics](examples/enhanced_memory_statistics.rs)**: Memory analytics and monitoring |
215 |
| - |
216 |
| -### Running Examples |
217 |
| - |
218 |
| -```bash |
219 |
| -# Basic functionality |
220 |
| -cargo run --example basic_usage |
221 |
| -cargo run --example knowledge_graph_usage |
222 |
| - |
223 |
| -# Advanced features |
224 |
| -cargo run --example intelligent_updates |
225 |
| -cargo run --example simple_security_demo |
226 |
| - |
227 |
| -# With optional features |
228 |
| -cargo run --example real_integrations --features "sql-storage" |
229 |
| -cargo run --example enhanced_memory_statistics --features "analytics" |
230 |
| -``` |
231 |
| - |
232 |
| -## Features by Category |
233 |
| - |
234 |
| -### Core Features (Default) |
235 |
| - |
236 |
| -- Memory operations (store, retrieve, update, delete) |
237 |
| -- In-memory and file-based storage |
238 |
| -- Basic search and retrieval |
239 |
| -- Memory metadata and tagging |
240 |
| - |
241 |
| -### Optional Features |
242 |
| - |
243 |
| -Enable additional functionality with feature flags: |
244 |
| - |
245 |
| -```toml |
246 |
| -[dependencies] |
247 |
| -synaptic = { version = "0.1.0", features = ["analytics", "security", "sql-storage"] } |
248 |
| -``` |
249 |
| - |
250 |
| -- **`analytics`**: Advanced memory analytics and performance monitoring |
251 |
| -- **`security`**: AES-256-GCM encryption and access control |
252 |
| -- **`sql-storage`**: PostgreSQL database backend support |
253 |
| -- **`multimodal`**: Document, image, and audio processing |
254 |
| -- **`distributed`**: Redis caching and distributed coordination |
255 |
| -- **`ml-models`**: Machine learning model integration |
256 |
| -- **`visualization`**: Plotting and visualization capabilities |
257 |
| - |
258 |
| -## Development |
259 |
| - |
260 |
| -### Setup |
261 |
| - |
262 |
| -```bash |
263 |
| -# Clone the repository |
264 |
| -git clone https://github.com/njfio/rust-synaptic.git |
265 |
| -cd rust-synaptic |
266 |
| - |
267 |
| -# Build the project |
268 |
| -cargo build |
269 |
| - |
270 |
| -# Run tests |
271 |
| -cargo test |
272 |
| -``` |
273 |
| - |
274 |
| -### Development Commands |
275 |
| - |
276 |
| -```bash |
277 |
| -# Code formatting |
278 |
| -cargo fmt |
279 |
| - |
280 |
| -# Linting |
281 |
| -cargo clippy --all-targets --all-features |
282 |
| - |
283 |
| -# Generate documentation |
284 |
| -cargo doc --all-features --no-deps --open |
285 |
| - |
286 |
| -# Run with specific features |
287 |
| -cargo run --features "analytics security" |
288 |
| - |
289 |
| -# Build for release |
290 |
| -cargo build --release |
291 |
| -``` |
292 |
| - |
293 |
| -## API Reference |
294 |
| - |
295 |
| -Generate and view the API documentation: |
296 |
| - |
297 |
| -```bash |
298 |
| -cargo doc --all-features --no-deps --open |
299 |
| -``` |
300 |
| - |
301 |
| -Key modules: |
302 |
| - |
303 |
| -- `synaptic::memory` - Core memory operations and types |
304 |
| -- `synaptic::memory::storage` - Storage backend implementations |
305 |
| -- `synaptic::memory::knowledge_graph` - Knowledge graph functionality |
306 |
| -- `synaptic::memory::temporal` - Temporal tracking and analysis |
307 |
| -- `synaptic::cli` - Command-line interface |
308 |
| -- `synaptic::security` - Security and encryption features |
309 |
| - |
310 |
| -## Contributing |
311 |
| - |
312 |
| -Contributions are welcome! Please feel free to submit a Pull Request. |
313 |
| - |
314 |
| -1. Fork the repository |
315 |
| -2. Create a feature branch |
316 |
| -3. Make your changes |
317 |
| -4. Add tests for new functionality |
318 |
| -5. Ensure all tests pass: `cargo test` |
319 |
| -6. Submit a pull request |
320 |
| - |
321 |
| -## License |
322 |
| - |
323 |
| -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments