Skip to content

An AI agent memory system implemented in Rust with intelligent memory management, knowledge graphs, and temporal tracking.

License

Notifications You must be signed in to change notification settings

njfio/rust-synaptic

Repository files navigation

Synaptic

Rust License: MIT

An AI agent memory system implemented in Rust with intelligent memory management, knowledge graphs, and temporal tracking.

Project Status

  • Library: Rust library with comprehensive test coverage
  • Version: 0.1.0 (development)
  • Architecture: Modular design with optional feature flags
  • Storage: In-memory, file-based, and SQL backends (PostgreSQL)
  • Testing: Comprehensive test suite covering core functionality
  • Build Status: ✅ Clean compilation, zero warnings, zero errors, production-ready codebase
  • Code Quality: ✅ Professional-grade Rust code with comprehensive clippy improvements

Recent Major Improvements

🚀 Zero Warnings Achievement (Latest)

  • Complete Warning Elimination: Eliminated ALL 1755+ compilation warnings to achieve 0 warnings
  • Dead Code Cleanup: Systematically removed hundreds of lines of unused code, methods, and variables
  • Clippy Improvements: Fixed critical clippy warnings including unsafe patterns and performance issues
  • Error Handling: Replaced dangerous unwrap() calls with proper error handling
  • Performance Optimizations: Improved memory usage with array optimizations and efficient patterns
  • Code Style: Enhanced naming conventions, added Default implementations, and improved code structure
  • Test Coverage: Maintained 100% test success rate (191 passing tests) throughout all improvements

🔧 Previous Achievements

  • Advanced Search Scoring: Sophisticated content type scoring algorithm with multi-factor analysis
  • Logging Standardization: Comprehensive structured logging system with tracing integration
  • Search Intelligence: Production-ready content classification for documentation, code, and knowledge content
  • Memory Management: Advanced automatic summarization and lifecycle management
  • Documentation: Comprehensive API documentation and usage guides

Core Features

Memory Management

  • Memory operations (store, retrieve, update, delete)
  • Advanced Search Engine: Sophisticated content type scoring with multi-factor analysis
  • Intelligent memory consolidation and summarization
  • Automatic summarization with multiple strategies
  • Lifecycle management with archival and cleanup
  • Memory optimization and compression
  • Advanced analytics and performance monitoring
  • Structured Logging: Comprehensive tracing and monitoring system

Knowledge Graph

  • Dynamic relationship detection and reasoning
  • Node merging for similar content
  • Graph traversal and pattern analysis
  • Temporal relationship tracking
  • Cross-modal relationship discovery

Storage Backends

  • Memory: In-memory storage for development and testing
  • File: Persistent file-based storage with Sled database
  • SQL: PostgreSQL integration (optional feature)
  • Distributed: Redis caching and coordination (optional)

Security & Privacy

  • AES-256-GCM encryption for sensitive data
  • Access control and audit logging
  • Note: Zero-knowledge proofs and homomorphic encryption are experimental features with limited functionality

Multi-Modal Processing

  • Documents: PDF, Markdown, CSV, text files (basic implementation)
  • Images: Feature extraction, OCR, visual analysis (requires optional dependencies)
  • Audio: Speech processing and feature extraction (requires optional dependencies)
  • Code: Syntax analysis and semantic understanding (requires optional dependencies)
  • Note: Multi-modal features require specific feature flags and external dependencies

Cross-Platform Support

  • WebAssembly: Browser-based applications with IndexedDB storage and web worker support
  • Mobile: iOS (Core Data) and Android (SQLite/Room) with platform-specific optimizations
  • Desktop: Native implementations for Windows, macOS, and Linux
  • Server: High-performance server deployments with distributed capabilities
  • Note: See Cross-Platform Features for detailed compatibility information

Installation

Note: This is a development library not yet published to crates.io.

Clone and build from source:

git clone https://github.com/njfio/rust-synaptic.git
cd rust-synaptic
cargo build

For use in other projects, add to your Cargo.toml:

[dependencies]
synaptic = { git = "https://github.com/njfio/rust-synaptic.git", features = ["analytics"] }

Quick Start

use synaptic::memory::{MemoryEntry, MemoryType};
use synaptic::memory::storage::create_storage;
use synaptic::StorageBackend;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create storage backend
    let storage = create_storage(StorageBackend::Memory).await?;

    // Create a memory entry
    let entry = MemoryEntry::new(
        "user_preference".to_string(),
        "Dark mode enabled".to_string(),
        MemoryType::ShortTerm,
    );

    // Store the memory
    storage.store(&entry).await?;

    // Retrieve the memory
    if let Some(retrieved) = storage.retrieve("user_preference").await? {
        println!("Retrieved: {}", retrieved.value);
    }

    // Search for memories
    let results = storage.search("dark mode", 10).await?;
    println!("Found {} related memories", results.len());

    Ok(())
}

Feature Flags

Core Features (Default)

  • core: Basic memory operations
  • storage: File and memory storage backends
  • bincode: Binary serialization support

Optional Features

  • analytics: Memory analytics and performance monitoring
  • security: Encryption, access control, and privacy features
  • sql-storage: PostgreSQL database backend
  • distributed: Redis caching and distributed coordination
  • multimodal: Multi-modal content processing
  • external-integrations: ML models, LLM, and visualization
  • cross-platform: WebAssembly and mobile support

Convenience Groups

  • full: All features enabled
  • minimal: Core features only

Examples

The project includes comprehensive examples:

# Basic functionality
cargo run --example basic_usage
cargo run --example knowledge_graph_usage

# Advanced features
cargo run --example phase3_analytics --features "analytics"
cargo run --example phase4_security_privacy --features "security"
cargo run --example real_integrations --features "external-integrations"

# Multi-modal processing
cargo run --example phase5_multimodal_crossplatform --features "multimodal"
cargo run --example phase5b_document_demo --features "document-processing"

Testing

# Run all tests
cargo test

# Run with specific features
cargo test --features "analytics security"

# Run specific test suites
cargo test --test security_suite --features "security"
cargo test --test multimodal_suite --features "multimodal"

Development

Setup

git clone https://github.com/njfio/rust-synaptic.git
cd rust-synaptic
cargo build

Using Justfile

The project includes a Justfile for common tasks:

# Show available commands
just

# Development
just build          # Build the project
just test           # Run all tests
just test-features  # Run tests with all features
just clippy         # Run lints

# Infrastructure (requires Docker)
just setup          # Start all services
just services-up    # Start Docker services
just services-down  # Stop Docker services

Project Structure

src/
├── lib.rs                    # Library entry point
├── memory/                   # Core memory system
│   ├── storage/             # Storage backends
│   ├── knowledge_graph/     # Graph operations
│   ├── management/          # Memory management
│   ├── temporal/            # Temporal tracking
│   └── embeddings/          # Vector embeddings
├── analytics/               # Analytics and monitoring
├── security/                # Security and privacy
├── integrations/            # External integrations
├── multimodal/              # Multi-modal processing
├── distributed/             # Distributed systems
└── cross_platform/          # Cross-platform support

Documentation

Comprehensive Guides

API Documentation

Generate and view Rust API documentation:

cargo doc --all-features --no-deps --open

Quick Links

Contributing

See CONTRIBUTING.md for development setup, coding standards, and contribution guidelines.

Development Status & Limitations

Experimental Features

  • Homomorphic Encryption: Limited functionality, not production-ready
  • Zero-Knowledge Proofs: Basic implementation, experimental status
  • WebAssembly Support: Experimental, may have performance limitations
  • Mobile Platform Support: Basic implementation, requires testing

External Dependencies

  • Multi-modal Processing: Requires heavy external dependencies (OpenCV, Tesseract, etc.)
  • ML Models: Integration requires external model files and configuration
  • Distributed Features: Some components are simplified for development

Production Readiness

  • Core Memory System: Production-ready with comprehensive tests and clean compilation
  • Knowledge Graph: Stable implementation with good test coverage
  • Storage Backends: Memory and file storage are stable, SQL storage functional
  • Analytics: Basic analytics implemented, advanced features in development
  • Build Quality: Zero compilation errors, clean codebase ready for production deployment

License

MIT License - see LICENSE file for details.

About

An AI agent memory system implemented in Rust with intelligent memory management, knowledge graphs, and temporal tracking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages